mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
profile: don't plot event-icons outside of range
Do this by extending the isInteresting() function for dive event items. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
a496ab016b
commit
1a429d9b17
3 changed files with 11 additions and 3 deletions
|
@ -191,8 +191,15 @@ static int depthAtTime(const plot_info &pi, duration_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DiveEventItem::isInteresting(const struct dive *d, const struct divecomputer *dc,
|
bool DiveEventItem::isInteresting(const struct dive *d, const struct divecomputer *dc,
|
||||||
const struct event *ev, const plot_info &pi)
|
const struct event *ev, const plot_info &pi,
|
||||||
|
int firstSecond, int lastSecond)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Ignore items outside of plot range
|
||||||
|
*/
|
||||||
|
if (ev->time.seconds < firstSecond || ev->time.seconds >= lastSecond)
|
||||||
|
return false;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some gas change events are special. Some dive computers just tell us the initial gas this way.
|
* Some gas change events are special. Some dive computers just tell us the initial gas this way.
|
||||||
* Don't bother showing those
|
* Don't bother showing those
|
||||||
|
|
|
@ -23,7 +23,8 @@ public:
|
||||||
void setHorizontalAxis(DiveCartesianAxis *axis);
|
void setHorizontalAxis(DiveCartesianAxis *axis);
|
||||||
bool shouldBeHidden();
|
bool shouldBeHidden();
|
||||||
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
|
static bool isInteresting(const struct dive *d, const struct divecomputer *dc,
|
||||||
const struct event *ev, const struct plot_info &pi);
|
const struct event *ev, const struct plot_info &pi,
|
||||||
|
int firstSecond, int lastSecond);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupToolTipString(struct gasmix lastgasmix);
|
void setupToolTipString(struct gasmix lastgasmix);
|
||||||
|
|
|
@ -487,7 +487,7 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, DivePlannerPointsM
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DiveEventItem::isInteresting(d, currentdc, event, plotInfo)) {
|
if (DiveEventItem::isInteresting(d, currentdc, event, plotInfo, firstSecond, lastSecond)) {
|
||||||
auto item = new DiveEventItem(d, event, lastgasmix, plotInfo,
|
auto item = new DiveEventItem(d, event, lastgasmix, plotInfo,
|
||||||
timeAxis, profileYAxis, animSpeed, *pixmaps);
|
timeAxis, profileYAxis, animSpeed, *pixmaps);
|
||||||
item->setZValue(2);
|
item->setZValue(2);
|
||||||
|
|
Loading…
Reference in a new issue