mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 03:29:16 +02:00
Prefer the map DEM for track/waypoints elevation if present
This commit is contained in:
@ -13,8 +13,8 @@
|
||||
#endif // Q_OS_ANDROID
|
||||
#include "common/programpaths.h"
|
||||
#include "common/config.h"
|
||||
#include "common/downloader.h"
|
||||
#include "common/dem.h"
|
||||
#include "map/downloader.h"
|
||||
#include "map/dem.h"
|
||||
#include "map/ellipsoid.h"
|
||||
#include "map/gcs.h"
|
||||
#include "map/conversion.h"
|
||||
|
@ -39,8 +39,9 @@ void CadenceGraph::setInfo()
|
||||
clearInfo();
|
||||
}
|
||||
|
||||
QList<GraphItem*> CadenceGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> CadenceGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
~CadenceGraph();
|
||||
|
||||
QString label() const {return tr("Cadence");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void showTracks(bool show);
|
||||
|
||||
|
@ -118,14 +118,14 @@ GraphItem *ElevationGraph::loadGraph(const Graph &graph, PathType type,
|
||||
return gi;
|
||||
}
|
||||
|
||||
QList<GraphItem*> ElevationGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> ElevationGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
QList<GraphItem*> graphs;
|
||||
GraphItem *primary, *secondary;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
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);
|
||||
secondary = primary
|
||||
@ -137,7 +137,7 @@ QList<GraphItem*> ElevationGraph::loadData(const Data &data)
|
||||
}
|
||||
for (int i = 0; i < data.routes().count(); i++) {
|
||||
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);
|
||||
secondary = primary
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
~ElevationGraph();
|
||||
|
||||
QString label() const {return tr("Elevation");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void setUnits(enum Units units);
|
||||
void showTracks(bool show);
|
||||
|
@ -43,8 +43,9 @@ void GearRatioGraph::setInfo()
|
||||
clearInfo();
|
||||
}
|
||||
|
||||
QList<GraphItem*> GearRatioGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> GearRatioGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
~GearRatioGraph();
|
||||
|
||||
QString label() const {return tr("Gear ratio");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void showTracks(bool show);
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "units.h"
|
||||
#include "timetype.h"
|
||||
|
||||
class Map;
|
||||
class Data;
|
||||
class GraphItem;
|
||||
|
||||
@ -24,7 +25,7 @@ public:
|
||||
virtual ~GraphTab() {}
|
||||
|
||||
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 setUnits(enum Units units) {GraphView::setUnits(units);}
|
||||
virtual void setGraphType(GraphType type) {GraphView::setGraphType(type);}
|
||||
|
@ -29,10 +29,10 @@
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include "common/config.h"
|
||||
#include "common/programpaths.h"
|
||||
#include "common/downloader.h"
|
||||
#include "common/demloader.h"
|
||||
#include "data/data.h"
|
||||
#include "data/poi.h"
|
||||
#include "map/downloader.h"
|
||||
#include "map/demloader.h"
|
||||
#include "map/maplist.h"
|
||||
#include "map/emptymap.h"
|
||||
#include "map/crs.h"
|
||||
@ -1145,7 +1145,7 @@ void GUI::loadData(const Data &data)
|
||||
_pathName = QString();
|
||||
|
||||
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())
|
||||
_splitter->refresh();
|
||||
paths = _mapView->loadData(data);
|
||||
|
@ -39,8 +39,9 @@ void HeartRateGraph::setInfo()
|
||||
clearInfo();
|
||||
}
|
||||
|
||||
QList<GraphItem*> HeartRateGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> HeartRateGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
~HeartRateGraph();
|
||||
|
||||
QString label() const {return tr("Heart rate");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void showTracks(bool show);
|
||||
|
||||
|
@ -39,8 +39,9 @@ void PowerGraph::setInfo()
|
||||
clearInfo();
|
||||
}
|
||||
|
||||
QList<GraphItem*> PowerGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> PowerGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
~PowerGraph();
|
||||
|
||||
QString label() const {return tr("Power");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void showTracks(bool show);
|
||||
|
||||
|
@ -69,8 +69,9 @@ GraphItem *SpeedGraph::loadGraph(const Graph &graph, const Track &track,
|
||||
return gi;
|
||||
}
|
||||
|
||||
QList<GraphItem*> SpeedGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> SpeedGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
|
@ -16,7 +16,7 @@ public:
|
||||
~SpeedGraph();
|
||||
|
||||
QString label() const {return tr("Speed");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void setUnits(Units units);
|
||||
void setTimeType(TimeType type);
|
||||
|
@ -43,8 +43,9 @@ void TemperatureGraph::setInfo()
|
||||
clearInfo();
|
||||
}
|
||||
|
||||
QList<GraphItem*> TemperatureGraph::loadData(const Data &data)
|
||||
QList<GraphItem*> TemperatureGraph::loadData(const Data &data, Map *map)
|
||||
{
|
||||
Q_UNUSED(map);
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
|
@ -14,7 +14,7 @@ public:
|
||||
~TemperatureGraph();
|
||||
|
||||
QString label() const {return tr("Temperature");}
|
||||
QList<GraphItem*> loadData(const Data &data);
|
||||
QList<GraphItem*> loadData(const Data &data, Map *map);
|
||||
void clear();
|
||||
void setUnits(enum Units units);
|
||||
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", "Coordinates"),
|
||||
Format::coordinates(_waypoint.coordinates(), _format));
|
||||
QPair<qreal, qreal> elevations(_waypoint.elevations());
|
||||
QPair<qreal, qreal> elevations(_waypoint.elevations(_map));
|
||||
if (!std::isnan(elevations.first)) {
|
||||
QString val = Format::elevation(elevations.first, _units);
|
||||
if (!std::isnan(elevations.second))
|
||||
@ -71,7 +71,7 @@ ToolTip WaypointItem::info() const
|
||||
}
|
||||
|
||||
WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||
QGraphicsItem *parent) : GraphicsItem(parent)
|
||||
QGraphicsItem *parent) : GraphicsItem(parent), _map(map)
|
||||
{
|
||||
_waypoint = waypoint;
|
||||
_showLabel = false;
|
||||
@ -93,6 +93,12 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
|
||||
void WaypointItem::setMap(Map *map)
|
||||
{
|
||||
_map = map;
|
||||
setPos(map->ll2xy(_waypoint.coordinates()));
|
||||
}
|
||||
|
||||
void WaypointItem::updateCache()
|
||||
{
|
||||
QPainterPath p;
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
|
||||
const Waypoint &waypoint() const {return _waypoint;}
|
||||
|
||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
||||
void setMap(Map *map);
|
||||
void setSize(int size);
|
||||
void setColor(const QColor &color);
|
||||
void showLabel(bool show);
|
||||
@ -51,6 +51,8 @@ private:
|
||||
|
||||
Waypoint _waypoint;
|
||||
|
||||
Map *_map;
|
||||
|
||||
QColor _color;
|
||||
int _size;
|
||||
bool _showLabel;
|
||||
|
Reference in New Issue
Block a user