mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-27 00:44:24 +02:00
Compare commits
220 Commits
Author | SHA1 | Date | |
---|---|---|---|
35309ef452 | |||
e6c9fb1971 | |||
fc858d6b68 | |||
4fd4135025 | |||
c16f33abce | |||
9b3da6a73c | |||
ff37b91bc5 | |||
896ebe9eb4 | |||
be87677ddf | |||
b40586c80f | |||
9f0fcdc13e | |||
6ca51f0ec6 | |||
3e03ecc9fe | |||
d94b189fed | |||
eec96cca62 | |||
7bc2c68a5c | |||
5b21d550af | |||
6f4259298b | |||
2c1a9f88c4 | |||
48438f9b4d | |||
9b7651bad4 | |||
b6ef1d36d6 | |||
d3cbdb8b92 | |||
a98e9a9784 | |||
3c6ce2dde2 | |||
4c88414677 | |||
ac5476868d | |||
bf6d7616ba | |||
9842214bb6 | |||
b6e9400392 | |||
c1a217847f | |||
409ce889cd | |||
09242841e3 | |||
a299207e5d | |||
efc773d04b | |||
16c95334a0 | |||
49ccb508a0 | |||
9c6c574443 | |||
f762013e1e | |||
f6b1344ee2 | |||
9f3129f899 | |||
f05ff372e7 | |||
c0adabe3f1 | |||
4a612f12bb | |||
8f4ce8d38c | |||
b73072795a | |||
57d3d9c965 | |||
d97a8c03a7 | |||
58b44d33a7 | |||
5c6f405795 | |||
156467a261 | |||
f4d5f8d057 | |||
b3655f6a1f | |||
f819840aff | |||
46bf281644 | |||
49470f22b2 | |||
078b272828 | |||
ed03e31949 | |||
605b09c195 | |||
ce41409713 | |||
0898953674 | |||
fd0401a4a6 | |||
869fdf5982 | |||
7fe518966c | |||
e568806366 | |||
aa32415adb | |||
c1a64d2c0b | |||
31bbdba548 | |||
0e4a5abc2b | |||
7a2f6b96a9 | |||
24c03fc15b | |||
f9af06267a | |||
2f9751672e | |||
140e975524 | |||
e6a39b5146 | |||
937251fbdc | |||
6e92557806 | |||
a3625ac89d | |||
a7e02bdc8b | |||
ed4e201b08 | |||
06901d8d7a | |||
698f14c835 | |||
f8806417d4 | |||
52e8eb1f6e | |||
0483d393ac | |||
5aa21380cb | |||
254deae04a | |||
076a091a5b | |||
bb7787b001 | |||
bc6d48d1fe | |||
9bae94f30d | |||
351fc0309a | |||
d8116c7f5d | |||
083dd39bef | |||
bd64ca4f57 | |||
b382a5e674 | |||
20687a1df7 | |||
bb82750e9b | |||
51e6058960 | |||
db3f111815 | |||
219311577f | |||
26d4770f47 | |||
db0d9ceffb | |||
fc9b01480c | |||
cd8f415615 | |||
824393879b | |||
f79f555d6f | |||
13e9a50d59 | |||
f1667e70b5 | |||
1ce347230b | |||
d4f3e293df | |||
7492b74aed | |||
71dbb176bb | |||
301107add1 | |||
60ae4c0268 | |||
bd76e508ae | |||
e9f7642cde | |||
5c73cb55cb | |||
c39298000d | |||
e17d7d4a8f | |||
65b74b146d | |||
b937b9f2cb | |||
d7fe0fa9bf | |||
9657104f50 | |||
5a692c71a8 | |||
e8ede272ae | |||
39a8a144dd | |||
02700a485d | |||
99ea19e35a | |||
a6bb0f1520 | |||
0a74684713 | |||
332a4d9393 | |||
db98f381b5 | |||
31a600638f | |||
2ff18bc373 | |||
c2e301f4e8 | |||
a25303fe98 | |||
2bee8656a4 | |||
4a31f6f76d | |||
eaef588443 | |||
87a808265e | |||
a39cef2abd | |||
960827e92b | |||
7de1b84f77 | |||
4b1fa13429 | |||
f10857eddc | |||
781fc22113 | |||
9ced0fd3a7 | |||
3e71d1b785 | |||
491bf5614b | |||
fc873719e1 | |||
99c3edddfd | |||
fde8ad620b | |||
7855c69729 | |||
8749be9103 | |||
7432459c93 | |||
6f9f49a435 | |||
eda5046518 | |||
b867ce9a7f | |||
cfdb12c4ae | |||
9436f98023 | |||
c89137204e | |||
905f80b1ce | |||
e707cc30ad | |||
4ef1fa77f8 | |||
df104b16c6 | |||
8f9049a8d4 | |||
d483cd35cd | |||
c2b09df118 | |||
9957e1834e | |||
7e537d819a | |||
8d1be76043 | |||
b68567f000 | |||
09a5f57109 | |||
ca8ff6c7ee | |||
e9c15ef956 | |||
e39f0881ab | |||
6f05d38d31 | |||
9cb91a35ef | |||
bb0073d7e7 | |||
3291ea86ef | |||
97d646bb19 | |||
672df4255e | |||
3fcf04daf7 | |||
3daab92b84 | |||
89f384feed | |||
fc555fd7d0 | |||
d58322b412 | |||
70222f4ae2 | |||
fe1aaa73a0 | |||
57741f8c2d | |||
6eb3a4f7de | |||
295a89b3cc | |||
dc3fdc4c3b | |||
3867b723a9 | |||
d7fc400d73 | |||
f8f6859e7d | |||
2501f834c8 | |||
3f4b70ee48 | |||
384d20b1a5 | |||
b4a06057f8 | |||
9f14eb7e70 | |||
dcf1c686e5 | |||
a8d183639e | |||
d9e025a18c | |||
0a9077545b | |||
bbc1d43290 | |||
524d72ce3c | |||
9f74bbb27a | |||
ce34d449c2 | |||
21dbd3958d | |||
92ac7c0c10 | |||
1f71b3a3b2 | |||
27886ea96a | |||
3176271955 | |||
d4b46a4bb6 | |||
3b2d4dcd31 | |||
de196e8281 | |||
f376f7139b | |||
9fe10f10b8 |
@ -1,4 +1,4 @@
|
|||||||
version: 5.17.{build}
|
version: 7.1.{build}
|
||||||
configuration: Release
|
configuration: Release
|
||||||
platform: Any CPU
|
platform: Any CPU
|
||||||
environment:
|
environment:
|
||||||
@ -34,6 +34,8 @@ build_script:
|
|||||||
|
|
||||||
copy pkg\%NSI% installer
|
copy pkg\%NSI% installer
|
||||||
|
|
||||||
|
copy pkg\macros.nsh installer
|
||||||
|
|
||||||
xcopy pkg\csv installer\csv /i
|
xcopy pkg\csv installer\csv /i
|
||||||
|
|
||||||
xcopy pkg\maps installer\maps /i
|
xcopy pkg\maps installer\maps /i
|
||||||
|
18
README.md
18
README.md
@ -3,23 +3,29 @@ GPXSee is a Qt-based GPS log file viewer and analyzer that supports GPX, TCX,
|
|||||||
KML, FIT, IGC, NMEA, SLF, LOC and OziExplorer files.
|
KML, FIT, IGC, NMEA, SLF, LOC and OziExplorer files.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
* [User-definable online maps](https://github.com/tumic0/GPXSee-maps) (OSM/Google tiles, WMTS, WMS).
|
* User-definable online maps (OpenStreetMap/Google tiles, WMTS, WMS, TMS).
|
||||||
* Offline maps (OziExplorer maps, TrekBuddy maps/atlases, Garmin JNX maps, GeoTIFF images).
|
* Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases, Garmin JNX maps, GeoTIFF images).
|
||||||
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts graphs.
|
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts graphs.
|
||||||
* Support for multiple tracks in one view.
|
* Support for multiple tracks in one view.
|
||||||
* Support for POI files.
|
* Support for POI files.
|
||||||
* Print/export to PDF.
|
* Print/export to PDF.
|
||||||
* Full-screen mode.
|
* Full-screen mode.
|
||||||
|
* HiDPI/Retina displays & maps support.
|
||||||
* Native GUI for Windows, Mac OS X and Linux.
|
* Native GUI for Windows, Mac OS X and Linux.
|
||||||
* Opens GPX, TCX, FIT, KML, IGC, NMEA, SLF, LOC, OziExplorer (PLT, RTE, WPT) and Garmin CSV files.
|
* Opens GPX, TCX, FIT, KML, IGC, NMEA, SLF, LOC, OziExplorer (PLT, RTE, WPT) and Garmin CSV files.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
Build requirements:
|
||||||
|
* Qt 4.8 or QT 5.x (Qt >= 5.10.1 recommended for all features)
|
||||||
|
* C++03 compiler (tested: msvc2015, gcc >= 4.8, clang/Apple LLVM version 8.1.0)
|
||||||
|
|
||||||
|
Build steps:
|
||||||
```shell
|
```shell
|
||||||
lrelease gpxsee.pro
|
lrelease gpxsee.pro
|
||||||
qmake gpxsee.pro
|
qmake gpxsee.pro
|
||||||
make
|
make # nmake on windows
|
||||||
```
|
```
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
@ -31,3 +37,9 @@ make
|
|||||||
|
|
||||||
## Homepage
|
## Homepage
|
||||||
http://www.gpxsee.org
|
http://www.gpxsee.org
|
||||||
|
|
||||||
|
## Maps
|
||||||
|
[GPXSee maps repository](https://github.com/tumic0/GPXSee-maps)
|
||||||
|
|
||||||
|
## Translations
|
||||||
|
GPXSee uses [Weblate](https://hosted.weblate.org/projects/gpxsee/translations/) for translations.
|
||||||
|
71
gpxsee.pro
71
gpxsee.pro
@ -1,9 +1,11 @@
|
|||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
VERSION = 5.17
|
VERSION = 7.1
|
||||||
|
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
network
|
network \
|
||||||
|
sql \
|
||||||
|
concurrent
|
||||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
QT += widgets
|
QT += widgets
|
||||||
QT += printsupport
|
QT += printsupport
|
||||||
@ -12,14 +14,17 @@ lessThan(QT_MAJOR_VERSION, 5) {QT += opengl}
|
|||||||
equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 4) {QT += opengl}
|
equals(QT_MAJOR_VERSION, 5) : lessThan(QT_MINOR_VERSION, 4) {QT += opengl}
|
||||||
|
|
||||||
INCLUDEPATH += ./src
|
INCLUDEPATH += ./src
|
||||||
HEADERS += src/config.h \
|
HEADERS += src/common/config.h \
|
||||||
src/common/staticassert.h \
|
src/common/staticassert.h \
|
||||||
src/common/coordinates.h \
|
src/common/coordinates.h \
|
||||||
src/common/range.h \
|
src/common/range.h \
|
||||||
src/common/rectc.h \
|
src/common/rectc.h \
|
||||||
src/common/wgs84.h \
|
src/common/wgs84.h \
|
||||||
src/common/str2int.h \
|
src/common/util.h \
|
||||||
src/common/rtree.h \
|
src/common/rtree.h \
|
||||||
|
src/common/kv.h \
|
||||||
|
src/common/greatcircle.h \
|
||||||
|
src/common/programpaths.h \
|
||||||
src/GUI/app.h \
|
src/GUI/app.h \
|
||||||
src/GUI/icons.h \
|
src/GUI/icons.h \
|
||||||
src/GUI/gui.h \
|
src/GUI/gui.h \
|
||||||
@ -69,10 +74,10 @@ HEADERS += src/config.h \
|
|||||||
src/GUI/gearratiographitem.h \
|
src/GUI/gearratiographitem.h \
|
||||||
src/GUI/oddspinbox.h \
|
src/GUI/oddspinbox.h \
|
||||||
src/GUI/settings.h \
|
src/GUI/settings.h \
|
||||||
src/GUI/nicenum.h \
|
|
||||||
src/GUI/cpuarch.h \
|
src/GUI/cpuarch.h \
|
||||||
src/GUI/searchpointer.h \
|
src/GUI/searchpointer.h \
|
||||||
src/GUI/mapview.h \
|
src/GUI/mapview.h \
|
||||||
|
src/GUI/font.h \
|
||||||
src/map/projection.h \
|
src/map/projection.h \
|
||||||
src/map/ellipsoid.h \
|
src/map/ellipsoid.h \
|
||||||
src/map/datum.h \
|
src/map/datum.h \
|
||||||
@ -89,7 +94,7 @@ HEADERS += src/config.h \
|
|||||||
src/map/downloader.h \
|
src/map/downloader.h \
|
||||||
src/map/tile.h \
|
src/map/tile.h \
|
||||||
src/map/emptymap.h \
|
src/map/emptymap.h \
|
||||||
src/map/offlinemap.h \
|
src/map/ozimap.h \
|
||||||
src/map/tar.h \
|
src/map/tar.h \
|
||||||
src/map/ozf.h \
|
src/map/ozf.h \
|
||||||
src/map/atlas.h \
|
src/map/atlas.h \
|
||||||
@ -113,6 +118,15 @@ HEADERS += src/config.h \
|
|||||||
src/map/crs.h \
|
src/map/crs.h \
|
||||||
src/map/coordinatesystem.h \
|
src/map/coordinatesystem.h \
|
||||||
src/map/pointd.h \
|
src/map/pointd.h \
|
||||||
|
src/map/rectd.h \
|
||||||
|
src/map/geocentric.h \
|
||||||
|
src/map/mercator.h \
|
||||||
|
src/map/jnxmap.h \
|
||||||
|
src/map/krovak.h \
|
||||||
|
src/map/geotiffmap.h \
|
||||||
|
src/map/image.h \
|
||||||
|
src/map/mbtilesmap.h \
|
||||||
|
src/map/osm.h \
|
||||||
src/data/graph.h \
|
src/data/graph.h \
|
||||||
src/data/poi.h \
|
src/data/poi.h \
|
||||||
src/data/waypoint.h \
|
src/data/waypoint.h \
|
||||||
@ -132,19 +146,15 @@ HEADERS += src/config.h \
|
|||||||
src/data/igcparser.h \
|
src/data/igcparser.h \
|
||||||
src/data/nmeaparser.h \
|
src/data/nmeaparser.h \
|
||||||
src/data/oziparsers.h \
|
src/data/oziparsers.h \
|
||||||
src/map/rectd.h \
|
|
||||||
src/map/geocentric.h \
|
|
||||||
src/map/mercator.h \
|
|
||||||
src/map/jnxmap.h \
|
|
||||||
src/map/krovak.h \
|
|
||||||
src/GUI/kv.h \
|
|
||||||
src/data/locparser.h \
|
src/data/locparser.h \
|
||||||
src/data/slfparser.h
|
src/data/slfparser.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/common/coordinates.cpp \
|
src/common/coordinates.cpp \
|
||||||
src/common/rectc.cpp \
|
src/common/rectc.cpp \
|
||||||
src/common/range.cpp \
|
src/common/range.cpp \
|
||||||
src/common/str2int.cpp \
|
src/common/util.cpp \
|
||||||
|
src/common/greatcircle.cpp \
|
||||||
|
src/common/programpaths.cpp \
|
||||||
src/GUI/app.cpp \
|
src/GUI/app.cpp \
|
||||||
src/GUI/gui.cpp \
|
src/GUI/gui.cpp \
|
||||||
src/GUI/axisitem.cpp \
|
src/GUI/axisitem.cpp \
|
||||||
@ -186,13 +196,12 @@ SOURCES += src/main.cpp \
|
|||||||
src/GUI/cadencegraphitem.cpp \
|
src/GUI/cadencegraphitem.cpp \
|
||||||
src/GUI/powergraphitem.cpp \
|
src/GUI/powergraphitem.cpp \
|
||||||
src/GUI/gearratiographitem.cpp \
|
src/GUI/gearratiographitem.cpp \
|
||||||
src/GUI/nicenum.cpp \
|
|
||||||
src/GUI/mapview.cpp \
|
src/GUI/mapview.cpp \
|
||||||
src/map/maplist.cpp \
|
src/map/maplist.cpp \
|
||||||
src/map/onlinemap.cpp \
|
src/map/onlinemap.cpp \
|
||||||
src/map/downloader.cpp \
|
src/map/downloader.cpp \
|
||||||
src/map/emptymap.cpp \
|
src/map/emptymap.cpp \
|
||||||
src/map/offlinemap.cpp \
|
src/map/ozimap.cpp \
|
||||||
src/map/tar.cpp \
|
src/map/tar.cpp \
|
||||||
src/map/atlas.cpp \
|
src/map/atlas.cpp \
|
||||||
src/map/ozf.cpp \
|
src/map/ozf.cpp \
|
||||||
@ -223,6 +232,15 @@ SOURCES += src/main.cpp \
|
|||||||
src/map/wms.cpp \
|
src/map/wms.cpp \
|
||||||
src/map/crs.cpp \
|
src/map/crs.cpp \
|
||||||
src/map/coordinatesystem.cpp \
|
src/map/coordinatesystem.cpp \
|
||||||
|
src/map/geocentric.cpp \
|
||||||
|
src/map/mercator.cpp \
|
||||||
|
src/map/jnxmap.cpp \
|
||||||
|
src/map/krovak.cpp \
|
||||||
|
src/map/map.cpp \
|
||||||
|
src/map/geotiffmap.cpp \
|
||||||
|
src/map/image.cpp \
|
||||||
|
src/map/mbtilesmap.cpp \
|
||||||
|
src/map/osm.cpp \
|
||||||
src/data/data.cpp \
|
src/data/data.cpp \
|
||||||
src/data/poi.cpp \
|
src/data/poi.cpp \
|
||||||
src/data/track.cpp \
|
src/data/track.cpp \
|
||||||
@ -236,34 +254,36 @@ SOURCES += src/main.cpp \
|
|||||||
src/data/igcparser.cpp \
|
src/data/igcparser.cpp \
|
||||||
src/data/nmeaparser.cpp \
|
src/data/nmeaparser.cpp \
|
||||||
src/data/oziparsers.cpp \
|
src/data/oziparsers.cpp \
|
||||||
src/map/geocentric.cpp \
|
|
||||||
src/map/mercator.cpp \
|
|
||||||
src/map/jnxmap.cpp \
|
|
||||||
src/map/krovak.cpp \
|
|
||||||
src/map/map.cpp \
|
|
||||||
src/data/locparser.cpp \
|
src/data/locparser.cpp \
|
||||||
src/data/slfparser.cpp
|
src/data/slfparser.cpp
|
||||||
|
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts \
|
TRANSLATIONS = lang/gpxsee_en.ts \
|
||||||
|
lang/gpxsee_cs.ts \
|
||||||
lang/gpxsee_sv.ts \
|
lang/gpxsee_sv.ts \
|
||||||
lang/gpxsee_de.ts \
|
lang/gpxsee_de.ts \
|
||||||
lang/gpxsee_ru.ts \
|
lang/gpxsee_ru.ts \
|
||||||
lang/gpxsee_fi.ts \
|
lang/gpxsee_fi.ts \
|
||||||
lang/gpxsee_fr.ts \
|
lang/gpxsee_fr.ts \
|
||||||
lang/gpxsee_pl.ts
|
lang/gpxsee_pl.ts \
|
||||||
|
lang/gpxsee_nb.ts \
|
||||||
|
lang/gpxsee_da.ts \
|
||||||
|
lang/gpxsee_tr.ts
|
||||||
|
|
||||||
macx {
|
macx {
|
||||||
ICON = icons/gpxsee.icns
|
ICON = icons/gpxsee.icns
|
||||||
QMAKE_INFO_PLIST = pkg/Info.plist
|
QMAKE_INFO_PLIST = pkg/Info.plist
|
||||||
LOCALE.path = Contents/Resources/translations
|
LOCALE.path = Contents/Resources/translations
|
||||||
LOCALE.files = lang/gpxsee_cs.qm \
|
LOCALE.files = lang/gpxsee_en.qm \
|
||||||
|
lang/gpxsee_cs.qm \
|
||||||
lang/gpxsee_de.qm \
|
lang/gpxsee_de.qm \
|
||||||
lang/gpxsee_fi.qm \
|
lang/gpxsee_fi.qm \
|
||||||
lang/gpxsee_fr.qm \
|
lang/gpxsee_fr.qm \
|
||||||
lang/gpxsee_ru.qm \
|
lang/gpxsee_ru.qm \
|
||||||
lang/gpxsee_sv.qm \
|
lang/gpxsee_sv.qm \
|
||||||
lang/gpxsee_pl.qm
|
lang/gpxsee_pl.qm \
|
||||||
|
lang/gpxsee_nb.qm \
|
||||||
|
lang/gpxsee_da.qm \
|
||||||
|
lang/gpxsee_tr.qm
|
||||||
CSV.path = Contents/Resources
|
CSV.path = Contents/Resources
|
||||||
CSV.files = pkg/csv
|
CSV.files = pkg/csv
|
||||||
MAPS.path = Contents/Resources
|
MAPS.path = Contents/Resources
|
||||||
@ -299,3 +319,4 @@ win32 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||||
|
DEFINES *= QT_USE_QSTRINGBUILDER
|
||||||
|
@ -40,5 +40,7 @@
|
|||||||
<file>icons/document-print_32@2x.png</file>
|
<file>icons/document-print_32@2x.png</file>
|
||||||
<file>icons/view-filter.png</file>
|
<file>icons/view-filter.png</file>
|
||||||
<file>icons/view-filter@2x.png</file>
|
<file>icons/view-filter@2x.png</file>
|
||||||
|
<file>icons/applications-internet_32.png</file>
|
||||||
|
<file>icons/applications-internet_32@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
icons/applications-internet_32.png
Normal file
BIN
icons/applications-internet_32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
icons/applications-internet_32@2x.png
Normal file
BIN
icons/applications-internet_32@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
File diff suppressed because it is too large
Load Diff
1749
lang/gpxsee_da.ts
Normal file
1749
lang/gpxsee_da.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4
lang/gpxsee_en.ts
Normal file
4
lang/gpxsee_en.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!DOCTYPE TS>
|
||||||
|
<TS version="2.1" language="en_US">
|
||||||
|
</TS>
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1749
lang/gpxsee_nb.ts
Normal file
1749
lang/gpxsee_nb.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1748
lang/gpxsee_tr.ts
Normal file
1748
lang/gpxsee_tr.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,21 +8,23 @@
|
|||||||
<summary>GPS log file viewer and analyzer</summary>
|
<summary>GPS log file viewer and analyzer</summary>
|
||||||
<description>
|
<description>
|
||||||
<p>GPXSee is a GPS log file viewer and analyzer that supports GPX, TCX,
|
<p>GPXSee is a GPS log file viewer and analyzer that supports GPX, TCX,
|
||||||
KML, FIT, IGC, NMEA and OziExplorer files.</p>
|
KML, FIT, IGC, NMEA, SLF, LOC and OziExplorer files.</p>
|
||||||
|
|
||||||
<p>Features:</p>
|
<p>Features:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>User-definable online maps (OSM/Google tiles, WMTS, WMS).</li>
|
<li>User-definable online maps (OpenStreetMap/Google tiles, WMTS,
|
||||||
<li>Offline maps (OziExplorer maps, TrekBuddy maps/atlases, GeoTIFF
|
WMS, TMS).</li>
|
||||||
images).</li>
|
<li>Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases,
|
||||||
|
GeoTIFF images).</li>
|
||||||
<li>Elevation, speed, heart rate, cadence, power and temperature
|
<li>Elevation, speed, heart rate, cadence, power and temperature
|
||||||
graphs.</li>
|
graphs.</li>
|
||||||
<li>Support for multiple tracks in one view.</li>
|
<li>Support for multiple tracks in one view.</li>
|
||||||
<li>Support for POI files.</li>
|
<li>Support for POI files.</li>
|
||||||
<li>Print/export to PDF.</li>
|
<li>Print/export to PDF.</li>
|
||||||
<li>Full-screen mode.</li>
|
<li>Full-screen mode.</li>
|
||||||
<li>Opens GPX, TCX, FIT, KML, IGC, NMEA, OziExplorer (PLT, WPT, RTE)
|
<li>HiDPI/Retina displays & maps support.</li>
|
||||||
and Garmin CSV files.</li>
|
<li>Opens GPX, TCX, FIT, KML, IGC, NMEA, SLF, LOC, OziExplorer (PLT,
|
||||||
|
WPT, RTE) and Garmin CSV files.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
@ -38,6 +40,10 @@
|
|||||||
<categories>
|
<categories>
|
||||||
<category>Graphics</category>
|
<category>Graphics</category>
|
||||||
<category>Viewer</category>
|
<category>Viewer</category>
|
||||||
|
<category>Maps</category>
|
||||||
|
<category>Geoscience</category>
|
||||||
|
<category>Geography</category>
|
||||||
|
<category>DataVisualization</category>
|
||||||
</categories>
|
</categories>
|
||||||
|
|
||||||
<url type="homepage">http://www.gpxsee.org</url>
|
<url type="homepage">http://www.gpxsee.org</url>
|
||||||
@ -58,5 +64,7 @@
|
|||||||
<mimetype>application/vnd.oziexplorer.plt</mimetype>
|
<mimetype>application/vnd.oziexplorer.plt</mimetype>
|
||||||
<mimetype>application/vnd.oziexplorer.rte</mimetype>
|
<mimetype>application/vnd.oziexplorer.rte</mimetype>
|
||||||
<mimetype>application/vnd.oziexplorer.wpt</mimetype>
|
<mimetype>application/vnd.oziexplorer.wpt</mimetype>
|
||||||
|
<mimetype>application/loc+xml</mimetype>
|
||||||
|
<mimetype>application/slf+xml</mimetype>
|
||||||
</mimetypes>
|
</mimetypes>
|
||||||
</component>
|
</component>
|
||||||
|
@ -10,5 +10,5 @@ Exec=gpxsee %F
|
|||||||
Icon=gpxsee
|
Icon=gpxsee
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Graphics;Viewer;Maps;Qt;
|
Categories=Graphics;Viewer;Education;Geography;Maps;Sports;Qt;
|
||||||
MimeType=application/gpx+xml;application/tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/loc+xml;application/slf+xml;
|
MimeType=application/gpx+xml;application/tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;application/vnd.oziexplorer.plt;application/vnd.oziexplorer.rte;application/vnd.oziexplorer.wpt;application/loc+xml;application/slf+xml;
|
||||||
|
@ -1,36 +1,13 @@
|
|||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
!include "x64.nsh"
|
!include "x64.nsh"
|
||||||
!include "WinVer.nsh"
|
!include "WinVer.nsh"
|
||||||
|
!include "macros.nsh"
|
||||||
|
|
||||||
; Macros
|
|
||||||
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
|
|
||||||
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
|
|
||||||
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
|
|
||||||
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
|
|
||||||
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro FILE_ASSOCIATION_REMOVE EXT
|
|
||||||
DeleteRegKey HKCR "GPXSee.${EXT}"
|
|
||||||
DeleteRegKey HKCR ".${EXT}"
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro LOCALIZATION LANG CODE
|
|
||||||
Section "${LANG}"
|
|
||||||
CreateDirectory "$INSTDIR\translations"
|
|
||||||
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
|
|
||||||
!if /FileExists translations\qt_${CODE}.qm
|
|
||||||
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
|
|
||||||
!endif
|
|
||||||
SectionEnd
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
|
|
||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "5.17"
|
!define VERSION "7.1"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}.exe"
|
OutFile "GPXSee-${VERSION}.exe"
|
||||||
@ -153,10 +130,13 @@ Section "QT framework" SEC_QT
|
|||||||
File "Qt5Widgets.dll"
|
File "Qt5Widgets.dll"
|
||||||
File "Qt5PrintSupport.dll"
|
File "Qt5PrintSupport.dll"
|
||||||
File "Qt5Network.dll"
|
File "Qt5Network.dll"
|
||||||
|
File "Qt5Sql.dll"
|
||||||
|
File "Qt5Concurrent.dll"
|
||||||
File /r "platforms"
|
File /r "platforms"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
File /r "printsupport"
|
File /r "printsupport"
|
||||||
File /r "styles"
|
File /r "styles"
|
||||||
|
File /r "sqldrivers"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
@ -201,12 +181,15 @@ SectionEnd
|
|||||||
|
|
||||||
SectionGroup "Localization" SEC_LOCALIZATION
|
SectionGroup "Localization" SEC_LOCALIZATION
|
||||||
!insertmacro LOCALIZATION "Czech" "cs"
|
!insertmacro LOCALIZATION "Czech" "cs"
|
||||||
|
!insertmacro LOCALIZATION "Danish" "da"
|
||||||
!insertmacro LOCALIZATION "Finnish" "fi"
|
!insertmacro LOCALIZATION "Finnish" "fi"
|
||||||
!insertmacro LOCALIZATION "French" "fr"
|
!insertmacro LOCALIZATION "French" "fr"
|
||||||
!insertmacro LOCALIZATION "German" "de"
|
!insertmacro LOCALIZATION "German" "de"
|
||||||
|
!insertmacro LOCALIZATION "Norwegian" "nb"
|
||||||
!insertmacro LOCALIZATION "Polish" "pl"
|
!insertmacro LOCALIZATION "Polish" "pl"
|
||||||
!insertmacro LOCALIZATION "Russian" "ru"
|
!insertmacro LOCALIZATION "Russian" "ru"
|
||||||
!insertmacro LOCALIZATION "Swedish" "sv"
|
!insertmacro LOCALIZATION "Swedish" "sv"
|
||||||
|
!insertmacro LOCALIZATION "Turkish" "tr"
|
||||||
SectionGroupEnd
|
SectionGroupEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
@ -1,36 +1,13 @@
|
|||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
!include "x64.nsh"
|
!include "x64.nsh"
|
||||||
!include "WinVer.nsh"
|
!include "WinVer.nsh"
|
||||||
|
!include "macros.nsh"
|
||||||
|
|
||||||
; Macros
|
|
||||||
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
|
|
||||||
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
|
|
||||||
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
|
|
||||||
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
|
|
||||||
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro FILE_ASSOCIATION_REMOVE EXT
|
|
||||||
DeleteRegKey HKCR "GPXSee.${EXT}"
|
|
||||||
DeleteRegKey HKCR ".${EXT}"
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
!macro LOCALIZATION LANG CODE
|
|
||||||
Section "${LANG}"
|
|
||||||
CreateDirectory "$INSTDIR\translations"
|
|
||||||
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
|
|
||||||
!if /FileExists translations\qt_${CODE}.qm
|
|
||||||
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
|
|
||||||
!endif
|
|
||||||
SectionEnd
|
|
||||||
!macroend
|
|
||||||
|
|
||||||
|
|
||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "5.17"
|
!define VERSION "7.1"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||||
@ -160,10 +137,13 @@ Section "QT framework" SEC_QT
|
|||||||
File "Qt5Widgets.dll"
|
File "Qt5Widgets.dll"
|
||||||
File "Qt5PrintSupport.dll"
|
File "Qt5PrintSupport.dll"
|
||||||
File "Qt5Network.dll"
|
File "Qt5Network.dll"
|
||||||
|
File "Qt5Sql.dll"
|
||||||
|
File "Qt5Concurrent.dll"
|
||||||
File /r "platforms"
|
File /r "platforms"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
File /r "printsupport"
|
File /r "printsupport"
|
||||||
File /r "styles"
|
File /r "styles"
|
||||||
|
File /r "sqldrivers"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
@ -203,12 +183,15 @@ SectionEnd
|
|||||||
|
|
||||||
SectionGroup "Localization" SEC_LOCALIZATION
|
SectionGroup "Localization" SEC_LOCALIZATION
|
||||||
!insertmacro LOCALIZATION "Czech" "cs"
|
!insertmacro LOCALIZATION "Czech" "cs"
|
||||||
|
!insertmacro LOCALIZATION "Danish" "da"
|
||||||
!insertmacro LOCALIZATION "Finnish" "fi"
|
!insertmacro LOCALIZATION "Finnish" "fi"
|
||||||
!insertmacro LOCALIZATION "French" "fr"
|
!insertmacro LOCALIZATION "French" "fr"
|
||||||
!insertmacro LOCALIZATION "German" "de"
|
!insertmacro LOCALIZATION "German" "de"
|
||||||
|
!insertmacro LOCALIZATION "Norwegian" "nb"
|
||||||
!insertmacro LOCALIZATION "Polish" "pl"
|
!insertmacro LOCALIZATION "Polish" "pl"
|
||||||
!insertmacro LOCALIZATION "Russian" "ru"
|
!insertmacro LOCALIZATION "Russian" "ru"
|
||||||
!insertmacro LOCALIZATION "Swedish" "sv"
|
!insertmacro LOCALIZATION "Swedish" "sv"
|
||||||
|
!insertmacro LOCALIZATION "Turkish" "tr"
|
||||||
SectionGroupEnd
|
SectionGroupEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
23
pkg/macros.nsh
Normal file
23
pkg/macros.nsh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
; File association
|
||||||
|
!macro FILE_ASSOCIATION_ADD EXT DESC ICON
|
||||||
|
WriteRegStr HKCR ".${EXT}" "" "GPXSee.${EXT}"
|
||||||
|
WriteRegStr HKCR "GPXSee.${EXT}" "" "${DESC}"
|
||||||
|
WriteRegStr HKCR "GPXSee.${EXT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,${ICON}"
|
||||||
|
WriteRegStr HKCR "GPXSee.${EXT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!macro FILE_ASSOCIATION_REMOVE EXT
|
||||||
|
DeleteRegKey HKCR "GPXSee.${EXT}"
|
||||||
|
DeleteRegKey HKCR ".${EXT}"
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
; Translations
|
||||||
|
!macro LOCALIZATION LANG CODE
|
||||||
|
Section "${LANG}"
|
||||||
|
CreateDirectory "$INSTDIR\translations"
|
||||||
|
File /oname=translations\gpxsee_${CODE}.qm translations\gpxsee_${CODE}.qm
|
||||||
|
!if /FileExists translations\qt_${CODE}.qm
|
||||||
|
File /oname=translations\qt_${CODE}.qm translations\qt_${CODE}.qm
|
||||||
|
!endif
|
||||||
|
SectionEnd
|
||||||
|
!macroend
|
@ -5,26 +5,37 @@
|
|||||||
#include <QNetworkProxyFactory>
|
#include <QNetworkProxyFactory>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
#include <QSettings>
|
||||||
|
#include "common/programpaths.h"
|
||||||
|
#include "common/config.h"
|
||||||
#include "map/downloader.h"
|
#include "map/downloader.h"
|
||||||
#include "map/ellipsoid.h"
|
#include "map/ellipsoid.h"
|
||||||
#include "map/gcs.h"
|
#include "map/gcs.h"
|
||||||
#include "map/pcs.h"
|
#include "map/pcs.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "config.h"
|
#include "settings.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
|
|
||||||
App::App(int &argc, char **argv) : QApplication(argc, argv),
|
App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||||
_argc(argc), _argv(argv)
|
_argc(argc), _argv(argv)
|
||||||
{
|
{
|
||||||
|
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
||||||
|
setApplicationName(APP_NAME);
|
||||||
|
#else
|
||||||
|
setApplicationName(QString(APP_NAME).toLower());
|
||||||
|
#endif
|
||||||
|
setApplicationVersion(APP_VERSION);
|
||||||
|
|
||||||
QTranslator *gpxsee = new QTranslator(this);
|
QTranslator *gpxsee = new QTranslator(this);
|
||||||
gpxsee->load(QLocale::system(), "gpxsee", "_", TRANSLATIONS_DIR);
|
gpxsee->load(QLocale::system(), "gpxsee", "_",
|
||||||
|
ProgramPaths::translationsDir());
|
||||||
installTranslator(gpxsee);
|
installTranslator(gpxsee);
|
||||||
|
|
||||||
QTranslator *qt = new QTranslator(this);
|
QTranslator *qt = new QTranslator(this);
|
||||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
||||||
qt->load(QLocale::system(), "qt", "_", TRANSLATIONS_DIR);
|
qt->load(QLocale::system(), "qt", "_", ProgramPaths::translationsDir());
|
||||||
#else // Q_OS_WIN32 || Q_OS_MAC
|
#else // Q_OS_WIN32 || Q_OS_MAC
|
||||||
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
|
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
|
||||||
QLibraryInfo::TranslationsPath));
|
QLibraryInfo::TranslationsPath));
|
||||||
@ -36,7 +47,21 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
|||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
Downloader::setNetworkAccessManager(new QNetworkAccessManager(this));
|
QSettings settings(APP_NAME, APP_NAME);
|
||||||
|
settings.beginGroup(OPTIONS_SETTINGS_GROUP);
|
||||||
|
|
||||||
|
/* The QNetworkAccessManager must be a child of QApplication, otherwise it
|
||||||
|
triggers the following warning on exit (and may probably crash):
|
||||||
|
"QThreadStorage: Thread X exited after QThreadStorage Y destroyed" */
|
||||||
|
Downloader::setNetworkManager(new QNetworkAccessManager(this));
|
||||||
|
#ifdef ENABLE_HTTP2
|
||||||
|
Downloader::enableHTTP2(settings.value(ENABLE_HTTP2_SETTING,
|
||||||
|
ENABLE_HTTP2_DEFAULT).toBool());
|
||||||
|
#endif // ENABLE_HTTP2
|
||||||
|
Downloader::setTimeout(settings.value(CONNECTION_TIMEOUT_SETTING,
|
||||||
|
CONNECTION_TIMEOUT_DEFAULT).toInt());
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
OPENGL_SET_SAMPLES(4);
|
OPENGL_SET_SAMPLES(4);
|
||||||
loadDatums();
|
loadDatums();
|
||||||
loadPCSs();
|
loadPCSs();
|
||||||
@ -49,14 +74,15 @@ App::~App()
|
|||||||
delete _gui;
|
delete _gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::run()
|
int App::run()
|
||||||
{
|
{
|
||||||
_gui->show();
|
_gui->show();
|
||||||
|
|
||||||
for (int i = 1; i < _argc; i++)
|
QStringList args(arguments());
|
||||||
_gui->openFile(QString::fromLocal8Bit(_argv[i]));
|
for (int i = 1; i < args.count(); i++)
|
||||||
|
_gui->openFile(args.at(i));
|
||||||
|
|
||||||
exec();
|
return exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool App::event(QEvent *event)
|
bool App::event(QEvent *event)
|
||||||
@ -71,41 +97,27 @@ bool App::event(QEvent *event)
|
|||||||
|
|
||||||
void App::loadDatums()
|
void App::loadDatums()
|
||||||
{
|
{
|
||||||
QString ef, df;
|
QString ellipsoidsFile(ProgramPaths::ellipsoidsFile());
|
||||||
|
QString gcsFile(ProgramPaths::gcsFile());
|
||||||
|
|
||||||
if (QFile::exists(USER_ELLIPSOID_FILE))
|
if (ellipsoidsFile.isNull())
|
||||||
ef = USER_ELLIPSOID_FILE;
|
|
||||||
else if (QFile::exists(GLOBAL_ELLIPSOID_FILE))
|
|
||||||
ef = GLOBAL_ELLIPSOID_FILE;
|
|
||||||
else
|
|
||||||
qWarning("No ellipsoids file found.");
|
qWarning("No ellipsoids file found.");
|
||||||
|
if (gcsFile.isNull())
|
||||||
|
qWarning("No GCS file found.");
|
||||||
|
|
||||||
if (QFile::exists(USER_GCS_FILE))
|
if (!ellipsoidsFile.isNull() && !gcsFile.isNull()) {
|
||||||
df = USER_GCS_FILE;
|
Ellipsoid::loadList(ellipsoidsFile);
|
||||||
else if (QFile::exists(GLOBAL_GCS_FILE))
|
GCS::loadList(gcsFile);
|
||||||
df = GLOBAL_GCS_FILE;
|
|
||||||
else
|
|
||||||
qWarning("No datums file found.");
|
|
||||||
|
|
||||||
if (!ef.isNull() && !df.isNull()) {
|
|
||||||
Ellipsoid::loadList(ef);
|
|
||||||
GCS::loadList(df);
|
|
||||||
} else
|
} else
|
||||||
qWarning("Maps based on a datum different from WGS84 won't work.");
|
qWarning("Maps based on a datum different from WGS84 won't work.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::loadPCSs()
|
void App::loadPCSs()
|
||||||
{
|
{
|
||||||
QString file;
|
QString pcsFile(ProgramPaths::pcsFile());
|
||||||
|
|
||||||
if (QFile::exists(USER_PCS_FILE))
|
if (pcsFile.isNull())
|
||||||
file = USER_PCS_FILE;
|
|
||||||
else if (QFile::exists(GLOBAL_PCS_FILE))
|
|
||||||
file = GLOBAL_PCS_FILE;
|
|
||||||
else {
|
|
||||||
qWarning("No PCS file found.");
|
qWarning("No PCS file found.");
|
||||||
return;
|
else
|
||||||
}
|
PCS::loadList(pcsFile);
|
||||||
|
|
||||||
PCS::loadList(file);
|
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ class App : QApplication
|
|||||||
public:
|
public:
|
||||||
App(int &argc, char **argv);
|
App(int &argc, char **argv);
|
||||||
~App();
|
~App();
|
||||||
void run();
|
int run();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event);
|
bool event(QEvent *event);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "common/util.h"
|
||||||
#include "nicenum.h"
|
#include "font.h"
|
||||||
#include "axisitem.h"
|
#include "axisitem.h"
|
||||||
|
|
||||||
|
|
||||||
@ -36,7 +36,8 @@ Ticks::Ticks(double minValue, double maxValue, int maxCount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent)
|
AxisItem::AxisItem(Type type, QGraphicsItem *parent)
|
||||||
|
: QGraphicsItem(parent), _locale(QLocale::system())
|
||||||
{
|
{
|
||||||
_type = type;
|
_type = type;
|
||||||
_size = 0;
|
_size = 0;
|
||||||
@ -56,7 +57,7 @@ void AxisItem::setRange(const RangeF &range)
|
|||||||
for (int i = 0; i < ticks.count(); i++) {
|
for (int i = 0; i < ticks.count(); i++) {
|
||||||
Tick &t = _ticks[i];
|
Tick &t = _ticks[i];
|
||||||
t.value = ticks.val(i);
|
t.value = ticks.val(i);
|
||||||
t.boundingBox = fm.tightBoundingRect(QString::number(t.value));
|
t.boundingBox = fm.tightBoundingRect(_locale.toString(t.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
@ -126,7 +127,7 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
TICK/2, (_size/_range.size()) * (val - _range.min()), -TICK/2);
|
TICK/2, (_size/_range.size()) * (val - _range.min()), -TICK/2);
|
||||||
painter->drawText(((_size/_range.size()) * (val - _range.min()))
|
painter->drawText(((_size/_range.size()) * (val - _range.min()))
|
||||||
- (ts.width()/2), ts.height() + TICK/2 + PADDING,
|
- (ts.width()/2), ts.height() + TICK/2 + PADDING,
|
||||||
QString::number(val));
|
_locale.toString(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->drawText(_size/2 - _labelBB.width()/2, _labelBB.height()
|
painter->drawText(_size/2 - _labelBB.width()/2, _labelBB.height()
|
||||||
@ -145,7 +146,7 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
* (val - _range.min())));
|
* (val - _range.min())));
|
||||||
painter->drawText(-(ts.width() + PADDING + TICK/2),
|
painter->drawText(-(ts.width() + PADDING + TICK/2),
|
||||||
-((_size/_range.size()) * (val - _range.min())) + (ts.height()/2),
|
-((_size/_range.size()) * (val - _range.min())) + (ts.height()/2),
|
||||||
QString::number(val));
|
_locale.toString(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->rotate(-90);
|
painter->rotate(-90);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QLocale>
|
||||||
#include "common/range.h"
|
#include "common/range.h"
|
||||||
|
|
||||||
class AxisItem : public QGraphicsItem
|
class AxisItem : public QGraphicsItem
|
||||||
@ -39,6 +40,7 @@ private:
|
|||||||
QVector<Tick> _ticks;
|
QVector<Tick> _ticks;
|
||||||
QRectF _boundingRect;
|
QRectF _boundingRect;
|
||||||
QFont _font;
|
QFont _font;
|
||||||
|
QLocale _locale;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AXISITEM_H
|
#endif // AXISITEM_H
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "cadencegraphitem.h"
|
#include "cadencegraphitem.h"
|
||||||
#include "cadencegraph.h"
|
#include "cadencegraph.h"
|
||||||
@ -7,7 +8,7 @@ CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
{
|
{
|
||||||
_showTracks = true;
|
_showTracks = true;
|
||||||
|
|
||||||
GraphView::setYUnits(tr("1/min"));
|
GraphView::setYUnits(tr("rpm"));
|
||||||
setYLabel(tr("Cadence"));
|
setYLabel(tr("Cadence"));
|
||||||
|
|
||||||
setSliderPrecision(1);
|
setSliderPrecision(1);
|
||||||
@ -16,9 +17,11 @@ CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
void CadenceGraph::setInfo()
|
void CadenceGraph::setInfo()
|
||||||
{
|
{
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
|
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
} else
|
} else
|
||||||
clearInfo();
|
clearInfo();
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "cadencegraphitem.h"
|
#include "cadencegraphitem.h"
|
||||||
|
|
||||||
|
|
||||||
CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
|
CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||||
{
|
{
|
||||||
qreal sum = 0;
|
qreal sum = 0;
|
||||||
|
_max = graph.first().y();
|
||||||
|
|
||||||
for (int j = 1; j < graph.size(); j++)
|
for (int i = 1; i < graph.size(); i++) {
|
||||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
qreal y = graph.at(i).y();
|
||||||
|
sum += y * (graph.at(i).s() - graph.at(i-1).s());
|
||||||
|
if (y > _max)
|
||||||
|
_max = y;
|
||||||
|
}
|
||||||
_avg = sum/graph.last().s();
|
_avg = sum/graph.last().s();
|
||||||
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
@ -16,11 +23,12 @@ CadenceGraphItem::CadenceGraphItem(const Graph &graph, GraphType type,
|
|||||||
QString CadenceGraphItem::toolTip() const
|
QString CadenceGraphItem::toolTip() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1)
|
tt.insert(tr("Maximum"), l.toString(max(), 'f', 1)
|
||||||
+ UNIT_SPACE + tr("1/min"));
|
+ UNIT_SPACE + tr("rpm"));
|
||||||
tt.insert(tr("Average"), QString::number(avg(), 'f', 1)
|
tt.insert(tr("Average"), l.toString(avg(), 'f', 1)
|
||||||
+ UNIT_SPACE + tr("1/min"));
|
+ UNIT_SPACE + tr("rpm"));
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ public:
|
|||||||
CadenceGraphItem(const Graph &graph, GraphType type,
|
CadenceGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
qreal avg() const {return _avg;}
|
qreal avg() const {return _avg;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString toolTip() const;
|
QString toolTip() const;
|
||||||
|
|
||||||
qreal _avg;
|
qreal _avg, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CADENCEGRAPHITEM_H
|
#endif // CADENCEGRAPHITEM_H
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "config.h"
|
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "elevationgraphitem.h"
|
#include "elevationgraphitem.h"
|
||||||
#include "elevationgraph.h"
|
#include "elevationgraph.h"
|
||||||
@ -54,13 +54,15 @@ void ElevationGraph::setInfo()
|
|||||||
if (std::isnan(max()) || std::isnan(min()))
|
if (std::isnan(max()) || std::isnan(min()))
|
||||||
clearInfo();
|
clearInfo();
|
||||||
else {
|
else {
|
||||||
GraphView::addInfo(tr("Ascent"), QString::number(ascent() * yScale(),
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
|
GraphView::addInfo(tr("Ascent"), l.toString(ascent() * yScale(),
|
||||||
'f', 0) + UNIT_SPACE + yUnits());
|
'f', 0) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Descent"), QString::number(descent() * yScale(),
|
GraphView::addInfo(tr("Descent"), l.toString(descent() * yScale(),
|
||||||
'f', 0) + UNIT_SPACE + yUnits());
|
'f', 0) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||||
0) + UNIT_SPACE + yUnits());
|
0) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f',
|
GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f',
|
||||||
0) + UNIT_SPACE + yUnits());
|
0) + UNIT_SPACE + yUnits());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "elevationgraphitem.h"
|
#include "elevationgraphitem.h"
|
||||||
|
|
||||||
|
|
||||||
ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type,
|
ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||||
{
|
{
|
||||||
_ascent = _descent = 0;
|
_ascent = _descent = 0;
|
||||||
|
_min = _max = graph.first().y();
|
||||||
|
|
||||||
for (int j = 1; j < graph.size(); j++) {
|
for (int j = 1; j < graph.size(); j++) {
|
||||||
qreal cur = graph.at(j).y();
|
qreal cur = graph.at(j).y();
|
||||||
@ -14,6 +17,11 @@ ElevationGraphItem::ElevationGraphItem(const Graph &graph, GraphType type,
|
|||||||
_ascent += cur - prev;
|
_ascent += cur - prev;
|
||||||
if (cur < prev)
|
if (cur < prev)
|
||||||
_descent += prev - cur;
|
_descent += prev - cur;
|
||||||
|
|
||||||
|
if (cur < _min)
|
||||||
|
_min = cur;
|
||||||
|
if (cur > _max)
|
||||||
|
_max = cur;
|
||||||
}
|
}
|
||||||
|
|
||||||
setToolTip(toolTip(Metric));
|
setToolTip(toolTip(Metric));
|
||||||
@ -24,14 +32,15 @@ QString ElevationGraphItem::toolTip(Units units) const
|
|||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
qreal scale = (units == Metric) ? 1.0 : M2FT;
|
qreal scale = (units == Metric) ? 1.0 : M2FT;
|
||||||
QString su = (units == Metric) ? tr("m") : tr("ft");
|
QString su = (units == Metric) ? tr("m") : tr("ft");
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Ascent"), QString::number(ascent() * scale, 'f', 0)
|
tt.insert(tr("Ascent"), l.toString(ascent() * scale, 'f', 0)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
tt.insert(tr("Descent"), QString::number(descent() * scale, 'f', 0)
|
tt.insert(tr("Descent"), l.toString(descent() * scale, 'f', 0)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 0)
|
tt.insert(tr("Maximum"), l.toString(max() * scale, 'f', 0)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
tt.insert(tr("Minimum"), QString::number(min() * scale, 'f', 0)
|
tt.insert(tr("Minimum"), l.toString(min() * scale, 'f', 0)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
|
@ -13,15 +13,15 @@ public:
|
|||||||
|
|
||||||
qreal ascent() const {return _ascent;}
|
qreal ascent() const {return _ascent;}
|
||||||
qreal descent() const {return _descent;}
|
qreal descent() const {return _descent;}
|
||||||
qreal min() const {return -bounds().bottom();}
|
qreal min() const {return _min;}
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
|
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString toolTip(Units units) const;
|
QString toolTip(Units units) const;
|
||||||
|
|
||||||
qreal _ascent, _descent;
|
qreal _ascent, _descent, _min, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELEVATIONGRAPHITEM_H
|
#endif // ELEVATIONGRAPHITEM_H
|
||||||
|
@ -22,7 +22,8 @@ ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
|||||||
int index;
|
int index;
|
||||||
|
|
||||||
_fileSelect = new FileSelectWidget();
|
_fileSelect = new FileSelectWidget();
|
||||||
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
|
_fileSelect->setFilter(tr("PDF files") + " (*.pdf);;" + tr("All files")
|
||||||
|
+ " (*)");
|
||||||
_fileSelect->setFile(_export->fileName);
|
_fileSelect->setFile(_export->fileName);
|
||||||
|
|
||||||
_paperSize = new QComboBox();
|
_paperSize = new QComboBox();
|
||||||
|
7
src/GUI/font.h
Normal file
7
src/GUI/font.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef FONT_H
|
||||||
|
#define FONT_H
|
||||||
|
|
||||||
|
#define FONT_FAMILY "Arial"
|
||||||
|
#define FONT_SIZE 12 // px
|
||||||
|
|
||||||
|
#endif // FONT_H
|
@ -46,37 +46,41 @@ QString Format::timeSpan(qreal time, bool full)
|
|||||||
|
|
||||||
QString Format::distance(qreal value, Units units)
|
QString Format::distance(qreal value, Units units)
|
||||||
{
|
{
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
if (units == Imperial) {
|
if (units == Imperial) {
|
||||||
if (value < MIINM)
|
if (value < MIINM)
|
||||||
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
|
return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "ft");
|
+ qApp->translate("Format", "ft");
|
||||||
else
|
else
|
||||||
return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE
|
return l.toString(value * M2MI, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "mi");
|
+ qApp->translate("Format", "mi");
|
||||||
} else if (units == Nautical) {
|
} else if (units == Nautical) {
|
||||||
if (value < NMIINM)
|
if (value < NMIINM)
|
||||||
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
|
return l.toString(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "ft");
|
+ qApp->translate("Format", "ft");
|
||||||
else
|
else
|
||||||
return QString::number(value * M2NMI, 'f', 1) + UNIT_SPACE
|
return l.toString(value * M2NMI, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "nmi");
|
+ qApp->translate("Format", "nmi");
|
||||||
} else {
|
} else {
|
||||||
if (value < KMINM)
|
if (value < KMINM)
|
||||||
return QString::number(value, 'f', 0) + UNIT_SPACE
|
return l.toString(value, 'f', 0) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "m");
|
+ qApp->translate("Format", "m");
|
||||||
else
|
else
|
||||||
return QString::number(value * M2KM, 'f', 1) + UNIT_SPACE
|
return l.toString(value * M2KM, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "km");
|
+ qApp->translate("Format", "km");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Format::elevation(qreal value, Units units)
|
QString Format::elevation(qreal value, Units units)
|
||||||
{
|
{
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
if (units == Metric)
|
if (units == Metric)
|
||||||
return QString::number(qRound(value)) + UNIT_SPACE
|
return l.toString(qRound(value)) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "m");
|
+ qApp->translate("Format", "m");
|
||||||
else
|
else
|
||||||
return QString::number(qRound(value * M2FT)) + UNIT_SPACE
|
return l.toString(qRound(value * M2FT)) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "ft");
|
+ qApp->translate("Format", "ft");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +99,8 @@ QString Format::coordinates(const Coordinates &value, CoordinatesFormat type)
|
|||||||
+ deg2DMS(qAbs(value.lon())) + xH;
|
+ deg2DMS(qAbs(value.lon())) + xH;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return QString::number(qAbs(value.lat()), 'f', 5) + yH + ","
|
QLocale l(QLocale::system());
|
||||||
+ QChar(0x00A0) + QString::number(qAbs(value.lon()), 'f', 5) + xH;
|
return l.toString(qAbs(value.lat()), 'f', 5) + yH + ","
|
||||||
|
+ QChar(0x00A0) + l.toString(qAbs(value.lon()), 'f', 5) + xH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "gearratiographitem.h"
|
#include "gearratiographitem.h"
|
||||||
#include "gearratiograph.h"
|
#include "gearratiograph.h"
|
||||||
@ -16,11 +17,13 @@ GearRatioGraph::GearRatioGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
void GearRatioGraph::setInfo()
|
void GearRatioGraph::setInfo()
|
||||||
{
|
{
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
GraphView::addInfo(tr("Most used"), QString::number(top() * yScale(),
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
|
GraphView::addInfo(tr("Most used"), l.toString(top() * yScale(),
|
||||||
'f', 2) + UNIT_SPACE + yUnits());
|
'f', 2) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f',
|
GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale(), 'f',
|
||||||
2) + UNIT_SPACE + yUnits());
|
2) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||||
2) + UNIT_SPACE + yUnits());
|
2) + UNIT_SPACE + yUnits());
|
||||||
} else
|
} else
|
||||||
clearInfo();
|
clearInfo();
|
||||||
|
@ -1,16 +1,25 @@
|
|||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "gearratiographitem.h"
|
#include "gearratiographitem.h"
|
||||||
|
|
||||||
|
|
||||||
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
|
GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent), _top(NAN)
|
||||||
{
|
{
|
||||||
qreal val = NAN;
|
qreal val = NAN;
|
||||||
|
_min = _max = graph.first().y();
|
||||||
|
|
||||||
|
for (int i = 1; i < graph.size(); i++) {
|
||||||
|
const GraphPoint &p = graph.at(i);
|
||||||
|
|
||||||
for (int j = 1; j < graph.size(); j++) {
|
|
||||||
const GraphPoint &p = graph.at(j);
|
|
||||||
qreal val = _map.value(p.y());
|
qreal val = _map.value(p.y());
|
||||||
_map.insert(p.y(), val + (p.s() - graph.at(j-1).s()));
|
_map.insert(p.y(), val + (p.s() - graph.at(i-1).s()));
|
||||||
|
|
||||||
|
if (p.y() < _min)
|
||||||
|
_min = p.y();
|
||||||
|
if (p.y() > _max)
|
||||||
|
_max = p.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QMap<qreal, qreal>::const_iterator it = _map.constBegin();
|
for (QMap<qreal, qreal>::const_iterator it = _map.constBegin();
|
||||||
@ -30,10 +39,11 @@ GearRatioGraphItem::GearRatioGraphItem(const Graph &graph, GraphType type,
|
|||||||
QString GearRatioGraphItem::toolTip() const
|
QString GearRatioGraphItem::toolTip() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Minimum"), QString::number(min(), 'f', 2));
|
tt.insert(tr("Minimum"), l.toString(min(), 'f', 2));
|
||||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 2));
|
tt.insert(tr("Maximum"), l.toString(max(), 'f', 2));
|
||||||
tt.insert(tr("Most used"), QString::number(top(), 'f', 2));
|
tt.insert(tr("Most used"), l.toString(top(), 'f', 2));
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ public:
|
|||||||
GearRatioGraphItem(const Graph &graph, GraphType type,
|
GearRatioGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
qreal min() const {return -bounds().bottom();}
|
qreal min() const {return _min;}
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
qreal top() const {return _top;}
|
qreal top() const {return _top;}
|
||||||
|
|
||||||
const QMap<qreal, qreal> &map() const {return _map;}
|
const QMap<qreal, qreal> &map() const {return _map;}
|
||||||
@ -22,7 +22,7 @@ private:
|
|||||||
QString toolTip() const;
|
QString toolTip() const;
|
||||||
|
|
||||||
QMap<qreal, qreal> _map;
|
QMap<qreal, qreal> _map;
|
||||||
qreal _top;
|
qreal _top, _min, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GEARRATIOGRAPHITEM_H
|
#endif // GEARRATIOGRAPHITEM_H
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
#include <QPaintDevice>
|
#include <QPaintDevice>
|
||||||
#include <QGraphicsSimpleTextItem>
|
#include <QGraphicsSimpleTextItem>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include <QLocale>
|
||||||
#include "data/graph.h"
|
#include "data/graph.h"
|
||||||
#include "opengl.h"
|
#include "opengl.h"
|
||||||
#include "config.h"
|
|
||||||
#include "axisitem.h"
|
#include "axisitem.h"
|
||||||
#include "slideritem.h"
|
#include "slideritem.h"
|
||||||
#include "sliderinfoitem.h"
|
#include "sliderinfoitem.h"
|
||||||
@ -413,8 +413,10 @@ void GraphView::updateSliderPosition()
|
|||||||
|
|
||||||
void GraphView::updateSliderInfo()
|
void GraphView::updateSliderInfo()
|
||||||
{
|
{
|
||||||
|
QLocale l(QLocale::system());
|
||||||
qreal r, y;
|
qreal r, y;
|
||||||
|
|
||||||
|
|
||||||
if (_visible.count() > 1) {
|
if (_visible.count() > 1) {
|
||||||
r = 0;
|
r = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
@ -435,9 +437,9 @@ void GraphView::updateSliderInfo()
|
|||||||
_sliderInfo->setSide(s);
|
_sliderInfo->setSide(s);
|
||||||
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
|
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
|
||||||
_sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos,
|
_sliderInfo->setText(_graphType == Time ? Format::timeSpan(_sliderPos,
|
||||||
bounds().width() > 3600) : QString::number(_sliderPos * _xScale, 'f', 1)
|
bounds().width() > 3600) : l.toString(_sliderPos * _xScale, 'f', 1)
|
||||||
+ UNIT_SPACE + _xUnits, (_visible.count() > 1) ? QString()
|
+ UNIT_SPACE + _xUnits, (_visible.count() > 1) ? QString()
|
||||||
: QString::number(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE
|
: l.toString(-y * _yScale + _yOffset, 'f', _precision) + UNIT_SPACE
|
||||||
+ _yUnits);
|
+ _yUnits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
168
src/GUI/gui.cpp
168
src/GUI/gui.cpp
@ -1,4 +1,4 @@
|
|||||||
#include "config.h"
|
#include "common/config.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
@ -28,6 +28,7 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
#include "common/programpaths.h"
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "data/poi.h"
|
#include "data/poi.h"
|
||||||
#include "map/maplist.h"
|
#include "map/maplist.h"
|
||||||
@ -108,14 +109,9 @@ GUI::GUI()
|
|||||||
void GUI::loadMaps()
|
void GUI::loadMaps()
|
||||||
{
|
{
|
||||||
_ml = new MapList(this);
|
_ml = new MapList(this);
|
||||||
QString dir;
|
QString mapDir(ProgramPaths::mapDir());
|
||||||
|
|
||||||
if (QFile::exists(USER_MAP_DIR))
|
if (!mapDir.isNull() && !_ml->loadDir(mapDir))
|
||||||
dir = USER_MAP_DIR;
|
|
||||||
else if (QFile::exists(GLOBAL_MAP_DIR))
|
|
||||||
dir = GLOBAL_MAP_DIR;
|
|
||||||
|
|
||||||
if (!dir.isNull() && !_ml->loadDir(dir))
|
|
||||||
qWarning("%s", qPrintable(_ml->errorString()));
|
qWarning("%s", qPrintable(_ml->errorString()));
|
||||||
|
|
||||||
_map = new EmptyMap(this);
|
_map = new EmptyMap(this);
|
||||||
@ -124,14 +120,9 @@ void GUI::loadMaps()
|
|||||||
void GUI::loadPOIs()
|
void GUI::loadPOIs()
|
||||||
{
|
{
|
||||||
_poi = new POI(this);
|
_poi = new POI(this);
|
||||||
QString dir;
|
QString poiDir(ProgramPaths::poiDir());
|
||||||
|
|
||||||
if (QFile::exists(USER_POI_DIR))
|
if (!poiDir.isNull() && !_poi->loadDir(poiDir))
|
||||||
dir = USER_POI_DIR;
|
|
||||||
else if (QFile::exists(GLOBAL_POI_DIR))
|
|
||||||
dir = GLOBAL_POI_DIR;
|
|
||||||
|
|
||||||
if (!dir.isNull() && !_poi->loadDir(dir))
|
|
||||||
qWarning("%s", qPrintable(_poi->errorString()));
|
qWarning("%s", qPrintable(_poi->errorString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,20 +138,25 @@ void GUI::createMapActions()
|
|||||||
_mapsActionGroup = new QActionGroup(this);
|
_mapsActionGroup = new QActionGroup(this);
|
||||||
_mapsActionGroup->setExclusive(true);
|
_mapsActionGroup->setExclusive(true);
|
||||||
|
|
||||||
for (int i = 0; i < _ml->maps().count(); i++) {
|
for (int i = 0; i < _ml->maps().count(); i++)
|
||||||
QAction *a = new QAction(_ml->maps().at(i)->name(), this);
|
createMapAction(_ml->maps().at(i));
|
||||||
|
|
||||||
|
connect(_mapsSignalMapper, SIGNAL(mapped(int)), this,
|
||||||
|
SLOT(mapChanged(int)));
|
||||||
|
}
|
||||||
|
|
||||||
|
QAction *GUI::createMapAction(const Map *map)
|
||||||
|
{
|
||||||
|
QAction *a = new QAction(map->name(), this);
|
||||||
a->setMenuRole(QAction::NoRole);
|
a->setMenuRole(QAction::NoRole);
|
||||||
a->setCheckable(true);
|
a->setCheckable(true);
|
||||||
a->setActionGroup(_mapsActionGroup);
|
a->setActionGroup(_mapsActionGroup);
|
||||||
|
|
||||||
_mapsSignalMapper->setMapping(a, i);
|
_mapActions.append(a);
|
||||||
|
_mapsSignalMapper->setMapping(a, _mapActions.size() - 1);
|
||||||
connect(a, SIGNAL(triggered()), _mapsSignalMapper, SLOT(map()));
|
connect(a, SIGNAL(triggered()), _mapsSignalMapper, SLOT(map()));
|
||||||
|
|
||||||
_mapActions.append(a);
|
return a;
|
||||||
}
|
|
||||||
|
|
||||||
connect(_mapsSignalMapper, SIGNAL(mapped(int)), this,
|
|
||||||
SLOT(mapChanged(int)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::createPOIFilesActions()
|
void GUI::createPOIFilesActions()
|
||||||
@ -168,23 +164,21 @@ void GUI::createPOIFilesActions()
|
|||||||
_poiFilesSignalMapper = new QSignalMapper(this);
|
_poiFilesSignalMapper = new QSignalMapper(this);
|
||||||
|
|
||||||
for (int i = 0; i < _poi->files().count(); i++)
|
for (int i = 0; i < _poi->files().count(); i++)
|
||||||
createPOIFileAction(i);
|
createPOIFileAction(_poi->files().at(i));
|
||||||
|
|
||||||
connect(_poiFilesSignalMapper, SIGNAL(mapped(int)), this,
|
connect(_poiFilesSignalMapper, SIGNAL(mapped(int)), this,
|
||||||
SLOT(poiFileChecked(int)));
|
SLOT(poiFileChecked(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction *GUI::createPOIFileAction(int index)
|
QAction *GUI::createPOIFileAction(const QString &fileName)
|
||||||
{
|
{
|
||||||
QAction *a = new QAction(QFileInfo(_poi->files().at(index)).fileName(),
|
QAction *a = new QAction(QFileInfo(fileName).fileName(), this);
|
||||||
this);
|
|
||||||
a->setMenuRole(QAction::NoRole);
|
a->setMenuRole(QAction::NoRole);
|
||||||
a->setCheckable(true);
|
a->setCheckable(true);
|
||||||
|
|
||||||
_poiFilesSignalMapper->setMapping(a, index);
|
|
||||||
connect(a, SIGNAL(triggered()), _poiFilesSignalMapper, SLOT(map()));
|
|
||||||
|
|
||||||
_poiFilesActions.append(a);
|
_poiFilesActions.append(a);
|
||||||
|
_poiFilesSignalMapper->setMapping(a, _poiFilesActions.size() - 1);
|
||||||
|
connect(a, SIGNAL(triggered()), _poiFilesSignalMapper, SLOT(map()));
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@ -641,14 +635,15 @@ void GUI::about()
|
|||||||
QUrl homepage(APP_HOMEPAGE);
|
QUrl homepage(APP_HOMEPAGE);
|
||||||
|
|
||||||
msgBox.setWindowTitle(tr("About GPXSee"));
|
msgBox.setWindowTitle(tr("About GPXSee"));
|
||||||
msgBox.setText("<h2>" + QString(APP_NAME) + "</h2><p><p>" + tr("Version ")
|
msgBox.setText("<h2>" + QString(APP_NAME) + "</h2><p><p>" + tr("Version %1")
|
||||||
+ APP_VERSION + " (" + CPU_ARCH + ", Qt " + QT_VERSION_STR + ")</p>");
|
.arg(QString(APP_VERSION) + " (" + CPU_ARCH + ", Qt " + QT_VERSION_STR
|
||||||
|
+ ")") + "</p>");
|
||||||
msgBox.setInformativeText("<table width=\"300\"><tr><td>"
|
msgBox.setInformativeText("<table width=\"300\"><tr><td>"
|
||||||
+ tr("GPXSee is distributed under the terms of the GNU General Public "
|
+ tr("GPXSee is distributed under the terms of the GNU General Public "
|
||||||
"License version 3. For more info about GPXSee visit the project "
|
"License version 3. For more info about GPXSee visit the project "
|
||||||
"homepage at ") + "<a href=\"" + homepage.toString() + "\">"
|
"homepage at %1.").arg("<a href=\"" + homepage.toString() + "\">"
|
||||||
+ homepage.toString(QUrl::RemoveScheme).mid(2)
|
+ homepage.toString(QUrl::RemoveScheme).mid(2) + "</a>")
|
||||||
+ "</a>.</td></tr></table>");
|
+ "</td></tr></table>");
|
||||||
|
|
||||||
QIcon icon = msgBox.windowIcon();
|
QIcon icon = msgBox.windowIcon();
|
||||||
QSize size = icon.actualSize(QSize(64, 64));
|
QSize size = icon.actualSize(QSize(64, 64));
|
||||||
@ -698,19 +693,15 @@ void GUI::paths()
|
|||||||
msgBox.setWindowTitle(tr("Paths"));
|
msgBox.setWindowTitle(tr("Paths"));
|
||||||
msgBox.setText("<h3>" + tr("Paths") + "</h3>");
|
msgBox.setText("<h3>" + tr("Paths") + "</h3>");
|
||||||
msgBox.setInformativeText(
|
msgBox.setInformativeText(
|
||||||
"<style>td {white-space: pre; padding-right: 1em;}</style><h4>"
|
"<style>td {white-space: pre; padding-right: 1em;}</style><table><tr><td>"
|
||||||
+ tr("Global") + "</h4><table><tr><td>" + tr("Map directory:")
|
+ tr("Map directory:") + "</td><td><code>"
|
||||||
+ "</td><td><code>" + QDir::cleanPath(GLOBAL_MAP_DIR)
|
+ QDir::cleanPath(ProgramPaths::mapDir(true)) + "</code></td></tr><tr><td>"
|
||||||
+ "</code></td></tr><tr><td>" + tr("POI directory:") + "</td><td><code>"
|
+ tr("POI directory:") + "</td><td><code>"
|
||||||
+ QDir::cleanPath(GLOBAL_POI_DIR) + "</code></td></tr><tr><td>"
|
+ QDir::cleanPath(ProgramPaths::poiDir(true)) + "</code></td></tr><tr><td>"
|
||||||
+ tr("GCS/PCS directory:") + "</td><td><code>"
|
+ tr("GCS/PCS directory:") + "</td><td><code>"
|
||||||
+ QDir::cleanPath(GLOBAL_CSV_DIR) + "</code></td></tr></table>"
|
+ QDir::cleanPath(ProgramPaths::csvDir(true)) + "</code></td></tr><tr><td>"
|
||||||
+ "<h4>" + tr("User-specific") + "</h4><table><tr><td>"
|
+ tr("Tile cache directory:") + "</td><td><code>"
|
||||||
+ tr("Map directory:") + "</td><td><code>" + QDir::cleanPath(USER_MAP_DIR)
|
+ QDir::cleanPath(ProgramPaths::tilesDir()) + "</code></td></tr></table>"
|
||||||
+ "</code></td></tr><tr><td>" + tr("POI directory:") + "</td><td><code>"
|
|
||||||
+ QDir::cleanPath(USER_POI_DIR) + "</code></td></tr><tr><td>"
|
|
||||||
+ tr("GCS/PCS directory:") + "</td><td><code>"
|
|
||||||
+ QDir::cleanPath(USER_CSV_DIR) + "</code></td></tr></table>"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
@ -838,7 +829,15 @@ bool GUI::openPOIFile(const QString &fileName)
|
|||||||
if (fileName.isEmpty() || _poi->files().contains(fileName))
|
if (fileName.isEmpty() || _poi->files().contains(fileName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!_poi->loadFile(fileName)) {
|
if (_poi->loadFile(fileName)) {
|
||||||
|
_mapView->showPOI(true);
|
||||||
|
_showPOIAction->setChecked(true);
|
||||||
|
QAction *action = createPOIFileAction(fileName);
|
||||||
|
action->setChecked(true);
|
||||||
|
_poiFilesMenu->addAction(action);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
QString error = tr("Error loading POI file:") + "\n\n"
|
QString error = tr("Error loading POI file:") + "\n\n"
|
||||||
+ fileName + "\n\n" + _poi->errorString();
|
+ fileName + "\n\n" + _poi->errorString();
|
||||||
if (_poi->errorLine())
|
if (_poi->errorLine())
|
||||||
@ -846,14 +845,6 @@ bool GUI::openPOIFile(const QString &fileName)
|
|||||||
QMessageBox::critical(this, APP_NAME, error);
|
QMessageBox::critical(this, APP_NAME, error);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
|
||||||
_mapView->showPOI(true);
|
|
||||||
_showPOIAction->setChecked(true);
|
|
||||||
QAction *action = createPOIFileAction(_poi->files().indexOf(fileName));
|
|
||||||
action->setChecked(true);
|
|
||||||
_poiFilesMenu->addAction(action);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -931,6 +922,11 @@ void GUI::openOptions()
|
|||||||
if (options.enableHTTP2 != _options.enableHTTP2)
|
if (options.enableHTTP2 != _options.enableHTTP2)
|
||||||
Downloader::enableHTTP2(options.enableHTTP2);
|
Downloader::enableHTTP2(options.enableHTTP2);
|
||||||
#endif // ENABLE_HTTP2
|
#endif // ENABLE_HTTP2
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
if (options.hidpiMap != _options.hidpiMap)
|
||||||
|
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||||
|
options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
if (reload)
|
if (reload)
|
||||||
reloadFile();
|
reloadFile();
|
||||||
@ -971,6 +967,8 @@ void GUI::exportFile()
|
|||||||
|
|
||||||
void GUI::statistics()
|
void GUI::statistics()
|
||||||
{
|
{
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
QString text = "<style>td {white-space: pre; padding-right: 4em;}"
|
QString text = "<style>td {white-space: pre; padding-right: 4em;}"
|
||||||
"th {text-align: left; padding-top: 0.5em;}</style><table>";
|
"th {text-align: left; padding-top: 0.5em;}</style><table>";
|
||||||
@ -981,21 +979,21 @@ void GUI::statistics()
|
|||||||
|
|
||||||
if (_showTracksAction->isChecked() && _trackCount > 1)
|
if (_showTracksAction->isChecked() && _trackCount > 1)
|
||||||
text.append("<tr><td>" + tr("Tracks") + ":</td><td>"
|
text.append("<tr><td>" + tr("Tracks") + ":</td><td>"
|
||||||
+ QString::number(_trackCount) + "</td></tr>");
|
+ l.toString(_trackCount) + "</td></tr>");
|
||||||
if (_showRoutesAction->isChecked() && _routeCount > 1)
|
if (_showRoutesAction->isChecked() && _routeCount > 1)
|
||||||
text.append("<tr><td>" + tr("Routes") + ":</td><td>"
|
text.append("<tr><td>" + tr("Routes") + ":</td><td>"
|
||||||
+ QString::number(_routeCount) + "</td></tr>");
|
+ l.toString(_routeCount) + "</td></tr>");
|
||||||
if (_showWaypointsAction->isChecked() && _waypointCount > 1)
|
if (_showWaypointsAction->isChecked() && _waypointCount > 1)
|
||||||
text.append("<tr><td>" + tr("Waypoints") + ":</td><td>"
|
text.append("<tr><td>" + tr("Waypoints") + ":</td><td>"
|
||||||
+ QString::number(_waypointCount) + "</td></tr>");
|
+ l.toString(_waypointCount) + "</td></tr>");
|
||||||
|
|
||||||
if (_dateRange.first.isValid()) {
|
if (_dateRange.first.isValid()) {
|
||||||
if (_dateRange.first == _dateRange.second) {
|
if (_dateRange.first == _dateRange.second) {
|
||||||
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
|
QString format = l.dateFormat(QLocale::LongFormat);
|
||||||
text.append("<tr><td>" + tr("Date") + ":</td><td>"
|
text.append("<tr><td>" + tr("Date") + ":</td><td>"
|
||||||
+ _dateRange.first.toString(format) + "</td></tr>");
|
+ _dateRange.first.toString(format) + "</td></tr>");
|
||||||
} else {
|
} else {
|
||||||
QString format = QLocale::system().dateFormat(QLocale::ShortFormat);
|
QString format = l.dateFormat(QLocale::ShortFormat);
|
||||||
text.append("<tr><td>" + tr("Date") + ":</td><td>"
|
text.append("<tr><td>" + tr("Date") + ":</td><td>"
|
||||||
+ QString("%1 - %2").arg(_dateRange.first.toString(format),
|
+ QString("%1 - %2").arg(_dateRange.first.toString(format),
|
||||||
_dateRange.second.toString(format)) + "</td></tr>");
|
_dateRange.second.toString(format)) + "</td></tr>");
|
||||||
@ -1037,6 +1035,7 @@ void GUI::statistics()
|
|||||||
|
|
||||||
void GUI::plot(QPrinter *printer)
|
void GUI::plot(QPrinter *printer)
|
||||||
{
|
{
|
||||||
|
QLocale l(QLocale::system());
|
||||||
QPainter p(printer);
|
QPainter p(printer);
|
||||||
TrackInfo info;
|
TrackInfo info;
|
||||||
qreal ih, gh, mh, ratio;
|
qreal ih, gh, mh, ratio;
|
||||||
@ -1047,19 +1046,19 @@ void GUI::plot(QPrinter *printer)
|
|||||||
|
|
||||||
if (_options.printItemCount) {
|
if (_options.printItemCount) {
|
||||||
if (_showTracksAction->isChecked() && _trackCount > 1)
|
if (_showTracksAction->isChecked() && _trackCount > 1)
|
||||||
info.insert(tr("Tracks"), QString::number(_trackCount));
|
info.insert(tr("Tracks"), l.toString(_trackCount));
|
||||||
if (_showRoutesAction->isChecked() && _routeCount > 1)
|
if (_showRoutesAction->isChecked() && _routeCount > 1)
|
||||||
info.insert(tr("Routes"), QString::number(_routeCount));
|
info.insert(tr("Routes"), l.toString(_routeCount));
|
||||||
if (_showWaypointsAction->isChecked() && _waypointCount > 1)
|
if (_showWaypointsAction->isChecked() && _waypointCount > 1)
|
||||||
info.insert(tr("Waypoints"), QString::number(_waypointCount));
|
info.insert(tr("Waypoints"), l.toString(_waypointCount));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_dateRange.first.isValid() && _options.printDate) {
|
if (_dateRange.first.isValid() && _options.printDate) {
|
||||||
if (_dateRange.first == _dateRange.second) {
|
if (_dateRange.first == _dateRange.second) {
|
||||||
QString format = QLocale::system().dateFormat(QLocale::LongFormat);
|
QString format = l.dateFormat(QLocale::LongFormat);
|
||||||
info.insert(tr("Date"), _dateRange.first.toString(format));
|
info.insert(tr("Date"), _dateRange.first.toString(format));
|
||||||
} else {
|
} else {
|
||||||
QString format = QLocale::system().dateFormat(QLocale::ShortFormat);
|
QString format = l.dateFormat(QLocale::ShortFormat);
|
||||||
info.insert(tr("Date"), QString("%1 - %2")
|
info.insert(tr("Date"), QString("%1 - %2")
|
||||||
.arg(_dateRange.first.toString(format),
|
.arg(_dateRange.first.toString(format),
|
||||||
_dateRange.second.toString(format)));
|
_dateRange.second.toString(format)));
|
||||||
@ -1286,18 +1285,11 @@ bool GUI::loadMap(const QString &fileName)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (_ml->loadFile(fileName)) {
|
if (_ml->loadFile(fileName)) {
|
||||||
QAction *a = new QAction(_ml->maps().last()->name(), this);
|
QAction *a = createMapAction(_ml->maps().last());
|
||||||
a->setMenuRole(QAction::NoRole);
|
|
||||||
a->setCheckable(true);
|
|
||||||
a->setActionGroup(_mapsActionGroup);
|
|
||||||
_mapsSignalMapper->setMapping(a, _ml->maps().size() - 1);
|
|
||||||
connect(a, SIGNAL(triggered()), _mapsSignalMapper, SLOT(map()));
|
|
||||||
_mapActions.append(a);
|
|
||||||
_mapMenu->insertAction(_mapsEnd, a);
|
_mapMenu->insertAction(_mapsEnd, a);
|
||||||
_showMapAction->setEnabled(true);
|
_showMapAction->setEnabled(true);
|
||||||
_clearMapCacheAction->setEnabled(true);
|
_clearMapCacheAction->setEnabled(true);
|
||||||
_mapActions.last()->trigger();
|
a->trigger();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
QString error = tr("Error loading map:") + "\n\n"
|
QString error = tr("Error loading map:") + "\n\n"
|
||||||
@ -1610,7 +1602,7 @@ void GUI::dropEvent(QDropEvent *event)
|
|||||||
|
|
||||||
void GUI::writeSettings()
|
void GUI::writeSettings()
|
||||||
{
|
{
|
||||||
QSettings settings(APP_NAME, APP_NAME);
|
QSettings settings(qApp->applicationName(), qApp->applicationName());
|
||||||
settings.clear();
|
settings.clear();
|
||||||
|
|
||||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||||
@ -1795,13 +1787,17 @@ void GUI::writeSettings()
|
|||||||
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
|
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
|
||||||
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
|
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
|
||||||
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
|
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
if (_options.hidpiMap != HIDPI_MAP_DEFAULT)
|
||||||
|
settings.setValue(HIDPI_MAP_SETTING, _options.hidpiMap);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::readSettings()
|
void GUI::readSettings()
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
QSettings settings(APP_NAME, APP_NAME);
|
QSettings settings(qApp->applicationName(), qApp->applicationName());
|
||||||
|
|
||||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||||
resize(settings.value(WINDOW_SIZE_SETTING, WINDOW_SIZE_DEFAULT).toSize());
|
resize(settings.value(WINDOW_SIZE_SETTING, WINDOW_SIZE_DEFAULT).toSize());
|
||||||
@ -2030,6 +2026,10 @@ void GUI::readSettings()
|
|||||||
SLIDER_COLOR_DEFAULT).value<QColor>();
|
SLIDER_COLOR_DEFAULT).value<QColor>();
|
||||||
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
|
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
|
||||||
ALWAYS_SHOW_MAP_DEFAULT).toBool();
|
ALWAYS_SHOW_MAP_DEFAULT).toBool();
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_options.hidpiMap = settings.value(HIDPI_MAP_SETTING, HIDPI_MAP_SETTING)
|
||||||
|
.toBool();
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
_mapView->setPalette(_options.palette);
|
_mapView->setPalette(_options.palette);
|
||||||
_mapView->setMapOpacity(_options.mapOpacity);
|
_mapView->setMapOpacity(_options.mapOpacity);
|
||||||
@ -2046,6 +2046,10 @@ void GUI::readSettings()
|
|||||||
_mapView->setMarkerColor(_options.sliderColor);
|
_mapView->setMarkerColor(_options.sliderColor);
|
||||||
if (_options.useOpenGL)
|
if (_options.useOpenGL)
|
||||||
_mapView->useOpenGL(true);
|
_mapView->useOpenGL(true);
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||||
|
_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
for (int i = 0; i < _tabs.count(); i++) {
|
for (int i = 0; i < _tabs.count(); i++) {
|
||||||
_tabs.at(i)->setPalette(_options.palette);
|
_tabs.at(i)->setPalette(_options.palette);
|
||||||
@ -2070,10 +2074,6 @@ void GUI::readSettings()
|
|||||||
_poi->setRadius(_options.poiRadius);
|
_poi->setRadius(_options.poiRadius);
|
||||||
|
|
||||||
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
QPixmapCache::setCacheLimit(_options.pixmapCache * 1024);
|
||||||
Downloader::setTimeout(_options.connectionTimeout);
|
|
||||||
#ifdef ENABLE_HTTP2
|
|
||||||
Downloader::enableHTTP2(_options.enableHTTP2);
|
|
||||||
#endif // ENABLE_HTTP2
|
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
@ -2131,7 +2131,8 @@ void GUI::show()
|
|||||||
void GUI::screenChanged(QScreen *screen)
|
void GUI::screenChanged(QScreen *screen)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
_mapView->updateDevicePixelRatio();
|
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||||
|
_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
|
|
||||||
disconnect(SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
disconnect(SIGNAL(logicalDotsPerInchChanged(qreal)), this,
|
||||||
SLOT(logicalDotsPerInchChanged(qreal)));
|
SLOT(logicalDotsPerInchChanged(qreal)));
|
||||||
@ -2147,6 +2148,7 @@ void GUI::logicalDotsPerInchChanged(qreal dpi)
|
|||||||
Q_UNUSED(dpi)
|
Q_UNUSED(dpi)
|
||||||
|
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
_mapView->updateDevicePixelRatio();
|
_mapView->setDevicePixelRatio(devicePixelRatioF(),
|
||||||
|
_options.hidpiMap ? devicePixelRatioF() : 1.0);
|
||||||
#endif // ENBLE_HIDPI
|
#endif // ENBLE_HIDPI
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,8 @@ private:
|
|||||||
void closeFiles();
|
void closeFiles();
|
||||||
void plot(QPrinter *printer);
|
void plot(QPrinter *printer);
|
||||||
|
|
||||||
QAction *createPOIFileAction(int index);
|
QAction *createPOIFileAction(const QString &fileName);
|
||||||
|
QAction *createMapAction(const Map *map);
|
||||||
void createPOIFilesActions();
|
void createPOIFilesActions();
|
||||||
void createMapActions();
|
void createMapActions();
|
||||||
void createActions();
|
void createActions();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "heartrategraphitem.h"
|
#include "heartrategraphitem.h"
|
||||||
#include "heartrategraph.h"
|
#include "heartrategraph.h"
|
||||||
@ -7,7 +8,7 @@ HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
{
|
{
|
||||||
_showTracks = true;
|
_showTracks = true;
|
||||||
|
|
||||||
GraphView::setYUnits(tr("1/min"));
|
GraphView::setYUnits(tr("bpm"));
|
||||||
setYLabel(tr("Heart rate"));
|
setYLabel(tr("Heart rate"));
|
||||||
|
|
||||||
setSliderPrecision(0);
|
setSliderPrecision(0);
|
||||||
@ -16,9 +17,11 @@ HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
void HeartRateGraph::setInfo()
|
void HeartRateGraph::setInfo()
|
||||||
{
|
{
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f',
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
|
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f',
|
||||||
0) + UNIT_SPACE + yUnits());
|
0) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||||
0) + UNIT_SPACE + yUnits());
|
0) + UNIT_SPACE + yUnits());
|
||||||
} else
|
} else
|
||||||
clearInfo();
|
clearInfo();
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "heartrategraphitem.h"
|
#include "heartrategraphitem.h"
|
||||||
|
|
||||||
|
|
||||||
HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
|
HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||||
{
|
{
|
||||||
qreal sum = 0;
|
qreal sum = 0;
|
||||||
|
_max = graph.first().y();
|
||||||
|
|
||||||
for (int j = 1; j < graph.size(); j++)
|
for (int i = 1; i < graph.size(); i++) {
|
||||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
qreal y = graph.at(i).y();
|
||||||
|
sum += y * (graph.at(i).s() - graph.at(i-1).s());
|
||||||
|
if (y > _max)
|
||||||
|
_max = y;
|
||||||
|
}
|
||||||
_avg = sum/graph.last().s();
|
_avg = sum/graph.last().s();
|
||||||
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
@ -16,11 +23,12 @@ HeartRateGraphItem::HeartRateGraphItem(const Graph &graph, GraphType type,
|
|||||||
QString HeartRateGraphItem::toolTip() const
|
QString HeartRateGraphItem::toolTip() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 0)
|
tt.insert(tr("Maximum"), l.toString(max(), 'f', 0)
|
||||||
+ UNIT_SPACE + tr("1/min"));
|
+ UNIT_SPACE + tr("bpm"));
|
||||||
tt.insert(tr("Average"), QString::number(avg(), 'f', 0)
|
tt.insert(tr("Average"), l.toString(avg(), 'f', 0)
|
||||||
+ UNIT_SPACE + tr("1/min"));
|
+ UNIT_SPACE + tr("bpm"));
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ public:
|
|||||||
HeartRateGraphItem(const Graph &graph, GraphType type,
|
HeartRateGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
qreal avg() const {return _avg;}
|
qreal avg() const {return _avg;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString toolTip() const;
|
QString toolTip() const;
|
||||||
|
|
||||||
qreal _avg;
|
qreal _avg, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HEARTRATEGRAPHITEM_H
|
#endif // HEARTRATEGRAPHITEM_H
|
||||||
|
@ -25,5 +25,6 @@
|
|||||||
#define SYSTEM_ICON ":/icons/preferences-system.png"
|
#define SYSTEM_ICON ":/icons/preferences-system.png"
|
||||||
#define PRINT_EXPORT_ICON ":/icons/document-print_32.png"
|
#define PRINT_EXPORT_ICON ":/icons/document-print_32.png"
|
||||||
#define DATA_ICON ":/icons/view-filter.png"
|
#define DATA_ICON ":/icons/view-filter.png"
|
||||||
|
#define MAPS_ICON ":/icons/applications-internet_32.png"
|
||||||
|
|
||||||
#endif /* ICONS_H */
|
#endif /* ICONS_H */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "font.h"
|
||||||
#include "infoitem.h"
|
#include "infoitem.h"
|
||||||
|
|
||||||
#define PADDING 10
|
#define PADDING 10
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <QGraphicsItem>
|
#include <QGraphicsItem>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "kv.h"
|
#include "common/kv.h"
|
||||||
|
|
||||||
class InfoItem : public QGraphicsItem
|
class InfoItem : public QGraphicsItem
|
||||||
{
|
{
|
||||||
|
@ -18,9 +18,10 @@
|
|||||||
|
|
||||||
#define MAX_DIGITAL_ZOOM 2
|
#define MAX_DIGITAL_ZOOM 2
|
||||||
#define MIN_DIGITAL_ZOOM -3
|
#define MIN_DIGITAL_ZOOM -3
|
||||||
#define MARGIN 10.0
|
#define MARGIN 10
|
||||||
#define SCALE_OFFSET 7
|
#define SCALE_OFFSET 7
|
||||||
|
|
||||||
|
|
||||||
MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
||||||
: QGraphicsView(parent)
|
: QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
@ -41,10 +42,6 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
_scene->addItem(_mapScale);
|
_scene->addItem(_mapScale);
|
||||||
|
|
||||||
_map = map;
|
_map = map;
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
_ratio = devicePixelRatioF();
|
|
||||||
_map->setDevicePixelRatio(_ratio);
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
_map->load();
|
_map->load();
|
||||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||||
|
|
||||||
@ -75,6 +72,11 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
_poiSize = 8;
|
_poiSize = 8;
|
||||||
_poiColor = Qt::black;
|
_poiColor = Qt::black;
|
||||||
|
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_deviceRatio = 1.0;
|
||||||
|
_mapRatio = 1.0;
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
_opengl = false;
|
||||||
_plot = false;
|
_plot = false;
|
||||||
_digitalZoom = 0;
|
_digitalZoom = 0;
|
||||||
|
|
||||||
@ -268,10 +270,10 @@ void MapView::setMap(Map *map)
|
|||||||
disconnect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
disconnect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||||
|
|
||||||
_map = map;
|
_map = map;
|
||||||
#ifdef ENABLE_HIDPI
|
|
||||||
_map->setDevicePixelRatio(_ratio);
|
|
||||||
#endif // ENABLE_HIDPI
|
|
||||||
_map->load();
|
_map->load();
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_map->setDevicePixelRatio(_deviceRatio, _mapRatio);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
|
||||||
|
|
||||||
digitalZoom(0);
|
digitalZoom(0);
|
||||||
@ -438,10 +440,10 @@ void MapView::zoom(int zoom, const QPoint &pos)
|
|||||||
digitalZoom(zoom);
|
digitalZoom(zoom);
|
||||||
} else {
|
} else {
|
||||||
Coordinates c = _map->xy2ll(mapToScene(pos));
|
Coordinates c = _map->xy2ll(mapToScene(pos));
|
||||||
qreal os = _map->zoom();
|
int oz = _map->zoom();
|
||||||
qreal ns = (zoom > 0) ? _map->zoomIn() : _map->zoomOut();
|
int nz = (zoom > 0) ? _map->zoomIn() : _map->zoomOut();
|
||||||
|
|
||||||
if (ns != os) {
|
if (nz != oz) {
|
||||||
rescale();
|
rescale();
|
||||||
centerOn(_map->ll2xy(c) - (pos - viewport()->rect().center()));
|
centerOn(_map->ll2xy(c) - (pos - viewport()->rect().center()));
|
||||||
} else {
|
} else {
|
||||||
@ -505,7 +507,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
setUpdatesEnabled(false);
|
setUpdatesEnabled(false);
|
||||||
_plot = true;
|
_plot = true;
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
_map->setDevicePixelRatio(1.0);
|
_map->setDevicePixelRatio(_deviceRatio, 1.0);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
// Compute sizes & ratios
|
// Compute sizes & ratios
|
||||||
@ -566,7 +568,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
|||||||
|
|
||||||
// Exit plot mode
|
// Exit plot mode
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
_map->setDevicePixelRatio(_ratio);
|
_map->setDevicePixelRatio(_deviceRatio, _mapRatio);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
_plot = false;
|
_plot = false;
|
||||||
setUpdatesEnabled(true);
|
setUpdatesEnabled(true);
|
||||||
@ -765,9 +767,17 @@ void MapView::drawBackground(QPainter *painter, const QRectF &rect)
|
|||||||
|
|
||||||
if (_showMap) {
|
if (_showMap) {
|
||||||
QRectF ir = rect.intersected(_map->bounds());
|
QRectF ir = rect.intersected(_map->bounds());
|
||||||
|
Map::Flags flags = Map::NoFlags;
|
||||||
|
|
||||||
if (_opacity < 1.0)
|
if (_opacity < 1.0)
|
||||||
painter->setOpacity(_opacity);
|
painter->setOpacity(_opacity);
|
||||||
_map->draw(painter, ir, _plot);
|
|
||||||
|
if (_plot)
|
||||||
|
flags = Map::Block;
|
||||||
|
else if (_opengl)
|
||||||
|
flags = Map::OpenGL;
|
||||||
|
|
||||||
|
_map->draw(painter, ir, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -808,6 +818,8 @@ void MapView::scrollContentsBy(int dx, int dy)
|
|||||||
|
|
||||||
void MapView::useOpenGL(bool use)
|
void MapView::useOpenGL(bool use)
|
||||||
{
|
{
|
||||||
|
_opengl = use;
|
||||||
|
|
||||||
if (use)
|
if (use)
|
||||||
setViewport(new OPENGL_WIDGET);
|
setViewport(new OPENGL_WIDGET);
|
||||||
else
|
else
|
||||||
@ -834,23 +846,21 @@ void MapView::reloadMap()
|
|||||||
_scene->invalidate();
|
_scene->invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::updateDevicePixelRatio()
|
void MapView::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
if (_ratio == devicePixelRatioF())
|
if (_deviceRatio == deviceRatio && _mapRatio == mapRatio)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_ratio = devicePixelRatioF();
|
_deviceRatio = deviceRatio;
|
||||||
|
_mapRatio = mapRatio;
|
||||||
|
QPixmapCache::clear();
|
||||||
|
|
||||||
QRectF vr(mapToScene(viewport()->rect()).boundingRect()
|
QRectF vr(mapToScene(viewport()->rect()).boundingRect()
|
||||||
.intersected(_map->bounds()));
|
.intersected(_map->bounds()));
|
||||||
RectC cr(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
|
RectC cr(_map->xy2ll(vr.topLeft()), _map->xy2ll(vr.bottomRight()));
|
||||||
|
|
||||||
_map->setDevicePixelRatio(_ratio);
|
_map->setDevicePixelRatio(_deviceRatio, _mapRatio);
|
||||||
|
|
||||||
digitalZoom(0);
|
|
||||||
|
|
||||||
_map->zoomFit(viewport()->rect().size(), cr);
|
|
||||||
_scene->setSceneRect(_map->bounds());
|
_scene->setSceneRect(_map->bounds());
|
||||||
|
|
||||||
for (int i = 0; i < _tracks.size(); i++)
|
for (int i = 0; i < _tracks.size(); i++)
|
||||||
@ -870,5 +880,8 @@ void MapView::updateDevicePixelRatio()
|
|||||||
centerOn(nc);
|
centerOn(nc);
|
||||||
|
|
||||||
reloadMap();
|
reloadMap();
|
||||||
|
#else // ENABLE_HIDPI
|
||||||
|
Q_UNUSED(deviceRatio);
|
||||||
|
Q_UNUSED(mapRatio);
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
|
#include "common/config.h"
|
||||||
#include "data/waypoint.h"
|
#include "data/waypoint.h"
|
||||||
#include "searchpointer.h"
|
#include "searchpointer.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
class Data;
|
class Data;
|
||||||
class POI;
|
class POI;
|
||||||
@ -69,7 +69,7 @@ public slots:
|
|||||||
void showRouteWaypoints(bool show);
|
void showRouteWaypoints(bool show);
|
||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
void setCoordinatesFormat(CoordinatesFormat format);
|
void setCoordinatesFormat(CoordinatesFormat format);
|
||||||
void updateDevicePixelRatio();
|
void setDevicePixelRatio(qreal deviceRatio, qreal mapRatio);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePOI();
|
void updatePOI();
|
||||||
@ -140,8 +140,10 @@ private:
|
|||||||
bool _plot;
|
bool _plot;
|
||||||
|
|
||||||
#ifdef ENABLE_HIDPI
|
#ifdef ENABLE_HIDPI
|
||||||
qreal _ratio;
|
qreal _deviceRatio;
|
||||||
|
qreal _mapRatio;
|
||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
|
bool _opengl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAPVIEW_H
|
#endif // MAPVIEW_H
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
#ifndef MISC_H
|
|
||||||
#define MISC_H
|
|
||||||
|
|
||||||
double niceNum(double x, int round);
|
|
||||||
|
|
||||||
#endif // MISC_H
|
|
@ -34,26 +34,61 @@ static QFrame *line()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QWidget *OptionsDialog::createGeneralPage()
|
QWidget *OptionsDialog::createMapPage()
|
||||||
{
|
{
|
||||||
_alwaysShowMap = new QCheckBox(tr("Always show the map"));
|
_alwaysShowMap = new QCheckBox(tr("Always show the map"));
|
||||||
_alwaysShowMap->setChecked(_options->alwaysShowMap);
|
_alwaysShowMap->setChecked(_options->alwaysShowMap);
|
||||||
_alwaysShowMap->setToolTip("<p>" +
|
_alwaysShowMap->setToolTip("<p>" +
|
||||||
tr("Show the map even when no files are loaded.") + "</p>");
|
tr("Show the map even when no files are loaded.") + "</p>");
|
||||||
|
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_hidpi = new QRadioButton(tr("High-resolution"));
|
||||||
|
_lodpi = new QRadioButton(tr("Standard"));
|
||||||
|
if (_options->hidpiMap)
|
||||||
|
_hidpi->setChecked(true);
|
||||||
|
else
|
||||||
|
_lodpi->setChecked(true);
|
||||||
|
QLabel *lhi = new QLabel(tr("Non-HiDPI maps are loaded as HiDPI maps. "
|
||||||
|
"The map is sharp but map objects are small/hard to read."));
|
||||||
|
QLabel *llo = new QLabel(tr("Non-HiDPI maps are loaded such as they are. "
|
||||||
|
"Map objects have the expected size but the map is blurry."));
|
||||||
|
QFont f = lhi->font();
|
||||||
|
f.setPointSize(f.pointSize() - 1);
|
||||||
|
lhi->setWordWrap(true);
|
||||||
|
llo->setWordWrap(true);
|
||||||
|
lhi->setFont(f);
|
||||||
|
llo->setFont(f);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
QFormLayout *showMapLayout = new QFormLayout();
|
QFormLayout *showMapLayout = new QFormLayout();
|
||||||
showMapLayout->addWidget(_alwaysShowMap);
|
showMapLayout->addWidget(_alwaysShowMap);
|
||||||
|
|
||||||
QWidget *generalTab = new QWidget();
|
QWidget *mapTab = new QWidget();
|
||||||
QVBoxLayout *generalTabLayout = new QVBoxLayout();
|
QVBoxLayout *mapTabLayout = new QVBoxLayout();
|
||||||
generalTabLayout->addLayout(showMapLayout);
|
mapTabLayout->addLayout(showMapLayout);
|
||||||
generalTabLayout->addStretch();
|
mapTabLayout->addStretch();
|
||||||
generalTab->setLayout(generalTabLayout);
|
mapTab->setLayout(mapTabLayout);
|
||||||
|
|
||||||
QTabWidget *generalPage = new QTabWidget();
|
#ifdef ENABLE_HIDPI
|
||||||
generalPage->addTab(generalTab, tr("General"));
|
QVBoxLayout *hidpiTabLayout = new QVBoxLayout();
|
||||||
|
hidpiTabLayout->addWidget(_lodpi);
|
||||||
|
hidpiTabLayout->addWidget(llo);
|
||||||
|
hidpiTabLayout->addSpacing(10);
|
||||||
|
hidpiTabLayout->addWidget(_hidpi);
|
||||||
|
hidpiTabLayout->addWidget(lhi);
|
||||||
|
hidpiTabLayout->addStretch();
|
||||||
|
|
||||||
return generalPage;
|
QWidget *hidpiTab = new QWidget();
|
||||||
|
hidpiTab->setLayout(hidpiTabLayout);
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
|
QTabWidget *mapPage = new QTabWidget();
|
||||||
|
mapPage->addTab(mapTab, tr("General"));
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
mapPage->addTab(hidpiTab, tr("HiDPI display mode"));
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
|
return mapPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *OptionsDialog::createAppearancePage()
|
QWidget *OptionsDialog::createAppearancePage()
|
||||||
@ -483,8 +518,8 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
: QDialog(parent), _options(options)
|
: QDialog(parent), _options(options)
|
||||||
{
|
{
|
||||||
QStackedWidget *pages = new QStackedWidget();
|
QStackedWidget *pages = new QStackedWidget();
|
||||||
pages->addWidget(createGeneralPage());
|
|
||||||
pages->addWidget(createAppearancePage());
|
pages->addWidget(createAppearancePage());
|
||||||
|
pages->addWidget(createMapPage());
|
||||||
pages->addWidget(createDataPage());
|
pages->addWidget(createDataPage());
|
||||||
pages->addWidget(createPOIPage());
|
pages->addWidget(createPOIPage());
|
||||||
pages->addWidget(createExportPage());
|
pages->addWidget(createExportPage());
|
||||||
@ -492,9 +527,9 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
|
|
||||||
QListWidget *menu = new QListWidget();
|
QListWidget *menu = new QListWidget();
|
||||||
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
|
||||||
new QListWidgetItem(QIcon(APP_ICON), tr("General"), menu);
|
|
||||||
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
|
new QListWidgetItem(QIcon(APPEARANCE_ICON), tr("Appearance"),
|
||||||
menu);
|
menu);
|
||||||
|
new QListWidgetItem(QIcon(MAPS_ICON), tr("Maps"), menu);
|
||||||
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
|
new QListWidgetItem(QIcon(DATA_ICON), tr("Data"), menu);
|
||||||
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
|
new QListWidgetItem(QIcon(POI_ICON), tr("POI"), menu);
|
||||||
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
|
new QListWidgetItem(QIcon(PRINT_EXPORT_ICON), tr("Print & Export"),
|
||||||
@ -532,8 +567,6 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
|
|||||||
|
|
||||||
void OptionsDialog::accept()
|
void OptionsDialog::accept()
|
||||||
{
|
{
|
||||||
_options->alwaysShowMap = _alwaysShowMap->isChecked();
|
|
||||||
|
|
||||||
_options->palette.setColor(_baseColor->color());
|
_options->palette.setColor(_baseColor->color());
|
||||||
_options->palette.setShift(_colorOffset->value());
|
_options->palette.setShift(_colorOffset->value());
|
||||||
_options->mapOpacity = _mapOpacity->value();
|
_options->mapOpacity = _mapOpacity->value();
|
||||||
@ -553,6 +586,11 @@ void OptionsDialog::accept()
|
|||||||
_options->sliderColor = _sliderColor->color();
|
_options->sliderColor = _sliderColor->color();
|
||||||
_options->graphAntiAliasing = _graphAA->isChecked();
|
_options->graphAntiAliasing = _graphAA->isChecked();
|
||||||
|
|
||||||
|
_options->alwaysShowMap = _alwaysShowMap->isChecked();
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
_options->hidpiMap = _hidpi->isChecked();
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
_options->elevationFilter = _elevationFilter->value();
|
_options->elevationFilter = _elevationFilter->value();
|
||||||
_options->speedFilter = _speedFilter->value();
|
_options->speedFilter = _speedFilter->value();
|
||||||
_options->heartRateFilter = _heartRateFilter->value();
|
_options->heartRateFilter = _heartRateFilter->value();
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
#define OPTIONSDIALOG_H
|
#define OPTIONSDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include "common/config.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
class ColorBox;
|
class ColorBox;
|
||||||
class StyleComboBox;
|
class StyleComboBox;
|
||||||
@ -18,8 +17,6 @@ class QRadioButton;
|
|||||||
class PercentSlider;
|
class PercentSlider;
|
||||||
|
|
||||||
struct Options {
|
struct Options {
|
||||||
// General
|
|
||||||
bool alwaysShowMap;
|
|
||||||
// Appearance
|
// Appearance
|
||||||
Palette palette;
|
Palette palette;
|
||||||
int trackWidth;
|
int trackWidth;
|
||||||
@ -36,6 +33,11 @@ struct Options {
|
|||||||
bool graphAntiAliasing;
|
bool graphAntiAliasing;
|
||||||
int mapOpacity;
|
int mapOpacity;
|
||||||
QColor backgroundColor;
|
QColor backgroundColor;
|
||||||
|
// Map
|
||||||
|
bool alwaysShowMap;
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
bool hidpiMap;
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
// Data
|
// Data
|
||||||
int elevationFilter;
|
int elevationFilter;
|
||||||
int speedFilter;
|
int speedFilter;
|
||||||
@ -79,7 +81,7 @@ public slots:
|
|||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *createGeneralPage();
|
QWidget *createMapPage();
|
||||||
QWidget *createAppearancePage();
|
QWidget *createAppearancePage();
|
||||||
QWidget *createDataPage();
|
QWidget *createDataPage();
|
||||||
QWidget *createPOIPage();
|
QWidget *createPOIPage();
|
||||||
@ -88,8 +90,6 @@ private:
|
|||||||
|
|
||||||
Options *_options;
|
Options *_options;
|
||||||
|
|
||||||
// General
|
|
||||||
QCheckBox *_alwaysShowMap;
|
|
||||||
// Appearance
|
// Appearance
|
||||||
ColorBox *_baseColor;
|
ColorBox *_baseColor;
|
||||||
QDoubleSpinBox *_colorOffset;
|
QDoubleSpinBox *_colorOffset;
|
||||||
@ -107,6 +107,12 @@ private:
|
|||||||
QSpinBox *_graphWidth;
|
QSpinBox *_graphWidth;
|
||||||
ColorBox *_sliderColor;
|
ColorBox *_sliderColor;
|
||||||
QCheckBox *_graphAA;
|
QCheckBox *_graphAA;
|
||||||
|
// Map
|
||||||
|
QCheckBox *_alwaysShowMap;
|
||||||
|
#ifdef ENABLE_HIDPI
|
||||||
|
QRadioButton *_hidpi;
|
||||||
|
QRadioButton *_lodpi;
|
||||||
|
#endif // ENABLE_HIDPI
|
||||||
// Data
|
// Data
|
||||||
OddSpinBox *_elevationFilter;
|
OddSpinBox *_elevationFilter;
|
||||||
OddSpinBox *_speedFilter;
|
OddSpinBox *_speedFilter;
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QApplication>
|
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include "common/greatcircle.h"
|
||||||
#include "map/map.h"
|
#include "map/map.h"
|
||||||
#include "tooltip.h"
|
|
||||||
#include "nicenum.h"
|
|
||||||
#include "pathitem.h"
|
#include "pathitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define GEOGRAPHICAL_MILE 1855.3248
|
||||||
|
|
||||||
|
static unsigned segments(qreal distance)
|
||||||
|
{
|
||||||
|
return ceil(distance / GEOGRAPHICAL_MILE);
|
||||||
|
}
|
||||||
|
|
||||||
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
||||||
: QGraphicsObject(parent)
|
: QGraphicsObject(parent)
|
||||||
{
|
{
|
||||||
@ -21,7 +26,7 @@ PathItem::PathItem(const Path &path, Map *map, QGraphicsItem *parent)
|
|||||||
QBrush brush(Qt::SolidPattern);
|
QBrush brush(Qt::SolidPattern);
|
||||||
_pen = QPen(brush, _width);
|
_pen = QPen(brush, _width);
|
||||||
|
|
||||||
updatePainterPath(map);
|
updatePainterPath();
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
_marker = new MarkerItem(this);
|
_marker = new MarkerItem(this);
|
||||||
@ -39,13 +44,54 @@ void PathItem::updateShape()
|
|||||||
_shape = s.createStroke(_painterPath);
|
_shape = s.createStroke(_painterPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::updatePainterPath(Map *map)
|
void PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
|
||||||
|
{
|
||||||
|
if (fabs(c1.lon() - c2.lon()) > 180.0) {
|
||||||
|
// Split segment on date line crossing
|
||||||
|
QPointF p;
|
||||||
|
|
||||||
|
if (c2.lon() < 0) {
|
||||||
|
QLineF l(QPointF(c1.lon(), c1.lat()), QPointF(c2.lon() + 360,
|
||||||
|
c2.lat()));
|
||||||
|
QLineF dl(QPointF(180, -90), QPointF(180, 90));
|
||||||
|
l.intersect(dl, &p);
|
||||||
|
_painterPath.lineTo(_map->ll2xy(Coordinates(180, p.y())));
|
||||||
|
_painterPath.moveTo(_map->ll2xy(Coordinates(-180, p.y())));
|
||||||
|
} else {
|
||||||
|
QLineF l(QPointF(c1.lon(), c1.lat()), QPointF(c2.lon() - 360,
|
||||||
|
c2.lat()));
|
||||||
|
QLineF dl(QPointF(-180, -90), QPointF(-180, 90));
|
||||||
|
l.intersect(dl, &p);
|
||||||
|
_painterPath.lineTo(_map->ll2xy(Coordinates(-180, p.y())));
|
||||||
|
_painterPath.moveTo(_map->ll2xy(Coordinates(180, p.y())));
|
||||||
|
}
|
||||||
|
_painterPath.lineTo(_map->ll2xy(c2));
|
||||||
|
} else
|
||||||
|
_painterPath.lineTo(_map->ll2xy(c2));
|
||||||
|
}
|
||||||
|
|
||||||
|
void PathItem::updatePainterPath()
|
||||||
{
|
{
|
||||||
_painterPath = QPainterPath();
|
_painterPath = QPainterPath();
|
||||||
|
|
||||||
_painterPath.moveTo(map->ll2xy(_path.first().coordinates()));
|
_painterPath.moveTo(_map->ll2xy(_path.first().coordinates()));
|
||||||
for (int i = 1; i < _path.size(); i++)
|
for (int i = 1; i < _path.size(); i++) {
|
||||||
_painterPath.lineTo(map->ll2xy(_path.at(i).coordinates()));
|
const PathPoint &p1 = _path.at(i-1);
|
||||||
|
const PathPoint &p2 = _path.at(i);
|
||||||
|
unsigned n = segments(p2.distance() - p1.distance());
|
||||||
|
|
||||||
|
if (n > 1) {
|
||||||
|
GreatCircle gc(p1.coordinates(), p2.coordinates());
|
||||||
|
Coordinates last = p1.coordinates();
|
||||||
|
|
||||||
|
for (unsigned j = 1; j <= n; j++) {
|
||||||
|
Coordinates c(gc.pointAt(j/(double)n));
|
||||||
|
addSegment(last, c);
|
||||||
|
last = c;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
addSegment(p1.coordinates(), p2.coordinates());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
void PathItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
@ -70,7 +116,7 @@ void PathItem::setMap(Map *map)
|
|||||||
|
|
||||||
_map = map;
|
_map = map;
|
||||||
|
|
||||||
updatePainterPath(map);
|
updatePainterPath();
|
||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
_marker->setPos(position(_markerDistance));
|
_marker->setPos(position(_markerDistance));
|
||||||
@ -141,19 +187,40 @@ QPointF PathItem::position(qreal x) const
|
|||||||
return _map->ll2xy(_path.at(mid).coordinates());
|
return _map->ll2xy(_path.at(mid).coordinates());
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineF l;
|
Coordinates c1, c2;
|
||||||
qreal p1, p2;
|
qreal p1, p2;
|
||||||
|
|
||||||
if (_path.at(mid).distance() < x) {
|
if (_path.at(mid).distance() < x) {
|
||||||
l = QLineF(_map->ll2xy(_path.at(mid).coordinates()),
|
c1 = _path.at(mid).coordinates(); c2 = _path.at(mid+1).coordinates();
|
||||||
_map->ll2xy(_path.at(mid+1).coordinates()));
|
|
||||||
p1 = _path.at(mid).distance(); p2 = _path.at(mid+1).distance();
|
p1 = _path.at(mid).distance(); p2 = _path.at(mid+1).distance();
|
||||||
} else {
|
} else {
|
||||||
l = QLineF(_map->ll2xy(_path.at(mid-1).coordinates()),
|
c1 = _path.at(mid-1).coordinates(); c2 = _path.at(mid).coordinates();
|
||||||
_map->ll2xy(_path.at(mid).coordinates()));
|
|
||||||
p1 = _path.at(mid-1).distance(); p2 = _path.at(mid).distance();
|
p1 = _path.at(mid-1).distance(); p2 = _path.at(mid).distance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned n = segments(p2 - p1);
|
||||||
|
if (n > 1) {
|
||||||
|
GreatCircle gc(c1, c2);
|
||||||
|
|
||||||
|
// Great circle point
|
||||||
|
double f = (x - p1) / (p2 - p1);
|
||||||
|
QPointF p(_map->ll2xy(gc.pointAt(f)));
|
||||||
|
|
||||||
|
// Segment line of the great circle path
|
||||||
|
double f1 = floor(n * f) / n;
|
||||||
|
double f2 = ceil(n * f) / n;
|
||||||
|
QLineF l(_map->ll2xy(gc.pointAt(f1)), _map->ll2xy(gc.pointAt(f2)));
|
||||||
|
|
||||||
|
// Project the great circle point to the segment line
|
||||||
|
QLineF u = l.unitVector();
|
||||||
|
double lambda = (u.dx() * (p.x() - l.p1().x())) + (u.dy() * (p.y()
|
||||||
|
- l.p1().y()));
|
||||||
|
return QPointF((u.dx() * lambda) + l.p1().x(), (u.dy() * lambda)
|
||||||
|
+ l.p1().y());
|
||||||
|
} else {
|
||||||
|
QLineF l(_map->ll2xy(c1), _map->ll2xy(c2));
|
||||||
return l.pointAt((x - p1) / (p2 - p1));
|
return l.pointAt((x - p1) / (p2 - p1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PathItem::moveMarker(qreal distance)
|
void PathItem::moveMarker(qreal distance)
|
||||||
|
@ -43,8 +43,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QPointF position(qreal distance) const;
|
QPointF position(qreal distance) const;
|
||||||
void updatePainterPath(Map *map);
|
void updatePainterPath();
|
||||||
void updateShape();
|
void updateShape();
|
||||||
|
void addSegment(const Coordinates &c1, const Coordinates &c2);
|
||||||
|
|
||||||
|
|
||||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
#include <QSlider>
|
#include <QSlider>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
#include <QLocale>
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "percentslider.h"
|
#include "percentslider.h"
|
||||||
|
|
||||||
|
|
||||||
static QString format(int value)
|
static QString format(int value)
|
||||||
{
|
{
|
||||||
return QString::number(value) + UNIT_SPACE + QString("%");
|
return QLocale::system().toString(value) + UNIT_SPACE + QString("%");
|
||||||
}
|
}
|
||||||
|
|
||||||
PercentSlider::PercentSlider(QWidget *parent) : QWidget(parent)
|
PercentSlider::PercentSlider(QWidget *parent) : QWidget(parent)
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "powergraphitem.h"
|
#include "powergraphitem.h"
|
||||||
#include "powergraph.h"
|
#include "powergraph.h"
|
||||||
@ -16,9 +17,11 @@ PowerGraph::PowerGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
void PowerGraph::setInfo()
|
void PowerGraph::setInfo()
|
||||||
{
|
{
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
|
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
} else
|
} else
|
||||||
clearInfo();
|
clearInfo();
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "powergraphitem.h"
|
#include "powergraphitem.h"
|
||||||
|
|
||||||
|
|
||||||
PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type,
|
PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||||
{
|
{
|
||||||
qreal sum = 0;
|
qreal sum = 0;
|
||||||
|
_max = graph.first().y();
|
||||||
|
|
||||||
for (int j = 1; j < graph.size(); j++)
|
for (int i = 1; i < graph.size(); i++) {
|
||||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
qreal y = graph.at(i).y();
|
||||||
|
sum += y * (graph.at(i).s() - graph.at(i-1).s());
|
||||||
|
if (y > _max)
|
||||||
|
_max = y;
|
||||||
|
}
|
||||||
_avg = sum/graph.last().s();
|
_avg = sum/graph.last().s();
|
||||||
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
@ -16,11 +23,12 @@ PowerGraphItem::PowerGraphItem(const Graph &graph, GraphType type,
|
|||||||
QString PowerGraphItem::toolTip() const
|
QString PowerGraphItem::toolTip() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Maximum"), QString::number(max(), 'f', 1)
|
tt.insert(tr("Maximum"), l.toString(max(), 'f', 1)
|
||||||
+ UNIT_SPACE + tr("1/min"));
|
+ UNIT_SPACE + tr("W"));
|
||||||
tt.insert(tr("Average"), QString::number(avg(), 'f', 1)
|
tt.insert(tr("Average"), l.toString(avg(), 'f', 1)
|
||||||
+ UNIT_SPACE + tr("1/min"));
|
+ UNIT_SPACE + tr("W"));
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ public:
|
|||||||
PowerGraphItem(const Graph &graph, GraphType type,
|
PowerGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
qreal avg() const {return _avg;}
|
qreal avg() const {return _avg;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString toolTip() const;
|
QString toolTip() const;
|
||||||
|
|
||||||
qreal _avg;
|
qreal _avg, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // POWERGRAPHITEM_H
|
#endif // POWERGRAPHITEM_H
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "common/util.h"
|
||||||
#include "nicenum.h"
|
#include "font.h"
|
||||||
#include "scaleitem.h"
|
#include "scaleitem.h"
|
||||||
|
|
||||||
|
|
||||||
#define BORDER_WIDTH 1
|
#define BORDER_WIDTH 1
|
||||||
#define SCALE_WIDTH 132
|
#define SCALE_WIDTH 135
|
||||||
#define SCALE_HEIGHT 5
|
#define SCALE_HEIGHT 5
|
||||||
#define SEGMENTS 3
|
#define SEGMENTS 3
|
||||||
#define PADDING 4
|
#define PADDING 4
|
||||||
|
@ -156,5 +156,7 @@
|
|||||||
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
|
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
|
||||||
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
|
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
|
||||||
#define ALWAYS_SHOW_MAP_DEFAULT true
|
#define ALWAYS_SHOW_MAP_DEFAULT true
|
||||||
|
#define HIDPI_MAP_SETTING "HiDPIMap"
|
||||||
|
#define HIDPI_MAP_DEFAULT true
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "font.h"
|
||||||
#include "sliderinfoitem.h"
|
#include "sliderinfoitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "config.h"
|
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "speedgraphitem.h"
|
#include "speedgraphitem.h"
|
||||||
@ -21,13 +21,14 @@ SpeedGraph::SpeedGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
void SpeedGraph::setInfo()
|
void SpeedGraph::setInfo()
|
||||||
{
|
{
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
|
QLocale l(QLocale::system());
|
||||||
QString pace = Format::timeSpan((3600.0 / (avg() * yScale())), false);
|
QString pace = Format::timeSpan((3600.0 / (avg() * yScale())), false);
|
||||||
QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ?
|
QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ?
|
||||||
tr("min/mi") : tr("min/nmi");
|
tr("min/mi") : tr("min/nmi");
|
||||||
|
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f',
|
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale(), 'f',
|
||||||
1) + UNIT_SPACE + yUnits());
|
1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale(), 'f',
|
||||||
1) + UNIT_SPACE + yUnits());
|
1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Pace"), pace + UNIT_SPACE + pu);
|
GraphView::addInfo(tr("Pace"), pace + UNIT_SPACE + pu);
|
||||||
} else
|
} else
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "speedgraphitem.h"
|
#include "speedgraphitem.h"
|
||||||
|
|
||||||
|
|
||||||
SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type,
|
SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type,
|
||||||
qreal movingTime, QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
qreal movingTime, QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||||
{
|
{
|
||||||
@ -11,6 +13,13 @@ SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type,
|
|||||||
_avg = graph.last().s() / graph.last().t();
|
_avg = graph.last().s() / graph.last().t();
|
||||||
_mavg = graph.last().s() / movingTime;
|
_mavg = graph.last().s() / movingTime;
|
||||||
|
|
||||||
|
_max = graph.first().y();
|
||||||
|
for (int i = 1; i < graph.size(); i++) {
|
||||||
|
qreal y = graph.at(i).y();
|
||||||
|
if (y > _max)
|
||||||
|
_max = y;
|
||||||
|
}
|
||||||
|
|
||||||
setToolTip(toolTip());
|
setToolTip(toolTip());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,10 +34,11 @@ QString SpeedGraphItem::toolTip() const
|
|||||||
? avg() * scale : mavg() * scale)), false);
|
? avg() * scale : mavg() * scale)), false);
|
||||||
QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ?
|
QString pu = (_units == Metric) ? tr("min/km") : (_units == Imperial) ?
|
||||||
tr("min/mi") : tr("min/nmi");
|
tr("min/mi") : tr("min/nmi");
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 1)
|
tt.insert(tr("Maximum"), l.toString(max() * scale, 'f', 1)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
tt.insert(tr("Average"), QString::number((_timeType == Total)
|
tt.insert(tr("Average"), l.toString((_timeType == Total)
|
||||||
? avg() * scale : mavg() * scale, 'f', 1) + UNIT_SPACE + su);
|
? avg() * scale : mavg() * scale, 'f', 1) + UNIT_SPACE + su);
|
||||||
tt.insert(tr("Pace"), pace + UNIT_SPACE + pu);
|
tt.insert(tr("Pace"), pace + UNIT_SPACE + pu);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ public:
|
|||||||
SpeedGraphItem(const Graph &graph, GraphType type, qreal movingTime,
|
SpeedGraphItem(const Graph &graph, GraphType type, qreal movingTime,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
qreal avg() const {return _avg;}
|
qreal avg() const {return _avg;}
|
||||||
qreal mavg() const {return _mavg;}
|
qreal mavg() const {return _mavg;}
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QString toolTip() const;
|
QString toolTip() const;
|
||||||
|
|
||||||
qreal _avg, _mavg;
|
qreal _avg, _mavg, _max;
|
||||||
|
|
||||||
Units _units;
|
Units _units;
|
||||||
TimeType _timeType;
|
TimeType _timeType;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "data/data.h"
|
#include "data/data.h"
|
||||||
#include "temperaturegraphitem.h"
|
#include "temperaturegraphitem.h"
|
||||||
#include "temperaturegraph.h"
|
#include "temperaturegraph.h"
|
||||||
@ -16,11 +17,13 @@ TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphTab(parent)
|
|||||||
void TemperatureGraph::setInfo()
|
void TemperatureGraph::setInfo()
|
||||||
{
|
{
|
||||||
if (_showTracks) {
|
if (_showTracks) {
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
|
GraphView::addInfo(tr("Average"), l.toString(avg() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale()
|
GraphView::addInfo(tr("Minimum"), l.toString(min() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
|
GraphView::addInfo(tr("Maximum"), l.toString(max() * yScale()
|
||||||
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
} else
|
} else
|
||||||
clearInfo();
|
clearInfo();
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
|
#include <QLocale>
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "temperaturegraphitem.h"
|
#include "temperaturegraphitem.h"
|
||||||
|
|
||||||
|
|
||||||
TemperatureGraphItem::TemperatureGraphItem(const Graph &graph, GraphType type,
|
TemperatureGraphItem::TemperatureGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
QGraphicsItem *parent) : GraphItem(graph, type, parent)
|
||||||
{
|
{
|
||||||
qreal sum = 0;
|
qreal sum = 0;
|
||||||
|
_min = _max = graph.first().y();
|
||||||
|
|
||||||
|
for (int j = 1; j < graph.size(); j++) {
|
||||||
|
qreal y = graph.at(j).y();
|
||||||
|
|
||||||
for (int j = 1; j < graph.size(); j++)
|
|
||||||
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
sum += graph.at(j).y() * (graph.at(j).s() - graph.at(j-1).s());
|
||||||
|
|
||||||
|
if (y > _max)
|
||||||
|
_max = y;
|
||||||
|
if (y < _min)
|
||||||
|
_min = y;
|
||||||
|
}
|
||||||
_avg = sum/graph.last().s();
|
_avg = sum/graph.last().s();
|
||||||
|
|
||||||
setToolTip(toolTip(Metric));
|
setToolTip(toolTip(Metric));
|
||||||
@ -20,12 +31,13 @@ QString TemperatureGraphItem::toolTip(Units units) const
|
|||||||
qreal offset = (units == Metric) ? 0 : C2FO;
|
qreal offset = (units == Metric) ? 0 : C2FO;
|
||||||
QString su = (units == Metric) ?
|
QString su = (units == Metric) ?
|
||||||
QChar(0x00B0) + tr("C") : QChar(0x00B0) + tr("F");
|
QChar(0x00B0) + tr("C") : QChar(0x00B0) + tr("F");
|
||||||
|
QLocale l(QLocale::system());
|
||||||
|
|
||||||
tt.insert(tr("Average"), QString::number(avg() * scale + offset, 'f', 1)
|
tt.insert(tr("Average"), l.toString(avg() * scale + offset, 'f', 1)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
tt.insert(tr("Maximum"), QString::number(max() * scale + offset, 'f', 1)
|
tt.insert(tr("Maximum"), l.toString(max() * scale + offset, 'f', 1)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
tt.insert(tr("Minimum"), QString::number(min() * scale + offset, 'f', 1)
|
tt.insert(tr("Minimum"), l.toString(min() * scale + offset, 'f', 1)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
|
|
||||||
return tt.toString();
|
return tt.toString();
|
||||||
|
@ -11,8 +11,8 @@ public:
|
|||||||
TemperatureGraphItem(const Graph &graph, GraphType type,
|
TemperatureGraphItem(const Graph &graph, GraphType type,
|
||||||
QGraphicsItem *parent = 0);
|
QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
qreal max() const {return -bounds().top();}
|
qreal max() const {return _max;}
|
||||||
qreal min() const {return -bounds().bottom();}
|
qreal min() const {return _min;}
|
||||||
qreal avg() const {return _avg;}
|
qreal avg() const {return _avg;}
|
||||||
|
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
@ -20,7 +20,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QString toolTip(Units units) const;
|
QString toolTip(Units units) const;
|
||||||
|
|
||||||
qreal _avg;
|
qreal _avg, _min, _max;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEMPERATUREGRAPHITEM_H
|
#endif // TEMPERATUREGRAPHITEM_H
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
void ToolTip::insert(const QString &key, const QString &value)
|
void ToolTip::insert(const QString &key, const QString &value)
|
||||||
{
|
{
|
||||||
QPair<QString, QString> entry(key, value);
|
_list.append(KV(key, value));
|
||||||
_list.append(entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ToolTip::toString()
|
QString ToolTip::toString()
|
||||||
@ -11,8 +10,8 @@ QString ToolTip::toString()
|
|||||||
QString ret = "<table>";
|
QString ret = "<table>";
|
||||||
|
|
||||||
for (int i = 0; i < _list.count(); i++)
|
for (int i = 0; i < _list.count(); i++)
|
||||||
ret += "<tr><td align=\"right\"><b>" + _list.at(i).first
|
ret += "<tr><td align=\"right\"><b>" + _list.at(i).key()
|
||||||
+ ": </b></td><td>" + _list.at(i).second + "</td></tr>";
|
+ ": </b></td><td>" + _list.at(i).value() + "</td></tr>";
|
||||||
|
|
||||||
ret += "</table>";
|
ret += "</table>";
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPair>
|
#include "common/kv.h"
|
||||||
|
|
||||||
class ToolTip
|
class ToolTip
|
||||||
{
|
{
|
||||||
@ -12,7 +12,7 @@ public:
|
|||||||
QString toString();
|
QString toString();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<QPair<QString, QString> > _list;
|
QList<KV> _list;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOOLTIP_H
|
#endif // TOOLTIP_H
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QPaintDevice>
|
#include <QPaintDevice>
|
||||||
#include "config.h"
|
|
||||||
#include "infoitem.h"
|
#include "infoitem.h"
|
||||||
#include "trackinfo.h"
|
#include "trackinfo.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "font.h"
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "waypointitem.h"
|
#include "waypointitem.h"
|
||||||
|
|
||||||
|
17
src/common/config.h
Normal file
17
src/common/config.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
#define APP_NAME "GPXSee"
|
||||||
|
#define APP_HOMEPAGE "http://www.gpxsee.org"
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1)
|
||||||
|
#define ENABLE_HTTP2
|
||||||
|
#endif // QT >= 5.10.1
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
|
#define ENABLE_HIDPI
|
||||||
|
#endif // QT >= 5.6
|
||||||
|
|
||||||
|
#endif /* CONFIG_H */
|
@ -32,6 +32,8 @@ private:
|
|||||||
double _lat, _lon;
|
double _lat, _lon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_TYPEINFO(Coordinates, Q_PRIMITIVE_TYPE);
|
||||||
|
|
||||||
inline bool operator==(const Coordinates &c1, const Coordinates &c2)
|
inline bool operator==(const Coordinates &c1, const Coordinates &c2)
|
||||||
{return (c1.lat() == c2.lat() && c1.lon() == c2.lon());}
|
{return (c1.lat() == c2.lat() && c1.lon() == c2.lon());}
|
||||||
inline bool operator!=(const Coordinates &c1, const Coordinates &c2)
|
inline bool operator!=(const Coordinates &c1, const Coordinates &c2)
|
||||||
|
34
src/common/greatcircle.cpp
Normal file
34
src/common/greatcircle.cpp
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#include "greatcircle.h"
|
||||||
|
|
||||||
|
GreatCircle::GreatCircle(const Coordinates &c1, const Coordinates &c2)
|
||||||
|
{
|
||||||
|
double lat1 = deg2rad(c1.lat());
|
||||||
|
double lon1 = deg2rad(c1.lon());
|
||||||
|
double lat2 = deg2rad(c2.lat());
|
||||||
|
double lon2 = deg2rad(c2.lon());
|
||||||
|
|
||||||
|
double cosLat1 = cos(lat1);
|
||||||
|
double cosLat2 = cos(lat2);
|
||||||
|
_sinLat1 = sin(lat1);
|
||||||
|
_sinLat2 = sin(lat2);
|
||||||
|
|
||||||
|
_xA = cosLat1 * cos(lon1);
|
||||||
|
_xB = cosLat2 * cos(lon2);
|
||||||
|
_yA = cosLat1 * sin(lon1);
|
||||||
|
_yB = cosLat2 * sin(lon2);
|
||||||
|
|
||||||
|
_d = 2 * asin(sqrt(pow((sin((lat1 - lat2) / 2)), 2) + cosLat1 * cosLat2
|
||||||
|
* pow(sin((lon1 - lon2) / 2), 2)));
|
||||||
|
_sinD = sin(_d);
|
||||||
|
}
|
||||||
|
|
||||||
|
Coordinates GreatCircle::pointAt(double f) const
|
||||||
|
{
|
||||||
|
double A = sin((1.0 - f) * _d) / _sinD;
|
||||||
|
double B = sin(f * _d) / _sinD;
|
||||||
|
double x = A * _xA + B * _xB;
|
||||||
|
double y = A * _yA + B * _yB;
|
||||||
|
double z = A * _sinLat1 + B * _sinLat2;
|
||||||
|
|
||||||
|
return Coordinates(rad2deg(atan2(y, x)), rad2deg(atan2(z, sqrt(x*x + y*y))));
|
||||||
|
}
|
20
src/common/greatcircle.h
Normal file
20
src/common/greatcircle.h
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#ifndef GREATCIRCLE_H
|
||||||
|
#define GREATCIRCLE_H
|
||||||
|
|
||||||
|
#include "coordinates.h"
|
||||||
|
|
||||||
|
class GreatCircle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GreatCircle(const Coordinates &c1, const Coordinates &c2);
|
||||||
|
|
||||||
|
Coordinates pointAt(double f) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
double _xA, _xB, _yA, _yB;
|
||||||
|
double _d;
|
||||||
|
double _sinD;
|
||||||
|
double _sinLat1, _sinLat2;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GREATCIRCLE_H
|
174
src/common/programpaths.cpp
Normal file
174
src/common/programpaths.cpp
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
#include <QtGlobal>
|
||||||
|
#include <QDir>
|
||||||
|
#include "programpaths.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define MAP_DIR "maps"
|
||||||
|
#define POI_DIR "POI"
|
||||||
|
#define CSV_DIR "csv"
|
||||||
|
#define TILES_DIR "tiles"
|
||||||
|
#define TRANSLATIONS_DIR "translations"
|
||||||
|
#define ELLIPSOID_FILE "ellipsoids.csv"
|
||||||
|
#define GCS_FILE "gcs.csv"
|
||||||
|
#define PCS_FILE "pcs.csv"
|
||||||
|
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0)
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN32)
|
||||||
|
#define USER_DIR QDir::homePath() + QString("/AppData/Roaming/") \
|
||||||
|
+ qApp->applicationName()
|
||||||
|
#define GLOBAL_DIR QApplication::applicationDirPath()
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
#define USER_DIR QDir::homePath() \
|
||||||
|
+ QString("/Library/Application Support/") \
|
||||||
|
+ qApp->applicationName()
|
||||||
|
#define GLOBAL_DIR QApplication::applicationDirPath() \
|
||||||
|
+ QString("/../Resources")
|
||||||
|
#else
|
||||||
|
#define USER_DIR QDir::homePath() + QString("/.local/share/") \
|
||||||
|
+ qApp->applicationName()
|
||||||
|
#define GLOBAL_DIR QString("/usr/share/") + qApp->applicationName()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static QString dir(const QString &dirName, bool writable = false)
|
||||||
|
{
|
||||||
|
QDir userDir(QDir(USER_DIR).filePath(dirName));
|
||||||
|
|
||||||
|
if (writable || userDir.exists())
|
||||||
|
return userDir.absolutePath();
|
||||||
|
else {
|
||||||
|
QDir globalDir(QDir(GLOBAL_DIR).filePath(dirName));
|
||||||
|
|
||||||
|
if (globalDir.exists())
|
||||||
|
return globalDir.absolutePath();
|
||||||
|
else
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString file(const QString &path, const QString &fileName)
|
||||||
|
{
|
||||||
|
if (path.isNull())
|
||||||
|
return QString();
|
||||||
|
|
||||||
|
QFileInfo fi(QDir(path).filePath(fileName));
|
||||||
|
return fi.exists() ? fi.absoluteFilePath() : QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::mapDir(bool writable)
|
||||||
|
{
|
||||||
|
return dir(MAP_DIR, writable);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::poiDir(bool writable)
|
||||||
|
{
|
||||||
|
return dir(POI_DIR, writable);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::csvDir(bool writable)
|
||||||
|
{
|
||||||
|
return dir(CSV_DIR, writable);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::tilesDir()
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_WIN32)
|
||||||
|
return QDir::homePath() + QString("/AppData/Local/")
|
||||||
|
+ qApp->applicationName() + QString("/cache/") + QString(TILES_DIR);
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
return QDir::homePath() + QString("/Library/Caches/")
|
||||||
|
+ qApp->applicationName() + QString("/" TILES_DIR);
|
||||||
|
#else
|
||||||
|
return QDir::homePath() + QString("/.cache/") + qApp->applicationName()
|
||||||
|
+ QString("/" TILES_DIR);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::translationsDir()
|
||||||
|
{
|
||||||
|
return dir(TRANSLATIONS_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::ellipsoidsFile()
|
||||||
|
{
|
||||||
|
return file(dir(CSV_DIR), ELLIPSOID_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::gcsFile()
|
||||||
|
{
|
||||||
|
return file(dir(CSV_DIR), GCS_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::pcsFile()
|
||||||
|
{
|
||||||
|
return file(dir(CSV_DIR), PCS_FILE);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
QString ProgramPaths::mapDir(bool writable)
|
||||||
|
{
|
||||||
|
if (writable)
|
||||||
|
return QDir(QStandardPaths::writableLocation(
|
||||||
|
QStandardPaths::AppDataLocation)).filePath(MAP_DIR);
|
||||||
|
else
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
MAP_DIR, QStandardPaths::LocateDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::poiDir(bool writable)
|
||||||
|
{
|
||||||
|
if (writable)
|
||||||
|
return QDir(QStandardPaths::writableLocation(
|
||||||
|
QStandardPaths::AppDataLocation)).filePath(POI_DIR);
|
||||||
|
else
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
POI_DIR, QStandardPaths::LocateDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::csvDir(bool writable)
|
||||||
|
{
|
||||||
|
if (writable)
|
||||||
|
return QDir(QStandardPaths::writableLocation(
|
||||||
|
QStandardPaths::AppDataLocation)).filePath(CSV_DIR);
|
||||||
|
else
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
CSV_DIR, QStandardPaths::LocateDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::tilesDir()
|
||||||
|
{
|
||||||
|
return QDir(QStandardPaths::writableLocation(
|
||||||
|
QStandardPaths::CacheLocation)).filePath(TILES_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::translationsDir()
|
||||||
|
{
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
TRANSLATIONS_DIR, QStandardPaths::LocateDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::ellipsoidsFile()
|
||||||
|
{
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
CSV_DIR "/" ELLIPSOID_FILE, QStandardPaths::LocateFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::gcsFile()
|
||||||
|
{
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
CSV_DIR "/" GCS_FILE, QStandardPaths::LocateFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ProgramPaths::pcsFile()
|
||||||
|
{
|
||||||
|
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
|
||||||
|
CSV_DIR "/" PCS_FILE, QStandardPaths::LocateFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // QT_VERSION < 5
|
18
src/common/programpaths.h
Normal file
18
src/common/programpaths.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef PROGRAMPATHS_H
|
||||||
|
#define PROGRAMPATHS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace ProgramPaths
|
||||||
|
{
|
||||||
|
QString mapDir(bool writable = false);
|
||||||
|
QString poiDir(bool writable = false);
|
||||||
|
QString csvDir(bool writable = false);
|
||||||
|
QString tilesDir();
|
||||||
|
QString translationsDir();
|
||||||
|
QString ellipsoidsFile();
|
||||||
|
QString gcsFile();
|
||||||
|
QString pcsFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PROGRAMPATHS_H
|
@ -8,7 +8,7 @@ class Range
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Range() {_min = 0; _max = 0;}
|
Range() {_min = 0; _max = 0;}
|
||||||
Range(int min, int max) {_min = min, _max = max;}
|
Range(int min, int max) : _min(min), _max(max) {}
|
||||||
|
|
||||||
int min() const {return _min;}
|
int min() const {return _min;}
|
||||||
int max() const {return _max;}
|
int max() const {return _max;}
|
||||||
@ -19,6 +19,8 @@ public:
|
|||||||
void setMin(int min) {_min = min;}
|
void setMin(int min) {_min = min;}
|
||||||
void setMax(int max) {_max = max;}
|
void setMax(int max) {_max = max;}
|
||||||
|
|
||||||
|
bool contains(int val) const {return (val >= _min && val <= _max);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _min, _max;
|
int _min, _max;
|
||||||
};
|
};
|
||||||
@ -27,7 +29,7 @@ class RangeF
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RangeF() {_min = 0; _max = 0;}
|
RangeF() {_min = 0; _max = 0;}
|
||||||
RangeF(qreal min, qreal max) {_min = min, _max = max;}
|
RangeF(qreal min, qreal max) : _min(min), _max(max) {}
|
||||||
|
|
||||||
RangeF operator&(const RangeF &r) const;
|
RangeF operator&(const RangeF &r) const;
|
||||||
RangeF &operator&=(const RangeF &r) {*this = *this & r; return *this;}
|
RangeF &operator&=(const RangeF &r) {*this = *this & r; return *this;}
|
||||||
|
@ -23,6 +23,11 @@ public:
|
|||||||
{return Coordinates((_tl.lon() + _br.lon()) / 2.0,
|
{return Coordinates((_tl.lon() + _br.lon()) / 2.0,
|
||||||
(_tl.lat() + _br.lat()) / 2.0);}
|
(_tl.lat() + _br.lat()) / 2.0);}
|
||||||
|
|
||||||
|
double top() const {return _tl.lat();}
|
||||||
|
double bottom() const {return _br.lat();}
|
||||||
|
double left() const {return _tl.lon();}
|
||||||
|
double right() const {return _br.lon();}
|
||||||
|
|
||||||
RectC operator|(const RectC &r) const;
|
RectC operator|(const RectC &r) const;
|
||||||
RectC &operator|=(const RectC &r) {*this = *this | r; return *this;}
|
RectC &operator|=(const RectC &r) {*this = *this | r; return *this;}
|
||||||
RectC operator&(const RectC &r) const;
|
RectC operator&(const RectC &r) const;
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#include <cctype>
|
|
||||||
#include "str2int.h"
|
|
||||||
|
|
||||||
int str2int(const char *str, int len)
|
|
||||||
{
|
|
||||||
int res = 0;
|
|
||||||
|
|
||||||
for (const char *sp = str; sp < str + len; sp++) {
|
|
||||||
if (::isdigit(*sp))
|
|
||||||
res = res * 10 + *sp - '0';
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
#ifndef MISC_H
|
|
||||||
#define MISC_H
|
|
||||||
|
|
||||||
int str2int(const char *str, int len);
|
|
||||||
|
|
||||||
#endif // MISC_H
|
|
@ -1,5 +1,21 @@
|
|||||||
|
#include <cctype>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "nicenum.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
|
int str2int(const char *str, int len)
|
||||||
|
{
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
|
for (const char *sp = str; sp < str + len; sp++) {
|
||||||
|
if (::isdigit(*sp))
|
||||||
|
res = res * 10 + *sp - '0';
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
double niceNum(double x, int round)
|
double niceNum(double x, int round)
|
||||||
{
|
{
|
7
src/common/util.h
Normal file
7
src/common/util.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#ifndef UTIL_H
|
||||||
|
#define UTIL_H
|
||||||
|
|
||||||
|
int str2int(const char *str, int len);
|
||||||
|
double niceNum(double x, int round);
|
||||||
|
|
||||||
|
#endif // UTIL_H
|
58
src/config.h
58
src/config.h
@ -1,58 +0,0 @@
|
|||||||
#ifndef CONFIG_H
|
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
#define APP_NAME "GPXSee"
|
|
||||||
#define APP_HOMEPAGE "http://www.gpxsee.org"
|
|
||||||
|
|
||||||
#define FONT_FAMILY "Arial"
|
|
||||||
#define FONT_SIZE 12 // px
|
|
||||||
|
|
||||||
#define MAP_DIR QString("maps")
|
|
||||||
#define POI_DIR QString("POI")
|
|
||||||
#define CSV_DIR QString("csv")
|
|
||||||
#define ELLIPSOID_FILE QString("ellipsoids.csv")
|
|
||||||
#define GCS_FILE QString("gcs.csv")
|
|
||||||
#define PCS_FILE QString("pcs.csv")
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32)
|
|
||||||
#define USER_DIR QDir::homePath() + QString("/GPXSee")
|
|
||||||
#define GLOBAL_DIR QApplication::applicationDirPath()
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
#define USER_DIR QDir::homePath() + QString("/.gpxsee")
|
|
||||||
#define GLOBAL_DIR QApplication::applicationDirPath() \
|
|
||||||
+ QString("/../Resources")
|
|
||||||
#else
|
|
||||||
#define USER_DIR QDir::homePath() + QString("/.gpxsee")
|
|
||||||
#define GLOBAL_DIR QString("/usr/share/gpxsee")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define USER_CSV_DIR USER_DIR + QString("/") + CSV_DIR
|
|
||||||
#define USER_ELLIPSOID_FILE USER_CSV_DIR + QString("/") + ELLIPSOID_FILE
|
|
||||||
#define USER_GCS_FILE USER_CSV_DIR + QString("/") + GCS_FILE
|
|
||||||
#define USER_PCS_FILE USER_CSV_DIR + QString("/") + PCS_FILE
|
|
||||||
#define USER_MAP_DIR USER_DIR + QString("/") + MAP_DIR
|
|
||||||
#define USER_POI_DIR USER_DIR + QString("/") + POI_DIR
|
|
||||||
#define GLOBAL_CSV_DIR GLOBAL_DIR + QString("/") + CSV_DIR
|
|
||||||
#define GLOBAL_ELLIPSOID_FILE GLOBAL_CSV_DIR + QString("/") + ELLIPSOID_FILE
|
|
||||||
#define GLOBAL_GCS_FILE GLOBAL_CSV_DIR + QString("/") + GCS_FILE
|
|
||||||
#define GLOBAL_PCS_FILE GLOBAL_CSV_DIR + QString("/") + PCS_FILE
|
|
||||||
#define GLOBAL_MAP_DIR GLOBAL_DIR + QString("/") + MAP_DIR
|
|
||||||
#define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR
|
|
||||||
#define TILES_DIR USER_DIR + QString("/tiles")
|
|
||||||
#define TRANSLATIONS_DIR GLOBAL_DIR + QString("/translations")
|
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 1)
|
|
||||||
#define ENABLE_HTTP2
|
|
||||||
#endif // QT >= 5.10.1
|
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
|
||||||
#define ENABLE_HIDPI
|
|
||||||
#endif // QT >= 5.6
|
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
|
@ -18,16 +18,16 @@ bool CSVParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal lat = list[0].trimmed().toDouble(&res);
|
qreal lon = list[0].trimmed().toDouble(&res);
|
||||||
if (!res || (lat < -90.0 || lat > 90.0)) {
|
|
||||||
_errorString = "Invalid latitude";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
qreal lon = list[1].trimmed().toDouble(&res);
|
|
||||||
if (!res || (lon < -180.0 || lon > 180.0)) {
|
if (!res || (lon < -180.0 || lon > 180.0)) {
|
||||||
_errorString = "Invalid longitude";
|
_errorString = "Invalid longitude";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
qreal lat = list[1].trimmed().toDouble(&res);
|
||||||
|
if (!res || (lat < -90.0 || lat > 90.0)) {
|
||||||
|
_errorString = "Invalid latitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Waypoint wp(Coordinates(lon, lat));
|
Waypoint wp(Coordinates(lon, lat));
|
||||||
|
|
||||||
QByteArray ba = list[2].trimmed();
|
QByteArray ba = list[2].trimmed();
|
||||||
|
@ -98,9 +98,9 @@ bool Data::loadFile(const QString &fileName)
|
|||||||
file.reset();
|
file.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
qWarning("Error loading data file: %s:\n", qPrintable(fileName));
|
qWarning("Error loading data file: %s:", qPrintable(fileName));
|
||||||
for (it = _parsers.begin(); it != _parsers.end(); it++)
|
for (it = _parsers.begin(); it != _parsers.end(); it++)
|
||||||
qWarning("%s: line %d: %s\n", qPrintable(it.key()),
|
qWarning("%s: line %d: %s", qPrintable(it.key()),
|
||||||
it.value()->errorLine(), qPrintable(it.value()->errorString()));
|
it.value()->errorLine(), qPrintable(it.value()->errorString()));
|
||||||
|
|
||||||
_errorLine = 0;
|
_errorLine = 0;
|
||||||
|
@ -98,7 +98,7 @@ template<class T> bool FITParser::readValue(CTX &ctx, T &val)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FITParser::skipValue(CTX &ctx, size_t size)
|
bool FITParser::skipValue(CTX &ctx, quint8 size)
|
||||||
{
|
{
|
||||||
ctx.len -= size;
|
ctx.len -= size;
|
||||||
return ctx.file->seek(ctx.file->pos() + size);
|
return ctx.file->seek(ctx.file->pos() + size);
|
||||||
|
@ -20,7 +20,7 @@ private:
|
|||||||
|
|
||||||
bool readData(QFile *file, char *data, size_t size);
|
bool readData(QFile *file, char *data, size_t size);
|
||||||
template<class T> bool readValue(CTX &ctx, T &val);
|
template<class T> bool readValue(CTX &ctx, T &val);
|
||||||
bool skipValue(CTX &ctx, size_t size);
|
bool skipValue(CTX &ctx, quint8 size);
|
||||||
bool readField(CTX &ctx, Field *field, quint32 &val);
|
bool readField(CTX &ctx, Field *field, quint32 &val);
|
||||||
|
|
||||||
bool parseHeader(CTX &ctx);
|
bool parseHeader(CTX &ctx);
|
||||||
|
@ -54,7 +54,7 @@ Coordinates GPXParser::coordinates()
|
|||||||
void GPXParser::rpExtension(TrackData *autoRoute)
|
void GPXParser::rpExtension(TrackData *autoRoute)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "rpt")
|
if (_reader.name() == QLatin1String("rpt"))
|
||||||
autoRoute->append(Trackpoint(coordinates()));
|
autoRoute->append(Trackpoint(coordinates()));
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
@ -63,9 +63,9 @@ void GPXParser::rpExtension(TrackData *autoRoute)
|
|||||||
void GPXParser::tpExtension(Trackpoint &trackpoint)
|
void GPXParser::tpExtension(Trackpoint &trackpoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "hr")
|
if (_reader.name() == QLatin1String("hr"))
|
||||||
trackpoint.setHeartRate(number());
|
trackpoint.setHeartRate(number());
|
||||||
else if (_reader.name() == "atemp")
|
else if (_reader.name() == QLatin1String("atemp"))
|
||||||
trackpoint.setTemperature(number());
|
trackpoint.setTemperature(number());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -75,7 +75,7 @@ void GPXParser::tpExtension(Trackpoint &trackpoint)
|
|||||||
void GPXParser::rteptExtensions(TrackData *autoRoute)
|
void GPXParser::rteptExtensions(TrackData *autoRoute)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "RoutePointExtension")
|
if (_reader.name() == QLatin1String("RoutePointExtension"))
|
||||||
rpExtension(autoRoute);
|
rpExtension(autoRoute);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -85,17 +85,18 @@ void GPXParser::rteptExtensions(TrackData *autoRoute)
|
|||||||
void GPXParser::trkptExtensions(Trackpoint &trackpoint)
|
void GPXParser::trkptExtensions(Trackpoint &trackpoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "speed")
|
if (_reader.name() == QLatin1String("speed"))
|
||||||
trackpoint.setSpeed(number());
|
trackpoint.setSpeed(number());
|
||||||
else if (_reader.name() == "hr" || _reader.name() == "heartrate")
|
else if (_reader.name() == QLatin1String("hr")
|
||||||
|
|| _reader.name() == QLatin1String("heartrate"))
|
||||||
trackpoint.setHeartRate(number());
|
trackpoint.setHeartRate(number());
|
||||||
else if (_reader.name() == "temp")
|
else if (_reader.name() == QLatin1String("temp"))
|
||||||
trackpoint.setTemperature(number());
|
trackpoint.setTemperature(number());
|
||||||
else if (_reader.name() == "cadence")
|
else if (_reader.name() == QLatin1String("cadence"))
|
||||||
trackpoint.setCadence(number());
|
trackpoint.setCadence(number());
|
||||||
else if (_reader.name() == "power")
|
else if (_reader.name() == QLatin1String("power"))
|
||||||
trackpoint.setPower(number());
|
trackpoint.setPower(number());
|
||||||
else if (_reader.name() == "TrackPointExtension")
|
else if (_reader.name() == QLatin1String("TrackPointExtension"))
|
||||||
tpExtension(trackpoint);
|
tpExtension(trackpoint);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -107,13 +108,13 @@ void GPXParser::trackpointData(Trackpoint &trackpoint)
|
|||||||
qreal gh = NAN;
|
qreal gh = NAN;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "ele")
|
if (_reader.name() == QLatin1String("ele"))
|
||||||
trackpoint.setElevation(number());
|
trackpoint.setElevation(number());
|
||||||
else if (_reader.name() == "time")
|
else if (_reader.name() == QLatin1String("time"))
|
||||||
trackpoint.setTimestamp(time());
|
trackpoint.setTimestamp(time());
|
||||||
else if (_reader.name() == "geoidheight")
|
else if (_reader.name() == QLatin1String("geoidheight"))
|
||||||
gh = number();
|
gh = number();
|
||||||
else if (_reader.name() == "extensions")
|
else if (_reader.name() == QLatin1String("extensions"))
|
||||||
trkptExtensions(trackpoint);
|
trkptExtensions(trackpoint);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -128,17 +129,17 @@ void GPXParser::waypointData(Waypoint &waypoint, TrackData *autoRoute)
|
|||||||
qreal gh = NAN;
|
qreal gh = NAN;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "name")
|
if (_reader.name() == QLatin1String("name"))
|
||||||
waypoint.setName(_reader.readElementText());
|
waypoint.setName(_reader.readElementText());
|
||||||
else if (_reader.name() == "desc")
|
else if (_reader.name() == QLatin1String("desc"))
|
||||||
waypoint.setDescription(_reader.readElementText());
|
waypoint.setDescription(_reader.readElementText());
|
||||||
else if (_reader.name() == "ele")
|
else if (_reader.name() == QLatin1String("ele"))
|
||||||
waypoint.setElevation(number());
|
waypoint.setElevation(number());
|
||||||
else if (_reader.name() == "geoidheight")
|
else if (_reader.name() == QLatin1String("geoidheight"))
|
||||||
gh = number();
|
gh = number();
|
||||||
else if (_reader.name() == "time")
|
else if (_reader.name() == QLatin1String("time"))
|
||||||
waypoint.setTimestamp(time());
|
waypoint.setTimestamp(time());
|
||||||
else if (autoRoute && _reader.name() == "extensions")
|
else if (autoRoute && _reader.name() == QLatin1String("extensions"))
|
||||||
rteptExtensions(autoRoute);
|
rteptExtensions(autoRoute);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -151,7 +152,7 @@ void GPXParser::waypointData(Waypoint &waypoint, TrackData *autoRoute)
|
|||||||
void GPXParser::trackpoints(TrackData &track)
|
void GPXParser::trackpoints(TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "trkpt") {
|
if (_reader.name() == QLatin1String("trkpt")) {
|
||||||
track.append(Trackpoint(coordinates()));
|
track.append(Trackpoint(coordinates()));
|
||||||
trackpointData(track.last());
|
trackpointData(track.last());
|
||||||
} else
|
} else
|
||||||
@ -164,12 +165,12 @@ void GPXParser::routepoints(RouteData &route, QList<TrackData> &tracks)
|
|||||||
TrackData autoRoute;
|
TrackData autoRoute;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "rtept") {
|
if (_reader.name() == QLatin1String("rtept")) {
|
||||||
route.append(Waypoint(coordinates()));
|
route.append(Waypoint(coordinates()));
|
||||||
waypointData(route.last(), &autoRoute);
|
waypointData(route.last(), &autoRoute);
|
||||||
} else if (_reader.name() == "name")
|
} else if (_reader.name() == QLatin1String("name"))
|
||||||
route.setName(_reader.readElementText());
|
route.setName(_reader.readElementText());
|
||||||
else if (_reader.name() == "desc")
|
else if (_reader.name() == QLatin1String("desc"))
|
||||||
route.setDescription(_reader.readElementText());
|
route.setDescription(_reader.readElementText());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -185,11 +186,11 @@ void GPXParser::routepoints(RouteData &route, QList<TrackData> &tracks)
|
|||||||
void GPXParser::track(TrackData &track)
|
void GPXParser::track(TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "trkseg")
|
if (_reader.name() == QLatin1String("trkseg"))
|
||||||
trackpoints(track);
|
trackpoints(track);
|
||||||
else if (_reader.name() == "name")
|
else if (_reader.name() == QLatin1String("name"))
|
||||||
track.setName(_reader.readElementText());
|
track.setName(_reader.readElementText());
|
||||||
else if (_reader.name() == "desc")
|
else if (_reader.name() == QLatin1String("desc"))
|
||||||
track.setDescription(_reader.readElementText());
|
track.setDescription(_reader.readElementText());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -200,13 +201,13 @@ void GPXParser::gpx(QList<TrackData> &tracks, QList<RouteData> &routes,
|
|||||||
QList<Waypoint> &waypoints)
|
QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "trk") {
|
if (_reader.name() == QLatin1String("trk")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
track(tracks.back());
|
track(tracks.back());
|
||||||
} else if (_reader.name() == "rte") {
|
} else if (_reader.name() == QLatin1String("rte")) {
|
||||||
routes.append(RouteData());
|
routes.append(RouteData());
|
||||||
routepoints(routes.back(), tracks);
|
routepoints(routes.back(), tracks);
|
||||||
} else if (_reader.name() == "wpt") {
|
} else if (_reader.name() == QLatin1String("wpt")) {
|
||||||
waypoints.append(Waypoint(coordinates()));
|
waypoints.append(Waypoint(coordinates()));
|
||||||
waypointData(waypoints.last());
|
waypointData(waypoints.last());
|
||||||
} else
|
} else
|
||||||
@ -222,7 +223,7 @@ bool GPXParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
_reader.setNamespaceProcessing(false);
|
_reader.setNamespaceProcessing(false);
|
||||||
|
|
||||||
if (_reader.readNextStartElement()) {
|
if (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "gpx")
|
if (_reader.name() == QLatin1String("gpx"))
|
||||||
gpx(tracks, routes, waypoints);
|
gpx(tracks, routes, waypoints);
|
||||||
else
|
else
|
||||||
_reader.raiseError("Not a GPX file");
|
_reader.raiseError("Not a GPX file");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "common/str2int.h"
|
#include "common/util.h"
|
||||||
#include "igcparser.h"
|
#include "igcparser.h"
|
||||||
|
|
||||||
|
|
||||||
@ -98,12 +98,14 @@ static bool readARecord(const char *line, qint64 len)
|
|||||||
|
|
||||||
bool IGCParser::readHRecord(const char *line, int len)
|
bool IGCParser::readHRecord(const char *line, int len)
|
||||||
{
|
{
|
||||||
if (len < 10 || ::strncmp(line, "HFDTE", 5))
|
if (len < 11 || ::strncmp(line, "HFDTE", 5))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
int d = str2int(line + 5, 2);
|
int offset = (len < 16 || ::strncmp(line + 5, "DATE:", 5)) ? 5 : 10;
|
||||||
int m = str2int(line + 7, 2);
|
|
||||||
int y = str2int(line + 9, 2);
|
int d = str2int(line + offset, 2);
|
||||||
|
int m = str2int(line + offset + 2, 2);
|
||||||
|
int y = str2int(line + offset + 4, 2);
|
||||||
|
|
||||||
if (y < 0 || m < 0 || d < 0) {
|
if (y < 0 || m < 0 || d < 0) {
|
||||||
_errorString = "Invalid date header format";
|
_errorString = "Invalid date header format";
|
||||||
|
@ -191,7 +191,7 @@ QDateTime KMLParser::timeStamp()
|
|||||||
QDateTime ts;
|
QDateTime ts;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "when")
|
if (_reader.name() == QLatin1String("when"))
|
||||||
ts = time();
|
ts = time();
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -203,7 +203,7 @@ QDateTime KMLParser::timeStamp()
|
|||||||
void KMLParser::lineString(TrackData &track)
|
void KMLParser::lineString(TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "coordinates") {
|
if (_reader.name() == QLatin1String("coordinates")) {
|
||||||
if (!lineCoordinates(track))
|
if (!lineCoordinates(track))
|
||||||
_reader.raiseError("Invalid coordinates");
|
_reader.raiseError("Invalid coordinates");
|
||||||
} else
|
} else
|
||||||
@ -214,7 +214,7 @@ void KMLParser::lineString(TrackData &track)
|
|||||||
void KMLParser::point(Waypoint &waypoint)
|
void KMLParser::point(Waypoint &waypoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "coordinates") {
|
if (_reader.name() == QLatin1String("coordinates")) {
|
||||||
if (!pointCoordinates(waypoint))
|
if (!pointCoordinates(waypoint))
|
||||||
_reader.raiseError("Invalid coordinates");
|
_reader.raiseError("Invalid coordinates");
|
||||||
} else
|
} else
|
||||||
@ -231,7 +231,7 @@ void KMLParser::heartRate(TrackData &track, int start)
|
|||||||
const char error[] = "Heartrate data count mismatch";
|
const char error[] = "Heartrate data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "value") {
|
if (_reader.name() == QLatin1String("value")) {
|
||||||
if (i < track.size())
|
if (i < track.size())
|
||||||
track[i++].setHeartRate(number());
|
track[i++].setHeartRate(number());
|
||||||
else {
|
else {
|
||||||
@ -252,7 +252,7 @@ void KMLParser::cadence(TrackData &track, int start)
|
|||||||
const char error[] = "Cadence data count mismatch";
|
const char error[] = "Cadence data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "value") {
|
if (_reader.name() == QLatin1String("value")) {
|
||||||
if (i < track.size())
|
if (i < track.size())
|
||||||
track[i++].setCadence(number());
|
track[i++].setCadence(number());
|
||||||
else {
|
else {
|
||||||
@ -273,7 +273,7 @@ void KMLParser::speed(TrackData &track, int start)
|
|||||||
const char error[] = "Speed data count mismatch";
|
const char error[] = "Speed data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "value") {
|
if (_reader.name() == QLatin1String("value")) {
|
||||||
if (i < track.size())
|
if (i < track.size())
|
||||||
track[i++].setSpeed(number());
|
track[i++].setSpeed(number());
|
||||||
else {
|
else {
|
||||||
@ -294,7 +294,7 @@ void KMLParser::temperature(TrackData &track, int start)
|
|||||||
const char error[] = "Temperature data count mismatch";
|
const char error[] = "Temperature data count mismatch";
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "value") {
|
if (_reader.name() == QLatin1String("value")) {
|
||||||
if (i < track.size())
|
if (i < track.size())
|
||||||
track[i++].setTemperature(number());
|
track[i++].setTemperature(number());
|
||||||
else {
|
else {
|
||||||
@ -312,17 +312,17 @@ void KMLParser::temperature(TrackData &track, int start)
|
|||||||
void KMLParser::schemaData(TrackData &track, int start)
|
void KMLParser::schemaData(TrackData &track, int start)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "SimpleArrayData") {
|
if (_reader.name() == QLatin1String("SimpleArrayData")) {
|
||||||
QXmlStreamAttributes attr = _reader.attributes();
|
QXmlStreamAttributes attr = _reader.attributes();
|
||||||
QStringRef name = attr.value("name");
|
QStringRef name = attr.value("name");
|
||||||
|
|
||||||
if (name == "Heartrate")
|
if (name == QLatin1String("Heartrate"))
|
||||||
heartRate(track, start);
|
heartRate(track, start);
|
||||||
else if (name == "Cadence")
|
else if (name == QLatin1String("Cadence"))
|
||||||
cadence(track, start);
|
cadence(track, start);
|
||||||
else if (name == "Speed")
|
else if (name == QLatin1String("Speed"))
|
||||||
speed(track, start);
|
speed(track, start);
|
||||||
else if (name == "Temperature")
|
else if (name == QLatin1String("Temperature"))
|
||||||
temperature(track, start);
|
temperature(track, start);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -334,7 +334,7 @@ void KMLParser::schemaData(TrackData &track, int start)
|
|||||||
void KMLParser::extendedData(TrackData &track, int start)
|
void KMLParser::extendedData(TrackData &track, int start)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "SchemaData")
|
if (_reader.name() == QLatin1String("SchemaData"))
|
||||||
schemaData(track, start);
|
schemaData(track, start);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -348,10 +348,10 @@ void KMLParser::track(TrackData &track)
|
|||||||
int i = first;
|
int i = first;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "when") {
|
if (_reader.name() == QLatin1String("when")) {
|
||||||
track.append(Trackpoint());
|
track.append(Trackpoint());
|
||||||
track.last().setTimestamp(time());
|
track.last().setTimestamp(time());
|
||||||
} else if (_reader.name() == "coord") {
|
} else if (_reader.name() == QLatin1String("coord")) {
|
||||||
if (i == track.size()) {
|
if (i == track.size()) {
|
||||||
_reader.raiseError(error);
|
_reader.raiseError(error);
|
||||||
return;
|
return;
|
||||||
@ -360,7 +360,7 @@ void KMLParser::track(TrackData &track)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} else if (_reader.name() == "ExtendedData")
|
} else if (_reader.name() == QLatin1String("ExtendedData"))
|
||||||
extendedData(track, first);
|
extendedData(track, first);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -373,7 +373,7 @@ void KMLParser::track(TrackData &track)
|
|||||||
void KMLParser::multiTrack(TrackData &t)
|
void KMLParser::multiTrack(TrackData &t)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Track")
|
if (_reader.name() == QLatin1String("Track"))
|
||||||
track(t);
|
track(t);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -385,14 +385,14 @@ void KMLParser::multiGeometry(QList<TrackData> &tracks,
|
|||||||
const QDateTime timestamp)
|
const QDateTime timestamp)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Point") {
|
if (_reader.name() == QLatin1String("Point")) {
|
||||||
waypoints.append(Waypoint());
|
waypoints.append(Waypoint());
|
||||||
Waypoint &w = waypoints.last();
|
Waypoint &w = waypoints.last();
|
||||||
w.setName(name);
|
w.setName(name);
|
||||||
w.setDescription(desc);
|
w.setDescription(desc);
|
||||||
w.setTimestamp(timestamp);
|
w.setTimestamp(timestamp);
|
||||||
point(w);
|
point(w);
|
||||||
} else if (_reader.name() == "LineString") {
|
} else if (_reader.name() == QLatin1String("LineString")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
TrackData &t = tracks.last();
|
TrackData &t = tracks.last();
|
||||||
t.setName(name);
|
t.setName(name);
|
||||||
@ -409,35 +409,35 @@ void KMLParser::placemark(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
|||||||
QDateTime timestamp;
|
QDateTime timestamp;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "name")
|
if (_reader.name() == QLatin1String("name"))
|
||||||
name = _reader.readElementText();
|
name = _reader.readElementText();
|
||||||
else if (_reader.name() == "description")
|
else if (_reader.name() == QLatin1String("description"))
|
||||||
desc = _reader.readElementText();
|
desc = _reader.readElementText();
|
||||||
else if (_reader.name() == "TimeStamp")
|
else if (_reader.name() == QLatin1String("TimeStamp"))
|
||||||
timestamp = timeStamp();
|
timestamp = timeStamp();
|
||||||
else if (_reader.name() == "MultiGeometry")
|
else if (_reader.name() == QLatin1String("MultiGeometry"))
|
||||||
multiGeometry(tracks, waypoints, name, desc, timestamp);
|
multiGeometry(tracks, waypoints, name, desc, timestamp);
|
||||||
else if (_reader.name() == "Point") {
|
else if (_reader.name() == QLatin1String("Point")) {
|
||||||
waypoints.append(Waypoint());
|
waypoints.append(Waypoint());
|
||||||
Waypoint &w = waypoints.last();
|
Waypoint &w = waypoints.last();
|
||||||
w.setName(name);
|
w.setName(name);
|
||||||
w.setDescription(desc);
|
w.setDescription(desc);
|
||||||
w.setTimestamp(timestamp);
|
w.setTimestamp(timestamp);
|
||||||
point(w);
|
point(w);
|
||||||
} else if (_reader.name() == "LineString"
|
} else if (_reader.name() == QLatin1String("LineString")
|
||||||
|| _reader.name() == "LinearRing") {
|
|| _reader.name() == QLatin1String("LinearRing")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
TrackData &t = tracks.last();
|
TrackData &t = tracks.last();
|
||||||
t.setName(name);
|
t.setName(name);
|
||||||
t.setDescription(desc);
|
t.setDescription(desc);
|
||||||
lineString(t);
|
lineString(t);
|
||||||
} else if (_reader.name() == "Track") {
|
} else if (_reader.name() == QLatin1String("Track")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
TrackData &t = tracks.last();
|
TrackData &t = tracks.last();
|
||||||
t.setName(name);
|
t.setName(name);
|
||||||
t.setDescription(desc);
|
t.setDescription(desc);
|
||||||
track(t);
|
track(t);
|
||||||
} else if (_reader.name() == "MultiTrack") {
|
} else if (_reader.name() == QLatin1String("MultiTrack")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
TrackData &t = tracks.last();
|
TrackData &t = tracks.last();
|
||||||
t.setName(name);
|
t.setName(name);
|
||||||
@ -451,9 +451,9 @@ void KMLParser::placemark(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
|||||||
void KMLParser::folder(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
void KMLParser::folder(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Placemark")
|
if (_reader.name() == QLatin1String("Placemark"))
|
||||||
placemark(tracks, waypoints);
|
placemark(tracks, waypoints);
|
||||||
else if (_reader.name() == "Folder")
|
else if (_reader.name() == QLatin1String("Folder"))
|
||||||
folder(tracks, waypoints);
|
folder(tracks, waypoints);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -463,9 +463,9 @@ void KMLParser::folder(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
|||||||
void KMLParser::document(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
void KMLParser::document(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Placemark")
|
if (_reader.name() == QLatin1String("Placemark"))
|
||||||
placemark(tracks, waypoints);
|
placemark(tracks, waypoints);
|
||||||
else if (_reader.name() == "Folder")
|
else if (_reader.name() == QLatin1String("Folder"))
|
||||||
folder(tracks, waypoints);
|
folder(tracks, waypoints);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -475,11 +475,11 @@ void KMLParser::document(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
|||||||
void KMLParser::kml(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
void KMLParser::kml(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Document")
|
if (_reader.name() == QLatin1String("Document"))
|
||||||
document(tracks, waypoints);
|
document(tracks, waypoints);
|
||||||
else if (_reader.name() == "Placemark")
|
else if (_reader.name() == QLatin1String("Placemark"))
|
||||||
placemark(tracks, waypoints);
|
placemark(tracks, waypoints);
|
||||||
else if (_reader.name() == "Folder")
|
else if (_reader.name() == QLatin1String("Folder"))
|
||||||
folder(tracks, waypoints);
|
folder(tracks, waypoints);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -495,7 +495,7 @@ bool KMLParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
_reader.setDevice(file);
|
_reader.setDevice(file);
|
||||||
|
|
||||||
if (_reader.readNextStartElement()) {
|
if (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "kml")
|
if (_reader.name() == QLatin1String("kml"))
|
||||||
kml(tracks, waypoints);
|
kml(tracks, waypoints);
|
||||||
else
|
else
|
||||||
_reader.raiseError("Not a KML file");
|
_reader.raiseError("Not a KML file");
|
||||||
|
@ -31,11 +31,11 @@ Coordinates LOCParser::coordinates()
|
|||||||
void LOCParser::waypoint(Waypoint &waypoint)
|
void LOCParser::waypoint(Waypoint &waypoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "name") {
|
if (_reader.name() == QLatin1String("name")) {
|
||||||
const QXmlStreamAttributes &attr = _reader.attributes();
|
const QXmlStreamAttributes &attr = _reader.attributes();
|
||||||
waypoint.setName(attr.value("id").toString());
|
waypoint.setName(attr.value("id").toString());
|
||||||
waypoint.setDescription(_reader.readElementText());
|
waypoint.setDescription(_reader.readElementText());
|
||||||
} else if (_reader.name() == "coord") {
|
} else if (_reader.name() == QLatin1String("coord")) {
|
||||||
waypoint.setCoordinates(coordinates());
|
waypoint.setCoordinates(coordinates());
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
} else
|
} else
|
||||||
@ -49,7 +49,7 @@ void LOCParser::waypoint(Waypoint &waypoint)
|
|||||||
void LOCParser::loc(QList<Waypoint> &waypoints)
|
void LOCParser::loc(QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "waypoint") {
|
if (_reader.name() == QLatin1String("waypoint")) {
|
||||||
waypoints.append(Waypoint());
|
waypoints.append(Waypoint());
|
||||||
waypoint(waypoints.last());
|
waypoint(waypoints.last());
|
||||||
} else
|
} else
|
||||||
@ -67,7 +67,7 @@ bool LOCParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
_reader.setDevice(file);
|
_reader.setDevice(file);
|
||||||
|
|
||||||
if (_reader.readNextStartElement()) {
|
if (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "loc")
|
if (_reader.name() == QLatin1String("loc"))
|
||||||
loc(waypoints);
|
loc(waypoints);
|
||||||
else
|
else
|
||||||
_reader.raiseError("Not a LOC file");
|
_reader.raiseError("Not a LOC file");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "common/str2int.h"
|
#include "common/util.h"
|
||||||
#include "nmeaparser.h"
|
#include "nmeaparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include "common/rectc.h"
|
#include "common/rectc.h"
|
||||||
|
#include "common/greatcircle.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
|
|
||||||
@ -94,22 +95,44 @@ static bool cb(size_t data, void* context)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void POI::search(const RectC &rect, QSet<int> &set) const
|
||||||
|
{
|
||||||
|
qreal min[2], max[2];
|
||||||
|
|
||||||
|
min[0] = rect.topLeft().lon();
|
||||||
|
min[1] = rect.bottomRight().lat();
|
||||||
|
max[0] = rect.bottomRight().lon();
|
||||||
|
max[1] = rect.topLeft().lat();
|
||||||
|
|
||||||
|
_tree.Search(min, max, cb, &set);
|
||||||
|
}
|
||||||
|
|
||||||
QList<Waypoint> POI::points(const Path &path) const
|
QList<Waypoint> POI::points(const Path &path) const
|
||||||
{
|
{
|
||||||
QList<Waypoint> ret;
|
QList<Waypoint> ret;
|
||||||
QSet<int> set;
|
QSet<int> set;
|
||||||
qreal min[2], max[2];
|
|
||||||
QSet<int>::const_iterator it;
|
QSet<int>::const_iterator it;
|
||||||
|
|
||||||
for (int i = 0; i < path.count(); i++) {
|
|
||||||
RectC br(path.at(i).coordinates(), _radius);
|
|
||||||
min[0] = br.topLeft().lon();
|
|
||||||
min[1] = br.bottomRight().lat();
|
|
||||||
max[0] = br.bottomRight().lon();
|
|
||||||
max[1] = br.topLeft().lat();
|
|
||||||
|
|
||||||
_tree.Search(min, max, cb, &set);
|
for (int i = 1; i < path.count(); i++) {
|
||||||
|
double ds = path.at(i).distance() - path.at(i-1).distance();
|
||||||
|
unsigned n = (unsigned)ceil(ds / _radius);
|
||||||
|
|
||||||
|
if (n > 1) {
|
||||||
|
GreatCircle gc(path.at(i-1).coordinates(), path.at(i).coordinates());
|
||||||
|
for (unsigned j = 0; j < n; j++) {
|
||||||
|
RectC br(gc.pointAt((double)j/n), _radius);
|
||||||
|
search(br, set);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
RectC br(path.at(i-1).coordinates(), _radius);
|
||||||
|
search(br, set);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RectC br(path.last().coordinates(), _radius);
|
||||||
|
search(br, set);
|
||||||
|
|
||||||
|
|
||||||
for (it = set.constBegin(); it != set.constEnd(); ++it)
|
for (it = set.constBegin(); it != set.constEnd(); ++it)
|
||||||
ret.append(_data.at(*it));
|
ret.append(_data.at(*it));
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include "waypoint.h"
|
#include "waypoint.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
class WaypointItem;
|
|
||||||
|
|
||||||
class POI : public QObject
|
class POI : public QObject
|
||||||
{
|
{
|
||||||
@ -45,6 +44,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool loadFile(const QString &path, bool dir);
|
bool loadFile(const QString &path, bool dir);
|
||||||
|
void search(const RectC &rect, QSet<int> &set) const;
|
||||||
|
|
||||||
POITree _tree;
|
POITree _tree;
|
||||||
QVector<Waypoint> _data;
|
QVector<Waypoint> _data;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
void SLFParser::warning(const char *text) const
|
void SLFParser::warning(const char *text) const
|
||||||
{
|
{
|
||||||
const QFile *file = static_cast<QFile *>(_reader.device());
|
const QFile *file = static_cast<QFile *>(_reader.device());
|
||||||
qWarning("%s:%lld: %s\n", qPrintable(file->fileName()),
|
qWarning("%s:%lld: %s", qPrintable(file->fileName()),
|
||||||
_reader.lineNumber(), text);
|
_reader.lineNumber(), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ bool SLFParser::data(const QXmlStreamAttributes &attr, const char *name,
|
|||||||
void SLFParser::entries(const QDateTime &date, TrackData &track)
|
void SLFParser::entries(const QDateTime &date, TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Entry") {
|
if (_reader.name() == QLatin1String("Entry")) {
|
||||||
qreal val, lat, lon;
|
qreal val, lat, lon;
|
||||||
QXmlStreamAttributes attr(_reader.attributes());
|
QXmlStreamAttributes attr(_reader.attributes());
|
||||||
|
|
||||||
@ -70,11 +70,11 @@ void SLFParser::entries(const QDateTime &date, TrackData &track)
|
|||||||
void SLFParser::generalInformation(QDateTime &date, TrackData &track)
|
void SLFParser::generalInformation(QDateTime &date, TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "name")
|
if (_reader.name() == QLatin1String("name"))
|
||||||
track.setName(_reader.readElementText());
|
track.setName(_reader.readElementText());
|
||||||
else if (_reader.name() == "description")
|
else if (_reader.name() == QLatin1String("description"))
|
||||||
track.setDescription(_reader.readElementText());
|
track.setDescription(_reader.readElementText());
|
||||||
else if (_reader.name() == "startDate") {
|
else if (_reader.name() == QLatin1String("startDate")) {
|
||||||
QString ds(_reader.readElementText());
|
QString ds(_reader.readElementText());
|
||||||
QLocale locale(QLocale::English);
|
QLocale locale(QLocale::English);
|
||||||
date = locale.toDateTime(ds.mid(0, ds.indexOf("GMT"))
|
date = locale.toDateTime(ds.mid(0, ds.indexOf("GMT"))
|
||||||
@ -89,9 +89,9 @@ void SLFParser::activity(TrackData &track)
|
|||||||
QDateTime date;
|
QDateTime date;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Entries")
|
if (_reader.name() == QLatin1String("Entries"))
|
||||||
entries(date, track);
|
entries(date, track);
|
||||||
else if (_reader.name() == "GeneralInformation")
|
else if (_reader.name() == QLatin1String("GeneralInformation"))
|
||||||
generalInformation(date, track);
|
generalInformation(date, track);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -108,7 +108,7 @@ bool SLFParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
_reader.setDevice(file);
|
_reader.setDevice(file);
|
||||||
|
|
||||||
if (_reader.readNextStartElement()) {
|
if (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Activity") {
|
if (_reader.name() == QLatin1String("Activity")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
activity(tracks.last());
|
activity(tracks.last());
|
||||||
} else
|
} else
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
void TCXParser::warning(const char *text) const
|
void TCXParser::warning(const char *text) const
|
||||||
{
|
{
|
||||||
const QFile *file = static_cast<QFile *>(_reader.device());
|
const QFile *file = static_cast<QFile *>(_reader.device());
|
||||||
qWarning("%s:%lld: %s\n", qPrintable(file->fileName()),
|
qWarning("%s:%lld: %s", qPrintable(file->fileName()),
|
||||||
_reader.lineNumber(), text);
|
_reader.lineNumber(), text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,13 +37,13 @@ Coordinates TCXParser::position()
|
|||||||
bool res;
|
bool res;
|
||||||
|
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "LatitudeDegrees") {
|
if (_reader.name() == QLatin1String("LatitudeDegrees")) {
|
||||||
val = _reader.readElementText().toDouble(&res);
|
val = _reader.readElementText().toDouble(&res);
|
||||||
if (!res || (val < -90.0 || val > 90.0))
|
if (!res || (val < -90.0 || val > 90.0))
|
||||||
_reader.raiseError("Invalid LatitudeDegrees");
|
_reader.raiseError("Invalid LatitudeDegrees");
|
||||||
else
|
else
|
||||||
pos.setLat(val);
|
pos.setLat(val);
|
||||||
} else if (_reader.name() == "LongitudeDegrees") {
|
} else if (_reader.name() == QLatin1String("LongitudeDegrees")) {
|
||||||
val = _reader.readElementText().toDouble(&res);
|
val = _reader.readElementText().toDouble(&res);
|
||||||
if (!res || (val < -180.0 || val > 180.0))
|
if (!res || (val < -180.0 || val > 180.0))
|
||||||
_reader.raiseError("Invalid LongitudeDegrees");
|
_reader.raiseError("Invalid LongitudeDegrees");
|
||||||
@ -59,7 +59,7 @@ Coordinates TCXParser::position()
|
|||||||
void TCXParser::heartRateBpm(Trackpoint &trackpoint)
|
void TCXParser::heartRateBpm(Trackpoint &trackpoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Value")
|
if (_reader.name() == QLatin1String("Value"))
|
||||||
trackpoint.setHeartRate(number());
|
trackpoint.setHeartRate(number());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -69,9 +69,9 @@ void TCXParser::heartRateBpm(Trackpoint &trackpoint)
|
|||||||
void TCXParser::extensions(Trackpoint &trackpoint)
|
void TCXParser::extensions(Trackpoint &trackpoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "RunCadence")
|
if (_reader.name() == QLatin1String("RunCadence"))
|
||||||
trackpoint.setCadence(number());
|
trackpoint.setCadence(number());
|
||||||
else if (_reader.name() == "Watts")
|
else if (_reader.name() == QLatin1String("Watts"))
|
||||||
trackpoint.setPower(number());
|
trackpoint.setPower(number());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -81,17 +81,17 @@ void TCXParser::extensions(Trackpoint &trackpoint)
|
|||||||
void TCXParser::trackpointData(Trackpoint &trackpoint)
|
void TCXParser::trackpointData(Trackpoint &trackpoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Position")
|
if (_reader.name() == QLatin1String("Position"))
|
||||||
trackpoint.setCoordinates(position());
|
trackpoint.setCoordinates(position());
|
||||||
else if (_reader.name() == "AltitudeMeters")
|
else if (_reader.name() == QLatin1String("AltitudeMeters"))
|
||||||
trackpoint.setElevation(number());
|
trackpoint.setElevation(number());
|
||||||
else if (_reader.name() == "Time")
|
else if (_reader.name() == QLatin1String("Time"))
|
||||||
trackpoint.setTimestamp(time());
|
trackpoint.setTimestamp(time());
|
||||||
else if (_reader.name() == "HeartRateBpm")
|
else if (_reader.name() == QLatin1String("HeartRateBpm"))
|
||||||
heartRateBpm(trackpoint);
|
heartRateBpm(trackpoint);
|
||||||
else if (_reader.name() == "Cadence")
|
else if (_reader.name() == QLatin1String("Cadence"))
|
||||||
trackpoint.setCadence(number());
|
trackpoint.setCadence(number());
|
||||||
else if (_reader.name() == "Extensions")
|
else if (_reader.name() == QLatin1String("Extensions"))
|
||||||
extensions(trackpoint);
|
extensions(trackpoint);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -101,15 +101,15 @@ void TCXParser::trackpointData(Trackpoint &trackpoint)
|
|||||||
void TCXParser::waypointData(Waypoint &waypoint)
|
void TCXParser::waypointData(Waypoint &waypoint)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Position")
|
if (_reader.name() == QLatin1String("Position"))
|
||||||
waypoint.setCoordinates(position());
|
waypoint.setCoordinates(position());
|
||||||
else if (_reader.name() == "Name")
|
else if (_reader.name() == QLatin1String("Name"))
|
||||||
waypoint.setName(_reader.readElementText());
|
waypoint.setName(_reader.readElementText());
|
||||||
else if (_reader.name() == "Notes")
|
else if (_reader.name() == QLatin1String("Notes"))
|
||||||
waypoint.setDescription(_reader.readElementText());
|
waypoint.setDescription(_reader.readElementText());
|
||||||
else if (_reader.name() == "AltitudeMeters")
|
else if (_reader.name() == QLatin1String("AltitudeMeters"))
|
||||||
waypoint.setElevation(number());
|
waypoint.setElevation(number());
|
||||||
else if (_reader.name() == "Time")
|
else if (_reader.name() == QLatin1String("Time"))
|
||||||
waypoint.setTimestamp(time());
|
waypoint.setTimestamp(time());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -119,7 +119,7 @@ void TCXParser::waypointData(Waypoint &waypoint)
|
|||||||
void TCXParser::trackpoints(TrackData &track)
|
void TCXParser::trackpoints(TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Trackpoint") {
|
if (_reader.name() == QLatin1String("Trackpoint")) {
|
||||||
Trackpoint t;
|
Trackpoint t;
|
||||||
trackpointData(t);
|
trackpointData(t);
|
||||||
if (t.coordinates().isValid())
|
if (t.coordinates().isValid())
|
||||||
@ -134,7 +134,7 @@ void TCXParser::trackpoints(TrackData &track)
|
|||||||
void TCXParser::lap(TrackData &track)
|
void TCXParser::lap(TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Track")
|
if (_reader.name() == QLatin1String("Track"))
|
||||||
trackpoints(track);
|
trackpoints(track);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -144,13 +144,13 @@ void TCXParser::lap(TrackData &track)
|
|||||||
void TCXParser::course(QList<Waypoint> &waypoints, TrackData &track)
|
void TCXParser::course(QList<Waypoint> &waypoints, TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Track")
|
if (_reader.name() == QLatin1String("Track"))
|
||||||
trackpoints(track);
|
trackpoints(track);
|
||||||
else if (_reader.name() == "Name")
|
else if (_reader.name() == QLatin1String("Name"))
|
||||||
track.setName(_reader.readElementText());
|
track.setName(_reader.readElementText());
|
||||||
else if (_reader.name() == "Notes")
|
else if (_reader.name() == QLatin1String("Notes"))
|
||||||
track.setDescription(_reader.readElementText());
|
track.setDescription(_reader.readElementText());
|
||||||
else if (_reader.name() == "CoursePoint") {
|
else if (_reader.name() == QLatin1String("CoursePoint")) {
|
||||||
Waypoint w;
|
Waypoint w;
|
||||||
waypointData(w);
|
waypointData(w);
|
||||||
if (w.coordinates().isValid())
|
if (w.coordinates().isValid())
|
||||||
@ -165,8 +165,10 @@ void TCXParser::course(QList<Waypoint> &waypoints, TrackData &track)
|
|||||||
void TCXParser::activity(TrackData &track)
|
void TCXParser::activity(TrackData &track)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Lap")
|
if (_reader.name() == QLatin1String("Lap"))
|
||||||
lap(track);
|
lap(track);
|
||||||
|
else if (_reader.name() == QLatin1String("Notes"))
|
||||||
|
track.setDescription(_reader.readElementText());
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
}
|
}
|
||||||
@ -175,7 +177,7 @@ void TCXParser::activity(TrackData &track)
|
|||||||
void TCXParser::courses(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
void TCXParser::courses(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Course") {
|
if (_reader.name() == QLatin1String("Course")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
course(waypoints, tracks.back());
|
course(waypoints, tracks.back());
|
||||||
} else
|
} else
|
||||||
@ -186,7 +188,7 @@ void TCXParser::courses(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
|||||||
void TCXParser::sport(QList<TrackData> &tracks)
|
void TCXParser::sport(QList<TrackData> &tracks)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Activity") {
|
if (_reader.name() == QLatin1String("Activity")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
activity(tracks.back());
|
activity(tracks.back());
|
||||||
} else
|
} else
|
||||||
@ -197,7 +199,8 @@ void TCXParser::sport(QList<TrackData> &tracks)
|
|||||||
void TCXParser::multiSportSession(QList<TrackData> &tracks)
|
void TCXParser::multiSportSession(QList<TrackData> &tracks)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "FirstSport" || _reader.name() == "NextSport")
|
if (_reader.name() == QLatin1String("FirstSport")
|
||||||
|
|| _reader.name() == QLatin1String("NextSport"))
|
||||||
sport(tracks);
|
sport(tracks);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -207,10 +210,10 @@ void TCXParser::multiSportSession(QList<TrackData> &tracks)
|
|||||||
void TCXParser::activities(QList<TrackData> &tracks)
|
void TCXParser::activities(QList<TrackData> &tracks)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Activity") {
|
if (_reader.name() == QLatin1String("Activity")) {
|
||||||
tracks.append(TrackData());
|
tracks.append(TrackData());
|
||||||
activity(tracks.back());
|
activity(tracks.back());
|
||||||
} else if (_reader.name() == "MultiSportSession")
|
} else if (_reader.name() == QLatin1String("MultiSportSession"))
|
||||||
multiSportSession(tracks);
|
multiSportSession(tracks);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -220,9 +223,9 @@ void TCXParser::activities(QList<TrackData> &tracks)
|
|||||||
void TCXParser::tcx(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
void TCXParser::tcx(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
{
|
{
|
||||||
while (_reader.readNextStartElement()) {
|
while (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "Courses")
|
if (_reader.name() == QLatin1String("Courses"))
|
||||||
courses(tracks, waypoints);
|
courses(tracks, waypoints);
|
||||||
else if (_reader.name() == "Activities")
|
else if (_reader.name() == QLatin1String("Activities"))
|
||||||
activities(tracks);
|
activities(tracks);
|
||||||
else
|
else
|
||||||
_reader.skipCurrentElement();
|
_reader.skipCurrentElement();
|
||||||
@ -238,7 +241,7 @@ bool TCXParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
_reader.setDevice(file);
|
_reader.setDevice(file);
|
||||||
|
|
||||||
if (_reader.readNextStartElement()) {
|
if (_reader.readNextStartElement()) {
|
||||||
if (_reader.name() == "TrainingCenterDatabase")
|
if (_reader.name() == QLatin1String("TrainingCenterDatabase"))
|
||||||
tcx(tracks, waypoints);
|
tcx(tracks, waypoints);
|
||||||
else
|
else
|
||||||
_reader.raiseError("Not a TCX file");
|
_reader.raiseError("Not a TCX file");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
#include "common/config.h"
|
||||||
#include "GUI/app.h"
|
#include "GUI/app.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -9,7 +9,5 @@ int main(int argc, char *argv[])
|
|||||||
#endif // ENABLE_HIDPI
|
#endif // ENABLE_HIDPI
|
||||||
|
|
||||||
App app(argc, argv);
|
App app(argc, argv);
|
||||||
app.run();
|
return app.run();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "common/coordinates.h"
|
#include "common/coordinates.h"
|
||||||
#include "common/str2int.h"
|
#include "common/util.h"
|
||||||
#include "angularunits.h"
|
#include "angularunits.h"
|
||||||
|
|
||||||
static double sDMS2deg(double val)
|
static double sDMS2deg(double val)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user