mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-21 12:49:10 +02:00
Compare commits
No commits in common. "aec052edafb63abb1857ffa96a024d6f88626a44" and "52ea52ff4e9cae68baab7c2e917bf89b9f3a4d21" have entirely different histories.
aec052edaf
...
52ea52ff4e
@ -47,7 +47,7 @@ QList<GraphItem*> CadenceGraph::loadData(const Data &data)
|
||||
const Track &track = data.tracks().at(i);
|
||||
const Graph &graph = track.cadence();
|
||||
|
||||
if (graph.isEmpty()) {
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
graphs.append(0);
|
||||
} else {
|
||||
|
@ -85,7 +85,7 @@ void ElevationGraph::setInfo()
|
||||
GraphItem *ElevationGraph::loadGraph(const Graph &graph, PathType type,
|
||||
const QColor &color, bool primary)
|
||||
{
|
||||
if (graph.isEmpty())
|
||||
if (!graph.isValid())
|
||||
return 0;
|
||||
|
||||
ElevationGraphItem *gi = new ElevationGraphItem(graph, _graphType, _width,
|
||||
|
@ -50,7 +50,7 @@ QList<GraphItem*> GearRatioGraph::loadData(const Data &data)
|
||||
for (int i = 0; i < data.tracks().count(); i++) {
|
||||
const Graph &graph = data.tracks().at(i).ratio();
|
||||
|
||||
if (graph.isEmpty()) {
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
graphs.append(0);
|
||||
} else {
|
||||
|
@ -8,6 +8,8 @@ GraphItem::GraphItem(const Graph &graph, GraphType type, int width,
|
||||
const QColor &color, Qt::PenStyle style, QGraphicsItem *parent)
|
||||
: GraphicsItem(parent), _graph(graph), _type(type), _secondaryGraph(0)
|
||||
{
|
||||
Q_ASSERT(_graph.isValid());
|
||||
|
||||
_units = Metric;
|
||||
_sx = 0; _sy = 0;
|
||||
_color = color;
|
||||
|
@ -47,7 +47,7 @@ QList<GraphItem*> HeartRateGraph::loadData(const Data &data)
|
||||
const Track &track = data.tracks().at(i);
|
||||
const Graph &graph = track.heartRate();
|
||||
|
||||
if (graph.isEmpty()) {
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
graphs.append(0);
|
||||
} else {
|
||||
|
@ -47,7 +47,7 @@ QList<GraphItem*> PowerGraph::loadData(const Data &data)
|
||||
const Track &track = data.tracks().at(i);
|
||||
const Graph &graph = track.power();
|
||||
|
||||
if (graph.isEmpty()) {
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
graphs.append(0);
|
||||
} else {
|
||||
|
@ -50,7 +50,7 @@ void SpeedGraph::setInfo()
|
||||
GraphItem *SpeedGraph::loadGraph(const Graph &graph, const Track &track,
|
||||
const QColor &color, bool primary)
|
||||
{
|
||||
if (graph.isEmpty())
|
||||
if (!graph.isValid())
|
||||
return 0;
|
||||
|
||||
SpeedGraphItem *gi = new SpeedGraphItem(graph, _graphType, _width,
|
||||
|
@ -51,7 +51,7 @@ QList<GraphItem*> TemperatureGraph::loadData(const Data &data)
|
||||
const Track &track = data.tracks().at(i);
|
||||
const Graph &graph = track.temperature();
|
||||
|
||||
if (graph.isEmpty()) {
|
||||
if (!graph.isValid()) {
|
||||
_palette.nextColor();
|
||||
graphs.append(0);
|
||||
} else {
|
||||
|
@ -46,6 +46,16 @@ typedef QVector<GraphPoint> GraphSegment;
|
||||
class Graph : public QList<GraphSegment>
|
||||
{
|
||||
public:
|
||||
bool isValid() const
|
||||
{
|
||||
if (isEmpty())
|
||||
return false;
|
||||
for (int i = 0; i < size(); i++)
|
||||
if (at(i).size() < 2)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool hasTime() const
|
||||
{
|
||||
for (int i = 0; i < size(); i++) {
|
||||
|
@ -68,14 +68,16 @@ GraphPair Route::elevation() const
|
||||
{
|
||||
if (_useDEM) {
|
||||
Graph dem(demElevation());
|
||||
return (dem.isEmpty())
|
||||
? GraphPair(gpsElevation(), Graph())
|
||||
: GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
||||
if (dem.isValid())
|
||||
return GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
||||
else
|
||||
return GraphPair(gpsElevation(), Graph());
|
||||
} else {
|
||||
Graph gps(gpsElevation());
|
||||
return (gps.isEmpty())
|
||||
? GraphPair(demElevation(), Graph())
|
||||
: GraphPair(gps, _show2ndElevation ? demElevation() : Graph());
|
||||
if (gps.isValid())
|
||||
return GraphPair(gps, _show2ndElevation ? demElevation() : Graph());
|
||||
else
|
||||
return GraphPair(demElevation(), Graph());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,7 @@ Graph Track::gpsElevation() const
|
||||
sd.at(j).elevation()));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2)
|
||||
ret.append(filter(gs, _elevationWindow));
|
||||
ret.append(filter(gs, _elevationWindow));
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -294,8 +293,7 @@ Graph Track::demElevation() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), dem));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2)
|
||||
ret.append(filter(gs, _elevationWindow));
|
||||
ret.append(filter(gs, _elevationWindow));
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -308,14 +306,16 @@ GraphPair Track::elevation() const
|
||||
{
|
||||
if (_useDEM) {
|
||||
Graph dem(demElevation());
|
||||
return (dem.isEmpty())
|
||||
? GraphPair(gpsElevation(), Graph())
|
||||
: GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
||||
if (dem.isValid())
|
||||
return GraphPair(dem, _show2ndElevation ? gpsElevation() : Graph());
|
||||
else
|
||||
return GraphPair(gpsElevation(), Graph());
|
||||
} else {
|
||||
Graph gps(gpsElevation());
|
||||
return (gps.isEmpty())
|
||||
? GraphPair(demElevation(), Graph())
|
||||
: GraphPair(gps, _show2ndElevation ? demElevation() : Graph());
|
||||
if (gps.isValid())
|
||||
return GraphPair(gps, _show2ndElevation ? demElevation() : Graph());
|
||||
else
|
||||
return GraphPair(demElevation(), Graph());
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,13 +344,11 @@ Graph Track::computedSpeed() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), v));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2) {
|
||||
ret.append(filter(gs, _speedWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
ret.append(filter(gs, _speedWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -384,13 +382,11 @@ Graph Track::reportedSpeed() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), v));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2) {
|
||||
ret.append(filter(gs, _speedWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
ret.append(filter(gs, _speedWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -403,14 +399,18 @@ GraphPair Track::speed() const
|
||||
{
|
||||
if (_useReportedSpeed) {
|
||||
Graph reported(reportedSpeed());
|
||||
return (reported.isEmpty())
|
||||
? GraphPair(computedSpeed(), Graph())
|
||||
: GraphPair(reported, _show2ndSpeed ? computedSpeed() : Graph());
|
||||
if (reported.isValid())
|
||||
return GraphPair(reported, _show2ndSpeed ? computedSpeed()
|
||||
: Graph());
|
||||
else
|
||||
return GraphPair(computedSpeed(), Graph());
|
||||
} else {
|
||||
Graph computed(computedSpeed());
|
||||
return (computed.isEmpty())
|
||||
? GraphPair(reportedSpeed(), Graph())
|
||||
: GraphPair(computed, _show2ndSpeed ? reportedSpeed() : Graph());
|
||||
if (computed.isValid())
|
||||
return GraphPair(computed, _show2ndSpeed ? reportedSpeed()
|
||||
: Graph());
|
||||
else
|
||||
return GraphPair(reportedSpeed(), Graph());
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,8 +430,7 @@ Graph Track::heartRate() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j),
|
||||
sd.at(j).heartRate()));
|
||||
|
||||
if (gs.size() >= 2)
|
||||
ret.append(filter(gs, _heartRateWindow));
|
||||
ret.append(filter(gs, _heartRateWindow));
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -457,8 +456,7 @@ Graph Track::temperature() const
|
||||
sd.at(j).temperature()));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2)
|
||||
ret.append(gs);
|
||||
ret.append(gs);
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -483,8 +481,7 @@ Graph Track::ratio() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j),
|
||||
sd.at(j).ratio()));
|
||||
|
||||
if (gs.size() >= 2)
|
||||
ret.append(gs);
|
||||
ret.append(gs);
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -518,13 +515,11 @@ Graph Track::cadence() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), c));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2) {
|
||||
ret.append(filter(gs, _cadenceWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
ret.append(filter(gs, _cadenceWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
@ -559,13 +554,11 @@ Graph Track::power() const
|
||||
gs.append(GraphPoint(seg.distance.at(j), seg.time.at(j), p));
|
||||
}
|
||||
|
||||
if (gs.size() >= 2) {
|
||||
ret.append(filter(gs, _powerWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
ret.append(filter(gs, _powerWindow));
|
||||
GraphSegment &filtered = ret.last();
|
||||
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
for (int j = 0; j < stop.size(); j++)
|
||||
filtered[stop.at(j)].setY(0);
|
||||
}
|
||||
|
||||
if (_data.style().color().isValid())
|
||||
|
Loading…
x
Reference in New Issue
Block a user