1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-31 00:55:13 +01:00
GPXSee/src/route.cpp

31 lines
611 B
C++
Raw Normal View History

2016-08-09 01:16:19 +02:00
#include "ll.h"
#include "route.h"
Route::Route(const QVector<Waypoint> &data) : _data(data)
{
qreal dist = 0;
_dd.append(dist);
for (int i = 1; i < data.count(); i++) {
dist += llDistance(data.at(i).coordinates(), data.at(i-1).coordinates());
2016-08-09 01:16:19 +02:00
_dd.append(dist);
}
}
QVector<QPointF> Route::elevation() const
2016-08-09 01:16:19 +02:00
{
QVector<QPointF> graph;
2016-08-09 01:16:19 +02:00
for (int i = 0; i < _data.size(); i++)
if (_data.at(i).hasElevation())
graph.append(QPointF(_dd.at(i), _data.at(i).elevation()
- _data.at(i).geoidHeight()));
return graph;
}
qreal Route::distance() const
{
return (_dd.isEmpty()) ? 0 : _dd.last();
2016-08-09 01:16:19 +02:00
}