8#include <QGraphicsTextItem>
16 std::map<std::string, DataHolderLib::Color>* stratColors,
18 : QGraphicsScene(parent)
21 int stratBarOffset = 250;
23 QFont font(
"Arial", 15, QFont::DemiBold,
false);
28 "\"" + QString::fromStdString(station->
getName()) +
"\"", font);
30 boreholeTag->setPos((textBounds.width() / 2.0), 80);
32 boreholeName->setPos((textBounds.width() / 2.0), 200);
35 "Depth: " + QString::number(station->
getDepth()) +
" m");
37 totalDepth->setPos((textBounds.width() / 2.0), 350);
48 stratBar->setPos(stratBarOffset,
MARGIN);
52 stratBarOffset + stratBarBounds.width());
57 stratBarOffset + (stratBarBounds.width() / 2));
68 std::vector<QNonScalableGraphicsTextItem*> depthText;
71 textBounds = depthText[0]->boundingRect();
72 depthText[0]->setPos(offset + textBounds.width() / 2, vertPos);
74 for (std::size_t i = 1; i < profile.size(); i++)
78 vertPos += log((*(profile[i - 1]))[2] - (*(profile[i]))[2] + 1) * 100;
79 textBounds = depthText[i]->boundingRect();
80 depthText[i]->setPos(offset + textBounds.width() / 2, vertPos);
85 const QString& text,
const QFont& font)
94 std::vector<GeoLib::Point*>
100 double halfHeight = 0;
101 std::vector<QNonScalableGraphicsTextItem*> soilText;
105 soilText[0]->setPos(offset , vertPos);
107 for (std::size_t i = 1; i < soilNames.size(); i++)
112 log((*(profile[i - 1]))[2] - (*(profile[i]))[2] + 1) * 100 / 2;
114 soilText[i]->setPos(offset ,
115 vertPos + halfHeight);
116 vertPos += (2 * halfHeight);
122 std::map<std::string, DataHolderLib::Color>* stratColors)
124 auto* b =
new StratBar(station, stratColors);
A borehole as a geometric object.
const std::vector< std::string > & getSoilNames() const
const std::vector< Point * > & getProfile() const
std::string const & getName() const
Returns the name of the station.
A QGraphicsTextItem that will ignore all geometric transformations.
QRectF boundingRect() const override
Returns the bounding rectangle of the text item.
A 2D bar visualisation of a borehole stratigraphy.
QRectF boundingRect() const override
Returns the bounding rectangle of the bar.
QNonScalableGraphicsTextItem * addNonScalableText(const QString &text, const QFont &font=QFont())
Add a non-scalable text item to the scene.
void addSoilNameLabels(std::vector< std::string > soilNames, std::vector< GeoLib::Point * > profile, double offset)
Adds text labels indicating the name of each soil layer.
StratScene(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr, QObject *parent=nullptr)
Constructor.
void addDepthLabels(std::vector< GeoLib::Point * > profile, double offset)
Adds text labels indicating the depth at the beginning and end of each soil layer.
static const int MARGIN
The margin between the boundary of the scene and the bounding box of all items within the scene.
StratBar * addStratBar(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr)
Add a stratigraphy-bar to the scene.