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