mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-27 21:24:47 +01:00
Prefer the map DEM for track/waypoints elevation if present
This commit is contained in:
parent
be75165088
commit
b6b64065fb
12
gpxsee.pro
12
gpxsee.pro
@ -39,12 +39,9 @@ HEADERS += src/common/config.h \
|
|||||||
src/common/greatcircle.h \
|
src/common/greatcircle.h \
|
||||||
src/common/programpaths.h \
|
src/common/programpaths.h \
|
||||||
src/common/tifffile.h \
|
src/common/tifffile.h \
|
||||||
src/common/downloader.h \
|
|
||||||
src/common/polygon.h \
|
src/common/polygon.h \
|
||||||
src/common/color.h \
|
src/common/color.h \
|
||||||
src/common/csv.h \
|
src/common/csv.h \
|
||||||
src/common/dem.h \
|
|
||||||
src/common/demloader.h \
|
|
||||||
src/GUI/crosshairitem.h \
|
src/GUI/crosshairitem.h \
|
||||||
src/GUI/motioninfoitem.h \
|
src/GUI/motioninfoitem.h \
|
||||||
src/GUI/pluginparameters.h \
|
src/GUI/pluginparameters.h \
|
||||||
@ -122,6 +119,8 @@ HEADERS += src/common/config.h \
|
|||||||
src/data/gpsdumpparser.h \
|
src/data/gpsdumpparser.h \
|
||||||
src/data/style.h \
|
src/data/style.h \
|
||||||
src/data/twonavparser.h \
|
src/data/twonavparser.h \
|
||||||
|
src/map/downloader.h \
|
||||||
|
src/map/demloader.h \
|
||||||
src/map/ENC/attributes.h \
|
src/map/ENC/attributes.h \
|
||||||
src/map/ENC/mapdata.h \
|
src/map/ENC/mapdata.h \
|
||||||
src/map/ENC/atlasdata.h \
|
src/map/ENC/atlasdata.h \
|
||||||
@ -196,6 +195,7 @@ HEADERS += src/common/config.h \
|
|||||||
src/map/sqlitemap.h \
|
src/map/sqlitemap.h \
|
||||||
src/map/utm.h \
|
src/map/utm.h \
|
||||||
src/map/map.h \
|
src/map/map.h \
|
||||||
|
src/map/dem.h \
|
||||||
src/map/maplist.h \
|
src/map/maplist.h \
|
||||||
src/map/onlinemap.h \
|
src/map/onlinemap.h \
|
||||||
src/map/tile.h \
|
src/map/tile.h \
|
||||||
@ -281,10 +281,7 @@ SOURCES += src/main.cpp \
|
|||||||
src/common/greatcircle.cpp \
|
src/common/greatcircle.cpp \
|
||||||
src/common/programpaths.cpp \
|
src/common/programpaths.cpp \
|
||||||
src/common/tifffile.cpp \
|
src/common/tifffile.cpp \
|
||||||
src/common/downloader.cpp \
|
|
||||||
src/common/csv.cpp \
|
src/common/csv.cpp \
|
||||||
src/common/dem.cpp \
|
|
||||||
src/common/demloader.cpp \
|
|
||||||
src/GUI/crosshairitem.cpp \
|
src/GUI/crosshairitem.cpp \
|
||||||
src/GUI/motioninfoitem.cpp \
|
src/GUI/motioninfoitem.cpp \
|
||||||
src/GUI/pluginparameters.cpp \
|
src/GUI/pluginparameters.cpp \
|
||||||
@ -347,6 +344,8 @@ SOURCES += src/main.cpp \
|
|||||||
src/GUI/pngexportdialog.cpp \
|
src/GUI/pngexportdialog.cpp \
|
||||||
src/GUI/projectioncombobox.cpp \
|
src/GUI/projectioncombobox.cpp \
|
||||||
src/GUI/passwordedit.cpp \
|
src/GUI/passwordedit.cpp \
|
||||||
|
src/map/downloader.cpp \
|
||||||
|
src/map/demloader.cpp \
|
||||||
src/map/ENC/atlasdata.cpp \
|
src/map/ENC/atlasdata.cpp \
|
||||||
src/map/ENC/mapdata.cpp \
|
src/map/ENC/mapdata.cpp \
|
||||||
src/map/ENC/rastertile.cpp \
|
src/map/ENC/rastertile.cpp \
|
||||||
@ -436,6 +435,7 @@ SOURCES += src/main.cpp \
|
|||||||
src/map/geocentric.cpp \
|
src/map/geocentric.cpp \
|
||||||
src/map/jnxmap.cpp \
|
src/map/jnxmap.cpp \
|
||||||
src/map/map.cpp \
|
src/map/map.cpp \
|
||||||
|
src/map/dem.cpp \
|
||||||
src/map/geotiffmap.cpp \
|
src/map/geotiffmap.cpp \
|
||||||
src/map/image.cpp \
|
src/map/image.cpp \
|
||||||
src/map/mbtilesmap.cpp \
|
src/map/mbtilesmap.cpp \
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
#include "common/programpaths.h"
|
#include "common/programpaths.h"
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "common/downloader.h"
|
#include "map/downloader.h"
|
||||||
#include "common/dem.h"
|
#include "map/dem.h"
|
||||||
#include "map/ellipsoid.h"
|
#include "map/ellipsoid.h"
|
||||||
#include "map/gcs.h"
|
#include "map/gcs.h"
|
||||||
#include "map/conversion.h"
|
#include "map/conversion.h"
|
||||||
|
@ -39,8 +39,9 @@ void CadenceGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> CadenceGraph::loadData(const Data &data)
|
QList<GraphItem*> CadenceGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(map);
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
~CadenceGraph();
|
~CadenceGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Cadence");}
|
QString label() const {return tr("Cadence");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
|
||||||
|
@ -118,14 +118,14 @@ GraphItem *ElevationGraph::loadGraph(const Graph &graph, PathType type,
|
|||||||
return gi;
|
return gi;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> ElevationGraph::loadData(const Data &data)
|
QList<GraphItem*> ElevationGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
GraphItem *primary, *secondary;
|
GraphItem *primary, *secondary;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
QColor color(_palette.nextColor());
|
QColor color(_palette.nextColor());
|
||||||
const GraphPair &gp = data.tracks().at(i).elevation();
|
const GraphPair &gp = data.tracks().at(i).elevation(map);
|
||||||
|
|
||||||
primary = loadGraph(gp.primary(), TrackPath, color, true);
|
primary = loadGraph(gp.primary(), TrackPath, color, true);
|
||||||
secondary = primary
|
secondary = primary
|
||||||
@ -137,7 +137,7 @@ QList<GraphItem*> ElevationGraph::loadData(const Data &data)
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < data.routes().count(); i++) {
|
for (int i = 0; i < data.routes().count(); i++) {
|
||||||
QColor color(_palette.nextColor());
|
QColor color(_palette.nextColor());
|
||||||
const GraphPair &gp = data.routes().at(i).elevation();
|
const GraphPair &gp = data.routes().at(i).elevation(map);
|
||||||
|
|
||||||
primary = loadGraph(gp.primary(), RoutePath, color, true);
|
primary = loadGraph(gp.primary(), RoutePath, color, true);
|
||||||
secondary = primary
|
secondary = primary
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
~ElevationGraph();
|
~ElevationGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Elevation");}
|
QString label() const {return tr("Elevation");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
@ -43,8 +43,9 @@ void GearRatioGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> GearRatioGraph::loadData(const Data &data)
|
QList<GraphItem*> GearRatioGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(map);
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
~GearRatioGraph();
|
~GearRatioGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Gear ratio");}
|
QString label() const {return tr("Gear ratio");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "timetype.h"
|
#include "timetype.h"
|
||||||
|
|
||||||
|
class Map;
|
||||||
class Data;
|
class Data;
|
||||||
class GraphItem;
|
class GraphItem;
|
||||||
|
|
||||||
@ -24,7 +25,7 @@ public:
|
|||||||
virtual ~GraphTab() {}
|
virtual ~GraphTab() {}
|
||||||
|
|
||||||
virtual QString label() const = 0;
|
virtual QString label() const = 0;
|
||||||
virtual QList<GraphItem*> loadData(const Data &data) = 0;
|
virtual QList<GraphItem*> loadData(const Data &data, Map *map) = 0;
|
||||||
virtual void clear() {GraphView::clear();}
|
virtual void clear() {GraphView::clear();}
|
||||||
virtual void setUnits(enum Units units) {GraphView::setUnits(units);}
|
virtual void setUnits(enum Units units) {GraphView::setUnits(units);}
|
||||||
virtual void setGraphType(GraphType type) {GraphView::setGraphType(type);}
|
virtual void setGraphType(GraphType type) {GraphView::setGraphType(type);}
|
||||||
|
@ -29,10 +29,10 @@
|
|||||||
#include <QGeoPositionInfoSource>
|
#include <QGeoPositionInfoSource>
|
||||||
#include "common/config.h"
|
#include "common/config.h"
|
||||||
#include "common/programpaths.h"
|
#include "common/programpaths.h"
|
||||||
#include "common/downloader.h"
|
|
||||||
#include "common/demloader.h"
|
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "data/poi.h"
|
#include "data/poi.h"
|
||||||
|
#include "map/downloader.h"
|
||||||
|
#include "map/demloader.h"
|
||||||
#include "map/maplist.h"
|
#include "map/maplist.h"
|
||||||
#include "map/emptymap.h"
|
#include "map/emptymap.h"
|
||||||
#include "map/crs.h"
|
#include "map/crs.h"
|
||||||
@ -1145,7 +1145,7 @@ void GUI::loadData(const Data &data)
|
|||||||
_pathName = QString();
|
_pathName = QString();
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
graphs.append(_tabs.at(i)->loadData(data));
|
graphs.append(_tabs.at(i)->loadData(data, _map));
|
||||||
if (updateGraphTabs())
|
if (updateGraphTabs())
|
||||||
_splitter->refresh();
|
_splitter->refresh();
|
||||||
paths = _mapView->loadData(data);
|
paths = _mapView->loadData(data);
|
||||||
|
@ -39,8 +39,9 @@ void HeartRateGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> HeartRateGraph::loadData(const Data &data)
|
QList<GraphItem*> HeartRateGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(map);
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
~HeartRateGraph();
|
~HeartRateGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Heart rate");}
|
QString label() const {return tr("Heart rate");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
|
||||||
|
@ -39,8 +39,9 @@ void PowerGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> PowerGraph::loadData(const Data &data)
|
QList<GraphItem*> PowerGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(map);
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
~PowerGraph();
|
~PowerGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Power");}
|
QString label() const {return tr("Power");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
|
||||||
|
@ -69,8 +69,9 @@ GraphItem *SpeedGraph::loadGraph(const Graph &graph, const Track &track,
|
|||||||
return gi;
|
return gi;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> SpeedGraph::loadData(const Data &data)
|
QList<GraphItem*> SpeedGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(map);
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
~SpeedGraph();
|
~SpeedGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Speed");}
|
QString label() const {return tr("Speed");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
void setTimeType(TimeType type);
|
void setTimeType(TimeType type);
|
||||||
|
@ -43,8 +43,9 @@ void TemperatureGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GraphItem*> TemperatureGraph::loadData(const Data &data)
|
QList<GraphItem*> TemperatureGraph::loadData(const Data &data, Map *map)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(map);
|
||||||
QList<GraphItem*> graphs;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
@ -14,7 +14,7 @@ public:
|
|||||||
~TemperatureGraph();
|
~TemperatureGraph();
|
||||||
|
|
||||||
QString label() const {return tr("Temperature");}
|
QString label() const {return tr("Temperature");}
|
||||||
QList<GraphItem*> loadData(const Data &data);
|
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
@ -25,7 +25,7 @@ ToolTip WaypointItem::info() const
|
|||||||
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
||||||
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
||||||
Format::coordinates(_waypoint.coordinates(), _format));
|
Format::coordinates(_waypoint.coordinates(), _format));
|
||||||
QPair<qreal, qreal> elevations(_waypoint.elevations());
|
QPair<qreal, qreal> elevations(_waypoint.elevations(_map));
|
||||||
if (!std::isnan(elevations.first)) {
|
if (!std::isnan(elevations.first)) {
|
||||||
QString val = Format::elevation(elevations.first, _units);
|
QString val = Format::elevation(elevations.first, _units);
|
||||||
if (!std::isnan(elevations.second))
|
if (!std::isnan(elevations.second))
|
||||||
@ -71,7 +71,7 @@ ToolTip WaypointItem::info() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||||
QGraphicsItem *parent) : GraphicsItem(parent)
|
QGraphicsItem *parent) : GraphicsItem(parent), _map(map)
|
||||||
{
|
{
|
||||||
_waypoint = waypoint;
|
_waypoint = waypoint;
|
||||||
_showLabel = false;
|
_showLabel = false;
|
||||||
@ -93,6 +93,12 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
|||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaypointItem::setMap(Map *map)
|
||||||
|
{
|
||||||
|
_map = map;
|
||||||
|
setPos(map->ll2xy(_waypoint.coordinates()));
|
||||||
|
}
|
||||||
|
|
||||||
void WaypointItem::updateCache()
|
void WaypointItem::updateCache()
|
||||||
{
|
{
|
||||||
QPainterPath p;
|
QPainterPath p;
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
|
|
||||||
const Waypoint &waypoint() const {return _waypoint;}
|
const Waypoint &waypoint() const {return _waypoint;}
|
||||||
|
|
||||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
void setMap(Map *map);
|
||||||
void setSize(int size);
|
void setSize(int size);
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void showLabel(bool show);
|
void showLabel(bool show);
|
||||||
@ -51,6 +51,8 @@ private:
|
|||||||
|
|
||||||
Waypoint _waypoint;
|
Waypoint _waypoint;
|
||||||
|
|
||||||
|
Map *_map;
|
||||||
|
|
||||||
QColor _color;
|
QColor _color;
|
||||||
int _size;
|
int _size;
|
||||||
bool _showLabel;
|
bool _showLabel;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "common/dem.h"
|
#include "map/map.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
|
|
||||||
bool Route::_useDEM = false;
|
bool Route::_useDEM = false;
|
||||||
@ -49,19 +49,17 @@ Graph Route::gpsElevation() const
|
|||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graph Route::demElevation() const
|
Graph Route::demElevation(Map *map) const
|
||||||
{
|
{
|
||||||
Graph graph;
|
Graph graph;
|
||||||
QDateTime date;
|
QDateTime date;
|
||||||
GraphSegment gs(date);
|
GraphSegment gs(date);
|
||||||
|
|
||||||
DEM::lock();
|
|
||||||
for (int i = 0; i < _data.size(); i++) {
|
for (int i = 0; i < _data.size(); i++) {
|
||||||
qreal dem = DEM::elevation(_data.at(i).coordinates());
|
qreal dem = map->elevation(_data.at(i).coordinates());
|
||||||
if (!std::isnan(dem))
|
if (!std::isnan(dem))
|
||||||
gs.append(GraphPoint(_distance.at(i), NAN, dem));
|
gs.append(GraphPoint(_distance.at(i), NAN, dem));
|
||||||
}
|
}
|
||||||
DEM::unlock();
|
|
||||||
|
|
||||||
if (gs.size() >= 2)
|
if (gs.size() >= 2)
|
||||||
graph.append(gs);
|
graph.append(gs);
|
||||||
@ -72,18 +70,18 @@ Graph Route::demElevation() const
|
|||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphPair Route::elevation() const
|
GraphPair Route::elevation(Map *map) const
|
||||||
{
|
{
|
||||||
if (_useDEM) {
|
if (_useDEM) {
|
||||||
Graph dem(demElevation());
|
Graph dem(demElevation(map));
|
||||||
return (dem.isEmpty())
|
return (dem.isEmpty())
|
||||||
? GraphPair(gpsElevation(), Graph())
|
? GraphPair(gpsElevation(), Graph())
|
||||||
: GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
: GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
||||||
} else {
|
} else {
|
||||||
Graph gps(gpsElevation());
|
Graph gps(gpsElevation());
|
||||||
return (gps.isEmpty())
|
return (gps.isEmpty())
|
||||||
? GraphPair(demElevation(), Graph())
|
? GraphPair(demElevation(map), Graph())
|
||||||
: GraphPair(gps, _show2ndElevation ? demElevation() : Graph());
|
: GraphPair(gps, _show2ndElevation ? demElevation(map) : Graph());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
|
class Map;
|
||||||
|
|
||||||
class Route
|
class Route
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -13,7 +15,7 @@ public:
|
|||||||
|
|
||||||
const RouteData &data() const {return _data;}
|
const RouteData &data() const {return _data;}
|
||||||
Path path() const;
|
Path path() const;
|
||||||
GraphPair elevation() const;
|
GraphPair elevation(Map *map) const;
|
||||||
qreal distance() const;
|
qreal distance() const;
|
||||||
|
|
||||||
const QString &name() const {return _data.name();}
|
const QString &name() const {return _data.name();}
|
||||||
@ -30,7 +32,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Graph gpsElevation() const;
|
Graph gpsElevation() const;
|
||||||
Graph demElevation() const;
|
Graph demElevation(Map *map) const;
|
||||||
|
|
||||||
RouteData _data;
|
RouteData _data;
|
||||||
QVector<qreal> _distance;
|
QVector<qreal> _distance;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "common/dem.h"
|
#include "map/map.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
|
||||||
|
|
||||||
@ -277,11 +277,10 @@ Graph Track::gpsElevation() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graph Track::demElevation() const
|
Graph Track::demElevation(Map *map) const
|
||||||
{
|
{
|
||||||
Graph ret;
|
Graph ret;
|
||||||
|
|
||||||
DEM::lock();
|
|
||||||
for (int i = 0; i < _data.size(); i++) {
|
for (int i = 0; i < _data.size(); i++) {
|
||||||
const SegmentData &sd = _data.at(i);
|
const SegmentData &sd = _data.at(i);
|
||||||
if (sd.size() < 2)
|
if (sd.size() < 2)
|
||||||
@ -290,7 +289,7 @@ Graph Track::demElevation() const
|
|||||||
GraphSegment gs(seg.start);
|
GraphSegment gs(seg.start);
|
||||||
|
|
||||||
for (int j = 0; j < sd.size(); j++) {
|
for (int j = 0; j < sd.size(); j++) {
|
||||||
qreal dem = DEM::elevation(sd.at(j).coordinates());
|
qreal dem = map->elevation(sd.at(j).coordinates());
|
||||||
if (std::isnan(dem) || seg.outliers.contains(j))
|
if (std::isnan(dem) || seg.outliers.contains(j))
|
||||||
continue;
|
continue;
|
||||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), dem));
|
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), dem));
|
||||||
@ -299,7 +298,6 @@ Graph Track::demElevation() const
|
|||||||
if (gs.size() >= 2)
|
if (gs.size() >= 2)
|
||||||
ret.append(filter(gs, _elevationWindow));
|
ret.append(filter(gs, _elevationWindow));
|
||||||
}
|
}
|
||||||
DEM::unlock();
|
|
||||||
|
|
||||||
if (_data.style().color().isValid())
|
if (_data.style().color().isValid())
|
||||||
ret.setColor(_data.style().color());
|
ret.setColor(_data.style().color());
|
||||||
@ -307,18 +305,18 @@ Graph Track::demElevation() const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphPair Track::elevation() const
|
GraphPair Track::elevation(Map *map) const
|
||||||
{
|
{
|
||||||
if (_useDEM) {
|
if (_useDEM) {
|
||||||
Graph dem(demElevation());
|
Graph dem(demElevation(map));
|
||||||
return (dem.isEmpty())
|
return (dem.isEmpty())
|
||||||
? GraphPair(gpsElevation(), Graph())
|
? GraphPair(gpsElevation(), Graph())
|
||||||
: GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
: GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
||||||
} else {
|
} else {
|
||||||
Graph gps(gpsElevation());
|
Graph gps(gpsElevation());
|
||||||
return (gps.isEmpty())
|
return (gps.isEmpty())
|
||||||
? GraphPair(demElevation(), Graph())
|
? GraphPair(demElevation(map), Graph())
|
||||||
: GraphPair(gps, _show2ndElevation ? demElevation() : Graph());
|
: GraphPair(gps, _show2ndElevation ? demElevation(map) : Graph());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "graph.h"
|
#include "graph.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
|
class Map;
|
||||||
|
|
||||||
class Track
|
class Track
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ public:
|
|||||||
|
|
||||||
Path path() const;
|
Path path() const;
|
||||||
|
|
||||||
GraphPair elevation() const;
|
GraphPair elevation(Map *map) const;
|
||||||
GraphPair speed() const;
|
GraphPair speed() const;
|
||||||
Graph heartRate() const;
|
Graph heartRate() const;
|
||||||
Graph temperature() const;
|
Graph temperature() const;
|
||||||
@ -68,7 +69,7 @@ private:
|
|||||||
qreal lastTime(int seg);
|
qreal lastTime(int seg);
|
||||||
bool discardStopPoint(const Segment &seg, int i) const;
|
bool discardStopPoint(const Segment &seg, int i) const;
|
||||||
|
|
||||||
Graph demElevation() const;
|
Graph demElevation(Map *map) const;
|
||||||
Graph gpsElevation() const;
|
Graph gpsElevation() const;
|
||||||
Graph reportedSpeed() const;
|
Graph reportedSpeed() const;
|
||||||
Graph computedSpeed() const;
|
Graph computedSpeed() const;
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include "common/dem.h"
|
#include "map/map.h"
|
||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
|
|
||||||
bool Waypoint::_useDEM = false;
|
bool Waypoint::_useDEM = false;
|
||||||
bool Waypoint::_show2ndElevation = false;
|
bool Waypoint::_show2ndElevation = false;
|
||||||
QHash<QString, QPixmap> Waypoint::_symbolIcons;
|
QHash<QString, QPixmap> Waypoint::_symbolIcons;
|
||||||
|
|
||||||
QPair<qreal, qreal> Waypoint::elevations() const
|
QPair<qreal, qreal> Waypoint::elevations(Map *map) const
|
||||||
{
|
{
|
||||||
if (_useDEM) {
|
if (_useDEM) {
|
||||||
DEM::lock();
|
qreal dem = map->elevation(coordinates());
|
||||||
qreal dem = DEM::elevation(coordinates());
|
|
||||||
DEM::unlock();
|
|
||||||
if (!std::isnan(dem))
|
if (!std::isnan(dem))
|
||||||
return QPair<qreal, qreal>(dem, _show2ndElevation ? elevation()
|
return QPair<qreal, qreal>(dem, _show2ndElevation ? elevation()
|
||||||
: NAN);
|
: NAN);
|
||||||
@ -20,12 +18,10 @@ QPair<qreal, qreal> Waypoint::elevations() const
|
|||||||
return QPair<qreal, qreal>(elevation(), NAN);
|
return QPair<qreal, qreal>(elevation(), NAN);
|
||||||
} else {
|
} else {
|
||||||
if (hasElevation()) {
|
if (hasElevation()) {
|
||||||
DEM::lock();
|
qreal dem = _show2ndElevation ? map->elevation(coordinates()) : NAN;
|
||||||
qreal dem = _show2ndElevation ? DEM::elevation(coordinates()) : NAN;
|
|
||||||
DEM::unlock();
|
|
||||||
return QPair<qreal, qreal>(elevation(), dem);
|
return QPair<qreal, qreal>(elevation(), dem);
|
||||||
} else
|
} else
|
||||||
return QPair<qreal, qreal>(DEM::elevation(coordinates()), NAN);
|
return QPair<qreal, qreal>(map->elevation(coordinates()), NAN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include "link.h"
|
#include "link.h"
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
|
|
||||||
|
class Map;
|
||||||
|
|
||||||
class Waypoint
|
class Waypoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -33,7 +35,7 @@ public:
|
|||||||
qreal elevation() const {return _elevation;}
|
qreal elevation() const {return _elevation;}
|
||||||
const PointStyle &style() const {return _style;}
|
const PointStyle &style() const {return _style;}
|
||||||
|
|
||||||
QPair<qreal, qreal> elevations() const;
|
QPair<qreal, qreal> elevations(Map *map) const;
|
||||||
|
|
||||||
void setCoordinates(const Coordinates &coordinates)
|
void setCoordinates(const Coordinates &coordinates)
|
||||||
{_coordinates = coordinates;}
|
{_coordinates = coordinates;}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QCache>
|
#include <QCache>
|
||||||
#include "common/dem.h"
|
#include "map/dem.h"
|
||||||
#include "map/textpathitem.h"
|
#include "map/textpathitem.h"
|
||||||
#include "map/textpointitem.h"
|
#include "map/textpointitem.h"
|
||||||
#include "map/bitmapline.h"
|
#include "map/bitmapline.h"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <private/qzipreader_p.h>
|
#include <private/qzipreader_p.h>
|
||||||
#include "rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "dem.h"
|
#include "dem.h"
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QLineF>
|
#include <QLineF>
|
||||||
#include "common/dem.h"
|
#include "dem.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QCache>
|
#include <QCache>
|
||||||
#include "common/dem.h"
|
#include "map/dem.h"
|
||||||
#include "map/rectd.h"
|
#include "map/rectd.h"
|
||||||
#include "map/hillshading.h"
|
#include "map/hillshading.h"
|
||||||
#include "map/filter.h"
|
#include "map/filter.h"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "common/range.h"
|
#include "common/range.h"
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "common/kv.h"
|
#include "common/kv.h"
|
||||||
#include "common/downloader.h"
|
#include "downloader.h"
|
||||||
#include "coordinatesystem.h"
|
#include "coordinatesystem.h"
|
||||||
|
|
||||||
class Map;
|
class Map;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "common/programpaths.h"
|
#include "common/programpaths.h"
|
||||||
#include "common/downloader.h"
|
#include "downloader.h"
|
||||||
#include "osm.h"
|
#include "osm.h"
|
||||||
#include "onlinemap.h"
|
#include "onlinemap.h"
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include "common/downloader.h"
|
#include "downloader.h"
|
||||||
#include "rectd.h"
|
#include "rectd.h"
|
||||||
|
|
||||||
class TileLoader : public QObject
|
class TileLoader : public QObject
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include "common/range.h"
|
#include "common/range.h"
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "common/kv.h"
|
#include "common/kv.h"
|
||||||
#include "common/downloader.h"
|
#include "downloader.h"
|
||||||
#include "projection.h"
|
#include "projection.h"
|
||||||
#include "coordinatesystem.h"
|
#include "coordinatesystem.h"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "common/hash.h"
|
#include "common/hash.h"
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
#include "common/kv.h"
|
#include "common/kv.h"
|
||||||
#include "common/downloader.h"
|
#include "downloader.h"
|
||||||
#include "projection.h"
|
#include "projection.h"
|
||||||
#include "coordinatesystem.h"
|
#include "coordinatesystem.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user