mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Show reference lines on CP chart
.. but only when showing a 'power' data series such as NP, xPower, aPower etc.
This commit is contained in:
@@ -767,6 +767,7 @@ CpintPlot::calculate(RideItem *rideItem)
|
||||
}
|
||||
}
|
||||
|
||||
refreshReferenceLines(rideItem);
|
||||
replot();
|
||||
}
|
||||
|
||||
@@ -852,3 +853,41 @@ CpintPlot::setModel(int i1, int i2, int i3, int i4, bool useT0)
|
||||
clear_CP_Curves();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CpintPlot::refreshReferenceLines(RideItem *rideItem)
|
||||
{
|
||||
// we only do refs for a specific ride
|
||||
if (rangemode) return;
|
||||
|
||||
// wipe existing
|
||||
foreach(QwtPlotMarker *referenceLine, referenceLines) {
|
||||
referenceLine->detach();
|
||||
delete referenceLine;
|
||||
}
|
||||
referenceLines.clear();
|
||||
|
||||
if (!rideItem && !rideItem->ride()) return;
|
||||
|
||||
// horizontal lines at reference points
|
||||
if (series == RideFile::aPower || series == RideFile::xPower || series == RideFile::NP || series == RideFile::watts || series == RideFile::wattsKg) {
|
||||
|
||||
if (rideItem->ride()) {
|
||||
foreach(const RideFilePoint *referencePoint, rideItem->ride()->referencePoints()) {
|
||||
|
||||
if (referencePoint->watts != 0) {
|
||||
QwtPlotMarker *referenceLine = new QwtPlotMarker;
|
||||
QPen p;
|
||||
p.setColor(GColor(CPLOTMARKER));
|
||||
p.setWidth(1);
|
||||
p.setStyle(Qt::DashLine);
|
||||
referenceLine->setLinePen(p);
|
||||
referenceLine->setLineStyle(QwtPlotMarker::HLine);
|
||||
referenceLine->setYValue(referencePoint->watts);
|
||||
referenceLine->attach(this);
|
||||
referenceLines.append(referenceLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ class CpintPlot : public QwtPlot
|
||||
RideFile::SeriesType series;
|
||||
Context *context;
|
||||
|
||||
void refreshReferenceLines(RideItem*);
|
||||
QList<QwtPlotMarker*> referenceLines;
|
||||
|
||||
RideFileCache *current, *bests;
|
||||
LTMCanvasPicker *canvasPicker;
|
||||
penTooltip *zoomer;
|
||||
|
||||
Reference in New Issue
Block a user