1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 11:39:16 +02:00

Added support for DEM data (SRTM HGT) elevation sources

This commit is contained in:
2019-01-06 18:45:09 +01:00
parent 8c8fedd7f7
commit 589c85b504
12 changed files with 207 additions and 16 deletions

View File

@ -12,6 +12,7 @@
#include "map/ellipsoid.h"
#include "map/gcs.h"
#include "map/pcs.h"
#include "data/track.h"
#include "opengl.h"
#include "gui.h"
#include "settings.h"
@ -65,6 +66,8 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
loadDatums();
loadPCSs();
Track::setDEMDir(ProgramPaths::demDir());
_gui = new GUI();
}

View File

@ -700,6 +700,8 @@ void GUI::paths()
+ QDir::cleanPath(ProgramPaths::poiDir(true)) + "</code></td></tr><tr><td>"
+ tr("GCS/PCS directory:") + "</td><td><code>"
+ QDir::cleanPath(ProgramPaths::csvDir(true)) + "</code></td></tr><tr><td>"
+ tr("DEM directory:") + "</td><td><code>"
+ QDir::cleanPath(ProgramPaths::demDir(true)) + "</code></td></tr><tr><td>"
+ tr("Tile cache directory:") + "</td><td><code>"
+ QDir::cleanPath(ProgramPaths::tilesDir()) + "</code></td></tr></table>"
);
@ -911,6 +913,7 @@ void GUI::openOptions()
SET_TRACK_OPTION(pauseSpeed, setPauseSpeed);
SET_TRACK_OPTION(pauseInterval, setPauseInterval);
SET_TRACK_OPTION(useReportedSpeed, useReportedSpeed);
SET_TRACK_OPTION(useDEMElevation, useDEMElevation);
if (options.poiRadius != _options.poiRadius)
_poi->setRadius(options.poiRadius);
@ -1754,6 +1757,8 @@ void GUI::writeSettings()
settings.setValue(PAUSE_INTERVAL_SETTING, _options.pauseInterval);
if (_options.useReportedSpeed != USE_REPORTED_SPEED_DEFAULT)
settings.setValue(USE_REPORTED_SPEED_SETTING, _options.useReportedSpeed);
if (_options.useDEMElevation != USE_DEM_ELEVATION_DEFAULT)
settings.setValue(USE_DEM_ELEVATION_SETTING, _options.useDEMElevation);
if (_options.poiRadius != POI_RADIUS_DEFAULT)
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
@ -1992,6 +1997,8 @@ void GUI::readSettings()
PAUSE_SPEED_DEFAULT).toFloat();
_options.useReportedSpeed = settings.value(USE_REPORTED_SPEED_SETTING,
USE_REPORTED_SPEED_DEFAULT).toBool();
_options.useDEMElevation = settings.value(USE_DEM_ELEVATION_SETTING,
USE_DEM_ELEVATION_DEFAULT).toBool();
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
PAUSE_INTERVAL_DEFAULT).toInt();
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
@ -2070,6 +2077,7 @@ void GUI::readSettings()
Track::setPauseSpeed(_options.pauseSpeed);
Track::setPauseInterval(_options.pauseInterval);
Track::useReportedSpeed(_options.useReportedSpeed);
Track::useDEMElevation(_options.useDEMElevation);
_poi->setRadius(_options.poiRadius);

View File

@ -345,25 +345,59 @@ QWidget *OptionsDialog::createDataPage()
pauseTab->setLayout(pauseLayout);
_computed = new QRadioButton(tr("Computed from distance/time"));
_reported = new QRadioButton(tr("Recorded by device"));
_computedSpeed = new QRadioButton(tr("Computed from distance/time"));
_reportedSpeed = new QRadioButton(tr("Recorded by device"));
if (_options->useReportedSpeed)
_reported->setChecked(true);
_reportedSpeed->setChecked(true);
else
_computed->setChecked(true);
_computedSpeed->setChecked(true);
QFormLayout *speedLayout = new QFormLayout();
speedLayout->addWidget(_computedSpeed);
speedLayout->addWidget(_reportedSpeed);
#ifndef Q_OS_MAC
QGroupBox *speedBox = new QGroupBox(tr("Speed"));
speedBox->setLayout(speedLayout);
#endif // Q_OS_MAC
_gpsElevation = new QRadioButton(tr("GPS data"));
_demElevation = new QRadioButton(tr("DEM data"));
if (_options->useDEMElevation)
_demElevation->setChecked(true);
else
_gpsElevation->setChecked(true);
QFormLayout *elevationLayout = new QFormLayout();
elevationLayout->addWidget(_gpsElevation);
elevationLayout->addWidget(_demElevation);
#ifndef Q_OS_MAC
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
elevationBox->setLayout(elevationLayout);
#endif // Q_OS_MAC
QFormLayout *sourceLayout = new QFormLayout();
sourceLayout->addWidget(_computed);
sourceLayout->addWidget(_reported);
QWidget *sourceTab = new QWidget();
sourceTab->setLayout(sourceLayout);
QVBoxLayout *sourceTabLayout = new QVBoxLayout();
#ifdef Q_OS_MAC
sourceTabLayout->addWidget(new QLabel(tr("Speed:")));
sourceTabLayout->addLayout(speedLayout);
sourceTabLayout->addWidget(line());
sourceTabLayout->addWidget(new QLabel(tr("Elevation:")));
sourceTabLayout->addLayout(elevationLayout);
#else // Q_OS_MAC
sourceTabLayout->addWidget(speedBox);
sourceTabLayout->addWidget(elevationBox);
#endif // Q_OS_MAC
sourceTabLayout->addStretch();
sourceTab->setLayout(sourceTabLayout);
QTabWidget *filterPage = new QTabWidget();
filterPage->addTab(filterTab, tr("Filtering"));
filterPage->addTab(sourceTab, tr("Sources"));
filterPage->addTab(pauseTab, tr("Pause detection"));
filterPage->addTab(sourceTab, tr("Speed"));
return filterPage;
}
@ -603,7 +637,8 @@ void OptionsDialog::accept()
if (qAbs(pauseSpeed - _options->pauseSpeed) > 0.01)
_options->pauseSpeed = pauseSpeed;
_options->pauseInterval = _pauseInterval->value();
_options->useReportedSpeed = _reported->isChecked();
_options->useReportedSpeed = _reportedSpeed->isChecked();
_options->useDEMElevation = _demElevation->isChecked();
qreal poiRadius = (_options->units == Imperial)
? _poiRadius->value() * MIINM : (_options->units == Nautical)

View File

@ -48,6 +48,7 @@ struct Options {
qreal pauseSpeed;
int pauseInterval;
bool useReportedSpeed;
bool useDEMElevation;
// POI
int poiRadius;
// System
@ -122,8 +123,10 @@ private:
QCheckBox *_outlierEliminate;
QDoubleSpinBox *_pauseSpeed;
QSpinBox *_pauseInterval;
QRadioButton *_computed;
QRadioButton *_reported;
QRadioButton *_computedSpeed;
QRadioButton *_reportedSpeed;
QRadioButton *_gpsElevation;
QRadioButton *_demElevation;
// POI
QDoubleSpinBox *_poiRadius;
// System

View File

@ -126,6 +126,8 @@
#define PAUSE_INTERVAL_DEFAULT 10 /* s */
#define USE_REPORTED_SPEED_SETTING "useReportedSpeed"
#define USE_REPORTED_SPEED_DEFAULT false
#define USE_DEM_ELEVATION_SETTING "useReportedSpeed"
#define USE_DEM_ELEVATION_DEFAULT false
#define POI_RADIUS_SETTING "poiRadius"
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
#define USE_OPENGL_SETTING "useOpenGL"