From fbd5238e4e125a6eb33dbca037028f677954b5ee Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 30 Jan 2010 10:56:29 +0000 Subject: [PATCH] Frame PvPf Plot When working with smaller intervals it is difficult to see the highlighted points when all the points are shown in black. This patch adds a 'Frame Intervals' checkbox to enable the user to turn off all the points when looking at specific intervals. If no intervals are selected then this setting has no net effect. All datapoints are shown. --- src/PfPvPlot.cpp | 12 ++++++++++++ src/PfPvPlot.h | 4 +++- src/PfPvWindow.cpp | 14 ++++++++++++++ src/PfPvWindow.h | 2 ++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/PfPvPlot.cpp b/src/PfPvPlot.cpp index dbde9994b..b16848a72 100644 --- a/src/PfPvPlot.cpp +++ b/src/PfPvPlot.cpp @@ -169,6 +169,9 @@ PfPvPlot::PfPvPlot(MainWindow *mainWindow) cl_ = settings->value(GC_CRANKLENGTH).toDouble() / 1000.0; + merge_intervals = false; + frame_intervals = true; + recalc(); } @@ -415,6 +418,8 @@ PfPvPlot::showIntervals(RideItem *_rideItem) int num_intervals=intervalCount(); if (mergeIntervals()) num_intervals = 1; + if (frameIntervals() || num_intervals==0) curve->setVisible(true); + if (frameIntervals()==false && num_intervals) curve->setVisible(false); QVector > > dataSetInterval(num_intervals); long tot_cad = 0; @@ -620,3 +625,10 @@ PfPvPlot::setMergeIntervals(bool value) merge_intervals = value; showIntervals(rideItem); } + +void +PfPvPlot::setFrameIntervals(bool value) +{ + frame_intervals = value; + showIntervals(rideItem); +} diff --git a/src/PfPvPlot.h b/src/PfPvPlot.h index 0a85976d4..5d7d3fe10 100644 --- a/src/PfPvPlot.h +++ b/src/PfPvPlot.h @@ -57,6 +57,8 @@ class PfPvPlot : public QwtPlot bool mergeIntervals() const { return merge_intervals; } void setMergeIntervals(bool value); + bool frameIntervals() const { return frame_intervals; } + void setFrameIntervals(bool value); public slots: signals: @@ -83,7 +85,7 @@ signals: int cad_; double cl_; bool shade_zones; // whether to shade zones, added 27Apr2009 djconnel - bool merge_intervals; + bool merge_intervals, frame_intervals; }; #endif // _GC_QaPlot_h diff --git a/src/PfPvWindow.cpp b/src/PfPvWindow.cpp index be369f14c..7c7e06d4c 100644 --- a/src/PfPvWindow.cpp +++ b/src/PfPvWindow.cpp @@ -43,6 +43,9 @@ PfPvWindow::PfPvWindow(MainWindow *mainWindow) : mergeIntervalPfPvCheckBox = new QCheckBox; mergeIntervalPfPvCheckBox->setText(tr("Merge intervals")); mergeIntervalPfPvCheckBox->setCheckState(Qt::Unchecked); + frameIntervalPfPvCheckBox = new QCheckBox; + frameIntervalPfPvCheckBox->setText(tr("Frame intervals")); + frameIntervalPfPvCheckBox->setCheckState(Qt::Checked); qaLayout->addWidget(qaCPLabel); qaLayout->addWidget(qaCPValue); @@ -52,6 +55,7 @@ PfPvWindow::PfPvWindow(MainWindow *mainWindow) : qaLayout->addWidget(qaClValue); qaLayout->addWidget(shadeZonesPfPvCheckBox); qaLayout->addWidget(mergeIntervalPfPvCheckBox); + qaLayout->addWidget(frameIntervalPfPvCheckBox); vlayout->addWidget(pfPvPlot); vlayout->addLayout(qaLayout); @@ -73,6 +77,8 @@ PfPvWindow::PfPvWindow(MainWindow *mainWindow) : this, SLOT(setShadeZonesPfPvFromCheckBox())); connect(mergeIntervalPfPvCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setMergeIntervalsPfPvFromCheckBox())); + connect(frameIntervalPfPvCheckBox, SIGNAL(stateChanged(int)), + this, SLOT(setFrameIntervalsPfPvFromCheckBox())); connect(mainWindow, SIGNAL(rideSelected()), this, SLOT(rideSelected())); connect(mainWindow, SIGNAL(intervalSelected()), this, SLOT(intervalSelected())); connect(mainWindow, SIGNAL(intervalsChanged()), this, SLOT(intervalSelected())); @@ -123,6 +129,14 @@ PfPvWindow::setMergeIntervalsPfPvFromCheckBox() } } +void +PfPvWindow::setFrameIntervalsPfPvFromCheckBox() +{ + if (pfPvPlot->frameIntervals() != frameIntervalPfPvCheckBox->isChecked()) { + pfPvPlot->setFrameIntervals(frameIntervalPfPvCheckBox->isChecked()); + } +} + void PfPvWindow::setQaCPFromLineEdit() { diff --git a/src/PfPvWindow.h b/src/PfPvWindow.h index eda2bde7c..fd91c53bd 100644 --- a/src/PfPvWindow.h +++ b/src/PfPvWindow.h @@ -48,6 +48,7 @@ class PfPvWindow : public QWidget void setQaCLFromLineEdit(); void setShadeZonesPfPvFromCheckBox(); void setMergeIntervalsPfPvFromCheckBox(); + void setFrameIntervalsPfPvFromCheckBox(); protected: @@ -55,6 +56,7 @@ class PfPvWindow : public QWidget PfPvPlot *pfPvPlot; QCheckBox *shadeZonesPfPvCheckBox; QCheckBox *mergeIntervalPfPvCheckBox; + QCheckBox *frameIntervalPfPvCheckBox; QLineEdit *qaCPValue; QLineEdit *qaCadValue; QLineEdit *qaClValue;