mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-28 05:34:47 +01:00
Added support for TCX and CSV files
This commit is contained in:
parent
94fc5e17d0
commit
d7fd40d9d2
17
gpxsee.pro
17
gpxsee.pro
@ -8,8 +8,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
|||||||
HEADERS += src/config.h \
|
HEADERS += src/config.h \
|
||||||
src/icons.h \
|
src/icons.h \
|
||||||
src/gui.h \
|
src/gui.h \
|
||||||
src/gpx.h \
|
|
||||||
src/parser.h \
|
|
||||||
src/poi.h \
|
src/poi.h \
|
||||||
src/rtree.h \
|
src/rtree.h \
|
||||||
src/ll.h \
|
src/ll.h \
|
||||||
@ -53,11 +51,14 @@ HEADERS += src/config.h \
|
|||||||
src/graph.h \
|
src/graph.h \
|
||||||
src/pathitem.h \
|
src/pathitem.h \
|
||||||
src/pathview.h \
|
src/pathview.h \
|
||||||
src/griditem.h
|
src/griditem.h \
|
||||||
|
src/data.h \
|
||||||
|
src/gpxparser.h \
|
||||||
|
src/tcxparser.h \
|
||||||
|
src/parser.h \
|
||||||
|
src/csvparser.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/gui.cpp \
|
src/gui.cpp \
|
||||||
src/gpx.cpp \
|
|
||||||
src/parser.cpp \
|
|
||||||
src/poi.cpp \
|
src/poi.cpp \
|
||||||
src/ll.cpp \
|
src/ll.cpp \
|
||||||
src/axisitem.cpp \
|
src/axisitem.cpp \
|
||||||
@ -93,7 +94,11 @@ SOURCES += src/main.cpp \
|
|||||||
src/graphitem.cpp \
|
src/graphitem.cpp \
|
||||||
src/pathitem.cpp \
|
src/pathitem.cpp \
|
||||||
src/pathview.cpp \
|
src/pathview.cpp \
|
||||||
src/griditem.cpp
|
src/griditem.cpp \
|
||||||
|
src/data.cpp \
|
||||||
|
src/gpxparser.cpp \
|
||||||
|
src/tcxparser.cpp \
|
||||||
|
src/csvparser.cpp
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
TRANSLATIONS = lang/gpxsee_cs.ts
|
||||||
macx {
|
macx {
|
||||||
|
@ -132,10 +132,6 @@
|
|||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>FileSelectWidget</name>
|
<name>FileSelectWidget</name>
|
||||||
<message>
|
|
||||||
<source>Browse...</source>
|
|
||||||
<translation type="obsolete">Procházet...</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/fileselectwidget.cpp" line="38"/>
|
<location filename="../src/fileselectwidget.cpp" line="38"/>
|
||||||
<source>Select file</source>
|
<source>Select file</source>
|
||||||
@ -145,260 +141,276 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GUI</name>
|
<name>GUI</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="529"/>
|
<location filename="../src/gui.cpp" line="538"/>
|
||||||
<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="593"/>
|
<location filename="../src/gui.cpp" line="602"/>
|
||||||
<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="672"/>
|
<location filename="../src/gui.cpp" line="683"/>
|
||||||
<source>Open POI file</source>
|
<source>Open POI file</source>
|
||||||
<translation>Otevřít POI soubor</translation>
|
<translation>Otevřít POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="209"/>
|
<location filename="../src/gui.cpp" line="215"/>
|
||||||
<source>Open</source>
|
<source>Open</source>
|
||||||
<translation>Otevřít</translation>
|
<translation>Otevřít</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="193"/>
|
<location filename="../src/gui.cpp" line="199"/>
|
||||||
<source>Quit</source>
|
<source>Quit</source>
|
||||||
<translation>Ukončit</translation>
|
<translation>Ukončit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="201"/>
|
<location filename="../src/gui.cpp" line="207"/>
|
||||||
<location filename="../src/gui.cpp" line="545"/>
|
<location filename="../src/gui.cpp" line="554"/>
|
||||||
<location filename="../src/gui.cpp" line="546"/>
|
<location filename="../src/gui.cpp" line="555"/>
|
||||||
<source>Keyboard controls</source>
|
<source>Keyboard controls</source>
|
||||||
<translation>Ovládací klávesy</translation>
|
<translation>Ovládací klávesy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="225"/>
|
<location filename="../src/gui.cpp" line="231"/>
|
||||||
<source>Close</source>
|
<source>Close</source>
|
||||||
<translation>Zavřít</translation>
|
<translation>Zavřít</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="231"/>
|
<location filename="../src/gui.cpp" line="237"/>
|
||||||
<source>Reload</source>
|
<source>Reload</source>
|
||||||
<translation>Znovu načíst</translation>
|
<translation>Znovu načíst</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="460"/>
|
<location filename="../src/gui.cpp" line="466"/>
|
||||||
<source>Show</source>
|
<source>Show</source>
|
||||||
<translation>Zobrazit</translation>
|
<translation>Zobrazit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="382"/>
|
<location filename="../src/gui.cpp" line="388"/>
|
||||||
<location filename="../src/gui.cpp" line="454"/>
|
<location filename="../src/gui.cpp" line="460"/>
|
||||||
<source>File</source>
|
<source>File</source>
|
||||||
<translation>Soubor</translation>
|
<translation>Soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="199"/>
|
<location filename="../src/gui.cpp" line="205"/>
|
||||||
<location filename="../src/gui.cpp" line="568"/>
|
<location filename="../src/gui.cpp" line="577"/>
|
||||||
<location filename="../src/gui.cpp" line="569"/>
|
<location filename="../src/gui.cpp" line="578"/>
|
||||||
<source>Data sources</source>
|
<source>Data sources</source>
|
||||||
<translation>Zdroje dat</translation>
|
<translation>Zdroje dat</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="239"/>
|
<location filename="../src/gui.cpp" line="245"/>
|
||||||
<source>Load POI file</source>
|
<source>Load POI file</source>
|
||||||
<translation>Nahrát POI soubor</translation>
|
<translation>Nahrát POI soubor</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="242"/>
|
<location filename="../src/gui.cpp" line="248"/>
|
||||||
<source>Close POI files</source>
|
<source>Close POI files</source>
|
||||||
<translation>Zavřit POI soubory</translation>
|
<translation>Zavřit POI soubory</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="244"/>
|
<location filename="../src/gui.cpp" line="250"/>
|
||||||
<source>Overlap POIs</source>
|
<source>Overlap POIs</source>
|
||||||
<translation>Překrývat POI</translation>
|
<translation>Překrývat POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="248"/>
|
<location filename="../src/gui.cpp" line="254"/>
|
||||||
<source>Show POI labels</source>
|
<source>Show POI labels</source>
|
||||||
<translation>Zobrazovat názvy POI</translation>
|
<translation>Zobrazovat názvy POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="253"/>
|
<location filename="../src/gui.cpp" line="259"/>
|
||||||
<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="262"/>
|
<location filename="../src/gui.cpp" line="268"/>
|
||||||
<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="268"/>
|
<location filename="../src/gui.cpp" line="274"/>
|
||||||
<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="277"/>
|
<location filename="../src/gui.cpp" line="283"/>
|
||||||
<location filename="../src/gui.cpp" line="281"/>
|
<location filename="../src/gui.cpp" line="287"/>
|
||||||
<location filename="../src/gui.cpp" line="555"/>
|
<location filename="../src/gui.cpp" line="564"/>
|
||||||
<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="288"/>
|
<location filename="../src/gui.cpp" line="294"/>
|
||||||
<source>Show tracks</source>
|
<source>Show tracks</source>
|
||||||
<translation>Zobrazit cesty</translation>
|
<translation>Zobrazit cesty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="292"/>
|
<location filename="../src/gui.cpp" line="298"/>
|
||||||
<source>Show routes</source>
|
<source>Show routes</source>
|
||||||
<translation>Zobrazit trasy</translation>
|
<translation>Zobrazit trasy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="296"/>
|
<location filename="../src/gui.cpp" line="302"/>
|
||||||
<source>Show waypoints</source>
|
<source>Show waypoints</source>
|
||||||
<translation>Zobrazit navigační body</translation>
|
<translation>Zobrazit navigační body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="300"/>
|
<location filename="../src/gui.cpp" line="306"/>
|
||||||
<source>Waypoint labels</source>
|
<source>Waypoint labels</source>
|
||||||
<translation>Názvy navigačních bodů</translation>
|
<translation>Názvy navigačních bodů</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="311"/>
|
<location filename="../src/gui.cpp" line="317"/>
|
||||||
<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="333"/>
|
<location filename="../src/gui.cpp" line="339"/>
|
||||||
<source>Show grid</source>
|
<source>Show grid</source>
|
||||||
<translation>Zobrazit mřížku</translation>
|
<translation>Zobrazit mřížku</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="339"/>
|
<location filename="../src/gui.cpp" line="345"/>
|
||||||
<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="345"/>
|
<location filename="../src/gui.cpp" line="351"/>
|
||||||
<source>Metric</source>
|
<source>Metric</source>
|
||||||
<translation>Metrické</translation>
|
<translation>Metrické</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="350"/>
|
<location filename="../src/gui.cpp" line="356"/>
|
||||||
<source>Imperial</source>
|
<source>Imperial</source>
|
||||||
<translation>Imperiální</translation>
|
<translation>Imperiální</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="356"/>
|
<location filename="../src/gui.cpp" line="362"/>
|
||||||
<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="364"/>
|
<location filename="../src/gui.cpp" line="370"/>
|
||||||
<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="367"/>
|
<location filename="../src/gui.cpp" line="373"/>
|
||||||
<source>Previous</source>
|
<source>Previous</source>
|
||||||
<translation>Předchozí</translation>
|
<translation>Předchozí</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="371"/>
|
<location filename="../src/gui.cpp" line="377"/>
|
||||||
<source>Last</source>
|
<source>Last</source>
|
||||||
<translation>Poslední</translation>
|
<translation>Poslední</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="374"/>
|
<location filename="../src/gui.cpp" line="380"/>
|
||||||
<source>First</source>
|
<source>First</source>
|
||||||
<translation>První</translation>
|
<translation>První</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="396"/>
|
<location filename="../src/gui.cpp" line="402"/>
|
||||||
<source>Map</source>
|
<source>Map</source>
|
||||||
<translation>Mapa</translation>
|
<translation>Mapa</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="403"/>
|
<location filename="../src/gui.cpp" line="409"/>
|
||||||
<source>Graph</source>
|
<source>Graph</source>
|
||||||
<translation>Graf</translation>
|
<translation>Graf</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="411"/>
|
<location filename="../src/gui.cpp" line="417"/>
|
||||||
<source>POI</source>
|
<source>POI</source>
|
||||||
<translation>POI</translation>
|
<translation>POI</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="412"/>
|
<location filename="../src/gui.cpp" line="418"/>
|
||||||
<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="423"/>
|
<location filename="../src/gui.cpp" line="429"/>
|
||||||
<source>Data</source>
|
<source>Data</source>
|
||||||
<translation>Data</translation>
|
<translation>Data</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="424"/>
|
<location filename="../src/gui.cpp" line="430"/>
|
||||||
<source>Display</source>
|
<source>Display</source>
|
||||||
<translation>Zobrazit</translation>
|
<translation>Zobrazit</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="432"/>
|
<location filename="../src/gui.cpp" line="438"/>
|
||||||
<source>Settings</source>
|
<source>Settings</source>
|
||||||
<translation>Nastavení</translation>
|
<translation>Nastavení</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="433"/>
|
<location filename="../src/gui.cpp" line="439"/>
|
||||||
<source>Units</source>
|
<source>Units</source>
|
||||||
<translation>Jednotky</translation>
|
<translation>Jednotky</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="441"/>
|
<location filename="../src/gui.cpp" line="447"/>
|
||||||
<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="557"/>
|
<location filename="../src/gui.cpp" line="566"/>
|
||||||
<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="674"/>
|
<location filename="../src/gui.cpp" line="604"/>
|
||||||
|
<location filename="../src/gui.cpp" line="685"/>
|
||||||
<source>GPX files (*.gpx)</source>
|
<source>GPX files (*.gpx)</source>
|
||||||
<translation>Soubory GPX (*.gpx)</translation>
|
<translation>Soubory GPX (*.gpx)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="674"/>
|
<location filename="../src/gui.cpp" line="604"/>
|
||||||
|
<location filename="../src/gui.cpp" line="686"/>
|
||||||
|
<source>TCX files (*.tcx)</source>
|
||||||
|
<translation>Soubory TCX (*.tcx)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="671"/>
|
||||||
|
<source>Error loading data file:
|
||||||
|
%1</source>
|
||||||
|
<translation>Datový soubor nelze otevřít:
|
||||||
|
%1 </translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../src/gui.cpp" line="605"/>
|
||||||
|
<location filename="../src/gui.cpp" line="685"/>
|
||||||
<source>CSV files (*.csv)</source>
|
<source>CSV files (*.csv)</source>
|
||||||
<translation>Soubory CSV (*.csv)</translation>
|
<translation>Soubory CSV (*.csv)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="675"/>
|
<location filename="../src/gui.cpp" line="605"/>
|
||||||
|
<location filename="../src/gui.cpp" line="686"/>
|
||||||
<source>All files (*)</source>
|
<source>All files (*)</source>
|
||||||
<translation>Všechny soubory (*)</translation>
|
<translation>Všechny soubory (*)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="761"/>
|
<location filename="../src/gui.cpp" line="772"/>
|
||||||
<location filename="../src/gui.cpp" line="764"/>
|
<location filename="../src/gui.cpp" line="775"/>
|
||||||
<source>Date</source>
|
<source>Date</source>
|
||||||
<translation>Datum</translation>
|
<translation>Datum</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="773"/>
|
<location filename="../src/gui.cpp" line="784"/>
|
||||||
<source>Routes</source>
|
<source>Routes</source>
|
||||||
<translation>Trasy</translation>
|
<translation>Trasy</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="961"/>
|
<location filename="../src/gui.cpp" line="972"/>
|
||||||
<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 numerus="yes">
|
<message numerus="yes">
|
||||||
<location filename="../src/gui.cpp" line="965"/>
|
<location filename="../src/gui.cpp" line="976"/>
|
||||||
<source>%1 files</source>
|
<source>%1 files</source>
|
||||||
<translation>
|
<translation>
|
||||||
<numerusform>%1 soubor</numerusform>
|
<numerusform>%1 soubor</numerusform>
|
||||||
@ -407,139 +419,128 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="548"/>
|
<location filename="../src/gui.cpp" line="557"/>
|
||||||
<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="525"/>
|
<location filename="../src/gui.cpp" line="534"/>
|
||||||
<source>Version </source>
|
<source>Version </source>
|
||||||
<translation>Verze </translation>
|
<translation>Verze </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="214"/>
|
<location filename="../src/gui.cpp" line="220"/>
|
||||||
<source>Print...</source>
|
<source>Print...</source>
|
||||||
<translation>Tisknout...</translation>
|
<translation>Tisknout...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="219"/>
|
<location filename="../src/gui.cpp" line="225"/>
|
||||||
<source>Export to PDF...</source>
|
<source>Export to PDF...</source>
|
||||||
<translation>Exportovat do PDF...</translation>
|
<translation>Exportovat do PDF...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="673"/>
|
<location filename="../src/gui.cpp" line="786"/>
|
||||||
<source>All POI files (*.gpx *.csv)</source>
|
|
||||||
<translation>Všechny POI soubory (*.gpx *.csv)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../src/gui.cpp" line="775"/>
|
|
||||||
<source>Waypoints</source>
|
<source>Waypoints</source>
|
||||||
<translation>Navigační body</translation>
|
<translation>Navigační body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="549"/>
|
<location filename="../src/gui.cpp" line="558"/>
|
||||||
<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="304"/>
|
<location filename="../src/gui.cpp" line="310"/>
|
||||||
<source>Route waypoints</source>
|
<source>Route waypoints</source>
|
||||||
<translation>Body tras</translation>
|
<translation>Body tras</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="551"/>
|
<location filename="../src/gui.cpp" line="560"/>
|
||||||
<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="552"/>
|
<location filename="../src/gui.cpp" line="561"/>
|
||||||
<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="553"/>
|
<location filename="../src/gui.cpp" line="562"/>
|
||||||
<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="572"/>
|
<location filename="../src/gui.cpp" line="581"/>
|
||||||
<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="575"/>
|
<location filename="../src/gui.cpp" line="584"/>
|
||||||
<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="583"/>
|
<location filename="../src/gui.cpp" line="592"/>
|
||||||
<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="594"/>
|
<location filename="../src/gui.cpp" line="603"/>
|
||||||
<source>GPX files (*.gpx);;All files (*)</source>
|
<location filename="../src/gui.cpp" line="684"/>
|
||||||
<translation>Soubory GPX (*.gpx);;Všechny soubory (*)</translation>
|
<source>All supported files (*.gpx *.tcx *.csv)</source>
|
||||||
|
<translation>Všechny podporované soubory (*.gpx *.tcx *.csv)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="663"/>
|
<location filename="../src/gui.cpp" line="674"/>
|
||||||
<location filename="../src/gui.cpp" line="692"/>
|
<location filename="../src/gui.cpp" line="703"/>
|
||||||
<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="771"/>
|
<location filename="../src/gui.cpp" line="782"/>
|
||||||
<source>Tracks</source>
|
<source>Tracks</source>
|
||||||
<translation>Cesty</translation>
|
<translation>Cesty</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="204"/>
|
<location filename="../src/gui.cpp" line="210"/>
|
||||||
<location filename="../src/gui.cpp" line="523"/>
|
<location filename="../src/gui.cpp" line="532"/>
|
||||||
<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="465"/>
|
<location filename="../src/gui.cpp" line="471"/>
|
||||||
<source>Navigation</source>
|
<source>Navigation</source>
|
||||||
<translation>Navigace</translation>
|
<translation>Navigace</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="571"/>
|
<location filename="../src/gui.cpp" line="580"/>
|
||||||
<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="582"/>
|
<location filename="../src/gui.cpp" line="591"/>
|
||||||
<source>POIs</source>
|
<source>POIs</source>
|
||||||
<translation>POI body</translation>
|
<translation>POI body</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="319"/>
|
<location filename="../src/gui.cpp" line="325"/>
|
||||||
<location filename="../src/gui.cpp" line="778"/>
|
<location filename="../src/gui.cpp" line="789"/>
|
||||||
<source>Distance</source>
|
<source>Distance</source>
|
||||||
<translation>Vzdálenost</translation>
|
<translation>Vzdálenost</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="326"/>
|
<location filename="../src/gui.cpp" line="332"/>
|
||||||
<location filename="../src/gui.cpp" line="780"/>
|
<location filename="../src/gui.cpp" line="791"/>
|
||||||
<source>Time</source>
|
<source>Time</source>
|
||||||
<translation>Čas</translation>
|
<translation>Čas</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="665"/>
|
<location filename="../src/gui.cpp" line="676"/>
|
||||||
<location filename="../src/gui.cpp" line="693"/>
|
<location filename="../src/gui.cpp" line="704"/>
|
||||||
<source>Error</source>
|
<source>Error</source>
|
||||||
<translation>Chyba</translation>
|
<translation>Chyba</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../src/gui.cpp" line="660"/>
|
<location filename="../src/gui.cpp" line="700"/>
|
||||||
<source>Error loading GPX file:
|
|
||||||
%1</source>
|
|
||||||
<translation>Soubor GPX nelze otevřít:
|
|
||||||
%1</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../src/gui.cpp" line="689"/>
|
|
||||||
<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:
|
||||||
|
48
src/csvparser.cpp
Normal file
48
src/csvparser.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#include "csvparser.h"
|
||||||
|
|
||||||
|
bool CSVParser::loadFile(QIODevice *device)
|
||||||
|
{
|
||||||
|
bool ret;
|
||||||
|
int ln = 1;
|
||||||
|
|
||||||
|
_errorLine = 0;
|
||||||
|
_errorString.clear();
|
||||||
|
|
||||||
|
while (!device->atEnd()) {
|
||||||
|
QByteArray line = device->readLine();
|
||||||
|
QList<QByteArray> list = line.split(',');
|
||||||
|
if (list.size() < 3) {
|
||||||
|
_errorString = "Parse error.";
|
||||||
|
_errorLine = ln;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal lat = list[0].trimmed().toDouble(&ret);
|
||||||
|
if (!ret) {
|
||||||
|
_errorString = "Invalid latitude.";
|
||||||
|
_errorLine = ln;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
qreal lon = list[1].trimmed().toDouble(&ret);
|
||||||
|
if (!ret) {
|
||||||
|
_errorString = "Invalid longitude.";
|
||||||
|
_errorLine = ln;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Waypoint wp(QPointF(lon, lat));
|
||||||
|
|
||||||
|
QByteArray ba = list[2].trimmed();
|
||||||
|
QString name = QString::fromUtf8(ba.data(), ba.size());
|
||||||
|
wp.setName(name);
|
||||||
|
|
||||||
|
if (list.size() > 3) {
|
||||||
|
ba = list[3].trimmed();
|
||||||
|
wp.setDescription(QString::fromUtf8(ba.data(), ba.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
_waypoints.append(wp);
|
||||||
|
ln++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
24
src/csvparser.h
Normal file
24
src/csvparser.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#ifndef CSVPARSER_H
|
||||||
|
#define CSVPARSER_H
|
||||||
|
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
class CSVParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSVParser(QList<QVector<Trackpoint> > &tracks,
|
||||||
|
QList<QVector<Waypoint> > &routes, QList<Waypoint> &waypoints)
|
||||||
|
: Parser(tracks, routes, waypoints) {_errorLine = 0;}
|
||||||
|
~CSVParser() {}
|
||||||
|
|
||||||
|
bool loadFile(QIODevice *device);
|
||||||
|
QString errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return _errorLine;}
|
||||||
|
const char *name() const {return "CSV";}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString _errorString;
|
||||||
|
int _errorLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CSVPARSER_H
|
62
src/data.cpp
Normal file
62
src/data.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include <QFile>
|
||||||
|
#include <QLineF>
|
||||||
|
#include "ll.h"
|
||||||
|
#include "gpxparser.h"
|
||||||
|
#include "tcxparser.h"
|
||||||
|
#include "csvparser.h"
|
||||||
|
#include "data.h"
|
||||||
|
|
||||||
|
|
||||||
|
Data::Data() : _errorLine(0)
|
||||||
|
{
|
||||||
|
_parsers << new GPXParser(_track_data, _route_data, _waypoint_data);
|
||||||
|
_parsers << new TCXParser(_track_data, _route_data, _waypoint_data);
|
||||||
|
_parsers << new CSVParser(_track_data, _route_data, _waypoint_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
Data::~Data()
|
||||||
|
{
|
||||||
|
for(int i = 0; i < _parsers.count(); i++)
|
||||||
|
delete _parsers.at(i);
|
||||||
|
|
||||||
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
|
delete _tracks.at(i);
|
||||||
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
|
delete _routes.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Data::loadFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
QFile file(fileName);
|
||||||
|
|
||||||
|
_errorString.clear();
|
||||||
|
_errorLine = 0;
|
||||||
|
|
||||||
|
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
||||||
|
_errorString = qPrintable(file.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _parsers.size(); i++) {
|
||||||
|
if (_parsers.at(i)->loadFile(&file)) {
|
||||||
|
for (int i = 0; i < _track_data.count(); i++)
|
||||||
|
_tracks.append(new Track(_track_data.at(i)));
|
||||||
|
for (int i = 0; i < _route_data.count(); i++)
|
||||||
|
_routes.append(new Route(_route_data.at(i)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
file.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "Error loading data file: %s:\n", qPrintable(fileName));
|
||||||
|
for (int i = 0; i < _parsers.size(); i++) {
|
||||||
|
fprintf(stderr, "%s: line %d: %s\n", _parsers.at(i)->name(),
|
||||||
|
_parsers.at(i)->errorLine(), qPrintable(_parsers.at(i)->errorString()));
|
||||||
|
if (_parsers.at(i)->errorLine() > _errorLine) {
|
||||||
|
_errorLine = _parsers.at(i)->errorLine();
|
||||||
|
_errorString = _parsers.at(i)->errorString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
#ifndef GPX_H
|
#ifndef DATA_H
|
||||||
#define GPX_H
|
#define DATA_H
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
@ -8,16 +8,17 @@
|
|||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
#include "track.h"
|
#include "track.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
#include "parser.h"
|
|
||||||
|
|
||||||
class GPX
|
class Parser;
|
||||||
|
|
||||||
|
class Data
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GPX();
|
Data();
|
||||||
~GPX();
|
~Data();
|
||||||
|
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
const QString &errorString() const {return _error;}
|
const QString &errorString() const {return _errorString;}
|
||||||
int errorLine() const {return _errorLine;}
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
const QList<Track*> &tracks() const {return _tracks;}
|
const QList<Track*> &tracks() const {return _tracks;}
|
||||||
@ -25,9 +26,9 @@ public:
|
|||||||
const QList<Waypoint> &waypoints() const {return _waypoint_data;}
|
const QList<Waypoint> &waypoints() const {return _waypoint_data;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Parser _parser;
|
QString _errorString;
|
||||||
QString _error;
|
|
||||||
int _errorLine;
|
int _errorLine;
|
||||||
|
QList<Parser*> _parsers;
|
||||||
|
|
||||||
QList<Track*> _tracks;
|
QList<Track*> _tracks;
|
||||||
QList<Route*> _routes;
|
QList<Route*> _routes;
|
||||||
@ -37,4 +38,4 @@ private:
|
|||||||
QList<Waypoint> _waypoint_data;
|
QList<Waypoint> _waypoint_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GPX_H
|
#endif // DATA_H
|
@ -1,6 +1,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "elevationgraph.h"
|
#include "elevationgraph.h"
|
||||||
|
|
||||||
|
|
||||||
@ -107,14 +107,14 @@ void ElevationGraph::loadGraph(const Graph &graph, Type type, PathItem *path)
|
|||||||
GraphView::loadGraph(graph, path, type);
|
GraphView::loadGraph(graph, path, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
|
void ElevationGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
{
|
{
|
||||||
int p = 0;
|
int p = 0;
|
||||||
|
|
||||||
for (int i = 0; i < gpx.tracks().count(); i++)
|
for (int i = 0; i < data.tracks().count(); i++)
|
||||||
loadGraph(gpx.tracks().at(i)->elevation(), Track, paths.at(p++));
|
loadGraph(data.tracks().at(i)->elevation(), Track, paths.at(p++));
|
||||||
for (int i = 0; i < gpx.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
loadGraph(gpx.routes().at(i)->elevation(), Route, paths.at(p++));
|
loadGraph(data.routes().at(i)->elevation(), Route, paths.at(p++));
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
ElevationGraph(QWidget *parent = 0);
|
ElevationGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Elevation");}
|
QString label() const {return tr("Elevation");}
|
||||||
void loadGPX(const GPX &gpx, const QList<PathItem *> &paths);
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
47
src/gpx.cpp
47
src/gpx.cpp
@ -1,47 +0,0 @@
|
|||||||
#include <QFile>
|
|
||||||
#include <QLineF>
|
|
||||||
#include "ll.h"
|
|
||||||
#include "gpx.h"
|
|
||||||
|
|
||||||
|
|
||||||
GPX::GPX() : _parser(_track_data, _route_data, _waypoint_data), _errorLine(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
GPX::~GPX()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _tracks.count(); i++)
|
|
||||||
delete _tracks.at(i);
|
|
||||||
for (int i = 0; i < _routes.count(); i++)
|
|
||||||
delete _routes.at(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GPX::loadFile(const QString &fileName)
|
|
||||||
{
|
|
||||||
bool ret;
|
|
||||||
QFile file(fileName);
|
|
||||||
|
|
||||||
|
|
||||||
_error.clear();
|
|
||||||
_errorLine = 0;
|
|
||||||
|
|
||||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
|
||||||
_error = qPrintable(file.errorString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = _parser.loadFile(&file);
|
|
||||||
file.close();
|
|
||||||
if (ret == false) {
|
|
||||||
_error = _parser.errorString();
|
|
||||||
_errorLine = _parser.errorLine();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < _track_data.count(); i++)
|
|
||||||
_tracks.append(new Track(_track_data.at(i)));
|
|
||||||
for (int i = 0; i < _route_data.count(); i++)
|
|
||||||
_routes.append(new Route(_route_data.at(i)));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
@ -1,18 +1,18 @@
|
|||||||
#include "parser.h"
|
#include "gpxparser.h"
|
||||||
|
|
||||||
|
|
||||||
void Parser::handleTrackpointData(DataType type, const QString &value)
|
void GPXParser::handleTrackpointData(DataType type, const QString &value)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Elevation:
|
case Elevation:
|
||||||
_track->last().setElevation(value.toLatin1().toDouble());
|
_track->last().setElevation(value.toDouble());
|
||||||
break;
|
break;
|
||||||
case Time:
|
case Time:
|
||||||
_track->last().setTimestamp(QDateTime::fromString(value.toLatin1(),
|
_track->last().setTimestamp(QDateTime::fromString(value,
|
||||||
Qt::ISODate));
|
Qt::ISODate));
|
||||||
break;
|
break;
|
||||||
case Geoidheight:
|
case Geoidheight:
|
||||||
_track->last().setGeoidHeight(value.toLatin1().toDouble());
|
_track->last().setGeoidHeight(value.toDouble());
|
||||||
break;
|
break;
|
||||||
case Speed:
|
case Speed:
|
||||||
_track->last().setSpeed(value.toDouble());
|
_track->last().setSpeed(value.toDouble());
|
||||||
@ -28,7 +28,7 @@ void Parser::handleTrackpointData(DataType type, const QString &value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::handleWaypointData(DataType type, const QString &value)
|
void GPXParser::handleWaypointData(DataType type, const QString &value)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Name:
|
case Name:
|
||||||
@ -38,21 +38,21 @@ void Parser::handleWaypointData(DataType type, const QString &value)
|
|||||||
_waypoints.last().setDescription(value);
|
_waypoints.last().setDescription(value);
|
||||||
break;
|
break;
|
||||||
case Time:
|
case Time:
|
||||||
_waypoints.last().setTimestamp(QDateTime::fromString(
|
_waypoints.last().setTimestamp(QDateTime::fromString(value,
|
||||||
value.toLatin1(), Qt::ISODate));
|
Qt::ISODate));
|
||||||
break;
|
break;
|
||||||
case Elevation:
|
case Elevation:
|
||||||
_waypoints.last().setElevation(value.toLatin1().toDouble());
|
_waypoints.last().setElevation(value.toDouble());
|
||||||
break;
|
break;
|
||||||
case Geoidheight:
|
case Geoidheight:
|
||||||
_waypoints.last().setGeoidHeight(value.toLatin1().toDouble());
|
_waypoints.last().setGeoidHeight(value.toDouble());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::handleRoutepointData(DataType type, const QString &value)
|
void GPXParser::handleRoutepointData(DataType type, const QString &value)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Name:
|
case Name:
|
||||||
@ -62,42 +62,42 @@ void Parser::handleRoutepointData(DataType type, const QString &value)
|
|||||||
_route->last().setDescription(value);
|
_route->last().setDescription(value);
|
||||||
break;
|
break;
|
||||||
case Time:
|
case Time:
|
||||||
_route->last().setTimestamp(QDateTime::fromString(
|
_route->last().setTimestamp(QDateTime::fromString(value,
|
||||||
value.toLatin1(), Qt::ISODate));
|
Qt::ISODate));
|
||||||
break;
|
break;
|
||||||
case Elevation:
|
case Elevation:
|
||||||
_route->last().setElevation(value.toLatin1().toDouble());
|
_route->last().setElevation(value.toDouble());
|
||||||
break;
|
break;
|
||||||
case Geoidheight:
|
case Geoidheight:
|
||||||
_route->last().setGeoidHeight(value.toLatin1().toDouble());
|
_route->last().setGeoidHeight(value.toDouble());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::handleTrackpointAttributes(const QXmlStreamAttributes &attr)
|
void GPXParser::handleTrackpointAttributes(const QXmlStreamAttributes &attr)
|
||||||
{
|
{
|
||||||
_track->last().setCoordinates(QPointF(
|
_track->last().setCoordinates(QPointF(
|
||||||
attr.value("lon").toLatin1().toDouble(),
|
attr.value("lon").toDouble(),
|
||||||
attr.value("lat").toLatin1().toDouble()));
|
attr.value("lat").toDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::handleRoutepointAttributes(const QXmlStreamAttributes &attr)
|
void GPXParser::handleRoutepointAttributes(const QXmlStreamAttributes &attr)
|
||||||
{
|
{
|
||||||
_route->last().setCoordinates(QPointF(
|
_route->last().setCoordinates(QPointF(
|
||||||
attr.value("lon").toLatin1().toDouble(),
|
attr.value("lon").toDouble(),
|
||||||
attr.value("lat").toLatin1().toDouble()));
|
attr.value("lat").toDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::handleWaypointAttributes(const QXmlStreamAttributes &attr)
|
void GPXParser::handleWaypointAttributes(const QXmlStreamAttributes &attr)
|
||||||
{
|
{
|
||||||
_waypoints.last().setCoordinates(QPointF(
|
_waypoints.last().setCoordinates(QPointF(
|
||||||
attr.value("lon").toLatin1().toDouble(),
|
attr.value("lon").toDouble(),
|
||||||
attr.value("lat").toLatin1().toDouble()));
|
attr.value("lat").toDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::tpExtension()
|
void GPXParser::tpExtension()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "hr")
|
if (_reader.name() == "hr")
|
||||||
@ -109,7 +109,7 @@ void Parser::tpExtension()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::extensions()
|
void GPXParser::extensions()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "speed")
|
if (_reader.name() == "speed")
|
||||||
@ -125,7 +125,7 @@ void Parser::extensions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::trackpointData()
|
void GPXParser::trackpointData()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "ele")
|
if (_reader.name() == "ele")
|
||||||
@ -141,7 +141,7 @@ void Parser::trackpointData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::routepointData()
|
void GPXParser::routepointData()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "name")
|
if (_reader.name() == "name")
|
||||||
@ -159,41 +159,7 @@ void Parser::routepointData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::trackpoints()
|
void GPXParser::waypointData()
|
||||||
{
|
|
||||||
while (_reader.readNextStartElement()) {
|
|
||||||
if (_reader.name() == "trkpt") {
|
|
||||||
_track->append(Trackpoint());
|
|
||||||
handleTrackpointAttributes(_reader.attributes());
|
|
||||||
trackpointData();
|
|
||||||
} else
|
|
||||||
_reader.skipCurrentElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parser::routepoints()
|
|
||||||
{
|
|
||||||
while (_reader.readNextStartElement()) {
|
|
||||||
if (_reader.name() == "rtept") {
|
|
||||||
_route->append(Waypoint());
|
|
||||||
handleRoutepointAttributes(_reader.attributes());
|
|
||||||
routepointData();
|
|
||||||
} else
|
|
||||||
_reader.skipCurrentElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parser::track()
|
|
||||||
{
|
|
||||||
while (_reader.readNextStartElement()) {
|
|
||||||
if (_reader.name() == "trkseg") {
|
|
||||||
trackpoints();
|
|
||||||
} else
|
|
||||||
_reader.skipCurrentElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parser::waypointData()
|
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "name")
|
if (_reader.name() == "name")
|
||||||
@ -211,7 +177,41 @@ void Parser::waypointData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::gpx()
|
void GPXParser::trackpoints()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "trkpt") {
|
||||||
|
_track->append(Trackpoint());
|
||||||
|
handleTrackpointAttributes(_reader.attributes());
|
||||||
|
trackpointData();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::routepoints()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "rtept") {
|
||||||
|
_route->append(Waypoint());
|
||||||
|
handleRoutepointAttributes(_reader.attributes());
|
||||||
|
routepointData();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::track()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "trkseg") {
|
||||||
|
trackpoints();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::gpx()
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "trk") {
|
if (_reader.name() == "trk") {
|
||||||
@ -231,7 +231,7 @@ void Parser::gpx()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::parse()
|
bool GPXParser::parse()
|
||||||
{
|
{
|
||||||
if (_reader.readNextStartElement()) {
|
if (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "gpx")
|
if (_reader.name() == "gpx")
|
||||||
@ -243,7 +243,7 @@ bool Parser::parse()
|
|||||||
return !_reader.error();
|
return !_reader.error();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::loadFile(QIODevice *device)
|
bool GPXParser::loadFile(QIODevice *device)
|
||||||
{
|
{
|
||||||
_reader.clear();
|
_reader.clear();
|
||||||
_reader.setDevice(device);
|
_reader.setDevice(device);
|
51
src/gpxparser.h
Normal file
51
src/gpxparser.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef GPXPARSER_H
|
||||||
|
#define GPXPARSER_H
|
||||||
|
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include <QVector>
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class GPXParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GPXParser(QList<QVector<Trackpoint> > &tracks,
|
||||||
|
QList<QVector<Waypoint> > &routes, QList<Waypoint> &waypoints)
|
||||||
|
: Parser(tracks, routes, waypoints) {_track = 0; _route = 0;}
|
||||||
|
~GPXParser() {}
|
||||||
|
|
||||||
|
bool loadFile(QIODevice *device);
|
||||||
|
QString errorString() const {return _reader.errorString();}
|
||||||
|
int errorLine() const {return _reader.lineNumber();}
|
||||||
|
const char *name() const {return "GPX";}
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum DataType {
|
||||||
|
Name, Description, Elevation, Time, Geoidheight, Speed, HeartRate,
|
||||||
|
Temperature
|
||||||
|
};
|
||||||
|
|
||||||
|
bool parse();
|
||||||
|
void gpx();
|
||||||
|
void track();
|
||||||
|
void trackpoints();
|
||||||
|
void routepoints();
|
||||||
|
void tpExtension();
|
||||||
|
void extensions();
|
||||||
|
void trackpointData();
|
||||||
|
void routepointData();
|
||||||
|
void waypointData();
|
||||||
|
|
||||||
|
void handleWaypointAttributes(const QXmlStreamAttributes &attr);
|
||||||
|
void handleWaypointData(DataType type, const QString &value);
|
||||||
|
void handleTrackpointAttributes(const QXmlStreamAttributes &attr);
|
||||||
|
void handleTrackpointData(DataType type, const QString &value);
|
||||||
|
void handleRoutepointAttributes(const QXmlStreamAttributes &attr);
|
||||||
|
void handleRoutepointData(DataType type, const QString &value);
|
||||||
|
|
||||||
|
QXmlStreamReader _reader;
|
||||||
|
QVector<Trackpoint> *_track;
|
||||||
|
QVector<Waypoint> *_route;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GPXPARSER_H
|
@ -5,7 +5,7 @@
|
|||||||
#include "graphview.h"
|
#include "graphview.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
|
||||||
class GPX;
|
class Data;
|
||||||
class PathItem;
|
class PathItem;
|
||||||
|
|
||||||
class GraphTab : public GraphView
|
class GraphTab : public GraphView
|
||||||
@ -17,7 +17,7 @@ public:
|
|||||||
{setFrameShape(QFrame::NoFrame);}
|
{setFrameShape(QFrame::NoFrame);}
|
||||||
|
|
||||||
virtual QString label() const = 0;
|
virtual QString label() const = 0;
|
||||||
virtual void loadGPX(const GPX &gpx, const QList<PathItem *> &paths) = 0;
|
virtual void loadData(const Data &data, const QList<PathItem *> &paths) = 0;
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
virtual void setUnits(enum Units units) = 0;
|
virtual void setUnits(enum Units units) = 0;
|
||||||
virtual void showTracks(bool show) = 0;
|
virtual void showTracks(bool show) = 0;
|
||||||
|
53
src/gui.cpp
53
src/gui.cpp
@ -26,7 +26,7 @@
|
|||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "maplist.h"
|
#include "maplist.h"
|
||||||
#include "elevationgraph.h"
|
#include "elevationgraph.h"
|
||||||
@ -55,8 +55,7 @@ GUI::GUI(QWidget *parent) : QMainWindow(parent)
|
|||||||
createMenus();
|
createMenus();
|
||||||
createToolBars();
|
createToolBars();
|
||||||
|
|
||||||
_browser = new FileBrowser(this);
|
createBrowser();
|
||||||
_browser->setFilter(QStringList("*.gpx"));
|
|
||||||
|
|
||||||
QSplitter *splitter = new QSplitter();
|
QSplitter *splitter = new QSplitter();
|
||||||
splitter->setOrientation(Qt::Vertical);
|
splitter->setOrientation(Qt::Vertical);
|
||||||
@ -105,6 +104,14 @@ GUI::~GUI()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::createBrowser()
|
||||||
|
{
|
||||||
|
QStringList filter;
|
||||||
|
filter << "*.gpx" << "*.tcx" << "*.csv";
|
||||||
|
_browser = new FileBrowser(this);
|
||||||
|
_browser->setFilter(filter);
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::loadMaps()
|
void GUI::loadMaps()
|
||||||
{
|
{
|
||||||
if (QFile::exists(USER_MAP_FILE))
|
if (QFile::exists(USER_MAP_FILE))
|
||||||
@ -593,7 +600,9 @@ void GUI::dataSources()
|
|||||||
void GUI::openFile()
|
void GUI::openFile()
|
||||||
{
|
{
|
||||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"),
|
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"),
|
||||||
QString(), tr("GPX files (*.gpx);;All files (*)"));
|
QString(), tr("All supported files (*.gpx *.tcx *.csv)") + ";;"
|
||||||
|
+ tr("GPX files (*.gpx)") + ";;" + tr("TCX files (*.tcx)") + ";;"
|
||||||
|
+ tr("CSV files (*.csv)") + ";;" + tr("All files (*)"));
|
||||||
QStringList list = files;
|
QStringList list = files;
|
||||||
|
|
||||||
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
|
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
|
||||||
@ -629,40 +638,40 @@ bool GUI::openFile(const QString &fileName)
|
|||||||
|
|
||||||
bool GUI::loadFile(const QString &fileName)
|
bool GUI::loadFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
GPX gpx;
|
Data data;
|
||||||
QList<PathItem*> paths;
|
QList<PathItem*> paths;
|
||||||
|
|
||||||
if (gpx.loadFile(fileName)) {
|
if (data.loadFile(fileName)) {
|
||||||
paths = _pathView->loadGPX(gpx);
|
paths = _pathView->loadData(data);
|
||||||
for (int i = 0; i < _tabs.count(); i++)
|
for (int i = 0; i < _tabs.count(); i++)
|
||||||
_tabs.at(i)->loadGPX(gpx, paths);
|
_tabs.at(i)->loadData(data, paths);
|
||||||
updateGraphTabs();
|
updateGraphTabs();
|
||||||
_pathView->setHidden(false);
|
_pathView->setHidden(false);
|
||||||
|
|
||||||
for (int i = 0; i < gpx.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
_trackDistance += gpx.tracks().at(i)->distance();
|
_trackDistance += data.tracks().at(i)->distance();
|
||||||
_time += gpx.tracks().at(i)->time();
|
_time += data.tracks().at(i)->time();
|
||||||
const QDate &date = gpx.tracks().at(i)->date().date();
|
const QDate &date = data.tracks().at(i)->date().date();
|
||||||
if (_dateRange.first.isNull() || _dateRange.first > date)
|
if (_dateRange.first.isNull() || _dateRange.first > date)
|
||||||
_dateRange.first = date;
|
_dateRange.first = date;
|
||||||
if (_dateRange.second.isNull() || _dateRange.second < date)
|
if (_dateRange.second.isNull() || _dateRange.second < date)
|
||||||
_dateRange.second = date;
|
_dateRange.second = date;
|
||||||
}
|
}
|
||||||
_trackCount += gpx.tracks().count();
|
_trackCount += data.tracks().count();
|
||||||
|
|
||||||
for (int i = 0; i < gpx.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
_routeDistance += gpx.routes().at(i)->distance();
|
_routeDistance += data.routes().at(i)->distance();
|
||||||
_routeCount += gpx.routes().count();
|
_routeCount += data.routes().count();
|
||||||
|
|
||||||
_waypointCount += gpx.waypoints().count();
|
_waypointCount += data.waypoints().count();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
QString error = fileName + QString("\n\n")
|
QString error = fileName + QString("\n\n")
|
||||||
+ tr("Error loading GPX file:\n%1").arg(gpx.errorString())
|
+ tr("Error loading data file:\n%1").arg(data.errorString())
|
||||||
+ QString("\n");
|
+ QString("\n");
|
||||||
if (gpx.errorLine())
|
if (data.errorLine())
|
||||||
error.append(tr("Line: %1").arg(gpx.errorLine()));
|
error.append(tr("Line: %1").arg(data.errorLine()));
|
||||||
|
|
||||||
QMessageBox::critical(this, tr("Error"), error);
|
QMessageBox::critical(this, tr("Error"), error);
|
||||||
return false;
|
return false;
|
||||||
@ -672,9 +681,9 @@ bool GUI::loadFile(const QString &fileName)
|
|||||||
void GUI::openPOIFile()
|
void GUI::openPOIFile()
|
||||||
{
|
{
|
||||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"),
|
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open POI file"),
|
||||||
QString(), tr("All POI files (*.gpx *.csv)") + ";;"
|
QString(), tr("All supported files (*.gpx *.tcx *.csv)") + ";;"
|
||||||
+ tr("GPX files (*.gpx)") + ";;" + tr("CSV files (*.csv)") + ";;"
|
+ tr("GPX files (*.gpx)") + ";;" + tr("CSV files (*.csv)") + ";;"
|
||||||
+ tr("All files (*)"));
|
+ tr("TCX files (*.tcx)") + ";;" + tr("All files (*)"));
|
||||||
QStringList list = files;
|
QStringList list = files;
|
||||||
|
|
||||||
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
|
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
|
||||||
|
@ -89,6 +89,7 @@ private:
|
|||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createPathView();
|
void createPathView();
|
||||||
void createGraphTabs();
|
void createGraphTabs();
|
||||||
|
void createBrowser();
|
||||||
|
|
||||||
bool openPOIFile(const QString &fileName);
|
bool openPOIFile(const QString &fileName);
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "heartrategraph.h"
|
#include "heartrategraph.h"
|
||||||
|
|
||||||
|
|
||||||
@ -24,10 +24,10 @@ void HeartRateGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
|
void HeartRateGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gpx.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
const Graph &graph = gpx.tracks().at(i)->heartRate();
|
const Graph &graph = data.tracks().at(i)->heartRate();
|
||||||
qreal sum = 0, w = 0;
|
qreal sum = 0, w = 0;
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
@ -40,12 +40,12 @@ void HeartRateGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
|
|||||||
sum += graph.at(j).y() * ds;
|
sum += graph.at(j).y() * ds;
|
||||||
w += ds;
|
w += ds;
|
||||||
}
|
}
|
||||||
_avg.append(QPointF(gpx.tracks().at(i)->distance(), sum/w));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||||
|
|
||||||
GraphView::loadGraph(graph, paths.at(i));
|
GraphView::loadGraph(graph, paths.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < gpx.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
skipColor();
|
skipColor();
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
HeartRateGraph(QWidget *parent = 0);
|
HeartRateGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Heart rate");}
|
QString label() const {return tr("Heart rate");}
|
||||||
void loadGPX(const GPX &gpx, const QList<PathItem *> &paths);
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units) {}
|
void setUnits(enum Units) {}
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
43
src/parser.h
43
src/parser.h
@ -1,55 +1,30 @@
|
|||||||
#ifndef PARSER_H
|
#ifndef PARSER_H
|
||||||
#define PARSER_H
|
#define PARSER_H
|
||||||
|
|
||||||
#include <QXmlStreamReader>
|
#include <QString>
|
||||||
#include <QVector>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "trackpoint.h"
|
#include "trackpoint.h"
|
||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
|
|
||||||
|
class QIODevice;
|
||||||
|
|
||||||
class Parser
|
class Parser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Parser(QList<QVector<Trackpoint> > &tracks,
|
Parser(QList<QVector<Trackpoint> > &tracks,
|
||||||
QList<QVector<Waypoint> > &routes, QList<Waypoint> &waypoints)
|
QList<QVector<Waypoint> > &routes, QList<Waypoint> &waypoints)
|
||||||
: _tracks(tracks), _routes(routes), _waypoints(waypoints)
|
: _tracks(tracks), _routes(routes), _waypoints(waypoints) {}
|
||||||
{_track = 0; _route = 0;}
|
virtual ~Parser() {}
|
||||||
|
|
||||||
bool loadFile(QIODevice *device);
|
virtual bool loadFile(QIODevice *device) = 0;
|
||||||
QString errorString() const {return _reader.errorString();}
|
virtual QString errorString() const = 0;
|
||||||
int errorLine() const {return _reader.lineNumber();}
|
virtual int errorLine() const = 0;
|
||||||
|
virtual const char *name() const = 0;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
enum DataType {
|
|
||||||
Name, Description, Elevation, Time, Geoidheight, Speed, HeartRate,
|
|
||||||
Temperature
|
|
||||||
};
|
|
||||||
|
|
||||||
bool parse();
|
|
||||||
void gpx();
|
|
||||||
void track();
|
|
||||||
void trackpoints();
|
|
||||||
void routepoints();
|
|
||||||
void tpExtension();
|
|
||||||
void extensions();
|
|
||||||
void trackpointData();
|
|
||||||
void routepointData();
|
|
||||||
void waypointData();
|
|
||||||
|
|
||||||
void handleWaypointAttributes(const QXmlStreamAttributes &attr);
|
|
||||||
void handleWaypointData(DataType type, const QString &value);
|
|
||||||
void handleTrackpointAttributes(const QXmlStreamAttributes &attr);
|
|
||||||
void handleTrackpointData(DataType type, const QString &value);
|
|
||||||
void handleRoutepointAttributes(const QXmlStreamAttributes &attr);
|
|
||||||
void handleRoutepointData(DataType type, const QString &value);
|
|
||||||
|
|
||||||
QXmlStreamReader _reader;
|
|
||||||
QList<QVector<Trackpoint> > &_tracks;
|
QList<QVector<Trackpoint> > &_tracks;
|
||||||
QList<QVector<Waypoint> > &_routes;
|
QList<QVector<Waypoint> > &_routes;
|
||||||
QList<Waypoint> &_waypoints;
|
QList<Waypoint> &_waypoints;
|
||||||
QVector<Trackpoint> *_track;
|
|
||||||
QVector<Waypoint> *_route;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PARSER_H
|
#endif // PARSER_H
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "trackitem.h"
|
#include "trackitem.h"
|
||||||
#include "routeitem.h"
|
#include "routeitem.h"
|
||||||
@ -124,17 +124,17 @@ void PathView::addWaypoints(const QList<Waypoint> &waypoints)
|
|||||||
_scale = mapScale(_zoom);
|
_scale = mapScale(_zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PathItem *> PathView::loadGPX(const GPX &gpx)
|
QList<PathItem *> PathView::loadData(const Data &data)
|
||||||
{
|
{
|
||||||
QList<PathItem *> paths;
|
QList<PathItem *> paths;
|
||||||
int zoom = _zoom;
|
int zoom = _zoom;
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < gpx.tracks().count(); i++)
|
for (int i = 0; i < data.tracks().count(); i++)
|
||||||
paths.append(addTrack(*(gpx.tracks().at(i))));
|
paths.append(addTrack(*(data.tracks().at(i))));
|
||||||
for (int i = 0; i < gpx.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
paths.append(addRoute(*(gpx.routes().at(i))));
|
paths.append(addRoute(*(data.routes().at(i))));
|
||||||
addWaypoints(gpx.waypoints());
|
addWaypoints(data.waypoints());
|
||||||
|
|
||||||
if (_tracks.empty() && _routes.empty() && _waypoints.empty())
|
if (_tracks.empty() && _routes.empty() && _waypoints.empty())
|
||||||
return paths;
|
return paths;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
|
|
||||||
class GPX;
|
class Data;
|
||||||
class POI;
|
class POI;
|
||||||
class Map;
|
class Map;
|
||||||
class Track;
|
class Track;
|
||||||
@ -28,7 +28,7 @@ public:
|
|||||||
PathView(QWidget *parent = 0);
|
PathView(QWidget *parent = 0);
|
||||||
~PathView();
|
~PathView();
|
||||||
|
|
||||||
QList<PathItem*> loadGPX(const GPX &gpx);
|
QList<PathItem*> loadData(const Data &data);
|
||||||
|
|
||||||
void setPOI(POI *poi);
|
void setPOI(POI *poi);
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
|
120
src/poi.cpp
120
src/poi.cpp
@ -4,7 +4,7 @@
|
|||||||
#include "pathitem.h"
|
#include "pathitem.h"
|
||||||
#include "waypointitem.h"
|
#include "waypointitem.h"
|
||||||
#include "ll.h"
|
#include "ll.h"
|
||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
|
|
||||||
|
|
||||||
@ -16,47 +16,23 @@ POI::POI(QObject *parent) : QObject(parent)
|
|||||||
|
|
||||||
bool POI::loadFile(const QString &fileName)
|
bool POI::loadFile(const QString &fileName)
|
||||||
{
|
{
|
||||||
QString error;
|
Data data;
|
||||||
int errorLine;
|
FileIndex index;
|
||||||
|
|
||||||
_error.clear();
|
_errorString.clear();
|
||||||
_errorLine = 0;
|
_errorLine = 0;
|
||||||
|
|
||||||
if (loadCSVFile(fileName)) {
|
|
||||||
emit pointsChanged();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
error = _error;
|
|
||||||
errorLine = _errorLine;
|
|
||||||
}
|
|
||||||
if (loadGPXFile(fileName)) {
|
|
||||||
emit pointsChanged();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr, "Error loading POI file: %s:\n", qPrintable(fileName));
|
|
||||||
fprintf(stderr, "CSV: line %d: %s\n", errorLine, qPrintable(error));
|
|
||||||
fprintf(stderr, "GPX: line %d: %s\n", _errorLine, qPrintable(_error));
|
|
||||||
|
|
||||||
if (errorLine > _errorLine) {
|
|
||||||
_errorLine = errorLine;
|
|
||||||
_error = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool POI::loadGPXFile(const QString &fileName)
|
|
||||||
{
|
|
||||||
GPX gpx;
|
|
||||||
FileIndex index;
|
|
||||||
|
|
||||||
index.enabled = true;
|
index.enabled = true;
|
||||||
index.start = _data.size();
|
index.start = _data.size();
|
||||||
|
|
||||||
if (gpx.loadFile(fileName)) {
|
if (!data.loadFile(fileName)) {
|
||||||
for (int i = 0; i < gpx.waypoints().size(); i++)
|
_errorString = data.errorString();
|
||||||
_data.append(gpx.waypoints().at(i));
|
_errorLine = data.errorLine();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < data.waypoints().size(); i++)
|
||||||
|
_data.append(data.waypoints().at(i));
|
||||||
index.end = _data.size() - 1;
|
index.end = _data.size() - 1;
|
||||||
|
|
||||||
for (int i = index.start; i <= index.end; i++) {
|
for (int i = index.start; i <= index.end; i++) {
|
||||||
@ -70,77 +46,7 @@ bool POI::loadGPXFile(const QString &fileName)
|
|||||||
_files.append(fileName);
|
_files.append(fileName);
|
||||||
_indexes.append(index);
|
_indexes.append(index);
|
||||||
|
|
||||||
return true;
|
emit pointsChanged();
|
||||||
} else {
|
|
||||||
_error = gpx.errorString();
|
|
||||||
_errorLine = gpx.errorLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool POI::loadCSVFile(const QString &fileName)
|
|
||||||
{
|
|
||||||
QFile file(fileName);
|
|
||||||
FileIndex index;
|
|
||||||
bool ret;
|
|
||||||
int ln = 1;
|
|
||||||
|
|
||||||
index.enabled = true;
|
|
||||||
index.start = _data.size();
|
|
||||||
|
|
||||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
|
||||||
_error = qPrintable(file.errorString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!file.atEnd()) {
|
|
||||||
QByteArray line = file.readLine();
|
|
||||||
QList<QByteArray> list = line.split(',');
|
|
||||||
if (list.size() < 3) {
|
|
||||||
_error = "Parse error.";
|
|
||||||
_errorLine = ln;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
qreal lat = list[0].trimmed().toDouble(&ret);
|
|
||||||
if (!ret) {
|
|
||||||
_error = "Invalid latitude.";
|
|
||||||
_errorLine = ln;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
qreal lon = list[1].trimmed().toDouble(&ret);
|
|
||||||
if (!ret) {
|
|
||||||
_error = "Invalid longitude.";
|
|
||||||
_errorLine = ln;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Waypoint wp(QPointF(lon, lat));
|
|
||||||
|
|
||||||
QByteArray ba = list[2].trimmed();
|
|
||||||
QString name = QString::fromUtf8(ba.data(), ba.size());
|
|
||||||
wp.setName(name);
|
|
||||||
|
|
||||||
if (list.size() > 3) {
|
|
||||||
ba = list[3].trimmed();
|
|
||||||
wp.setDescription(QString::fromUtf8(ba.data(), ba.size()));
|
|
||||||
}
|
|
||||||
|
|
||||||
_data.append(wp);
|
|
||||||
ln++;
|
|
||||||
}
|
|
||||||
index.end = _data.size() - 1;
|
|
||||||
|
|
||||||
for (int i = index.start; i <= index.end; i++) {
|
|
||||||
const QPointF &p = _data.at(i).coordinates();
|
|
||||||
qreal c[2];
|
|
||||||
c[0] = p.x();
|
|
||||||
c[1] = p.y();
|
|
||||||
_tree.Insert(c, c, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
_files.append(fileName);
|
|
||||||
_indexes.append(index);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public:
|
|||||||
POI(QObject *parent = 0);
|
POI(QObject *parent = 0);
|
||||||
|
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
const QString &errorString() const {return _error;}
|
const QString &errorString() const {return _errorString;}
|
||||||
int errorLine() const {return _errorLine;}
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
qreal radius() const {return _radius;}
|
qreal radius() const {return _radius;}
|
||||||
@ -44,9 +44,6 @@ private:
|
|||||||
bool enabled;
|
bool enabled;
|
||||||
} FileIndex;
|
} FileIndex;
|
||||||
|
|
||||||
bool loadCSVFile(const QString &fileName);
|
|
||||||
bool loadGPXFile(const QString &fileName);
|
|
||||||
|
|
||||||
POITree _tree;
|
POITree _tree;
|
||||||
QVector<Waypoint> _data;
|
QVector<Waypoint> _data;
|
||||||
QStringList _files;
|
QStringList _files;
|
||||||
@ -54,7 +51,7 @@ private:
|
|||||||
|
|
||||||
qreal _radius;
|
qreal _radius;
|
||||||
|
|
||||||
QString _error;
|
QString _errorString;
|
||||||
int _errorLine;
|
int _errorLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "speedgraph.h"
|
#include "speedgraph.h"
|
||||||
|
|
||||||
|
|
||||||
@ -25,22 +25,22 @@ void SpeedGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpeedGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
|
void SpeedGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gpx.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
const Graph &graph = gpx.tracks().at(i)->speed();
|
const Graph &graph = data.tracks().at(i)->speed();
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
_avg.append(QPointF(gpx.tracks().at(i)->distance(),
|
_avg.append(QPointF(data.tracks().at(i)->distance(),
|
||||||
gpx.tracks().at(i)->distance() / gpx.tracks().at(i)->time()));
|
data.tracks().at(i)->distance() / data.tracks().at(i)->time()));
|
||||||
|
|
||||||
GraphView::loadGraph(graph, paths.at(i));
|
GraphView::loadGraph(graph, paths.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < gpx.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
skipColor();
|
skipColor();
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
@ -12,7 +12,7 @@ public:
|
|||||||
SpeedGraph(QWidget *parent = 0);
|
SpeedGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Speed");}
|
QString label() const {return tr("Speed");}
|
||||||
void loadGPX(const GPX &gpx, const QList<PathItem *> &paths);
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
181
src/tcxparser.cpp
Normal file
181
src/tcxparser.cpp
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
#include "tcxparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
QPointF TCXParser::position()
|
||||||
|
{
|
||||||
|
QPointF pos;
|
||||||
|
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "LatitudeDegrees")
|
||||||
|
pos.setY(_reader.readElementText().toDouble());
|
||||||
|
else if (_reader.name() == "LongitudeDegrees")
|
||||||
|
pos.setX(_reader.readElementText().toDouble());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::trackpointData()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Position")
|
||||||
|
_track->last().setCoordinates(position());
|
||||||
|
else if (_reader.name() == "AltitudeMeters")
|
||||||
|
_track->last().setElevation(_reader.readElementText().toDouble());
|
||||||
|
else if (_reader.name() == "Time")
|
||||||
|
_track->last().setTimestamp(QDateTime::fromString(
|
||||||
|
_reader.readElementText(), Qt::ISODate));
|
||||||
|
else if (_reader.name() == "HeartRateBpm")
|
||||||
|
_track->last().setHeartRate(_reader.readElementText().toDouble());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::routepointData()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Position")
|
||||||
|
_route->last().setCoordinates(position());
|
||||||
|
else if (_reader.name() == "AltitudeMeters")
|
||||||
|
_route->last().setElevation(_reader.readElementText().toDouble());
|
||||||
|
else if (_reader.name() == "Time")
|
||||||
|
_route->last().setTimestamp(QDateTime::fromString(
|
||||||
|
_reader.readElementText(), Qt::ISODate));
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::waypointData()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Position")
|
||||||
|
_waypoints.last().setCoordinates(position());
|
||||||
|
else if (_reader.name() == "Name")
|
||||||
|
_waypoints.last().setName(_reader.readElementText());
|
||||||
|
else if (_reader.name() == "Notes")
|
||||||
|
_waypoints.last().setDescription(_reader.readElementText());
|
||||||
|
else if (_reader.name() == "AltitudeMeters")
|
||||||
|
_waypoints.last().setElevation(
|
||||||
|
_reader.readElementText().toDouble());
|
||||||
|
else if (_reader.name() == "Time")
|
||||||
|
_waypoints.last().setTimestamp(QDateTime::fromString(
|
||||||
|
_reader.readElementText(), Qt::ISODate));
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::trackpoints()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Trackpoint") {
|
||||||
|
_track->append(Trackpoint());
|
||||||
|
trackpointData();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::routepoints()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Trackpoint") {
|
||||||
|
_route->append(Waypoint());
|
||||||
|
routepointData();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::lap()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Track") {
|
||||||
|
_tracks.append(QVector<Trackpoint>());
|
||||||
|
_track = &_tracks.back();
|
||||||
|
trackpoints();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::course()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Track") {
|
||||||
|
_routes.append(QVector<Waypoint>());
|
||||||
|
_route = &_routes.back();
|
||||||
|
routepoints();
|
||||||
|
} else if (_reader.name() == "CoursePoint") {
|
||||||
|
_waypoints.append(Waypoint());
|
||||||
|
waypointData();
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::activity()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Lap")
|
||||||
|
lap();
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::courses()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Course")
|
||||||
|
course();
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::activities()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Activity")
|
||||||
|
activity();
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TCXParser::tcx()
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Courses")
|
||||||
|
courses();
|
||||||
|
else if (_reader.name() == "Activities")
|
||||||
|
activities();
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TCXParser::parse()
|
||||||
|
{
|
||||||
|
if (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "TrainingCenterDatabase")
|
||||||
|
tcx();
|
||||||
|
else
|
||||||
|
_reader.raiseError("Not a TCX file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return !_reader.error();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TCXParser::loadFile(QIODevice *device)
|
||||||
|
{
|
||||||
|
_reader.clear();
|
||||||
|
_reader.setDevice(device);
|
||||||
|
|
||||||
|
return parse();
|
||||||
|
}
|
42
src/tcxparser.h
Normal file
42
src/tcxparser.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef TCXPARSER_H
|
||||||
|
#define TCXPARSER_H
|
||||||
|
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include <QVector>
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class TCXParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
TCXParser(QList<QVector<Trackpoint> > &tracks,
|
||||||
|
QList<QVector<Waypoint> > &routes, QList<Waypoint> &waypoints)
|
||||||
|
: Parser(tracks, routes, waypoints) {_track = 0; _route = 0;}
|
||||||
|
~TCXParser() {}
|
||||||
|
|
||||||
|
bool loadFile(QIODevice *device);
|
||||||
|
QString errorString() const {return _reader.errorString();}
|
||||||
|
int errorLine() const {return _reader.lineNumber();}
|
||||||
|
const char *name() const {return "TCX";}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool parse();
|
||||||
|
void tcx();
|
||||||
|
void courses();
|
||||||
|
void activities();
|
||||||
|
void course();
|
||||||
|
void activity();
|
||||||
|
void lap();
|
||||||
|
void trackpoints();
|
||||||
|
void routepoints();
|
||||||
|
void trackpointData();
|
||||||
|
void routepointData();
|
||||||
|
void waypointData();
|
||||||
|
QPointF position();
|
||||||
|
|
||||||
|
QXmlStreamReader _reader;
|
||||||
|
QVector<Trackpoint> *_track;
|
||||||
|
QVector<Waypoint> *_route;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // TCXPARSER_H
|
@ -1,4 +1,4 @@
|
|||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "temperaturegraph.h"
|
#include "temperaturegraph.h"
|
||||||
|
|
||||||
|
|
||||||
@ -26,10 +26,10 @@ void TemperatureGraph::setInfo()
|
|||||||
clearInfo();
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TemperatureGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
|
void TemperatureGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gpx.tracks().count(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
const Graph &graph = gpx.tracks().at(i)->temperature();
|
const Graph &graph = data.tracks().at(i)->temperature();
|
||||||
qreal sum = 0, w = 0;
|
qreal sum = 0, w = 0;
|
||||||
|
|
||||||
if (graph.size() < 2) {
|
if (graph.size() < 2) {
|
||||||
@ -42,12 +42,12 @@ void TemperatureGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
|
|||||||
sum += graph.at(j).y() * ds;
|
sum += graph.at(j).y() * ds;
|
||||||
w += ds;
|
w += ds;
|
||||||
}
|
}
|
||||||
_avg.append(QPointF(gpx.tracks().at(i)->distance(), sum/w));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||||
|
|
||||||
GraphView::loadGraph(graph, paths.at(i));
|
GraphView::loadGraph(graph, paths.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < gpx.routes().count(); i++)
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
skipColor();
|
skipColor();
|
||||||
|
|
||||||
setInfo();
|
setInfo();
|
||||||
|
@ -11,7 +11,7 @@ public:
|
|||||||
TemperatureGraph(QWidget *parent = 0);
|
TemperatureGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
QString label() const {return tr("Temperature");}
|
QString label() const {return tr("Temperature");}
|
||||||
void loadGPX(const GPX &gpx, const QList<PathItem *> &paths);
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
void showTracks(bool show);
|
void showTracks(bool show);
|
||||||
|
Loading…
Reference in New Issue
Block a user