mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: pass [from,to] range to polygon plotting functions
Only plot the zoomed range. Currently this passes the sample before and after the range, so it generally "overshoots" by one sample in each direction. The plan is to do clipping on the first and last polygon segment later on. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c09382036f
commit
118700fd18
3 changed files with 97 additions and 56 deletions
|
@ -395,6 +395,22 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
timeAxis->setBounds(round(relStart * maxtime), round(relEnd * maxtime));
|
||||
}
|
||||
|
||||
// Find first and last plotInfo entry
|
||||
int firstSecond = lrint(timeAxis->minimum());
|
||||
int lastSecond = lrint(timeAxis->maximum());
|
||||
auto it1 = std::lower_bound(plotInfo.entry, plotInfo.entry + plotInfo.nr, firstSecond,
|
||||
[](const plot_data &d, int s)
|
||||
{ return d.sec < s; });
|
||||
auto it2 = std::lower_bound(it1, plotInfo.entry + plotInfo.nr, lastSecond,
|
||||
[](const plot_data &d, int s)
|
||||
{ return d.sec < s; });
|
||||
if (it1 > plotInfo.entry && it1->sec > firstSecond)
|
||||
--it1;
|
||||
if (it2 < plotInfo.entry + plotInfo.nr)
|
||||
++it2;
|
||||
int from = it1 - plotInfo.entry;
|
||||
int to = it2 - plotInfo.entry;
|
||||
|
||||
timeAxis->updateTicks(animSpeed);
|
||||
cylinderPressureAxis->setBounds(plotInfo.minpressure, plotInfo.maxpressure);
|
||||
|
||||
|
@ -446,7 +462,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
|||
|
||||
// Replot dive items
|
||||
for (AbstractProfilePolygonItem *item: profileItems)
|
||||
item->replot(d, inPlanner);
|
||||
item->replot(d, from, to, inPlanner);
|
||||
|
||||
if (prefs.percentagegraph)
|
||||
percentageItem->replot(d, currentdc, dataModel->data());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue