mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Fixed the instant-resize-after-first-load issue
This commit is contained in:
parent
4463241e50
commit
b0f4f2294a
@ -24,28 +24,33 @@ void CadenceGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CadenceGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
QList<GraphItem*> CadenceGraph::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
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)->cadence();
|
const Graph &graph = data.tracks().at(i)->cadence();
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
graphs.append(0);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
CadenceGraphItem *gi = new CadenceGraphItem(graph, _graphType);
|
CadenceGraphItem *gi = new CadenceGraphItem(graph, _graphType);
|
||||||
GraphView::addGraph(gi, paths.at(i));
|
GraphView::addGraph(gi);
|
||||||
|
|
||||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||||
|
graphs.append(gi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++) {
|
||||||
skipColor();
|
skipColor();
|
||||||
|
graphs.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
return graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal CadenceGraph::avg() const
|
qreal CadenceGraph::avg() const
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
CadenceGraph(QWidget *parent = 0);
|
CadenceGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Cadence");}
|
QString label() const {return tr("Cadence");}
|
||||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
QList<GraphItem*> loadData(const Data &data);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
void showRoutes(bool show) {Q_UNUSED(show);}
|
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||||
|
@ -65,15 +65,15 @@ void ElevationGraph::setInfo()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::loadGraph(const Graph &graph, Type type, PathItem *path)
|
GraphItem *ElevationGraph::loadGraph(const Graph &graph, Type type)
|
||||||
{
|
{
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ElevationGraphItem *gi = new ElevationGraphItem(graph, _graphType);
|
ElevationGraphItem *gi = new ElevationGraphItem(graph, _graphType);
|
||||||
GraphView::addGraph(gi, path, type);
|
GraphView::addGraph(gi, type);
|
||||||
|
|
||||||
if (type == Track) {
|
if (type == Track) {
|
||||||
_trackAscent += gi->ascent();
|
_trackAscent += gi->ascent();
|
||||||
@ -86,20 +86,23 @@ void ElevationGraph::loadGraph(const Graph &graph, Type type, PathItem *path)
|
|||||||
_routeMax = nMax(_routeMax, gi->max());
|
_routeMax = nMax(_routeMax, gi->max());
|
||||||
_routeMin = nMin(_routeMin, gi->min());
|
_routeMin = nMin(_routeMin, gi->min());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return gi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
QList<GraphItem*> ElevationGraph::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
int p = 0;
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++)
|
for (int i = 0; i < data.tracks().count(); i++)
|
||||||
loadGraph(data.tracks().at(i)->elevation(), Track, paths.at(p++));
|
graphs.append(loadGraph(data.tracks().at(i)->elevation(), Track));
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
loadGraph(data.routes().at(i)->elevation(), Route, paths.at(p++));
|
graphs.append(loadGraph(data.routes().at(i)->elevation(), Route));
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
return graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::clear()
|
void ElevationGraph::clear()
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
ElevationGraph(QWidget *parent = 0);
|
ElevationGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Elevation");}
|
QString label() const {return tr("Elevation");}
|
||||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
QList<GraphItem*> loadData(const Data &data);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
@ -28,7 +28,7 @@ private:
|
|||||||
void setYUnits(Units units);
|
void setYUnits(Units units);
|
||||||
void setInfo();
|
void setInfo();
|
||||||
|
|
||||||
void loadGraph(const Graph &graph, Type type, PathItem *path);
|
GraphItem *loadGraph(const Graph &graph, Type type);
|
||||||
|
|
||||||
qreal _trackAscent, _trackDescent;
|
qreal _trackAscent, _trackDescent;
|
||||||
qreal _routeAscent, _routeDescent;
|
qreal _routeAscent, _routeDescent;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "timetype.h"
|
#include "timetype.h"
|
||||||
|
|
||||||
class Data;
|
class Data;
|
||||||
class PathItem;
|
class GraphItem;
|
||||||
|
|
||||||
class GraphTab : public GraphView
|
class GraphTab : public GraphView
|
||||||
{
|
{
|
||||||
@ -19,7 +19,7 @@ public:
|
|||||||
virtual ~GraphTab() {}
|
virtual ~GraphTab() {}
|
||||||
|
|
||||||
virtual QString label() const = 0;
|
virtual QString label() const = 0;
|
||||||
virtual void loadData(const Data &data, const QList<PathItem *> &paths) = 0;
|
virtual QList<GraphItem*> loadData(const Data &data) = 0;
|
||||||
virtual void clear() {GraphView::clear();}
|
virtual void clear() {GraphView::clear();}
|
||||||
virtual void setUnits(enum Units units) {GraphView::setUnits(units);}
|
virtual void setUnits(enum Units units) {GraphView::setUnits(units);}
|
||||||
virtual void setGraphType(GraphType type) {GraphView::setGraphType(type);}
|
virtual void setGraphType(GraphType type) {GraphView::setGraphType(type);}
|
||||||
|
@ -187,7 +187,7 @@ void GraphView::showSliderInfo(bool show)
|
|||||||
_sliderInfo->setVisible(show);
|
_sliderInfo->setVisible(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::addGraph(GraphItem *graph, PathItem *path, int id)
|
void GraphView::addGraph(GraphItem *graph, int id)
|
||||||
{
|
{
|
||||||
QColor color(_palette.nextColor());
|
QColor color(_palette.nextColor());
|
||||||
color.setAlpha(255);
|
color.setAlpha(255);
|
||||||
@ -199,10 +199,6 @@ void GraphView::addGraph(GraphItem *graph, PathItem *path, int id)
|
|||||||
|
|
||||||
connect(this, SIGNAL(sliderPositionChanged(qreal)), graph,
|
connect(this, SIGNAL(sliderPositionChanged(qreal)), graph,
|
||||||
SLOT(emitSliderPositionChanged(qreal)));
|
SLOT(emitSliderPositionChanged(qreal)));
|
||||||
connect(graph, SIGNAL(sliderPositionChanged(qreal)), path,
|
|
||||||
SLOT(moveMarker(qreal)));
|
|
||||||
connect(path, SIGNAL(selected(bool)), graph, SLOT(hover(bool)));
|
|
||||||
connect(graph, SIGNAL(selected(bool)), path, SLOT(hover(bool)));
|
|
||||||
|
|
||||||
_graphs.append(graph);
|
_graphs.append(graph);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ signals:
|
|||||||
void sliderPositionChanged(qreal);
|
void sliderPositionChanged(qreal);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addGraph(GraphItem *graph, PathItem *path, int id = 0);
|
void addGraph(GraphItem *graph, int id = 0);
|
||||||
|
|
||||||
void showGraph(bool show, int id = 0);
|
void showGraph(bool show, int id = 0);
|
||||||
void setGraphType(GraphType type);
|
void setGraphType(GraphType type);
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
#include "filebrowser.h"
|
#include "filebrowser.h"
|
||||||
#include "cpuarch.h"
|
#include "cpuarch.h"
|
||||||
#include "graphtab.h"
|
#include "graphtab.h"
|
||||||
|
#include "graphitem.h"
|
||||||
|
#include "pathitem.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
|
|
||||||
@ -58,15 +60,15 @@ GUI::GUI()
|
|||||||
|
|
||||||
createBrowser();
|
createBrowser();
|
||||||
|
|
||||||
QSplitter *splitter = new QSplitter();
|
_splitter = new QSplitter();
|
||||||
splitter->setOrientation(Qt::Vertical);
|
_splitter->setOrientation(Qt::Vertical);
|
||||||
splitter->setChildrenCollapsible(false);
|
_splitter->setChildrenCollapsible(false);
|
||||||
splitter->addWidget(_mapView);
|
_splitter->addWidget(_mapView);
|
||||||
splitter->addWidget(_graphTabWidget);
|
_splitter->addWidget(_graphTabWidget);
|
||||||
splitter->setContentsMargins(0, 0, 0, 0);
|
_splitter->setContentsMargins(0, 0, 0, 0);
|
||||||
splitter->setStretchFactor(0, 255);
|
_splitter->setStretchFactor(0, 255);
|
||||||
splitter->setStretchFactor(1, 1);
|
_splitter->setStretchFactor(1, 1);
|
||||||
setCentralWidget(splitter);
|
setCentralWidget(_splitter);
|
||||||
|
|
||||||
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
setWindowIcon(QIcon(QPixmap(APP_ICON)));
|
||||||
setWindowTitle(APP_NAME);
|
setWindowTitle(APP_NAME);
|
||||||
@ -688,8 +690,6 @@ bool GUI::openFile(const QString &fileName)
|
|||||||
updateNavigationActions();
|
updateNavigationActions();
|
||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
updateGraphTabs();
|
|
||||||
updateMapView();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -703,13 +703,10 @@ bool GUI::openFile(const QString &fileName)
|
|||||||
bool GUI::loadFile(const QString &fileName)
|
bool GUI::loadFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
Data data;
|
Data data;
|
||||||
|
QList<QList<GraphItem*> > graphs;
|
||||||
QList<PathItem*> paths;
|
QList<PathItem*> paths;
|
||||||
|
|
||||||
if (data.loadFile(fileName)) {
|
if (data.loadFile(fileName)) {
|
||||||
paths = _mapView->loadData(data);
|
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
|
||||||
_tabs.at(i)->loadData(data, paths);
|
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
_trackDistance += data.tracks().at(i)->distance();
|
_trackDistance += data.tracks().at(i)->distance();
|
||||||
_time += data.tracks().at(i)->time();
|
_time += data.tracks().at(i)->time();
|
||||||
@ -736,6 +733,25 @@ bool GUI::loadFile(const QString &fileName)
|
|||||||
} else
|
} else
|
||||||
_pathName = QString();
|
_pathName = QString();
|
||||||
|
|
||||||
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
|
graphs.append(_tabs.at(i)->loadData(data));
|
||||||
|
if (updateGraphTabs() | updateMapView())
|
||||||
|
_splitter->refresh();
|
||||||
|
paths = _mapView->loadData(data);
|
||||||
|
|
||||||
|
for (int i = 0; i < paths.count(); i++) {
|
||||||
|
const PathItem *pi = paths.at(i);
|
||||||
|
for (int j = 0; j < graphs.count(); j++) {
|
||||||
|
const GraphItem *gi = graphs.at(j).at(i);
|
||||||
|
if (!gi)
|
||||||
|
continue;
|
||||||
|
connect(gi, SIGNAL(sliderPositionChanged(qreal)), pi,
|
||||||
|
SLOT(moveMarker(qreal)));
|
||||||
|
connect(pi, SIGNAL(selected(bool)), gi, SLOT(hover(bool)));
|
||||||
|
connect(gi, SIGNAL(selected(bool)), pi, SLOT(hover(bool)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
updateNavigationActions();
|
updateNavigationActions();
|
||||||
@ -1010,8 +1026,6 @@ void GUI::reloadFile()
|
|||||||
|
|
||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
updateWindowTitle();
|
updateWindowTitle();
|
||||||
updateGraphTabs();
|
|
||||||
updateMapView();
|
|
||||||
if (_files.isEmpty())
|
if (_files.isEmpty())
|
||||||
_fileActionGroup->setEnabled(false);
|
_fileActionGroup->setEnabled(false);
|
||||||
else
|
else
|
||||||
@ -1276,10 +1290,11 @@ void GUI::updateNavigationActions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::updateGraphTabs()
|
bool GUI::updateGraphTabs()
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
GraphTab *tab;
|
GraphTab *tab;
|
||||||
|
bool hidden = _graphTabWidget->isHidden();
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.size(); i++) {
|
for (int i = 0; i < _tabs.size(); i++) {
|
||||||
tab = _tabs.at(i);
|
tab = _tabs.at(i);
|
||||||
@ -1303,14 +1318,20 @@ void GUI::updateGraphTabs()
|
|||||||
_graphTabWidget->setHidden(true);
|
_graphTabWidget->setHidden(true);
|
||||||
_showGraphsAction->setEnabled(false);
|
_showGraphsAction->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (hidden != _graphTabWidget->isHidden());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::updateMapView()
|
bool GUI::updateMapView()
|
||||||
{
|
{
|
||||||
|
bool hidden = _mapView->isHidden();
|
||||||
|
|
||||||
if (_options.alwaysShowMap)
|
if (_options.alwaysShowMap)
|
||||||
_mapView->setHidden(false);
|
_mapView->setHidden(false);
|
||||||
else
|
else
|
||||||
_mapView->setHidden(!(_trackCount + _routeCount + _waypointCount));
|
_mapView->setHidden(!(_trackCount + _routeCount + _waypointCount));
|
||||||
|
|
||||||
|
return (hidden != _mapView->isHidden());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::setTimeType(TimeType type)
|
void GUI::setTimeType(TimeType type)
|
||||||
|
@ -20,6 +20,7 @@ class QTabWidget;
|
|||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
class QSplitter;
|
||||||
class QSignalMapper;
|
class QSignalMapper;
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
class FileBrowser;
|
class FileBrowser;
|
||||||
@ -109,8 +110,8 @@ private:
|
|||||||
void updateStatusBarInfo();
|
void updateStatusBarInfo();
|
||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void updateNavigationActions();
|
void updateNavigationActions();
|
||||||
void updateGraphTabs();
|
bool updateGraphTabs();
|
||||||
void updateMapView();
|
bool updateMapView();
|
||||||
|
|
||||||
TimeType timeType() const;
|
TimeType timeType() const;
|
||||||
Units units() const;
|
Units units() const;
|
||||||
@ -196,6 +197,7 @@ private:
|
|||||||
QLabel *_distanceLabel;
|
QLabel *_distanceLabel;
|
||||||
QLabel *_timeLabel;
|
QLabel *_timeLabel;
|
||||||
|
|
||||||
|
QSplitter *_splitter;
|
||||||
MapView *_mapView;
|
MapView *_mapView;
|
||||||
QTabWidget *_graphTabWidget;
|
QTabWidget *_graphTabWidget;
|
||||||
QList<GraphTab*> _tabs;
|
QList<GraphTab*> _tabs;
|
||||||
|
@ -24,28 +24,33 @@ void HeartRateGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
QList<GraphItem*> HeartRateGraph::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
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)->heartRate();
|
const Graph &graph = data.tracks().at(i)->heartRate();
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
graphs.append(0);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
HeartRateGraphItem *gi = new HeartRateGraphItem(graph, _graphType);
|
HeartRateGraphItem *gi = new HeartRateGraphItem(graph, _graphType);
|
||||||
GraphView::addGraph(gi, paths.at(i));
|
GraphView::addGraph(gi);
|
||||||
|
|
||||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||||
|
graphs.append(gi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++) {
|
||||||
skipColor();
|
skipColor();
|
||||||
|
graphs.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
return graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal HeartRateGraph::avg() const
|
qreal HeartRateGraph::avg() const
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
HeartRateGraph(QWidget *parent = 0);
|
HeartRateGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Heart rate");}
|
QString label() const {return tr("Heart rate");}
|
||||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
QList<GraphItem*> loadData(const Data &data);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ class RouteItem;
|
|||||||
class WaypointItem;
|
class WaypointItem;
|
||||||
class ScaleItem;
|
class ScaleItem;
|
||||||
class PathItem;
|
class PathItem;
|
||||||
|
class GraphItem;
|
||||||
|
|
||||||
class MapView : public QGraphicsView
|
class MapView : public QGraphicsView
|
||||||
{
|
{
|
||||||
@ -30,7 +31,7 @@ class MapView : public QGraphicsView
|
|||||||
public:
|
public:
|
||||||
MapView(Map *map, POI *poi, QWidget *parent = 0);
|
MapView(Map *map, POI *poi, QWidget *parent = 0);
|
||||||
|
|
||||||
QList<PathItem*> loadData(const Data &data);
|
QList<PathItem *> loadData(const Data &data);
|
||||||
|
|
||||||
void setPalette(const Palette &palette);
|
void setPalette(const Palette &palette);
|
||||||
void setPOI(POI *poi);
|
void setPOI(POI *poi);
|
||||||
|
@ -24,28 +24,33 @@ void PowerGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
QList<GraphItem*> PowerGraph::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
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)->power();
|
const Graph &graph = data.tracks().at(i)->power();
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
graphs.append(0);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
PowerGraphItem *gi = new PowerGraphItem(graph, _graphType);
|
PowerGraphItem *gi = new PowerGraphItem(graph, _graphType);
|
||||||
GraphView::addGraph(gi, paths.at(i));
|
GraphView::addGraph(gi);
|
||||||
|
|
||||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||||
|
graphs.append(gi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++) {
|
||||||
skipColor();
|
skipColor();
|
||||||
|
graphs.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
return graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal PowerGraph::avg() const
|
qreal PowerGraph::avg() const
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
PowerGraph(QWidget *parent = 0);
|
PowerGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Power");}
|
QString label() const {return tr("Power");}
|
||||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
QList<GraphItem*> loadData(const Data &data);
|
||||||
void clear();
|
void clear();
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
|
||||||
|
@ -34,32 +34,37 @@ void SpeedGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpeedGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
QList<GraphItem*> SpeedGraph::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
for (int i = 0; i < data.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
const Track *track = data.tracks().at(i);
|
const Track *track = data.tracks().at(i);
|
||||||
const Graph &graph = track->speed();
|
const Graph &graph = track->speed();
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
graphs.append(0);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
SpeedGraphItem *gi = new SpeedGraphItem(graph, _graphType,
|
SpeedGraphItem *gi = new SpeedGraphItem(graph, _graphType,
|
||||||
track->movingTime());
|
track->movingTime());
|
||||||
gi->setTimeType(_timeType);
|
gi->setTimeType(_timeType);
|
||||||
GraphView::addGraph(gi, paths.at(i));
|
GraphView::addGraph(gi);
|
||||||
|
|
||||||
_avg.append(QPointF(track->distance(), gi->avg()));
|
_avg.append(QPointF(track->distance(), gi->avg()));
|
||||||
_mavg.append(QPointF(track->distance(), gi->mavg()));
|
_mavg.append(QPointF(track->distance(), gi->mavg()));
|
||||||
|
graphs.append(gi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++) {
|
||||||
skipColor();
|
skipColor();
|
||||||
|
graphs.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
return graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal SpeedGraph::avg() const
|
qreal SpeedGraph::avg() const
|
||||||
|
@ -12,7 +12,7 @@ public:
|
|||||||
SpeedGraph(QWidget *parent = 0);
|
SpeedGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Speed");}
|
QString label() const {return tr("Speed");}
|
||||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
QList<GraphItem*> loadData(const Data &data);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
void setTimeType(TimeType type);
|
void setTimeType(TimeType type);
|
||||||
|
@ -26,28 +26,34 @@ void TemperatureGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemperatureGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
QList<GraphItem*> TemperatureGraph::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
|
QList<GraphItem*> graphs;
|
||||||
|
|
||||||
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)->temperature();
|
const Graph &graph = data.tracks().at(i)->temperature();
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
graphs.append(0);
|
||||||
}
|
} else {
|
||||||
|
TemperatureGraphItem *gi = new TemperatureGraphItem(graph,
|
||||||
TemperatureGraphItem *gi = new TemperatureGraphItem(graph, _graphType);
|
_graphType);
|
||||||
GraphView::addGraph(gi, paths.at(i));
|
GraphView::addGraph(gi);
|
||||||
|
|
||||||
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
|
||||||
|
graphs.append(gi);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < data.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++) {
|
||||||
skipColor();
|
skipColor();
|
||||||
|
graphs.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
|
|
||||||
|
return graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal TemperatureGraph::avg() const
|
qreal TemperatureGraph::avg() const
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
TemperatureGraph(QWidget *parent = 0);
|
TemperatureGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Temperature");}
|
QString label() const {return tr("Temperature");}
|
||||||
void loadData(const Data &data, const QList<PathItem *> &paths);
|
QList<GraphItem*> loadData(const Data &data);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
Loading…
Reference in New Issue
Block a user