mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 11:45:53 +01:00
Added support for GPX routes
This commit is contained in:
parent
5912506292
commit
dad85e46a7
@ -47,7 +47,9 @@ HEADERS += src/config.h \
|
|||||||
src/graphtab.h \
|
src/graphtab.h \
|
||||||
src/misc.h \
|
src/misc.h \
|
||||||
src/trackitem.h \
|
src/trackitem.h \
|
||||||
src/tooltip.h
|
src/tooltip.h \
|
||||||
|
src/route.h \
|
||||||
|
src/routeitem.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/gui.cpp \
|
src/gui.cpp \
|
||||||
src/gpx.cpp \
|
src/gpx.cpp \
|
||||||
@ -82,7 +84,9 @@ SOURCES += src/main.cpp \
|
|||||||
src/misc.cpp \
|
src/misc.cpp \
|
||||||
src/waypoint.cpp \
|
src/waypoint.cpp \
|
||||||
src/trackitem.cpp \
|
src/trackitem.cpp \
|
||||||
src/tooltip.cpp
|
src/tooltip.cpp \
|
||||||
|
src/route.cpp \
|
||||||
|
src/routeitem.cpp
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||||
macx {
|
macx {
|
||||||
|
@ -163,17 +163,17 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GUI</name>
|
<name>GUI</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="446"/>
|
<location filename="../src/gui.cpp" line="477"/>
|
||||||
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
|
<source>GPXSee is distributed under the terms of the GNU General Public License version 3. For more info about GPXSee visit the project homepage at </source>
|
||||||
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
|
<translation>Program GPXSee je distribuován pod podmínkami licence GNU General Public License verze 3. Pro více informací navštivte stránky programu na adrese </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="510"/>
|
<location filename="../src/gui.cpp" line="541"/>
|
||||||
<source>Open file</source>
|
<source>Open file</source>
|
||||||
<translation>Otevřít soubor</translation>
|
<translation>Otevřít soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="586"/>
|
<location filename="../src/gui.cpp" line="617"/>
|
||||||
<source>Open POI file</source>
|
<source>Open POI file</source>
|
||||||
<translation>Otevřít POI soubor</translation>
|
<translation>Otevřít POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -189,8 +189,8 @@
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="186"/>
|
<location filename="../src/gui.cpp" line="186"/>
|
||||||
<location filename="../src/gui.cpp" line="462"/>
|
<location filename="../src/gui.cpp" line="493"/>
|
||||||
<location filename="../src/gui.cpp" line="463"/>
|
<location filename="../src/gui.cpp" line="494"/>
|
||||||
<source>Keyboard controls</source>
|
<source>Keyboard controls</source>
|
||||||
<translation>Ovládací klávesy</translation>
|
<translation>Ovládací klávesy</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -205,20 +205,20 @@
|
|||||||
<translation>Znovu načíst</translation>
|
<translation>Znovu načíst</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="378"/>
|
<location filename="../src/gui.cpp" line="409"/>
|
||||||
<source>Show</source>
|
<source>Show</source>
|
||||||
<translation>Zobrazit</translation>
|
<translation>Zobrazit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="317"/>
|
<location filename="../src/gui.cpp" line="339"/>
|
||||||
<location filename="../src/gui.cpp" line="372"/>
|
<location filename="../src/gui.cpp" line="403"/>
|
||||||
<source>File</source>
|
<source>File</source>
|
||||||
<translation>Soubor</translation>
|
<translation>Soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="184"/>
|
<location filename="../src/gui.cpp" line="184"/>
|
||||||
<location filename="../src/gui.cpp" line="485"/>
|
<location filename="../src/gui.cpp" line="516"/>
|
||||||
<location filename="../src/gui.cpp" line="486"/>
|
<location filename="../src/gui.cpp" line="517"/>
|
||||||
<source>Data sources</source>
|
<source>Data sources</source>
|
||||||
<translation>Zdroje dat</translation>
|
<translation>Zdroje dat</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -238,125 +238,150 @@
|
|||||||
<translation>Překrývat POI</translation>
|
<translation>Překrývat POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="234"/>
|
<location filename="../src/gui.cpp" line="233"/>
|
||||||
|
<source>Show POI labels</source>
|
||||||
|
<translation>Zobrazovat názvy POI</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="238"/>
|
||||||
<source>Show POIs</source>
|
<source>Show POIs</source>
|
||||||
<translation>Zobrazit POI</translation>
|
<translation>Zobrazit POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="242"/>
|
<location filename="../src/gui.cpp" line="246"/>
|
||||||
<source>Show map</source>
|
<source>Show map</source>
|
||||||
<translation>Zobrazit mapu</translation>
|
<translation>Zobrazit mapu</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="248"/>
|
<location filename="../src/gui.cpp" line="252"/>
|
||||||
<source>Clear tile cache</source>
|
<source>Clear tile cache</source>
|
||||||
<translation>Vymazat mezipaměť dlaždic</translation>
|
<translation>Vymazat mezipaměť dlaždic</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="257"/>
|
|
||||||
<location filename="../src/gui.cpp" line="261"/>
|
<location filename="../src/gui.cpp" line="261"/>
|
||||||
<location filename="../src/gui.cpp" line="472"/>
|
<location filename="../src/gui.cpp" line="265"/>
|
||||||
|
<location filename="../src/gui.cpp" line="503"/>
|
||||||
<source>Next map</source>
|
<source>Next map</source>
|
||||||
<translation>Následující mapa</translation>
|
<translation>Následující mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="268"/>
|
<location filename="../src/gui.cpp" line="272"/>
|
||||||
|
<source>Show tracks</source>
|
||||||
|
<translation>Zobrazit cesty</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="276"/>
|
||||||
|
<source>Show routes</source>
|
||||||
|
<translation>Zobrazit trasy</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="280"/>
|
||||||
|
<source>Show waypoints</source>
|
||||||
|
<translation>Zobrazit navigační body</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="290"/>
|
||||||
<source>Show graphs</source>
|
<source>Show graphs</source>
|
||||||
<translation>Zobrazovat grafy</translation>
|
<translation>Zobrazovat grafy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="274"/>
|
<location filename="../src/gui.cpp" line="296"/>
|
||||||
<source>Show toolbars</source>
|
<source>Show toolbars</source>
|
||||||
<translation>Zobrazovat nástrojové lišty</translation>
|
<translation>Zobrazovat nástrojové lišty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="280"/>
|
<location filename="../src/gui.cpp" line="302"/>
|
||||||
<source>Metric</source>
|
<source>Metric</source>
|
||||||
<translation>Metrické</translation>
|
<translation>Metrické</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="285"/>
|
<location filename="../src/gui.cpp" line="307"/>
|
||||||
<source>Imperial</source>
|
<source>Imperial</source>
|
||||||
<translation>Imperiální</translation>
|
<translation>Imperiální</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="291"/>
|
<location filename="../src/gui.cpp" line="313"/>
|
||||||
<source>Fullscreen mode</source>
|
<source>Fullscreen mode</source>
|
||||||
<translation>Celoobrazovkový režim</translation>
|
<translation>Celoobrazovkový režim</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="299"/>
|
<location filename="../src/gui.cpp" line="321"/>
|
||||||
<source>Next</source>
|
<source>Next</source>
|
||||||
<translation>Následující</translation>
|
<translation>Následující</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="302"/>
|
<location filename="../src/gui.cpp" line="324"/>
|
||||||
<source>Previous</source>
|
<source>Previous</source>
|
||||||
<translation>Předchozí</translation>
|
<translation>Předchozí</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="306"/>
|
<location filename="../src/gui.cpp" line="328"/>
|
||||||
<source>Last</source>
|
<source>Last</source>
|
||||||
<translation>Poslední</translation>
|
<translation>Poslední</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="309"/>
|
<location filename="../src/gui.cpp" line="331"/>
|
||||||
<source>First</source>
|
<source>First</source>
|
||||||
<translation>První</translation>
|
<translation>První</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="331"/>
|
<location filename="../src/gui.cpp" line="353"/>
|
||||||
<source>Map</source>
|
<source>Map</source>
|
||||||
<translation>Mapa</translation>
|
<translation>Mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="338"/>
|
<location filename="../src/gui.cpp" line="360"/>
|
||||||
<source>POI</source>
|
<source>POI</source>
|
||||||
<translation>POI</translation>
|
<translation>POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="339"/>
|
<location filename="../src/gui.cpp" line="361"/>
|
||||||
<source>POI files</source>
|
<source>POI files</source>
|
||||||
<translation>POI soubory</translation>
|
<translation>POI soubory</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="349"/>
|
<location filename="../src/gui.cpp" line="372"/>
|
||||||
|
<source>Data</source>
|
||||||
|
<translation>Data</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="380"/>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Nastavení</translation>
|
<translation>Nastavení</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="350"/>
|
<location filename="../src/gui.cpp" line="381"/>
|
||||||
<source>Units</source>
|
<source>Units</source>
|
||||||
<translation>Jednotky</translation>
|
<translation>Jednotky</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="359"/>
|
<location filename="../src/gui.cpp" line="390"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation>Nápověda</translation>
|
<translation>Nápověda</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="474"/>
|
<location filename="../src/gui.cpp" line="505"/>
|
||||||
<source>Previous map</source>
|
<source>Previous map</source>
|
||||||
<translation>Předchozí mapa</translation>
|
<translation>Předchozí mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="672"/>
|
<location filename="../src/gui.cpp" line="703"/>
|
||||||
<location filename="../src/gui.cpp" line="675"/>
|
<location filename="../src/gui.cpp" line="706"/>
|
||||||
<source>Date</source>
|
<source>Date</source>
|
||||||
<translation>Datum</translation>
|
<translation>Datum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="853"/>
|
<location filename="../src/gui.cpp" line="884"/>
|
||||||
<source>No GPX files loaded</source>
|
<source>No GPX files loaded</source>
|
||||||
<translation>Nejsou načteny žádné GPX soubory</translation>
|
<translation>Nejsou načteny žádné GPX soubory</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="465"/>
|
<location filename="../src/gui.cpp" line="496"/>
|
||||||
<source>Next file</source>
|
<source>Next file</source>
|
||||||
<translation>Následující soubor</translation>
|
<translation>Následující soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="442"/>
|
<location filename="../src/gui.cpp" line="473"/>
|
||||||
<source>Version </source>
|
<source>Version </source>
|
||||||
<translation>Verze </translation>
|
<translation>Verze </translation>
|
||||||
</message>
|
</message>
|
||||||
@ -371,123 +396,133 @@
|
|||||||
<translation>Exportovat do PDF...</translation>
|
<translation>Exportovat do PDF...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="466"/>
|
<location filename="../src/gui.cpp" line="284"/>
|
||||||
|
<source>Show waypoint labels</source>
|
||||||
|
<translation>Zobrazovat názvy navigačních bodů</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="377"/>
|
||||||
|
<source>Rendering</source>
|
||||||
|
<translation>Zobrazení</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="497"/>
|
||||||
<source>Previous file</source>
|
<source>Previous file</source>
|
||||||
<translation>Předchozí soubor</translation>
|
<translation>Předchozí soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="468"/>
|
<location filename="../src/gui.cpp" line="499"/>
|
||||||
<source>First file</source>
|
<source>First file</source>
|
||||||
<translation>První soubor</translation>
|
<translation>První soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="469"/>
|
<location filename="../src/gui.cpp" line="500"/>
|
||||||
<source>Last file</source>
|
<source>Last file</source>
|
||||||
<translation>Poslední soubor</translation>
|
<translation>Poslední soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="470"/>
|
<location filename="../src/gui.cpp" line="501"/>
|
||||||
<source>Append modifier</source>
|
<source>Append modifier</source>
|
||||||
<translation>Modifikátor nahradit/přidat</translation>
|
<translation>Modifikátor nahradit/přidat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="489"/>
|
<location filename="../src/gui.cpp" line="520"/>
|
||||||
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
|
<source>Map (tiles) source URLs are read on program startup from the following file:</source>
|
||||||
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
|
<translation>URL mapových zdrojů (dlaždic) jsou načteny při startu programu z následujícího souboru:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="492"/>
|
<location filename="../src/gui.cpp" line="523"/>
|
||||||
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
|
<source>The file format is one map entry per line, consisting of the map name and tiles URL delimited by a TAB character. The tile X and Y coordinates are replaced with $x and $y in the URL and the zoom level is replaced with $z. An example map file could look like:</source>
|
||||||
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
|
<translation>Formát souboru je jeden mapový záznam na řádku, kde mapový záznam sestává ze jména mapy a URL dlaždic navzájem oddělených tabulátorem. Souřadnice dlaždice jsou v URL nahrazeny řetězci $x a $y, úroven přiblížení (zoom) pak řetězcem $z. Příklad:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="500"/>
|
<location filename="../src/gui.cpp" line="531"/>
|
||||||
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
|
<source>To make GPXSee load a POI file automatically on startup, add the file to the following directory:</source>
|
||||||
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
|
<translation>POI soubory, které se mají automaticky nahrát při startu programu jsou načítány z následujícího adresáře:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="511"/>
|
<location filename="../src/gui.cpp" line="542"/>
|
||||||
<source>GPX files (*.gpx);;All files (*)</source>
|
<source>GPX files (*.gpx);;All files (*)</source>
|
||||||
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
|
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="577"/>
|
<location filename="../src/gui.cpp" line="608"/>
|
||||||
<location filename="../src/gui.cpp" line="603"/>
|
<location filename="../src/gui.cpp" line="634"/>
|
||||||
<source>Line: %1</source>
|
<source>Line: %1</source>
|
||||||
<translation>Řádka: %1</translation>
|
<translation>Řádka: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="587"/>
|
<location filename="../src/gui.cpp" line="618"/>
|
||||||
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
|
<source>GPX files (*.gpx);;CSV files (*.csv);;All files (*)</source>
|
||||||
<translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation>
|
<translation>Soubory GPX (*.gpx);;Soubory CSV (*.csv);;Všechny soubory (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="678"/>
|
<location filename="../src/gui.cpp" line="709"/>
|
||||||
<source>Tracks</source>
|
<source>Tracks</source>
|
||||||
<translation>Počet tras</translation>
|
<translation>Počet tras</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="684"/>
|
<location filename="../src/gui.cpp" line="715"/>
|
||||||
<source>mi</source>
|
<source>mi</source>
|
||||||
<translation>mi</translation>
|
<translation>mi</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="189"/>
|
<location filename="../src/gui.cpp" line="189"/>
|
||||||
<location filename="../src/gui.cpp" line="440"/>
|
<location filename="../src/gui.cpp" line="471"/>
|
||||||
<source>About GPXSee</source>
|
<source>About GPXSee</source>
|
||||||
<translation>O aplikaci GPXSee</translation>
|
<translation>O aplikaci GPXSee</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="382"/>
|
<location filename="../src/gui.cpp" line="413"/>
|
||||||
<source>Navigation</source>
|
<source>Navigation</source>
|
||||||
<translation>Navigace</translation>
|
<translation>Navigace</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="488"/>
|
<location filename="../src/gui.cpp" line="519"/>
|
||||||
<source>Map sources</source>
|
<source>Map sources</source>
|
||||||
<translation>Mapové zdroje</translation>
|
<translation>Mapové zdroje</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="499"/>
|
<location filename="../src/gui.cpp" line="530"/>
|
||||||
<source>POIs</source>
|
<source>POIs</source>
|
||||||
<translation>POI body</translation>
|
<translation>POI body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="683"/>
|
<location filename="../src/gui.cpp" line="714"/>
|
||||||
<location filename="../src/gui.cpp" line="686"/>
|
<location filename="../src/gui.cpp" line="717"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="691"/>
|
<location filename="../src/gui.cpp" line="722"/>
|
||||||
<source>Time</source>
|
<source>Time</source>
|
||||||
<translation>Čas</translation>
|
<translation>Čas</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="860"/>
|
<location filename="../src/gui.cpp" line="891"/>
|
||||||
<source>%1 tracks</source>
|
<source>%1 tracks</source>
|
||||||
<translation>Počet tras: %1</translation>
|
<translation>Počet tras: %1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="687"/>
|
<location filename="../src/gui.cpp" line="718"/>
|
||||||
<source>km</source>
|
<source>km</source>
|
||||||
<translation>km</translation>
|
<translation>km</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="579"/>
|
<location filename="../src/gui.cpp" line="610"/>
|
||||||
<location filename="../src/gui.cpp" line="604"/>
|
<location filename="../src/gui.cpp" line="635"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>Chyba</translation>
|
<translation>Chyba</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="574"/>
|
<location filename="../src/gui.cpp" line="605"/>
|
||||||
<source>Error loading GPX file:
|
<source>Error loading GPX file:
|
||||||
%1</source>
|
%1</source>
|
||||||
<translation>Soubor GPX nelze otevřít:
|
<translation>Soubor GPX nelze otevřít:
|
||||||
%1</translation>
|
%1</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="600"/>
|
<location filename="../src/gui.cpp" line="631"/>
|
||||||
<source>Error loading POI file:
|
<source>Error loading POI file:
|
||||||
%1</source>
|
%1</source>
|
||||||
<translation>Soubor POI nelze otevřít:
|
<translation>Soubor POI nelze otevřít:
|
||||||
@ -725,22 +760,27 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>WaypointItem</name>
|
<name>WaypointItem</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/waypointitem.cpp" line="16"/>
|
<location filename="../src/waypointitem.cpp" line="17"/>
|
||||||
|
<source>Name</source>
|
||||||
|
<translation>Název</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/waypointitem.cpp" line="18"/>
|
||||||
<source>Coordinates</source>
|
<source>Coordinates</source>
|
||||||
<translation>Souřadnice</translation>
|
<translation>Souřadnice</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/waypointitem.cpp" line="19"/>
|
<location filename="../src/waypointitem.cpp" line="21"/>
|
||||||
<source>Elevation</source>
|
<source>Elevation</source>
|
||||||
<translation>Výška</translation>
|
<translation>Výška</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/waypointitem.cpp" line="22"/>
|
<location filename="../src/waypointitem.cpp" line="24"/>
|
||||||
<source>Date</source>
|
<source>Date</source>
|
||||||
<translation>Datum</translation>
|
<translation>Datum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/waypointitem.cpp" line="25"/>
|
<location filename="../src/waypointitem.cpp" line="27"/>
|
||||||
<source>Description</source>
|
<source>Description</source>
|
||||||
<translation>Popis</translation>
|
<translation>Popis</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -17,7 +17,7 @@ ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
setMinYRange(50.0);
|
setMinYRange(50.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::addInfo()
|
void ElevationGraph::setInfo()
|
||||||
{
|
{
|
||||||
GraphView::addInfo(tr("Ascent"), QString::number(_ascent * yScale(), 'f', 0)
|
GraphView::addInfo(tr("Ascent"), QString::number(_ascent * yScale(), 'f', 0)
|
||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
@ -27,20 +27,15 @@ void ElevationGraph::addInfo()
|
|||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', 0)
|
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', 0)
|
||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
|
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::loadGPX(const GPX &gpx)
|
void ElevationGraph::loadPath(const QVector<QPointF> &data)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gpx.trackCount(); i++) {
|
|
||||||
QVector<QPointF> data;
|
|
||||||
qreal ascent = 0, descent = 0;
|
qreal ascent = 0, descent = 0;
|
||||||
|
|
||||||
gpx.track(i).elevationGraph(data);
|
|
||||||
if (data.count() < 2) {
|
if (data.count() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 1; j < data.size(); j++) {
|
for (int j = 1; j < data.size(); j++) {
|
||||||
@ -59,8 +54,24 @@ void ElevationGraph::loadGPX(const GPX &gpx)
|
|||||||
loadData(data);
|
loadData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::loadGPX(const GPX &gpx)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < gpx.trackCount(); i++) {
|
||||||
|
QVector<QPointF> data;
|
||||||
|
gpx.track(i).elevationGraph(data);
|
||||||
|
loadPath(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < gpx.routeCount(); i++) {
|
||||||
|
QVector<QPointF> data;
|
||||||
|
gpx.route(i).elevationGraph(data);
|
||||||
|
loadPath(data);
|
||||||
|
}
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
addInfo();
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::clear()
|
void ElevationGraph::clear()
|
||||||
@ -106,9 +117,10 @@ void ElevationGraph::setYUnits()
|
|||||||
void ElevationGraph::setUnits(enum Units units)
|
void ElevationGraph::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
_units = units;
|
_units = units;
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
setYUnits();
|
setYUnits();
|
||||||
|
setInfo();
|
||||||
|
|
||||||
clearInfo();
|
redraw();
|
||||||
addInfo();
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,9 @@ private:
|
|||||||
|
|
||||||
void setXUnits();
|
void setXUnits();
|
||||||
void setYUnits();
|
void setYUnits();
|
||||||
void addInfo();
|
void setInfo();
|
||||||
|
|
||||||
|
void loadPath(const QVector<QPointF> &data);
|
||||||
|
|
||||||
qreal _ascent, _descent;
|
qreal _ascent, _descent;
|
||||||
enum Units _units;
|
enum Units _units;
|
||||||
|
@ -7,18 +7,21 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
#include "route.h"
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
|
|
||||||
class GPX
|
class GPX
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GPX() : _parser(_tracks, _waypoints), _errorLine(0) {}
|
GPX() : _parser(_tracks, _routes, _waypoints), _errorLine(0) {}
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
const QString &errorString() const {return _error;}
|
const QString &errorString() const {return _error;}
|
||||||
int errorLine() const {return _errorLine;}
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
int trackCount() const {return _tracks.count();}
|
int trackCount() const {return _tracks.count();}
|
||||||
Track track(int i) const {return Track(_tracks.at(i));}
|
Track track(int i) const {return Track(_tracks.at(i));}
|
||||||
|
int routeCount() const {return _routes.count();}
|
||||||
|
Route route(int i) const {return Route(_routes.at(i));}
|
||||||
const QList<Waypoint> &waypoints() const {return _waypoints;}
|
const QList<Waypoint> &waypoints() const {return _waypoints;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -27,6 +30,7 @@ private:
|
|||||||
int _errorLine;
|
int _errorLine;
|
||||||
|
|
||||||
QList<QVector<Trackpoint> > _tracks;
|
QList<QVector<Trackpoint> > _tracks;
|
||||||
|
QList<QVector<Waypoint> > _routes;
|
||||||
QList<Waypoint> _waypoints;
|
QList<Waypoint> _waypoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
192
src/gui.cpp
192
src/gui.cpp
@ -44,12 +44,12 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
loadMaps();
|
loadMaps();
|
||||||
loadPOIs();
|
loadPOIs();
|
||||||
|
|
||||||
createActions();
|
|
||||||
createMenus();
|
|
||||||
createToolBars();
|
|
||||||
createTrackView();
|
createTrackView();
|
||||||
createTrackGraphs();
|
createTrackGraphs();
|
||||||
createStatusBar();
|
createStatusBar();
|
||||||
|
createActions();
|
||||||
|
createMenus();
|
||||||
|
createToolBars();
|
||||||
|
|
||||||
_browser = new FileBrowser(this);
|
_browser = new FileBrowser(this);
|
||||||
_browser->setFilter(QStringList("*.gpx"));
|
_browser->setFilter(QStringList("*.gpx"));
|
||||||
@ -189,7 +189,7 @@ void GUI::createActions()
|
|||||||
tr("About GPXSee"), this);
|
tr("About GPXSee"), this);
|
||||||
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
connect(_aboutAction, SIGNAL(triggered()), this, SLOT(about()));
|
||||||
|
|
||||||
// File related actions
|
// File actions
|
||||||
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
_openFileAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
|
||||||
tr("Open"), this);
|
tr("Open"), this);
|
||||||
_openFileAction->setShortcut(OPEN_SHORTCUT);
|
_openFileAction->setShortcut(OPEN_SHORTCUT);
|
||||||
@ -228,8 +228,12 @@ void GUI::createActions()
|
|||||||
connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles()));
|
connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles()));
|
||||||
_overlapPOIAction = new QAction(tr("Overlap POIs"), this);
|
_overlapPOIAction = new QAction(tr("Overlap POIs"), this);
|
||||||
_overlapPOIAction->setCheckable(true);
|
_overlapPOIAction->setCheckable(true);
|
||||||
connect(_overlapPOIAction, SIGNAL(triggered(bool)), this,
|
connect(_overlapPOIAction, SIGNAL(triggered(bool)), _track,
|
||||||
SLOT(overlapPOIs(bool)));
|
SLOT(setPOIOverlap(bool)));
|
||||||
|
_showPOILabelsAction = new QAction(tr("Show POI labels"), this);
|
||||||
|
_showPOILabelsAction->setCheckable(true);
|
||||||
|
connect(_showPOILabelsAction, SIGNAL(triggered(bool)), _track,
|
||||||
|
SLOT(showPOILabels(bool)));
|
||||||
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
|
||||||
tr("Show POIs"), this);
|
tr("Show POIs"), this);
|
||||||
_showPOIAction->setCheckable(true);
|
_showPOIAction->setCheckable(true);
|
||||||
@ -264,6 +268,24 @@ void GUI::createActions()
|
|||||||
addAction(_prevMapAction);
|
addAction(_prevMapAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Data actions
|
||||||
|
_showTracksAction = new QAction(tr("Show tracks"), this);
|
||||||
|
_showTracksAction->setCheckable(true);
|
||||||
|
connect(_showTracksAction, SIGNAL(triggered(bool)), _track,
|
||||||
|
SLOT(showTracks(bool)));
|
||||||
|
_showRoutesAction = new QAction(tr("Show routes"), this);
|
||||||
|
_showRoutesAction->setCheckable(true);
|
||||||
|
connect(_showRoutesAction, SIGNAL(triggered(bool)), _track,
|
||||||
|
SLOT(showRoutes(bool)));
|
||||||
|
_showWaypointsAction = new QAction(tr("Show waypoints"), this);
|
||||||
|
_showWaypointsAction->setCheckable(true);
|
||||||
|
connect(_showWaypointsAction, SIGNAL(triggered(bool)), _track,
|
||||||
|
SLOT(showWaypoints(bool)));
|
||||||
|
_showWaypointLabelsAction = new QAction(tr("Show waypoint labels"), this);
|
||||||
|
_showWaypointLabelsAction->setCheckable(true);
|
||||||
|
connect(_showWaypointLabelsAction, SIGNAL(triggered(bool)), _track,
|
||||||
|
SLOT(showWaypointLabels(bool)));
|
||||||
|
|
||||||
// Settings actions
|
// Settings actions
|
||||||
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
||||||
_showGraphsAction->setCheckable(true);
|
_showGraphsAction->setCheckable(true);
|
||||||
@ -314,53 +336,62 @@ void GUI::createActions()
|
|||||||
|
|
||||||
void GUI::createMenus()
|
void GUI::createMenus()
|
||||||
{
|
{
|
||||||
_fileMenu = menuBar()->addMenu(tr("File"));
|
QMenu *fileMenu = menuBar()->addMenu(tr("File"));
|
||||||
_fileMenu->addAction(_openFileAction);
|
fileMenu->addAction(_openFileAction);
|
||||||
_fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
_fileMenu->addAction(_printFileAction);
|
fileMenu->addAction(_printFileAction);
|
||||||
_fileMenu->addAction(_exportFileAction);
|
fileMenu->addAction(_exportFileAction);
|
||||||
_fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
_fileMenu->addAction(_reloadFileAction);
|
fileMenu->addAction(_reloadFileAction);
|
||||||
_fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
_fileMenu->addAction(_closeFileAction);
|
fileMenu->addAction(_closeFileAction);
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
_fileMenu->addSeparator();
|
fileMenu->addSeparator();
|
||||||
_fileMenu->addAction(_exitAction);
|
fileMenu->addAction(_exitAction);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
_mapMenu = menuBar()->addMenu(tr("Map"));
|
QMenu *mapMenu = menuBar()->addMenu(tr("Map"));
|
||||||
_mapMenu->addActions(_mapActions);
|
mapMenu->addActions(_mapActions);
|
||||||
_mapMenu->addSeparator();
|
mapMenu->addSeparator();
|
||||||
_mapMenu->addAction(_clearMapCacheAction);
|
mapMenu->addAction(_clearMapCacheAction);
|
||||||
_mapMenu->addSeparator();
|
mapMenu->addSeparator();
|
||||||
_mapMenu->addAction(_showMapAction);
|
mapMenu->addAction(_showMapAction);
|
||||||
|
|
||||||
_poiMenu = menuBar()->addMenu(tr("POI"));
|
QMenu *poiMenu = menuBar()->addMenu(tr("POI"));
|
||||||
_poiFilesMenu = _poiMenu->addMenu(tr("POI files"));
|
_poiFilesMenu = poiMenu->addMenu(tr("POI files"));
|
||||||
_poiFilesMenu->addActions(_poiFilesActions);
|
_poiFilesMenu->addActions(_poiFilesActions);
|
||||||
_poiMenu->addSeparator();
|
poiMenu->addSeparator();
|
||||||
_poiMenu->addAction(_openPOIAction);
|
poiMenu->addAction(_openPOIAction);
|
||||||
_poiMenu->addAction(_closePOIAction);
|
poiMenu->addAction(_closePOIAction);
|
||||||
_poiMenu->addSeparator();
|
poiMenu->addSeparator();
|
||||||
_poiMenu->addAction(_overlapPOIAction);
|
poiMenu->addAction(_showPOILabelsAction);
|
||||||
_poiMenu->addSeparator();
|
poiMenu->addAction(_overlapPOIAction);
|
||||||
_poiMenu->addAction(_showPOIAction);
|
poiMenu->addSeparator();
|
||||||
|
poiMenu->addAction(_showPOIAction);
|
||||||
|
|
||||||
_settingsMenu = menuBar()->addMenu(tr("Settings"));
|
QMenu *dataMenu = menuBar()->addMenu(tr("Data"));
|
||||||
_unitsMenu = _settingsMenu->addMenu(tr("Units"));
|
dataMenu->addAction(_showTracksAction);
|
||||||
_unitsMenu->addAction(_metricUnitsAction);
|
dataMenu->addAction(_showRoutesAction);
|
||||||
_unitsMenu->addAction(_imperialUnitsAction);
|
dataMenu->addAction(_showWaypointsAction);
|
||||||
_settingsMenu->addSeparator();
|
dataMenu->addSeparator();
|
||||||
_settingsMenu->addAction(_showToolbarsAction);
|
QMenu *displayMenu = dataMenu->addMenu(tr("Rendering"));
|
||||||
_settingsMenu->addAction(_showGraphsAction);
|
displayMenu->addAction(_showWaypointLabelsAction);
|
||||||
_settingsMenu->addSeparator();
|
|
||||||
_settingsMenu->addAction(_fullscreenAction);
|
|
||||||
|
|
||||||
_helpMenu = menuBar()->addMenu(tr("Help"));
|
QMenu *settingsMenu = menuBar()->addMenu(tr("Settings"));
|
||||||
_helpMenu->addAction(_dataSourcesAction);
|
QMenu *unitsMenu = settingsMenu->addMenu(tr("Units"));
|
||||||
_helpMenu->addAction(_keysAction);
|
unitsMenu->addAction(_metricUnitsAction);
|
||||||
_helpMenu->addSeparator();
|
unitsMenu->addAction(_imperialUnitsAction);
|
||||||
_helpMenu->addAction(_aboutAction);
|
settingsMenu->addSeparator();
|
||||||
|
settingsMenu->addAction(_showToolbarsAction);
|
||||||
|
settingsMenu->addAction(_showGraphsAction);
|
||||||
|
settingsMenu->addSeparator();
|
||||||
|
settingsMenu->addAction(_fullscreenAction);
|
||||||
|
|
||||||
|
QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
|
||||||
|
helpMenu->addAction(_dataSourcesAction);
|
||||||
|
helpMenu->addAction(_keysAction);
|
||||||
|
helpMenu->addSeparator();
|
||||||
|
helpMenu->addAction(_aboutAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createToolBars()
|
void GUI::createToolBars()
|
||||||
@ -706,8 +737,8 @@ void GUI::plot(QPrinter *printer)
|
|||||||
? 0.15 * r * (printer->height() - ih - 2*mh)
|
? 0.15 * r * (printer->height() - ih - 2*mh)
|
||||||
: 0.15 * (printer->height() - ih - 2*mh);
|
: 0.15 * (printer->height() - ih - 2*mh);
|
||||||
gh = qMax(gh, ratio * 150);
|
gh = qMax(gh, ratio * 150);
|
||||||
GraphView *gv = static_cast<GraphView*>(_trackGraphs->currentWidget());
|
GraphTab *gt = static_cast<GraphTab*>(_trackGraphs->currentWidget());
|
||||||
gv->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
|
gt->plot(&p, QRectF(0, printer->height() - gh, printer->width(), gh));
|
||||||
} else
|
} else
|
||||||
gh = 0;
|
gh = 0;
|
||||||
_track->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
|
_track->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
|
||||||
@ -771,11 +802,6 @@ void GUI::closeAll()
|
|||||||
updateTrackView();
|
updateTrackView();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::overlapPOIs(bool checked)
|
|
||||||
{
|
|
||||||
_track->setPOIOverlap(checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GUI::showPOI(bool checked)
|
void GUI::showPOI(bool checked)
|
||||||
{
|
{
|
||||||
if (checked)
|
if (checked)
|
||||||
@ -841,6 +867,11 @@ void GUI::showFullscreen(bool checked)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::showWaypointLabels(bool checked)
|
||||||
|
{
|
||||||
|
_track->showWaypointLabels(checked);
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::clearMapCache()
|
void GUI::clearMapCache()
|
||||||
{
|
{
|
||||||
_currentMap->clearCache();
|
_currentMap->clearCache();
|
||||||
@ -920,8 +951,8 @@ void GUI::graphChanged(int index)
|
|||||||
if (index < 0)
|
if (index < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GraphView *gv = static_cast<GraphView*>(_trackGraphs->widget(index));
|
GraphTab *gt = static_cast<GraphTab*>(_trackGraphs->widget(index));
|
||||||
gv->setSliderPosition(_sliderPos);
|
gt->setSliderPosition(_sliderPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::updateNavigationActions()
|
void GUI::updateNavigationActions()
|
||||||
@ -972,7 +1003,8 @@ void GUI::updateGraphTabs()
|
|||||||
|
|
||||||
void GUI::updateTrackView()
|
void GUI::updateTrackView()
|
||||||
{
|
{
|
||||||
_track->setHidden(!(_track->trackCount() + _track->waypointCount()));
|
_track->setHidden(!(_track->trackCount() + _track->routeCount()
|
||||||
|
+ _track->waypointCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::setMetricUnits()
|
void GUI::setMetricUnits()
|
||||||
@ -1106,6 +1138,16 @@ void GUI::writeSettings()
|
|||||||
}
|
}
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(DATA_SETTINGS_GROUP);
|
||||||
|
settings.setValue(SHOW_TRACKS_SETTING, _showTracksAction->isChecked());
|
||||||
|
settings.setValue(SHOW_ROUTES_SETTING, _showRoutesAction->isChecked());
|
||||||
|
settings.setValue(SHOW_WAYPOINTS_SETTING,
|
||||||
|
_showWaypointsAction->isChecked());
|
||||||
|
settings.setValue(SHOW_WAYPOINT_LABELS_SETTING,
|
||||||
|
_showWaypointLabelsAction->isChecked());
|
||||||
|
|
||||||
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::readSettings()
|
void GUI::readSettings()
|
||||||
@ -1125,15 +1167,13 @@ void GUI::readSettings()
|
|||||||
_imperialUnitsAction->setChecked(true);
|
_imperialUnitsAction->setChecked(true);
|
||||||
} else
|
} else
|
||||||
_metricUnitsAction->setChecked(true);
|
_metricUnitsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false) {
|
if (settings.value(SHOW_TOOLBARS_SETTING, true).toBool() == false)
|
||||||
showToolbars(false);
|
showToolbars(false);
|
||||||
_showToolbarsAction->setChecked(false);
|
else
|
||||||
} else
|
|
||||||
_showToolbarsAction->setChecked(true);
|
_showToolbarsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false) {
|
if (settings.value(SHOW_GRAPHS_SETTING, true).toBool() == false)
|
||||||
showGraphs(false);
|
showGraphs(false);
|
||||||
_showGraphsAction->setChecked(false);
|
else
|
||||||
} else
|
|
||||||
_showGraphsAction->setChecked(true);
|
_showGraphsAction->setChecked(true);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
@ -1151,11 +1191,14 @@ void GUI::readSettings()
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup(POI_SETTINGS_GROUP);
|
settings.beginGroup(POI_SETTINGS_GROUP);
|
||||||
if (settings.value(OVERLAP_POI_SETTING, true).toBool() == false) {
|
if (settings.value(OVERLAP_POI_SETTING, true).toBool() == false)
|
||||||
_track->setPOIOverlap(false);
|
_track->setPOIOverlap(false);
|
||||||
_overlapPOIAction->setChecked(false);
|
else
|
||||||
} else
|
|
||||||
_overlapPOIAction->setChecked(true);
|
_overlapPOIAction->setChecked(true);
|
||||||
|
if (settings.value(LABELS_POI_SETTING, true).toBool() == false)
|
||||||
|
_track->showPOILabels(false);
|
||||||
|
else
|
||||||
|
_showPOILabelsAction->setChecked(true);
|
||||||
if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
|
if (settings.value(SHOW_POI_SETTING, false).toBool() == true)
|
||||||
_showPOIAction->setChecked(true);
|
_showPOIAction->setChecked(true);
|
||||||
for (int i = 0; i < _poiFilesActions.count(); i++)
|
for (int i = 0; i < _poiFilesActions.count(); i++)
|
||||||
@ -1172,6 +1215,25 @@ void GUI::readSettings()
|
|||||||
}
|
}
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.beginGroup(DATA_SETTINGS_GROUP);
|
||||||
|
if (settings.value(SHOW_TRACKS_SETTING, true).toBool() == false)
|
||||||
|
_track->showTracks(false);
|
||||||
|
else
|
||||||
|
_showTracksAction->setChecked(true);
|
||||||
|
if (settings.value(SHOW_ROUTES_SETTING, true).toBool() == false)
|
||||||
|
_track->showRoutes(false);
|
||||||
|
else
|
||||||
|
_showRoutesAction->setChecked(true);
|
||||||
|
if (settings.value(SHOW_WAYPOINTS_SETTING, true).toBool() == false)
|
||||||
|
_track->showWaypoints(false);
|
||||||
|
else
|
||||||
|
_showWaypointsAction->setChecked(true);
|
||||||
|
if (settings.value(SHOW_WAYPOINT_LABELS_SETTING, true).toBool() == false)
|
||||||
|
_track->showWaypointLabels(false);
|
||||||
|
else
|
||||||
|
_showWaypointLabelsAction->setChecked(true);
|
||||||
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
int GUI::mapIndex(const QString &name)
|
int GUI::mapIndex(const QString &name)
|
||||||
|
20
src/gui.h
20
src/gui.h
@ -43,12 +43,12 @@ private slots:
|
|||||||
void reloadFile();
|
void reloadFile();
|
||||||
void openPOIFile();
|
void openPOIFile();
|
||||||
void closePOIFiles();
|
void closePOIFiles();
|
||||||
void overlapPOIs(bool checked);
|
|
||||||
void showPOI(bool checked);
|
void showPOI(bool checked);
|
||||||
void showMap(bool checked);
|
void showMap(bool checked);
|
||||||
void showGraphs(bool checked);
|
void showGraphs(bool checked);
|
||||||
void showToolbars(bool checked);
|
void showToolbars(bool checked);
|
||||||
void showFullscreen(bool checked);
|
void showFullscreen(bool checked);
|
||||||
|
void showWaypointLabels(bool checked);
|
||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
void nextMap();
|
void nextMap();
|
||||||
void prevMap();
|
void prevMap();
|
||||||
@ -101,21 +101,13 @@ private:
|
|||||||
void readSettings();
|
void readSettings();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
|
||||||
QMenu *_fileMenu;
|
|
||||||
QMenu *_helpMenu;
|
|
||||||
QMenu *_poiMenu;
|
|
||||||
QMenu *_mapMenu;
|
|
||||||
QMenu *_settingsMenu;
|
|
||||||
QMenu *_unitsMenu;
|
|
||||||
QMenu *_poiFilesMenu;
|
|
||||||
|
|
||||||
QToolBar *_fileToolBar;
|
QToolBar *_fileToolBar;
|
||||||
QToolBar *_showToolBar;
|
QToolBar *_showToolBar;
|
||||||
QToolBar *_navigationToolBar;
|
QToolBar *_navigationToolBar;
|
||||||
QTabWidget *_trackGraphs;
|
QMenu *_poiFilesMenu;
|
||||||
|
|
||||||
QActionGroup *_fileActionGroup;
|
QActionGroup *_fileActionGroup;
|
||||||
QActionGroup *_navigationActionGroup;
|
QActionGroup *_navigationActionGroup;
|
||||||
|
|
||||||
QAction *_exitAction;
|
QAction *_exitAction;
|
||||||
QAction *_keysAction;
|
QAction *_keysAction;
|
||||||
QAction *_dataSourcesAction;
|
QAction *_dataSourcesAction;
|
||||||
@ -130,6 +122,7 @@ private:
|
|||||||
QAction *_closePOIAction;
|
QAction *_closePOIAction;
|
||||||
QAction *_showPOIAction;
|
QAction *_showPOIAction;
|
||||||
QAction *_overlapPOIAction;
|
QAction *_overlapPOIAction;
|
||||||
|
QAction *_showPOILabelsAction;
|
||||||
QAction *_showMapAction;
|
QAction *_showMapAction;
|
||||||
QAction *_fullscreenAction;
|
QAction *_fullscreenAction;
|
||||||
QAction *_clearMapCacheAction;
|
QAction *_clearMapCacheAction;
|
||||||
@ -143,6 +136,10 @@ private:
|
|||||||
QAction *_imperialUnitsAction;
|
QAction *_imperialUnitsAction;
|
||||||
QAction *_nextMapAction;
|
QAction *_nextMapAction;
|
||||||
QAction *_prevMapAction;
|
QAction *_prevMapAction;
|
||||||
|
QAction *_showTracksAction;
|
||||||
|
QAction *_showRoutesAction;
|
||||||
|
QAction *_showWaypointsAction;
|
||||||
|
QAction *_showWaypointLabelsAction;
|
||||||
QList<QAction*> _mapActions;
|
QList<QAction*> _mapActions;
|
||||||
QList<QAction*> _poiFilesActions;
|
QList<QAction*> _poiFilesActions;
|
||||||
|
|
||||||
@ -153,6 +150,7 @@ private:
|
|||||||
QLabel *_timeLabel;
|
QLabel *_timeLabel;
|
||||||
|
|
||||||
TrackView *_track;
|
TrackView *_track;
|
||||||
|
QTabWidget *_trackGraphs;
|
||||||
QList<GraphTab*> _tabs;
|
QList<GraphTab*> _tabs;
|
||||||
|
|
||||||
POI _poi;
|
POI _poi;
|
||||||
|
@ -13,14 +13,12 @@ HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
setSliderPrecision(0);
|
setSliderPrecision(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::addInfo()
|
void HeartRateGraph::setInfo()
|
||||||
{
|
{
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', 0)
|
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', 0)
|
||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 0)
|
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 0)
|
||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
|
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::loadGPX(const GPX &gpx)
|
void HeartRateGraph::loadGPX(const GPX &gpx)
|
||||||
@ -44,8 +42,13 @@ void HeartRateGraph::loadGPX(const GPX &gpx)
|
|||||||
loadData(data);
|
loadData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < gpx.routeCount(); i++)
|
||||||
|
skipColor();
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
addInfo();
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal HeartRateGraph::avg() const
|
qreal HeartRateGraph::avg() const
|
||||||
@ -92,8 +95,9 @@ void HeartRateGraph::setXUnits()
|
|||||||
void HeartRateGraph::setUnits(enum Units units)
|
void HeartRateGraph::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
_units = units;
|
_units = units;
|
||||||
setXUnits();
|
|
||||||
|
|
||||||
clearInfo();
|
setXUnits();
|
||||||
addInfo();
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ private:
|
|||||||
qreal avg() const;
|
qreal avg() const;
|
||||||
qreal max() const {return bounds().bottom();}
|
qreal max() const {return bounds().bottom();}
|
||||||
void setXUnits();
|
void setXUnits();
|
||||||
void addInfo();
|
void setInfo();
|
||||||
|
|
||||||
QList<QPointF> _avg;
|
QList<QPointF> _avg;
|
||||||
enum Units _units;
|
enum Units _units;
|
||||||
|
@ -52,6 +52,30 @@ void Parser::handleWaypointData(DataType type, const QString &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Parser::handleRoutepointData(DataType type, const QString &value)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case Name:
|
||||||
|
_route->last().setName(value);
|
||||||
|
break;
|
||||||
|
case Description:
|
||||||
|
_route->last().setDescription(value);
|
||||||
|
break;
|
||||||
|
case Time:
|
||||||
|
_route->last().setTimestamp(QDateTime::fromString(
|
||||||
|
value.toLatin1(), Qt::ISODate));
|
||||||
|
break;
|
||||||
|
case Elevation:
|
||||||
|
_route->last().setElevation(value.toLatin1().toDouble());
|
||||||
|
break;
|
||||||
|
case Geoidheight:
|
||||||
|
_route->last().setGeoidHeight(value.toLatin1().toDouble());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Parser::handleTrackpointAttributes(const QXmlStreamAttributes &attr)
|
void Parser::handleTrackpointAttributes(const QXmlStreamAttributes &attr)
|
||||||
{
|
{
|
||||||
_track->last().setCoordinates(QPointF(
|
_track->last().setCoordinates(QPointF(
|
||||||
@ -59,6 +83,13 @@ void Parser::handleTrackpointAttributes(const QXmlStreamAttributes &attr)
|
|||||||
attr.value("lat").toLatin1().toDouble()));
|
attr.value("lat").toLatin1().toDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Parser::handleRoutepointAttributes(const QXmlStreamAttributes &attr)
|
||||||
|
{
|
||||||
|
_route->last().setCoordinates(QPointF(
|
||||||
|
attr.value("lon").toLatin1().toDouble(),
|
||||||
|
attr.value("lat").toLatin1().toDouble()));
|
||||||
|
}
|
||||||
|
|
||||||
void Parser::handleWaypointAttributes(const QXmlStreamAttributes &attr)
|
void Parser::handleWaypointAttributes(const QXmlStreamAttributes &attr)
|
||||||
{
|
{
|
||||||
_waypoints.last().setCoordinates(QPointF(
|
_waypoints.last().setCoordinates(QPointF(
|
||||||
@ -110,6 +141,20 @@ void Parser::trackpointData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Parser::routepointData()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "name")
|
||||||
|
handleRoutepointData(Name, _reader.readElementText());
|
||||||
|
else if (_reader.name() == "ele")
|
||||||
|
handleRoutepointData(Elevation, _reader.readElementText());
|
||||||
|
else if (_reader.name() == "geoidheight")
|
||||||
|
handleRoutepointData(Geoidheight, _reader.readElementText());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Parser::trackpoints()
|
void Parser::trackpoints()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
@ -122,6 +167,18 @@ void Parser::trackpoints()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Parser::routepoints()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "rtept") {
|
||||||
|
_route->append(Waypoint());
|
||||||
|
handleRoutepointAttributes(_reader.attributes());
|
||||||
|
routepointData();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Parser::track()
|
void Parser::track()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
@ -157,6 +214,10 @@ void Parser::gpx()
|
|||||||
_tracks.append(QVector<Trackpoint>());
|
_tracks.append(QVector<Trackpoint>());
|
||||||
_track = &_tracks.back();
|
_track = &_tracks.back();
|
||||||
track();
|
track();
|
||||||
|
} else if (_reader.name() == "rte") {
|
||||||
|
_routes.append(QVector<Waypoint>());
|
||||||
|
_route = &_routes.back();
|
||||||
|
routepoints();
|
||||||
} else if (_reader.name() == "wpt") {
|
} else if (_reader.name() == "wpt") {
|
||||||
_waypoints.append(Waypoint());
|
_waypoints.append(Waypoint());
|
||||||
handleWaypointAttributes(_reader.attributes());
|
handleWaypointAttributes(_reader.attributes());
|
||||||
|
13
src/parser.h
13
src/parser.h
@ -11,8 +11,11 @@
|
|||||||
class Parser
|
class Parser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Parser(QList<QVector<Trackpoint> > &tracks, QList<Waypoint> &waypoints)
|
Parser(QList<QVector<Trackpoint> > &tracks,
|
||||||
: _tracks(tracks), _waypoints(waypoints) {_track = 0;}
|
QList<QVector<Waypoint> > &routes, QList<Waypoint> &waypoints)
|
||||||
|
: _tracks(tracks), _routes(routes), _waypoints(waypoints)
|
||||||
|
{_track = 0; _route = 0;}
|
||||||
|
|
||||||
bool loadFile(QIODevice *device);
|
bool loadFile(QIODevice *device);
|
||||||
QString errorString() const {return _reader.errorString();}
|
QString errorString() const {return _reader.errorString();}
|
||||||
int errorLine() const {return _reader.lineNumber();}
|
int errorLine() const {return _reader.lineNumber();}
|
||||||
@ -27,20 +30,26 @@ private:
|
|||||||
void gpx();
|
void gpx();
|
||||||
void track();
|
void track();
|
||||||
void trackpoints();
|
void trackpoints();
|
||||||
|
void routepoints();
|
||||||
void tpExtension();
|
void tpExtension();
|
||||||
void extensions();
|
void extensions();
|
||||||
void trackpointData();
|
void trackpointData();
|
||||||
|
void routepointData();
|
||||||
void waypointData();
|
void waypointData();
|
||||||
|
|
||||||
void handleWaypointAttributes(const QXmlStreamAttributes &attr);
|
void handleWaypointAttributes(const QXmlStreamAttributes &attr);
|
||||||
void handleWaypointData(DataType type, const QString &value);
|
void handleWaypointData(DataType type, const QString &value);
|
||||||
void handleTrackpointAttributes(const QXmlStreamAttributes &attr);
|
void handleTrackpointAttributes(const QXmlStreamAttributes &attr);
|
||||||
void handleTrackpointData(DataType type, const QString &value);
|
void handleTrackpointData(DataType type, const QString &value);
|
||||||
|
void handleRoutepointAttributes(const QXmlStreamAttributes &attr);
|
||||||
|
void handleRoutepointData(DataType type, const QString &value);
|
||||||
|
|
||||||
QXmlStreamReader _reader;
|
QXmlStreamReader _reader;
|
||||||
QList<QVector<Trackpoint> > &_tracks;
|
QList<QVector<Trackpoint> > &_tracks;
|
||||||
|
QList<QVector<Waypoint> > &_routes;
|
||||||
QList<Waypoint> &_waypoints;
|
QList<Waypoint> &_waypoints;
|
||||||
QVector<Trackpoint> *_track;
|
QVector<Trackpoint> *_track;
|
||||||
|
QVector<Waypoint> *_route;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PARSER_H
|
#endif // PARSER_H
|
||||||
|
25
src/route.cpp
Normal file
25
src/route.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "ll.h"
|
||||||
|
#include "route.h"
|
||||||
|
|
||||||
|
Route::Route(const QVector<Waypoint> &data) : _data(data)
|
||||||
|
{
|
||||||
|
qreal dist = 0;
|
||||||
|
|
||||||
|
_dd.append(dist);
|
||||||
|
for (int i = 1; i < _data.count(); i++) {
|
||||||
|
dist += llDistance(_data.at(i).coordinates(),
|
||||||
|
_data.at(i-1).coordinates());
|
||||||
|
_dd.append(dist);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Route::elevationGraph(QVector<QPointF> &graph) const
|
||||||
|
{
|
||||||
|
if (!_data.size())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < _data.size(); i++)
|
||||||
|
if (_data.at(i).hasElevation())
|
||||||
|
graph.append(QPointF(_dd.at(i), _data.at(i).elevation()
|
||||||
|
- _data.at(i).geoidHeight()));
|
||||||
|
}
|
23
src/route.h
Normal file
23
src/route.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef ROUTE_H
|
||||||
|
#define ROUTE_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include "waypoint.h"
|
||||||
|
|
||||||
|
class Route
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Route(const QVector<Waypoint> &data);
|
||||||
|
|
||||||
|
const QVector<Waypoint> &route() const {return _data;}
|
||||||
|
void elevationGraph(QVector<QPointF> &graph) const;
|
||||||
|
qreal distance() const {return _dd.last();}
|
||||||
|
|
||||||
|
bool isNull() const {return (_data.count() < 2) ? true : false;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const QVector<Waypoint> &_data;
|
||||||
|
QVector<qreal> _dd;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ROUTE_H
|
74
src/routeitem.cpp
Normal file
74
src/routeitem.cpp
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#include <QPainter>
|
||||||
|
#include "ll.h"
|
||||||
|
#include "waypoint.h"
|
||||||
|
#include "waypointitem.h"
|
||||||
|
#include "routeitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define ROUTE_WIDTH 3
|
||||||
|
|
||||||
|
RouteItem::RouteItem(const Route &route, QGraphicsItem *parent)
|
||||||
|
: QGraphicsItem(parent)
|
||||||
|
{
|
||||||
|
WaypointItem *wi;
|
||||||
|
|
||||||
|
const QVector<Waypoint> &r = route.route();
|
||||||
|
Q_ASSERT(r.count() >= 2);
|
||||||
|
|
||||||
|
wi = new WaypointItem(r.at(0));
|
||||||
|
wi->setParentItem(this);
|
||||||
|
const QPointF &p = r.at(0).coordinates();
|
||||||
|
_path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
|
||||||
|
for (int i = 1; i < r.size(); i++) {
|
||||||
|
const QPointF &p = r.at(i).coordinates();
|
||||||
|
_path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
|
||||||
|
wi = new WaypointItem(r.at(i));
|
||||||
|
wi->setParentItem(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
QBrush brush(Qt::SolidPattern);
|
||||||
|
_pen = QPen(brush, ROUTE_WIDTH, Qt::DotLine);
|
||||||
|
|
||||||
|
_marker = new MarkerItem(this);
|
||||||
|
_marker->setPos(_path.pointAtPercent(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void RouteItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget)
|
||||||
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
|
painter->setPen(_pen);
|
||||||
|
painter->drawPath(_path);
|
||||||
|
|
||||||
|
/*
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
painter->drawRect(boundingRect());
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void RouteItem::setScale(qreal scale)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_pen.setWidthF(ROUTE_WIDTH * 1.0/scale);
|
||||||
|
QGraphicsItem::setScale(scale);
|
||||||
|
_marker->setScale(1.0/scale);
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> childs = childItems();
|
||||||
|
for (int i = 0; i < childs.count(); i++)
|
||||||
|
childs.at(i)->setScale(1.0/scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RouteItem::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_pen.setColor(color);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RouteItem::moveMarker(qreal t)
|
||||||
|
{
|
||||||
|
Q_ASSERT(t >= 0 && t <= 1.0);
|
||||||
|
_marker->setPos(_path.pointAtPercent(t));
|
||||||
|
}
|
32
src/routeitem.h
Normal file
32
src/routeitem.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef ROUTEITEM_H
|
||||||
|
#define ROUTEITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
#include "markeritem.h"
|
||||||
|
#include "route.h"
|
||||||
|
|
||||||
|
class RouteItem : public QGraphicsItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RouteItem(const Route &route, QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
|
QRectF boundingRect() const {return _path.boundingRect();}
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget);
|
||||||
|
|
||||||
|
const QPainterPath &path() const {return _path;}
|
||||||
|
|
||||||
|
void setScale(qreal scale);
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
|
void showMarker(bool show) {_marker->setVisible(show);}
|
||||||
|
void moveMarker(qreal t);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QPainterPath _path;
|
||||||
|
QPen _pen;
|
||||||
|
|
||||||
|
MarkerItem *_marker;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ROUTEITEM_H
|
@ -16,8 +16,15 @@
|
|||||||
|
|
||||||
#define POI_SETTINGS_GROUP "POI"
|
#define POI_SETTINGS_GROUP "POI"
|
||||||
#define OVERLAP_POI_SETTING "overlap"
|
#define OVERLAP_POI_SETTING "overlap"
|
||||||
|
#define LABELS_POI_SETTING "labels"
|
||||||
#define SHOW_POI_SETTING "show"
|
#define SHOW_POI_SETTING "show"
|
||||||
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
|
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
|
||||||
#define DISABLED_POI_FILE_SETTING "file"
|
#define DISABLED_POI_FILE_SETTING "file"
|
||||||
|
|
||||||
|
#define DATA_SETTINGS_GROUP "Data"
|
||||||
|
#define SHOW_TRACKS_SETTING "tracks"
|
||||||
|
#define SHOW_ROUTES_SETTING "routes"
|
||||||
|
#define SHOW_WAYPOINTS_SETTING "waypoints"
|
||||||
|
#define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels"
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
@ -14,14 +14,12 @@ SpeedGraph::SpeedGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
setSliderPrecision(1);
|
setSliderPrecision(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpeedGraph::addInfo()
|
void SpeedGraph::setInfo()
|
||||||
{
|
{
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', 1)
|
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', 1)
|
||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 1)
|
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 1)
|
||||||
+ UNIT_SPACE + yUnits());
|
+ UNIT_SPACE + yUnits());
|
||||||
|
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpeedGraph::loadGPX(const GPX &gpx)
|
void SpeedGraph::loadGPX(const GPX &gpx)
|
||||||
@ -41,8 +39,13 @@ void SpeedGraph::loadGPX(const GPX &gpx)
|
|||||||
loadData(data);
|
loadData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < gpx.routeCount(); i++)
|
||||||
|
skipColor();
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
addInfo();
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal SpeedGraph::avg() const
|
qreal SpeedGraph::avg() const
|
||||||
@ -100,9 +103,10 @@ void SpeedGraph::setYUnits()
|
|||||||
void SpeedGraph::setUnits(enum Units units)
|
void SpeedGraph::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
_units = units;
|
_units = units;
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
setYUnits();
|
setYUnits();
|
||||||
|
setInfo();
|
||||||
|
|
||||||
clearInfo();
|
redraw();
|
||||||
addInfo();
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ private:
|
|||||||
qreal max() const {return bounds().bottom();}
|
qreal max() const {return bounds().bottom();}
|
||||||
void setXUnits();
|
void setXUnits();
|
||||||
void setYUnits();
|
void setYUnits();
|
||||||
void addInfo();
|
void setInfo();
|
||||||
|
|
||||||
QList<QPointF> _avg;
|
QList<QPointF> _avg;
|
||||||
enum Units _units;
|
enum Units _units;
|
||||||
|
@ -13,7 +13,7 @@ TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
setSliderPrecision(1);
|
setSliderPrecision(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemperatureGraph::addInfo()
|
void TemperatureGraph::setInfo()
|
||||||
{
|
{
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
|
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
@ -21,8 +21,6 @@ void TemperatureGraph::addInfo()
|
|||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
|
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
|
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemperatureGraph::loadGPX(const GPX &gpx)
|
void TemperatureGraph::loadGPX(const GPX &gpx)
|
||||||
@ -46,8 +44,13 @@ void TemperatureGraph::loadGPX(const GPX &gpx)
|
|||||||
loadData(data);
|
loadData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < gpx.routeCount(); i++)
|
||||||
|
skipColor();
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
addInfo();
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal TemperatureGraph::avg() const
|
qreal TemperatureGraph::avg() const
|
||||||
@ -107,9 +110,10 @@ void TemperatureGraph::setYUnits()
|
|||||||
void TemperatureGraph::setUnits(enum Units units)
|
void TemperatureGraph::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
_units = units;
|
_units = units;
|
||||||
|
|
||||||
setXUnits();
|
setXUnits();
|
||||||
setYUnits();
|
setYUnits();
|
||||||
|
setInfo();
|
||||||
|
|
||||||
clearInfo();
|
redraw();
|
||||||
addInfo();
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ private:
|
|||||||
qreal max() const {return bounds().bottom();}
|
qreal max() const {return bounds().bottom();}
|
||||||
void setXUnits();
|
void setXUnits();
|
||||||
void setYUnits();
|
void setYUnits();
|
||||||
void addInfo();
|
void setInfo();
|
||||||
|
|
||||||
QList<QPointF> _avg;
|
QList<QPointF> _avg;
|
||||||
enum Units _units;
|
enum Units _units;
|
||||||
|
@ -24,7 +24,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
const QVector<Trackpoint> &_data;
|
const QVector<Trackpoint> &_data;
|
||||||
QVector<qreal> _dd;
|
QVector<qreal> _dd;
|
||||||
qreal _distance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TRACK_H
|
#endif // TRACK_H
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QPen>
|
#include <QPainter>
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
@ -28,23 +28,22 @@ void TrackItem::updateShape()
|
|||||||
{
|
{
|
||||||
QPainterPathStroker s;
|
QPainterPathStroker s;
|
||||||
s.setWidth(TRACK_WIDTH * 1.0/scale());
|
s.setWidth(TRACK_WIDTH * 1.0/scale());
|
||||||
_shape = s.createStroke(path().simplified());
|
_shape = s.createStroke(_path.simplified());
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
||||||
: QGraphicsPathItem(parent)
|
: QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
QVector<QPointF> t;
|
QVector<QPointF> t;
|
||||||
QPainterPath path;
|
|
||||||
|
|
||||||
track.track(t);
|
track.track(t);
|
||||||
Q_ASSERT(t.count() >= 2);
|
Q_ASSERT(t.count() >= 2);
|
||||||
|
|
||||||
const QPointF &p = t.at(0);
|
const QPointF &p = t.at(0);
|
||||||
path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
|
_path.moveTo(ll2mercator(QPointF(p.x(), -p.y())));
|
||||||
for (int i = 1; i < t.size(); i++) {
|
for (int i = 1; i < t.size(); i++) {
|
||||||
const QPointF &p = t.at(i);
|
const QPointF &p = t.at(i);
|
||||||
path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
|
_path.lineTo(ll2mercator(QPointF(p.x(), -p.y())));
|
||||||
}
|
}
|
||||||
|
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
@ -52,32 +51,48 @@ TrackItem::TrackItem(const Track &track, QGraphicsItem *parent)
|
|||||||
_distance = track.distance();
|
_distance = track.distance();
|
||||||
_time = track.time();
|
_time = track.time();
|
||||||
|
|
||||||
setPath(path);
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
|
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
QBrush brush(Qt::SolidPattern);
|
QBrush brush(Qt::SolidPattern);
|
||||||
QPen pen(brush, TRACK_WIDTH);
|
_pen = QPen(brush, TRACK_WIDTH);
|
||||||
setPen(pen);
|
|
||||||
|
_marker = new MarkerItem(this);
|
||||||
|
_marker->setPos(_path.pointAtPercent(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget)
|
||||||
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
|
painter->setPen(_pen);
|
||||||
|
painter->drawPath(_path);
|
||||||
|
|
||||||
|
/*
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
painter->drawRect(boundingRect());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackItem::setScale(qreal scale)
|
void TrackItem::setScale(qreal scale)
|
||||||
{
|
{
|
||||||
QGraphicsPathItem::setScale(scale);
|
prepareGeometryChange();
|
||||||
updateShape();
|
|
||||||
|
|
||||||
QPen p(pen());
|
_pen.setWidthF(TRACK_WIDTH * 1.0/scale);
|
||||||
p.setWidthF(TRACK_WIDTH * 1.0/scale);
|
QGraphicsItem::setScale(scale);
|
||||||
setPen(p);
|
_marker->setScale(1.0/scale);
|
||||||
|
|
||||||
|
updateShape();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackItem::setColor(const QColor &color)
|
void TrackItem::setColor(const QColor &color)
|
||||||
{
|
{
|
||||||
QPen p(pen());
|
_pen.setColor(color);
|
||||||
p.setColor(color);
|
update();
|
||||||
setPen(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackItem::setUnits(enum Units units)
|
void TrackItem::setUnits(enum Units units)
|
||||||
@ -85,3 +100,9 @@ void TrackItem::setUnits(enum Units units)
|
|||||||
_units = units;
|
_units = units;
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackItem::moveMarker(qreal t)
|
||||||
|
{
|
||||||
|
Q_ASSERT(t >= 0 && t <= 1.0);
|
||||||
|
_marker->setPos(_path.pointAtPercent(t));
|
||||||
|
}
|
||||||
|
@ -1,27 +1,41 @@
|
|||||||
#ifndef TRACKITEM_H
|
#ifndef TRACKITEM_H
|
||||||
#define TRACKITEM_H
|
#define TRACKITEM_H
|
||||||
|
|
||||||
#include <QGraphicsPathItem>
|
#include <QGraphicsItem>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
|
#include "markeritem.h"
|
||||||
|
|
||||||
class TrackItem : public QGraphicsPathItem
|
|
||||||
|
class TrackItem : public QGraphicsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TrackItem(const Track &track, QGraphicsItem *parent = 0);
|
TrackItem(const Track &track, QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
QPainterPath shape() const {return _shape;}
|
QPainterPath shape() const {return _shape;}
|
||||||
void setScale(qreal scale);
|
QRectF boundingRect() const {return _shape.boundingRect();}
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget);
|
||||||
|
|
||||||
|
const QPainterPath &path() const {return _path;}
|
||||||
|
|
||||||
|
void setScale(qreal scale);
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
|
void showMarker(bool show) {_marker->setVisible(show);}
|
||||||
|
void moveMarker(qreal t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateShape();
|
void updateShape();
|
||||||
QString toolTip();
|
QString toolTip();
|
||||||
|
|
||||||
|
QPainterPath _path;
|
||||||
QPainterPath _shape;
|
QPainterPath _shape;
|
||||||
|
QPen _pen;
|
||||||
|
|
||||||
|
MarkerItem *_marker;
|
||||||
|
|
||||||
Units _units;
|
Units _units;
|
||||||
QDateTime _date;
|
QDateTime _date;
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
#include "gpx.h"
|
#include "gpx.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "trackitem.h"
|
#include "trackitem.h"
|
||||||
|
#include "routeitem.h"
|
||||||
#include "waypointitem.h"
|
#include "waypointitem.h"
|
||||||
#include "markeritem.h"
|
|
||||||
#include "scaleitem.h"
|
#include "scaleitem.h"
|
||||||
#include "trackview.h"
|
#include "trackview.h"
|
||||||
|
|
||||||
@ -37,9 +37,16 @@ TrackView::TrackView(QWidget *parent)
|
|||||||
_maxPath = 0;
|
_maxPath = 0;
|
||||||
_maxDistance = 0;
|
_maxDistance = 0;
|
||||||
|
|
||||||
_plot = false;
|
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
_overlap = true;
|
|
||||||
|
_showTracks = true;
|
||||||
|
_showRoutes = true;
|
||||||
|
_showWaypoints = true;
|
||||||
|
_showWaypointLabels = true;
|
||||||
|
_showPOILabels = true;
|
||||||
|
_overlapPOIs = true;
|
||||||
|
|
||||||
|
_plot = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackView::~TrackView()
|
TrackView::~TrackView()
|
||||||
@ -55,23 +62,39 @@ void TrackView::addTrack(const Track &track)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TrackItem *pi = new TrackItem(track);
|
TrackItem *ti = new TrackItem(track);
|
||||||
_paths.append(pi);
|
_tracks.append(ti);
|
||||||
_zoom = qMin(_zoom, scale2zoom(trackScale()));
|
_zoom = qMin(_zoom, scale2zoom(trackScale()));
|
||||||
_scale = mapScale(_zoom);
|
_scale = mapScale(_zoom);
|
||||||
pi->setScale(1.0/_scale);
|
ti->setScale(1.0/_scale);
|
||||||
pi->setColor(_palette.color());
|
ti->setColor(_palette.color());
|
||||||
_scene->addItem(pi);
|
ti->setVisible(_showTracks);
|
||||||
|
_scene->addItem(ti);
|
||||||
|
|
||||||
MarkerItem *mi = new MarkerItem(pi);
|
_maxPath = qMax(ti->path().length(), _maxPath);
|
||||||
_markers.append(mi);
|
|
||||||
mi->setPos(pi->path().pointAtPercent(0));
|
|
||||||
mi->setScale(_scale);
|
|
||||||
|
|
||||||
_maxPath = qMax(pi->path().length(), _maxPath);
|
|
||||||
_maxDistance = qMax(track.distance(), _maxDistance);
|
_maxDistance = qMax(track.distance(), _maxDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackView::addRoute(const Route &route)
|
||||||
|
{
|
||||||
|
if (route.isNull()) {
|
||||||
|
_palette.color();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RouteItem *ri = new RouteItem(route);
|
||||||
|
_routes.append(ri);
|
||||||
|
_zoom = qMin(_zoom, scale2zoom(routeScale()));
|
||||||
|
_scale = mapScale(_zoom);
|
||||||
|
ri->setScale(1.0/_scale);
|
||||||
|
ri->setColor(_palette.color());
|
||||||
|
ri->setVisible(_showRoutes);
|
||||||
|
_scene->addItem(ri);
|
||||||
|
|
||||||
|
_maxPath = qMax(ri->path().length(), _maxPath);
|
||||||
|
_maxDistance = qMax(route.distance(), _maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
void TrackView::addWaypoints(const QList<Waypoint> &waypoints)
|
void TrackView::addWaypoints(const QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < waypoints.count(); i++) {
|
for (int i = 0; i < waypoints.count(); i++) {
|
||||||
@ -80,6 +103,8 @@ void TrackView::addWaypoints(const QList<Waypoint> &waypoints)
|
|||||||
WaypointItem *wi = new WaypointItem(w);
|
WaypointItem *wi = new WaypointItem(w);
|
||||||
wi->setScale(1.0/_scale);
|
wi->setScale(1.0/_scale);
|
||||||
wi->setZValue(1);
|
wi->setZValue(1);
|
||||||
|
wi->showLabel(_showWaypointLabels);
|
||||||
|
wi->setVisible(_showWaypoints);
|
||||||
_scene->addItem(wi);
|
_scene->addItem(wi);
|
||||||
|
|
||||||
_waypoints.append(wi);
|
_waypoints.append(wi);
|
||||||
@ -95,16 +120,19 @@ void TrackView::loadGPX(const GPX &gpx)
|
|||||||
|
|
||||||
for (int i = 0; i < gpx.trackCount(); i++)
|
for (int i = 0; i < gpx.trackCount(); i++)
|
||||||
addTrack(gpx.track(i));
|
addTrack(gpx.track(i));
|
||||||
|
for (int i = 0; i < gpx.routeCount(); i++)
|
||||||
|
addRoute(gpx.route(i));
|
||||||
addWaypoints(gpx.waypoints());
|
addWaypoints(gpx.waypoints());
|
||||||
|
|
||||||
if (_paths.empty() && _waypoints.empty())
|
if (_tracks.empty() && _routes.empty() && _waypoints.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((_paths.size() > 1 && _zoom < zoom)
|
if ((_tracks.size() > 1 && _zoom < zoom)
|
||||||
|| (_waypoints.size() && _zoom < zoom))
|
|| (_waypoints.size() && _zoom < zoom))
|
||||||
rescale(_scale);
|
rescale(_scale);
|
||||||
|
|
||||||
QRectF br = trackBoundingRect() | waypointBoundingRect();
|
QRectF br = trackBoundingRect() | routeBoundingRect()
|
||||||
|
| waypointBoundingRect();
|
||||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||||
_scene->setSceneRect(ba);
|
_scene->setSceneRect(ba);
|
||||||
centerOn(ba.center());
|
centerOn(ba.center());
|
||||||
@ -117,12 +145,24 @@ void TrackView::loadGPX(const GPX &gpx)
|
|||||||
|
|
||||||
QRectF TrackView::trackBoundingRect() const
|
QRectF TrackView::trackBoundingRect() const
|
||||||
{
|
{
|
||||||
if (_paths.empty())
|
if (_tracks.empty())
|
||||||
return QRectF();
|
return QRectF();
|
||||||
|
|
||||||
QRectF br = _paths.at(0)->sceneBoundingRect();
|
QRectF br = _tracks.at(0)->sceneBoundingRect();
|
||||||
for (int i = 1; i < _paths.size(); i++)
|
for (int i = 1; i < _tracks.size(); i++)
|
||||||
br |= _paths.at(i)->sceneBoundingRect();
|
br |= _tracks.at(i)->sceneBoundingRect();
|
||||||
|
|
||||||
|
return br;
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF TrackView::routeBoundingRect() const
|
||||||
|
{
|
||||||
|
if (_routes.empty())
|
||||||
|
return QRectF();
|
||||||
|
|
||||||
|
QRectF br = _routes.at(0)->sceneBoundingRect();
|
||||||
|
for (int i = 1; i < _routes.size(); i++)
|
||||||
|
br |= _routes.at(i)->sceneBoundingRect();
|
||||||
|
|
||||||
return br;
|
return br;
|
||||||
}
|
}
|
||||||
@ -153,13 +193,29 @@ QRectF TrackView::waypointBoundingRect() const
|
|||||||
|
|
||||||
qreal TrackView::trackScale() const
|
qreal TrackView::trackScale() const
|
||||||
{
|
{
|
||||||
if (_paths.empty())
|
if (_tracks.empty())
|
||||||
return mapScale(ZOOM_MAX);
|
return mapScale(ZOOM_MAX);
|
||||||
|
|
||||||
QRectF br = _paths.at(0)->path().boundingRect();
|
QRectF br = _tracks.at(0)->path().boundingRect();
|
||||||
|
|
||||||
for (int i = 1; i < _paths.size(); i++)
|
for (int i = 1; i < _tracks.size(); i++)
|
||||||
br |= _paths.at(i)->path().boundingRect();
|
br |= _tracks.at(i)->path().boundingRect();
|
||||||
|
|
||||||
|
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
||||||
|
br.height() / (viewport()->height() - MARGIN/2));
|
||||||
|
|
||||||
|
return qMax(sc.x(), sc.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal TrackView::routeScale() const
|
||||||
|
{
|
||||||
|
if (_routes.empty())
|
||||||
|
return mapScale(ZOOM_MAX);
|
||||||
|
|
||||||
|
QRectF br = _routes.at(0)->path().boundingRect();
|
||||||
|
|
||||||
|
for (int i = 1; i < _routes.size(); i++)
|
||||||
|
br |= _routes.at(i)->path().boundingRect();
|
||||||
|
|
||||||
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
|
||||||
br.height() / (viewport()->height() - MARGIN/2));
|
br.height() / (viewport()->height() - MARGIN/2));
|
||||||
@ -215,10 +271,11 @@ void TrackView::checkPOIOverlap()
|
|||||||
|
|
||||||
void TrackView::rescale(qreal scale)
|
void TrackView::rescale(qreal scale)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _paths.size(); i++) {
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
_markers.at(i)->setScale(scale);
|
_tracks.at(i)->setScale(1.0/scale);
|
||||||
_paths.at(i)->setScale(1.0/scale);
|
|
||||||
}
|
for (int i = 0; i < _routes.size(); i++)
|
||||||
|
_routes.at(i)->setScale(1.0/scale);
|
||||||
|
|
||||||
for (int i = 0; i < _waypoints.size(); i++)
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
_waypoints.at(i)->setScale(1.0/scale);
|
_waypoints.at(i)->setScale(1.0/scale);
|
||||||
@ -229,7 +286,7 @@ void TrackView::rescale(qreal scale)
|
|||||||
it.value()->show();
|
it.value()->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_overlap)
|
if (!_overlapPOIs)
|
||||||
checkPOIOverlap();
|
checkPOIOverlap();
|
||||||
|
|
||||||
_scale = scale;
|
_scale = scale;
|
||||||
@ -246,6 +303,7 @@ void TrackView::addPOI(const QVector<Waypoint> &waypoints)
|
|||||||
WaypointItem *pi = new WaypointItem(w);
|
WaypointItem *pi = new WaypointItem(w);
|
||||||
pi->setScale(1.0/_scale);
|
pi->setScale(1.0/_scale);
|
||||||
pi->setZValue(1);
|
pi->setZValue(1);
|
||||||
|
pi->showLabel(_showPOILabels);
|
||||||
_scene->addItem(pi);
|
_scene->addItem(pi);
|
||||||
|
|
||||||
_pois.insert(w, pi);
|
_pois.insert(w, pi);
|
||||||
@ -254,14 +312,16 @@ void TrackView::addPOI(const QVector<Waypoint> &waypoints)
|
|||||||
|
|
||||||
void TrackView::loadPOI(const POI &poi)
|
void TrackView::loadPOI(const POI &poi)
|
||||||
{
|
{
|
||||||
if (!_paths.size() && !_waypoints.size())
|
if (!_tracks.size() && !_routes.size() && !_waypoints.size())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int i = 0; i < _paths.size(); i++)
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
addPOI(poi.points(_paths.at(i)->path()));
|
addPOI(poi.points(_tracks.at(i)->path()));
|
||||||
|
for (int i = 0; i < _routes.size(); i++)
|
||||||
|
addPOI(poi.points(_routes.at(i)->path()));
|
||||||
addPOI(poi.points(_waypoints));
|
addPOI(poi.points(_waypoints));
|
||||||
|
|
||||||
if (!_overlap)
|
if (!_overlapPOIs)
|
||||||
checkPOIOverlap();
|
checkPOIOverlap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,8 +340,8 @@ void TrackView::setUnits(enum Units units)
|
|||||||
|
|
||||||
_mapScale->setUnits(units);
|
_mapScale->setUnits(units);
|
||||||
|
|
||||||
for (int i = 0; i < _paths.count(); i++)
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
_paths[i]->setUnits(units);
|
_tracks[i]->setUnits(units);
|
||||||
|
|
||||||
for (int i = 0; i < _waypoints.size(); i++)
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
_waypoints.at(i)->setUnits(units);
|
_waypoints.at(i)->setUnits(units);
|
||||||
@ -298,21 +358,24 @@ void TrackView::redraw()
|
|||||||
|
|
||||||
void TrackView::rescale()
|
void TrackView::rescale()
|
||||||
{
|
{
|
||||||
_zoom = qMin(scale2zoom(trackScale()), scale2zoom(waypointScale()));
|
_zoom = qMin(qMin(scale2zoom(trackScale()), scale2zoom(routeScale())),
|
||||||
|
scale2zoom(waypointScale()));
|
||||||
|
|
||||||
rescale(mapScale(_zoom));
|
rescale(mapScale(_zoom));
|
||||||
_mapScale->setZoom(_zoom);
|
_mapScale->setZoom(_zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackView::zoom(int z, const QPointF &pos)
|
void TrackView::zoom(int z, const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (_paths.isEmpty() && _waypoints.isEmpty())
|
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qreal scale = _scale;
|
qreal scale = _scale;
|
||||||
_zoom = z;
|
_zoom = z;
|
||||||
|
|
||||||
rescale(mapScale(_zoom));
|
rescale(mapScale(_zoom));
|
||||||
QRectF br = trackBoundingRect() | waypointBoundingRect();
|
QRectF br = trackBoundingRect() | routeBoundingRect()
|
||||||
|
| waypointBoundingRect();
|
||||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||||
_scene->setSceneRect(ba);
|
_scene->setSceneRect(ba);
|
||||||
|
|
||||||
@ -329,7 +392,7 @@ void TrackView::zoom(int z, const QPointF &pos)
|
|||||||
|
|
||||||
void TrackView::wheelEvent(QWheelEvent *event)
|
void TrackView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (_paths.isEmpty() && _waypoints.isEmpty())
|
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QPointF pos = mapToScene(event->pos());
|
QPointF pos = mapToScene(event->pos());
|
||||||
@ -406,9 +469,9 @@ void TrackView::clear()
|
|||||||
_scene->removeItem(_mapScale);
|
_scene->removeItem(_mapScale);
|
||||||
|
|
||||||
_pois.clear();
|
_pois.clear();
|
||||||
_paths.clear();
|
_tracks.clear();
|
||||||
|
_routes.clear();
|
||||||
_waypoints.clear();
|
_waypoints.clear();
|
||||||
_markers.clear();
|
|
||||||
_scene->clear();
|
_scene->clear();
|
||||||
_palette.reset();
|
_palette.reset();
|
||||||
|
|
||||||
@ -424,23 +487,75 @@ void TrackView::movePositionMarker(qreal val)
|
|||||||
{
|
{
|
||||||
qreal mp = val / _maxDistance;
|
qreal mp = val / _maxDistance;
|
||||||
|
|
||||||
for (int i = 0; i < _paths.size(); i++) {
|
for (int i = 0; i < _tracks.size(); i++) {
|
||||||
qreal f = _maxPath / _paths.at(i)->path().length();
|
qreal f = _maxPath / _tracks.at(i)->path().length();
|
||||||
if (mp * f < 0 || mp * f > 1.0)
|
if (mp * f < 0 || mp * f > 1.0)
|
||||||
_markers.at(i)->setVisible(false);
|
_tracks.at(i)->showMarker(false);
|
||||||
else {
|
else {
|
||||||
QPointF pos = _paths.at(i)->path().pointAtPercent(mp * f);
|
_tracks.at(i)->moveMarker(mp * f);
|
||||||
_markers.at(i)->setPos(pos);
|
_tracks.at(i)->showMarker(true);
|
||||||
_markers.at(i)->setVisible(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _routes.size(); i++) {
|
||||||
|
qreal f = _maxPath / _routes.at(i)->path().length();
|
||||||
|
if (mp * f < 0 || mp * f > 1.0)
|
||||||
|
_routes.at(i)->showMarker(false);
|
||||||
|
else {
|
||||||
|
_routes.at(i)->moveMarker(mp * f);
|
||||||
|
_routes.at(i)->showMarker(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackView::showTracks(bool show)
|
||||||
|
{
|
||||||
|
_showTracks = show;
|
||||||
|
|
||||||
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
|
_tracks.at(i)->setVisible(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackView::showRoutes(bool show)
|
||||||
|
{
|
||||||
|
_showRoutes = show;
|
||||||
|
|
||||||
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
|
_routes.at(i)->setVisible(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackView::showWaypoints(bool show)
|
||||||
|
{
|
||||||
|
_showWaypoints = show;
|
||||||
|
|
||||||
|
for (int i = 0; i < _waypoints.count(); i++)
|
||||||
|
_waypoints.at(i)->setVisible(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackView::showWaypointLabels(bool show)
|
||||||
|
{
|
||||||
|
_showWaypointLabels = show;
|
||||||
|
|
||||||
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
|
_waypoints.at(i)->showLabel(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrackView::showPOILabels(bool show)
|
||||||
|
{
|
||||||
|
_showPOILabels = show;
|
||||||
|
|
||||||
|
QHash<Waypoint, WaypointItem*>::const_iterator it;
|
||||||
|
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||||
|
it.value()->showLabel(show);
|
||||||
|
|
||||||
|
setPOIOverlap(_overlapPOIs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrackView::setPOIOverlap(bool overlap)
|
void TrackView::setPOIOverlap(bool overlap)
|
||||||
{
|
{
|
||||||
_overlap = overlap;
|
_overlapPOIs = overlap;
|
||||||
|
|
||||||
if (_overlap) {
|
if (_overlapPOIs) {
|
||||||
QHash<Waypoint, WaypointItem*>::const_iterator it;
|
QHash<Waypoint, WaypointItem*>::const_iterator it;
|
||||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||||
it.value()->show();
|
it.value()->show();
|
||||||
@ -450,7 +565,8 @@ void TrackView::setPOIOverlap(bool overlap)
|
|||||||
|
|
||||||
void TrackView::drawBackground(QPainter *painter, const QRectF &rect)
|
void TrackView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||||
{
|
{
|
||||||
if ((_paths.isEmpty() && _waypoints.isEmpty()) || !_map) {
|
if ((_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
|
|| !_map) {
|
||||||
painter->fillRect(rect, Qt::white);
|
painter->fillRect(rect, Qt::white);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -481,12 +597,13 @@ void TrackView::drawBackground(QPainter *painter, const QRectF &rect)
|
|||||||
|
|
||||||
void TrackView::resizeEvent(QResizeEvent *e)
|
void TrackView::resizeEvent(QResizeEvent *e)
|
||||||
{
|
{
|
||||||
if (_paths.isEmpty() && _waypoints.isEmpty())
|
if (_tracks.isEmpty() && _routes.isEmpty() && _waypoints.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rescale();
|
rescale();
|
||||||
|
|
||||||
QRectF br = trackBoundingRect() | waypointBoundingRect();
|
QRectF br = trackBoundingRect() | routeBoundingRect()
|
||||||
|
| waypointBoundingRect();
|
||||||
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
QRectF ba = br.adjusted(-TILE_SIZE, -TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
||||||
|
|
||||||
if (ba.width() < e->size().width()) {
|
if (ba.width() < e->size().width()) {
|
||||||
|
@ -13,9 +13,10 @@ class GPX;
|
|||||||
class POI;
|
class POI;
|
||||||
class Map;
|
class Map;
|
||||||
class Track;
|
class Track;
|
||||||
|
class Route;
|
||||||
class TrackItem;
|
class TrackItem;
|
||||||
|
class RouteItem;
|
||||||
class WaypointItem;
|
class WaypointItem;
|
||||||
class MarkerItem;
|
|
||||||
class ScaleItem;
|
class ScaleItem;
|
||||||
|
|
||||||
class TrackView : public QGraphicsView
|
class TrackView : public QGraphicsView
|
||||||
@ -34,25 +35,35 @@ public:
|
|||||||
|
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void setPOIOverlap(bool overlap);
|
|
||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target);
|
void plot(QPainter *painter, const QRectF &target);
|
||||||
|
|
||||||
int trackCount() const {return _paths.count();}
|
int trackCount() const {return _tracks.count();}
|
||||||
|
int routeCount() const {return _routes.count();}
|
||||||
int waypointCount() const {return _waypoints.count();}
|
int waypointCount() const {return _waypoints.count();}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void movePositionMarker(qreal val);
|
void movePositionMarker(qreal val);
|
||||||
void redraw();
|
void redraw();
|
||||||
|
|
||||||
|
void setPOIOverlap(bool overlap);
|
||||||
|
void showWaypointLabels(bool show);
|
||||||
|
void showPOILabels(bool show);
|
||||||
|
void showTracks(bool show);
|
||||||
|
void showRoutes(bool show);
|
||||||
|
void showWaypoints(bool show);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addTrack(const Track &track);
|
void addTrack(const Track &track);
|
||||||
|
void addRoute(const Route &route);
|
||||||
void addWaypoints(const QList<Waypoint> &waypoints);
|
void addWaypoints(const QList<Waypoint> &waypoints);
|
||||||
void addPOI(const QVector<Waypoint> &waypoints);
|
void addPOI(const QVector<Waypoint> &waypoints);
|
||||||
|
|
||||||
QRectF trackBoundingRect() const;
|
QRectF trackBoundingRect() const;
|
||||||
|
QRectF routeBoundingRect() const;
|
||||||
QRectF waypointBoundingRect() const;
|
QRectF waypointBoundingRect() const;
|
||||||
qreal trackScale() const;
|
qreal trackScale() const;
|
||||||
|
qreal routeScale() const;
|
||||||
qreal waypointScale() const;
|
qreal waypointScale() const;
|
||||||
qreal mapScale(int zoom) const;
|
qreal mapScale(int zoom) const;
|
||||||
void rescale(qreal scale);
|
void rescale(qreal scale);
|
||||||
@ -67,8 +78,8 @@ private:
|
|||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
||||||
QGraphicsScene *_scene;
|
QGraphicsScene *_scene;
|
||||||
QList<TrackItem*> _paths;
|
QList<TrackItem*> _tracks;
|
||||||
QList<MarkerItem*> _markers;
|
QList<RouteItem*> _routes;
|
||||||
QList<WaypointItem*> _waypoints;
|
QList<WaypointItem*> _waypoints;
|
||||||
QHash<Waypoint, WaypointItem*> _pois;
|
QHash<Waypoint, WaypointItem*> _pois;
|
||||||
|
|
||||||
@ -82,7 +93,14 @@ private:
|
|||||||
int _zoom;
|
int _zoom;
|
||||||
|
|
||||||
Units _units;
|
Units _units;
|
||||||
bool _overlap;
|
|
||||||
|
bool _showTracks;
|
||||||
|
bool _showRoutes;
|
||||||
|
bool _showWaypoints;
|
||||||
|
bool _showWaypointLabels;
|
||||||
|
bool _showPOILabels;
|
||||||
|
bool _overlapPOIs;
|
||||||
|
|
||||||
bool _plot;
|
bool _plot;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ public:
|
|||||||
void setElevation(qreal elevation) {_elevation = elevation;}
|
void setElevation(qreal elevation) {_elevation = elevation;}
|
||||||
void setGeoidHeight(qreal geoidHeight) {_geoidHeight = geoidHeight;}
|
void setGeoidHeight(qreal geoidHeight) {_geoidHeight = geoidHeight;}
|
||||||
|
|
||||||
|
bool hasElevation() const {return !std::isnan(_elevation);}
|
||||||
|
|
||||||
bool operator==(const Waypoint &other) const
|
bool operator==(const Waypoint &other) const
|
||||||
{return this->_name == other._name
|
{return this->_name == other._name
|
||||||
&& this->_coordinates == other._coordinates;}
|
&& this->_coordinates == other._coordinates;}
|
||||||
|
@ -13,6 +13,8 @@ QString WaypointItem::toolTip()
|
|||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
|
||||||
|
if (!_waypoint.name().isEmpty() && !_showLabel)
|
||||||
|
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
||||||
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
||||||
::coordinates(_waypoint.coordinates()));
|
::coordinates(_waypoint.coordinates()));
|
||||||
if (!std::isnan(_waypoint.elevation()))
|
if (!std::isnan(_waypoint.elevation()))
|
||||||
@ -32,6 +34,7 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, QGraphicsItem *parent)
|
|||||||
: QGraphicsItem(parent)
|
: QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
|
_showLabel = true;
|
||||||
|
|
||||||
_waypoint = waypoint;
|
_waypoint = waypoint;
|
||||||
_coordinates = ll2mercator(QPointF(waypoint.coordinates().x(),
|
_coordinates = ll2mercator(QPointF(waypoint.coordinates().x(),
|
||||||
@ -46,6 +49,7 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, QGraphicsItem *parent)
|
|||||||
|
|
||||||
void WaypointItem::updateBoundingRect()
|
void WaypointItem::updateBoundingRect()
|
||||||
{
|
{
|
||||||
|
if (_showLabel) {
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FONT_SIZE);
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
@ -54,6 +58,9 @@ void WaypointItem::updateBoundingRect()
|
|||||||
|
|
||||||
_boundingRect = QRectF(-POINT_SIZE/2, -POINT_SIZE/2, ts.width()
|
_boundingRect = QRectF(-POINT_SIZE/2, -POINT_SIZE/2, ts.width()
|
||||||
+ POINT_SIZE, ts.height() + fm.descent() + POINT_SIZE);
|
+ POINT_SIZE, ts.height() + fm.descent() + POINT_SIZE);
|
||||||
|
} else
|
||||||
|
_boundingRect = QRectF(-POINT_SIZE/2, -POINT_SIZE/2, POINT_SIZE,
|
||||||
|
POINT_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointItem::paint(QPainter *painter,
|
void WaypointItem::paint(QPainter *painter,
|
||||||
@ -61,6 +68,8 @@ void WaypointItem::paint(QPainter *painter,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(option);
|
Q_UNUSED(option);
|
||||||
Q_UNUSED(widget);
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
|
if (_showLabel) {
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPixelSize(FONT_SIZE);
|
font.setPixelSize(FONT_SIZE);
|
||||||
font.setFamily(FONT_FAMILY);
|
font.setFamily(FONT_FAMILY);
|
||||||
@ -68,8 +77,10 @@ void WaypointItem::paint(QPainter *painter,
|
|||||||
QRect ts = fm.tightBoundingRect(_waypoint.name());
|
QRect ts = fm.tightBoundingRect(_waypoint.name());
|
||||||
|
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
painter->drawText(POINT_SIZE/2 - qMax(ts.x(), 0), POINT_SIZE/2 + ts.height(),
|
painter->drawText(POINT_SIZE/2 - qMax(ts.x(), 0), POINT_SIZE/2
|
||||||
_waypoint.name());
|
+ ts.height(), _waypoint.name());
|
||||||
|
}
|
||||||
|
|
||||||
painter->setBrush(Qt::SolidPattern);
|
painter->setBrush(Qt::SolidPattern);
|
||||||
painter->drawEllipse(-POINT_SIZE/2, -POINT_SIZE/2, POINT_SIZE, POINT_SIZE);
|
painter->drawEllipse(-POINT_SIZE/2, -POINT_SIZE/2, POINT_SIZE, POINT_SIZE);
|
||||||
|
|
||||||
@ -90,3 +101,11 @@ void WaypointItem::setUnits(enum Units units)
|
|||||||
_units = units;
|
_units = units;
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WaypointItem::showLabel(bool show)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
_showLabel = show;
|
||||||
|
updateBoundingRect();
|
||||||
|
setToolTip(toolTip());
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ public:
|
|||||||
|
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void setScale(qreal scale);
|
void setScale(qreal scale);
|
||||||
|
void showLabel(bool show);
|
||||||
|
|
||||||
QRectF boundingRect() const {return _boundingRect;}
|
QRectF boundingRect() const {return _boundingRect;}
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -28,6 +29,7 @@ private:
|
|||||||
QPointF _coordinates;
|
QPointF _coordinates;
|
||||||
Waypoint _waypoint;
|
Waypoint _waypoint;
|
||||||
Units _units;
|
Units _units;
|
||||||
|
bool _showLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WAYPOINTITEM_H
|
#endif // WAYPOINTITEM_H
|
||||||
|
Loading…
Reference in New Issue
Block a user