mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 03:29:16 +02:00
Added initial support for track/route graphs differentiation
This commit is contained in:
@ -1,12 +1,46 @@
|
||||
#include <cmath>
|
||||
#include "config.h"
|
||||
#include "gpx.h"
|
||||
#include "elevationgraph.h"
|
||||
|
||||
|
||||
static qreal nMin(qreal a, qreal b)
|
||||
{
|
||||
if (!std::isnan(a) && !std::isnan(b))
|
||||
return qMin(a, b);
|
||||
else if (!std::isnan(a))
|
||||
return a;
|
||||
else if (!std::isnan(b))
|
||||
return b;
|
||||
else
|
||||
return NAN;
|
||||
}
|
||||
|
||||
static qreal nMax(qreal a, qreal b)
|
||||
{
|
||||
if (!std::isnan(a) && !std::isnan(b))
|
||||
return qMax(a, b);
|
||||
else if (!std::isnan(a))
|
||||
return a;
|
||||
else if (!std::isnan(b))
|
||||
return b;
|
||||
else
|
||||
return NAN;
|
||||
}
|
||||
|
||||
ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
|
||||
{
|
||||
_ascent = 0;
|
||||
_descent = 0;
|
||||
_trackAscent = 0;
|
||||
_routeAscent = 0;
|
||||
_trackDescent = 0;
|
||||
_routeDescent = 0;
|
||||
_trackMin = NAN;
|
||||
_trackMax = NAN;
|
||||
_routeMin = NAN;
|
||||
_routeMax = NAN;
|
||||
|
||||
_showRoutes = true;
|
||||
_showTracks = true;
|
||||
|
||||
_units = Metric;
|
||||
|
||||
@ -19,25 +53,31 @@ ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
|
||||
|
||||
void ElevationGraph::setInfo()
|
||||
{
|
||||
GraphView::addInfo(tr("Ascent"), QString::number(_ascent * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Descent"), QString::number(_descent * yScale(), 'f',
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', 0)
|
||||
+ UNIT_SPACE + yUnits());
|
||||
if (std::isnan(max()) || std::isnan(min()))
|
||||
clearInfo();
|
||||
else {
|
||||
GraphView::addInfo(tr("Ascent"), QString::number(ascent() * yScale(),
|
||||
'f', 0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Descent"), QString::number(descent() * yScale(),
|
||||
'f', 0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f',
|
||||
0) + UNIT_SPACE + yUnits());
|
||||
}
|
||||
}
|
||||
|
||||
void ElevationGraph::loadPath(const QVector<QPointF> &data)
|
||||
void ElevationGraph::loadPath(const QVector<QPointF> &data, Type type)
|
||||
{
|
||||
qreal ascent = 0, descent = 0;
|
||||
qreal min, max;
|
||||
|
||||
if (data.count() < 2) {
|
||||
skipColor();
|
||||
return;
|
||||
}
|
||||
|
||||
max = min = data.at(0).y();
|
||||
for (int j = 1; j < data.size(); j++) {
|
||||
qreal cur = data.at(j).y();
|
||||
qreal prev = data.at(j-1).y();
|
||||
@ -46,20 +86,34 @@ void ElevationGraph::loadPath(const QVector<QPointF> &data)
|
||||
ascent += cur - prev;
|
||||
if (cur < prev)
|
||||
descent += prev - cur;
|
||||
|
||||
if (cur < min)
|
||||
min = cur;
|
||||
if (cur > max)
|
||||
max = cur;
|
||||
}
|
||||
|
||||
_ascent += ascent;
|
||||
_descent += descent;
|
||||
if (type == Track) {
|
||||
_trackAscent += ascent;
|
||||
_trackDescent += descent;
|
||||
_trackMax = nMax(_trackMax, max);
|
||||
_trackMin = nMin(_trackMin, min);
|
||||
} else {
|
||||
_routeAscent += ascent;
|
||||
_routeDescent += descent;
|
||||
_routeMax = nMax(_routeMax, max);
|
||||
_routeMin = nMin(_routeMin, min);
|
||||
}
|
||||
|
||||
loadData(data);
|
||||
loadData(data, type);
|
||||
}
|
||||
|
||||
void ElevationGraph::loadGPX(const GPX &gpx)
|
||||
{
|
||||
for (int i = 0; i < gpx.tracks().count(); i++)
|
||||
loadPath(gpx.tracks().at(i)->elevation());
|
||||
loadPath(gpx.tracks().at(i)->elevation(), Track);
|
||||
for (int i = 0; i < gpx.routes().count(); i++)
|
||||
loadPath(gpx.routes().at(i)->elevation());
|
||||
loadPath(gpx.routes().at(i)->elevation(), Route);
|
||||
|
||||
setXUnits();
|
||||
setInfo();
|
||||
@ -69,8 +123,14 @@ void ElevationGraph::loadGPX(const GPX &gpx)
|
||||
|
||||
void ElevationGraph::clear()
|
||||
{
|
||||
_ascent = 0;
|
||||
_descent = 0;
|
||||
_trackAscent = 0;
|
||||
_routeAscent = 0;
|
||||
_trackDescent = 0;
|
||||
_routeDescent = 0;
|
||||
_trackMin = NAN;
|
||||
_trackMax = NAN;
|
||||
_routeMin = NAN;
|
||||
_trackMax = NAN;
|
||||
|
||||
GraphView::clear();
|
||||
}
|
||||
@ -117,3 +177,79 @@ void ElevationGraph::setUnits(enum Units units)
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void ElevationGraph::showTracks(bool show)
|
||||
{
|
||||
_showTracks = show;
|
||||
|
||||
setInfo();
|
||||
showGraph(show, Track);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void ElevationGraph::showRoutes(bool show)
|
||||
{
|
||||
_showRoutes = show;
|
||||
|
||||
setInfo();
|
||||
showGraph(show, Route);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
qreal ElevationGraph::ascent() const
|
||||
{
|
||||
qreal val = 0;
|
||||
|
||||
if (_showRoutes)
|
||||
val += _routeAscent;
|
||||
if (_showTracks)
|
||||
val += _trackAscent;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
qreal ElevationGraph::descent() const
|
||||
{
|
||||
qreal val = 0;
|
||||
|
||||
if (_showRoutes)
|
||||
val += _routeDescent;
|
||||
if (_showTracks)
|
||||
val += _trackDescent;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
qreal ElevationGraph::max() const
|
||||
{
|
||||
qreal val;
|
||||
|
||||
if (_showRoutes && _showTracks)
|
||||
val = nMax(_routeMax, _trackMax);
|
||||
else if (_showTracks)
|
||||
val = _trackMax;
|
||||
else if (_showRoutes)
|
||||
val = _routeMax;
|
||||
else
|
||||
val = NAN;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
qreal ElevationGraph::min() const
|
||||
{
|
||||
qreal val;
|
||||
|
||||
if (_showRoutes && _showTracks)
|
||||
val = nMin(_routeMin, _trackMin);
|
||||
else if (_showTracks)
|
||||
val = _trackMin;
|
||||
else if (_showRoutes)
|
||||
val = _routeMin;
|
||||
else
|
||||
val = NAN;
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -16,21 +16,30 @@ public:
|
||||
void loadGPX(const GPX &gpx);
|
||||
void clear();
|
||||
void setUnits(enum Units units);
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show);
|
||||
|
||||
private:
|
||||
qreal ascent() const {return _ascent;}
|
||||
qreal descent() const {return _descent;}
|
||||
qreal max() const {return bounds().bottom();}
|
||||
qreal min() const {return bounds().top();}
|
||||
enum Type {Track, Route};
|
||||
|
||||
qreal max() const;
|
||||
qreal min() const;
|
||||
qreal ascent() const;
|
||||
qreal descent() const;
|
||||
|
||||
void setXUnits();
|
||||
void setYUnits();
|
||||
void setInfo();
|
||||
|
||||
void loadPath(const QVector<QPointF> &data);
|
||||
void loadPath(const QVector<QPointF> &data, Type type);
|
||||
|
||||
qreal _trackAscent, _trackDescent;
|
||||
qreal _routeAscent, _routeDescent;
|
||||
qreal _trackMax, _routeMax;
|
||||
qreal _trackMin, _routeMin;
|
||||
|
||||
qreal _ascent, _descent;
|
||||
enum Units _units;
|
||||
bool _showTracks, _showRoutes;
|
||||
};
|
||||
|
||||
#endif // ELEVATIONGRAPH_H
|
||||
|
19
src/graphitem.h
Normal file
19
src/graphitem.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef GRAPHITEM_H
|
||||
#define GRAPHITEM_H
|
||||
|
||||
#include <QGraphicsPathItem>
|
||||
|
||||
class GraphItem : public QGraphicsPathItem
|
||||
{
|
||||
public:
|
||||
GraphItem(const QPainterPath &path, QGraphicsItem * parent = 0)
|
||||
: QGraphicsPathItem(path, parent) {_id = 0;}
|
||||
|
||||
int id() {return _id;}
|
||||
void setId(int id) {_id = id;}
|
||||
|
||||
private:
|
||||
int _id;
|
||||
};
|
||||
|
||||
#endif // GRAPHITEM_H
|
@ -18,6 +18,8 @@ public:
|
||||
virtual void loadGPX(const GPX &gpx) = 0;
|
||||
virtual void clear() = 0;
|
||||
virtual void setUnits(enum Units units) = 0;
|
||||
virtual void showTracks(bool show) = 0;
|
||||
virtual void showRoutes(bool show) = 0;
|
||||
};
|
||||
|
||||
#endif // GRAPHTAB_H
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QEvent>
|
||||
#include <QPaintEngine>
|
||||
@ -8,6 +7,7 @@
|
||||
#include "slideritem.h"
|
||||
#include "sliderinfoitem.h"
|
||||
#include "infoitem.h"
|
||||
#include "graphitem.h"
|
||||
#include "graphview.h"
|
||||
|
||||
|
||||
@ -33,20 +33,17 @@ GraphView::GraphView(QWidget *parent)
|
||||
|
||||
_xAxis = new AxisItem(AxisItem::X);
|
||||
_yAxis = new AxisItem(AxisItem::Y);
|
||||
|
||||
_slider = new SliderItem();
|
||||
_slider->setZValue(2.0);
|
||||
_sliderInfo = new SliderInfoItem(_slider);
|
||||
_sliderInfo->setZValue(2.0);
|
||||
_info = new InfoItem();
|
||||
|
||||
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
|
||||
SLOT(emitSliderPositionChanged(const QPointF&)));
|
||||
connect(_scene, SIGNAL(mouseClicked(const QPointF&)), this,
|
||||
SLOT(newSliderPosition(const QPointF&)));
|
||||
|
||||
_info = new InfoItem();
|
||||
|
||||
_sliderInfo = new SliderInfoItem(_slider);
|
||||
_sliderInfo->setZValue(2.0);
|
||||
|
||||
_xScale = 1;
|
||||
_yScale = 1;
|
||||
_yOffset = 0;
|
||||
@ -63,10 +60,8 @@ GraphView::~GraphView()
|
||||
delete _xAxis;
|
||||
if (_yAxis->scene() != _scene)
|
||||
delete _yAxis;
|
||||
|
||||
if (_slider->scene() != _scene)
|
||||
delete _slider;
|
||||
|
||||
if (_info->scene() != _scene)
|
||||
delete _info;
|
||||
}
|
||||
@ -117,10 +112,10 @@ void GraphView::setYUnits(const QString &units)
|
||||
createYLabel();
|
||||
}
|
||||
|
||||
void GraphView::loadData(const QVector<QPointF> &data)
|
||||
void GraphView::loadData(const QVector<QPointF> &data, int id)
|
||||
{
|
||||
QPainterPath path;
|
||||
QGraphicsPathItem *pi;
|
||||
GraphItem *pi;
|
||||
|
||||
|
||||
if (data.size() < 2)
|
||||
@ -137,14 +132,29 @@ void GraphView::loadData(const QVector<QPointF> &data)
|
||||
updateBounds(p);
|
||||
}
|
||||
|
||||
pi = new QGraphicsPathItem(path);
|
||||
pi = new GraphItem(path);
|
||||
QBrush brush(_palette.color(), Qt::SolidPattern);
|
||||
QPen pen(brush, 0);
|
||||
pi->setPen(pen);
|
||||
pi->setId(id);
|
||||
if (_hide.contains(id))
|
||||
pi->hide();
|
||||
_scene->addItem(pi);
|
||||
_graphs.append(pi);
|
||||
}
|
||||
|
||||
void GraphView::showGraph(bool show, int id)
|
||||
{
|
||||
for (int i = 0; i < _graphs.count(); i++)
|
||||
if (_graphs.at(i)->id() == id)
|
||||
_graphs.at(i)->setVisible(show);
|
||||
|
||||
if (show)
|
||||
_hide.remove(id);
|
||||
else
|
||||
_hide.insert(id);
|
||||
}
|
||||
|
||||
void GraphView::redraw()
|
||||
{
|
||||
if (!_graphs.isEmpty())
|
||||
@ -209,13 +219,8 @@ void GraphView::redraw(const QSizeF &size)
|
||||
_scene->addItem(_yAxis);
|
||||
|
||||
_slider->setArea(r);
|
||||
if (_sliderPos > _bounds.right() || _sliderPos < _bounds.left())
|
||||
_slider->setVisible(false);
|
||||
_slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(),
|
||||
r.bottom());
|
||||
_scene->addItem(_slider);
|
||||
|
||||
updateSliderInfo();
|
||||
updateSliderPosition();
|
||||
|
||||
r = _scene->itemsBoundingRect();
|
||||
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
||||
@ -301,6 +306,17 @@ static qreal yAtX(const QPainterPath &path, qreal x)
|
||||
return l.pointAt((x - l.p1().x()) / (l.p2().x() - l.p1().x())).y();
|
||||
}
|
||||
|
||||
void GraphView::updateSliderPosition()
|
||||
{
|
||||
Q_ASSERT(_sliderPos <= _bounds.right() && _sliderPos >= _bounds.left());
|
||||
|
||||
_slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(),
|
||||
_slider->area().bottom());
|
||||
//_slider->setVisible(false);
|
||||
|
||||
updateSliderInfo();
|
||||
}
|
||||
|
||||
void GraphView::updateSliderInfo()
|
||||
{
|
||||
_sliderInfo->setVisible(_graphs.size() == 1);
|
||||
@ -333,33 +349,26 @@ void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
||||
return;
|
||||
|
||||
_sliderPos = (pos.x() / _slider->area().width()) * _bounds.width();
|
||||
emit sliderPositionChanged(_sliderPos);
|
||||
|
||||
updateSliderInfo();
|
||||
updateSliderPosition();
|
||||
emit sliderPositionChanged(_sliderPos);
|
||||
}
|
||||
|
||||
void GraphView::setSliderPosition(qreal pos)
|
||||
{
|
||||
_sliderPos = pos;
|
||||
|
||||
if (_graphs.isEmpty())
|
||||
return;
|
||||
|
||||
if (pos > _bounds.right() || pos < _bounds.left())
|
||||
_slider->setVisible(false);
|
||||
else {
|
||||
_slider->setPos((pos / _bounds.width()) * _slider->area().width(), 0);
|
||||
_slider->setVisible(true);
|
||||
}
|
||||
_sliderPos = pos;
|
||||
|
||||
updateSliderPosition();
|
||||
emit sliderPositionChanged(_sliderPos);
|
||||
}
|
||||
|
||||
void GraphView::newSliderPosition(const QPointF &pos)
|
||||
{
|
||||
if (_slider->area().contains(pos)) {
|
||||
_slider->setPos(pos);
|
||||
_slider->setVisible(true);
|
||||
if (_slider->area().contains(pos))
|
||||
emitSliderPositionChanged(pos);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::addInfo(const QString &key, const QString &value)
|
||||
|
@ -5,14 +5,15 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QPointF>
|
||||
#include "palette.h"
|
||||
|
||||
|
||||
class AxisItem;
|
||||
class SliderItem;
|
||||
class SliderInfoItem;
|
||||
class InfoItem;
|
||||
class GraphItem;
|
||||
|
||||
class Scene : public QGraphicsScene
|
||||
{
|
||||
@ -34,12 +35,12 @@ public:
|
||||
GraphView(QWidget *parent = 0);
|
||||
~GraphView();
|
||||
|
||||
void loadData(const QVector<QPointF> &data);
|
||||
|
||||
void loadData(const QVector<QPointF> &data, int id = 0);
|
||||
int count() const {return _graphs.count();}
|
||||
void redraw();
|
||||
void clear();
|
||||
|
||||
int count() const {return _graphs.count();}
|
||||
void showGraph(bool show, int id = 0);
|
||||
|
||||
const QString &xLabel() const {return _xLabel;}
|
||||
const QString &yLabel() const {return _yLabel;}
|
||||
@ -70,11 +71,11 @@ signals:
|
||||
|
||||
protected:
|
||||
const QRectF &bounds() const {return _bounds;}
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void redraw(const QSizeF &size);
|
||||
void addInfo(const QString &key, const QString &value);
|
||||
void clearInfo();
|
||||
void skipColor() {_palette.color();}
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
private slots:
|
||||
void emitSliderPositionChanged(const QPointF &pos);
|
||||
@ -84,6 +85,7 @@ private:
|
||||
void createXLabel();
|
||||
void createYLabel();
|
||||
void updateBounds(const QPointF &point);
|
||||
void updateSliderPosition();
|
||||
void updateSliderInfo();
|
||||
|
||||
qreal _xScale, _yScale;
|
||||
@ -101,7 +103,9 @@ private:
|
||||
SliderInfoItem *_sliderInfo;
|
||||
InfoItem *_info;
|
||||
|
||||
QList<QGraphicsPathItem*> _graphs;
|
||||
QList<GraphItem*> _graphs;
|
||||
QSet<int> _hide;
|
||||
bool _hideAll;
|
||||
QRectF _bounds;
|
||||
Palette _palette;
|
||||
};
|
||||
|
28
src/gui.cpp
28
src/gui.cpp
@ -273,15 +273,15 @@ void GUI::createActions()
|
||||
}
|
||||
|
||||
// Data actions
|
||||
_showTracksAction = new QAction(tr("Tracks"), this);
|
||||
_showTracksAction = new QAction(tr("Show tracks"), this);
|
||||
_showTracksAction->setCheckable(true);
|
||||
connect(_showTracksAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(showTracks(bool)));
|
||||
_showRoutesAction = new QAction(tr("Routes"), this);
|
||||
_showRoutesAction = new QAction(tr("Show routes"), this);
|
||||
_showRoutesAction->setCheckable(true);
|
||||
connect(_showRoutesAction, SIGNAL(triggered(bool)), this,
|
||||
SLOT(showRoutes(bool)));
|
||||
_showWaypointsAction = new QAction(tr("Waypoints"), this);
|
||||
_showWaypointsAction = new QAction(tr("Show waypoints"), this);
|
||||
_showWaypointsAction->setCheckable(true);
|
||||
connect(_showWaypointsAction, SIGNAL(triggered(bool)), _track,
|
||||
SLOT(showWaypoints(bool)));
|
||||
@ -289,7 +289,7 @@ void GUI::createActions()
|
||||
_showWaypointLabelsAction->setCheckable(true);
|
||||
connect(_showWaypointLabelsAction, SIGNAL(triggered(bool)), _track,
|
||||
SLOT(showWaypointLabels(bool)));
|
||||
_showRouteWaypointsAction = new QAction(tr("Route Waypoints"), this);
|
||||
_showRouteWaypointsAction = new QAction(tr("Route waypoints"), this);
|
||||
_showRouteWaypointsAction->setCheckable(true);
|
||||
connect(_showRouteWaypointsAction, SIGNAL(triggered(bool)), _track,
|
||||
SLOT(showRouteWaypoints(bool)));
|
||||
@ -889,12 +889,20 @@ void GUI::showFullscreen(bool checked)
|
||||
void GUI::showTracks(bool show)
|
||||
{
|
||||
_track->showTracks(show);
|
||||
|
||||
for (int i = 0; i < _tabs.size(); i++)
|
||||
_tabs.at(i)->showTracks(show);
|
||||
|
||||
updateStatusBarInfo();
|
||||
}
|
||||
|
||||
void GUI::showRoutes(bool show)
|
||||
{
|
||||
_track->showRoutes(show);
|
||||
|
||||
for (int i = 0; i < _tabs.size(); i++)
|
||||
_tabs.at(i)->showRoutes(show);
|
||||
|
||||
updateStatusBarInfo();
|
||||
}
|
||||
|
||||
@ -1251,13 +1259,17 @@ void GUI::readSettings()
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(DATA_SETTINGS_GROUP);
|
||||
if (settings.value(SHOW_TRACKS_SETTING, true).toBool() == false)
|
||||
if (settings.value(SHOW_TRACKS_SETTING, true).toBool() == false) {
|
||||
_track->showTracks(false);
|
||||
else
|
||||
for (int i = 0; i < _tabs.count(); i++)
|
||||
_tabs.at(i)->showTracks(false);
|
||||
} else
|
||||
_showTracksAction->setChecked(true);
|
||||
if (settings.value(SHOW_ROUTES_SETTING, true).toBool() == false)
|
||||
if (settings.value(SHOW_ROUTES_SETTING, true).toBool() == false) {
|
||||
_track->showRoutes(false);
|
||||
else
|
||||
for (int i = 0; i < _tabs.count(); i++)
|
||||
_tabs.at(i)->showRoutes(false);
|
||||
} else
|
||||
_showRoutesAction->setChecked(true);
|
||||
if (settings.value(SHOW_WAYPOINTS_SETTING, true).toBool() == false)
|
||||
_track->showWaypoints(false);
|
||||
|
@ -100,3 +100,15 @@ void HeartRateGraph::setUnits(enum Units units)
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void HeartRateGraph::showTracks(bool show)
|
||||
{
|
||||
if (show)
|
||||
setInfo();
|
||||
else
|
||||
clearInfo();
|
||||
|
||||
showGraph(show);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
void loadGPX(const GPX &gpx);
|
||||
void clear();
|
||||
void setUnits(enum Units units);
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||
|
||||
private:
|
||||
qreal avg() const;
|
||||
|
@ -108,3 +108,15 @@ void SpeedGraph::setUnits(enum Units units)
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void SpeedGraph::showTracks(bool show)
|
||||
{
|
||||
if (show)
|
||||
setInfo();
|
||||
else
|
||||
clearInfo();
|
||||
|
||||
showGraph(show);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ public:
|
||||
void loadGPX(const GPX &gpx);
|
||||
void clear();
|
||||
void setUnits(enum Units units);
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||
|
||||
private:
|
||||
qreal avg() const;
|
||||
|
@ -116,3 +116,15 @@ void TemperatureGraph::setUnits(enum Units units)
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
||||
void TemperatureGraph::showTracks(bool show)
|
||||
{
|
||||
if (show)
|
||||
setInfo();
|
||||
else
|
||||
clearInfo();
|
||||
|
||||
showGraph(show);
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
@ -16,6 +16,8 @@ public:
|
||||
void loadGPX(const GPX &gpx);
|
||||
void clear();
|
||||
void setUnits(enum Units units);
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||
|
||||
private:
|
||||
qreal avg() const;
|
||||
|
Reference in New Issue
Block a user