OGS
StratView.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include "StratScene.h"
7#include <QGraphicsView>
8#include <QWidget>
9
10
11namespace GeoLib
12{
13class StationBorehole;
14}
15
19class StratView : public QGraphicsView
20{
21 Q_OBJECT
22public:
26 explicit StratView(QWidget* parent = nullptr) { Q_UNUSED(parent); }
27 ~StratView() override;
28
31 std::map<std::string, DataHolderLib::Color>* stratColors = nullptr);
32
34 int getHeight() { return static_cast<int>((_scene->itemsBoundingRect()).height()); }
35
37 int getWidth() { return static_cast<int>((_scene->itemsBoundingRect()).width()); }
38
39 void saveAsImage(QString fileName);
40
41protected:
43 void resizeEvent(QResizeEvent* event) override;
44
45private:
47 void initialize();
48
50 QSize minimumSizeHint() const override
51 {
52 return QSize(3 * _scene->MARGIN, 2 * _scene->MARGIN);
53 }
54
56 QSize sizeHint() const override
57 {
58 return QSize(6 * _scene->MARGIN, 4 * _scene->MARGIN);
59 }
60
62 void update();
63
64 StratScene* _scene{nullptr};
65};
A borehole as a geometric object.
The scene for the visualisation of the stratigraphy of a borehole.
Definition StratScene.h:18
~StratView() override
Definition StratView.cpp:10
void saveAsImage(QString fileName)
Definition StratView.cpp:48
void update()
Updates the view automatically when a Borehole is added or when the window containing the view change...
Definition StratView.cpp:38
StratView(QWidget *parent=nullptr)
Definition StratView.h:26
int getHeight()
Returns the height of the bounding rectangle of all objects within the scene.
Definition StratView.h:34
void initialize()
Initialises the view.
Definition StratView.cpp:24
StratScene * _scene
Definition StratView.h:64
void setStation(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr)
Sets the Borehole whose data should be visualised.
Definition StratView.cpp:15
QSize minimumSizeHint() const override
The minimum size of the window.
Definition StratView.h:50
void resizeEvent(QResizeEvent *event) override
Resizes the scene.
Definition StratView.cpp:32
int getWidth()
Returns the width of the bounding rectangle of all objects within the scene.
Definition StratView.h:37
QSize sizeHint() const override
The default size of the window.
Definition StratView.h:56