20 std::map<std::string, DataHolderLib::Color>* stratColors,
21 QGraphicsItem* parent)
22 : QGraphicsItem(parent), _station(station)
36 const QStyleOptionGraphicsItem* option,
45 QPen pen(Qt::black, 1, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin);
46 pen.setCosmetic(
true);
53 std::size_t nLayers = profile.size();
55 painter->drawLine(0, 0,
BARWIDTH + 5, 0);
57 for (std::size_t i = 1; i < nLayers; i++)
60 height =
logHeight(((*(profile[i - 1]))[2] - (*(profile[i]))[2]));
61 QRectF layer(0, top,
BARWIDTH, height);
64 QBrush brush(QColor(
static_cast<int>(c[0]),
65 static_cast<int>(c[1]),
66 static_cast<int>(c[2]),
69 painter->setBrush(brush);
71 painter->drawRect(layer);
73 static_cast<int>(layer.bottom()),
75 static_cast<int>(layer.bottom()));
86 for (std::size_t i = 1; i < profile.size(); i++)
88 height += (log((*(profile[i - 1]))[2] - (*(profile[i]))[2] + 1) * 100);
Definition of the StratBar class.
A borehole as a geometric object.
const std::vector< std::string > & getSoilNames() const
const std::vector< Point * > & getProfile() const
double logHeight(double h) const
Calculates the height for a soil layer by "log(d+1)*100".
double totalLogHeight() const
Calculates the total height of the bar by calculating and adding the log-height for all layers in the...
static const int BARWIDTH
The default width of the bar.
QRectF boundingRect() const override
Returns the bounding rectangle of the bar.
std::map< std::string, DataHolderLib::Color > _stratColors
GeoLib::StationBorehole * _station
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints the bar.
StratBar(GeoLib::StationBorehole *station, std::map< std::string, DataHolderLib::Color > *stratColors=nullptr, QGraphicsItem *parent=nullptr)
Constructor.
Color getColor(const std::string &id, std::map< std::string, Color > &colors)
std::array< unsigned char, 4 > Color