mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
statistics: add notion of Z-value to chart items
The chart items were drawn in order of creation. To control this, add a notion of Z-value. In contrast to QGraphicsScene, make this a small integer value. To controll order of drawing, a plain QSGNode is created for every possible Z-Value and items are added to these nodes. Thus, items are rendered by Z-value and if the Z-value is equal by order of creation. Likewise split the list of chart-items into Z-values, so that items can be quickly unregistered: The items that will be removed individually will usuall be part of Z-levels with only few items (e.g. legend, infobox). Z-levels with many items (notably the series) will always be fully rebuilt. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
785d5189f6
commit
e1c0cace95
7 changed files with 82 additions and 31 deletions
|
@ -12,8 +12,8 @@ static int round_up(double f)
|
|||
return static_cast<int>(ceil(f));
|
||||
}
|
||||
|
||||
ChartItem::ChartItem(StatsView &v) :
|
||||
dirty(false), view(v), positionDirty(false), textureDirty(false)
|
||||
ChartItem::ChartItem(StatsView &v, ChartZValue z) :
|
||||
dirty(false), zValue(z), view(v), positionDirty(false), textureDirty(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ void ChartItem::render()
|
|||
return;
|
||||
if (!node) {
|
||||
node.reset(view.w()->createImageNode());
|
||||
view.addQSGNode(node.get(), 0);
|
||||
view.addQSGNode(node.get(), zValue);
|
||||
}
|
||||
if (!img) {
|
||||
resize(QSizeF(1,1));
|
||||
|
@ -85,7 +85,8 @@ QRectF ChartItem::getRect() const
|
|||
return rect;
|
||||
}
|
||||
|
||||
ChartRectItem::ChartRectItem(StatsView &v, const QPen &pen, const QBrush &brush, double radius) : ChartItem(v),
|
||||
ChartRectItem::ChartRectItem(StatsView &v, ChartZValue z,
|
||||
const QPen &pen, const QBrush &brush, double radius) : ChartItem(v, z),
|
||||
pen(pen), brush(brush), radius(radius)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue