mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Split DEM setting for data and POI + only load DEM data for visible POIs
This commit is contained in:
parent
98c4fb2037
commit
442f4deee2
@ -13,7 +13,6 @@
|
|||||||
#include "map/gcs.h"
|
#include "map/gcs.h"
|
||||||
#include "map/pcs.h"
|
#include "map/pcs.h"
|
||||||
#include "data/dem.h"
|
#include "data/dem.h"
|
||||||
#include "data/data.h"
|
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
@ -65,8 +64,6 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
#endif // ENABLE_HTTP2
|
#endif // ENABLE_HTTP2
|
||||||
Downloader::setTimeout(settings.value(CONNECTION_TIMEOUT_SETTING,
|
Downloader::setTimeout(settings.value(CONNECTION_TIMEOUT_SETTING,
|
||||||
CONNECTION_TIMEOUT_DEFAULT).toInt());
|
CONNECTION_TIMEOUT_DEFAULT).toInt());
|
||||||
Data::useDEMElevation(settings.value(USE_DEM_ELEVATION_SETTING,
|
|
||||||
USE_DEM_ELEVATION_DEFAULT).toBool());
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
_gui = new GUI();
|
_gui = new GUI();
|
||||||
|
@ -918,18 +918,24 @@ void GUI::openOptions()
|
|||||||
SET_TRACK_OPTION(pauseSpeed, setPauseSpeed);
|
SET_TRACK_OPTION(pauseSpeed, setPauseSpeed);
|
||||||
SET_TRACK_OPTION(pauseInterval, setPauseInterval);
|
SET_TRACK_OPTION(pauseInterval, setPauseInterval);
|
||||||
SET_TRACK_OPTION(useReportedSpeed, useReportedSpeed);
|
SET_TRACK_OPTION(useReportedSpeed, useReportedSpeed);
|
||||||
SET_DATA_OPTION(useDEMElevation, useDEMElevation);
|
|
||||||
|
SET_DATA_OPTION(dataUseDEM, useDEM);
|
||||||
|
|
||||||
if (options.poiRadius != _options.poiRadius)
|
if (options.poiRadius != _options.poiRadius)
|
||||||
_poi->setRadius(options.poiRadius);
|
_poi->setRadius(options.poiRadius);
|
||||||
|
if (options.poiUseDEM != _options.poiUseDEM)
|
||||||
|
_poi->useDEM(options.poiUseDEM);
|
||||||
|
|
||||||
if (options.pixmapCache != _options.pixmapCache)
|
if (options.pixmapCache != _options.pixmapCache)
|
||||||
QPixmapCache::setCacheLimit(options.pixmapCache * 1024);
|
QPixmapCache::setCacheLimit(options.pixmapCache * 1024);
|
||||||
|
|
||||||
if (options.connectionTimeout != _options.connectionTimeout)
|
if (options.connectionTimeout != _options.connectionTimeout)
|
||||||
Downloader::setTimeout(options.connectionTimeout);
|
Downloader::setTimeout(options.connectionTimeout);
|
||||||
#ifdef ENABLE_HTTP2
|
#ifdef ENABLE_HTTP2
|
||||||
if (options.enableHTTP2 != _options.enableHTTP2)
|
if (options.enableHTTP2 != _options.enableHTTP2)
|
||||||
Downloader::enableHTTP2(options.enableHTTP2);
|
Downloader::enableHTTP2(options.enableHTTP2);
|
||||||
#endif // ENABLE_HTTP2
|
#endif // ENABLE_HTTP2
|
||||||
|
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
if (options.hidpiMap != _options.hidpiMap)
|
if (options.hidpiMap != _options.hidpiMap)
|
||||||
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||||
@ -1762,10 +1768,12 @@ void GUI::writeSettings()
|
|||||||
settings.setValue(PAUSE_INTERVAL_SETTING, _options.pauseInterval);
|
settings.setValue(PAUSE_INTERVAL_SETTING, _options.pauseInterval);
|
||||||
if (_options.useReportedSpeed != USE_REPORTED_SPEED_DEFAULT)
|
if (_options.useReportedSpeed != USE_REPORTED_SPEED_DEFAULT)
|
||||||
settings.setValue(USE_REPORTED_SPEED_SETTING, _options.useReportedSpeed);
|
settings.setValue(USE_REPORTED_SPEED_SETTING, _options.useReportedSpeed);
|
||||||
if (_options.useDEMElevation != USE_DEM_ELEVATION_DEFAULT)
|
if (_options.dataUseDEM != DATA_USE_DEM_DEFAULT)
|
||||||
settings.setValue(USE_DEM_ELEVATION_SETTING, _options.useDEMElevation);
|
settings.setValue(DATA_USE_DEM_SETTING, _options.dataUseDEM);
|
||||||
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
||||||
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
settings.setValue(POI_RADIUS_SETTING, _options.poiRadius);
|
||||||
|
if (_options.poiUseDEM != POI_USE_DEM_DEFAULT)
|
||||||
|
settings.setValue(POI_USE_DEM_SETTING, _options.poiUseDEM);
|
||||||
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
if (_options.useOpenGL != USE_OPENGL_DEFAULT)
|
||||||
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
|
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
|
||||||
#ifdef ENABLE_HTTP2
|
#ifdef ENABLE_HTTP2
|
||||||
@ -2002,12 +2010,14 @@ void GUI::readSettings()
|
|||||||
PAUSE_SPEED_DEFAULT).toFloat();
|
PAUSE_SPEED_DEFAULT).toFloat();
|
||||||
_options.useReportedSpeed = settings.value(USE_REPORTED_SPEED_SETTING,
|
_options.useReportedSpeed = settings.value(USE_REPORTED_SPEED_SETTING,
|
||||||
USE_REPORTED_SPEED_DEFAULT).toBool();
|
USE_REPORTED_SPEED_DEFAULT).toBool();
|
||||||
_options.useDEMElevation = settings.value(USE_DEM_ELEVATION_SETTING,
|
_options.dataUseDEM = settings.value(DATA_USE_DEM_SETTING,
|
||||||
USE_DEM_ELEVATION_DEFAULT).toBool();
|
DATA_USE_DEM_DEFAULT).toBool();
|
||||||
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
|
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
|
||||||
PAUSE_INTERVAL_DEFAULT).toInt();
|
PAUSE_INTERVAL_DEFAULT).toInt();
|
||||||
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
|
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
|
||||||
.toInt();
|
.toInt();
|
||||||
|
_options.poiUseDEM = settings.value(POI_USE_DEM_SETTING,
|
||||||
|
POI_USE_DEM_DEFAULT).toBool();
|
||||||
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
|
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
|
||||||
.toBool();
|
.toBool();
|
||||||
#ifdef ENABLE_HTTP2
|
#ifdef ENABLE_HTTP2
|
||||||
@ -2082,9 +2092,10 @@ void GUI::readSettings()
|
|||||||
Track::setPauseSpeed(_options.pauseSpeed);
|
Track::setPauseSpeed(_options.pauseSpeed);
|
||||||
Track::setPauseInterval(_options.pauseInterval);
|
Track::setPauseInterval(_options.pauseInterval);
|
||||||
Track::useReportedSpeed(_options.useReportedSpeed);
|
Track::useReportedSpeed(_options.useReportedSpeed);
|
||||||
Data::useDEMElevation(_options.useDEMElevation);
|
Data::useDEM(_options.dataUseDEM);
|
||||||
|
|
||||||
_poi->setRadius(_options.poiRadius);
|
_poi->setRadius(_options.poiRadius);
|
||||||
|
_poi->useDEM(_options.poiUseDEM);
|
||||||
|
|
||||||
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
||||||
|
|
||||||
|
@ -352,12 +352,12 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
else
|
else
|
||||||
_computedSpeed->setChecked(true);
|
_computedSpeed->setChecked(true);
|
||||||
|
|
||||||
_gpsElevation = new QRadioButton(tr("GPS data"));
|
_dataGPSElevation = new QRadioButton(tr("GPS data"));
|
||||||
_demElevation = new QRadioButton(tr("DEM data"));
|
_dataDEMElevation = new QRadioButton(tr("DEM data"));
|
||||||
if (_options->useDEMElevation)
|
if (_options->dataUseDEM)
|
||||||
_demElevation->setChecked(true);
|
_dataDEMElevation->setChecked(true);
|
||||||
else
|
else
|
||||||
_gpsElevation->setChecked(true);
|
_dataGPSElevation->setChecked(true);
|
||||||
|
|
||||||
|
|
||||||
QWidget *sourceTab = new QWidget();
|
QWidget *sourceTab = new QWidget();
|
||||||
@ -387,8 +387,8 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
QGroupBox *speedBox = new QGroupBox(tr("Speed"));
|
QGroupBox *speedBox = new QGroupBox(tr("Speed"));
|
||||||
speedBox->setLayout(speedLayout);
|
speedBox->setLayout(speedLayout);
|
||||||
|
|
||||||
elevationLayout->addWidget(_gpsElevation);
|
elevationLayout->addWidget(_dataGPSElevation);
|
||||||
elevationLayout->addWidget(_demElevation);
|
elevationLayout->addWidget(_dataDEMElevation);
|
||||||
|
|
||||||
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
|
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
|
||||||
elevationBox->setLayout(elevationLayout);
|
elevationBox->setLayout(elevationLayout);
|
||||||
@ -410,6 +410,13 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
|
|
||||||
QWidget *OptionsDialog::createPOIPage()
|
QWidget *OptionsDialog::createPOIPage()
|
||||||
{
|
{
|
||||||
|
_poiGPSElevation = new QRadioButton(tr("GPS data"));
|
||||||
|
_poiDEMElevation = new QRadioButton(tr("DEM data"));
|
||||||
|
if (_options->poiUseDEM)
|
||||||
|
_poiDEMElevation->setChecked(true);
|
||||||
|
else
|
||||||
|
_poiGPSElevation->setChecked(true);
|
||||||
|
|
||||||
_poiRadius = new QDoubleSpinBox();
|
_poiRadius = new QDoubleSpinBox();
|
||||||
_poiRadius->setSingleStep(1);
|
_poiRadius->setSingleStep(1);
|
||||||
_poiRadius->setDecimals(1);
|
_poiRadius->setDecimals(1);
|
||||||
@ -424,8 +431,13 @@ QWidget *OptionsDialog::createPOIPage()
|
|||||||
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVBoxLayout *elevationLayout = new QVBoxLayout();
|
||||||
|
elevationLayout->addWidget(_poiGPSElevation);
|
||||||
|
elevationLayout->addWidget(_poiDEMElevation);
|
||||||
|
|
||||||
QFormLayout *poiLayout = new QFormLayout();
|
QFormLayout *poiLayout = new QFormLayout();
|
||||||
poiLayout->addRow(tr("POI radius:"), _poiRadius);
|
poiLayout->addRow(tr("Radius:"), _poiRadius);
|
||||||
|
poiLayout->addRow(tr("Elevation:"), elevationLayout);
|
||||||
|
|
||||||
QWidget *poiTab = new QWidget();
|
QWidget *poiTab = new QWidget();
|
||||||
poiTab->setLayout(poiLayout);
|
poiTab->setLayout(poiLayout);
|
||||||
@ -644,13 +656,14 @@ void OptionsDialog::accept()
|
|||||||
_options->pauseSpeed = pauseSpeed;
|
_options->pauseSpeed = pauseSpeed;
|
||||||
_options->pauseInterval = _pauseInterval->value();
|
_options->pauseInterval = _pauseInterval->value();
|
||||||
_options->useReportedSpeed = _reportedSpeed->isChecked();
|
_options->useReportedSpeed = _reportedSpeed->isChecked();
|
||||||
_options->useDEMElevation = _demElevation->isChecked();
|
_options->dataUseDEM = _dataDEMElevation->isChecked();
|
||||||
|
|
||||||
qreal poiRadius = (_options->units == Imperial)
|
qreal poiRadius = (_options->units == Imperial)
|
||||||
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
||||||
? _poiRadius->value() * NMIINM : _poiRadius->value() * KMINM;
|
? _poiRadius->value() * NMIINM : _poiRadius->value() * KMINM;
|
||||||
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
||||||
_options->poiRadius = poiRadius;
|
_options->poiRadius = poiRadius;
|
||||||
|
_options->poiUseDEM = _poiDEMElevation->isChecked();
|
||||||
|
|
||||||
_options->useOpenGL = _useOpenGL->isChecked();
|
_options->useOpenGL = _useOpenGL->isChecked();
|
||||||
#ifdef ENABLE_HTTP2
|
#ifdef ENABLE_HTTP2
|
||||||
|
@ -48,9 +48,10 @@ struct Options {
|
|||||||
qreal pauseSpeed;
|
qreal pauseSpeed;
|
||||||
int pauseInterval;
|
int pauseInterval;
|
||||||
bool useReportedSpeed;
|
bool useReportedSpeed;
|
||||||
bool useDEMElevation;
|
bool dataUseDEM;
|
||||||
// POI
|
// POI
|
||||||
int poiRadius;
|
int poiRadius;
|
||||||
|
bool poiUseDEM;
|
||||||
// System
|
// System
|
||||||
bool useOpenGL;
|
bool useOpenGL;
|
||||||
#ifdef ENABLE_HTTP2
|
#ifdef ENABLE_HTTP2
|
||||||
@ -125,10 +126,12 @@ private:
|
|||||||
QSpinBox *_pauseInterval;
|
QSpinBox *_pauseInterval;
|
||||||
QRadioButton *_computedSpeed;
|
QRadioButton *_computedSpeed;
|
||||||
QRadioButton *_reportedSpeed;
|
QRadioButton *_reportedSpeed;
|
||||||
QRadioButton *_gpsElevation;
|
QRadioButton *_dataGPSElevation;
|
||||||
QRadioButton *_demElevation;
|
QRadioButton *_dataDEMElevation;
|
||||||
// POI
|
// POI
|
||||||
QDoubleSpinBox *_poiRadius;
|
QDoubleSpinBox *_poiRadius;
|
||||||
|
QRadioButton *_poiGPSElevation;
|
||||||
|
QRadioButton *_poiDEMElevation;
|
||||||
// System
|
// System
|
||||||
QSpinBox *_pixmapCache;
|
QSpinBox *_pixmapCache;
|
||||||
QSpinBox *_connectionTimeout;
|
QSpinBox *_connectionTimeout;
|
||||||
|
@ -126,10 +126,12 @@
|
|||||||
#define PAUSE_INTERVAL_DEFAULT 10 /* s */
|
#define PAUSE_INTERVAL_DEFAULT 10 /* s */
|
||||||
#define USE_REPORTED_SPEED_SETTING "useReportedSpeed"
|
#define USE_REPORTED_SPEED_SETTING "useReportedSpeed"
|
||||||
#define USE_REPORTED_SPEED_DEFAULT false
|
#define USE_REPORTED_SPEED_DEFAULT false
|
||||||
#define USE_DEM_ELEVATION_SETTING "useDEMElevation"
|
#define DATA_USE_DEM_SETTING "dataUseDEM"
|
||||||
#define USE_DEM_ELEVATION_DEFAULT false
|
#define DATA_USE_DEM_DEFAULT false
|
||||||
#define POI_RADIUS_SETTING "poiRadius"
|
#define POI_RADIUS_SETTING "poiRadius"
|
||||||
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||||
|
#define POI_USE_DEM_SETTING "poiUseDEM"
|
||||||
|
#define POI_USE_DEM_DEFAULT false
|
||||||
#define USE_OPENGL_SETTING "useOpenGL"
|
#define USE_OPENGL_SETTING "useOpenGL"
|
||||||
#define USE_OPENGL_DEFAULT false
|
#define USE_OPENGL_DEFAULT false
|
||||||
#define ENABLE_HTTP2_SETTING "enableHTTP2"
|
#define ENABLE_HTTP2_SETTING "enableHTTP2"
|
||||||
|
@ -51,7 +51,7 @@ static QHash<QString, Parser*> parsers()
|
|||||||
|
|
||||||
|
|
||||||
QHash<QString, Parser*> Data::_parsers = parsers();
|
QHash<QString, Parser*> Data::_parsers = parsers();
|
||||||
bool Data::_useDEMElevation = false;
|
bool Data::_useDEM = false;
|
||||||
|
|
||||||
Data::~Data()
|
Data::~Data()
|
||||||
{
|
{
|
||||||
@ -68,7 +68,7 @@ void Data::processData()
|
|||||||
for (int i = 0; i < _routeData.count(); i++)
|
for (int i = 0; i < _routeData.count(); i++)
|
||||||
_routes.append(new Route(_routeData.at(i)));
|
_routes.append(new Route(_routeData.at(i)));
|
||||||
for (int i = 0; i < _waypoints.size(); i++) {
|
for (int i = 0; i < _waypoints.size(); i++) {
|
||||||
if (!_waypoints.at(i).hasElevation() || _useDEMElevation) {
|
if (!_waypoints.at(i).hasElevation() || _useDEM) {
|
||||||
qreal elevation = DEM::elevation(_waypoints.at(i).coordinates());
|
qreal elevation = DEM::elevation(_waypoints.at(i).coordinates());
|
||||||
if (!std::isnan(elevation))
|
if (!std::isnan(elevation))
|
||||||
_waypoints[i].setElevation(elevation);
|
_waypoints[i].setElevation(elevation);
|
||||||
@ -76,7 +76,7 @@ void Data::processData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Data::Data(const QString &fileName)
|
Data::Data(const QString &fileName, bool poi)
|
||||||
{
|
{
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
QFileInfo fi(fileName);
|
QFileInfo fi(fileName);
|
||||||
@ -92,7 +92,8 @@ Data::Data(const QString &fileName)
|
|||||||
QHash<QString, Parser*>::iterator it;
|
QHash<QString, Parser*>::iterator it;
|
||||||
if ((it = _parsers.find(fi.suffix().toLower())) != _parsers.end()) {
|
if ((it = _parsers.find(fi.suffix().toLower())) != _parsers.end()) {
|
||||||
if (it.value()->parse(&file, _trackData, _routeData, _waypoints)) {
|
if (it.value()->parse(&file, _trackData, _routeData, _waypoints)) {
|
||||||
processData();
|
if (!poi)
|
||||||
|
processData();
|
||||||
_valid = true;
|
_valid = true;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -102,7 +103,8 @@ Data::Data(const QString &fileName)
|
|||||||
} else {
|
} else {
|
||||||
for (it = _parsers.begin(); it != _parsers.end(); it++) {
|
for (it = _parsers.begin(); it != _parsers.end(); it++) {
|
||||||
if (it.value()->parse(&file, _trackData, _routeData, _waypoints)) {
|
if (it.value()->parse(&file, _trackData, _routeData, _waypoints)) {
|
||||||
processData();
|
if (!poi)
|
||||||
|
processData();
|
||||||
_valid = true;
|
_valid = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -148,9 +150,9 @@ QStringList Data::filter()
|
|||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Data::useDEMElevation(bool use)
|
void Data::useDEM(bool use)
|
||||||
{
|
{
|
||||||
_useDEMElevation = use;
|
_useDEM = use;
|
||||||
Route::useDEMElevation(use);
|
Route::useDEM(use);
|
||||||
Track::useDEMElevation(use);
|
Track::useDEM(use);
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
class Data
|
class Data
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Data(const QString &fileName);
|
Data(const QString &fileName, bool poi = false);
|
||||||
~Data();
|
~Data();
|
||||||
|
|
||||||
bool isValid() const {return _valid;}
|
bool isValid() const {return _valid;}
|
||||||
@ -28,7 +28,7 @@ public:
|
|||||||
static QString formats();
|
static QString formats();
|
||||||
static QStringList filter();
|
static QStringList filter();
|
||||||
|
|
||||||
static void useDEMElevation(bool use);
|
static void useDEM(bool use);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processData();
|
void processData();
|
||||||
@ -45,7 +45,7 @@ private:
|
|||||||
QList<RouteData> _routeData;
|
QList<RouteData> _routeData;
|
||||||
|
|
||||||
static QHash<QString, Parser*> _parsers;
|
static QHash<QString, Parser*> _parsers;
|
||||||
static bool _useDEMElevation;
|
static bool _useDEM;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATA_H
|
#endif // DATA_H
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "common/greatcircle.h"
|
#include "common/greatcircle.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
#include "dem.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
|
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ POI::POI(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
bool POI::loadFile(const QString &path, bool dir)
|
bool POI::loadFile(const QString &path, bool dir)
|
||||||
{
|
{
|
||||||
Data data(path);
|
Data data(path, true);
|
||||||
FileIndex index;
|
FileIndex index;
|
||||||
|
|
||||||
index.enabled = true;
|
index.enabled = true;
|
||||||
@ -107,6 +108,17 @@ void POI::search(const RectC &rect, QSet<int> &set) const
|
|||||||
_tree.Search(min, max, cb, &set);
|
_tree.Search(min, max, cb, &set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void POI::appendElevation(QList<Waypoint> &points) const
|
||||||
|
{
|
||||||
|
for (int i = 0; i < points.size(); i++) {
|
||||||
|
if (!points.at(i).hasElevation() || _useDEM) {
|
||||||
|
qreal elevation = DEM::elevation(points.at(i).coordinates());
|
||||||
|
if (!std::isnan(elevation))
|
||||||
|
points[i].setElevation(elevation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QList<Waypoint> POI::points(const Path &path) const
|
QList<Waypoint> POI::points(const Path &path) const
|
||||||
{
|
{
|
||||||
QList<Waypoint> ret;
|
QList<Waypoint> ret;
|
||||||
@ -137,6 +149,8 @@ QList<Waypoint> POI::points(const Path &path) const
|
|||||||
for (it = set.constBegin(); it != set.constEnd(); ++it)
|
for (it = set.constBegin(); it != set.constEnd(); ++it)
|
||||||
ret.append(_data.at(*it));
|
ret.append(_data.at(*it));
|
||||||
|
|
||||||
|
appendElevation(ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +172,8 @@ QList<Waypoint> POI::points(const Waypoint &point) const
|
|||||||
for (it = set.constBegin(); it != set.constEnd(); ++it)
|
for (it = set.constBegin(); it != set.constEnd(); ++it)
|
||||||
ret.append(_data.at(*it));
|
ret.append(_data.at(*it));
|
||||||
|
|
||||||
|
appendElevation(ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,3 +219,10 @@ void POI::setRadius(unsigned radius)
|
|||||||
|
|
||||||
emit pointsChanged();
|
emit pointsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void POI::useDEM(bool use)
|
||||||
|
{
|
||||||
|
_useDEM = use;
|
||||||
|
|
||||||
|
emit pointsChanged();
|
||||||
|
}
|
||||||
|
@ -24,6 +24,7 @@ public:
|
|||||||
|
|
||||||
unsigned radius() const {return _radius;}
|
unsigned radius() const {return _radius;}
|
||||||
void setRadius(unsigned radius);
|
void setRadius(unsigned radius);
|
||||||
|
void useDEM(bool use);
|
||||||
|
|
||||||
QList<Waypoint> points(const Path &path) const;
|
QList<Waypoint> points(const Path &path) const;
|
||||||
QList<Waypoint> points(const Waypoint &point) const;
|
QList<Waypoint> points(const Waypoint &point) const;
|
||||||
@ -45,6 +46,7 @@ private:
|
|||||||
|
|
||||||
bool loadFile(const QString &path, bool dir);
|
bool loadFile(const QString &path, bool dir);
|
||||||
void search(const RectC &rect, QSet<int> &set) const;
|
void search(const RectC &rect, QSet<int> &set) const;
|
||||||
|
void appendElevation(QList<Waypoint> &points) const;
|
||||||
|
|
||||||
POITree _tree;
|
POITree _tree;
|
||||||
QVector<Waypoint> _data;
|
QVector<Waypoint> _data;
|
||||||
@ -52,6 +54,7 @@ private:
|
|||||||
QList<FileIndex> _indexes;
|
QList<FileIndex> _indexes;
|
||||||
|
|
||||||
unsigned _radius;
|
unsigned _radius;
|
||||||
|
bool _useDEM;
|
||||||
|
|
||||||
QString _errorString;
|
QString _errorString;
|
||||||
int _errorLine;
|
int _errorLine;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
||||||
|
|
||||||
bool Route::_useDEMElevation = false;
|
bool Route::_useDEM = false;
|
||||||
|
|
||||||
Route::Route(const RouteData &data) : _data(data)
|
Route::Route(const RouteData &data) : _data(data)
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ Graph Route::elevation() const
|
|||||||
Graph graph;
|
Graph graph;
|
||||||
|
|
||||||
for (int i = 0; i < _data.size(); i++) {
|
for (int i = 0; i < _data.size(); i++) {
|
||||||
if (_data.at(i).hasElevation() && !_useDEMElevation)
|
if (_data.at(i).hasElevation() && !_useDEM)
|
||||||
graph.append(GraphPoint(_distance.at(i), NAN,
|
graph.append(GraphPoint(_distance.at(i), NAN,
|
||||||
_data.at(i).elevation()));
|
_data.at(i).elevation()));
|
||||||
else {
|
else {
|
||||||
|
@ -24,13 +24,13 @@ public:
|
|||||||
|
|
||||||
bool isNull() const {return (_data.count() < 2);}
|
bool isNull() const {return (_data.count() < 2);}
|
||||||
|
|
||||||
static void useDEMElevation(bool use) {_useDEMElevation = use;}
|
static void useDEM(bool use) {_useDEM = use;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const RouteData &_data;
|
const RouteData &_data;
|
||||||
QVector<qreal> _distance;
|
QVector<qreal> _distance;
|
||||||
|
|
||||||
static bool _useDEMElevation;
|
static bool _useDEM;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ROUTE_H
|
#endif // ROUTE_H
|
||||||
|
@ -13,7 +13,7 @@ int Track::_pauseInterval = 10;
|
|||||||
|
|
||||||
bool Track::_outlierEliminate = true;
|
bool Track::_outlierEliminate = true;
|
||||||
bool Track::_useReportedSpeed = false;
|
bool Track::_useReportedSpeed = false;
|
||||||
bool Track::_useDEMElevation = false;
|
bool Track::_useDEM = false;
|
||||||
|
|
||||||
|
|
||||||
static qreal median(QVector<qreal> &v)
|
static qreal median(QVector<qreal> &v)
|
||||||
@ -154,7 +154,7 @@ Graph Track::elevation() const
|
|||||||
if (_outliers.contains(i))
|
if (_outliers.contains(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (_data.at(i).hasElevation() && !_useDEMElevation)
|
if (_data.at(i).hasElevation() && !_useDEM)
|
||||||
raw.append(GraphPoint(_distance.at(i), _time.at(i),
|
raw.append(GraphPoint(_distance.at(i), _time.at(i),
|
||||||
_data.at(i).elevation()));
|
_data.at(i).elevation()));
|
||||||
else {
|
else {
|
||||||
|
@ -45,7 +45,7 @@ public:
|
|||||||
static void setOutlierElimination(bool eliminate)
|
static void setOutlierElimination(bool eliminate)
|
||||||
{_outlierEliminate = eliminate;}
|
{_outlierEliminate = eliminate;}
|
||||||
static void useReportedSpeed(bool use) {_useReportedSpeed = use;}
|
static void useReportedSpeed(bool use) {_useReportedSpeed = use;}
|
||||||
static void useDEMElevation(bool use) {_useDEMElevation = use;}
|
static void useDEM(bool use) {_useDEM = use;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool discardStopPoint(int i) const;
|
bool discardStopPoint(int i) const;
|
||||||
@ -70,7 +70,7 @@ private:
|
|||||||
static qreal _pauseSpeed;
|
static qreal _pauseSpeed;
|
||||||
static int _pauseInterval;
|
static int _pauseInterval;
|
||||||
static bool _useReportedSpeed;
|
static bool _useReportedSpeed;
|
||||||
static bool _useDEMElevation;
|
static bool _useDEM;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRACK_H
|
#endif // TRACK_H
|
||||||
|
Loading…
Reference in New Issue
Block a user