1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-04-21 12:49:10 +02:00

Compare commits

..

No commits in common. "190a961242de9e18bf1a0ba532aad76afa22625b" and "a4a54101a318dbb742086d829c41ab5157050e02" have entirely different histories.

8 changed files with 21 additions and 59 deletions

View File

@ -224,12 +224,6 @@ qreal GraphItem::timeAtDistance(qreal distance) const
return l.pointAt((distance - l.p1().x()) / (l.p2().x() - l.p1().x())).y();
}
GraphItem::SegmentTime GraphItem::date(qreal x)
{
const GraphSegment *seg = segment(x, _type);
return seg ? SegmentTime(seg->start(), seg->first().t()) : SegmentTime();
}
void GraphItem::hover(bool hover)
{
if (hover) {

View File

@ -12,16 +12,6 @@ class GraphItem : public QObject, public GraphicsItem
Q_OBJECT
public:
struct SegmentTime
{
SegmentTime() : time(NAN) {}
SegmentTime(const QDateTime &date, qreal time)
: date(date), time(time) {}
QDateTime date;
qreal time;
};
GraphItem(const Graph &graph, GraphType type, int width,
const QColor &color, Qt::PenStyle style, QGraphicsItem *parent = 0);
virtual ~GraphItem() {}
@ -53,7 +43,6 @@ public:
qreal yAtX(qreal x) const;
qreal distanceAtTime(qreal time) const;
qreal timeAtDistance(qreal distance) const;
SegmentTime date(qreal x);
void redraw();

View File

@ -334,18 +334,12 @@ void PathItem::setMarkerPosition(qreal pos)
void PathItem::setMarkerInfo(qreal pos)
{
if (_markerInfoType == MarkerInfoItem::Date) {
QDateTime date;
if (_graph) {
qreal time = (_graph->graphType() == Time)
? pos : _graph->timeAtDistance(pos);
GraphItem::SegmentTime st(_graph->date(pos));
if (st.date.isValid() && !std::isnan(time))
date = st.date.addSecs(time - st.time);
}
if (date.isValid())
_markerInfo->setDate(date.toTimeZone(_timeZone));
qreal time = _graph
? (_graph->graphType() == Time) ? pos : _graph->timeAtDistance(pos)
: NAN;
QDateTime d(date());
if (!std::isnan(time) && d.isValid())
_markerInfo->setDate(d.addSecs(time).toTimeZone(_timeZone));
else
_markerInfo->setDate(QDateTime());
} else if (_markerInfoType == MarkerInfoItem::Position)

View File

@ -4,7 +4,6 @@
#include <QList>
#include <QVector>
#include <QColor>
#include <QDateTime>
#include <QDebug>
#include <cmath>
@ -42,19 +41,7 @@ inline QDebug operator<<(QDebug dbg, const GraphPoint &point)
}
#endif // QT_NO_DEBUG
class GraphSegment : public QVector<GraphPoint>
{
public:
GraphSegment(const QDateTime &start)
: _start(start) {}
GraphSegment(int size, const QDateTime &start)
: QVector<GraphPoint>(size), _start(start) {}
const QDateTime &start() const {return _start;}
private:
QDateTime _start;
};
typedef QVector<GraphPoint> GraphSegment;
class Graph : public QList<GraphSegment>
{

View File

@ -33,7 +33,7 @@ Path Route::path() const
Graph Route::gpsElevation() const
{
Graph graph;
graph.append(GraphSegment(QDateTime()));
graph.append(GraphSegment());
GraphSegment &gs = graph.last();
for (int i = 0; i < _data.size(); i++)
@ -49,7 +49,7 @@ Graph Route::gpsElevation() const
Graph Route::demElevation() const
{
Graph graph;
graph.append(GraphSegment(QDateTime()));
graph.append(GraphSegment());
GraphSegment &gs = graph.last();
for (int i = 0; i < _data.size(); i++) {

View File

@ -66,10 +66,10 @@ static QSet<int> eliminate(const QVector<qreal> &v)
static GraphSegment filter(const GraphSegment &g, int window)
{
if (g.size() < window || window < 2)
return g;
return GraphSegment(g);
qreal acc = 0;
GraphSegment ret(g.size(), g.start());
GraphSegment ret(g.size());
for (int i = 0; i < window; i++)
acc += g.at(i).y();
@ -131,7 +131,6 @@ Track::Track(const TrackData &data) : _pause(0)
Segment &seg = _segments.last();
seg.start = sd.first().timestamp();
seg.distance.append(lastDistance(i));
seg.time.append(sd.first().hasTimestamp() ? lastTime(i) : NAN);
seg.speed.append(sd.first().hasTimestamp() ? 0 : NAN);
@ -258,7 +257,7 @@ Graph Track::gpsElevation() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
for (int j = 0; j < sd.size(); j++) {
if (!sd.at(j).hasElevation() || seg.outliers.contains(j))
@ -286,7 +285,7 @@ Graph Track::demElevation() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
for (int j = 0; j < sd.size(); j++) {
qreal dem = DEM::elevation(sd.at(j).coordinates());
@ -329,7 +328,7 @@ Graph Track::computedSpeed() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
QList<int> stop;
qreal v;
@ -369,7 +368,7 @@ Graph Track::reportedSpeed() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
QList<int> stop;
qreal v;
@ -424,7 +423,7 @@ Graph Track::heartRate() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
for (int j = 0; j < sd.size(); j++)
if (sd.at(j).hasHeartRate() && !seg.outliers.contains(j))
@ -450,7 +449,7 @@ Graph Track::temperature() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
for (int j = 0; j < sd.count(); j++) {
if (sd.at(j).hasTemperature() && !seg.outliers.contains(j))
@ -477,7 +476,7 @@ Graph Track::ratio() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
for (int j = 0; j < sd.size(); j++)
if (sd.at(j).hasRatio() && !seg.outliers.contains(j))
@ -503,7 +502,7 @@ Graph Track::cadence() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
QList<int> stop;
qreal c;
@ -546,7 +545,7 @@ Graph Track::power() const
if (sd.size() < 2)
continue;
const Segment &seg = _segments.at(i);
GraphSegment gs(seg.start);
GraphSegment gs;
for (int j = 0; j < sd.size(); j++) {
if (sd.at(j).hasPower() && seg.stop.contains(j)) {

View File

@ -56,7 +56,6 @@ public:
private:
struct Segment {
QDateTime start;
QVector<qreal> distance;
QVector<qreal> time;
QVector<qreal> speed;

View File

@ -157,7 +157,7 @@ void KMZMap::computeBounds()
_adjust = 0;
_bounds = QVector<Bounds>(_tiles.count());
for (int i = 0; i < _tiles.count(); i++) {
QRectF xy(offsets.at(i), _tiles.at(i).bounds().size() / _mapRatio);
QRectF xy(offsets.at(i), _tiles.at(i).bounds().size());
_bounds[i] = Bounds(_tiles.at(i).bbox(), xy);
_adjust = qMin(qMin(_tiles.at(i).bounds().left(),
_tiles.at(i).bounds().top()), _adjust);