CPPlot Show Best Option

.. sometimes its useful just to see the model and not the bests
   curve. So added an option to get rid of the bests curve and
   show the model on its own.
This commit is contained in:
Mark Liversedge
2014-05-21 14:18:57 +01:00
parent f577a343ec
commit 085ce83bf5
4 changed files with 39 additions and 4 deletions

View File

@@ -54,8 +54,10 @@ CPPlot::CPPlot(QWidget *parent, Context *context, bool rangemode) : QwtPlot(pare
model(0), modelVariant(0),
// state
context(context), rideCache(NULL), bestsCache(NULL), rideSeries(RideFile::watts), isFiltered(false), shadeMode(2),
shadeIntervals(true), rangemode(rangemode), showPercent(false), showHeat(false), showHeatByDate(false),
context(context), rideCache(NULL), bestsCache(NULL), rideSeries(RideFile::watts),
isFiltered(false), shadeMode(2),
shadeIntervals(true), rangemode(rangemode),
showBest(true), showPercent(false), showHeat(false), showHeatByDate(false),
plotType(0),
// curves and plot objects
@@ -327,7 +329,7 @@ CPPlot::plotModel()
QPen pen(GColor(CCP));
double width = appsettings->value(this, GC_LINEWIDTH, 1.0).toDouble();
pen.setWidth(width);
pen.setStyle(Qt::DashLine);
if (showBest) pen.setStyle(Qt::DashLine);
modelCurve->setPen(pen);
modelCurve->attach(this);
@@ -575,6 +577,7 @@ CPPlot::plotBests()
work[t] = values[t] * t / 1000; // kJ not Joules
}
if (showBest) {
if (shadingCP == 0) {
// PLAIN CURVE
@@ -758,6 +761,7 @@ CPPlot::plotBests()
++zone;
}
}
}
// X-AXIS
@@ -998,7 +1002,7 @@ CPPlot::setRide(RideItem *rideItem)
void
CPPlot::pointHover(QwtPlotCurve *curve, int index)
{
if (curve == modelCurve) return; // ignore model curve hover
if (showBest && curve == modelCurve) return; // ignore model curve hover
if (index >= 0) {
@@ -1103,6 +1107,13 @@ CPPlot::setShowHeat(bool x)
clearCurves();
}
void
CPPlot::setShowBest(bool x)
{
showBest = x;
clearCurves();
}
void
CPPlot::setShowPercent(bool x)
{