OGS
StratView.h
Go to the documentation of this file.
1
15#pragma once
16
17#include "StratScene.h"
18#include <QGraphicsView>
19#include <QWidget>
20
21
22namespace GeoLib
23{
24class StationBorehole;
25}
26
30class StratView : public QGraphicsView
31{
32 Q_OBJECT
33public:
37 explicit StratView(QWidget* parent = nullptr) { Q_UNUSED(parent); }
38 ~StratView() override;
39
42 std::map<std::string, DataHolderLib::Color>* stratColors = nullptr);
43
45 int getHeight() { return static_cast<int>((_scene->itemsBoundingRect()).height()); }
46
48 int getWidth() { return static_cast<int>((_scene->itemsBoundingRect()).width()); }
49
50 void saveAsImage(QString fileName);
51
52protected:
54 void resizeEvent(QResizeEvent* event) override;
55
56private:
58 void initialize();
59
61 QSize minimumSizeHint() const override
62 {
63 return QSize(3 * _scene->MARGIN, 2 * _scene->MARGIN);
64 }
65
67 QSize sizeHint() const override
68 {
69 return QSize(6 * _scene->MARGIN, 4 * _scene->MARGIN);
70 }
71
73 void update();
74
75 StratScene* _scene{nullptr};
76};
Definition of the StratScene class.
A borehole as a geometric object.
The scene for the visualisation of the stratigraphy of a borehole.
Definition StratScene.h:29
static const int MARGIN
The margin between the boundary of the scene and the bounding box of all items within the scene.
Definition StratScene.h:39
A view in which to display the stratigraphy of a borehole.
Definition StratView.h:31
~StratView() override
Definition StratView.cpp:21
void saveAsImage(QString fileName)
Definition StratView.cpp:59
void update()
Updates the view automatically when a Borehole is added or when the window containing the view change...
Definition StratView.cpp:49
StratView(QWidget *parent=nullptr)
Definition StratView.h:37
int getHeight()
Returns the height of the bounding rectangle of all objects within the scene.
Definition StratView.h:45
void initialize()
Initialises the view.
Definition StratView.cpp:35
StratScene * _scene
Definition StratView.h:75
void setStation(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr)
Sets the Borehole whose data should be visualised.
Definition StratView.cpp:26
QSize minimumSizeHint() const override
The minimum size of the window.
Definition StratView.h:61
void resizeEvent(QResizeEvent *event) override
Resizes the scene.
Definition StratView.cpp:43
int getWidth()
Returns the width of the bounding rectangle of all objects within the scene.
Definition StratView.h:48
QSize sizeHint() const override
The default size of the window.
Definition StratView.h:67