mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
AllPlot: Add secondary Scope to plot speed and headwind in the same together
This commit is contained in:
@@ -228,7 +228,7 @@ class TimeScaleDraw: public QwtScaleDraw
|
||||
static inline double
|
||||
max(double a, double b) { if (a > b) return a; else return b; }
|
||||
|
||||
AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType scope, bool wanttext):
|
||||
AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType scope, RideFile::SeriesType secScope, bool wanttext):
|
||||
QwtPlot(parent),
|
||||
rideItem(NULL),
|
||||
shade_zones(true),
|
||||
@@ -246,6 +246,7 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType s
|
||||
showBalance(true),
|
||||
bydist(false),
|
||||
scope(scope),
|
||||
secondaryScope(secScope),
|
||||
context(context),
|
||||
parent(parent),
|
||||
wanttext(wanttext)
|
||||
@@ -1762,6 +1763,10 @@ AllPlot::setDataFromPlot(AllPlot *plot)
|
||||
{
|
||||
ourCurve = speedCurve;
|
||||
thereCurve = referencePlot->speedCurve;
|
||||
if (secondaryScope == RideFile::headwind) {
|
||||
ourICurve = windCurve;
|
||||
thereICurve = referencePlot->windCurve;
|
||||
}
|
||||
title = tr("Speed");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -63,7 +63,7 @@ class AllPlot : public QwtPlot
|
||||
// you can declare which series to plot, none means do them all
|
||||
// wanttext is to say if plot markers should have text
|
||||
AllPlot(AllPlotWindow *parent, Context *context,
|
||||
RideFile::SeriesType series = RideFile::none, bool wanttext = true);
|
||||
RideFile::SeriesType series = RideFile::none, RideFile::SeriesType secSeries = RideFile::none, bool wanttext = true);
|
||||
|
||||
bool eventFilter(QObject *object, QEvent *e);
|
||||
|
||||
@@ -216,6 +216,7 @@ class AllPlot : public QwtPlot
|
||||
|
||||
// scope of plot (none means all, or just for a specific series
|
||||
RideFile::SeriesType scope;
|
||||
RideFile::SeriesType secondaryScope;
|
||||
|
||||
private:
|
||||
Context *context;
|
||||
|
||||
@@ -1804,6 +1804,7 @@ AllPlotWindow::setupSeriesStackPlots()
|
||||
// this is NOT a memory leak (see ZZZ below)
|
||||
seriesPlots.clear();
|
||||
|
||||
bool addHeadwind = false;
|
||||
RideItem* rideItem = current;
|
||||
if (!rideItem || !rideItem->ride() || rideItem->ride()->dataPoints().isEmpty()) return;
|
||||
|
||||
@@ -1819,7 +1820,7 @@ AllPlotWindow::setupSeriesStackPlots()
|
||||
if (showCad->isChecked() && rideItem->ride()->areDataPresent()->cad) serieslist << RideFile::cad;
|
||||
if (showAlt->isChecked() && rideItem->ride()->areDataPresent()->alt) serieslist << RideFile::alt;
|
||||
if (showTemp->isChecked() && rideItem->ride()->areDataPresent()->temp) serieslist << RideFile::temp;
|
||||
if (showWind->isChecked() && rideItem->ride()->areDataPresent()->headwind) serieslist << RideFile::headwind;
|
||||
if (showWind->isChecked() && rideItem->ride()->areDataPresent()->headwind) addHeadwind=true; //serieslist << RideFile::headwind;
|
||||
if (showTorque->isChecked() && rideItem->ride()->areDataPresent()->nm) serieslist << RideFile::nm;
|
||||
if (showNP->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::NP;
|
||||
if (showXP->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::xPower;
|
||||
@@ -1831,7 +1832,7 @@ AllPlotWindow::setupSeriesStackPlots()
|
||||
foreach(RideFile::SeriesType x, serieslist) {
|
||||
|
||||
// create that plot
|
||||
AllPlot *_allPlot = new AllPlot(this, context, x, first);
|
||||
AllPlot *_allPlot = new AllPlot(this, context, x, (addHeadwind && x == RideFile::kph ? RideFile::headwind : RideFile::none), first);
|
||||
_allPlot->setAutoFillBackground(false);
|
||||
_allPlot->setPalette(palette);
|
||||
_allPlot->setDataFromPlot(allPlot); // will clone all settings and data for the series
|
||||
|
||||
Reference in New Issue
Block a user