diff --git a/lang/gpxsee_cs.ts b/lang/gpxsee_cs.ts
index 6d26b630..ccc3555d 100644
--- a/lang/gpxsee_cs.ts
+++ b/lang/gpxsee_cs.ts
@@ -607,6 +607,14 @@
km
+
+ RouteItem
+
+
+
+ Vzdálenost
+
+
ScaleItem
diff --git a/src/graphview.cpp b/src/graphview.cpp
index 24f34b4c..a0ba92d2 100644
--- a/src/graphview.cpp
+++ b/src/graphview.cpp
@@ -55,6 +55,22 @@ GraphView::GraphView(QWidget *parent)
_sliderPos = 0;
}
+GraphView::~GraphView()
+{
+ if (_xAxis->scene() != _scene)
+ delete _xAxis;
+ if (_yAxis->scene() != _scene)
+ delete _yAxis;
+ if (_slider->scene() != _scene)
+ delete _slider;
+ if (_info->scene() != _scene)
+ delete _info;
+
+ for (int i = 0; i < _graphs.count(); i++)
+ if (_graphs.at(i)->scene() != _scene)
+ delete _graphs[i];
+}
+
void GraphView::createXLabel()
{
_xAxis->setLabel(QString("%1 [%2]").arg(_xLabel).arg(_xUnits));
diff --git a/src/graphview.h b/src/graphview.h
index ae5f55fa..af22d467 100644
--- a/src/graphview.h
+++ b/src/graphview.h
@@ -33,6 +33,7 @@ class GraphView : public QGraphicsView
public:
GraphView(QWidget *parent = 0);
+ ~GraphView();
void loadData(const QVector &data, int id = 0);
int count() const {return _graphs.count();}
diff --git a/src/parser.cpp b/src/parser.cpp
index 7c00487a..b428d409 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -146,10 +146,14 @@ void Parser::routepointData()
while (_reader.readNextStartElement()) {
if (_reader.name() == "name")
handleRoutepointData(Name, _reader.readElementText());
+ else if (_reader.name() == "desc")
+ handleRoutepointData(Description, _reader.readElementText());
else if (_reader.name() == "ele")
handleRoutepointData(Elevation, _reader.readElementText());
else if (_reader.name() == "geoidheight")
handleRoutepointData(Geoidheight, _reader.readElementText());
+ else if (_reader.name() == "time")
+ handleRoutepointData(Time, _reader.readElementText());
else
_reader.skipCurrentElement();
}
diff --git a/src/routeitem.cpp b/src/routeitem.cpp
index 6966f7a0..41a871aa 100644
--- a/src/routeitem.cpp
+++ b/src/routeitem.cpp
@@ -1,12 +1,32 @@
+#include
#include
#include "ll.h"
+#include "misc.h"
#include "waypoint.h"
#include "waypointitem.h"
+#include "tooltip.h"
#include "routeitem.h"
#define ROUTE_WIDTH 3
+QString RouteItem::toolTip()
+{
+ ToolTip tt;
+
+ tt.insert(qApp->translate("RouteItem", "Distance"),
+ ::distance(_distance, _units));
+
+ return tt.toString();
+}
+
+void RouteItem::updateShape()
+{
+ QPainterPathStroker s;
+ s.setWidth(ROUTE_WIDTH * 1.0/scale());
+ _shape = s.createStroke(_path);
+}
+
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
: QGraphicsItem(parent)
{
@@ -26,8 +46,14 @@ RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
wi->setParentItem(this);
}
+ _units = Metric;
_distance = route.distance();
+ setToolTip(toolTip());
+ setCursor(Qt::ArrowCursor);
+
+ updateShape();
+
QBrush brush(Qt::SolidPattern);
_pen = QPen(brush, ROUTE_WIDTH, Qt::DotLine);
@@ -60,6 +86,8 @@ void RouteItem::setScale(qreal scale)
QList childs = childItems();
for (int i = 0; i < childs.count(); i++)
childs.at(i)->setScale(1.0/scale);
+
+ updateShape();
}
void RouteItem::setColor(const QColor &color)
@@ -68,6 +96,12 @@ void RouteItem::setColor(const QColor &color)
update();
}
+void RouteItem::setUnits(enum Units units)
+{
+ _units = units;
+ setToolTip(toolTip());
+}
+
void RouteItem::moveMarker(qreal distance)
{
if (distance > _distance)
diff --git a/src/routeitem.h b/src/routeitem.h
index e2336c0c..5b174ae1 100644
--- a/src/routeitem.h
+++ b/src/routeitem.h
@@ -4,13 +4,16 @@
#include
#include "markeritem.h"
#include "route.h"
+#include "units.h"
+
class RouteItem : public QGraphicsItem
{
public:
RouteItem(const Route &route, QGraphicsItem *parent = 0);
- QRectF boundingRect() const {return _path.boundingRect();}
+ QPainterPath shape() const {return _shape;}
+ QRectF boundingRect() const {return _shape.boundingRect();}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
@@ -18,6 +21,7 @@ public:
void setScale(qreal scale);
void setColor(const QColor &color);
+ void setUnits(enum Units units);
void showMarker(bool show) {_marker->setVisible(show);}
void moveMarker(qreal distance);
@@ -26,11 +30,16 @@ public:
void showWaypointLabels(bool show);
private:
+ void updateShape();
+ QString toolTip();
+
QPainterPath _path;
+ QPainterPath _shape;
QPen _pen;
MarkerItem *_marker;
+ Units _units;
qreal _distance;
};
diff --git a/src/trackview.cpp b/src/trackview.cpp
index a0ae38b2..ec68d3bc 100644
--- a/src/trackview.cpp
+++ b/src/trackview.cpp
@@ -341,7 +341,8 @@ void TrackView::setUnits(enum Units units)
for (int i = 0; i < _tracks.count(); i++)
_tracks[i]->setUnits(units);
-
+ for (int i = 0; i < _routes.count(); i++)
+ _routes[i]->setUnits(units);
for (int i = 0; i < _waypoints.size(); i++)
_waypoints.at(i)->setUnits(units);