1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Graph items are now selecteble like path items (+ tool tips)

This commit is contained in:
Martin Tůma 2017-09-24 19:54:13 +02:00
parent 7bc83603ca
commit d3fbbecb2d
41 changed files with 954 additions and 169 deletions

View File

@ -97,7 +97,13 @@ HEADERS += src/config.h \
src/oddspinbox.h \
src/rectc.h \
src/searchpointer.h \
src/percentslider.h
src/percentslider.h \
src/elevationgraphitem.h \
src/speedgraphitem.h \
src/heartrategraphitem.h \
src/temperaturegraphitem.h \
src/cadencegraphitem.h \
src/powergraphitem.h
SOURCES += src/main.cpp \
src/gui.cpp \
src/poi.cpp \
@ -167,7 +173,13 @@ SOURCES += src/main.cpp \
src/albersequal.cpp \
src/oddspinbox.cpp \
src/rectc.cpp \
src/percentslider.cpp
src/percentslider.cpp \
src/elevationgraphitem.cpp \
src/speedgraphitem.cpp \
src/heartrategraphitem.cpp \
src/temperaturegraphitem.cpp \
src/cadencegraphitem.cpp \
src/powergraphitem.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts \
lang/gpxsee_sv.ts \

BIN
lang/gpxsee_cs.qm Normal file

Binary file not shown.

View File

@ -25,6 +25,25 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>CadenceGraphItem</name>
<message>
<location filename="../src/cadencegraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/cadencegraphitem.cpp" line="21"/>
<location filename="../src/cadencegraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/cadencegraphitem.cpp" line="22"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
</context>
<context>
<name>Data</name>
<message>
@ -82,36 +101,69 @@
<translation>Výška</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="141"/>
<location filename="../src/elevationgraph.cpp" line="122"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="58"/>
<location filename="../src/elevationgraph.cpp" line="57"/>
<source>Ascent</source>
<translation>Stoupání</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="60"/>
<location filename="../src/elevationgraph.cpp" line="59"/>
<source>Descent</source>
<translation>Klesání</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="64"/>
<location filename="../src/elevationgraph.cpp" line="63"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="144"/>
<location filename="../src/elevationgraph.cpp" line="125"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="62"/>
<location filename="../src/elevationgraph.cpp" line="61"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
</context>
<context>
<name>ElevationGraphItem</name>
<message>
<location filename="../src/elevationgraphitem.cpp" line="26"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="26"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="28"/>
<source>Ascent</source>
<translation>Stoupání</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="30"/>
<source>Descent</source>
<translation>Klesání</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="32"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="34"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
</context>
<context>
<name>ExportDialog</name>
<message>
@ -725,12 +777,12 @@
</message>
<message>
<location filename="../src/graphview.cpp" line="60"/>
<location filename="../src/graphview.cpp" line="157"/>
<location filename="../src/graphview.cpp" line="161"/>
<source>Distance</source>
<translation>Vzdálenost</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="159"/>
<location filename="../src/graphview.cpp" line="163"/>
<source>Time</source>
<translation>Čas</translation>
</message>
@ -759,6 +811,25 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>HeartRateGraphItem</name>
<message>
<location filename="../src/heartrategraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/heartrategraphitem.cpp" line="21"/>
<location filename="../src/heartrategraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/heartrategraphitem.cpp" line="22"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
</context>
<context>
<name>MapList</name>
<message>
@ -1152,6 +1223,25 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>PowerGraphItem</name>
<message>
<location filename="../src/powergraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/powergraphitem.cpp" line="21"/>
<location filename="../src/powergraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/powergraphitem.cpp" line="22"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
</context>
<context>
<name>RouteItem</name>
<message>
@ -1196,32 +1286,60 @@
<context>
<name>SpeedGraph</name>
<message>
<location filename="../src/speedgraph.cpp" line="13"/>
<location filename="../src/speedgraph.cpp" line="14"/>
<location filename="../src/speedgraph.h" line="14"/>
<source>Speed</source>
<translation>Rychlost</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="79"/>
<location filename="../src/speedgraph.cpp" line="81"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="21"/>
<location filename="../src/speedgraph.cpp" line="22"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="23"/>
<location filename="../src/speedgraph.cpp" line="24"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="82"/>
<location filename="../src/speedgraph.cpp" line="84"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>
</context>
<context>
<name>SpeedGraphItem</name>
<message>
<location filename="../src/speedgraphitem.cpp" line="17"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="17"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="19"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="21"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="23"/>
<source>Moving average</source>
<translation>Čistý průměr</translation>
</message>
</context>
<context>
<name>TemperatureGraph</name>
<message>
@ -1246,16 +1364,44 @@
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="81"/>
<location filename="../src/temperaturegraph.cpp" line="76"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="85"/>
<location filename="../src/temperaturegraph.cpp" line="80"/>
<source>F</source>
<translation>F</translation>
</message>
</context>
<context>
<name>TemperatureGraphItem</name>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="22"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="22"/>
<source>F</source>
<translation>F</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="24"/>
<source>Average</source>
<translation>Průměr</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="26"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="28"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
</context>
<context>
<name>TrackItem</name>
<message>

BIN
lang/gpxsee_de.qm Normal file

Binary file not shown.

View File

@ -25,6 +25,25 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>CadenceGraphItem</name>
<message>
<location filename="../src/cadencegraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/cadencegraphitem.cpp" line="21"/>
<location filename="../src/cadencegraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/cadencegraphitem.cpp" line="22"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
</context>
<context>
<name>Data</name>
<message>
@ -82,36 +101,69 @@
<translation>Höhe</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="141"/>
<location filename="../src/elevationgraph.cpp" line="122"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="58"/>
<location filename="../src/elevationgraph.cpp" line="57"/>
<source>Ascent</source>
<translation>Steigung</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="60"/>
<location filename="../src/elevationgraph.cpp" line="59"/>
<source>Descent</source>
<translation>Gefälle</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="64"/>
<location filename="../src/elevationgraph.cpp" line="63"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="144"/>
<location filename="../src/elevationgraph.cpp" line="125"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="62"/>
<location filename="../src/elevationgraph.cpp" line="61"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
</context>
<context>
<name>ElevationGraphItem</name>
<message>
<location filename="../src/elevationgraphitem.cpp" line="26"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="26"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="28"/>
<source>Ascent</source>
<translation>Steigung</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="30"/>
<source>Descent</source>
<translation>Gefälle</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="32"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="34"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
</context>
<context>
<name>ExportDialog</name>
<message>
@ -724,12 +776,12 @@
</message>
<message>
<location filename="../src/graphview.cpp" line="60"/>
<location filename="../src/graphview.cpp" line="157"/>
<location filename="../src/graphview.cpp" line="161"/>
<source>Distance</source>
<translation>Distanz</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="159"/>
<location filename="../src/graphview.cpp" line="163"/>
<source>Time</source>
<translation>Zeit</translation>
</message>
@ -758,6 +810,25 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>HeartRateGraphItem</name>
<message>
<location filename="../src/heartrategraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/heartrategraphitem.cpp" line="21"/>
<location filename="../src/heartrategraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/heartrategraphitem.cpp" line="22"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
</context>
<context>
<name>MapList</name>
<message>
@ -1151,6 +1222,25 @@
<translation>Maximum</translation>
</message>
</context>
<context>
<name>PowerGraphItem</name>
<message>
<location filename="../src/powergraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/powergraphitem.cpp" line="21"/>
<location filename="../src/powergraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/powergraphitem.cpp" line="22"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
</context>
<context>
<name>RouteItem</name>
<message>
@ -1195,32 +1285,60 @@
<context>
<name>SpeedGraph</name>
<message>
<location filename="../src/speedgraph.cpp" line="13"/>
<location filename="../src/speedgraph.cpp" line="14"/>
<location filename="../src/speedgraph.h" line="14"/>
<source>Speed</source>
<translation>Geschwindigkeit</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="79"/>
<location filename="../src/speedgraph.cpp" line="81"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="21"/>
<location filename="../src/speedgraph.cpp" line="22"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="23"/>
<location filename="../src/speedgraph.cpp" line="24"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="82"/>
<location filename="../src/speedgraph.cpp" line="84"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>
</context>
<context>
<name>SpeedGraphItem</name>
<message>
<location filename="../src/speedgraphitem.cpp" line="17"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="17"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="19"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="21"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="23"/>
<source>Moving average</source>
<translation>Bewegungsdurchschnitt</translation>
</message>
</context>
<context>
<name>TemperatureGraph</name>
<message>
@ -1245,16 +1363,44 @@
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="81"/>
<location filename="../src/temperaturegraph.cpp" line="76"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="85"/>
<location filename="../src/temperaturegraph.cpp" line="80"/>
<source>F</source>
<translation>F</translation>
</message>
</context>
<context>
<name>TemperatureGraphItem</name>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="22"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="22"/>
<source>F</source>
<translation>F</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="24"/>
<source>Average</source>
<translation>Durchschnitt</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="26"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="28"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
</context>
<context>
<name>TrackItem</name>
<message>

BIN
lang/gpxsee_sv.qm Normal file

Binary file not shown.

View File

@ -25,6 +25,25 @@
<translation>Maximal</translation>
</message>
</context>
<context>
<name>CadenceGraphItem</name>
<message>
<location filename="../src/cadencegraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/cadencegraphitem.cpp" line="21"/>
<location filename="../src/cadencegraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/cadencegraphitem.cpp" line="22"/>
<source>Average</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Data</name>
<message>
@ -82,36 +101,69 @@
<translation>Höjd</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="141"/>
<location filename="../src/elevationgraph.cpp" line="122"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="58"/>
<location filename="../src/elevationgraph.cpp" line="57"/>
<source>Ascent</source>
<translation>Stigning</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="60"/>
<location filename="../src/elevationgraph.cpp" line="59"/>
<source>Descent</source>
<translation>Nedstigning</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="64"/>
<location filename="../src/elevationgraph.cpp" line="63"/>
<source>Minimum</source>
<translation>Minimum</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="144"/>
<location filename="../src/elevationgraph.cpp" line="125"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraph.cpp" line="62"/>
<location filename="../src/elevationgraph.cpp" line="61"/>
<source>Maximum</source>
<translation>Maximum</translation>
</message>
</context>
<context>
<name>ElevationGraphItem</name>
<message>
<location filename="../src/elevationgraphitem.cpp" line="26"/>
<source>m</source>
<translation>m</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="26"/>
<source>ft</source>
<translation>ft</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="28"/>
<source>Ascent</source>
<translation>Stigning</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="30"/>
<source>Descent</source>
<translation>Nedstigning</translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="32"/>
<source>Maximum</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/elevationgraphitem.cpp" line="34"/>
<source>Minimum</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ExportDialog</name>
<message>
@ -724,12 +776,12 @@
</message>
<message>
<location filename="../src/graphview.cpp" line="60"/>
<location filename="../src/graphview.cpp" line="157"/>
<location filename="../src/graphview.cpp" line="161"/>
<source>Distance</source>
<translation>Avstånd</translation>
</message>
<message>
<location filename="../src/graphview.cpp" line="159"/>
<location filename="../src/graphview.cpp" line="163"/>
<source>Time</source>
<translation>Tid</translation>
</message>
@ -758,6 +810,25 @@
<translation>Max</translation>
</message>
</context>
<context>
<name>HeartRateGraphItem</name>
<message>
<location filename="../src/heartrategraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/heartrategraphitem.cpp" line="21"/>
<location filename="../src/heartrategraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/heartrategraphitem.cpp" line="22"/>
<source>Average</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MapList</name>
<message>
@ -1151,6 +1222,25 @@
<translation>Max</translation>
</message>
</context>
<context>
<name>PowerGraphItem</name>
<message>
<location filename="../src/powergraphitem.cpp" line="20"/>
<source>Maximum</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/powergraphitem.cpp" line="21"/>
<location filename="../src/powergraphitem.cpp" line="23"/>
<source>1/min</source>
<translation>1/min</translation>
</message>
<message>
<location filename="../src/powergraphitem.cpp" line="22"/>
<source>Average</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RouteItem</name>
<message>
@ -1195,32 +1285,60 @@
<context>
<name>SpeedGraph</name>
<message>
<location filename="../src/speedgraph.cpp" line="13"/>
<location filename="../src/speedgraph.cpp" line="14"/>
<location filename="../src/speedgraph.h" line="14"/>
<source>Speed</source>
<translation>Hastighet</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="79"/>
<location filename="../src/speedgraph.cpp" line="81"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="21"/>
<location filename="../src/speedgraph.cpp" line="22"/>
<source>Average</source>
<translation>Medel</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="23"/>
<location filename="../src/speedgraph.cpp" line="24"/>
<source>Maximum</source>
<translation>Max</translation>
</message>
<message>
<location filename="../src/speedgraph.cpp" line="82"/>
<location filename="../src/speedgraph.cpp" line="84"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>
</context>
<context>
<name>SpeedGraphItem</name>
<message>
<location filename="../src/speedgraphitem.cpp" line="17"/>
<source>km/h</source>
<translation>km/h</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="17"/>
<source>mi/h</source>
<translation>mi/h</translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="19"/>
<source>Maximum</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="21"/>
<source>Average</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/speedgraphitem.cpp" line="23"/>
<source>Moving average</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TemperatureGraph</name>
<message>
@ -1245,16 +1363,44 @@
<translation>Max</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="81"/>
<location filename="../src/temperaturegraph.cpp" line="76"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraph.cpp" line="85"/>
<location filename="../src/temperaturegraph.cpp" line="80"/>
<source>F</source>
<translation>F</translation>
</message>
</context>
<context>
<name>TemperatureGraphItem</name>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="22"/>
<source>C</source>
<translation>C</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="22"/>
<source>F</source>
<translation>F</translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="24"/>
<source>Average</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="26"/>
<source>Maximum</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/temperaturegraphitem.cpp" line="28"/>
<source>Minimum</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TrackItem</name>
<message>

View File

@ -1,10 +1,10 @@
#include "data.h"
#include "cadencegraphitem.h"
#include "cadencegraph.h"
CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;
_showTracks = true;
GraphView::setYUnits(tr("1/min"));
@ -28,21 +28,16 @@ void CadenceGraph::loadData(const Data &data, const QList<PathItem *> &paths)
{
for (int i = 0; i < data.tracks().count(); i++) {
const Graph &graph = data.tracks().at(i)->cadence();
qreal sum = 0, w = 0;
if (graph.size() < 2) {
skipColor();
continue;
}
for (int j = 1; j < graph.size(); j++) {
qreal ds = graph.at(j).s() - graph.at(j-1).s();
sum += graph.at(j).y() * ds;
w += ds;
}
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
CadenceGraphItem *gi = new CadenceGraphItem(graph);
GraphView::addGraph(gi, paths.at(i));
GraphView::loadGraph(graph, paths.at(i));
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
}
for (int i = 0; i < data.routes().count(); i++)

View File

@ -23,7 +23,6 @@ private:
QList<QPointF> _avg;
enum Units _units;
bool _showTracks;
};

26
src/cadencegraphitem.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "tooltip.h"
#include "cadencegraphitem.h"
CadenceGraphItem::CadenceGraphItem(const Graph &graph, QGraphicsItem *parent)
: GraphItem(graph, parent)
{
qreal sum = 0;
for (int j = 1; j < graph.size(); j++)
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
_avg = sum/graph.last().s();
setToolTip(toolTip());
}
QString CadenceGraphItem::toolTip() const
{
ToolTip tt;
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1)
+ UNIT_SPACE + tr("1/min"));
tt.insert(tr("Average"), QString::number(avg(), 'f', 1)
+ UNIT_SPACE + tr("1/min"));
return tt.toString();
}

20
src/cadencegraphitem.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef CADENCEGRAPHITEM_H
#define CADENCEGRAPHITEM_H
#include "graphitem.h"
class CadenceGraphItem : public GraphItem
{
public:
CadenceGraphItem(const Graph &graph, QGraphicsItem *parent = 0);
qreal max() const {return -bounds().top();}
qreal avg() const {return _avg;}
private:
QString toolTip() const;
qreal _avg;
};
#endif // CADENCEGRAPHITEM_H

View File

@ -1,6 +1,8 @@
#include <cmath>
#include "config.h"
#include "data.h"
#include "tooltip.h"
#include "elevationgraphitem.h"
#include "elevationgraph.h"
@ -42,11 +44,8 @@ ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
_showRoutes = true;
_showTracks = true;
_units = Metric;
setYUnits();
setYLabel(tr("Elevation"));
setMinYRange(50.0);
}
@ -68,43 +67,25 @@ void ElevationGraph::setInfo()
void ElevationGraph::loadGraph(const Graph &graph, Type type, PathItem *path)
{
qreal ascent = 0, descent = 0;
qreal min, max;
if (graph.size() < 2) {
skipColor();
return;
}
max = min = graph.at(0).y();
for (int j = 1; j < graph.size(); j++) {
qreal cur = graph.at(j).y();
qreal prev = graph.at(j-1).y();
if (cur > prev)
ascent += cur - prev;
if (cur < prev)
descent += prev - cur;
if (cur < min)
min = cur;
if (cur > max)
max = cur;
}
ElevationGraphItem *gi = new ElevationGraphItem(graph);
GraphView::addGraph(gi, path, type);
if (type == Track) {
_trackAscent += ascent;
_trackDescent += descent;
_trackMax = nMax(_trackMax, max);
_trackMin = nMin(_trackMin, min);
_trackAscent += gi->ascent();
_trackDescent += gi->descent();
_trackMax = nMax(_trackMax, gi->max());
_trackMin = nMin(_trackMin, gi->min());
} else {
_routeAscent += ascent;
_routeDescent += descent;
_routeMax = nMax(_routeMax, max);
_routeMin = nMin(_routeMin, min);
_routeAscent += gi->ascent();
_routeDescent += gi->descent();
_routeMax = nMax(_routeMax, gi->max());
_routeMin = nMin(_routeMin, gi->min());
}
GraphView::loadGraph(graph, path, type);
}
void ElevationGraph::loadData(const Data &data, const QList<PathItem *> &paths)
@ -148,11 +129,10 @@ void ElevationGraph::setYUnits()
void ElevationGraph::setUnits(enum Units units)
{
_units = units;
GraphView::setUnits(units);
setYUnits();
setInfo();
GraphView::setUnits(units);
redraw();
}

View File

@ -35,7 +35,6 @@ private:
qreal _trackMax, _routeMax;
qreal _trackMin, _routeMin;
enum Units _units;
bool _showTracks, _showRoutes;
};

View File

@ -0,0 +1,43 @@
#include "tooltip.h"
#include "elevationgraphitem.h"
ElevationGraphItem::ElevationGraphItem(const Graph &graph, QGraphicsItem *parent)
: GraphItem(graph, parent)
{
_ascent = _descent = 0;
for (int j = 1; j < graph.size(); j++) {
qreal cur = graph.at(j).y();
qreal prev = graph.at(j-1).y();
if (cur > prev)
_ascent += cur - prev;
if (cur < prev)
_descent += prev - cur;
}
setToolTip(toolTip(Metric));
}
QString ElevationGraphItem::toolTip(Units units) const
{
ToolTip tt;
qreal scale = (units == Metric) ? 1.0 : M2FT;
QString su = (units == Metric) ? tr("m") : tr("ft");
tt.insert(tr("Ascent"), QString::number(ascent() * scale, 'f', 0)
+ UNIT_SPACE + su);
tt.insert(tr("Descent"), QString::number(descent() * scale, 'f', 0)
+ UNIT_SPACE + su);
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 0)
+ UNIT_SPACE + su);
tt.insert(tr("Minimum"), QString::number(min() * scale, 'f', 0)
+ UNIT_SPACE + su);
return tt.toString();
}
void ElevationGraphItem::setUnits(Units units)
{
setToolTip(toolTip(units));
}

24
src/elevationgraphitem.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef ELEVATIONGRAPHITEM_H
#define ELEVATIONGRAPHITEM_H
#include "graphitem.h"
class ElevationGraphItem : public GraphItem
{
public:
ElevationGraphItem(const Graph &graph, QGraphicsItem *parent = 0);
qreal ascent() const {return _ascent;}
qreal descent() const {return _descent;}
qreal min() const {return -bounds().bottom();}
qreal max() const {return -bounds().top();}
void setUnits(Units units);
private:
QString toolTip(Units units) const;
qreal _ascent, _descent;
};
#endif // ELEVATIONGRAPHITEM_H

View File

@ -25,7 +25,17 @@ GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
setZValue(1.0);
updatePath();
updateShape();
updateBounds();
setAcceptHoverEvents(true);
}
void GraphItem::updateShape()
{
QPainterPathStroker s;
s.setWidth(_width + 1);
_shape = s.createStroke(_path);
}
void GraphItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
@ -50,6 +60,7 @@ void GraphItem::setGraphType(GraphType type)
_type = type;
updatePath();
updateShape();
updateBounds();
}
@ -65,6 +76,8 @@ void GraphItem::setWidth(int width)
_width = width;
_pen.setWidth(width);
updateShape();
}
qreal GraphItem::yAtX(qreal x)
@ -143,9 +156,9 @@ void GraphItem::emitSliderPositionChanged(qreal pos)
emit sliderPositionChanged(pos);
}
void GraphItem::selected(bool selected)
void GraphItem::hover(bool hover)
{
if (selected) {
if (hover) {
_pen.setWidth(_width + 1);
setZValue(zValue() + 1.0);
} else {
@ -165,6 +178,7 @@ void GraphItem::setScale(qreal sx, qreal sy)
_sx = sx; _sy = sy;
updatePath();
updateShape();
}
void GraphItem::updatePath()
@ -199,3 +213,25 @@ void GraphItem::updateBounds()
_bounds = QRectF(QPointF(left, top), QPointF(right, bottom));
}
void GraphItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
_pen.setWidthF(_width + 1);
setZValue(zValue() + 1.0);
update();
emit selected(true);
}
void GraphItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);
_pen.setWidthF(_width);
setZValue(zValue() - 1.0);
update();
emit selected(false);
}

View File

@ -3,6 +3,7 @@
#include <QGraphicsObject>
#include <QPen>
#include "units.h"
#include "graph.h"
class GraphItem : public QGraphicsObject
@ -12,8 +13,8 @@ class GraphItem : public QGraphicsObject
public:
GraphItem(const Graph &graph, QGraphicsItem *parent = 0);
QRectF boundingRect() const
{return _path.boundingRect();}
QPainterPath shape() const {return _shape;}
QRectF boundingRect() const {return _shape.boundingRect();}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
@ -29,15 +30,22 @@ public:
qreal yAtX(qreal x);
qreal distanceAtTime(qreal time);
virtual void setUnits(Units units) {Q_UNUSED(units);}
signals:
void sliderPositionChanged(qreal);
void selected(bool);
public slots:
void emitSliderPositionChanged(qreal);
void selected(bool selected);
void hover(bool hover);
private:
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
void updatePath();
void updateShape();
void updateBounds();
int _id;
@ -48,6 +56,7 @@ private:
GraphType _type;
QPainterPath _path;
QPainterPath _shape;
QRectF _bounds;
qreal _sx, _sy;

View File

@ -139,6 +139,10 @@ void GraphView::setXUnits()
void GraphView::setUnits(Units units)
{
_units = units;
for (int i = 0; i < _graphs.count(); i++)
_graphs.at(i)->setUnits(units);
setXUnits();
}
@ -167,29 +171,27 @@ void GraphView::showGrid(bool show)
_grid->setVisible(show);
}
void GraphView::loadGraph(const Graph &graph, PathItem *path, int id)
void GraphView::addGraph(GraphItem *graph, PathItem *path, int id)
{
if (graph.size() < 2)
return;
graph->setUnits(_units);
graph->setGraphType(_graphType);
graph->setId(id);
graph->setColor(_palette.nextColor());
graph->setWidth(_width);
GraphItem *gi = new GraphItem(graph);
gi->setGraphType(_graphType);
gi->setId(id);
gi->setColor(_palette.nextColor());
gi->setWidth(_width);
connect(this, SIGNAL(sliderPositionChanged(qreal)), gi,
connect(this, SIGNAL(sliderPositionChanged(qreal)), graph,
SLOT(emitSliderPositionChanged(qreal)));
connect(gi, SIGNAL(sliderPositionChanged(qreal)), path,
connect(graph, SIGNAL(sliderPositionChanged(qreal)), path,
SLOT(moveMarker(qreal)));
connect(path, SIGNAL(selected(bool)), gi, SLOT(selected(bool)));
connect(path, SIGNAL(selected(bool)), graph, SLOT(hover(bool)));
connect(graph, SIGNAL(selected(bool)), path, SLOT(hover(bool)));
_graphs.append(gi);
_graphs.append(graph);
if (!_hide.contains(id)) {
_visible.append(gi);
_scene->addItem(gi);
_bounds |= gi->bounds();
_visible.append(graph);
_scene->addItem(graph);
_bounds |= graph->bounds();
setXUnits();
}
}

View File

@ -4,9 +4,9 @@
#include <QGraphicsView>
#include <QList>
#include <QSet>
#include "graph.h"
#include "palette.h"
#include "units.h"
#include "graph.h"
class AxisItem;
@ -25,7 +25,7 @@ public:
GraphView(QWidget *parent = 0);
~GraphView();
void loadGraph(const Graph &graph, PathItem *path, int id = 0);
void addGraph(GraphItem *graph, PathItem *path, int id = 0);
int count() const {return _graphs.count();}
void redraw();
void clear();
@ -68,6 +68,9 @@ protected:
void clearInfo();
void skipColor() {_palette.nextColor();}
Units _units;
GraphType _graphType;
private slots:
void emitSliderPositionChanged(const QPointF &pos);
void newSliderPosition(const QPointF &pos);
@ -106,9 +109,6 @@ private:
QRectF _bounds;
Palette _palette;
int _width;
Units _units;
GraphType _graphType;
};
#endif // GRAPHVIEW_H

View File

@ -1,10 +1,10 @@
#include "data.h"
#include "heartrategraphitem.h"
#include "heartrategraph.h"
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;
_showTracks = true;
GraphView::setYUnits(tr("1/min"));
@ -28,21 +28,16 @@ void HeartRateGraph::loadData(const Data &data, const QList<PathItem *> &paths)
{
for (int i = 0; i < data.tracks().count(); i++) {
const Graph &graph = data.tracks().at(i)->heartRate();
qreal sum = 0, w = 0;
if (graph.size() < 2) {
skipColor();
continue;
}
for (int j = 1; j < graph.size(); j++) {
qreal ds = graph.at(j).s() - graph.at(j-1).s();
sum += graph.at(j).y() * ds;
w += ds;
}
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
HeartRateGraphItem *gi = new HeartRateGraphItem(graph);
GraphView::addGraph(gi, paths.at(i));
GraphView::loadGraph(graph, paths.at(i));
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
}
for (int i = 0; i < data.routes().count(); i++)

View File

@ -22,7 +22,6 @@ private:
QList<QPointF> _avg;
enum Units _units;
bool _showTracks;
};

View File

@ -0,0 +1,26 @@
#include "tooltip.h"
#include "heartrategraphitem.h"
HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, QGraphicsItem *parent)
: GraphItem(graph, parent)
{
qreal sum = 0;
for (int j = 1; j < graph.size(); j++)
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
_avg = sum/graph.last().s();
setToolTip(toolTip());
}
QString HeartRateGraphItem::toolTip() const
{
ToolTip tt;
tt.insert(tr("Maximum"), QString::number(max(), 'f', 0)
+ UNIT_SPACE + tr("1/min"));
tt.insert(tr("Average"), QString::number(avg(), 'f', 0)
+ UNIT_SPACE + tr("1/min"));
return tt.toString();
}

20
src/heartrategraphitem.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef HEARTRATEGRAPHITEM_H
#define HEARTRATEGRAPHITEM_H
#include "graphitem.h"
class HeartRateGraphItem : public GraphItem
{
public:
HeartRateGraphItem(const Graph &graph, QGraphicsItem *parent = 0);
qreal max() const {return -bounds().top();}
qreal avg() const {return _avg;}
private:
QString toolTip() const;
qreal _avg;
};
#endif // HEARTRATEGRAPHITEM_H

View File

@ -154,6 +154,19 @@ void PathItem::moveMarker(qreal distance)
_marker->setVisible(false);
}
void PathItem::hover(bool hover)
{
if (hover) {
_pen.setWidth(_width + 1);
setZValue(zValue() + 1.0);
} else {
_pen.setWidth(_width);
setZValue(zValue() - 1.0);
}
update();
}
void PathItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
{
Q_UNUSED(event);

View File

@ -32,6 +32,7 @@ public:
public slots:
void moveMarker(qreal distance);
void hover(bool hover);
signals:
void selected(bool);

View File

@ -1,10 +1,10 @@
#include "data.h"
#include "powergraphitem.h"
#include "powergraph.h"
PowerGraph::PowerGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;
_showTracks = true;
GraphView::setYUnits(tr("W"));
@ -28,21 +28,16 @@ void PowerGraph::loadData(const Data &data, const QList<PathItem *> &paths)
{
for (int i = 0; i < data.tracks().count(); i++) {
const Graph &graph = data.tracks().at(i)->power();
qreal sum = 0, w = 0;
if (graph.size() < 2) {
skipColor();
continue;
}
for (int j = 1; j < graph.size(); j++) {
qreal ds = graph.at(j).s() - graph.at(j-1).s();
sum += graph.at(j).y() * ds;
w += ds;
}
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
PowerGraphItem *gi = new PowerGraphItem(graph);
GraphView::addGraph(gi, paths.at(i));
GraphView::loadGraph(graph, paths.at(i));
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
}
for (int i = 0; i < data.routes().count(); i++)

View File

@ -22,7 +22,6 @@ private:
QList<QPointF> _avg;
enum Units _units;
bool _showTracks;
};

26
src/powergraphitem.cpp Normal file
View File

@ -0,0 +1,26 @@
#include "tooltip.h"
#include "powergraphitem.h"
PowerGraphItem::PowerGraphItem(const Graph &graph, QGraphicsItem *parent)
: GraphItem(graph, parent)
{
qreal sum = 0;
for (int j = 1; j < graph.size(); j++)
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
_avg = sum/graph.last().s();
setToolTip(toolTip());
}
QString PowerGraphItem::toolTip() const
{
ToolTip tt;
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1)
+ UNIT_SPACE + tr("1/min"));
tt.insert(tr("Average"), QString::number(avg(), 'f', 1)
+ UNIT_SPACE + tr("1/min"));
return tt.toString();
}

20
src/powergraphitem.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef POWERGRAPHITEM_H
#define POWERGRAPHITEM_H
#include "graphitem.h"
class PowerGraphItem : public GraphItem
{
public:
PowerGraphItem(const Graph &graph, QGraphicsItem *parent = 0);
qreal max() const {return -bounds().top();}
qreal avg() const {return _avg;}
private:
QString toolTip() const;
qreal _avg;
};
#endif // POWERGRAPHITEM_H

View File

@ -7,7 +7,7 @@
#include "routeitem.h"
QString RouteItem::toolTip(Units units)
QString RouteItem::toolTip(Units units) const
{
ToolTip tt;

View File

@ -14,7 +14,6 @@ class RouteItem : public PathItem
public:
RouteItem(const Route &route, Map *map, QGraphicsItem *parent = 0);
//void setScale(qreal scale);
void setMap(Map *map);
void setUnits(Units units);
@ -22,7 +21,7 @@ public:
void showWaypointLabels(bool show);
private:
QString toolTip(Units units);
QString toolTip(Units units) const;
QString _name;
QString _desc;

View File

@ -1,11 +1,12 @@
#include "config.h"
#include "data.h"
#include "tooltip.h"
#include "speedgraphitem.h"
#include "speedgraph.h"
SpeedGraph::SpeedGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;
_timeType = Total;
_showTracks = true;
@ -29,18 +30,19 @@ void SpeedGraph::setInfo()
void SpeedGraph::loadData(const Data &data, const QList<PathItem *> &paths)
{
for (int i = 0; i < data.tracks().count(); i++) {
const Graph &graph = data.tracks().at(i)->speed();
const Track *track = data.tracks().at(i);
const Graph &graph = track->speed();
if (graph.size() < 2) {
skipColor();
continue;
}
_avg.append(QPointF(data.tracks().at(i)->distance(),
data.tracks().at(i)->distance() / data.tracks().at(i)->time()));
_avgM.append(QPointF(data.tracks().at(i)->distance(),
data.tracks().at(i)->distance() / data.tracks().at(i)->movingTime()));
SpeedGraphItem *gi = new SpeedGraphItem(graph, track->movingTime());
GraphView::addGraph(gi, paths.at(i));
GraphView::loadGraph(graph, paths.at(i));
_avg.append(QPointF(track->distance(), gi->avg()));
_mavg.append(QPointF(track->distance(), gi->mavg()));
}
for (int i = 0; i < data.routes().count(); i++)
@ -55,7 +57,7 @@ qreal SpeedGraph::avg() const
{
qreal sum = 0, w = 0;
QList<QPointF>::const_iterator it;
const QList<QPointF> &list = (_timeType == Moving) ? _avgM : _avg;
const QList<QPointF> &list = (_timeType == Moving) ? _mavg : _avg;
for (it = list.begin(); it != list.end(); it++) {
sum += it->y() * it->x();
@ -68,7 +70,7 @@ qreal SpeedGraph::avg() const
void SpeedGraph::clear()
{
_avg.clear();
_avgM.clear();
_mavg.clear();
GraphView::clear();
}
@ -86,11 +88,10 @@ void SpeedGraph::setYUnits()
void SpeedGraph::setUnits(enum Units units)
{
_units = units;
GraphView::setUnits(units);
setYUnits();
setInfo();
GraphView::setUnits(units);
redraw();
}

View File

@ -14,8 +14,8 @@ public:
QString label() const {return tr("Speed");}
void loadData(const Data &data, const QList<PathItem *> &paths);
void clear();
void setUnits(enum Units units);
void setTimeType(enum TimeType type);
void setUnits(Units units);
void setTimeType(TimeType type);
void showTracks(bool show);
private:
@ -25,9 +25,8 @@ private:
void setInfo();
QList<QPointF> _avg;
QList<QPointF> _avgM;
QList<QPointF> _mavg;
enum Units _units;
enum TimeType _timeType;
bool _showTracks;
};

32
src/speedgraphitem.cpp Normal file
View File

@ -0,0 +1,32 @@
#include "tooltip.h"
#include "speedgraphitem.h"
SpeedGraphItem::SpeedGraphItem(const Graph &graph, qreal movingTime,
QGraphicsItem *parent) : GraphItem(graph, parent)
{
_avg = graph.last().s() / graph.last().t();
_mavg = graph.last().s() / movingTime;
setToolTip(toolTip(Metric));
}
QString SpeedGraphItem::toolTip(Units units) const
{
ToolTip tt;
qreal scale = (units == Metric) ? MS2KMH : MS2MIH;
QString su = (units == Metric) ? tr("km/h") : tr("mi/h");
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 1)
+ UNIT_SPACE + su);
tt.insert(tr("Average"), QString::number(avg() * scale, 'f', 1)
+ UNIT_SPACE + su);
tt.insert(tr("Moving average"), QString::number(mavg() * scale, 'f', 1)
+ UNIT_SPACE + su);
return tt.toString();
}
void SpeedGraphItem::setUnits(Units units)
{
setToolTip(toolTip(units));
}

24
src/speedgraphitem.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef SPEEDGRAPHITEM_H
#define SPEEDGRAPHITEM_H
#include "graphitem.h"
class SpeedGraphItem : public GraphItem
{
public:
SpeedGraphItem(const Graph &graph, qreal movingTime,
QGraphicsItem *parent = 0);
qreal max() const {return -bounds().top();}
qreal avg() const {return _avg;}
qreal mavg() const {return _mavg;}
void setUnits(Units units);
private:
QString toolTip(Units units) const;
qreal _avg, _mavg;
};
#endif // SPEEDGRAPHITEM_H

View File

@ -1,10 +1,10 @@
#include "data.h"
#include "temperaturegraphitem.h"
#include "temperaturegraph.h"
TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;
_showTracks = true;
setYUnits();
@ -30,21 +30,16 @@ void TemperatureGraph::loadData(const Data &data, const QList<PathItem *> &paths
{
for (int i = 0; i < data.tracks().count(); i++) {
const Graph &graph = data.tracks().at(i)->temperature();
qreal sum = 0, w = 0;
if (graph.size() < 2) {
skipColor();
continue;
}
for (int j = 1; j < graph.size(); j++) {
qreal ds = graph.at(j).s() - graph.at(j-1).s();
sum += graph.at(j).y() * ds;
w += ds;
}
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
TemperatureGraphItem *gi = new TemperatureGraphItem(graph);
GraphView::addGraph(gi, paths.at(i));
GraphView::loadGraph(graph, paths.at(i));
_avg.append(QPointF(data.tracks().at(i)->distance(), gi->avg()));
}
for (int i = 0; i < data.routes().count(); i++)
@ -90,11 +85,10 @@ void TemperatureGraph::setYUnits()
void TemperatureGraph::setUnits(enum Units units)
{
_units = units;
GraphView::setUnits(units);
setYUnits();
setInfo();
GraphView::setUnits(units);
redraw();
}

View File

@ -25,7 +25,6 @@ private:
QList<QPointF> _avg;
enum Units _units;
bool _showTracks;
};

View File

@ -0,0 +1,37 @@
#include "tooltip.h"
#include "temperaturegraphitem.h"
TemperatureGraphItem::TemperatureGraphItem(const Graph &graph,
QGraphicsItem *parent) : GraphItem(graph, parent)
{
qreal sum = 0;
for (int j = 1; j < graph.size(); j++)
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
_avg = sum/graph.last().s();
setToolTip(toolTip(Metric));
}
QString TemperatureGraphItem::toolTip(Units units) const
{
ToolTip tt;
qreal scale = (units == Metric) ? 1.0 : C2FS;
qreal offset = (units == Metric) ? 0 : C2FO;
QString su = (units == Metric) ?
QChar(0x00B0) + tr("C") : QChar(0x00B0) + tr("F");
tt.insert(tr("Average"), QString::number(avg() * scale + offset, 'f', 1)
+ UNIT_SPACE + su);
tt.insert(tr("Maximum"), QString::number(max() * scale + offset, 'f', 1)
+ UNIT_SPACE + su);
tt.insert(tr("Minimum"), QString::number(min() * scale + offset, 'f', 1)
+ UNIT_SPACE + su);
return tt.toString();
}
void TemperatureGraphItem::setUnits(Units units)
{
setToolTip(toolTip(units));
}

View File

@ -0,0 +1,23 @@
#ifndef TEMPERATUREGRAPHITEM_H
#define TEMPERATUREGRAPHITEM_H
#include "graphitem.h"
class TemperatureGraphItem : public GraphItem
{
public:
TemperatureGraphItem(const Graph &graph, QGraphicsItem *parent = 0);
qreal max() const {return -bounds().top();}
qreal min() const {return -bounds().bottom();}
qreal avg() const {return _avg;}
void setUnits(Units units);
private:
QString toolTip(Units units) const;
qreal _avg;
};
#endif // TEMPERATUREGRAPHITEM_H

View File

@ -5,7 +5,7 @@
#include "trackitem.h"
QString TrackItem::toolTip(Units units)
QString TrackItem::toolTip(Units units) const
{
ToolTip tt;

View File

@ -19,7 +19,7 @@ public:
void setUnits(Units units);
private:
QString toolTip(Units units);
QString toolTip(Units units) const;
QString _name;
QString _desc;