mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 11:39:16 +02:00
Enable simultaneous display of GPS and DEM data
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
|
||||
int width, const QColor &color, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
: GraphItem(graph, type, width, color, Qt::SolidLine, parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -65,35 +65,38 @@ void ElevationGraph::setInfo()
|
||||
}
|
||||
}
|
||||
|
||||
GraphItem *ElevationGraph::loadGraph(const Graph &graph, Type type)
|
||||
GraphItem *ElevationGraph::loadGraph(const Graph &graph, PathType type,
|
||||
const QColor &color, bool primary)
|
||||
{
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
if (!graph.isValid())
|
||||
return 0;
|
||||
}
|
||||
|
||||
ElevationGraphItem *gi = new ElevationGraphItem(graph, _graphType, _width,
|
||||
_palette.nextColor());
|
||||
color, primary ? Qt::SolidLine : Qt::DashLine);
|
||||
gi->setUnits(_units);
|
||||
|
||||
if (type == Track) {
|
||||
if (type == TrackPath) {
|
||||
_tracks.append(gi);
|
||||
if (_showTracks)
|
||||
addGraph(gi);
|
||||
|
||||
_trackAscent += gi->ascent();
|
||||
_trackDescent += gi->descent();
|
||||
_trackMax = nMax(_trackMax, gi->max());
|
||||
_trackMin = nMin(_trackMin, gi->min());
|
||||
if (primary) {
|
||||
_trackAscent += gi->ascent();
|
||||
_trackDescent += gi->descent();
|
||||
_trackMax = nMax(_trackMax, gi->max());
|
||||
_trackMin = nMin(_trackMin, gi->min());
|
||||
}
|
||||
} else {
|
||||
_routes.append(gi);
|
||||
if (_showRoutes)
|
||||
addGraph(gi);
|
||||
|
||||
_routeAscent += gi->ascent();
|
||||
_routeDescent += gi->descent();
|
||||
_routeMax = nMax(_routeMax, gi->max());
|
||||
_routeMin = nMin(_routeMin, gi->min());
|
||||
if (primary) {
|
||||
_routeAscent += gi->ascent();
|
||||
_routeDescent += gi->descent();
|
||||
_routeMax = nMax(_routeMax, gi->max());
|
||||
_routeMin = nMin(_routeMin, gi->min());
|
||||
}
|
||||
}
|
||||
|
||||
return gi;
|
||||
@ -102,11 +105,32 @@ GraphItem *ElevationGraph::loadGraph(const Graph &graph, Type type)
|
||||
QList<GraphItem*> ElevationGraph::loadData(const Data &data)
|
||||
{
|
||||
QList<GraphItem*> graphs;
|
||||
GraphItem *primary, *secondary;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++)
|
||||
graphs.append(loadGraph(data.tracks().at(i).elevation(), Track));
|
||||
for (int i = 0; i < data.routes().count(); i++)
|
||||
graphs.append(loadGraph(data.routes().at(i).elevation(), Route));
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
QColor color(_palette.nextColor());
|
||||
const GraphPair &gp = data.tracks().at(i).elevation();
|
||||
|
||||
primary = loadGraph(gp.primary(), TrackPath, color, true);
|
||||
secondary = primary
|
||||
? loadGraph(gp.secondary(), TrackPath, color, false) : 0;
|
||||
if (primary && secondary)
|
||||
primary->setSecondaryGraph(secondary);
|
||||
|
||||
graphs.append(primary);
|
||||
}
|
||||
for (int i = 0; i < data.routes().count(); i++) {
|
||||
QColor color(_palette.nextColor());
|
||||
const GraphPair &gp = data.routes().at(i).elevation();
|
||||
|
||||
primary = loadGraph(gp.primary(), RoutePath, color, true);
|
||||
secondary = primary
|
||||
? loadGraph(gp.secondary(), RoutePath, color, false) : 0;
|
||||
if (primary && secondary)
|
||||
primary->setSecondaryGraph(secondary);
|
||||
|
||||
graphs.append(primary);
|
||||
}
|
||||
for (int i = 0; i < data.areas().count(); i++)
|
||||
_palette.nextColor();
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
void showRoutes(bool show);
|
||||
|
||||
private:
|
||||
enum Type {Track, Route};
|
||||
enum PathType {TrackPath, RoutePath};
|
||||
|
||||
qreal max() const;
|
||||
qreal min() const;
|
||||
@ -31,7 +31,8 @@ private:
|
||||
void setYUnits(Units units);
|
||||
void setInfo();
|
||||
|
||||
GraphItem *loadGraph(const Graph &graph, Type type);
|
||||
GraphItem *loadGraph(const Graph &graph, PathType type, const QColor &color,
|
||||
bool primary);
|
||||
void showItems(const QList<ElevationGraphItem *> &list, bool show);
|
||||
|
||||
qreal _trackAscent, _trackDescent;
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
|
||||
ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type,
|
||||
int width, const QColor &color, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
int width, const QColor &color, Qt::PenStyle style, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, style, parent)
|
||||
{
|
||||
_min = GraphItem::min();
|
||||
_max = GraphItem::max();
|
||||
@ -42,5 +42,6 @@ QString ElevationGraphItem::info() const
|
||||
tt.insert(tr("Minimum"), l.toString(min() * scale, 'f', 0)
|
||||
+ UNIT_SPACE + su);
|
||||
|
||||
|
||||
return tt.toString();
|
||||
}
|
||||
|
@ -8,8 +8,10 @@ class ElevationGraphItem : public GraphItem
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum DataType {GPS, DEM};
|
||||
|
||||
ElevationGraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, QGraphicsItem *parent = 0);
|
||||
const QColor &color, Qt::PenStyle style, QGraphicsItem *parent = 0);
|
||||
|
||||
qreal ascent() const {return _ascent;}
|
||||
qreal descent() const {return _descent;}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
|
||||
int width, const QColor &color, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
: GraphItem(graph, type, width, color, Qt::SolidLine, parent)
|
||||
{
|
||||
for (int i = 0; i < graph.size(); i++) {
|
||||
const GraphSegment &segment = graph.at(i);
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
|
||||
GraphItem::GraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, QGraphicsItem *parent)
|
||||
: GraphicsItem(parent), _graph(graph), _type(type)
|
||||
const QColor &color, Qt::PenStyle style, QGraphicsItem *parent)
|
||||
: GraphicsItem(parent), _graph(graph), _type(type), _secondaryGraph(0)
|
||||
{
|
||||
Q_ASSERT(_graph.isValid());
|
||||
|
||||
_units = Metric;
|
||||
_pen = QPen(color, width);
|
||||
_pen = QPen(color, width, style);
|
||||
_sx = 0; _sy = 0;
|
||||
_time = _graph.hasTime();
|
||||
setZValue(2.0);
|
||||
|
@ -12,8 +12,8 @@ class GraphItem : public QObject, public GraphicsItem
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GraphItem(const Graph &graph, GraphType type, int width, const QColor &color,
|
||||
QGraphicsItem *parent = 0);
|
||||
GraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, Qt::PenStyle style, QGraphicsItem *parent = 0);
|
||||
virtual ~GraphItem() {}
|
||||
|
||||
virtual QString info() const = 0;
|
||||
@ -35,6 +35,9 @@ public:
|
||||
void setWidth(int width);
|
||||
void setUnits(Units units) {_units = units;}
|
||||
|
||||
GraphItem *secondaryGraph() const {return _secondaryGraph;}
|
||||
void setSecondaryGraph(GraphItem *graph) {_secondaryGraph = graph;}
|
||||
|
||||
qreal yAtX(qreal x);
|
||||
qreal distanceAtTime(qreal time);
|
||||
|
||||
@ -69,6 +72,8 @@ private:
|
||||
qreal _sx, _sy;
|
||||
QPen _pen;
|
||||
bool _time;
|
||||
|
||||
GraphItem *_secondaryGraph;
|
||||
};
|
||||
|
||||
#endif // GRAPHITEM_H
|
||||
|
@ -419,14 +419,16 @@ void GraphView::updateSliderInfo()
|
||||
{
|
||||
QLocale l(QLocale::system());
|
||||
qreal r = 0, y = 0;
|
||||
GraphItem *cardinal = (_graphs.count() == 1 || (_graphs.count() == 2
|
||||
&& _graphs.first()->secondaryGraph())) ? _graphs.first() : 0;
|
||||
|
||||
if (_graphs.count() == 1) {
|
||||
QRectF br(_graphs.first()->bounds());
|
||||
if (cardinal) {
|
||||
QRectF br(_bounds);
|
||||
if (br.height() < _minYRange)
|
||||
br.adjust(0, -(_minYRange/2 - br.height()/2), 0,
|
||||
_minYRange/2 - br.height()/2);
|
||||
|
||||
y = _graphs.first()->yAtX(_sliderPos);
|
||||
y = cardinal->yAtX(_sliderPos);
|
||||
r = (y - br.bottom()) / br.height();
|
||||
}
|
||||
|
||||
@ -436,11 +438,17 @@ void GraphView::updateSliderInfo()
|
||||
|
||||
_sliderInfo->setSide(s);
|
||||
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
|
||||
_sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos,
|
||||
QString xText(_graphType == Time ? Format::timeSpan(_sliderPos,
|
||||
bounds().width() > 3600) : l.toString(_sliderPos * _xScale, 'f', 1)
|
||||
+ UNIT_SPACE + _xUnits, (_graphs.count() > 1) ? QString()
|
||||
: l.toString(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE
|
||||
+ _yUnits);
|
||||
+ UNIT_SPACE + _xUnits);
|
||||
QString yText((!cardinal) ? QString() : l.toString(-y * _yScale + _yOffset,
|
||||
'f', _precision) + UNIT_SPACE + _yUnits);
|
||||
if (cardinal && cardinal->secondaryGraph()) {
|
||||
qreal delta = y - cardinal->secondaryGraph()->yAtX(_sliderPos);
|
||||
yText += " \u0394" + l.toString(-delta * _yScale + _yOffset, 'f',
|
||||
_precision) + UNIT_SPACE + _yUnits;
|
||||
}
|
||||
_sliderInfo->setText(xText, yText);
|
||||
}
|
||||
|
||||
void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
||||
|
@ -909,9 +909,14 @@ void GUI::openOptions()
|
||||
Track::action(options.option); \
|
||||
reload = true; \
|
||||
}
|
||||
#define SET_DATA_OPTION(option, action) \
|
||||
#define SET_ROUTE_OPTION(option, action) \
|
||||
if (options.option != _options.option) { \
|
||||
Data::action(options.option); \
|
||||
Route::action(options.option); \
|
||||
reload = true; \
|
||||
}
|
||||
#define SET_WAYPOINT_OPTION(option, action) \
|
||||
if (options.option != _options.option) { \
|
||||
Waypoint::action(options.option); \
|
||||
reload = true; \
|
||||
}
|
||||
|
||||
@ -957,13 +962,18 @@ void GUI::openOptions()
|
||||
SET_TRACK_OPTION(pauseSpeed, setPauseSpeed);
|
||||
SET_TRACK_OPTION(pauseInterval, setPauseInterval);
|
||||
SET_TRACK_OPTION(useReportedSpeed, useReportedSpeed);
|
||||
SET_TRACK_OPTION(dataUseDEM, useDEM);
|
||||
SET_TRACK_OPTION(showSecondaryElevation, showSecondaryElevation);
|
||||
SET_TRACK_OPTION(showSecondarySpeed, showSecondarySpeed);
|
||||
|
||||
SET_DATA_OPTION(dataUseDEM, useDEM);
|
||||
SET_ROUTE_OPTION(dataUseDEM, useDEM);
|
||||
SET_ROUTE_OPTION(showSecondaryElevation, showSecondaryElevation);
|
||||
|
||||
SET_WAYPOINT_OPTION(dataUseDEM, useDEM);
|
||||
SET_WAYPOINT_OPTION(showSecondaryElevation, showSecondaryElevation);
|
||||
|
||||
if (options.poiRadius != _options.poiRadius)
|
||||
_poi->setRadius(options.poiRadius);
|
||||
if (options.poiUseDEM != _options.poiUseDEM)
|
||||
_poi->useDEM(options.poiUseDEM);
|
||||
|
||||
if (options.pixmapCache != _options.pixmapCache)
|
||||
QPixmapCache::setCacheLimit(options.pixmapCache * 1024);
|
||||
@ -1851,10 +1861,14 @@ void GUI::writeSettings()
|
||||
settings.setValue(USE_REPORTED_SPEED_SETTING, _options.useReportedSpeed);
|
||||
if (_options.dataUseDEM != DATA_USE_DEM_DEFAULT)
|
||||
settings.setValue(DATA_USE_DEM_SETTING, _options.dataUseDEM);
|
||||
if (_options.showSecondaryElevation != SHOW_SECONDARY_ELEVATION_DEFAULT)
|
||||
settings.setValue(SHOW_SECONDARY_ELEVATION_SETTING,
|
||||
_options.showSecondaryElevation);
|
||||
if (_options.showSecondarySpeed != SHOW_SECONDARY_SPEED_DEFAULT)
|
||||
settings.setValue(SHOW_SECONDARY_SPEED_SETTING,
|
||||
_options.showSecondarySpeed);
|
||||
if (_options.poiRadius != POI_RADIUS_DEFAULT)
|
||||
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)
|
||||
settings.setValue(USE_OPENGL_SETTING, _options.useOpenGL);
|
||||
#ifdef ENABLE_HTTP2
|
||||
@ -2119,14 +2133,18 @@ void GUI::readSettings()
|
||||
USE_REPORTED_SPEED_DEFAULT).toBool();
|
||||
_options.dataUseDEM = settings.value(DATA_USE_DEM_SETTING,
|
||||
DATA_USE_DEM_DEFAULT).toBool();
|
||||
_options.showSecondaryElevation = settings.value(
|
||||
SHOW_SECONDARY_ELEVATION_SETTING,
|
||||
SHOW_SECONDARY_ELEVATION_DEFAULT).toBool();
|
||||
_options.showSecondarySpeed = settings.value(
|
||||
SHOW_SECONDARY_SPEED_SETTING,
|
||||
SHOW_SECONDARY_SPEED_DEFAULT).toBool();
|
||||
_options.automaticPause = settings.value(AUTOMATIC_PAUSE_SETTING,
|
||||
AUTOMATIC_PAUSE_DEFAULT).toBool();
|
||||
_options.pauseInterval = settings.value(PAUSE_INTERVAL_SETTING,
|
||||
PAUSE_INTERVAL_DEFAULT).toInt();
|
||||
_options.poiRadius = settings.value(POI_RADIUS_SETTING, POI_RADIUS_DEFAULT)
|
||||
.toInt();
|
||||
_options.poiUseDEM = settings.value(POI_USE_DEM_SETTING,
|
||||
POI_USE_DEM_DEFAULT).toBool();
|
||||
_options.useOpenGL = settings.value(USE_OPENGL_SETTING, USE_OPENGL_DEFAULT)
|
||||
.toBool();
|
||||
#ifdef ENABLE_HTTP2
|
||||
@ -2206,10 +2224,15 @@ void GUI::readSettings()
|
||||
Track::setPauseSpeed(_options.pauseSpeed);
|
||||
Track::setPauseInterval(_options.pauseInterval);
|
||||
Track::useReportedSpeed(_options.useReportedSpeed);
|
||||
Data::useDEM(_options.dataUseDEM);
|
||||
Track::useDEM(_options.dataUseDEM);
|
||||
Track::showSecondaryElevation(_options.showSecondaryElevation);
|
||||
Track::showSecondarySpeed(_options.showSecondarySpeed);
|
||||
Route::useDEM(_options.dataUseDEM);
|
||||
Route::showSecondaryElevation(_options.showSecondaryElevation);
|
||||
Waypoint::useDEM(_options.dataUseDEM);
|
||||
Waypoint::showSecondaryElevation(_options.showSecondaryElevation);
|
||||
|
||||
_poi->setRadius(_options.poiRadius);
|
||||
_poi->useDEM(_options.poiUseDEM);
|
||||
|
||||
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
|
||||
int width, const QColor &color, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
: GraphItem(graph, type, width, color, Qt::SolidLine, parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -407,6 +407,8 @@ QWidget *OptionsDialog::createDataPage()
|
||||
_reportedSpeed->setChecked(true);
|
||||
else
|
||||
_computedSpeed->setChecked(true);
|
||||
_showSecondarySpeed = new QCheckBox(tr("Show secondary speed"));
|
||||
_showSecondarySpeed->setChecked(_options->showSecondarySpeed);
|
||||
|
||||
_dataGPSElevation = new QRadioButton(tr("GPS data"));
|
||||
_dataDEMElevation = new QRadioButton(tr("DEM data"));
|
||||
@ -414,7 +416,8 @@ QWidget *OptionsDialog::createDataPage()
|
||||
_dataDEMElevation->setChecked(true);
|
||||
else
|
||||
_dataGPSElevation->setChecked(true);
|
||||
|
||||
_showSecondaryElevation = new QCheckBox(tr("Show secondary elevation"));
|
||||
_showSecondaryElevation->setChecked(_options->showSecondaryElevation);
|
||||
|
||||
QWidget *sourceTab = new QWidget();
|
||||
QVBoxLayout *sourceTabLayout = new QVBoxLayout();
|
||||
@ -426,6 +429,7 @@ QWidget *OptionsDialog::createDataPage()
|
||||
QVBoxLayout *speedOptions = new QVBoxLayout();
|
||||
speedOptions->addWidget(_computedSpeed);
|
||||
speedOptions->addWidget(_reportedSpeed);
|
||||
speedOptions->addWidget(_showSecondarySpeed);
|
||||
|
||||
QButtonGroup *elevationGroup = new QButtonGroup(this);
|
||||
elevationGroup->addButton(_dataGPSElevation);
|
||||
@ -433,6 +437,7 @@ QWidget *OptionsDialog::createDataPage()
|
||||
QVBoxLayout *elevationOptions = new QVBoxLayout();
|
||||
elevationOptions->addWidget(_dataGPSElevation);
|
||||
elevationOptions->addWidget(_dataDEMElevation);
|
||||
elevationOptions->addWidget(_showSecondaryElevation);
|
||||
|
||||
QFormLayout *formLayout = new QFormLayout();
|
||||
formLayout->addRow(tr("Speed:"), speedOptions);
|
||||
@ -445,12 +450,14 @@ QWidget *OptionsDialog::createDataPage()
|
||||
|
||||
speedLayout->addWidget(_computedSpeed);
|
||||
speedLayout->addWidget(_reportedSpeed);
|
||||
speedLayout->addWidget(_showSecondarySpeed);
|
||||
|
||||
QGroupBox *speedBox = new QGroupBox(tr("Speed"));
|
||||
speedBox->setLayout(speedLayout);
|
||||
|
||||
elevationLayout->addWidget(_dataGPSElevation);
|
||||
elevationLayout->addWidget(_dataDEMElevation);
|
||||
elevationLayout->addWidget(_showSecondaryElevation);
|
||||
|
||||
QGroupBox *elevationBox = new QGroupBox(tr("Elevation"));
|
||||
elevationBox->setLayout(elevationLayout);
|
||||
@ -472,13 +479,6 @@ QWidget *OptionsDialog::createDataPage()
|
||||
|
||||
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->setSingleStep(1);
|
||||
_poiRadius->setDecimals(1);
|
||||
@ -493,13 +493,8 @@ QWidget *OptionsDialog::createPOIPage()
|
||||
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
||||
}
|
||||
|
||||
QVBoxLayout *elevationLayout = new QVBoxLayout();
|
||||
elevationLayout->addWidget(_poiGPSElevation);
|
||||
elevationLayout->addWidget(_poiDEMElevation);
|
||||
|
||||
QFormLayout *poiLayout = new QFormLayout();
|
||||
poiLayout->addRow(tr("Radius:"), _poiRadius);
|
||||
poiLayout->addRow(tr("Elevation:"), elevationLayout);
|
||||
|
||||
QWidget *poiTab = new QWidget();
|
||||
poiTab->setLayout(poiLayout);
|
||||
@ -725,13 +720,14 @@ void OptionsDialog::accept()
|
||||
_options->pauseInterval = _pauseInterval->value();
|
||||
_options->useReportedSpeed = _reportedSpeed->isChecked();
|
||||
_options->dataUseDEM = _dataDEMElevation->isChecked();
|
||||
_options->showSecondaryElevation = _showSecondaryElevation->isChecked();
|
||||
_options->showSecondarySpeed = _showSecondarySpeed->isChecked();
|
||||
|
||||
qreal poiRadius = (_options->units == Imperial)
|
||||
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
||||
? _poiRadius->value() * NMIINM : _poiRadius->value() * KMINM;
|
||||
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
||||
_options->poiRadius = poiRadius;
|
||||
_options->poiUseDEM = _poiDEMElevation->isChecked();
|
||||
|
||||
_options->useOpenGL = _useOpenGL->isChecked();
|
||||
#ifdef ENABLE_HTTP2
|
||||
|
@ -54,9 +54,10 @@ struct Options {
|
||||
int pauseInterval;
|
||||
bool useReportedSpeed;
|
||||
bool dataUseDEM;
|
||||
bool showSecondaryElevation;
|
||||
bool showSecondarySpeed;
|
||||
// POI
|
||||
int poiRadius;
|
||||
bool poiUseDEM;
|
||||
// System
|
||||
bool useOpenGL;
|
||||
#ifdef ENABLE_HTTP2
|
||||
@ -142,10 +143,10 @@ private:
|
||||
QRadioButton *_reportedSpeed;
|
||||
QRadioButton *_dataGPSElevation;
|
||||
QRadioButton *_dataDEMElevation;
|
||||
QCheckBox *_showSecondaryElevation;
|
||||
QCheckBox *_showSecondarySpeed;
|
||||
// POI
|
||||
QDoubleSpinBox *_poiRadius;
|
||||
QRadioButton *_poiGPSElevation;
|
||||
QRadioButton *_poiDEMElevation;
|
||||
// System
|
||||
QSpinBox *_pixmapCache;
|
||||
QSpinBox *_connectionTimeout;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
: GraphItem(graph, type, width, color, Qt::SolidLine, parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -145,6 +145,10 @@
|
||||
#define USE_REPORTED_SPEED_DEFAULT false
|
||||
#define DATA_USE_DEM_SETTING "dataUseDEM"
|
||||
#define DATA_USE_DEM_DEFAULT false
|
||||
#define SHOW_SECONDARY_ELEVATION_SETTING "showSecondaryElevation"
|
||||
#define SHOW_SECONDARY_ELEVATION_DEFAULT false
|
||||
#define SHOW_SECONDARY_SPEED_SETTING "showSecondarySpeed"
|
||||
#define SHOW_SECONDARY_SPEED_DEFAULT false
|
||||
#define POI_RADIUS_SETTING "poiRadius"
|
||||
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
|
||||
#define POI_USE_DEM_SETTING "poiUseDEM"
|
||||
|
@ -40,31 +40,46 @@ void SpeedGraph::setInfo()
|
||||
clearInfo();
|
||||
}
|
||||
|
||||
GraphItem *SpeedGraph::loadGraph(const Graph &graph, const Track &track,
|
||||
const QColor &color, bool primary)
|
||||
{
|
||||
if (!graph.isValid())
|
||||
return 0;
|
||||
|
||||
SpeedGraphItem *gi = new SpeedGraphItem(graph, _graphType, _width,
|
||||
color, primary ? Qt::SolidLine : Qt::DashLine, track.movingTime());
|
||||
gi->setTimeType(_timeType);
|
||||
gi->setUnits(_units);
|
||||
|
||||
_tracks.append(gi);
|
||||
if (_showTracks)
|
||||
addGraph(gi);
|
||||
|
||||
if (primary) {
|
||||
_avg.append(QPointF(track.distance(), gi->avg()));
|
||||
_mavg.append(QPointF(track.distance(), gi->mavg()));
|
||||
}
|
||||
|
||||
return gi;
|
||||
}
|
||||
|
||||
QList<GraphItem*> SpeedGraph::loadData(const Data &data)
|
||||
{
|
||||
QList<GraphItem*> graphs;
|
||||
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
GraphItem *primary, *secondary;
|
||||
QColor color(_palette.nextColor());
|
||||
const Track &track = data.tracks().at(i);
|
||||
const Graph &graph = track.speed();
|
||||
const GraphPair &gp = track.speed();
|
||||
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
graphs.append(0);
|
||||
} else {
|
||||
SpeedGraphItem *gi = new SpeedGraphItem(graph, _graphType, _width,
|
||||
_palette.nextColor(), track.movingTime());
|
||||
gi->setTimeType(_timeType);
|
||||
gi->setUnits(_units);
|
||||
primary = loadGraph(gp.primary(), track, color, true);
|
||||
secondary = primary
|
||||
? loadGraph(gp.secondary(), track, color, false) : 0;
|
||||
if (primary && secondary)
|
||||
primary->setSecondaryGraph(secondary);
|
||||
|
||||
_tracks.append(gi);
|
||||
if (_showTracks)
|
||||
addGraph(gi);
|
||||
|
||||
_avg.append(QPointF(track.distance(), gi->avg()));
|
||||
_mavg.append(QPointF(track.distance(), gi->mavg()));
|
||||
graphs.append(gi);
|
||||
}
|
||||
graphs.append(primary);
|
||||
}
|
||||
|
||||
for (int i = 0; i < data.routes().count(); i++) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "graphtab.h"
|
||||
|
||||
class SpeedGraphItem;
|
||||
class Track;
|
||||
|
||||
class SpeedGraph : public GraphTab
|
||||
{
|
||||
@ -22,6 +23,8 @@ public:
|
||||
void showTracks(bool show);
|
||||
|
||||
private:
|
||||
GraphItem *loadGraph(const Graph &graph, const Track &track,
|
||||
const QColor &color, bool primary);
|
||||
qreal avg() const;
|
||||
qreal max() const {return bounds().bottom();}
|
||||
void setYUnits();
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
|
||||
SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, qreal movingTime, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
const QColor &color, Qt::PenStyle style, qreal movingTime,
|
||||
QGraphicsItem *parent) : GraphItem(graph, type, width, color, style, parent)
|
||||
{
|
||||
_timeType = Total;
|
||||
|
||||
|
@ -10,7 +10,8 @@ class SpeedGraphItem : public GraphItem
|
||||
|
||||
public:
|
||||
SpeedGraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, qreal movingTime, QGraphicsItem *parent = 0);
|
||||
const QColor &color, Qt::PenStyle style, qreal movingTime,
|
||||
QGraphicsItem *parent = 0);
|
||||
|
||||
qreal avg() const {return _avg;}
|
||||
qreal mavg() const {return _mavg;}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
TemperatureGraphItem::TemperatureGraphItem(const Graph &graph, GraphType type,
|
||||
int width, const QColor &color, QGraphicsItem *parent)
|
||||
: GraphItem(graph, type, width, color, parent)
|
||||
: GraphItem(graph, type, width, color, Qt::SolidLine, parent)
|
||||
{
|
||||
_min = GraphItem::min();
|
||||
_max = GraphItem::max();
|
||||
|
@ -21,9 +21,13 @@ QString WaypointItem::info() const
|
||||
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
||||
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
||||
Format::coordinates(_waypoint.coordinates(), _format));
|
||||
if (_waypoint.hasElevation())
|
||||
tt.insert(qApp->translate("WaypointItem", "Elevation"),
|
||||
Format::elevation(_waypoint.elevation(), _units));
|
||||
if (!std::isnan(_waypoint.elevations().first)) {
|
||||
QString val = Format::elevation(_waypoint.elevations().first, _units);
|
||||
if (!std::isnan(_waypoint.elevations().second))
|
||||
val += " (" + Format::elevation(_waypoint.elevations().second,
|
||||
_units) + ")";
|
||||
tt.insert(qApp->translate("WaypointItem", "Elevation"), val);
|
||||
}
|
||||
if (_waypoint.timestamp().isValid())
|
||||
tt.insert(qApp->translate("WaypointItem", "Date"),
|
||||
_waypoint.timestamp().toString(Qt::SystemLocaleShortDate));
|
||||
|
Reference in New Issue
Block a user