OGS
StratBar.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 <cmath>
7
8#include <QGraphicsItem>
9
12
18class StratBar : public QGraphicsItem
19{
20public:
27 explicit StratBar(
29 std::map<std::string, DataHolderLib::Color>* stratColors = nullptr,
30 QGraphicsItem* parent = nullptr);
31 ~StratBar() override = default;
32
34 QRectF boundingRect() const override;
35
37 void paint(QPainter* painter,
38 const QStyleOptionGraphicsItem* option,
39 QWidget* widget) override;
40
41private:
46 double logHeight(double h) const { return log(h + 1) * 100; }
47
49 double totalLogHeight() const;
50
52 static const int BARWIDTH = 50;
53
55 std::map<std::string, DataHolderLib::Color> _stratColors;
56};
A borehole as a geometric object.
double logHeight(double h) const
Calculates the height for a soil layer by "log(d+1)*100".
Definition StratBar.h:46
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:70
~StratBar() override=default
static const int BARWIDTH
The default width of the bar.
Definition StratBar.h:52
QRectF boundingRect() const override
Returns the bounding rectangle of the bar.
Definition StratBar.cpp:19
std::map< std::string, DataHolderLib::Color > _stratColors
Definition StratBar.h:55
GeoLib::StationBorehole * _station
Definition StratBar.h:54
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints the bar.
Definition StratBar.cpp:24
StratBar(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr, QGraphicsItem *parent=nullptr)
Constructor.
Definition StratBar.cpp:8