OGS
StratBar.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <cmath>
18
19#include <QGraphicsItem>
20
23
29class StratBar : public QGraphicsItem
30{
31public:
38 explicit StratBar(
40 std::map<std::string, DataHolderLib::Color>* stratColors = nullptr,
41 QGraphicsItem* parent = nullptr);
42 ~StratBar() override = default;
43
45 QRectF boundingRect() const override;
46
48 void paint(QPainter* painter,
49 const QStyleOptionGraphicsItem* option,
50 QWidget* widget) override;
51
52private:
57 double logHeight(double h) const { return log(h + 1) * 100; }
58
60 double totalLogHeight() const;
61
63 static const int BARWIDTH = 50;
64
66 std::map<std::string, DataHolderLib::Color> _stratColors;
67};
Definition of the Color class.
Definition of the StationBorehole class.
A borehole as a geometric object.
A 2D bar visualisation of a borehole stratigraphy.
Definition StratBar.h:30
double logHeight(double h) const
Calculates the height for a soil layer by "log(d+1)*100".
Definition StratBar.h:57
double totalLogHeight() const
Calculates the total height of the bar by calculating and adding the log-height for all layers in the...
Definition StratBar.cpp:81
~StratBar() override=default
static const int BARWIDTH
The default width of the bar.
Definition StratBar.h:63
QRectF boundingRect() const override
Returns the bounding rectangle of the bar.
Definition StratBar.cpp:30
std::map< std::string, DataHolderLib::Color > _stratColors
Definition StratBar.h:66
GeoLib::StationBorehole * _station
Definition StratBar.h:65
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints the bar.
Definition StratBar.cpp:35
StratBar(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr, QGraphicsItem *parent=nullptr)
Constructor.
Definition StratBar.cpp:19