19#include <QGraphicsTextItem>
27 std::map<std::string, DataHolderLib::Color>* stratColors,
29 : QGraphicsScene(parent)
32 int stratBarOffset = 250;
34 QFont font(
"Arial", 15, QFont::DemiBold,
false);
39 "\"" + QString::fromStdString(station->
getName()) +
"\"", font);
41 boreholeTag->setPos((textBounds.width() / 2.0), 80);
43 boreholeName->setPos((textBounds.width() / 2.0), 200);
46 "Depth: " + QString::number(station->
getDepth()) +
" m");
48 totalDepth->setPos((textBounds.width() / 2.0), 350);
59 stratBar->setPos(stratBarOffset,
MARGIN);
63 stratBarOffset + stratBarBounds.width());
68 stratBarOffset + (stratBarBounds.width() / 2));
79 std::vector<QNonScalableGraphicsTextItem*> depthText;
82 textBounds = depthText[0]->boundingRect();
83 depthText[0]->setPos(offset + textBounds.width() / 2, vertPos);
85 for (std::size_t i = 1; i < profile.size(); i++)
89 vertPos += log((*(profile[i - 1]))[2] - (*(profile[i]))[2] + 1) * 100;
90 textBounds = depthText[i]->boundingRect();
91 depthText[i]->setPos(offset + textBounds.width() / 2, vertPos);
96 const QString& text,
const QFont& font)
105 std::vector<GeoLib::Point*>
111 double halfHeight = 0;
112 std::vector<QNonScalableGraphicsTextItem*> soilText;
116 soilText[0]->setPos(offset , vertPos);
118 for (std::size_t i = 1; i < soilNames.size(); i++)
123 log((*(profile[i - 1]))[2] - (*(profile[i]))[2] + 1) * 100 / 2;
125 soilText[i]->setPos(offset ,
126 vertPos + halfHeight);
127 vertPos += (2 * halfHeight);
133 std::map<std::string, DataHolderLib::Color>* stratColors)
135 auto* b =
new StratBar(station, stratColors);
Definition of the QNonScalableGraphicsTextItem class.
Definition of the StratBar class.
Definition of the StratScene class.
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.