mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Added speed data source setting
This commit is contained in:
parent
1cd726691e
commit
fc18283172
@ -860,6 +860,7 @@ void GUI::openOptions()
|
||||
SET_TRACK_OPTION(outlierEliminate, setOutlierElimination);
|
||||
SET_TRACK_OPTION(pauseSpeed, setPauseSpeed);
|
||||
SET_TRACK_OPTION(pauseInterval, setPauseInterval);
|
||||
SET_TRACK_OPTION(useReportedSpeed, useReportedSpeed);
|
||||
|
||||
if (options.poiRadius != _options.poiRadius)
|
||||
_poi->setRadius(options.poiRadius);
|
||||
@ -1631,6 +1632,8 @@ void GUI::writeSettings()
|
||||
settings.setValue(PAUSE_SPEED_SETTING, _options.pauseSpeed);
|
||||
if (_options.pauseInterval != PAUSE_INTERVAL_DEFAULT)
|
||||
settings.setValue(PAUSE_INTERVAL_SETTING, _options.pauseInterval);
|
||||
if (_options.useReportedSpeed != USE_REPORTED_SPEED_DEFAULT)
|
||||
settings.setValue(USE_REPORTED_SPEED_SETTING, _options.useReportedSpeed);
|
||||
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
||||
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
||||
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
||||
@ -1859,6 +1862,8 @@ void GUI::readSettings()
|
||||
OUTLIER_ELIMINATE_DEFAULT).toBool();
|
||||
_options.pauseSpeed = settings.value(PAUSE_SPEED_SETTING,
|
||||
PAUSE_SPEED_DEFAULT).toFloat();
|
||||
_options.useReportedSpeed = settings.value(USE_REPORTED_SPEED_SETTING,
|
||||
USE_REPORTED_SPEED_DEFAULT).toBool();
|
||||
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
|
||||
PAUSE_INTERVAL_DEFAULT).toInt();
|
||||
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
|
||||
@ -1924,6 +1929,7 @@ void GUI::readSettings()
|
||||
Track::setOutlierElimination(_options.outlierEliminate);
|
||||
Track::setPauseSpeed(_options.pauseSpeed);
|
||||
Track::setPauseInterval(_options.pauseInterval);
|
||||
Track::useReportedSpeed(_options.useReportedSpeed);
|
||||
|
||||
_poi->setRadius(_options.poiRadius);
|
||||
|
||||
|
@ -311,9 +311,25 @@ QWidget *OptionsDialog::createDataPage()
|
||||
pauseTab->setLayout(pauseLayout);
|
||||
|
||||
|
||||
_computed = new QRadioButton(tr("Computed from distance/time"));
|
||||
_reported = new QRadioButton(tr("Reported by device"));
|
||||
if (_options->useReportedSpeed)
|
||||
_reported->setChecked(true);
|
||||
else
|
||||
_computed->setChecked(true);
|
||||
|
||||
QFormLayout *sourceLayout = new QFormLayout();
|
||||
sourceLayout->addWidget(_computed);
|
||||
sourceLayout->addWidget(_reported);
|
||||
|
||||
QWidget *sourceTab = new QWidget();
|
||||
sourceTab->setLayout(sourceLayout);
|
||||
|
||||
|
||||
QTabWidget *filterPage = new QTabWidget();
|
||||
filterPage->addTab(filterTab, tr("Filtering"));
|
||||
filterPage->addTab(pauseTab, tr("Pause detection"));
|
||||
filterPage->addTab(sourceTab, tr("Speed"));
|
||||
|
||||
return filterPage;
|
||||
}
|
||||
@ -543,6 +559,7 @@ void OptionsDialog::accept()
|
||||
if (qAbs(pauseSpeed - _options->pauseSpeed) > 0.01)
|
||||
_options->pauseSpeed = pauseSpeed;
|
||||
_options->pauseInterval = _pauseInterval->value();
|
||||
_options->useReportedSpeed = _reported->isChecked();
|
||||
|
||||
qreal poiRadius = (_options->units == Imperial)
|
||||
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
||||
|
@ -43,6 +43,7 @@ struct Options {
|
||||
bool outlierEliminate;
|
||||
qreal pauseSpeed;
|
||||
int pauseInterval;
|
||||
bool useReportedSpeed;
|
||||
// POI
|
||||
int poiRadius;
|
||||
// System
|
||||
@ -110,6 +111,8 @@ private:
|
||||
QCheckBox *_outlierEliminate;
|
||||
QDoubleSpinBox *_pauseSpeed;
|
||||
QSpinBox *_pauseInterval;
|
||||
QRadioButton *_computed;
|
||||
QRadioButton *_reported;
|
||||
// POI
|
||||
QDoubleSpinBox *_poiRadius;
|
||||
// System
|
||||
|
@ -124,6 +124,8 @@
|
||||
#define PAUSE_SPEED_DEFAULT 0.5 /* m/s */
|
||||
#define PAUSE_INTERVAL_SETTING "pauseInterval"
|
||||
#define PAUSE_INTERVAL_DEFAULT 10 /* s */
|
||||
#define USE_REPORTED_SPEED_SETTING "useReportedSpeed"
|
||||
#define USE_REPORTED_SPEED_DEFAULT false
|
||||
#define POI_RADIUS_SETTING "poiRadius"
|
||||
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||
#define USE_OPENGL_SETTING "useOpenGL"
|
||||
|
@ -10,6 +10,7 @@ qreal Track::_pauseSpeed = 0.5;
|
||||
int Track::_pauseInterval = 10;
|
||||
|
||||
bool Track::_outlierEliminate = true;
|
||||
bool Track::_useReportedSpeed = false;
|
||||
|
||||
|
||||
static qreal median(QVector<qreal> &v)
|
||||
@ -91,13 +92,12 @@ Track::Track(const TrackData &data) : _data(data)
|
||||
if (dt < 1e-3) {
|
||||
_speed.append(_speed.at(i-1));
|
||||
acceleration.append(acceleration.at(i-1));
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
_speed.append(ds / dt);
|
||||
|
||||
qreal dv = _speed.at(i) - _speed.at(i-1);
|
||||
acceleration.append(dv / dt);
|
||||
}
|
||||
}
|
||||
|
||||
_pause = 0;
|
||||
for (int i = 1; i < _data.count(); i++) {
|
||||
@ -166,7 +166,8 @@ Graph Track::speed() const
|
||||
|| _data.at(i).hasSpeed())) {
|
||||
v = 0;
|
||||
stop.append(raw.size());
|
||||
} else if (_data.at(i).hasSpeed() && !_outliers.contains(i))
|
||||
} else if (_useReportedSpeed && _data.at(i).hasSpeed()
|
||||
&& !_outliers.contains(i))
|
||||
v = _data.at(i).speed();
|
||||
else if (!std::isnan(_speed.at(i)) && !_outliers.contains(i))
|
||||
v = _speed.at(i);
|
||||
|
@ -42,6 +42,7 @@ public:
|
||||
static void setPauseInterval(int interval) {_pauseInterval = interval;}
|
||||
static void setOutlierElimination(bool eliminate)
|
||||
{_outlierEliminate = eliminate;}
|
||||
static void useReportedSpeed(bool use) {_useReportedSpeed = use;}
|
||||
|
||||
private:
|
||||
bool discardStopPoint(int i) const;
|
||||
@ -58,15 +59,14 @@ private:
|
||||
qreal _pause;
|
||||
|
||||
static bool _outlierEliminate;
|
||||
|
||||
static int _elevationWindow;
|
||||
static int _speedWindow;
|
||||
static int _heartRateWindow;
|
||||
static int _cadenceWindow;
|
||||
static int _powerWindow;
|
||||
|
||||
static qreal _pauseSpeed;
|
||||
static int _pauseInterval;
|
||||
static bool _useReportedSpeed;
|
||||
};
|
||||
|
||||
#endif // TRACK_H
|
||||
|
Loading…
Reference in New Issue
Block a user