Compare commits
399 Commits
Author | SHA1 | Date | |
---|---|---|---|
a45125be9a | |||
a7154988ab | |||
afe9a14d5b | |||
b3f1596918 | |||
cd90407f56 | |||
73f06e61f0 | |||
c708fa35fd | |||
dcedfe1e9f | |||
daa9d296bd | |||
b8a9a4481c | |||
e792bf3b23 | |||
359a9f0a5a | |||
4b0b6513d1 | |||
c7762e26fb | |||
5b8d41afb7 | |||
81e1664a9b | |||
fad3f116f5 | |||
a6e522d758 | |||
ab65deadb6 | |||
7f80e8f7b7 | |||
9a5c5eaf61 | |||
9bc5016141 | |||
a4a46232e4 | |||
d85fbe5b48 | |||
141e0cb404 | |||
2b7d0cd631 | |||
d106f47771 | |||
e48729fc84 | |||
dca53bc622 | |||
65045dfee4 | |||
002b9c35e1 | |||
945528d6b1 | |||
4697ba4ef0 | |||
9bf1447a7e | |||
1a8114af8e | |||
ad154dfd7d | |||
c2004ded31 | |||
3ced367fab | |||
506d1998f8 | |||
afc5e9ca4b | |||
425d0e3013 | |||
3a8b1107fe | |||
ad7a413d50 | |||
8d5f72de64 | |||
9e798e626c | |||
cb70f0dded | |||
400003f684 | |||
69db510b10 | |||
cd9ea0f8a9 | |||
0f6c8eb896 | |||
6b3c0d05ca | |||
b0cc028c4c | |||
1513130435 | |||
ec798451e8 | |||
ffc61552d2 | |||
aff7b1c13f | |||
d54f22d3f0 | |||
dba6291f3e | |||
e96cee2ea8 | |||
1eaaea98a3 | |||
a90073c422 | |||
223a13583c | |||
4386e1f2e1 | |||
5bfe9c2527 | |||
efa2b1c366 | |||
e0ad64a902 | |||
f0a1acb96a | |||
5f3bdb87f8 | |||
90d062e097 | |||
58b4c87d46 | |||
02654ec862 | |||
ff015c8714 | |||
c339116cd1 | |||
d8d70bfd8b | |||
7d8149ace3 | |||
4460b454c4 | |||
211310f377 | |||
1e4bcd0ac1 | |||
1a66ed0a36 | |||
273a127069 | |||
1c0a0fd0b3 | |||
713e331b2a | |||
96f406aad7 | |||
0aedec66c4 | |||
b500031713 | |||
699e4f32d5 | |||
992c8aaaf9 | |||
68a72c5809 | |||
eace308774 | |||
e4e3f7d143 | |||
acc49d015e | |||
b48652cb78 | |||
0808f6679e | |||
610ac3d73f | |||
1d719fdcc8 | |||
1746e1cf08 | |||
5d5a5365cd | |||
7dfdeac1da | |||
1ff13ee9f8 | |||
34b1fb6b5d | |||
02bf85780a | |||
47199348d8 | |||
3b55bc0efc | |||
4de3ddf71b | |||
e26fa92ce6 | |||
dfb69b2755 | |||
c2a30738cb | |||
fd53e89ea5 | |||
ccf91bb29f | |||
75bd388be0 | |||
aef0357204 | |||
d073d606d0 | |||
8822bf7e5f | |||
051a3ed303 | |||
96437ae6ab | |||
89c25bbc3a | |||
322792ea04 | |||
ce1c76a315 | |||
804e9594ad | |||
651973c524 | |||
533af66080 | |||
bab5750cf7 | |||
0d6f3ea162 | |||
b915302e2f | |||
03ef7a9147 | |||
33cb944e36 | |||
8bc575aef2 | |||
f0b7abdb72 | |||
6ce14734cd | |||
925a0e2951 | |||
e46bba18f2 | |||
a56aa4e706 | |||
c4b3a81b0b | |||
957cc6f4f3 | |||
ebad0832ee | |||
186c135ad5 | |||
72b5b1ea97 | |||
106d4c6e0b | |||
8f815a6af0 | |||
60f107d7cd | |||
e87fff4bf8 | |||
e6547d92f0 | |||
bfcc577f64 | |||
a56ad8a933 | |||
b1748c848b | |||
3763d44662 | |||
b3e8081942 | |||
b3dc886afc | |||
431002fd62 | |||
63c3a50ca6 | |||
7fd30bbda3 | |||
c1844f9557 | |||
0c7601c831 | |||
19eb3fba7f | |||
bde3c8cc3d | |||
b0ce471ea8 | |||
bd23120c2c | |||
ac4ef0631e | |||
60d9a172b6 | |||
b8eede21c0 | |||
70ddbe192f | |||
d8477571cc | |||
92545acba0 | |||
2bf66ea912 | |||
b21c2267cf | |||
278aa904c1 | |||
b369985f0a | |||
6a5781771f | |||
1b616f3c81 | |||
99dfbc1d2f | |||
f83e3376b4 | |||
311aeecb27 | |||
338ace6dff | |||
51e9ef4416 | |||
ebefe54510 | |||
1ec732c78d | |||
ff733b2705 | |||
99e32b1a15 | |||
f4a992a66f | |||
f52fa9a9ef | |||
61f3a1c932 | |||
93313da01d | |||
a253ac1796 | |||
e6a0eeefcc | |||
214d7c40dc | |||
cd89706d74 | |||
961eac9324 | |||
ddacac8d2e | |||
bd9b5dbc6a | |||
8b813b5879 | |||
b79de29464 | |||
ae2765528d | |||
0356917790 | |||
7352b24473 | |||
3a9ec6247c | |||
e74ac78138 | |||
5fa91be4ac | |||
536b4fd121 | |||
0556ae0f58 | |||
e38fdb26d7 | |||
e420602c69 | |||
b2a49eaa23 | |||
211a4e4cef | |||
8ff8d4bf16 | |||
46598a85fc | |||
32cbd33c91 | |||
0e356d0222 | |||
1a29ab6304 | |||
5581cff55b | |||
a458b82e37 | |||
bd946fb477 | |||
7e6ed0933c | |||
1586a5e912 | |||
3e340ab941 | |||
ea178d1acb | |||
f61488fcfa | |||
b68ca92add | |||
0448ae5eea | |||
2bc112c7b4 | |||
ccd92edb8d | |||
0cbf79870b | |||
7e8530555d | |||
2fd16e5e31 | |||
a5033c8b19 | |||
b0c6176ddd | |||
6edd7a8c61 | |||
8a299be65b | |||
cde4c65c53 | |||
b24136a580 | |||
da1b2bb90a | |||
30e198cf46 | |||
0f2deca4fa | |||
1055c4fd98 | |||
18c501b610 | |||
71310116e3 | |||
34e48199b2 | |||
4cf027df58 | |||
a9668ca86e | |||
181f60ed40 | |||
307405d661 | |||
1242423ca8 | |||
2bdab0f449 | |||
4e23df3a66 | |||
23f5a317d0 | |||
80bc9f1f01 | |||
dec3f10df3 | |||
296d4c6c9d | |||
668558cf2e | |||
a6053a4d7b | |||
535361dada | |||
e9e7660beb | |||
eb5692a0ab | |||
367427b26a | |||
371fa13bc6 | |||
5a8250ed63 | |||
c8a39a607b | |||
215cf03b68 | |||
9cadb8d0a5 | |||
20c82deda7 | |||
7c9768e83a | |||
736566b12c | |||
540339bf22 | |||
81a9743064 | |||
818fa11fd3 | |||
dd80d34e58 | |||
17c791d753 | |||
9f06b042ca | |||
d201101587 | |||
da842bd21d | |||
8a90a736d2 | |||
aac9bf024b | |||
585ded6b1c | |||
b9098c0dc5 | |||
584245785e | |||
66ce91c237 | |||
d134938ff8 | |||
9e583a9dab | |||
62ff4bb7c4 | |||
4b66aaa78b | |||
c97aa9c25d | |||
f1c6db0b46 | |||
9bd70ec96e | |||
984d3bb6c5 | |||
87a4398131 | |||
324ac2e0f4 | |||
8591d3f34c | |||
1a53968bd3 | |||
82cf7b49ca | |||
9789982626 | |||
eb03fe6ead | |||
0d1b416c4f | |||
c89f8dbb47 | |||
e4d777bace | |||
640829d89d | |||
78fb5c1547 | |||
6a25ad6379 | |||
5693375a3f | |||
10b903c129 | |||
9a0d304e8d | |||
0e5eb7287d | |||
7827509a4a | |||
974290ce8b | |||
09c097cc68 | |||
7f12c0ca95 | |||
a773921da0 | |||
b67428065f | |||
5bbf117f64 | |||
1744764025 | |||
c425b3868d | |||
84e61c657e | |||
721ee2aaa9 | |||
6cc22afcdc | |||
b99def1b30 | |||
1c5a19a33a | |||
27194d3d36 | |||
375ef20592 | |||
e86c19635e | |||
d7fd40d9d2 | |||
94fc5e17d0 | |||
425c75416a | |||
1160c6d385 | |||
a6b2a477a1 | |||
0ca264b176 | |||
be3c101c07 | |||
cb52ad8bc5 | |||
12d5dcc78c | |||
afd87c6fa2 | |||
c7d68f924f | |||
89304c0d5c | |||
c57a0f4061 | |||
f02ff1fa01 | |||
434df521fb | |||
9d90b97ba3 | |||
09631de5a2 | |||
6b8c0231ea | |||
eae55b14bb | |||
29fe054d57 | |||
b95fb80210 | |||
70f4010f55 | |||
014e260042 | |||
80bf57abfc | |||
473b92e8f7 | |||
1634b0715c | |||
1a07360d91 | |||
7e365cb990 | |||
19c44f56d6 | |||
799079392c | |||
1957a51570 | |||
e9b32fb582 | |||
3e421c6aba | |||
aa461a04b1 | |||
b369ffacef | |||
6034685fa0 | |||
420e96a2f4 | |||
a5f11cb77b | |||
f9fcbf5de4 | |||
058a09a426 | |||
ebf3c3bc14 | |||
eeed5ceba3 | |||
1827787fc2 | |||
3074ba9957 | |||
8624b42e0b | |||
c00ebdeefd | |||
05f1536285 | |||
bf69ef58ba | |||
adcd603eec | |||
0ee0bd882e | |||
d48a2aac93 | |||
7993e4dcb3 | |||
d20d94ef05 | |||
9f0582cbea | |||
1e6925da75 | |||
7cfc05c101 | |||
392b829733 | |||
36083d2fa1 | |||
63fd7f239c | |||
20b107581e | |||
aacc04520f | |||
dad85e46a7 | |||
5912506292 | |||
e3c23d0ffc | |||
efdb31ddc5 | |||
ee2f471ca0 | |||
dafadbab60 | |||
7de08d116a | |||
dac06b9537 | |||
33b6e8954c | |||
2695745d82 | |||
fc67f6f19a | |||
07cd536867 | |||
c3d6294b7a | |||
68671ed994 | |||
46989bd7a0 | |||
0ce2f02178 | |||
1289762365 | |||
f0c3f9b8c8 | |||
31f6eeac26 | |||
40803d68c1 | |||
35dea229b4 |
187
Info.plist
@ -15,7 +15,7 @@
|
|||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>@EXECUTABLE@</string>
|
<string>@EXECUTABLE@</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>cz.wz.tumic.GPXSee</string>
|
<string>org.gpxsee.GPXSee</string>
|
||||||
|
|
||||||
<key>CFBundleDocumentTypes</key>
|
<key>CFBundleDocumentTypes</key>
|
||||||
<array>
|
<array>
|
||||||
@ -35,6 +35,86 @@
|
|||||||
<key>CFBundleTypeRole</key>
|
<key>CFBundleTypeRole</key>
|
||||||
<string>Viewer</string>
|
<string>Viewer</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>tcx</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/tcx+xml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>tcx.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Training Center XML</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>kml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/vnd.google-earth.kml+xml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>kml.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Keyhole Markup Language</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>fit</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/vnd.ant.fit</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>fit.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Flexible and Interoperable Data Transfer</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>igc</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/vnd.fai.igc</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>igc.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>Flight Recorder Data Format</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>nmea</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>application/vnd.nmea.nmea</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeIconFile</key>
|
||||||
|
<string>nmea.icns</string>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>NMEA 0183 data</string>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
<key>UTImportedTypeDeclarations</key>
|
<key>UTImportedTypeDeclarations</key>
|
||||||
@ -60,6 +140,111 @@
|
|||||||
<string>application/gpx+xml</string>
|
<string>application/gpx+xml</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>com.garmin.tcx</string>
|
||||||
|
<key>UTTypeReferenceURL</key>
|
||||||
|
<string>http://www8.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>Training Center XML</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.xml</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>tcx</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/tcx+xml</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>com.google.kml</string>
|
||||||
|
<key>UTTypeReferenceURL</key>
|
||||||
|
<string>https://developers.google.com/kml/documentation/kmlreference</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>Keyhole Markup Language</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.xml</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>kml</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/vnd.google-earth.kml+xml</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>com.thisisant.fit</string>
|
||||||
|
<key>UTTypeReferenceURL</key>
|
||||||
|
<string>https://www.thisisant.com/resources/fit</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>Flexible and Interoperable Data Transfer</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.data</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>fit</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/vnd.ant.fit</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>org.fai.igc</string>
|
||||||
|
<key>UTTypeReferenceURL</key>
|
||||||
|
<string>http://www.fai.org/gnss-recording-devices/igc-approved-flight-recorders</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>Flight Recorder Data Format</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.data</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>igc</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/vnd.fai.igc</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>UTTypeIdentifier</key>
|
||||||
|
<string>org.nmea.nmea</string>
|
||||||
|
<key>UTTypeReferenceURL</key>
|
||||||
|
<string>http://www.nmea.org/content/nmea_standards/nmea_0183_v_410.asp</string>
|
||||||
|
<key>UTTypeDescription</key>
|
||||||
|
<string>NMEA 0183 data</string>
|
||||||
|
<key>UTTypeConformsTo</key>
|
||||||
|
<array>
|
||||||
|
<string>public.data</string>
|
||||||
|
</array>
|
||||||
|
<key>UTTypeTagSpecification</key>
|
||||||
|
<dict>
|
||||||
|
<key>public.filename-extension</key>
|
||||||
|
<array>
|
||||||
|
<string>nmea</string>
|
||||||
|
</array>
|
||||||
|
<key>public.mime-type</key>
|
||||||
|
<string>application/vnd.nmea.nmea</string>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
|
||||||
</dict>
|
</dict>
|
||||||
|
34
README.md
@ -1,33 +1,33 @@
|
|||||||
# GPXSee
|
# GPXSee
|
||||||
GPX viewer and analyzer.
|
GPXSee is a Qt-based GPS log file viewer and analyzer that supports GPX, TCX,
|
||||||
|
KML, FIT, IGC and NMEA files.
|
||||||
|
|
||||||
* User-definable map sources.
|
## Features
|
||||||
* Track and elevation/speed/heart rate graphs.
|
* User-definable online maps.
|
||||||
|
* Offline maps (OziExplorer maps and TrekBuddy maps/atlases).
|
||||||
|
* Elevation, speed, heart rate, cadence, power and temperature graphs.
|
||||||
* Support for multiple tracks in one view.
|
* Support for multiple tracks in one view.
|
||||||
* Support for POI files.
|
* Support for POI files.
|
||||||
* Export to PDF.
|
* Print/export to PDF.
|
||||||
* Full-screen mode
|
* Full-screen mode.
|
||||||
* 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 and Garmin CSV files.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
### Linux/OS X
|
|
||||||
```shell
|
```shell
|
||||||
lrelease gpxsee.pro
|
lrelease gpxsee.pro
|
||||||
qmake gpxsee.pro
|
qmake gpxsee.pro
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
### Windows
|
|
||||||
```shell
|
|
||||||
lrelease gpxsee.pro
|
|
||||||
qmake gpxsee.pro
|
|
||||||
nmake release
|
|
||||||
```
|
|
||||||
|
|
||||||
## Binaries
|
## Download
|
||||||
* Windows & OS X builds: http://sourceforge.net/projects/gpxsee
|
* [Windows & OS X builds](http://sourceforge.net/projects/gpxsee)
|
||||||
* Linux packages: https://build.opensuse.org/project/repositories/home:tumic:GPXSee
|
* [Linux packages](http://software.opensuse.org/download.html?project=home%3Atumic%3AGPXSee&package=gpxsee)
|
||||||
|
|
||||||
|
## Changelog
|
||||||
|
[Changelog](https://build.opensuse.org/package/view_file/home:tumic:GPXSee/gpxsee/gpxsee.changes)
|
||||||
|
|
||||||
## Homepage
|
## Homepage
|
||||||
GPXSee homepage: http://tumic.wz.cz/gpxsee
|
http://www.gpxsee.org
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
|
||||||
set PATH=C:\qt\qtbase\bin;%PATH%
|
|
||||||
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
|
|
||||||
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
|
|
||||||
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib;%LIB%
|
|
||||||
set CL=/D_USING_V110_SDK71_
|
|
@ -1,6 +0,0 @@
|
|||||||
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
|
||||||
set PATH=C:\qt64\qtbase\bin;%PATH%
|
|
||||||
set PATH=C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin;%PATH%
|
|
||||||
set INCLUDE=C:\Program Files\Microsoft SDKs\Windows\v7.1\Include;%INCLUDE%
|
|
||||||
set LIB=C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64;%LIB%
|
|
||||||
set CL=/D_USING_V110_SDK71_
|
|
144
gpxsee.pro
@ -1,18 +1,17 @@
|
|||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
VERSION = 2.14
|
VERSION = 4.10
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
network
|
network
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
|
||||||
|
lessThan(QT_VERSION, 5.4): QT += opengl
|
||||||
|
macx: QT += opengl
|
||||||
HEADERS += src/config.h \
|
HEADERS += src/config.h \
|
||||||
src/icons.h \
|
src/icons.h \
|
||||||
src/gui.h \
|
src/gui.h \
|
||||||
src/gpx.h \
|
|
||||||
src/parser.h \
|
|
||||||
src/poi.h \
|
src/poi.h \
|
||||||
src/rtree.h \
|
src/rtree.h \
|
||||||
src/ll.h \
|
|
||||||
src/axisitem.h \
|
src/axisitem.h \
|
||||||
src/keys.h \
|
src/keys.h \
|
||||||
src/slideritem.h \
|
src/slideritem.h \
|
||||||
@ -23,13 +22,11 @@ HEADERS += src/config.h \
|
|||||||
src/sliderinfoitem.h \
|
src/sliderinfoitem.h \
|
||||||
src/filebrowser.h \
|
src/filebrowser.h \
|
||||||
src/map.h \
|
src/map.h \
|
||||||
src/maplist.h \
|
src/onlinemap.h \
|
||||||
src/downloader.h \
|
src/downloader.h \
|
||||||
src/units.h \
|
src/units.h \
|
||||||
src/scaleitem.h \
|
src/scaleitem.h \
|
||||||
src/nicenum.h \
|
|
||||||
src/waypoint.h \
|
src/waypoint.h \
|
||||||
src/trackview.h \
|
|
||||||
src/track.h \
|
src/track.h \
|
||||||
src/graphview.h \
|
src/graphview.h \
|
||||||
src/trackpoint.h \
|
src/trackpoint.h \
|
||||||
@ -43,13 +40,66 @@ HEADERS += src/config.h \
|
|||||||
src/trackinfo.h \
|
src/trackinfo.h \
|
||||||
src/exportdialog.h \
|
src/exportdialog.h \
|
||||||
src/fileselectwidget.h \
|
src/fileselectwidget.h \
|
||||||
src/margins.h
|
src/margins.h \
|
||||||
|
src/temperaturegraph.h \
|
||||||
|
src/graphtab.h \
|
||||||
|
src/misc.h \
|
||||||
|
src/trackitem.h \
|
||||||
|
src/tooltip.h \
|
||||||
|
src/route.h \
|
||||||
|
src/routeitem.h \
|
||||||
|
src/graphitem.h \
|
||||||
|
src/graph.h \
|
||||||
|
src/pathitem.h \
|
||||||
|
src/pathview.h \
|
||||||
|
src/griditem.h \
|
||||||
|
src/data.h \
|
||||||
|
src/gpxparser.h \
|
||||||
|
src/tcxparser.h \
|
||||||
|
src/parser.h \
|
||||||
|
src/csvparser.h \
|
||||||
|
src/coordinates.h \
|
||||||
|
src/tile.h \
|
||||||
|
src/rd.h \
|
||||||
|
src/wgs84.h \
|
||||||
|
src/kmlparser.h \
|
||||||
|
src/trackdata.h \
|
||||||
|
src/routedata.h \
|
||||||
|
src/fitparser.h \
|
||||||
|
src/format.h \
|
||||||
|
src/path.h \
|
||||||
|
src/assert.h \
|
||||||
|
src/cadencegraph.h \
|
||||||
|
src/powergraph.h \
|
||||||
|
src/igcparser.h \
|
||||||
|
src/nmeaparser.h \
|
||||||
|
src/optionsdialog.h \
|
||||||
|
src/colorbox.h \
|
||||||
|
src/stylecombobox.h \
|
||||||
|
src/opengl.h \
|
||||||
|
src/timetype.h \
|
||||||
|
src/emptymap.h \
|
||||||
|
src/offlinemap.h \
|
||||||
|
src/matrix.h \
|
||||||
|
src/tar.h \
|
||||||
|
src/atlas.h \
|
||||||
|
src/projection.h \
|
||||||
|
src/mercator.h \
|
||||||
|
src/transversemercator.h \
|
||||||
|
src/latlon.h \
|
||||||
|
src/utm.h \
|
||||||
|
src/lambertconic.h \
|
||||||
|
src/ellipsoid.h \
|
||||||
|
src/ozf.h \
|
||||||
|
src/datum.h \
|
||||||
|
src/maplist.h \
|
||||||
|
src/albersequal.h \
|
||||||
|
src/oddspinbox.h \
|
||||||
|
src/rectc.h \
|
||||||
|
src/searchpointer.h
|
||||||
SOURCES += src/main.cpp \
|
SOURCES += src/main.cpp \
|
||||||
src/gui.cpp \
|
src/gui.cpp \
|
||||||
src/gpx.cpp \
|
|
||||||
src/parser.cpp \
|
|
||||||
src/poi.cpp \
|
src/poi.cpp \
|
||||||
src/ll.cpp \
|
|
||||||
src/axisitem.cpp \
|
src/axisitem.cpp \
|
||||||
src/slideritem.cpp \
|
src/slideritem.cpp \
|
||||||
src/markeritem.cpp \
|
src/markeritem.cpp \
|
||||||
@ -58,12 +108,9 @@ SOURCES += src/main.cpp \
|
|||||||
src/speedgraph.cpp \
|
src/speedgraph.cpp \
|
||||||
src/sliderinfoitem.cpp \
|
src/sliderinfoitem.cpp \
|
||||||
src/filebrowser.cpp \
|
src/filebrowser.cpp \
|
||||||
src/map.cpp \
|
src/onlinemap.cpp \
|
||||||
src/maplist.cpp \
|
|
||||||
src/downloader.cpp \
|
src/downloader.cpp \
|
||||||
src/scaleitem.cpp \
|
src/scaleitem.cpp \
|
||||||
src/nicenum.cpp \
|
|
||||||
src/trackview.cpp \
|
|
||||||
src/track.cpp \
|
src/track.cpp \
|
||||||
src/graphview.cpp \
|
src/graphview.cpp \
|
||||||
src/waypointitem.cpp \
|
src/waypointitem.cpp \
|
||||||
@ -73,19 +120,78 @@ SOURCES += src/main.cpp \
|
|||||||
src/app.cpp \
|
src/app.cpp \
|
||||||
src/trackinfo.cpp \
|
src/trackinfo.cpp \
|
||||||
src/exportdialog.cpp \
|
src/exportdialog.cpp \
|
||||||
src/fileselectwidget.cpp
|
src/fileselectwidget.cpp \
|
||||||
|
src/temperaturegraph.cpp \
|
||||||
|
src/trackpoint.cpp \
|
||||||
|
src/misc.cpp \
|
||||||
|
src/waypoint.cpp \
|
||||||
|
src/trackitem.cpp \
|
||||||
|
src/tooltip.cpp \
|
||||||
|
src/route.cpp \
|
||||||
|
src/routeitem.cpp \
|
||||||
|
src/graphitem.cpp \
|
||||||
|
src/pathitem.cpp \
|
||||||
|
src/pathview.cpp \
|
||||||
|
src/griditem.cpp \
|
||||||
|
src/data.cpp \
|
||||||
|
src/gpxparser.cpp \
|
||||||
|
src/tcxparser.cpp \
|
||||||
|
src/csvparser.cpp \
|
||||||
|
src/coordinates.cpp \
|
||||||
|
src/kmlparser.cpp \
|
||||||
|
src/fitparser.cpp \
|
||||||
|
src/format.cpp \
|
||||||
|
src/graph.cpp \
|
||||||
|
src/cadencegraph.cpp \
|
||||||
|
src/powergraph.cpp \
|
||||||
|
src/igcparser.cpp \
|
||||||
|
src/path.cpp \
|
||||||
|
src/nmeaparser.cpp \
|
||||||
|
src/optionsdialog.cpp \
|
||||||
|
src/colorbox.cpp \
|
||||||
|
src/stylecombobox.cpp \
|
||||||
|
src/emptymap.cpp \
|
||||||
|
src/offlinemap.cpp \
|
||||||
|
src/matrix.cpp \
|
||||||
|
src/tar.cpp \
|
||||||
|
src/atlas.cpp \
|
||||||
|
src/mercator.cpp \
|
||||||
|
src/transversemercator.cpp \
|
||||||
|
src/utm.cpp \
|
||||||
|
src/lambertconic.cpp \
|
||||||
|
src/ellipsoid.cpp \
|
||||||
|
src/ozf.cpp \
|
||||||
|
src/datum.cpp \
|
||||||
|
src/maplist.cpp \
|
||||||
|
src/albersequal.cpp \
|
||||||
|
src/oddspinbox.cpp \
|
||||||
|
src/rectc.cpp
|
||||||
RESOURCES += gpxsee.qrc
|
RESOURCES += gpxsee.qrc
|
||||||
TRANSLATIONS = lang/gpxsee_cs.ts
|
TRANSLATIONS = lang/gpxsee_cs.ts \
|
||||||
|
lang/gpxsee_sv.ts \
|
||||||
|
lang/gpxsee_de.ts
|
||||||
macx {
|
macx {
|
||||||
ICON = icons/gpxsee.icns
|
ICON = icons/gpxsee.icns
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
QMAKE_INFO_PLIST = Info.plist
|
||||||
APP_RESOURCES.files = icons/gpx.icns \
|
APP_RESOURCES.files = icons/gpx.icns \
|
||||||
pkg/maps.txt
|
icons/tcx.icns \
|
||||||
|
icons/kml.icns \
|
||||||
|
icons/fit.icns \
|
||||||
|
icons/igc.icns \
|
||||||
|
icons/nmea.icns \
|
||||||
|
pkg/maps.txt \
|
||||||
|
pkg/ellipsoids.csv \
|
||||||
|
pkg/datums.csv
|
||||||
APP_RESOURCES.path = Contents/Resources
|
APP_RESOURCES.path = Contents/Resources
|
||||||
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
||||||
}
|
}
|
||||||
win32 {
|
win32 {
|
||||||
RC_ICONS = icons/gpxsee.ico \
|
RC_ICONS = icons/gpxsee.ico \
|
||||||
icons/gpx.ico
|
icons/gpx.ico \
|
||||||
|
icons/tcx.ico \
|
||||||
|
icons/kml.ico \
|
||||||
|
icons/fit.ico \
|
||||||
|
icons/igc.ico \
|
||||||
|
icons/nmea.ico
|
||||||
}
|
}
|
||||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||||
|
@ -14,6 +14,14 @@
|
|||||||
<file>icons/arrow-left-double.png</file>
|
<file>icons/arrow-left-double.png</file>
|
||||||
<file>icons/arrow-right-double.png</file>
|
<file>icons/arrow-right-double.png</file>
|
||||||
<file>icons/view-fullscreen.png</file>
|
<file>icons/view-fullscreen.png</file>
|
||||||
|
<file>icons/office-chart-line.png</file>
|
||||||
|
<file>icons/preferences-desktop-display.png</file>
|
||||||
|
<file>icons/flag_48.png</file>
|
||||||
|
<file>icons/system-run.png</file>
|
||||||
|
<file>icons/document-print-preview.png</file>
|
||||||
|
<file>icons/view-filter.png</file>
|
||||||
<file>lang/gpxsee_cs.qm</file>
|
<file>lang/gpxsee_cs.qm</file>
|
||||||
|
<file>lang/gpxsee_sv.qm</file>
|
||||||
|
<file>lang/gpxsee_de.qm</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
icons/document-print-preview.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
icons/fit.icns
Normal file
BIN
icons/fit.ico
Normal file
After Width: | Height: | Size: 361 KiB |
171
icons/fit.svg
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="svg3390"
|
||||||
|
height="185"
|
||||||
|
width="185"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="fit.svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1440"
|
||||||
|
inkscape:window-height="815"
|
||||||
|
id="namedview3427"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:zoom="3.1351351"
|
||||||
|
inkscape:cx="92.5"
|
||||||
|
inkscape:cy="92.5"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg3390" />
|
||||||
|
<metadata
|
||||||
|
id="metadata3404">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3402" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867"
|
||||||
|
id="path3392"
|
||||||
|
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0" />
|
||||||
|
<rect
|
||||||
|
y="124.9782"
|
||||||
|
x="16.573463"
|
||||||
|
height="49.84631"
|
||||||
|
width="120.3215"
|
||||||
|
id="rect3426"
|
||||||
|
style="fill:#006600;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||||
|
<g
|
||||||
|
id="g3828"
|
||||||
|
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)">
|
||||||
|
<g
|
||||||
|
id="g3715">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="113"
|
||||||
|
cy="90.875"
|
||||||
|
id="ellipse3717"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round"
|
||||||
|
cx="113"
|
||||||
|
cy="90.875"
|
||||||
|
id="ellipse3719"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<polyline
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4"
|
||||||
|
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||||
|
id="polyline3721" />
|
||||||
|
<g
|
||||||
|
id="g3723">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="73.5"
|
||||||
|
cy="125.854"
|
||||||
|
id="ellipse3725"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="73.5"
|
||||||
|
cy="125.854"
|
||||||
|
id="ellipse3727"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3729">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="136.5"
|
||||||
|
cy="172.375"
|
||||||
|
id="ellipse3731"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="136.5"
|
||||||
|
cy="172.375"
|
||||||
|
id="ellipse3733"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3735">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="60.700001"
|
||||||
|
cy="186.39999"
|
||||||
|
id="ellipse3737"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="60.700001"
|
||||||
|
cy="186.39999"
|
||||||
|
id="ellipse3739"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3741">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="154.5"
|
||||||
|
cy="154.354"
|
||||||
|
id="ellipse3743"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="154.5"
|
||||||
|
cy="154.354"
|
||||||
|
id="ellipse3745"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3747">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="96"
|
||||||
|
cy="151.875"
|
||||||
|
id="ellipse3749"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="96"
|
||||||
|
cy="151.875"
|
||||||
|
id="ellipse3751"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
transform="scale(0.9437456,1.0596076)"
|
||||||
|
id="text3921"
|
||||||
|
y="155.86783"
|
||||||
|
x="44.388157"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"
|
||||||
|
sodipodi:linespacing="100%"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan3429"
|
||||||
|
x="44.388157"
|
||||||
|
y="155.86783">FIT</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.9 KiB |
BIN
icons/flag_48.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
icons/gpx.icns
BIN
icons/gpx.ico
Before Width: | Height: | Size: 361 KiB After Width: | Height: | Size: 361 KiB |
146
icons/gpx.svg
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
version="1.1"
|
||||||
|
id="svg3390"
|
||||||
|
height="185"
|
||||||
|
width="185">
|
||||||
|
<metadata
|
||||||
|
id="metadata3404">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3402" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867"
|
||||||
|
id="path3392"
|
||||||
|
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0" />
|
||||||
|
<rect
|
||||||
|
y="124.9782"
|
||||||
|
x="16.573463"
|
||||||
|
height="49.84631"
|
||||||
|
width="120.3215"
|
||||||
|
id="rect3426"
|
||||||
|
style="fill:#003399;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||||
|
<g
|
||||||
|
id="g3828"
|
||||||
|
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)">
|
||||||
|
<g
|
||||||
|
id="g3715">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="113"
|
||||||
|
cy="90.875"
|
||||||
|
id="ellipse3717"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round"
|
||||||
|
cx="113"
|
||||||
|
cy="90.875"
|
||||||
|
id="ellipse3719"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<polyline
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4"
|
||||||
|
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||||
|
id="polyline3721" />
|
||||||
|
<g
|
||||||
|
id="g3723">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="73.5"
|
||||||
|
cy="125.854"
|
||||||
|
id="ellipse3725"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="73.5"
|
||||||
|
cy="125.854"
|
||||||
|
id="ellipse3727"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3729">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="136.5"
|
||||||
|
cy="172.375"
|
||||||
|
id="ellipse3731"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="136.5"
|
||||||
|
cy="172.375"
|
||||||
|
id="ellipse3733"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3735">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="60.700001"
|
||||||
|
cy="186.39999"
|
||||||
|
id="ellipse3737"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="60.700001"
|
||||||
|
cy="186.39999"
|
||||||
|
id="ellipse3739"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3741">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="154.5"
|
||||||
|
cy="154.354"
|
||||||
|
id="ellipse3743"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="154.5"
|
||||||
|
cy="154.354"
|
||||||
|
id="ellipse3745"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3747">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="96"
|
||||||
|
cy="151.875"
|
||||||
|
id="ellipse3749"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="96"
|
||||||
|
cy="151.875"
|
||||||
|
id="ellipse3751"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
transform="scale(0.9437456,1.0596076)"
|
||||||
|
id="text3921"
|
||||||
|
y="155.86783"
|
||||||
|
x="31.672857"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
y="155.86783"
|
||||||
|
x="31.672857"
|
||||||
|
id="tspan3923"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;writing-mode:lr-tb;text-anchor:start">GPX</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.4 KiB |
BIN
icons/igc.icns
Normal file
BIN
icons/igc.ico
Normal file
After Width: | Height: | Size: 361 KiB |
145
icons/igc.svg
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="185"
|
||||||
|
height="185"
|
||||||
|
id="svg3390"
|
||||||
|
version="1.1">
|
||||||
|
<metadata
|
||||||
|
id="metadata3404">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3402" />
|
||||||
|
<path
|
||||||
|
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0"
|
||||||
|
id="path3392"
|
||||||
|
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867" />
|
||||||
|
<rect
|
||||||
|
style="fill:#ff3300;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect3426"
|
||||||
|
width="120.3215"
|
||||||
|
height="49.84631"
|
||||||
|
x="16.573463"
|
||||||
|
y="124.9782" />
|
||||||
|
<g
|
||||||
|
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)"
|
||||||
|
id="g3828">
|
||||||
|
<g
|
||||||
|
id="g3715">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3717"
|
||||||
|
cy="90.875"
|
||||||
|
cx="113"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3719"
|
||||||
|
cy="90.875"
|
||||||
|
cx="113"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round" />
|
||||||
|
</g>
|
||||||
|
<polyline
|
||||||
|
id="polyline3721"
|
||||||
|
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4" />
|
||||||
|
<g
|
||||||
|
id="g3723">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3725"
|
||||||
|
cy="125.854"
|
||||||
|
cx="73.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3727"
|
||||||
|
cy="125.854"
|
||||||
|
cx="73.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3729">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3731"
|
||||||
|
cy="172.375"
|
||||||
|
cx="136.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3733"
|
||||||
|
cy="172.375"
|
||||||
|
cx="136.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3735">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3737"
|
||||||
|
cy="186.39999"
|
||||||
|
cx="60.700001"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3739"
|
||||||
|
cy="186.39999"
|
||||||
|
cx="60.700001"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3741">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3743"
|
||||||
|
cy="154.354"
|
||||||
|
cx="154.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3745"
|
||||||
|
cy="154.354"
|
||||||
|
cx="154.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3747">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3749"
|
||||||
|
cy="151.875"
|
||||||
|
cx="96"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3751"
|
||||||
|
cy="151.875"
|
||||||
|
cx="96"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="40.149723"
|
||||||
|
y="155.86783"
|
||||||
|
id="text3921"
|
||||||
|
transform="scale(0.9437456,1.0596076)"><tspan
|
||||||
|
y="155.86783"
|
||||||
|
x="40.149723"
|
||||||
|
id="tspan3448">IGC</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
BIN
icons/kml.icns
Normal file
BIN
icons/kml.ico
Normal file
After Width: | Height: | Size: 361 KiB |
143
icons/kml.svg
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="185"
|
||||||
|
height="185"
|
||||||
|
id="svg3390"
|
||||||
|
version="1.1">
|
||||||
|
<metadata
|
||||||
|
id="metadata3404">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3402" />
|
||||||
|
<path
|
||||||
|
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0"
|
||||||
|
id="path3392"
|
||||||
|
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867" />
|
||||||
|
<rect
|
||||||
|
style="fill:#990000;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect3426"
|
||||||
|
width="120.3215"
|
||||||
|
height="49.84631"
|
||||||
|
x="16.573463"
|
||||||
|
y="124.9782" />
|
||||||
|
<g
|
||||||
|
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)"
|
||||||
|
id="g3828">
|
||||||
|
<g
|
||||||
|
id="g3715">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3717"
|
||||||
|
cy="90.875"
|
||||||
|
cx="113"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3719"
|
||||||
|
cy="90.875"
|
||||||
|
cx="113"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round" />
|
||||||
|
</g>
|
||||||
|
<polyline
|
||||||
|
id="polyline3721"
|
||||||
|
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4" />
|
||||||
|
<g
|
||||||
|
id="g3723">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3725"
|
||||||
|
cy="125.854"
|
||||||
|
cx="73.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3727"
|
||||||
|
cy="125.854"
|
||||||
|
cx="73.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3729">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3731"
|
||||||
|
cy="172.375"
|
||||||
|
cx="136.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3733"
|
||||||
|
cy="172.375"
|
||||||
|
cx="136.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3735">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3737"
|
||||||
|
cy="186.39999"
|
||||||
|
cx="60.700001"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3739"
|
||||||
|
cy="186.39999"
|
||||||
|
cx="60.700001"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3741">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3743"
|
||||||
|
cy="154.354"
|
||||||
|
cx="154.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3745"
|
||||||
|
cy="154.354"
|
||||||
|
cx="154.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3747">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3749"
|
||||||
|
cy="151.875"
|
||||||
|
cx="96"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3751"
|
||||||
|
cy="151.875"
|
||||||
|
cx="96"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
||||||
|
x="31.672857"
|
||||||
|
y="155.86783"
|
||||||
|
id="text3921"
|
||||||
|
transform="scale(0.9437456,1.0596076)"><tspan
|
||||||
|
id="tspan3429">KML</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
BIN
icons/nmea.icns
Normal file
BIN
icons/nmea.ico
Normal file
After Width: | Height: | Size: 361 KiB |
145
icons/nmea.svg
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
version="1.1"
|
||||||
|
id="svg3390"
|
||||||
|
height="185"
|
||||||
|
width="185">
|
||||||
|
<metadata
|
||||||
|
id="metadata3404">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3402" />
|
||||||
|
<path
|
||||||
|
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867"
|
||||||
|
id="path3392"
|
||||||
|
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0" />
|
||||||
|
<rect
|
||||||
|
y="124.9782"
|
||||||
|
x="16.573463"
|
||||||
|
height="49.84631"
|
||||||
|
width="131.6837"
|
||||||
|
id="rect3426"
|
||||||
|
style="fill:#0083d7;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||||
|
<g
|
||||||
|
id="g3828"
|
||||||
|
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)">
|
||||||
|
<g
|
||||||
|
id="g3715">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="113"
|
||||||
|
cy="90.875"
|
||||||
|
id="ellipse3717"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round"
|
||||||
|
cx="113"
|
||||||
|
cy="90.875"
|
||||||
|
id="ellipse3719"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<polyline
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4"
|
||||||
|
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||||
|
id="polyline3721" />
|
||||||
|
<g
|
||||||
|
id="g3723">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="73.5"
|
||||||
|
cy="125.854"
|
||||||
|
id="ellipse3725"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="73.5"
|
||||||
|
cy="125.854"
|
||||||
|
id="ellipse3727"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3729">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="136.5"
|
||||||
|
cy="172.375"
|
||||||
|
id="ellipse3731"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="136.5"
|
||||||
|
cy="172.375"
|
||||||
|
id="ellipse3733"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3735">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="60.700001"
|
||||||
|
cy="186.39999"
|
||||||
|
id="ellipse3737"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="60.700001"
|
||||||
|
cy="186.39999"
|
||||||
|
id="ellipse3739"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3741">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="154.5"
|
||||||
|
cy="154.354"
|
||||||
|
id="ellipse3743"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="154.5"
|
||||||
|
cy="154.354"
|
||||||
|
id="ellipse3745"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3747">
|
||||||
|
<circle
|
||||||
|
style="fill:#000000"
|
||||||
|
cx="96"
|
||||||
|
cy="151.875"
|
||||||
|
id="ellipse3749"
|
||||||
|
r="7.0209999" />
|
||||||
|
<circle
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2"
|
||||||
|
cx="96"
|
||||||
|
cy="151.875"
|
||||||
|
id="ellipse3751"
|
||||||
|
r="7.0209999" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
transform="scale(0.9437456,1.0596076)"
|
||||||
|
id="text3921"
|
||||||
|
y="155.86783"
|
||||||
|
x="21.076782"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
y="155.86783"
|
||||||
|
x="21.076782"
|
||||||
|
id="tspan3429">NMEA</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
BIN
icons/office-chart-line.png
Normal file
After Width: | Height: | Size: 728 B |
BIN
icons/preferences-desktop-display.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
icons/system-run.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
icons/tcx.icns
Normal file
BIN
icons/tcx.ico
Normal file
After Width: | Height: | Size: 361 KiB |
145
icons/tcx.svg
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="185"
|
||||||
|
height="185"
|
||||||
|
id="svg3390"
|
||||||
|
version="1.1">
|
||||||
|
<metadata
|
||||||
|
id="metadata3404">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs3402" />
|
||||||
|
<path
|
||||||
|
d="m 128.23996,2.2548915 -95.377018,0 0,181.0580085 134.394868,0 0,-141.313567 z m 0,0 0,39.7444415 39.01785,0"
|
||||||
|
id="path3392"
|
||||||
|
style="fill:#ffffff;stroke:#999999;stroke-width:2.18774867" />
|
||||||
|
<rect
|
||||||
|
style="fill:#ffcc00;fill-opacity:1;stroke:none;stroke-width:2;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="rect3426"
|
||||||
|
width="120.3215"
|
||||||
|
height="49.84631"
|
||||||
|
x="16.573463"
|
||||||
|
y="124.9782" />
|
||||||
|
<g
|
||||||
|
transform="matrix(0.89093793,0,0,0.84489692,3.5017807,-51.565424)"
|
||||||
|
id="g3828">
|
||||||
|
<g
|
||||||
|
id="g3715">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3717"
|
||||||
|
cy="90.875"
|
||||||
|
cx="113"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3719"
|
||||||
|
cy="90.875"
|
||||||
|
cx="113"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2;stroke-linejoin:round" />
|
||||||
|
</g>
|
||||||
|
<polyline
|
||||||
|
id="polyline3721"
|
||||||
|
points="62.3563,178.566 73.5,125.854 96,151.875 113,90.875 136.5,172.375 148.831,160.03 "
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:4" />
|
||||||
|
<g
|
||||||
|
id="g3723">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3725"
|
||||||
|
cy="125.854"
|
||||||
|
cx="73.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3727"
|
||||||
|
cy="125.854"
|
||||||
|
cx="73.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3729">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3731"
|
||||||
|
cy="172.375"
|
||||||
|
cx="136.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3733"
|
||||||
|
cy="172.375"
|
||||||
|
cx="136.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3735">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3737"
|
||||||
|
cy="186.39999"
|
||||||
|
cx="60.700001"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3739"
|
||||||
|
cy="186.39999"
|
||||||
|
cx="60.700001"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3741">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3743"
|
||||||
|
cy="154.354"
|
||||||
|
cx="154.5"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3745"
|
||||||
|
cy="154.354"
|
||||||
|
cx="154.5"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3747">
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3749"
|
||||||
|
cy="151.875"
|
||||||
|
cx="96"
|
||||||
|
style="fill:#000000" />
|
||||||
|
<circle
|
||||||
|
r="7.0209999"
|
||||||
|
id="ellipse3751"
|
||||||
|
cy="151.875"
|
||||||
|
cx="96"
|
||||||
|
style="fill:none;fill-opacity:0;stroke:#000000;stroke-width:2" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:40px;line-height:100%;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
x="35.911289"
|
||||||
|
y="155.86783"
|
||||||
|
id="text3921"
|
||||||
|
transform="scale(0.9437456,1.0596076)"><tspan
|
||||||
|
y="155.86783"
|
||||||
|
x="35.911289"
|
||||||
|
id="tspan3429">TCX</tspan></text>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4.1 KiB |
BIN
icons/view-filter.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
1458
lang/gpxsee_cs.ts
1215
lang/gpxsee_de.ts
Normal file
1215
lang/gpxsee_sv.ts
Normal file
123
pkg/datums.csv
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
Adindan,4201,5,-162,-12,206
|
||||||
|
Afgooye,4205,15,-43,-163,45
|
||||||
|
Ain el Abd 1970,4204,14,-150,-251,-2
|
||||||
|
Anna 1 Astro 1965,4708,2,-491,-22,435
|
||||||
|
Arc 1950,4209,5,-143,-90,-294
|
||||||
|
Arc 1960,4210,5,-160,-8,-300
|
||||||
|
Ascension Island 1958,4712,14,-207,107,52
|
||||||
|
Astro B4 Sorol Atoll,4707,14,114,-116,-333
|
||||||
|
Astro Beacon 1945,4709,14,145,75,-272
|
||||||
|
Astro DOS 71/4,4710,14,-320,550,-494
|
||||||
|
Astronomic Stn 1952,4711,14,124,-234,-25
|
||||||
|
Australian Geodetic 1966,4202,2,-133,-48,148
|
||||||
|
Australian Geodetic 1984,4203,2,-134,-48,149
|
||||||
|
Australian Geocentric 1994 (GDA94),4283,11,0,0,0
|
||||||
|
Austrian,4312,3,594,84,471
|
||||||
|
Bellevue (IGN),4714,14,-127,-769,472
|
||||||
|
Bermuda 1957,4216,4,-73,213,296
|
||||||
|
Bogota Observatory,4218,14,307,304,-318
|
||||||
|
Campo Inchauspe,4221,14,-148,136,90
|
||||||
|
Canton Astro 1966,4716,14,298,-304,-375
|
||||||
|
Cape,4222,5,-136,-108,-292
|
||||||
|
Cape Canaveral,4717,4,-2,150,181
|
||||||
|
Carthage,4223,5,-263,6,431
|
||||||
|
CH-1903,4149,3,674,15,405
|
||||||
|
Chatham 1971,4672,14,175,-38,113
|
||||||
|
Chua Astro,4224,14,-134,229,-29
|
||||||
|
Corrego Alegre,4225,14,-206,172,-6
|
||||||
|
Djakarta (Batavia),4211,3,-377,681,-50
|
||||||
|
DOS 1968,,14,230,-199,-752
|
||||||
|
Easter Island 1967,4719,14,211,147,111
|
||||||
|
Egypt,,14,-130,-117,-151
|
||||||
|
European 1950,4230,14,-87,-98,-121
|
||||||
|
European 1950 (Mean France),,14,-87,-96,-120
|
||||||
|
European 1950 (Spain and Portugal),,14,-84,-107,-120
|
||||||
|
European 1979,4668,14,-86,-98,-119
|
||||||
|
Finland Hayford,4123,14,-78,-231,-97
|
||||||
|
Gandajika Base,4233,14,-133,-321,50
|
||||||
|
Geodetic Datum 1949,4272,14,84,-22,209
|
||||||
|
GGRS 87,4121,11,-199.87,74.79,246.62
|
||||||
|
Guam 1963,4675,4,-100,-248,259
|
||||||
|
GUX 1 Astro,4718,14,252,-209,-751
|
||||||
|
Hartebeeshoek94,4148,20,0,0,0
|
||||||
|
Hermannskogel,3906,3,653,-212,449
|
||||||
|
Hjorsey 1955,4658,14,-73,46,-86
|
||||||
|
Hong Kong 1963,4739,14,-156,-271,-189
|
||||||
|
Hu-Tzu-Shan,4236,14,-634,-549,-201
|
||||||
|
Indian Bangladesh,4682,6,289,734,257
|
||||||
|
Indian Thailand,4240,6,214,836,303
|
||||||
|
Israeli,4281,23,-235,-85,264
|
||||||
|
Ireland 1965,4299,1,506,-122,611
|
||||||
|
ISTS 073 Astro 1969,4724,14,208,-435,-229
|
||||||
|
Johnston Island,4725,14,191,-77,-204
|
||||||
|
Kandawala,4244,6,-97,787,86
|
||||||
|
Kerguelen Island,4698,14,145,-187,103
|
||||||
|
Kertau 1948,4245,7,-11,851,5
|
||||||
|
L.C. 5 Astro,4726,4,42,124,147
|
||||||
|
Liberia 1964,4251,5,-90,40,88
|
||||||
|
Luzon Mindanao,,4,-133,-79,-72
|
||||||
|
Luzon Philippines,4253,4,-133,-77,-51
|
||||||
|
Mahe 1971,4256,5,41,-220,-134
|
||||||
|
Marco Astro,4616,14,-289,-124,60
|
||||||
|
Massawa,4262,3,639,405,60
|
||||||
|
Merchich,4261,5,31,146,47
|
||||||
|
Midway Astro 1961,4727,14,912,-58,1227
|
||||||
|
Minna,4263,5,-92,-93,122
|
||||||
|
NAD27 Alaska,,4,-5,135,172
|
||||||
|
NAD27 Bahamas,,4,-4,154,178
|
||||||
|
NAD27 Canada,,4,-10,158,187
|
||||||
|
NAD27 Canal Zone,,4,0,125,201
|
||||||
|
NAD27 Caribbean,,4,-7,152,178
|
||||||
|
NAD27 Central,,4,0,125,194
|
||||||
|
NAD27 CONUS,,4,-8,160,176
|
||||||
|
NAD27 Cuba,,4,-9,152,178
|
||||||
|
NAD27 Greenland,,4,11,114,195
|
||||||
|
NAD27 Mexico,,4,-12,130,190
|
||||||
|
NAD27 San Salvador,,4,1,140,165
|
||||||
|
NAD83,4269,11,0,0,0
|
||||||
|
Nahrwn Masirah Ilnd,,5,-247,-148,369
|
||||||
|
Nahrwn Saudi Arbia,,5,-231,-196,482
|
||||||
|
Nahrwn United Arab,,5,-249,-156,381
|
||||||
|
Naparima BWI,4271,14,-2,374,172
|
||||||
|
NGO1948,4273,27,315,-217,528
|
||||||
|
NTF France,4275,24,-168,-60,320
|
||||||
|
Norsk,4817,27,278,93,474
|
||||||
|
NZGD1949,4272,14,84,-22,209
|
||||||
|
NZGD2000,4167,20,0,0,0
|
||||||
|
Observatorio 1966,4182,14,-425,-169,81
|
||||||
|
Old Egyptian,4229,12,-130,110,-13
|
||||||
|
Old Hawaiian,4135,4,61,-285,-181
|
||||||
|
Oman,4232,5,-346,-1,224
|
||||||
|
Ord Srvy Grt Britn,4277,0,375,-111,431
|
||||||
|
Pico De Las Nieves,4728,14,-307,-92,127
|
||||||
|
Pitcairn Astro 1967,4729,14,185,165,42
|
||||||
|
Potsdam Rauenberg DHDN,4314,3,606,23,413
|
||||||
|
Prov So Amrican 1956,4248,14,-288,175,-376
|
||||||
|
Prov So Chilean 1963,4254,14,16,196,93
|
||||||
|
Puerto Rico,4139,4,11,72,-101
|
||||||
|
Pulkovo 1942 (1),4284,15,28,-130,-95
|
||||||
|
Pulkovo 1942 (2),4284,15,28,-130,-95
|
||||||
|
Qatar National,4285,14,-128,-283,22
|
||||||
|
Qornoq,4287,14,164,138,-189
|
||||||
|
Reunion,4626,14,94,-948,-1262
|
||||||
|
Rijksdriehoeksmeting,4289,3,593,26,478
|
||||||
|
Rome 1940,4806,14,-225,-65,9
|
||||||
|
RT 90,4124,3,498,-36,568
|
||||||
|
S42,4179,15,28,-121,-77
|
||||||
|
Santo (DOS),4730,14,170,42,84
|
||||||
|
Sao Braz,4184,14,-203,141,53
|
||||||
|
Sapper Hill 1943,4292,14,-355,16,74
|
||||||
|
Schwarzeck,4293,21,616,97,-251
|
||||||
|
South American 1969,4291,16,-57,1,-41
|
||||||
|
South Asia,,8,7,-10,-26
|
||||||
|
Southeast Base,4615,14,-499,-249,314
|
||||||
|
Southwest Base,4183,14,-104,167,-38
|
||||||
|
Timbalai 1948,4298,6,-689,691,-46
|
||||||
|
Tokyo,4301,3,-128,481,664
|
||||||
|
Tristan Astro 1968,4734,14,-632,438,-609
|
||||||
|
Viti Levu 1916,4731,5,51,391,-36
|
||||||
|
Wake-Eniwetok 1960,4732,13,101,52,-39
|
||||||
|
WGS 72,4322,19,0,0,5
|
||||||
|
WGS 84,4326,20,0,0,0
|
||||||
|
Yacare,4309,14,-155,171,37
|
||||||
|
Zanderij,4311,14,-265,120,-358
|
|
30
pkg/ellipsoids.csv
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
0,Airy 1830,6377563.396,299.3249646
|
||||||
|
1,Modified Airy,6377340.189,299.3249646
|
||||||
|
2,Australian National,6378160.0,298.25
|
||||||
|
3,Bessel 1841,6377397.155,299.1528128
|
||||||
|
4,Clarke 1866,6378206.4,294.9786982
|
||||||
|
5,Clarke 1880,6378249.145,293.465
|
||||||
|
6,Everest (India 1830),6377276.345,300.8017
|
||||||
|
7,Everest (1948),6377304.063,300.8017
|
||||||
|
8,Modified Fischer 1960,6378155.0,298.3
|
||||||
|
9,Everest (Pakistan),6377309.613,300.8017
|
||||||
|
10,Indonesian 1974,6378160.0,298.247
|
||||||
|
11,GRS 80,6378137.0,298.257222101
|
||||||
|
12,Helmert 1906,6378200.0,298.3
|
||||||
|
13,Hough 1960,6378270.0,297.0
|
||||||
|
14,International 1924,6378388.0,297.0
|
||||||
|
15,Krassovsky 1940,6378245.0,298.3
|
||||||
|
16,South American 1969,6378160.0,298.25
|
||||||
|
17,Everest (Malaysia 1969),6377295.664,300.8017
|
||||||
|
18,Everest (Sabah Sarawak),6377298.556,300.8017
|
||||||
|
19,WGS 72,6378135.0,298.26
|
||||||
|
20,WGS 84,6378137.0,298.257223563
|
||||||
|
21,Bessel 1841 (Namibia),6377483.865,299.1528128
|
||||||
|
22,Everest (India 1956),6377301.243,300.8017
|
||||||
|
23,Clarke 1880 Palestine,6378300.789,293.466
|
||||||
|
24,Clarke 1880 IGN,6378249.2,293.466021
|
||||||
|
25,Hayford 1909,6378388.0,296.959263
|
||||||
|
26,Clarke 1858,6378350.87,294.26
|
||||||
|
27,Bessel 1841 (Norway),6377492.0176,299.1528
|
||||||
|
28,Plessis 1817 (France),6376523.0,308.6409971
|
||||||
|
29,Hayford 1924,6378388.0,297.0
|
|
BIN
pkg/gpxsee.cer
Normal file
131
pkg/gpxsee.nsi
@ -1,13 +1,16 @@
|
|||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
!include "x64.nsh"
|
!include "x64.nsh"
|
||||||
|
!include "WinVer.nsh"
|
||||||
|
|
||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "2.14"
|
!define VERSION "4.10"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}.exe"
|
OutFile "GPXSee-${VERSION}.exe"
|
||||||
|
; Compression method
|
||||||
|
SetCompressor /SOLID lzma
|
||||||
|
|
||||||
; Required execution level
|
; Required execution level
|
||||||
RequestExecutionLevel admin
|
RequestExecutionLevel admin
|
||||||
@ -15,14 +18,27 @@ RequestExecutionLevel admin
|
|||||||
; The default installation directory
|
; The default installation directory
|
||||||
InstallDir "$PROGRAMFILES\GPXSee"
|
InstallDir "$PROGRAMFILES\GPXSee"
|
||||||
|
|
||||||
|
; Installer executable info
|
||||||
|
VIProductVersion "${VERSION}.0.0"
|
||||||
|
VIAddVersionKey "ProductVersion" ${VERSION}
|
||||||
|
VIAddVersionKey "FileVersion" "${VERSION}.0.0"
|
||||||
|
VIAddVersionKey "ProductName" "GPXSee"
|
||||||
|
VIAddVersionKey "LegalCopyright" "GPXSee project"
|
||||||
|
VIAddVersionKey "FileDescription" "GPXSee installer"
|
||||||
|
|
||||||
; Registry key to check for directory (so if you install again, it will
|
; Registry key to check for directory (so if you install again, it will
|
||||||
; overwrite the old one automatically)
|
; overwrite the old one automatically)
|
||||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||||
|
|
||||||
; Registry key for uninstaller
|
; Registry key for uninstaller
|
||||||
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
|
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
|
||||||
; GPX file type registry entry
|
; File types registry entries
|
||||||
!define REGGPX "GPXSee.gpx"
|
!define REGGPX "GPXSee.gpx"
|
||||||
|
!define REGTCX "GPXSee.tcx"
|
||||||
|
!define REGKML "GPXSee.kml"
|
||||||
|
!define REGFIT "GPXSee.fit"
|
||||||
|
!define REGIGC "GPXSee.igc"
|
||||||
|
!define REGNMEA "GPXSee.nmea"
|
||||||
|
|
||||||
; Start menu page configuration
|
; Start menu page configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
@ -50,9 +66,15 @@ Var StartMenuFolder
|
|||||||
; Languages
|
; Languages
|
||||||
!insertmacro MUI_LANGUAGE "English"
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
|
Function .onInit
|
||||||
|
${IfNot} ${AtLeastWin7}
|
||||||
|
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
; The stuff to install
|
; The stuff to install
|
||||||
Section "GPXSee (required)" SEC_APP
|
Section "GPXSee" SEC_APP
|
||||||
|
|
||||||
SectionIn RO
|
SectionIn RO
|
||||||
|
|
||||||
@ -62,18 +84,8 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
; Put the files there
|
; Put the files there
|
||||||
File "gpxsee.exe"
|
File "gpxsee.exe"
|
||||||
File "maps.txt"
|
File "maps.txt"
|
||||||
|
File "ellipsoids.csv"
|
||||||
; Write the installation path into the registry
|
File "datums.csv"
|
||||||
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
|
||||||
|
|
||||||
; Write the uninstall keys for Windows
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
|
||||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
||||||
|
|
||||||
; Create start menu entry and add links
|
; Create start menu entry and add links
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
@ -83,30 +95,71 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
; Associate .gpx files
|
; Create the uninstaller
|
||||||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Write the installation path into the registry
|
||||||
|
DetailPrint "Registering application..."
|
||||||
|
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
||||||
|
|
||||||
|
; Write the uninstall keys for Windows
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
|
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||||
|
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||||
|
|
||||||
|
; Associate file formats
|
||||||
|
DetailPrint "Associating file types..."
|
||||||
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
|
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
|
||||||
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
|
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
|
||||||
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
|
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
|
||||||
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".tcx" "" "${REGTCX}"
|
||||||
|
WriteRegStr HKCR "${REGTCX}" "" "Training Center XML"
|
||||||
|
WriteRegStr HKCR "${REGTCX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,2"
|
||||||
|
WriteRegStr HKCR "${REGTCX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".kml" "" "${REGKML}"
|
||||||
|
WriteRegStr HKCR "${REGKML}" "" "Keyhole Markup Language"
|
||||||
|
WriteRegStr HKCR "${REGKML}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,3"
|
||||||
|
WriteRegStr HKCR "${REGKML}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".fit" "" "${REGFIT}"
|
||||||
|
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
||||||
|
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
||||||
|
WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".igc" "" "${REGIGC}"
|
||||||
|
WriteRegStr HKCR "${REGIGC}" "" "Flight Recorder Data Format"
|
||||||
|
WriteRegStr HKCR "${REGIGC}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,5"
|
||||||
|
WriteRegStr HKCR "${REGIGC}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".nmea" "" "${REGNMEA}"
|
||||||
|
WriteRegStr HKCR "${REGNMEA}" "" "NMEA 0183 data"
|
||||||
|
WriteRegStr HKCR "${REGNMEA}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,6"
|
||||||
|
WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
|
||||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "QT libs" SEC_QT
|
Section "QT framework" SEC_QT
|
||||||
|
|
||||||
|
SectionIn RO
|
||||||
|
|
||||||
File "Qt5Core.dll"
|
File "Qt5Core.dll"
|
||||||
File "Qt5Gui.dll"
|
File "Qt5Gui.dll"
|
||||||
File "Qt5Widgets.dll"
|
File "Qt5Widgets.dll"
|
||||||
File "Qt5PrintSupport.dll"
|
File "Qt5PrintSupport.dll"
|
||||||
File "Qt5Network.dll"
|
File "Qt5Network.dll"
|
||||||
File "libGLESv2.dll"
|
|
||||||
File /r "platforms"
|
File /r "platforms"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
|
File /r "printsupport"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "MSVC runtime" SEC_MSVC
|
Section "MSVC runtime" SEC_MSVC
|
||||||
|
|
||||||
|
SectionIn RO
|
||||||
|
|
||||||
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
||||||
${If} ${RunningX64}
|
${If} ${RunningX64}
|
||||||
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
|
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86" "Installed"
|
||||||
@ -120,12 +173,28 @@ Section "MSVC runtime" SEC_MSVC
|
|||||||
|
|
||||||
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
||||||
SetOutPath $TEMP
|
SetOutPath $TEMP
|
||||||
File "VC_redist.x86.exe"
|
File "vcredist_x86.exe"
|
||||||
ExecWait '"$TEMP/VC_redist.x86.exe" /install /quiet /norestart'
|
ExecWait '"$TEMP\vcredist_x86.exe" /install /quiet /norestart'
|
||||||
|
SetOutPath $INSTDIR
|
||||||
|
|
||||||
done:
|
done:
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
Section "OpenSSL" SEC_OPENSSL
|
||||||
|
|
||||||
|
File "libeay32.dll"
|
||||||
|
File "ssleay32.dll"
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "ANGLE" SEC_ANGLE
|
||||||
|
|
||||||
|
File "libGLESv2.dll"
|
||||||
|
File "libEGL.dll"
|
||||||
|
File "D3DCompiler_47.dll"
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
; Uninstaller
|
; Uninstaller
|
||||||
@ -148,6 +217,16 @@ Section "Uninstall"
|
|||||||
; Remove GPX file association
|
; Remove GPX file association
|
||||||
DeleteRegKey HKCR "${REGGPX}"
|
DeleteRegKey HKCR "${REGGPX}"
|
||||||
DeleteRegKey HKCR ".gpx"
|
DeleteRegKey HKCR ".gpx"
|
||||||
|
DeleteRegKey HKCR "${REGTCX}"
|
||||||
|
DeleteRegKey HKCR ".tcx"
|
||||||
|
DeleteRegKey HKCR "${REGKML}"
|
||||||
|
DeleteRegKey HKCR ".kml"
|
||||||
|
DeleteRegKey HKCR "${REGFIT}"
|
||||||
|
DeleteRegKey HKCR ".fit"
|
||||||
|
DeleteRegKey HKCR "${REGIGC}"
|
||||||
|
DeleteRegKey HKCR ".igc"
|
||||||
|
DeleteRegKey HKCR "${REGNMEA}"
|
||||||
|
DeleteRegKey HKCR ".nmea"
|
||||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@ -158,15 +237,21 @@ SectionEnd
|
|||||||
|
|
||||||
;Language strings
|
;Language strings
|
||||||
LangString DESC_QT ${LANG_ENGLISH} \
|
LangString DESC_QT ${LANG_ENGLISH} \
|
||||||
"QT Library. Unselct only if you have QT already installed!"
|
"QT cross-platform application framework."
|
||||||
LangString DESC_MSVC ${LANG_ENGLISH} \
|
LangString DESC_MSVC ${LANG_ENGLISH} \
|
||||||
"Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
|
"Visual C++ 2015 runtime components. If already installed, will be skipped."
|
||||||
|
LangString DESC_OPENSSL ${LANG_ENGLISH} \
|
||||||
|
"OpenSSL library. Required for HTTPS to work."
|
||||||
|
LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||||
|
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||||
LangString DESC_APP ${LANG_ENGLISH} \
|
LangString DESC_APP ${LANG_ENGLISH} \
|
||||||
"GPXSee application"
|
"GPXSee application"
|
||||||
|
|
||||||
;Assign language strings to sections
|
;Assign language strings to sections
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
136
pkg/gpxsee64.nsi
@ -1,13 +1,16 @@
|
|||||||
!include "MUI2.nsh"
|
!include "MUI2.nsh"
|
||||||
!include "x64.nsh"
|
!include "x64.nsh"
|
||||||
|
!include "WinVer.nsh"
|
||||||
|
|
||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "2.14"
|
!define VERSION "4.10"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||||
|
; Compression method
|
||||||
|
SetCompressor /SOLID lzma
|
||||||
|
|
||||||
; Required execution level
|
; Required execution level
|
||||||
RequestExecutionLevel admin
|
RequestExecutionLevel admin
|
||||||
@ -15,14 +18,27 @@ RequestExecutionLevel admin
|
|||||||
; The default installation directory
|
; The default installation directory
|
||||||
InstallDir "$PROGRAMFILES64\GPXSee"
|
InstallDir "$PROGRAMFILES64\GPXSee"
|
||||||
|
|
||||||
|
; Installer executable info
|
||||||
|
VIProductVersion "${VERSION}.0.0"
|
||||||
|
VIAddVersionKey "ProductVersion" ${VERSION}
|
||||||
|
VIAddVersionKey "FileVersion" "${VERSION}.0.0"
|
||||||
|
VIAddVersionKey "ProductName" "GPXSee"
|
||||||
|
VIAddVersionKey "LegalCopyright" "GPXSee project"
|
||||||
|
VIAddVersionKey "FileDescription" "GPXSee installer (x64)"
|
||||||
|
|
||||||
; Registry key to check for directory (so if you install again, it will
|
; Registry key to check for directory (so if you install again, it will
|
||||||
; overwrite the old one automatically)
|
; overwrite the old one automatically)
|
||||||
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir"
|
||||||
|
|
||||||
; Registry key for uninstaller
|
; Registry key for uninstaller
|
||||||
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
|
!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee"
|
||||||
; GPX file type registry entry
|
; File types registry entries
|
||||||
!define REGGPX "GPXSee.gpx"
|
!define REGGPX "GPXSee.gpx"
|
||||||
|
!define REGTCX "GPXSee.tcx"
|
||||||
|
!define REGKML "GPXSee.kml"
|
||||||
|
!define REGFIT "GPXSee.fit"
|
||||||
|
!define REGIGC "GPXSee.igc"
|
||||||
|
!define REGNMEA "GPXSee.nmea"
|
||||||
|
|
||||||
; Start menu page configuration
|
; Start menu page configuration
|
||||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||||
@ -50,7 +66,12 @@ Var StartMenuFolder
|
|||||||
; Languages
|
; Languages
|
||||||
!insertmacro MUI_LANGUAGE "English"
|
!insertmacro MUI_LANGUAGE "English"
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
|
${IfNot} ${AtLeastWin7}
|
||||||
|
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
|
||||||
|
Abort
|
||||||
|
${EndIf}
|
||||||
|
|
||||||
${If} ${RunningX64}
|
${If} ${RunningX64}
|
||||||
SetRegView 64
|
SetRegView 64
|
||||||
${Else}
|
${Else}
|
||||||
@ -60,7 +81,7 @@ Function .onInit
|
|||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
; The stuff to install
|
; The stuff to install
|
||||||
Section "GPXSee (required)" SEC_APP
|
Section "GPXSee" SEC_APP
|
||||||
|
|
||||||
SectionIn RO
|
SectionIn RO
|
||||||
|
|
||||||
@ -70,19 +91,9 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
; Put the files there
|
; Put the files there
|
||||||
File "gpxsee.exe"
|
File "gpxsee.exe"
|
||||||
File "maps.txt"
|
File "maps.txt"
|
||||||
|
File "ellipsoids.csv"
|
||||||
|
File "datums.csv"
|
||||||
|
|
||||||
; Write the installation path into the registry
|
|
||||||
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
|
||||||
|
|
||||||
; Write the uninstall keys for Windows
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee"
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
|
||||||
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
|
||||||
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
|
||||||
WriteUninstaller "$INSTDIR\uninstall.exe"
|
|
||||||
|
|
||||||
; Create start menu entry and add links
|
; Create start menu entry and add links
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
@ -91,30 +102,71 @@ Section "GPXSee (required)" SEC_APP
|
|||||||
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_END
|
!insertmacro MUI_STARTMENU_WRITE_END
|
||||||
|
|
||||||
; Associate .gpx files
|
; Create the uninstaller
|
||||||
|
WriteUninstaller "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
|
; Write the installation path into the registry
|
||||||
|
DetailPrint "Registering application..."
|
||||||
|
WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR"
|
||||||
|
|
||||||
|
; Write the uninstall keys for Windows
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee (x64)"
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma"
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "${VERSION}"
|
||||||
|
WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"'
|
||||||
|
WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1
|
||||||
|
WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1
|
||||||
|
|
||||||
|
; Associate file formats
|
||||||
|
DetailPrint "Associating file types..."
|
||||||
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
|
WriteRegStr HKCR ".gpx" "" "${REGGPX}"
|
||||||
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
|
WriteRegStr HKCR "${REGGPX}" "" "GPS Exchange Format"
|
||||||
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
|
WriteRegStr HKCR "${REGGPX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,1"
|
||||||
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
WriteRegStr HKCR "${REGGPX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".tcx" "" "${REGTCX}"
|
||||||
|
WriteRegStr HKCR "${REGTCX}" "" "Training Center XML"
|
||||||
|
WriteRegStr HKCR "${REGTCX}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,2"
|
||||||
|
WriteRegStr HKCR "${REGTCX}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".kml" "" "${REGKML}"
|
||||||
|
WriteRegStr HKCR "${REGKML}" "" "Keyhole Markup Language"
|
||||||
|
WriteRegStr HKCR "${REGKML}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,3"
|
||||||
|
WriteRegStr HKCR "${REGKML}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".fit" "" "${REGFIT}"
|
||||||
|
WriteRegStr HKCR "${REGFIT}" "" "Flexible and Interoperable Data Transfer"
|
||||||
|
WriteRegStr HKCR "${REGFIT}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,4"
|
||||||
|
WriteRegStr HKCR "${REGFIT}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".igc" "" "${REGIGC}"
|
||||||
|
WriteRegStr HKCR "${REGIGC}" "" "Flight Recorder Data Format"
|
||||||
|
WriteRegStr HKCR "${REGIGC}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,5"
|
||||||
|
WriteRegStr HKCR "${REGIGC}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
WriteRegStr HKCR ".nmea" "" "${REGNMEA}"
|
||||||
|
WriteRegStr HKCR "${REGNMEA}" "" "NMEA 0183 data"
|
||||||
|
WriteRegStr HKCR "${REGNMEA}\DefaultIcon" "" "$INSTDIR\GPXSee.exe,6"
|
||||||
|
WriteRegStr HKCR "${REGNMEA}\shell\open\command" "" "$\"$INSTDIR\GPXSee.exe$\" $\"%1$\""
|
||||||
|
|
||||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "QT libs" SEC_QT
|
Section "QT framework" SEC_QT
|
||||||
|
|
||||||
|
SectionIn RO
|
||||||
|
|
||||||
File "Qt5Core.dll"
|
File "Qt5Core.dll"
|
||||||
File "Qt5Gui.dll"
|
File "Qt5Gui.dll"
|
||||||
File "Qt5Widgets.dll"
|
File "Qt5Widgets.dll"
|
||||||
File "Qt5PrintSupport.dll"
|
File "Qt5PrintSupport.dll"
|
||||||
File "Qt5Network.dll"
|
File "Qt5Network.dll"
|
||||||
File "libGLESv2.dll"
|
|
||||||
File /r "platforms"
|
File /r "platforms"
|
||||||
File /r "imageformats"
|
File /r "imageformats"
|
||||||
|
File /r "printsupport"
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "MSVC runtime" SEC_MSVC
|
Section "MSVC runtime" SEC_MSVC
|
||||||
|
|
||||||
|
SectionIn RO
|
||||||
|
|
||||||
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..."
|
||||||
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
|
ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed"
|
||||||
StrCmp $R0 "1" 0 +3
|
StrCmp $R0 "1" 0 +3
|
||||||
@ -123,12 +175,28 @@ Section "MSVC runtime" SEC_MSVC
|
|||||||
|
|
||||||
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
DetailPrint "Installing Visual C++ 2015 Redistributable..."
|
||||||
SetOutPath $TEMP
|
SetOutPath $TEMP
|
||||||
File "VC_redist.x64.exe"
|
File "vcredist_x64.exe"
|
||||||
ExecWait '"$TEMP/VC_redist.x64.exe" /install /quiet /norestart'
|
ExecWait '"$TEMP\vcredist_x64.exe" /install /quiet /norestart'
|
||||||
|
SetOutPath $INSTDIR
|
||||||
|
|
||||||
done:
|
done:
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
Section "OpenSSL" SEC_OPENSSL
|
||||||
|
|
||||||
|
File "libeay32.dll"
|
||||||
|
File "ssleay32.dll"
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "ANGLE" SEC_ANGLE
|
||||||
|
|
||||||
|
File "libGLESv2.dll"
|
||||||
|
File "libEGL.dll"
|
||||||
|
File "D3DCompiler_47.dll"
|
||||||
|
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|
||||||
; Uninstaller
|
; Uninstaller
|
||||||
@ -149,9 +217,19 @@ Section "Uninstall"
|
|||||||
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
|
Delete "$SMPROGRAMS\$StartMenuFolder\*.*"
|
||||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||||
|
|
||||||
; Remove GPX file association
|
; Remove File associations
|
||||||
DeleteRegKey HKCR "${REGGPX}"
|
DeleteRegKey HKCR "${REGGPX}"
|
||||||
DeleteRegKey HKCR ".gpx"
|
DeleteRegKey HKCR ".gpx"
|
||||||
|
DeleteRegKey HKCR "${REGTCX}"
|
||||||
|
DeleteRegKey HKCR ".tcx"
|
||||||
|
DeleteRegKey HKCR "${REGKML}"
|
||||||
|
DeleteRegKey HKCR ".kml"
|
||||||
|
DeleteRegKey HKCR "${REGFIT}"
|
||||||
|
DeleteRegKey HKCR ".fit"
|
||||||
|
DeleteRegKey HKCR "${REGIGC}"
|
||||||
|
DeleteRegKey HKCR ".igc"
|
||||||
|
DeleteRegKey HKCR "${REGNMEA}"
|
||||||
|
DeleteRegKey HKCR ".nmea"
|
||||||
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
@ -162,15 +240,21 @@ SectionEnd
|
|||||||
|
|
||||||
;Language strings
|
;Language strings
|
||||||
LangString DESC_QT ${LANG_ENGLISH} \
|
LangString DESC_QT ${LANG_ENGLISH} \
|
||||||
"QT Library. Unselct only if you have QT already installed!"
|
"QT cross-platform application framework."
|
||||||
LangString DESC_MSVC ${LANG_ENGLISH} \
|
LangString DESC_MSVC ${LANG_ENGLISH} \
|
||||||
"Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!"
|
"Visual C++ 2015 runtime components. If already installed, will be skipped."
|
||||||
|
LangString DESC_OPENSSL ${LANG_ENGLISH} \
|
||||||
|
"OpenSSL library. Required for HTTPS to work."
|
||||||
|
LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||||
|
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||||
LangString DESC_APP ${LANG_ENGLISH} \
|
LangString DESC_APP ${LANG_ENGLISH} \
|
||||||
"GPXSee application"
|
"GPXSee application"
|
||||||
|
|
||||||
;Assign language strings to sections
|
;Assign language strings to sections
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
|
||||||
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
Thunderforest http://tile.thunderforest.com/outdoors/$z/$x/$y.png
|
Open Topo Map https://a.tile.opentopomap.org/$z/$x/$y.png
|
||||||
Open Street Map http://tile.openstreetmap.org/$z/$x/$y.png
|
Open Street Map http://tile.openstreetmap.org/$z/$x/$y.png
|
||||||
|
USGS Topo https://navigator.er.usgs.gov/tiles/tcr.cgi/$z/$x/$y.png
|
||||||
|
USGS Imagery https://navigator.er.usgs.gov/tiles/aerial_Imagery.cgi/$z/$x/$y
|
||||||
|
229
src/albersequal.cpp
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
/*
|
||||||
|
* Based on libgeotrans with the following Source Code Disclaimer:
|
||||||
|
|
||||||
|
1. The GEOTRANS source code ("the software") is provided free of charge by
|
||||||
|
the National Imagery and Mapping Agency (NIMA) of the United States
|
||||||
|
Department of Defense. Although NIMA makes no copyright claim under Title 17
|
||||||
|
U.S.C., NIMA claims copyrights in the source code under other legal regimes.
|
||||||
|
NIMA hereby grants to each user of the software a license to use and
|
||||||
|
distribute the software, and develop derivative works.
|
||||||
|
|
||||||
|
2. Warranty Disclaimer: The software was developed to meet only the internal
|
||||||
|
requirements of the U.S. National Imagery and Mapping Agency. The software
|
||||||
|
is provided "as is," and no warranty, express or implied, including but not
|
||||||
|
limited to the implied warranties of merchantability and fitness for
|
||||||
|
particular purpose or arising by statute or otherwise in law or from a
|
||||||
|
course of dealing or usage in trade, is made by NIMA as to the accuracy and
|
||||||
|
functioning of the software.
|
||||||
|
|
||||||
|
3. NIMA and its personnel are not required to provide technical support or
|
||||||
|
general assistance with respect to the software.
|
||||||
|
|
||||||
|
4. Neither NIMA nor its personnel will be liable for any claims, losses, or
|
||||||
|
damages arising from or connected with the use of the software. The user
|
||||||
|
agrees to hold harmless the United States National Imagery and Mapping
|
||||||
|
Agency. The user's sole and exclusive remedy is to stop using the software.
|
||||||
|
|
||||||
|
5. NIMA requests that products developed using the software credit the
|
||||||
|
source of the software with the following statement, "The product was
|
||||||
|
developed using GEOTRANS, a product of the National Imagery and Mapping
|
||||||
|
Agency and U.S. Army Engineering Research and Development Center."
|
||||||
|
|
||||||
|
6. For any products developed using the software, NIMA requires a disclaimer
|
||||||
|
that use of the software does not indicate endorsement or approval of the
|
||||||
|
product by the Secretary of Defense or the National Imagery and Mapping
|
||||||
|
Agency. Pursuant to the United States Code, 10 U.S.C. Sec. 2797, the name of
|
||||||
|
the National Imagery and Mapping Agency, the initials "NIMA", the seal of
|
||||||
|
the National Imagery and Mapping Agency, or any colorable imitation thereof
|
||||||
|
shall not be used to imply approval, endorsement, or authorization of a
|
||||||
|
product without prior written permission from United States Secretary of
|
||||||
|
Defense.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ellipsoid.h"
|
||||||
|
#include "rd.h"
|
||||||
|
#include "albersequal.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef M_PI_2
|
||||||
|
#define M_PI_2 1.57079632679489661923
|
||||||
|
#endif // M_PI_2
|
||||||
|
|
||||||
|
#define ONE_MINUS_SQR(x) (1.0 - (x) * (x))
|
||||||
|
#define ALBERS_Q(slat, one_minus_sqr_es_sin, es_sin) \
|
||||||
|
(_one_minus_es2 * ((slat) / (one_minus_sqr_es_sin) - \
|
||||||
|
(1 / (_two_es)) * log((1 - (es_sin)) / (1 + (es_sin)))))
|
||||||
|
#define ALBERS_M(clat, one_minus_sqr_es_sin) \
|
||||||
|
((clat) / sqrt(one_minus_sqr_es_sin))
|
||||||
|
|
||||||
|
|
||||||
|
AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||||
|
double standardParallel2, double latitudeOrigin, double longitudeOrigin,
|
||||||
|
double falseEasting, double falseNorthing)
|
||||||
|
{
|
||||||
|
double sin_lat, sin_lat1, sin_lat2, cos_lat1, cos_lat2;
|
||||||
|
double m1, m2, sqr_m1, sqr_m2;
|
||||||
|
double q0, q1, q2;
|
||||||
|
double es_sin, es_sin1, es_sin2;
|
||||||
|
double one_minus_sqr_es_sin1, one_minus_sqr_es_sin2;
|
||||||
|
double nq0;
|
||||||
|
double sp1, sp2;
|
||||||
|
|
||||||
|
|
||||||
|
_e = ellipsoid;
|
||||||
|
_latitudeOrigin = deg2rad(latitudeOrigin);
|
||||||
|
_longitudeOrigin = deg2rad(longitudeOrigin);
|
||||||
|
_falseEasting = falseEasting;
|
||||||
|
_falseNorthing = falseNorthing;
|
||||||
|
|
||||||
|
sp1 = deg2rad(standardParallel1);
|
||||||
|
sp2 = deg2rad(standardParallel2);
|
||||||
|
|
||||||
|
_es2 = 2 * _e.flattening() - _e.flattening() * _e.flattening();
|
||||||
|
_es = sqrt(_es2);
|
||||||
|
_one_minus_es2 = 1 - _es2;
|
||||||
|
_two_es = 2 * _es;
|
||||||
|
|
||||||
|
sin_lat = sin(_latitudeOrigin);
|
||||||
|
es_sin = _es * sin_lat;
|
||||||
|
q0 = ALBERS_Q(sin_lat, ONE_MINUS_SQR(es_sin), es_sin);
|
||||||
|
|
||||||
|
sin_lat1 = sin(sp1);
|
||||||
|
cos_lat1 = cos(sp1);
|
||||||
|
es_sin1 = _es * sin_lat1;
|
||||||
|
one_minus_sqr_es_sin1 = ONE_MINUS_SQR(es_sin1);
|
||||||
|
m1 = ALBERS_M(cos_lat1, one_minus_sqr_es_sin1);
|
||||||
|
q1 = ALBERS_Q(sin_lat1, one_minus_sqr_es_sin1, es_sin1);
|
||||||
|
|
||||||
|
sqr_m1 = m1 * m1;
|
||||||
|
if (fabs(sp1 - sp2) > 1.0e-10) {
|
||||||
|
sin_lat2 = sin(sp2);
|
||||||
|
cos_lat2 = cos(sp2);
|
||||||
|
es_sin2 = _es * sin_lat2;
|
||||||
|
one_minus_sqr_es_sin2 = ONE_MINUS_SQR(es_sin2);
|
||||||
|
m2 = ALBERS_M(cos_lat2, one_minus_sqr_es_sin2);
|
||||||
|
q2 = ALBERS_Q(sin_lat2, one_minus_sqr_es_sin2, es_sin2);
|
||||||
|
sqr_m2 = m2 * m2;
|
||||||
|
_n = (sqr_m1 - sqr_m2) / (q2 - q1);
|
||||||
|
} else
|
||||||
|
_n = sin_lat1;
|
||||||
|
|
||||||
|
_C = sqr_m1 + _n * q1;
|
||||||
|
_a_over_n = _e.radius() / _n;
|
||||||
|
nq0 = _n * q0;
|
||||||
|
_rho0 = (_C < nq0) ? 0 : _a_over_n * sqrt(_C - nq0);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF AlbersEqual::ll2xy(const Coordinates &c) const
|
||||||
|
{
|
||||||
|
double dlam;
|
||||||
|
double sin_lat;
|
||||||
|
double es_sin;
|
||||||
|
double q;
|
||||||
|
double rho;
|
||||||
|
double theta;
|
||||||
|
double nq;
|
||||||
|
|
||||||
|
|
||||||
|
dlam = deg2rad(c.lon()) - _longitudeOrigin;
|
||||||
|
if (dlam > M_PI)
|
||||||
|
dlam -= 2.0 * M_PI;
|
||||||
|
if (dlam < -M_PI)
|
||||||
|
dlam += 2.0 * M_PI;
|
||||||
|
|
||||||
|
sin_lat = sin(deg2rad(c.lat()));
|
||||||
|
es_sin = _es * sin_lat;
|
||||||
|
q = ALBERS_Q(sin_lat, ONE_MINUS_SQR(es_sin), es_sin);
|
||||||
|
nq = _n * q;
|
||||||
|
rho = (_C < nq) ? 0 : _a_over_n * sqrt(_C - nq);
|
||||||
|
theta = _n * dlam;
|
||||||
|
|
||||||
|
return QPointF(rho * sin(theta) + _falseEasting,
|
||||||
|
_rho0 - rho * cos(theta) + _falseNorthing);
|
||||||
|
}
|
||||||
|
|
||||||
|
Coordinates AlbersEqual::xy2ll(const QPointF &p) const
|
||||||
|
{
|
||||||
|
double dy, dx;
|
||||||
|
double rho0_minus_dy;
|
||||||
|
double q, qc, q_over_2;
|
||||||
|
double rho, rho_n;
|
||||||
|
double phi, delta_phi = 1.0;
|
||||||
|
double sin_phi;
|
||||||
|
double es_sin, one_minus_sqr_es_sin;
|
||||||
|
double theta = 0.0;
|
||||||
|
int count = 30;
|
||||||
|
double tolerance = 4.85e-10;
|
||||||
|
double lat, lon;
|
||||||
|
|
||||||
|
|
||||||
|
dy = p.y() - _falseNorthing;
|
||||||
|
dx = p.x() - _falseEasting;
|
||||||
|
|
||||||
|
rho0_minus_dy = _rho0 - dy;
|
||||||
|
rho = sqrt(dx * dx + rho0_minus_dy * rho0_minus_dy);
|
||||||
|
|
||||||
|
if (_n < 0) {
|
||||||
|
rho *= -1.0;
|
||||||
|
dx *= -1.0;
|
||||||
|
rho0_minus_dy *= -1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rho != 0.0)
|
||||||
|
theta = atan2(dx, rho0_minus_dy);
|
||||||
|
rho_n = rho * _n;
|
||||||
|
q = (_C - (rho_n * rho_n) / (_e.radius() * _e.radius())) / _n;
|
||||||
|
qc = 1 - ((_one_minus_es2) / (_two_es)) * log((1.0 - _es) / (1.0 + _es));
|
||||||
|
if (fabs(fabs(qc) - fabs(q)) > 1.0e-6) {
|
||||||
|
q_over_2 = q / 2.0;
|
||||||
|
if (q_over_2 > 1.0)
|
||||||
|
lat = M_PI_2;
|
||||||
|
else if (q_over_2 < -1.0)
|
||||||
|
lat = -M_PI_2;
|
||||||
|
else {
|
||||||
|
phi = asin(q_over_2);
|
||||||
|
if (_es < 1.0e-10)
|
||||||
|
lat = phi;
|
||||||
|
else {
|
||||||
|
while ((fabs(delta_phi) > tolerance) && count) {
|
||||||
|
sin_phi = sin(phi);
|
||||||
|
es_sin = _es * sin_phi;
|
||||||
|
one_minus_sqr_es_sin = ONE_MINUS_SQR(es_sin);
|
||||||
|
delta_phi = (one_minus_sqr_es_sin * one_minus_sqr_es_sin)
|
||||||
|
/ (2.0 * cos(phi)) * (q / (_one_minus_es2) - sin_phi
|
||||||
|
/ one_minus_sqr_es_sin + (log((1.0 - es_sin)
|
||||||
|
/ (1.0 + es_sin)) / (_two_es)));
|
||||||
|
phi += delta_phi;
|
||||||
|
count --;
|
||||||
|
}
|
||||||
|
|
||||||
|
lat = phi;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lat > M_PI_2)
|
||||||
|
lat = M_PI_2;
|
||||||
|
else if (lat < -M_PI_2)
|
||||||
|
lat = -M_PI_2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (q >= 0.0)
|
||||||
|
lat = M_PI_2;
|
||||||
|
else
|
||||||
|
lat = -M_PI_2;
|
||||||
|
}
|
||||||
|
|
||||||
|
lon = _longitudeOrigin + theta / _n;
|
||||||
|
|
||||||
|
if (lon > M_PI)
|
||||||
|
lon -= M_PI * 2;
|
||||||
|
if (lon < -M_PI)
|
||||||
|
lon += M_PI * 2;
|
||||||
|
|
||||||
|
if (lon > M_PI)
|
||||||
|
lon = M_PI;
|
||||||
|
else if (lon < -M_PI)
|
||||||
|
lon = -M_PI;
|
||||||
|
|
||||||
|
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||||
|
}
|
36
src/albersequal.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef ALBERSEQUAL_H
|
||||||
|
#define ALBERSEQUAL_H
|
||||||
|
|
||||||
|
#include "projection.h"
|
||||||
|
|
||||||
|
class Ellipsoid;
|
||||||
|
|
||||||
|
class AlbersEqual : public Projection
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||||
|
double standardParallel2, double latitudeOrigin, double longitudeOrigin,
|
||||||
|
double falseEasting, double falseNorthing);
|
||||||
|
|
||||||
|
virtual QPointF ll2xy(const Coordinates &c) const;
|
||||||
|
virtual Coordinates xy2ll(const QPointF &p) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ellipsoid _e;
|
||||||
|
|
||||||
|
double _latitudeOrigin;
|
||||||
|
double _longitudeOrigin;
|
||||||
|
double _falseEasting;
|
||||||
|
double _falseNorthing;
|
||||||
|
|
||||||
|
double _rho0;
|
||||||
|
double _C;
|
||||||
|
double _n;
|
||||||
|
double _es;
|
||||||
|
double _es2;
|
||||||
|
double _a_over_n;
|
||||||
|
double _one_minus_es2;
|
||||||
|
double _two_es;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ALBERSEQUAL_H
|
23
src/app.cpp
@ -2,29 +2,42 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QFileOpenEvent>
|
#include <QFileOpenEvent>
|
||||||
|
#include <QNetworkProxyFactory>
|
||||||
|
#include <QLibraryInfo>
|
||||||
|
#include "opengl.h"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
#include "onlinemap.h"
|
||||||
|
#include "downloader.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)
|
||||||
{
|
{
|
||||||
_translator = new QTranslator();
|
QTranslator *gpxsee = new QTranslator(this);
|
||||||
|
|
||||||
QString locale = QLocale::system().name();
|
QString locale = QLocale::system().name();
|
||||||
_translator->load(QString(":/lang/gpxsee_") + locale);
|
gpxsee->load(QString(":/lang/gpxsee_") + locale);
|
||||||
installTranslator(_translator);
|
installTranslator(gpxsee);
|
||||||
|
|
||||||
|
QTranslator *qt = new QTranslator(this);
|
||||||
|
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
|
||||||
|
QLibraryInfo::TranslationsPath));
|
||||||
|
installTranslator(qt);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
setAttribute(Qt::AA_DontShowIconsInMenus);
|
setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
|
OnlineMap::setDownloader(new Downloader(this));
|
||||||
|
OPENGL_SET_SAMPLES(4);
|
||||||
|
|
||||||
_gui = new GUI();
|
_gui = new GUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
App::~App()
|
App::~App()
|
||||||
{
|
{
|
||||||
delete _gui;
|
delete _gui;
|
||||||
delete _translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void App::run()
|
void App::run()
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
class GUI;
|
class GUI;
|
||||||
class QTranslator;
|
|
||||||
|
|
||||||
class App : QApplication
|
class App : QApplication
|
||||||
{
|
{
|
||||||
@ -22,7 +21,6 @@ private:
|
|||||||
int &_argc;
|
int &_argc;
|
||||||
char **_argv;
|
char **_argv;
|
||||||
GUI *_gui;
|
GUI *_gui;
|
||||||
QTranslator *_translator;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APP_H
|
#endif // APP_H
|
||||||
|
11
src/assert.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef ASSERT_H
|
||||||
|
#define ASSERT_H
|
||||||
|
|
||||||
|
template<bool> struct CompileTimeAssert;
|
||||||
|
template<> struct CompileTimeAssert <true> {};
|
||||||
|
|
||||||
|
#define STATIC_ASSERT(e) \
|
||||||
|
(CompileTimeAssert <(e) != 0>())
|
||||||
|
|
||||||
|
#endif // ASSERT_H
|
||||||
|
|
339
src/atlas.cpp
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
#include <QDir>
|
||||||
|
#include <QtAlgorithms>
|
||||||
|
#include <QPainter>
|
||||||
|
#include "rectc.h"
|
||||||
|
#include "tar.h"
|
||||||
|
#include "atlas.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define ZOOM_THRESHOLD 0.9
|
||||||
|
|
||||||
|
#define TL(m) ((m)->xy2pp((m)->bounds().topLeft()))
|
||||||
|
#define BR(m) ((m)->xy2pp((m)->bounds().bottomRight()))
|
||||||
|
|
||||||
|
static bool resCmp(const OfflineMap *m1, const OfflineMap *m2)
|
||||||
|
{
|
||||||
|
qreal r1, r2;
|
||||||
|
|
||||||
|
r1 = m1->resolution(m1->bounds().center());
|
||||||
|
r2 = m2->resolution(m2->bounds().center());
|
||||||
|
|
||||||
|
return r1 > r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool xCmp(const OfflineMap *m1, const OfflineMap *m2)
|
||||||
|
{
|
||||||
|
return TL(m1).x() < TL(m2).x();
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool yCmp(const OfflineMap *m1, const OfflineMap *m2)
|
||||||
|
{
|
||||||
|
return TL(m1).y() > TL(m2).y();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Atlas::isAtlas(Tar &tar, const QString &path)
|
||||||
|
{
|
||||||
|
QFileInfo fi(path);
|
||||||
|
QByteArray ba;
|
||||||
|
QString suffix = fi.suffix().toLower();
|
||||||
|
|
||||||
|
if (suffix == "tar") {
|
||||||
|
if (!tar.load(path)) {
|
||||||
|
_errorString = "Error reading tar file";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QString tbaFileName = fi.completeBaseName() + ".tba";
|
||||||
|
ba = tar.file(tbaFileName);
|
||||||
|
} else if (suffix == "tba") {
|
||||||
|
QFile tbaFile(path);
|
||||||
|
if (!tbaFile.open(QIODevice::ReadOnly)) {
|
||||||
|
_errorString = QString("Error opening tba file: %1")
|
||||||
|
.arg(tbaFile.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ba = tbaFile.readAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ba.startsWith("Atlas 1.0"))
|
||||||
|
return true;
|
||||||
|
else {
|
||||||
|
_errorString = "Missing or invalid tba file";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Atlas::computeZooms()
|
||||||
|
{
|
||||||
|
qSort(_maps.begin(), _maps.end(), resCmp);
|
||||||
|
|
||||||
|
_zooms.append(QPair<int, int>(0, _maps.count() - 1));
|
||||||
|
for (int i = 1; i < _maps.count(); i++) {
|
||||||
|
qreal last = _maps.at(i-1)->resolution(_maps.at(i)->bounds().center());
|
||||||
|
qreal cur = _maps.at(i)->resolution(_maps.at(i)->bounds().center());
|
||||||
|
if (cur < last * ZOOM_THRESHOLD) {
|
||||||
|
_zooms.last().second = i-1;
|
||||||
|
_zooms.append(QPair<int, int>(i, _maps.count() - 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Atlas::computeBounds()
|
||||||
|
{
|
||||||
|
QList<QPointF> offsets;
|
||||||
|
|
||||||
|
for (int i = 0; i < _maps.count(); i++)
|
||||||
|
offsets.append(QPointF());
|
||||||
|
|
||||||
|
for (int z = 0; z < _zooms.count(); z++) {
|
||||||
|
QList<OfflineMap*> m;
|
||||||
|
for (int i = _zooms.at(z).first; i <= _zooms.at(z).second; i++)
|
||||||
|
m.append(_maps.at(i));
|
||||||
|
|
||||||
|
qSort(m.begin(), m.end(), xCmp);
|
||||||
|
offsets[_maps.indexOf(m.first())].setX(0);
|
||||||
|
for (int i = 1; i < m.size(); i++) {
|
||||||
|
qreal w = round(m.first()->pp2xy(TL(m.at(i))).x());
|
||||||
|
offsets[_maps.indexOf(m.at(i))].setX(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
qSort(m.begin(), m.end(), yCmp);
|
||||||
|
offsets[_maps.indexOf(m.first())].setY(0);
|
||||||
|
for (int i = 1; i < m.size(); i++) {
|
||||||
|
qreal h = round(m.first()->pp2xy(TL(m.at(i))).y());
|
||||||
|
offsets[_maps.indexOf(m.at(i))].setY(h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < _maps.count(); i++)
|
||||||
|
_bounds.append(QPair<QRectF, QRectF>(QRectF(TL(_maps.at(i)),
|
||||||
|
BR(_maps.at(i))), QRectF(offsets.at(i), _maps.at(i)->bounds().size())));
|
||||||
|
}
|
||||||
|
|
||||||
|
Atlas::Atlas(const QString &fileName, QObject *parent) : Map(parent)
|
||||||
|
{
|
||||||
|
Tar tar;
|
||||||
|
QFileInfo fi(fileName);
|
||||||
|
|
||||||
|
_valid = false;
|
||||||
|
_zoom = 0;
|
||||||
|
_name = fi.dir().dirName();
|
||||||
|
_ci = -1; _cz = -1;
|
||||||
|
|
||||||
|
if (!isAtlas(tar, fileName))
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDir dir(fi.absolutePath());
|
||||||
|
QFileInfoList layers = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
|
for (int n = 0; n < layers.count(); n++) {
|
||||||
|
QDir zdir(layers.at(n).absoluteFilePath());
|
||||||
|
QFileInfoList maps = zdir.entryInfoList(QDir::Dirs
|
||||||
|
| QDir::NoDotAndDotDot);
|
||||||
|
for (int i = 0; i < maps.count(); i++) {
|
||||||
|
QString mapFile = maps.at(i).absoluteFilePath() + "/"
|
||||||
|
+ maps.at(i).fileName() + ".map";
|
||||||
|
|
||||||
|
OfflineMap *map;
|
||||||
|
if (tar.isOpen())
|
||||||
|
map = new OfflineMap(mapFile, tar, this);
|
||||||
|
else
|
||||||
|
map = new OfflineMap(mapFile, this);
|
||||||
|
|
||||||
|
if (map->isValid())
|
||||||
|
_maps.append(map);
|
||||||
|
else {
|
||||||
|
_errorString = QString("Error loading map: %1: %2")
|
||||||
|
.arg(mapFile, map->errorString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (_maps.isEmpty()) {
|
||||||
|
_errorString = "No maps found in atlas";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
computeZooms();
|
||||||
|
computeBounds();
|
||||||
|
|
||||||
|
_valid = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Atlas::~Atlas()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _maps.size(); i++)
|
||||||
|
delete _maps.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF Atlas::bounds() const
|
||||||
|
{
|
||||||
|
QSizeF s(0, 0);
|
||||||
|
|
||||||
|
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||||
|
if (_bounds.at(i).second.right() > s.width())
|
||||||
|
s.setWidth(_bounds.at(i).second.right());
|
||||||
|
if (_bounds.at(i).second.bottom() > s.height())
|
||||||
|
s.setHeight(_bounds.at(i).second.bottom());
|
||||||
|
}
|
||||||
|
|
||||||
|
return QRectF(QPointF(0, 0), s);
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal Atlas::resolution(const QPointF &p) const
|
||||||
|
{
|
||||||
|
int idx = _zooms.at(_zoom).first;
|
||||||
|
|
||||||
|
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||||
|
if (_bounds.at(i).second.contains(_maps.at(i)->xy2pp(p))) {
|
||||||
|
idx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _maps.at(idx)->resolution(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal Atlas::zoom() const
|
||||||
|
{
|
||||||
|
return _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal Atlas::zoomFit(const QSize &size, const RectC &br)
|
||||||
|
{
|
||||||
|
_zoom = 0;
|
||||||
|
|
||||||
|
if (!br.isValid()) {
|
||||||
|
_zoom = _zooms.size() - 1;
|
||||||
|
return _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int z = 0; z < _zooms.count(); z++) {
|
||||||
|
for (int i = _zooms.at(z).first; i <= _zooms.at(z).second; i++) {
|
||||||
|
if (!_bounds.at(i).first.contains(_maps.at(i)->ll2pp(br.center())))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QRect sbr = QRectF(_maps.at(i)->ll2xy(br.topLeft()),
|
||||||
|
_maps.at(i)->ll2xy(br.bottomRight())).toRect().normalized();
|
||||||
|
|
||||||
|
if (sbr.size().width() > size.width()
|
||||||
|
|| sbr.size().height() > size.height())
|
||||||
|
return _zoom;
|
||||||
|
|
||||||
|
_zoom = z;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal Atlas::zoomFit(qreal resolution, const Coordinates &c)
|
||||||
|
{
|
||||||
|
_zoom = 0;
|
||||||
|
|
||||||
|
for (int z = 0; z < _zooms.count(); z++) {
|
||||||
|
for (int i = _zooms.at(z).first; i <= _zooms.at(z).second; i++) {
|
||||||
|
if (!_bounds.at(i).first.contains(_maps.at(i)->ll2pp(c)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (_maps.at(i)->resolution(_maps.at(i)->ll2xy(c)) < resolution)
|
||||||
|
return _zoom;
|
||||||
|
|
||||||
|
_zoom = z;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal Atlas::zoomIn()
|
||||||
|
{
|
||||||
|
_zoom = qMin(_zoom + 1, _zooms.size() - 1);
|
||||||
|
return _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal Atlas::zoomOut()
|
||||||
|
{
|
||||||
|
_zoom = qMax(_zoom - 1, 0);
|
||||||
|
return _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF Atlas::ll2xy(const Coordinates &c)
|
||||||
|
{
|
||||||
|
QPointF pp;
|
||||||
|
|
||||||
|
if (_cz != _zoom) {
|
||||||
|
_ci = -1;
|
||||||
|
_cz = _zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_ci >= 0)
|
||||||
|
pp = _maps.at(_ci)->ll2pp(c);
|
||||||
|
if (_ci < 0 || !_bounds.at(_ci).first.contains(pp)) {
|
||||||
|
_ci = _zooms.at(_zoom).first;
|
||||||
|
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||||
|
pp = _maps.at(i)->ll2pp(c);
|
||||||
|
if (_bounds.at(i).first.contains(pp)) {
|
||||||
|
_ci = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF p = _maps.at(_ci)->pp2xy(pp);
|
||||||
|
return p + _bounds.at(_ci).second.topLeft();
|
||||||
|
}
|
||||||
|
|
||||||
|
Coordinates Atlas::xy2ll(const QPointF &p)
|
||||||
|
{
|
||||||
|
int idx = _zooms.at(_zoom).first;
|
||||||
|
|
||||||
|
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||||
|
if (_bounds.at(i).second.contains(_maps.at(i)->xy2pp(p))) {
|
||||||
|
idx = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF p2 = p - _bounds.at(idx).second.topLeft();
|
||||||
|
return _maps.at(idx)->xy2ll(p2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Atlas::draw(QPainter *painter, const QRectF &rect)
|
||||||
|
{
|
||||||
|
// All in one map
|
||||||
|
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||||
|
QRectF ir = rect.intersected(_bounds.at(i).second);
|
||||||
|
if (ir == rect) {
|
||||||
|
draw(painter, rect, i);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Multiple maps
|
||||||
|
painter->fillRect(rect, Qt::white);
|
||||||
|
for (int i = _zooms.at(_zoom).first; i <= _zooms.at(_zoom).second; i++) {
|
||||||
|
QRectF ir = rect.intersected(_bounds.at(i).second);
|
||||||
|
if (!ir.isNull())
|
||||||
|
draw(painter, ir, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Atlas::draw(QPainter *painter, const QRectF &rect, int mapIndex)
|
||||||
|
{
|
||||||
|
OfflineMap *map = _maps.at(mapIndex);
|
||||||
|
const QPointF offset = _bounds.at(mapIndex).second.topLeft();
|
||||||
|
QRectF pr = QRectF(rect.topLeft() - offset, rect.size());
|
||||||
|
|
||||||
|
map->load();
|
||||||
|
|
||||||
|
painter->translate(offset);
|
||||||
|
map->draw(painter, pr);
|
||||||
|
painter->translate(-offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Atlas::unload()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _maps.count(); i++)
|
||||||
|
_maps.at(i)->unload();
|
||||||
|
}
|
56
src/atlas.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#ifndef ATLAS_H
|
||||||
|
#define ATLAS_H
|
||||||
|
|
||||||
|
#include <QFileInfoList>
|
||||||
|
#include "map.h"
|
||||||
|
#include "offlinemap.h"
|
||||||
|
|
||||||
|
|
||||||
|
class Atlas : public Map
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Atlas(const QString &fileName, QObject *parent = 0);
|
||||||
|
~Atlas();
|
||||||
|
|
||||||
|
const QString &name() const {return _name;}
|
||||||
|
|
||||||
|
QRectF bounds() const;
|
||||||
|
qreal resolution(const QPointF &p) const;
|
||||||
|
|
||||||
|
qreal zoom() const;
|
||||||
|
qreal zoomFit(const QSize &size, const RectC &br);
|
||||||
|
qreal zoomFit(qreal resolution, const Coordinates &c);
|
||||||
|
qreal zoomIn();
|
||||||
|
qreal zoomOut();
|
||||||
|
|
||||||
|
QPointF ll2xy(const Coordinates &c);
|
||||||
|
Coordinates xy2ll(const QPointF &p);
|
||||||
|
|
||||||
|
void draw(QPainter *painter, const QRectF &rect);
|
||||||
|
|
||||||
|
void unload();
|
||||||
|
|
||||||
|
bool isValid() const {return _valid;}
|
||||||
|
const QString &errorString() const {return _errorString;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void draw(QPainter *painter, const QRectF &rect, int mapIndex);
|
||||||
|
bool isAtlas(Tar &tar, const QString &path);
|
||||||
|
void computeZooms();
|
||||||
|
void computeBounds();
|
||||||
|
|
||||||
|
QString _name;
|
||||||
|
bool _valid;
|
||||||
|
QString _errorString;
|
||||||
|
|
||||||
|
QList<OfflineMap*> _maps;
|
||||||
|
QVector<QPair<int, int> > _zooms;
|
||||||
|
QVector<QPair<QRectF, QRectF> > _bounds;
|
||||||
|
int _zoom;
|
||||||
|
|
||||||
|
int _ci, _cz;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ATLAS_H
|
@ -1,10 +1,11 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "nicenum.h"
|
#include "misc.h"
|
||||||
#include "axisitem.h"
|
#include "axisitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define AXIS_WIDTH 1
|
||||||
#define TICK 6
|
#define TICK 6
|
||||||
#define PADDING 6
|
#define PADDING 6
|
||||||
#define XTICKS 15
|
#define XTICKS 15
|
||||||
@ -34,6 +35,10 @@ AxisItem::AxisItem(Type type, QGraphicsItem *parent) : QGraphicsItem(parent)
|
|||||||
{
|
{
|
||||||
_type = type;
|
_type = type;
|
||||||
_size = 0;
|
_size = 0;
|
||||||
|
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxisItem::setRange(const RangeF &range)
|
void AxisItem::setRange(const RangeF &range)
|
||||||
@ -41,6 +46,7 @@ void AxisItem::setRange(const RangeF &range)
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_range = range;
|
_range = range;
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxisItem::setSize(qreal size)
|
void AxisItem::setSize(qreal size)
|
||||||
@ -48,6 +54,7 @@ void AxisItem::setSize(qreal size)
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_size = size;
|
_size = size;
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxisItem::setLabel(const QString& label)
|
void AxisItem::setLabel(const QString& label)
|
||||||
@ -55,6 +62,7 @@ void AxisItem::setLabel(const QString& label)
|
|||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_label = label;
|
_label = label;
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AxisItem::updateBoundingRect()
|
void AxisItem::updateBoundingRect()
|
||||||
@ -75,7 +83,7 @@ void AxisItem::updateBoundingRect()
|
|||||||
if (_type == X) {
|
if (_type == X) {
|
||||||
_boundingRect = QRectF(-ss.width()/2, -TICK/2,
|
_boundingRect = QRectF(-ss.width()/2, -TICK/2,
|
||||||
_size + es.width()/2 + ss.width()/2,
|
_size + es.width()/2 + ss.width()/2,
|
||||||
ls.height() + es.height() - fm.descent() + TICK + 2*PADDING);
|
ls.height() + es.height() - fm.descent() + TICK + 2*PADDING + 1);
|
||||||
} else {
|
} else {
|
||||||
int mtw = 0;
|
int mtw = 0;
|
||||||
QRect ts;
|
QRect ts;
|
||||||
@ -88,9 +96,8 @@ void AxisItem::updateBoundingRect()
|
|||||||
mtw = qMax(ts.width(), mtw);
|
mtw = qMax(ts.width(), mtw);
|
||||||
}
|
}
|
||||||
|
|
||||||
_boundingRect = QRectF(-(ls.height() + mtw + 2*PADDING
|
_boundingRect = QRectF(-(ls.height() + mtw + 2*PADDING + TICK/2),
|
||||||
- fm.descent() + TICK/2), -(_size + es.height()/2
|
-(_size + es.height()/2 + fm.descent()), ls.height() + mtw + 2*PADDING
|
||||||
+ fm.descent()), ls.height() -fm.descent() + mtw + 2*PADDING
|
|
||||||
+ TICK, _size + es.height()/2 + fm.descent() + ss.height()/2);
|
+ TICK, _size + es.height()/2 + fm.descent() + ss.height()/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,9 +115,12 @@ void AxisItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
struct Label l;
|
struct Label l;
|
||||||
qreal range = _range.size();
|
qreal range = _range.size();
|
||||||
qreal val;
|
qreal val;
|
||||||
|
QPen pen = QPen(Qt::black, AXIS_WIDTH);
|
||||||
|
|
||||||
|
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
|
painter->setPen(pen);
|
||||||
|
|
||||||
ls = fm.tightBoundingRect(_label);
|
ls = fm.tightBoundingRect(_label);
|
||||||
|
|
||||||
@ -193,3 +203,16 @@ QSizeF AxisItem::margin() const
|
|||||||
+ TICK/2, es.height()/2 + fm.descent());
|
+ TICK/2, es.height()/2 + fm.descent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<qreal> AxisItem::ticks() const
|
||||||
|
{
|
||||||
|
struct Label l;
|
||||||
|
QList<qreal> list;
|
||||||
|
|
||||||
|
l = label(_range.min(), _range.max(), (_type == X) ? XTICKS : YTICKS);
|
||||||
|
for (int i = 0; i < ((l.max - l.min) / l.d) + 1; i++)
|
||||||
|
list.append(((_size/_range.size()) * ((l.min + i * l.d)
|
||||||
|
- _range.min())));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
@ -20,6 +20,7 @@ public:
|
|||||||
void setLabel(const QString& label);
|
void setLabel(const QString& label);
|
||||||
|
|
||||||
QSizeF margin() const;
|
QSizeF margin() const;
|
||||||
|
QList<qreal> ticks() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateBoundingRect();
|
void updateBoundingRect();
|
||||||
|
84
src/cadencegraph.cpp
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#include "data.h"
|
||||||
|
#include "cadencegraph.h"
|
||||||
|
|
||||||
|
|
||||||
|
CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
|
||||||
|
{
|
||||||
|
_units = Metric;
|
||||||
|
_showTracks = true;
|
||||||
|
|
||||||
|
GraphView::setYUnits(tr("1/min"));
|
||||||
|
setYLabel(tr("Cadence"));
|
||||||
|
|
||||||
|
setSliderPrecision(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CadenceGraph::setInfo()
|
||||||
|
{
|
||||||
|
if (_showTracks) {
|
||||||
|
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale()
|
||||||
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
|
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale()
|
||||||
|
+ yOffset(), 'f', 1) + UNIT_SPACE + yUnits());
|
||||||
|
} else
|
||||||
|
clearInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CadenceGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
|
const Graph &graph = data.tracks().at(i)->cadence();
|
||||||
|
qreal sum = 0, w = 0;
|
||||||
|
|
||||||
|
if (graph.size() < 2) {
|
||||||
|
skipColor();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int j = 1; j < graph.size(); j++) {
|
||||||
|
qreal ds = graph.at(j).s() - graph.at(j-1).s();
|
||||||
|
sum += graph.at(j).y() * ds;
|
||||||
|
w += ds;
|
||||||
|
}
|
||||||
|
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||||
|
|
||||||
|
GraphView::loadGraph(graph, paths.at(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
|
skipColor();
|
||||||
|
|
||||||
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal CadenceGraph::avg() const
|
||||||
|
{
|
||||||
|
qreal sum = 0, w = 0;
|
||||||
|
QList<QPointF>::const_iterator it;
|
||||||
|
|
||||||
|
for (it = _avg.begin(); it != _avg.end(); it++) {
|
||||||
|
sum += it->y() * it->x();
|
||||||
|
w += it->x();
|
||||||
|
}
|
||||||
|
|
||||||
|
return (sum / w);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CadenceGraph::clear()
|
||||||
|
{
|
||||||
|
_avg.clear();
|
||||||
|
|
||||||
|
GraphView::clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CadenceGraph::showTracks(bool show)
|
||||||
|
{
|
||||||
|
_showTracks = show;
|
||||||
|
|
||||||
|
showGraph(show);
|
||||||
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
31
src/cadencegraph.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef CADENCEGRAPH_H
|
||||||
|
#define CADENCEGRAPH_H
|
||||||
|
|
||||||
|
#include "graphtab.h"
|
||||||
|
|
||||||
|
class CadenceGraph : public GraphTab
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CadenceGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
|
QString label() const {return tr("Cadence");}
|
||||||
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
|
void clear();
|
||||||
|
void setUnits(enum Units) {}
|
||||||
|
void showTracks(bool show);
|
||||||
|
void showRoutes(bool show) {Q_UNUSED(show);}
|
||||||
|
|
||||||
|
private:
|
||||||
|
qreal avg() const;
|
||||||
|
qreal max() const {return bounds().bottom();}
|
||||||
|
void setInfo();
|
||||||
|
|
||||||
|
QList<QPointF> _avg;
|
||||||
|
|
||||||
|
enum Units _units;
|
||||||
|
bool _showTracks;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CADENCEGRAPH_H
|
68
src/colorbox.cpp
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
#include <QStylePainter>
|
||||||
|
#include <QStyleOptionComboBox>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QColorDialog>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include "colorbox.h"
|
||||||
|
|
||||||
|
|
||||||
|
ColorBox::ColorBox(QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
_color = Qt::red;
|
||||||
|
setSizePolicy(QSizePolicy::QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize ColorBox::sizeHint() const
|
||||||
|
{
|
||||||
|
static QSize size;
|
||||||
|
if (size.isValid())
|
||||||
|
return size;
|
||||||
|
|
||||||
|
QComboBox cb;
|
||||||
|
size = cb.sizeHint();
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColorBox::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
Q_UNUSED(event);
|
||||||
|
|
||||||
|
QStylePainter painter(this);
|
||||||
|
|
||||||
|
QStyleOptionComboBox option;
|
||||||
|
option.initFrom(this);
|
||||||
|
|
||||||
|
#if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
|
||||||
|
painter.setBrush(_color);
|
||||||
|
painter.drawPrimitive(QStyle::PE_Frame, option);
|
||||||
|
#else // Q_OS_MAC || Q_OS_WIN32
|
||||||
|
// Fallback for some broken QT4 styles that do not draw the background
|
||||||
|
painter.setBrush(_color);
|
||||||
|
painter.setPen(Qt::NoPen);
|
||||||
|
painter.drawRect(event->rect().adjusted(2, 2, -2, -2));
|
||||||
|
// If works (QT5 and most QT4 styles) overpaints the previous rectangle
|
||||||
|
option.palette.setBrush(QPalette::Base, _color);
|
||||||
|
painter.drawPrimitive(QStyle::PE_PanelLineEdit, option);
|
||||||
|
painter.drawPrimitive(QStyle::PE_FrameLineEdit, option);
|
||||||
|
#endif // Q_OS_MAC || Q_OS_WIN32
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColorBox::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() != Qt::LeftButton)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QColor color = QColorDialog::getColor(_color, this, QString(),
|
||||||
|
QColorDialog::ShowAlphaChannel);
|
||||||
|
if (color.isValid()) {
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
emit colorChanged(_color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ColorBox::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_color = color;
|
||||||
|
update();
|
||||||
|
}
|
29
src/colorbox.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef COLORBOX_H
|
||||||
|
#define COLORBOX_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class ColorBox : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ColorBox(QWidget *parent = 0);
|
||||||
|
|
||||||
|
const QColor &color() const {return _color;}
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
|
QSize sizeHint() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void colorChanged(const QColor &color);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QColor _color;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COLORBOX_H
|
21
src/config.h
@ -7,13 +7,16 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#define APP_NAME "GPXSee"
|
#define APP_NAME "GPXSee"
|
||||||
#define APP_HOMEPAGE "http://tumic.wz.cz/gpxsee"
|
#define APP_HOMEPAGE "http://www.gpxsee.org"
|
||||||
|
|
||||||
#define FONT_FAMILY "Arial"
|
#define FONT_FAMILY "Arial"
|
||||||
#define FONT_SIZE 12
|
#define FONT_SIZE 12
|
||||||
#define SCREEN_DPI 96.0
|
#define SCREEN_DPI 96.0
|
||||||
|
|
||||||
|
#define ELLIPSOID_FILE QString("ellipsoids.csv")
|
||||||
|
#define DATUM_FILE QString("datums.csv")
|
||||||
#define MAP_FILE QString("maps.txt")
|
#define MAP_FILE QString("maps.txt")
|
||||||
|
#define MAP_DIR QString("maps")
|
||||||
#define POI_DIR QString("POI")
|
#define POI_DIR QString("POI")
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
@ -28,10 +31,16 @@
|
|||||||
#define GLOBAL_DIR QString("/usr/share/gpxsee")
|
#define GLOBAL_DIR QString("/usr/share/gpxsee")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define USER_MAP_FILE USER_DIR + QString("/") + MAP_FILE
|
#define USER_ELLIPSOID_FILE USER_DIR + QString("/") + ELLIPSOID_FILE
|
||||||
#define USER_POI_DIR USER_DIR + QString("/") + POI_DIR
|
#define USER_DATUM_FILE USER_DIR + QString("/") + DATUM_FILE
|
||||||
#define GLOBAL_MAP_FILE GLOBAL_DIR + QString("/") + MAP_FILE
|
#define USER_MAP_DIR USER_DIR + QString("/") + MAP_DIR
|
||||||
#define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR
|
#define USER_MAP_FILE USER_DIR + QString("/") + MAP_FILE
|
||||||
#define TILES_DIR USER_DIR + QString("/tiles")
|
#define USER_POI_DIR USER_DIR + QString("/") + POI_DIR
|
||||||
|
#define GLOBAL_ELLIPSOID_FILE GLOBAL_DIR + QString("/") + ELLIPSOID_FILE
|
||||||
|
#define GLOBAL_DATUM_FILE GLOBAL_DIR + QString("/") + DATUM_FILE
|
||||||
|
#define GLOBAL_MAP_DIR GLOBAL_DIR + QString("/") + MAP_DIR
|
||||||
|
#define GLOBAL_MAP_FILE GLOBAL_DIR + QString("/") + MAP_FILE
|
||||||
|
#define GLOBAL_POI_DIR GLOBAL_DIR + QString("/") + POI_DIR
|
||||||
|
#define TILES_DIR USER_DIR + QString("/tiles")
|
||||||
|
|
||||||
#endif /* CONFIG_H */
|
#endif /* CONFIG_H */
|
||||||
|
56
src/coordinates.cpp
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#include "rd.h"
|
||||||
|
#include "wgs84.h"
|
||||||
|
#include "coordinates.h"
|
||||||
|
|
||||||
|
#define MIN_LAT deg2rad(-90.0)
|
||||||
|
#define MAX_LAT deg2rad(90.0)
|
||||||
|
#define MIN_LON deg2rad(-180.0)
|
||||||
|
#define MAX_LON deg2rad(180.0)
|
||||||
|
|
||||||
|
qreal Coordinates::distanceTo(const Coordinates &c) const
|
||||||
|
{
|
||||||
|
qreal dLat = deg2rad(c.lat() - _lat);
|
||||||
|
qreal dLon = deg2rad(c.lon() - _lon);
|
||||||
|
qreal a = pow(sin(dLat / 2.0), 2.0)
|
||||||
|
+ cos(deg2rad(_lat)) * cos(deg2rad(c.lat())) * pow(sin(dLon / 2.0), 2.0);
|
||||||
|
|
||||||
|
return (WGS84_RADIUS * (2.0 * atan2(sqrt(a), sqrt(1.0 - a))));
|
||||||
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug dbg, const Coordinates &coordinates)
|
||||||
|
{
|
||||||
|
const bool ais = dbg.autoInsertSpaces();
|
||||||
|
dbg.nospace() << "Coordinates(" << coordinates.lon() << ", "
|
||||||
|
<< coordinates.lat() << ")";
|
||||||
|
dbg.setAutoInsertSpaces(ais);
|
||||||
|
return dbg.maybeSpace();
|
||||||
|
}
|
||||||
|
|
||||||
|
QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
|
||||||
|
{
|
||||||
|
qreal radDist = distance / WGS84_RADIUS;
|
||||||
|
|
||||||
|
qreal minLat = deg2rad(_lat) - radDist;
|
||||||
|
qreal maxLat = deg2rad(_lat) + radDist;
|
||||||
|
|
||||||
|
qreal minLon, maxLon;
|
||||||
|
if (minLat > MIN_LAT && maxLat < MAX_LAT) {
|
||||||
|
qreal deltaLon = asin(sin(radDist) / cos(_lat));
|
||||||
|
minLon = deg2rad(_lon) - deltaLon;
|
||||||
|
if (minLon < MIN_LON)
|
||||||
|
minLon += 2.0 * M_PI;
|
||||||
|
maxLon = deg2rad(_lon) + deltaLon;
|
||||||
|
if (maxLon > MAX_LON)
|
||||||
|
maxLon -= 2.0 * M_PI;
|
||||||
|
} else {
|
||||||
|
// a pole is within the distance
|
||||||
|
minLat = qMax(minLat, MIN_LAT);
|
||||||
|
maxLat = qMin(maxLat, MAX_LAT);
|
||||||
|
minLon = MIN_LON;
|
||||||
|
maxLon = MAX_LON;
|
||||||
|
}
|
||||||
|
|
||||||
|
return QPair<Coordinates, Coordinates>(Coordinates(rad2deg(qMin(minLon,
|
||||||
|
maxLon)), rad2deg(qMin(minLat, maxLat))), Coordinates(rad2deg(qMax(minLon,
|
||||||
|
maxLon)), rad2deg(qMax(minLat, maxLat))));
|
||||||
|
}
|
42
src/coordinates.h
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#ifndef COORDINATES_H
|
||||||
|
#define COORDINATES_H
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <QPair>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
class Coordinates
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Coordinates() {_lon = NAN; _lat = NAN;}
|
||||||
|
Coordinates(const Coordinates &c) {_lon = c._lon; _lat = c._lat;}
|
||||||
|
Coordinates(qreal lon, qreal lat) {_lon = lon; _lat = lat;}
|
||||||
|
|
||||||
|
qreal &rlon() {return _lon;}
|
||||||
|
qreal &rlat() {return _lat;}
|
||||||
|
void setLon(qreal lon) {_lon = lon;}
|
||||||
|
void setLat(qreal lat) {_lat = lat;}
|
||||||
|
qreal lon() const {return _lon;}
|
||||||
|
qreal lat() const {return _lat;}
|
||||||
|
|
||||||
|
bool isNull() const
|
||||||
|
{return std::isnan(_lon) && std::isnan(_lat);}
|
||||||
|
bool isValid() const
|
||||||
|
{return (_lon >= -180.0 && _lon <= 180.0
|
||||||
|
&& _lat >= -90.0 && _lat <= 90.0);}
|
||||||
|
|
||||||
|
qreal distanceTo(const Coordinates &c) const;
|
||||||
|
QPair<Coordinates, Coordinates> boundingRect(qreal distance) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
qreal _lat, _lon;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline bool operator==(const Coordinates &c1, const Coordinates &c2)
|
||||||
|
{return (c1.lat() == c2.lat() && c1.lon() == c2.lon());}
|
||||||
|
inline bool operator!=(const Coordinates &c1, const Coordinates &c2)
|
||||||
|
{return !(c1 == c2);}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug dbg, const Coordinates &trackpoint);
|
||||||
|
|
||||||
|
#endif // COORDINATES_H
|
47
src/csvparser.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include "csvparser.h"
|
||||||
|
|
||||||
|
bool CSVParser::parse(QFile *file, QList<TrackData> &track,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
Q_UNUSED(track);
|
||||||
|
Q_UNUSED(routes);
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
_errorLine = 1;
|
||||||
|
_errorString.clear();
|
||||||
|
|
||||||
|
while (!file->atEnd()) {
|
||||||
|
QByteArray line = file->readLine();
|
||||||
|
QList<QByteArray> list = line.split(',');
|
||||||
|
if (list.size() < 3) {
|
||||||
|
_errorString = "Parse error";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal lat = 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)) {
|
||||||
|
_errorString = "Invalid longitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Waypoint wp(Coordinates(lon, lat));
|
||||||
|
|
||||||
|
QByteArray ba = list[2].trimmed();
|
||||||
|
QString name = QString::fromUtf8(ba.data(), ba.size());
|
||||||
|
wp.setName(name);
|
||||||
|
|
||||||
|
if (list.size() > 3) {
|
||||||
|
ba = list[3].trimmed();
|
||||||
|
wp.setDescription(QString::fromUtf8(ba.data(), ba.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
waypoints.append(wp);
|
||||||
|
_errorLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
22
src/csvparser.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef CSVPARSER_H
|
||||||
|
#define CSVPARSER_H
|
||||||
|
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
class CSVParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CSVParser() : _errorLine(0) {}
|
||||||
|
~CSVParser() {}
|
||||||
|
|
||||||
|
bool parse(QFile *file, QList<TrackData> &track, QList<RouteData> &routes,
|
||||||
|
QList<Waypoint> &waypoints);
|
||||||
|
QString errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString _errorString;
|
||||||
|
int _errorLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CSVPARSER_H
|
109
src/data.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QLineF>
|
||||||
|
#include "gpxparser.h"
|
||||||
|
#include "tcxparser.h"
|
||||||
|
#include "csvparser.h"
|
||||||
|
#include "kmlparser.h"
|
||||||
|
#include "fitparser.h"
|
||||||
|
#include "igcparser.h"
|
||||||
|
#include "nmeaparser.h"
|
||||||
|
#include "data.h"
|
||||||
|
|
||||||
|
|
||||||
|
static QHash<QString, Parser*> parsers()
|
||||||
|
{
|
||||||
|
QHash<QString, Parser*> hash;
|
||||||
|
|
||||||
|
hash.insert("gpx", new GPXParser());
|
||||||
|
hash.insert("tcx", new TCXParser());
|
||||||
|
hash.insert("kml", new KMLParser());
|
||||||
|
hash.insert("fit", new FITParser());
|
||||||
|
hash.insert("csv", new CSVParser());
|
||||||
|
hash.insert("igc", new IGCParser());
|
||||||
|
hash.insert("nmea", new NMEAParser());
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
QHash<QString, Parser*> Data::_parsers = parsers();
|
||||||
|
|
||||||
|
Data::~Data()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
|
delete _tracks.at(i);
|
||||||
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
|
delete _routes.at(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Data::processData()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < _trackData.count(); i++)
|
||||||
|
_tracks.append(new Track(_trackData.at(i)));
|
||||||
|
for (int i = 0; i < _routeData.count(); i++)
|
||||||
|
_routes.append(new Route(_routeData.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Data::loadFile(const QString &fileName)
|
||||||
|
{
|
||||||
|
QFile file(fileName);
|
||||||
|
QFileInfo fi(fileName);
|
||||||
|
|
||||||
|
|
||||||
|
_errorString.clear();
|
||||||
|
_errorLine = 0;
|
||||||
|
|
||||||
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
|
_errorString = qPrintable(file.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QHash<QString, Parser*>::iterator it;
|
||||||
|
if ((it = _parsers.find(fi.suffix().toLower())) != _parsers.end()) {
|
||||||
|
if (it.value()->parse(&file, _trackData, _routeData, _waypoints)) {
|
||||||
|
processData();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorLine = it.value()->errorLine();
|
||||||
|
_errorString = it.value()->errorString();
|
||||||
|
} else {
|
||||||
|
for (it = _parsers.begin(); it != _parsers.end(); it++) {
|
||||||
|
if (it.value()->parse(&file, _trackData, _routeData, _waypoints)) {
|
||||||
|
processData();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
file.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
qWarning("Error loading data file: %s:\n", qPrintable(fileName));
|
||||||
|
for (it = _parsers.begin(); it != _parsers.end(); it++)
|
||||||
|
qWarning("%s: line %d: %s\n", qPrintable(it.key()),
|
||||||
|
it.value()->errorLine(), qPrintable(it.value()->errorString()));
|
||||||
|
|
||||||
|
_errorLine = 0;
|
||||||
|
_errorString = "Unknown format";
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Data::formats()
|
||||||
|
{
|
||||||
|
return tr("Supported files (*.csv *.fit *.gpx *.igc *.kml *.nmea *.tcx)")
|
||||||
|
+ ";;" + tr("CSV files (*.csv)") + ";;" + tr("FIT files (*.fit)") + ";;"
|
||||||
|
+ tr("GPX files (*.gpx)") + ";;" + tr("IGC files (*.igc)") + ";;"
|
||||||
|
+ tr("KML files (*.kml)") + ";;" + tr("NMEA files (*.nmea)") + ";;"
|
||||||
|
+ tr("TCX files (*.tcx)") + ";;" + tr("All files (*)");
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList Data::filter()
|
||||||
|
{
|
||||||
|
QStringList filter;
|
||||||
|
QHash<QString, Parser*>::iterator it;
|
||||||
|
|
||||||
|
for (it = _parsers.begin(); it != _parsers.end(); it++)
|
||||||
|
filter << QString("*.%1").arg(it.key());
|
||||||
|
|
||||||
|
return filter;
|
||||||
|
}
|
51
src/data.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#ifndef DATA_H
|
||||||
|
#define DATA_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include <QList>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QPointF>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringList>
|
||||||
|
#include "waypoint.h"
|
||||||
|
#include "track.h"
|
||||||
|
#include "route.h"
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class Data : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Data(QObject *parent = 0) : QObject(parent), _errorLine(0) {}
|
||||||
|
~Data();
|
||||||
|
|
||||||
|
bool loadFile(const QString &fileName);
|
||||||
|
const QString &errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
|
const QList<Track*> &tracks() const {return _tracks;}
|
||||||
|
const QList<Route*> &routes() const {return _routes;}
|
||||||
|
const QList<Waypoint> &waypoints() const {return _waypoints;}
|
||||||
|
|
||||||
|
static QString formats();
|
||||||
|
static QStringList filter();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void processData();
|
||||||
|
|
||||||
|
QString _errorString;
|
||||||
|
int _errorLine;
|
||||||
|
|
||||||
|
QList<Track*> _tracks;
|
||||||
|
QList<Route*> _routes;
|
||||||
|
QList<Waypoint> _waypoints;
|
||||||
|
|
||||||
|
QList<TrackData> _trackData;
|
||||||
|
QList<RouteData> _routeData;
|
||||||
|
|
||||||
|
static QHash<QString, Parser*> _parsers;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DATA_H
|
121
src/datum.cpp
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
#include <cmath>
|
||||||
|
#include <QFile>
|
||||||
|
#include "wgs84.h"
|
||||||
|
#include "rd.h"
|
||||||
|
#include "datum.h"
|
||||||
|
|
||||||
|
|
||||||
|
static QMap<QString, Datum> WGS84()
|
||||||
|
{
|
||||||
|
QMap<QString, Datum> map;
|
||||||
|
map.insert("WGS 84", Datum(Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING),
|
||||||
|
0.0, 0.0, 0.0));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMap<QString, Datum> Datum::_datums = WGS84();
|
||||||
|
QString Datum::_errorString;
|
||||||
|
int Datum::_errorLine = 0;
|
||||||
|
|
||||||
|
Datum Datum::datum(const QString &name)
|
||||||
|
{
|
||||||
|
QMap<QString, Datum>::const_iterator it = _datums.find(name);
|
||||||
|
|
||||||
|
if (it == _datums.end())
|
||||||
|
return Datum();
|
||||||
|
|
||||||
|
return it.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Datum::loadList(const QString &path)
|
||||||
|
{
|
||||||
|
QFile file(path);
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
|
_errorString = qPrintable(file.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorLine = 1;
|
||||||
|
_errorString.clear();
|
||||||
|
|
||||||
|
while (!file.atEnd()) {
|
||||||
|
QByteArray line = file.readLine();
|
||||||
|
QList<QByteArray> list = line.split(',');
|
||||||
|
if (list.size() != 6) {
|
||||||
|
_errorString = "Format error";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int eid = list[2].trimmed().toInt(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid ellipsoid id";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
double dx = list[3].trimmed().toDouble(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid dx";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
double dy = list[4].trimmed().toDouble(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid dy";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
double dz = list[5].trimmed().toDouble(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid dz";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ellipsoid e = Ellipsoid::ellipsoid(eid);
|
||||||
|
if (e.isNull()) {
|
||||||
|
_errorString = "Unknown ellipsoid ID";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Datum d(e, dx, dy, dz);
|
||||||
|
_datums.insert(list[0].trimmed(), d);
|
||||||
|
|
||||||
|
_errorLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Abridged Molodensky transformation
|
||||||
|
Coordinates Datum::toWGS84(const Coordinates &c) const
|
||||||
|
{
|
||||||
|
if (_ellipsoid.radius() == WGS84_RADIUS
|
||||||
|
&& _ellipsoid.flattening() == WGS84_FLATTENING
|
||||||
|
&& _dx == 0.0 && _dy == 0.0 && _dz == 0.0)
|
||||||
|
return c;
|
||||||
|
|
||||||
|
double rlat = deg2rad(c.lat());
|
||||||
|
double rlon = deg2rad(c.lon());
|
||||||
|
|
||||||
|
double slat = sin(rlat);
|
||||||
|
double clat = cos(rlat);
|
||||||
|
double slon = sin(rlon);
|
||||||
|
double clon = cos(rlon);
|
||||||
|
double ssqlat = slat * slat;
|
||||||
|
|
||||||
|
double from_f = ellipsoid().flattening();
|
||||||
|
double df = WGS84_FLATTENING - from_f;
|
||||||
|
double from_a = ellipsoid().radius();
|
||||||
|
double da = WGS84_RADIUS - from_a;
|
||||||
|
double from_esq = ellipsoid().flattening()
|
||||||
|
* (2.0 - ellipsoid().flattening());
|
||||||
|
double adb = 1.0 / (1.0 - from_f);
|
||||||
|
double rn = from_a / sqrt(1 - from_esq * ssqlat);
|
||||||
|
double rm = from_a * (1 - from_esq) / pow((1 - from_esq * ssqlat), 1.5);
|
||||||
|
double from_h = 0.0;
|
||||||
|
|
||||||
|
double dlat = (-dx() * slat * clon - dy() * slat * slon + dz() * clat + da
|
||||||
|
* rn * from_esq * slat * clat / from_a + df * (rm * adb + rn / adb) * slat
|
||||||
|
* clat) / (rm + from_h);
|
||||||
|
double dlon = (-dx() * slon + dy() * clon) / ((rn + from_h) * clat);
|
||||||
|
|
||||||
|
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
|
||||||
|
}
|
40
src/datum.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#ifndef DATUM_H
|
||||||
|
#define DATUM_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include "ellipsoid.h"
|
||||||
|
#include "coordinates.h"
|
||||||
|
|
||||||
|
class Datum
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Datum() : _ellipsoid(Ellipsoid()), _dx(0.0), _dy(0.0), _dz(0.0) {}
|
||||||
|
Datum(const Ellipsoid &ellipsoid, double dx, double dy, double dz)
|
||||||
|
: _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz) {}
|
||||||
|
|
||||||
|
const Ellipsoid &ellipsoid() const {return _ellipsoid;}
|
||||||
|
double dx() const {return _dx;}
|
||||||
|
double dy() const {return _dy;}
|
||||||
|
double dz() const {return _dz;}
|
||||||
|
|
||||||
|
bool isNull() const
|
||||||
|
{return (_ellipsoid.isNull() && _dx == 0.0 && _dy == 0.0 && _dz == 0.0);}
|
||||||
|
|
||||||
|
Coordinates toWGS84(const Coordinates &c) const;
|
||||||
|
|
||||||
|
static bool loadList(const QString &path);
|
||||||
|
static const QString &errorString() {return _errorString;}
|
||||||
|
static int errorLine() {return _errorLine;}
|
||||||
|
|
||||||
|
static Datum datum(const QString &name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ellipsoid _ellipsoid;
|
||||||
|
double _dx, _dy, _dz;
|
||||||
|
|
||||||
|
static QMap<QString, Datum> _datums;
|
||||||
|
static QString _errorString;
|
||||||
|
static int _errorLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DATUM_H
|
@ -1,5 +1,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "downloader.h"
|
#include "downloader.h"
|
||||||
|
|
||||||
@ -17,25 +19,39 @@
|
|||||||
#define USER_AGENT \
|
#define USER_AGENT \
|
||||||
APP_NAME "/" APP_VERSION " (" PLATFORM_STR "; Qt " QT_VERSION_STR ")"
|
APP_NAME "/" APP_VERSION " (" PLATFORM_STR "; Qt " QT_VERSION_STR ")"
|
||||||
|
|
||||||
Downloader::Downloader()
|
#define ATTR_REDIRECT QNetworkRequest::RedirectionTargetAttribute
|
||||||
|
#define ATTR_FILE QNetworkRequest::User
|
||||||
|
#define ATTR_ORIGIN (QNetworkRequest::Attribute)(QNetworkRequest::User + 1)
|
||||||
|
#define ATTR_LEVEL (QNetworkRequest::Attribute)(QNetworkRequest::User + 2)
|
||||||
|
|
||||||
|
#define MAX_REDIRECT_LEVEL 5
|
||||||
|
|
||||||
|
|
||||||
|
Downloader::Downloader(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
connect(&_manager, SIGNAL(finished(QNetworkReply*)),
|
connect(&_manager, SIGNAL(finished(QNetworkReply*)),
|
||||||
SLOT(downloadFinished(QNetworkReply*)));
|
SLOT(downloadFinished(QNetworkReply*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Downloader::doDownload(const Download &dl)
|
bool Downloader::doDownload(const Download &dl, const Redirect &redirect)
|
||||||
{
|
{
|
||||||
QUrl url(dl.url());
|
QUrl url(dl.url());
|
||||||
|
|
||||||
if (_errorDownloads.contains(url))
|
if (_errorDownloads.contains(url))
|
||||||
return false;
|
return false;
|
||||||
|
if (_currentDownloads.contains(url))
|
||||||
|
return false;
|
||||||
|
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
request.setAttribute(QNetworkRequest::User, QVariant(dl.file()));
|
request.setAttribute(ATTR_FILE, QVariant(dl.file()));
|
||||||
|
if (!redirect.isNull()) {
|
||||||
|
request.setAttribute(ATTR_ORIGIN, QVariant(redirect.origin()));
|
||||||
|
request.setAttribute(ATTR_LEVEL, QVariant(redirect.level()));
|
||||||
|
}
|
||||||
request.setRawHeader("User-Agent", USER_AGENT);
|
request.setRawHeader("User-Agent", USER_AGENT);
|
||||||
QNetworkReply *reply = _manager.get(request);
|
QNetworkReply *reply = _manager.get(request);
|
||||||
|
|
||||||
_currentDownloads.append(reply);
|
_currentDownloads.insert(url, reply);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -45,7 +61,7 @@ bool Downloader::saveToDisk(const QString &filename, QIODevice *data)
|
|||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
|
|
||||||
if (!file.open(QIODevice::WriteOnly)) {
|
if (!file.open(QIODevice::WriteOnly)) {
|
||||||
fprintf(stderr, "Error writing map tile: %s: %s\n",
|
qWarning("Error writing map tile: %s: %s\n",
|
||||||
qPrintable(filename), qPrintable(file.errorString()));
|
qPrintable(filename), qPrintable(file.errorString()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -58,18 +74,49 @@ bool Downloader::saveToDisk(const QString &filename, QIODevice *data)
|
|||||||
|
|
||||||
void Downloader::downloadFinished(QNetworkReply *reply)
|
void Downloader::downloadFinished(QNetworkReply *reply)
|
||||||
{
|
{
|
||||||
QUrl url = reply->url();
|
QUrl url = reply->request().url();
|
||||||
|
|
||||||
if (reply->error()) {
|
if (reply->error()) {
|
||||||
_errorDownloads.insert(url);
|
QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl();
|
||||||
fprintf(stderr, "Error downloading map tile: %s: %s\n",
|
if (origin.isEmpty()) {
|
||||||
url.toEncoded().constData(), qPrintable(reply->errorString()));
|
_errorDownloads.insert(url);
|
||||||
|
qWarning("Error downloading map tile: %s: %s\n",
|
||||||
|
url.toEncoded().constData(), qPrintable(reply->errorString()));
|
||||||
|
} else {
|
||||||
|
_errorDownloads.insert(origin);
|
||||||
|
qWarning("Error downloading map tile: %s -> %s: %s\n",
|
||||||
|
origin.toEncoded().constData(), url.toEncoded().constData(),
|
||||||
|
qPrintable(reply->errorString()));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
QString filename = reply->request().attribute(QNetworkRequest::User)
|
QUrl location = reply->attribute(ATTR_REDIRECT).toUrl();
|
||||||
|
QString filename = reply->request().attribute(ATTR_FILE)
|
||||||
.toString();
|
.toString();
|
||||||
saveToDisk(filename, reply);
|
|
||||||
|
if (!location.isEmpty()) {
|
||||||
|
QUrl origin = reply->request().attribute(ATTR_ORIGIN).toUrl();
|
||||||
|
int level = reply->request().attribute(ATTR_LEVEL).toInt();
|
||||||
|
|
||||||
|
if (location == url) {
|
||||||
|
_errorDownloads.insert(url);
|
||||||
|
qWarning("Error downloading map tile: %s: "
|
||||||
|
"redirect loop\n", url.toEncoded().constData());
|
||||||
|
} else if (level >= MAX_REDIRECT_LEVEL) {
|
||||||
|
_errorDownloads.insert(origin);
|
||||||
|
qWarning("Error downloading map tile: %s: "
|
||||||
|
"redirect level limit reached\n",
|
||||||
|
origin.toEncoded().constData());
|
||||||
|
} else {
|
||||||
|
Redirect redirect(origin.isEmpty() ? url : origin, level + 1);
|
||||||
|
Download dl(location, filename);
|
||||||
|
doDownload(dl, redirect);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
if (!saveToDisk(filename, reply))
|
||||||
|
_errorDownloads.insert(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentDownloads.removeAll(reply);
|
_currentDownloads.remove(url);
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
|
||||||
if (_currentDownloads.isEmpty())
|
if (_currentDownloads.isEmpty())
|
||||||
|
@ -2,23 +2,24 @@
|
|||||||
#define DOWNLOADER_H
|
#define DOWNLOADER_H
|
||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QMap>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
|
|
||||||
|
class QNetworkReply;
|
||||||
|
|
||||||
class Download
|
class Download
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Download(const QString &url, const QString &file)
|
Download(const QUrl &url, const QString &file)
|
||||||
{_url = url; _file = file;}
|
{_url = url; _file = file;}
|
||||||
const QString& url() const {return _url;}
|
const QUrl& url() const {return _url;}
|
||||||
const QString& file() const {return _file;}
|
const QString& file() const {return _file;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _url;
|
QUrl _url;
|
||||||
QString _file;
|
QString _file;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -28,8 +29,8 @@ class Downloader : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Downloader& instance()
|
Downloader(QObject *parent = 0);
|
||||||
{static Downloader i; return i;}
|
|
||||||
bool get(const QList<Download> &list);
|
bool get(const QList<Download> &list);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -39,15 +40,28 @@ private slots:
|
|||||||
void downloadFinished(QNetworkReply *reply);
|
void downloadFinished(QNetworkReply *reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Downloader();
|
class Redirect
|
||||||
Downloader(Downloader const&);
|
{
|
||||||
void operator=(Downloader const&);
|
public:
|
||||||
|
Redirect() : _level(0) {}
|
||||||
|
Redirect(const QUrl &origin, int level) :
|
||||||
|
_origin(origin), _level(level) {}
|
||||||
|
|
||||||
bool doDownload(const Download &dl);
|
const QUrl &origin() const {return _origin;}
|
||||||
|
int level() const {return _level;}
|
||||||
|
|
||||||
|
bool isNull() const {return (_level == 0);}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QUrl _origin;
|
||||||
|
int _level;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool doDownload(const Download &dl, const Redirect &redirect = Redirect());
|
||||||
bool saveToDisk(const QString &filename, QIODevice *data);
|
bool saveToDisk(const QString &filename, QIODevice *data);
|
||||||
|
|
||||||
QNetworkAccessManager _manager;
|
QNetworkAccessManager _manager;
|
||||||
QList<QNetworkReply *> _currentDownloads;
|
QMap<QUrl, QNetworkReply *> _currentDownloads;
|
||||||
QSet<QUrl> _errorDownloads;
|
QSet<QUrl> _errorDownloads;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,97 +1,140 @@
|
|||||||
|
#include <cmath>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "elevationgraph.h"
|
#include "elevationgraph.h"
|
||||||
|
|
||||||
|
|
||||||
ElevationGraph::ElevationGraph(QWidget *parent) : GraphView(parent)
|
static qreal nMin(qreal a, qreal b)
|
||||||
{
|
{
|
||||||
_ascent = 0;
|
if (!std::isnan(a) && !std::isnan(b))
|
||||||
_descent = 0;
|
return qMin(a, b);
|
||||||
|
else if (!std::isnan(a))
|
||||||
|
return a;
|
||||||
|
else if (!std::isnan(b))
|
||||||
|
return b;
|
||||||
|
else
|
||||||
|
return NAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qreal nMax(qreal a, qreal b)
|
||||||
|
{
|
||||||
|
if (!std::isnan(a) && !std::isnan(b))
|
||||||
|
return qMax(a, b);
|
||||||
|
else if (!std::isnan(a))
|
||||||
|
return a;
|
||||||
|
else if (!std::isnan(b))
|
||||||
|
return b;
|
||||||
|
else
|
||||||
|
return NAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
|
||||||
|
{
|
||||||
|
_trackAscent = 0;
|
||||||
|
_routeAscent = 0;
|
||||||
|
_trackDescent = 0;
|
||||||
|
_routeDescent = 0;
|
||||||
|
_trackMin = NAN;
|
||||||
|
_trackMax = NAN;
|
||||||
|
_routeMin = NAN;
|
||||||
|
_routeMax = NAN;
|
||||||
|
|
||||||
|
_showRoutes = true;
|
||||||
|
_showTracks = true;
|
||||||
|
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
|
|
||||||
setYUnits();
|
setYUnits();
|
||||||
setXLabel(tr("Distance"));
|
|
||||||
setYLabel(tr("Elevation"));
|
setYLabel(tr("Elevation"));
|
||||||
|
|
||||||
setMinYRange(50.0);
|
setMinYRange(50.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::addInfo()
|
void ElevationGraph::setInfo()
|
||||||
{
|
{
|
||||||
GraphView::addInfo(tr("Ascent"), QString::number(_ascent * yScale(), 'f', 0)
|
if (std::isnan(max()) || std::isnan(min()))
|
||||||
+ UNIT_SPACE + yUnits());
|
clearInfo();
|
||||||
GraphView::addInfo(tr("Descent"), QString::number(_descent * yScale(), 'f',
|
else {
|
||||||
0) + UNIT_SPACE + yUnits());
|
GraphView::addInfo(tr("Ascent"), QString::number(ascent() * yScale(),
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 0)
|
'f', 0) + UNIT_SPACE + yUnits());
|
||||||
+ UNIT_SPACE + yUnits());
|
GraphView::addInfo(tr("Descent"), QString::number(descent() * yScale(),
|
||||||
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f', 0)
|
'f', 0) + UNIT_SPACE + yUnits());
|
||||||
+ UNIT_SPACE + yUnits());
|
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
||||||
|
0) + UNIT_SPACE + yUnits());
|
||||||
|
GraphView::addInfo(tr("Minimum"), QString::number(min() * yScale(), 'f',
|
||||||
|
0) + UNIT_SPACE + yUnits());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::loadGraph(const Graph &graph, Type type, PathItem *path)
|
||||||
|
{
|
||||||
|
qreal ascent = 0, descent = 0;
|
||||||
|
qreal min, max;
|
||||||
|
|
||||||
|
if (graph.size() < 2) {
|
||||||
|
skipColor();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
max = min = graph.at(0).y();
|
||||||
|
for (int j = 1; j < graph.size(); j++) {
|
||||||
|
qreal cur = graph.at(j).y();
|
||||||
|
qreal prev = graph.at(j-1).y();
|
||||||
|
|
||||||
|
if (cur > prev)
|
||||||
|
ascent += cur - prev;
|
||||||
|
if (cur < prev)
|
||||||
|
descent += prev - cur;
|
||||||
|
|
||||||
|
if (cur < min)
|
||||||
|
min = cur;
|
||||||
|
if (cur > max)
|
||||||
|
max = cur;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == Track) {
|
||||||
|
_trackAscent += ascent;
|
||||||
|
_trackDescent += descent;
|
||||||
|
_trackMax = nMax(_trackMax, max);
|
||||||
|
_trackMin = nMin(_trackMin, min);
|
||||||
|
} else {
|
||||||
|
_routeAscent += ascent;
|
||||||
|
_routeDescent += descent;
|
||||||
|
_routeMax = nMax(_routeMax, max);
|
||||||
|
_routeMin = nMin(_routeMin, min);
|
||||||
|
}
|
||||||
|
|
||||||
|
GraphView::loadGraph(graph, path, type);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
|
{
|
||||||
|
int p = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < data.tracks().count(); i++)
|
||||||
|
loadGraph(data.tracks().at(i)->elevation(), Track, paths.at(p++));
|
||||||
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
|
loadGraph(data.routes().at(i)->elevation(), Route, paths.at(p++));
|
||||||
|
|
||||||
|
setInfo();
|
||||||
|
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::loadGPX(const GPX &gpx)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < gpx.trackCount(); i++) {
|
|
||||||
QVector<QPointF> data;
|
|
||||||
qreal ascent = 0, descent = 0;
|
|
||||||
|
|
||||||
gpx.track(i).elevationGraph(data);
|
|
||||||
if (data.count() < 2) {
|
|
||||||
skipColor();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int j = 1; j < data.size(); j++) {
|
|
||||||
qreal cur = data.at(j).y();
|
|
||||||
qreal prev = data.at(j-1).y();
|
|
||||||
|
|
||||||
if (cur > prev)
|
|
||||||
ascent += cur - prev;
|
|
||||||
if (cur < prev)
|
|
||||||
descent += prev - cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
_ascent += ascent;
|
|
||||||
_descent += descent;
|
|
||||||
|
|
||||||
loadData(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
setXUnits();
|
|
||||||
addInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ElevationGraph::clear()
|
void ElevationGraph::clear()
|
||||||
{
|
{
|
||||||
_ascent = 0;
|
_trackAscent = 0;
|
||||||
_descent = 0;
|
_routeAscent = 0;
|
||||||
|
_trackDescent = 0;
|
||||||
|
_routeDescent = 0;
|
||||||
|
_trackMin = NAN;
|
||||||
|
_trackMax = NAN;
|
||||||
|
_routeMin = NAN;
|
||||||
|
_routeMax = NAN;
|
||||||
|
|
||||||
GraphView::clear();
|
GraphView::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElevationGraph::setXUnits()
|
|
||||||
{
|
|
||||||
if (_units == Metric) {
|
|
||||||
if (bounds().width() < KMINM) {
|
|
||||||
GraphView::setXUnits(tr("m"));
|
|
||||||
setXScale(1);
|
|
||||||
} else {
|
|
||||||
GraphView::setXUnits(tr("km"));
|
|
||||||
setXScale(M2KM);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (bounds().width() < MIINM) {
|
|
||||||
GraphView::setXUnits(tr("ft"));
|
|
||||||
setXScale(M2FT);
|
|
||||||
} else {
|
|
||||||
GraphView::setXUnits(tr("mi"));
|
|
||||||
setXScale(M2MI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ElevationGraph::setYUnits()
|
void ElevationGraph::setYUnits()
|
||||||
{
|
{
|
||||||
if (_units == Metric) {
|
if (_units == Metric) {
|
||||||
@ -106,9 +149,86 @@ void ElevationGraph::setYUnits()
|
|||||||
void ElevationGraph::setUnits(enum Units units)
|
void ElevationGraph::setUnits(enum Units units)
|
||||||
{
|
{
|
||||||
_units = units;
|
_units = units;
|
||||||
setXUnits();
|
|
||||||
setYUnits();
|
|
||||||
|
|
||||||
clearInfo();
|
setYUnits();
|
||||||
addInfo();
|
setInfo();
|
||||||
|
GraphView::setUnits(units);
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::showTracks(bool show)
|
||||||
|
{
|
||||||
|
_showTracks = show;
|
||||||
|
|
||||||
|
setInfo();
|
||||||
|
showGraph(show, Track);
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElevationGraph::showRoutes(bool show)
|
||||||
|
{
|
||||||
|
_showRoutes = show;
|
||||||
|
|
||||||
|
showGraph(show, Route);
|
||||||
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal ElevationGraph::ascent() const
|
||||||
|
{
|
||||||
|
qreal val = 0;
|
||||||
|
|
||||||
|
if (_showRoutes)
|
||||||
|
val += _routeAscent;
|
||||||
|
if (_showTracks)
|
||||||
|
val += _trackAscent;
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal ElevationGraph::descent() const
|
||||||
|
{
|
||||||
|
qreal val = 0;
|
||||||
|
|
||||||
|
if (_showRoutes)
|
||||||
|
val += _routeDescent;
|
||||||
|
if (_showTracks)
|
||||||
|
val += _trackDescent;
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal ElevationGraph::max() const
|
||||||
|
{
|
||||||
|
qreal val;
|
||||||
|
|
||||||
|
if (_showRoutes && _showTracks)
|
||||||
|
val = nMax(_routeMax, _trackMax);
|
||||||
|
else if (_showTracks)
|
||||||
|
val = _trackMax;
|
||||||
|
else if (_showRoutes)
|
||||||
|
val = _routeMax;
|
||||||
|
else
|
||||||
|
val = NAN;
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal ElevationGraph::min() const
|
||||||
|
{
|
||||||
|
qreal val;
|
||||||
|
|
||||||
|
if (_showRoutes && _showTracks)
|
||||||
|
val = nMin(_routeMin, _trackMin);
|
||||||
|
else if (_showTracks)
|
||||||
|
val = _trackMin;
|
||||||
|
else if (_showRoutes)
|
||||||
|
val = _routeMin;
|
||||||
|
else
|
||||||
|
val = NAN;
|
||||||
|
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,42 @@
|
|||||||
#ifndef ELEVATIONGRAPH_H
|
#ifndef ELEVATIONGRAPH_H
|
||||||
#define ELEVATIONGRAPH_H
|
#define ELEVATIONGRAPH_H
|
||||||
|
|
||||||
#include "graphview.h"
|
#include "graphtab.h"
|
||||||
#include "units.h"
|
|
||||||
|
|
||||||
class GPX;
|
class ElevationGraph : public GraphTab
|
||||||
|
|
||||||
class ElevationGraph : public GraphView
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElevationGraph(QWidget *parent = 0);
|
ElevationGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
void loadGPX(const GPX &gpx);
|
QString label() const {return tr("Elevation");}
|
||||||
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void setUnits(enum Units units);
|
||||||
|
void showTracks(bool show);
|
||||||
qreal ascent() const {return _ascent;}
|
void showRoutes(bool show);
|
||||||
qreal descent() const {return _descent;}
|
|
||||||
qreal max() const {return bounds().bottom();}
|
|
||||||
qreal min() const {return bounds().top();}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setXUnits();
|
enum Type {Track, Route};
|
||||||
void setYUnits();
|
|
||||||
void addInfo();
|
qreal max() const;
|
||||||
|
qreal min() const;
|
||||||
|
qreal ascent() const;
|
||||||
|
qreal descent() const;
|
||||||
|
|
||||||
|
void setYUnits();
|
||||||
|
void setInfo();
|
||||||
|
|
||||||
|
void loadGraph(const Graph &graph, Type type, PathItem *path);
|
||||||
|
|
||||||
|
qreal _trackAscent, _trackDescent;
|
||||||
|
qreal _routeAscent, _routeDescent;
|
||||||
|
qreal _trackMax, _routeMax;
|
||||||
|
qreal _trackMin, _routeMin;
|
||||||
|
|
||||||
qreal _ascent, _descent;
|
|
||||||
enum Units _units;
|
enum Units _units;
|
||||||
|
bool _showTracks, _showRoutes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELEVATIONGRAPH_H
|
#endif // ELEVATIONGRAPH_H
|
||||||
|
62
src/ellipsoid.cpp
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#include <QFile>
|
||||||
|
#include "ellipsoid.h"
|
||||||
|
|
||||||
|
QMap<int, Ellipsoid> Ellipsoid::_ellipsoids;
|
||||||
|
QString Ellipsoid::_errorString;
|
||||||
|
int Ellipsoid::_errorLine = 0;
|
||||||
|
|
||||||
|
Ellipsoid Ellipsoid::ellipsoid(int id)
|
||||||
|
{
|
||||||
|
QMap<int, Ellipsoid>::const_iterator it = _ellipsoids.find(id);
|
||||||
|
|
||||||
|
if (it == _ellipsoids.end())
|
||||||
|
return Ellipsoid();
|
||||||
|
|
||||||
|
return it.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Ellipsoid::loadList(const QString &path)
|
||||||
|
{
|
||||||
|
QFile file(path);
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
if (!file.open(QFile::ReadOnly)) {
|
||||||
|
_errorString = qPrintable(file.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorLine = 1;
|
||||||
|
_errorString.clear();
|
||||||
|
|
||||||
|
while (!file.atEnd()) {
|
||||||
|
QByteArray line = file.readLine();
|
||||||
|
QList<QByteArray> list = line.split(',');
|
||||||
|
if (list.size() != 4) {
|
||||||
|
_errorString = "Format error";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = list[0].trimmed().toInt(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid ellipsoid id";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
double radius = list[2].trimmed().toDouble(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid ellipsoid radius";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
double flattening = list[3].trimmed().toDouble(&res);
|
||||||
|
if (!res) {
|
||||||
|
_errorString = "Invalid ellipsoid flattening";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ellipsoid e(radius, 1.0/flattening);
|
||||||
|
_ellipsoids.insert(id, e);
|
||||||
|
|
||||||
|
_errorLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
34
src/ellipsoid.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef ELLIPSOID_H
|
||||||
|
#define ELLIPSOID_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
|
class Ellipsoid
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Ellipsoid() : _radius(0.0), _flattening(0.0) {}
|
||||||
|
Ellipsoid(double radius, double flattening)
|
||||||
|
: _radius(radius), _flattening(flattening) {}
|
||||||
|
|
||||||
|
double radius() const {return _radius;}
|
||||||
|
double flattening() const {return _flattening;}
|
||||||
|
|
||||||
|
bool isNull() const {return (_radius == 0.0 && _flattening == 0.0);}
|
||||||
|
|
||||||
|
static bool loadList(const QString &path);
|
||||||
|
static const QString &errorString() {return _errorString;}
|
||||||
|
static int errorLine() {return _errorLine;}
|
||||||
|
|
||||||
|
static Ellipsoid ellipsoid(int id);
|
||||||
|
|
||||||
|
private:
|
||||||
|
double _radius;
|
||||||
|
double _flattening;
|
||||||
|
|
||||||
|
static QMap<int, Ellipsoid> _ellipsoids;
|
||||||
|
static QString _errorString;
|
||||||
|
static int _errorLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // ELLIPSOID_H
|
86
src/emptymap.cpp
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#include <QtGlobal>
|
||||||
|
#include <QPainter>
|
||||||
|
#include "rectc.h"
|
||||||
|
#include "misc.h"
|
||||||
|
#include "rd.h"
|
||||||
|
#include "wgs84.h"
|
||||||
|
#include "coordinates.h"
|
||||||
|
#include "mercator.h"
|
||||||
|
#include "emptymap.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SCALE_MIN 0.5
|
||||||
|
#define SCALE_MAX 1.0E-6
|
||||||
|
|
||||||
|
EmptyMap::EmptyMap(QObject *parent) : Map(parent)
|
||||||
|
{
|
||||||
|
_scale = SCALE_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF EmptyMap::bounds() const
|
||||||
|
{
|
||||||
|
return scaled(QRectF(QPointF(-180, -180), QSizeF(360, 360)), 1.0/_scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal EmptyMap::zoomFit(const QSize &size, const RectC &br)
|
||||||
|
{
|
||||||
|
if (!br.isValid())
|
||||||
|
_scale = SCALE_MAX;
|
||||||
|
else {
|
||||||
|
QRectF tbr(Mercator().ll2xy(br.topLeft()),
|
||||||
|
Mercator().ll2xy(br.bottomRight()));
|
||||||
|
QPointF sc(tbr.width() / size.width(), tbr.height() / size.height());
|
||||||
|
_scale = qMax(sc.x(), sc.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
_scale = qMax(_scale, SCALE_MAX);
|
||||||
|
_scale = qMin(_scale, SCALE_MIN);
|
||||||
|
|
||||||
|
return _scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal EmptyMap::zoomFit(qreal resolution, const Coordinates &c)
|
||||||
|
{
|
||||||
|
_scale = (360.0 * resolution) / (WGS84_RADIUS * 2 * M_PI
|
||||||
|
* cos(deg2rad(c.lat())));
|
||||||
|
|
||||||
|
_scale = qMax(_scale, SCALE_MAX);
|
||||||
|
_scale = qMin(_scale, SCALE_MIN);
|
||||||
|
|
||||||
|
return _scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal EmptyMap::resolution(const QPointF &p) const
|
||||||
|
{
|
||||||
|
return (WGS84_RADIUS * 2 * M_PI * _scale / 360.0
|
||||||
|
* cos(2.0 * atan(exp(deg2rad(-p.y() * _scale))) - M_PI/2));
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal EmptyMap::zoomIn()
|
||||||
|
{
|
||||||
|
_scale = qMax(_scale / 2.0, SCALE_MAX);
|
||||||
|
return _scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal EmptyMap::zoomOut()
|
||||||
|
{
|
||||||
|
_scale = qMin(_scale * 2.0, SCALE_MIN);
|
||||||
|
return _scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EmptyMap::draw(QPainter *painter, const QRectF &rect)
|
||||||
|
{
|
||||||
|
painter->fillRect(rect, Qt::white);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF EmptyMap::ll2xy(const Coordinates &c)
|
||||||
|
{
|
||||||
|
QPointF m = Mercator().ll2xy(c);
|
||||||
|
return QPointF(m.x() / _scale, m.y() / -_scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
Coordinates EmptyMap::xy2ll(const QPointF &p)
|
||||||
|
{
|
||||||
|
QPointF m(p.x() * _scale, -p.y() * _scale);
|
||||||
|
return Mercator().xy2ll(m);
|
||||||
|
}
|
34
src/emptymap.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#ifndef EMPTYMAP_H
|
||||||
|
#define EMPTYMAP_H
|
||||||
|
|
||||||
|
#include "map.h"
|
||||||
|
|
||||||
|
class EmptyMap : public Map
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
EmptyMap(QObject *parent = 0);
|
||||||
|
|
||||||
|
const QString &name() const {return _name;}
|
||||||
|
|
||||||
|
QRectF bounds() const;
|
||||||
|
qreal resolution(const QPointF &p) const;
|
||||||
|
|
||||||
|
qreal zoom() const {return _scale;}
|
||||||
|
qreal zoomFit(const QSize &size, const RectC &br);
|
||||||
|
qreal zoomFit(qreal resolution, const Coordinates &c);
|
||||||
|
qreal zoomIn();
|
||||||
|
qreal zoomOut();
|
||||||
|
|
||||||
|
QPointF ll2xy(const Coordinates &c);
|
||||||
|
Coordinates xy2ll(const QPointF &p);
|
||||||
|
|
||||||
|
void draw(QPainter *painter, const QRectF &rect);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString _name;
|
||||||
|
qreal _scale;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EMPTYMAP_H
|
@ -11,23 +11,19 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include <QLocale>
|
|
||||||
#include "fileselectwidget.h"
|
#include "fileselectwidget.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "exportdialog.h"
|
#include "exportdialog.h"
|
||||||
|
|
||||||
|
|
||||||
ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
||||||
: QDialog(parent), _printer(printer)
|
: QDialog(parent), _export(exp)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
_units = (QLocale::system().measurementSystem()
|
|
||||||
== QLocale::ImperialSystem) ? QPrinter::Inch : QPrinter::Millimeter;
|
|
||||||
|
|
||||||
_fileSelect = new FileSelectWidget();
|
_fileSelect = new FileSelectWidget();
|
||||||
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
|
_fileSelect->setFilter(tr("PDF files (*.pdf);;All files (*)"));
|
||||||
_fileSelect->setFile(_printer->outputFileName());
|
_fileSelect->setFile(_export->fileName);
|
||||||
|
|
||||||
_paperSize = new QComboBox();
|
_paperSize = new QComboBox();
|
||||||
_paperSize->addItem("A3", QPrinter::A3);
|
_paperSize->addItem("A3", QPrinter::A3);
|
||||||
@ -36,7 +32,7 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
|||||||
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
|
_paperSize->addItem("Tabloid", QPrinter::Tabloid);
|
||||||
_paperSize->addItem("Legal", QPrinter::Legal);
|
_paperSize->addItem("Legal", QPrinter::Legal);
|
||||||
_paperSize->addItem("Letter", QPrinter::Letter);
|
_paperSize->addItem("Letter", QPrinter::Letter);
|
||||||
if ((index = _paperSize->findData(_printer->paperSize())) >= 0)
|
if ((index = _paperSize->findData(_export->paperSize)) >= 0)
|
||||||
_paperSize->setCurrentIndex(index);
|
_paperSize->setCurrentIndex(index);
|
||||||
|
|
||||||
_portrait = new QRadioButton(tr("Portrait"));
|
_portrait = new QRadioButton(tr("Portrait"));
|
||||||
@ -44,32 +40,34 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
|||||||
QHBoxLayout *orientationLayout = new QHBoxLayout();
|
QHBoxLayout *orientationLayout = new QHBoxLayout();
|
||||||
orientationLayout->addWidget(_portrait);
|
orientationLayout->addWidget(_portrait);
|
||||||
orientationLayout->addWidget(_landscape);
|
orientationLayout->addWidget(_landscape);
|
||||||
if (_printer->orientation() == QPrinter::Portrait)
|
if (_export->orientation == QPrinter::Portrait)
|
||||||
_portrait->setChecked(true);
|
_portrait->setChecked(true);
|
||||||
else
|
else
|
||||||
_landscape->setChecked(true);
|
_landscape->setChecked(true);
|
||||||
|
|
||||||
qreal top, bottom, left, right;
|
|
||||||
|
|
||||||
_printer->getPageMargins(&left, &top, &right, &bottom, _units);
|
|
||||||
QString us = _units == QPrinter::Inch ? tr("in") : tr("mm");
|
|
||||||
_topMargin = new QDoubleSpinBox();
|
_topMargin = new QDoubleSpinBox();
|
||||||
_bottomMargin = new QDoubleSpinBox();
|
_bottomMargin = new QDoubleSpinBox();
|
||||||
_leftMargin = new QDoubleSpinBox();
|
_leftMargin = new QDoubleSpinBox();
|
||||||
_rightMargin = new QDoubleSpinBox();
|
_rightMargin = new QDoubleSpinBox();
|
||||||
_topMargin->setValue(top);
|
QString us = (_export->units == Imperial) ? tr("in") : tr("mm");
|
||||||
_topMargin->setSuffix(UNIT_SPACE + us);
|
_topMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_bottomMargin->setValue(bottom);
|
|
||||||
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_leftMargin->setValue(left);
|
|
||||||
_leftMargin->setSuffix(UNIT_SPACE + us);
|
_leftMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_rightMargin->setValue(right);
|
|
||||||
_rightMargin->setSuffix(UNIT_SPACE + us);
|
_rightMargin->setSuffix(UNIT_SPACE + us);
|
||||||
if (_units == QPrinter::Inch) {
|
if (_export->units == Imperial) {
|
||||||
|
_topMargin->setValue(_export->margins.top() * MM2IN);
|
||||||
|
_bottomMargin->setValue(_export->margins.bottom() * MM2IN);
|
||||||
|
_leftMargin->setValue(_export->margins.left() * MM2IN);
|
||||||
|
_rightMargin->setValue(_export->margins.right() * MM2IN);
|
||||||
_topMargin->setSingleStep(0.1);
|
_topMargin->setSingleStep(0.1);
|
||||||
_bottomMargin->setSingleStep(0.1);
|
_bottomMargin->setSingleStep(0.1);
|
||||||
_leftMargin->setSingleStep(0.1);
|
_leftMargin->setSingleStep(0.1);
|
||||||
_rightMargin->setSingleStep(0.1);
|
_rightMargin->setSingleStep(0.1);
|
||||||
|
} else {
|
||||||
|
_topMargin->setValue(_export->margins.top());
|
||||||
|
_bottomMargin->setValue(_export->margins.bottom());
|
||||||
|
_leftMargin->setValue(_export->margins.left());
|
||||||
|
_rightMargin->setValue(_export->margins.right());
|
||||||
}
|
}
|
||||||
|
|
||||||
QGridLayout *marginsLayout = new QGridLayout();
|
QGridLayout *marginsLayout = new QGridLayout();
|
||||||
@ -91,6 +89,7 @@ ExportDialog::ExportDialog(QPrinter *printer, QWidget *parent)
|
|||||||
line->setFrameShadow(QFrame::Sunken);
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
pageSetupLayout->addRow(line);
|
pageSetupLayout->addRow(line);
|
||||||
pageSetupLayout->addRow(tr("File:"), _fileSelect);
|
pageSetupLayout->addRow(tr("File:"), _fileSelect);
|
||||||
|
pageSetupLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||||
#else // Q_OS_MAC
|
#else // Q_OS_MAC
|
||||||
pageSetupBox->setLayout(pageSetupLayout);
|
pageSetupBox->setLayout(pageSetupLayout);
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
@ -163,12 +162,16 @@ void ExportDialog::accept()
|
|||||||
QPrinter::PaperSize paperSize = static_cast<QPrinter::PaperSize>
|
QPrinter::PaperSize paperSize = static_cast<QPrinter::PaperSize>
|
||||||
(_paperSize->itemData(_paperSize->currentIndex()).toInt());
|
(_paperSize->itemData(_paperSize->currentIndex()).toInt());
|
||||||
|
|
||||||
_printer->setOutputFormat(QPrinter::PdfFormat);
|
_export->fileName = _fileSelect->file();
|
||||||
_printer->setOutputFileName(_fileSelect->file());
|
_export->paperSize = paperSize;
|
||||||
_printer->setPaperSize(paperSize);
|
_export->orientation = orientation;
|
||||||
_printer->setOrientation(orientation);
|
if (_export->units == Imperial)
|
||||||
_printer->setPageMargins(_leftMargin->value(), _topMargin->value(),
|
_export->margins = MarginsF(_leftMargin->value() / MM2IN,
|
||||||
_rightMargin->value(), _bottomMargin->value(), _units);
|
_topMargin->value() / MM2IN, _rightMargin->value() / MM2IN,
|
||||||
|
_bottomMargin->value() / MM2IN);
|
||||||
|
else
|
||||||
|
_export->margins = MarginsF(_leftMargin->value(), _topMargin->value(),
|
||||||
|
_rightMargin->value(), _bottomMargin->value());
|
||||||
|
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,29 @@
|
|||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
#include "margins.h"
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
class QRadioButton;
|
class QRadioButton;
|
||||||
class FileSelectWidget;
|
class FileSelectWidget;
|
||||||
class QDoubleSpinBox;
|
class QDoubleSpinBox;
|
||||||
|
|
||||||
|
struct Export {
|
||||||
|
QString fileName;
|
||||||
|
QPrinter::PaperSize paperSize;
|
||||||
|
QPrinter::Orientation orientation;
|
||||||
|
MarginsF margins;
|
||||||
|
|
||||||
|
Units units;
|
||||||
|
};
|
||||||
|
|
||||||
class ExportDialog : public QDialog
|
class ExportDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExportDialog(QPrinter *printer, QWidget *parent = 0);
|
ExportDialog(Export *exp, QWidget *parent = 0);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void accept();
|
void accept();
|
||||||
@ -22,9 +33,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
bool checkFile();
|
bool checkFile();
|
||||||
|
|
||||||
QPrinter *_printer;
|
Export *_export;
|
||||||
|
|
||||||
QPrinter::Unit _units;
|
|
||||||
|
|
||||||
FileSelectWidget *_fileSelect;
|
FileSelectWidget *_fileSelect;
|
||||||
QComboBox *_paperSize;
|
QComboBox *_paperSize;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QToolButton>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
@ -12,7 +13,13 @@ FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
|
|||||||
QFontMetrics fm(QApplication::font());
|
QFontMetrics fm(QApplication::font());
|
||||||
_edit = new QLineEdit();
|
_edit = new QLineEdit();
|
||||||
_edit->setMinimumWidth(fm.boundingRect(QDir::homePath()).width());
|
_edit->setMinimumWidth(fm.boundingRect(QDir::homePath()).width());
|
||||||
_button = new QPushButton(tr("Browse..."));
|
#ifdef Q_OS_WIN32
|
||||||
|
_button = new QPushButton("...");
|
||||||
|
_button->setMaximumWidth(_button->sizeHint().width() / 2);
|
||||||
|
#else // Q_OS_WIN32
|
||||||
|
_button = new QToolButton();
|
||||||
|
_button->setText("...");
|
||||||
|
#endif // Q_OS_WIN32
|
||||||
connect(_button, SIGNAL(clicked()), this, SLOT(browse()));
|
connect(_button, SIGNAL(clicked()), this, SLOT(browse()));
|
||||||
|
|
||||||
QHBoxLayout *layout = new QHBoxLayout();
|
QHBoxLayout *layout = new QHBoxLayout();
|
||||||
@ -20,6 +27,9 @@ FileSelectWidget::FileSelectWidget(QWidget *parent) : QWidget(parent)
|
|||||||
layout->addWidget(_edit);
|
layout->addWidget(_edit);
|
||||||
layout->addWidget(_button);
|
layout->addWidget(_button);
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
|
QSizePolicy p(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
|
setSizePolicy(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileSelectWidget::browse()
|
void FileSelectWidget::browse()
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
|
class QToolButton;
|
||||||
|
|
||||||
class FileSelectWidget : public QWidget
|
class FileSelectWidget : public QWidget
|
||||||
{
|
{
|
||||||
@ -22,7 +23,11 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit *_edit;
|
QLineEdit *_edit;
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
QPushButton *_button;
|
QPushButton *_button;
|
||||||
|
#else // Q_OS_WIN32
|
||||||
|
QToolButton *_button;
|
||||||
|
#endif // Q_OS_WIN32
|
||||||
|
|
||||||
QString _filter;
|
QString _filter;
|
||||||
};
|
};
|
||||||
|
364
src/fitparser.cpp
Normal file
@ -0,0 +1,364 @@
|
|||||||
|
#include <cstring>
|
||||||
|
#include <QtEndian>
|
||||||
|
#include "assert.h"
|
||||||
|
#include "fitparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
const quint32 FIT_MAGIC = 0x5449462E; // .FIT
|
||||||
|
|
||||||
|
#define RECORD_MESSAGE 20
|
||||||
|
#define TIMESTAMP_FIELD 253
|
||||||
|
|
||||||
|
|
||||||
|
FITParser::FITParser()
|
||||||
|
{
|
||||||
|
memset(_defs, 0, sizeof(_defs));
|
||||||
|
|
||||||
|
_device = 0;
|
||||||
|
_endian = 0;
|
||||||
|
_timestamp = 0;
|
||||||
|
_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FITParser::clearDefinitions()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if (_defs[i].fields)
|
||||||
|
delete[] _defs[i].fields;
|
||||||
|
if (_defs[i].devFields)
|
||||||
|
delete[] _defs[i].devFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(_defs, 0, sizeof(_defs));
|
||||||
|
}
|
||||||
|
|
||||||
|
void FITParser::warning(const char *text) const
|
||||||
|
{
|
||||||
|
const QFile *file = static_cast<QFile *>(_device);
|
||||||
|
qWarning("%s:%d: %s\n", qPrintable(file->fileName()), _len, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::readData(char *data, size_t size)
|
||||||
|
{
|
||||||
|
qint64 n;
|
||||||
|
|
||||||
|
n = _device->read(data, size);
|
||||||
|
if (n < 0) {
|
||||||
|
_errorString = "I/O error";
|
||||||
|
return false;
|
||||||
|
} else if ((size_t)n < size) {
|
||||||
|
_errorString = "Premature end of data";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T> bool FITParser::readValue(T &val)
|
||||||
|
{
|
||||||
|
T data;
|
||||||
|
|
||||||
|
if (!readData((char*)&data, sizeof(T)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
_len -= sizeof(T);
|
||||||
|
|
||||||
|
if (sizeof(T) > 1) {
|
||||||
|
if (_endian)
|
||||||
|
val = qFromBigEndian(data);
|
||||||
|
else
|
||||||
|
val = qFromLittleEndian(data);
|
||||||
|
} else
|
||||||
|
val = data;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::skipValue(size_t size)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
quint8 val;
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
if (!readValue(val))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parseDefinitionMessage(quint8 header)
|
||||||
|
{
|
||||||
|
int local_id = header & 0x0f;
|
||||||
|
MessageDefinition* def = &_defs[local_id];
|
||||||
|
quint8 i;
|
||||||
|
|
||||||
|
|
||||||
|
if (def->fields) {
|
||||||
|
delete[] def->fields;
|
||||||
|
def->fields = 0;
|
||||||
|
}
|
||||||
|
if (def->devFields) {
|
||||||
|
delete[] def->devFields;
|
||||||
|
def->devFields = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reserved/unused
|
||||||
|
if (!readValue(i))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// endianness
|
||||||
|
if (!readValue(def->endian))
|
||||||
|
return false;
|
||||||
|
if (def->endian > 1) {
|
||||||
|
_errorString = "Bad endian field";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_endian = def->endian;
|
||||||
|
|
||||||
|
// global message number
|
||||||
|
if (!readValue(def->globalId))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// number of records
|
||||||
|
if (!readValue(def->numFields))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// definition records
|
||||||
|
def->fields = new Field[def->numFields];
|
||||||
|
for (i = 0; i < def->numFields; i++) {
|
||||||
|
STATIC_ASSERT(sizeof(def->fields[i]) == 3);
|
||||||
|
if (!readData((char*)&(def->fields[i]), sizeof(def->fields[i])))
|
||||||
|
return false;
|
||||||
|
_len -= sizeof(def->fields[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// developer definition records
|
||||||
|
if (header & 0x20) {
|
||||||
|
if (!readValue(def->numDevFields))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
def->devFields = new Field[def->numDevFields];
|
||||||
|
for (i = 0; i < def->numDevFields; i++) {
|
||||||
|
STATIC_ASSERT(sizeof(def->devFields[i]) == 3);
|
||||||
|
if (!readData((char*)&(def->devFields[i]),
|
||||||
|
sizeof(def->devFields[i])))
|
||||||
|
return false;
|
||||||
|
_len -= sizeof(def->devFields[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::readField(Field *f, quint32 &val)
|
||||||
|
{
|
||||||
|
quint8 v8 = (quint8)-1;
|
||||||
|
quint16 v16 = (quint16)-1;
|
||||||
|
bool ret;
|
||||||
|
|
||||||
|
val = (quint32)-1;
|
||||||
|
|
||||||
|
switch (f->type) {
|
||||||
|
case 1: // sint8
|
||||||
|
case 2: // uint8
|
||||||
|
if (f->size == 1) {
|
||||||
|
ret = readValue(v8);
|
||||||
|
val = v8;
|
||||||
|
} else
|
||||||
|
ret = skipValue(f->size);
|
||||||
|
break;
|
||||||
|
case 0x83: // sint16
|
||||||
|
case 0x84: // uint16
|
||||||
|
if (f->size == 2) {
|
||||||
|
ret = readValue(v16);
|
||||||
|
val = v16;
|
||||||
|
} else
|
||||||
|
ret = skipValue(f->size);
|
||||||
|
break;
|
||||||
|
case 0x85: // sint32
|
||||||
|
case 0x86: // uint32
|
||||||
|
if (f->size == 4)
|
||||||
|
ret = readValue(val);
|
||||||
|
else
|
||||||
|
ret = skipValue(f->size);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ret = skipValue(f->size);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parseData(TrackData &track, MessageDefinition *def,
|
||||||
|
quint8 offset)
|
||||||
|
{
|
||||||
|
Field *field;
|
||||||
|
quint32 timestamp = _timestamp + offset;
|
||||||
|
quint32 val;
|
||||||
|
Trackpoint trackpoint;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
if (!def->fields && !def->devFields) {
|
||||||
|
_errorString = "Undefined data message";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_endian = def->endian;
|
||||||
|
|
||||||
|
for (i = 0; i < def->numFields; i++) {
|
||||||
|
field = &def->fields[i];
|
||||||
|
if (!readField(field, val))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (field->id == TIMESTAMP_FIELD)
|
||||||
|
_timestamp = timestamp = val;
|
||||||
|
else if (def->globalId == RECORD_MESSAGE) {
|
||||||
|
switch (field->id) {
|
||||||
|
case 0:
|
||||||
|
if (val != 0x7fffffff)
|
||||||
|
trackpoint.rcoordinates().setLat(
|
||||||
|
((qint32)val / (double)0x7fffffff) * 180);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (val != 0x7fffffff)
|
||||||
|
trackpoint.rcoordinates().setLon(
|
||||||
|
((qint32)val / (double)0x7fffffff) * 180);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
if (val != 0xffff)
|
||||||
|
trackpoint.setElevation((val / 5.0) - 500);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (val != 0xff)
|
||||||
|
trackpoint.setHeartRate(val);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
if (val != 0xff)
|
||||||
|
trackpoint.setCadence(val);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
if (val != 0xffff)
|
||||||
|
trackpoint.setSpeed(val / 1000.0f);
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if (val != 0xffff)
|
||||||
|
trackpoint.setPower(val);
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
if (val != 0x7f)
|
||||||
|
trackpoint.setTemperature((qint8)val);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < def->numDevFields; i++) {
|
||||||
|
field = &def->devFields[i];
|
||||||
|
if (!readField(field, val))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (def->globalId == RECORD_MESSAGE) {
|
||||||
|
if (trackpoint.coordinates().isValid()) {
|
||||||
|
trackpoint.setTimestamp(QDateTime::fromTime_t(timestamp
|
||||||
|
+ 631065600));
|
||||||
|
track.append(trackpoint);
|
||||||
|
} else {
|
||||||
|
if (trackpoint.coordinates().isNull())
|
||||||
|
warning("Missing coordinates");
|
||||||
|
else {
|
||||||
|
_errorString = "Invalid coordinates";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parseDataMessage(TrackData &track, quint8 header)
|
||||||
|
{
|
||||||
|
int local_id = header & 0xf;
|
||||||
|
MessageDefinition* def = &_defs[local_id];
|
||||||
|
return parseData(track, def, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parseCompressedMessage(TrackData &track, quint8 header)
|
||||||
|
{
|
||||||
|
int local_id = (header >> 5) & 3;
|
||||||
|
MessageDefinition* def = &_defs[local_id];
|
||||||
|
return parseData(track, def, header & 0x1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parseRecord(TrackData &track)
|
||||||
|
{
|
||||||
|
quint8 header;
|
||||||
|
|
||||||
|
if (!readValue(header))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (header & 0x80)
|
||||||
|
return parseCompressedMessage(track, header);
|
||||||
|
else if (header & 0x40)
|
||||||
|
return parseDefinitionMessage(header);
|
||||||
|
else
|
||||||
|
return parseDataMessage(track, header);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parseHeader()
|
||||||
|
{
|
||||||
|
FileHeader hdr;
|
||||||
|
quint16 crc;
|
||||||
|
qint64 len;
|
||||||
|
|
||||||
|
STATIC_ASSERT(sizeof(hdr) == 12);
|
||||||
|
len = _device->read((char*)&hdr, sizeof(hdr));
|
||||||
|
if (len < 0) {
|
||||||
|
_errorString = "I/O error";
|
||||||
|
return false;
|
||||||
|
} else if ((size_t)len < sizeof(hdr)
|
||||||
|
|| hdr.magic != qToLittleEndian(FIT_MAGIC)) {
|
||||||
|
_errorString = "Not a FIT file";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_len = qFromLittleEndian(hdr.dataSize);
|
||||||
|
|
||||||
|
if (hdr.headerSize > sizeof(hdr))
|
||||||
|
if (!readData((char *)&crc, sizeof(crc)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FITParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
Q_UNUSED(routes);
|
||||||
|
Q_UNUSED(waypoints);
|
||||||
|
bool ret = true;
|
||||||
|
|
||||||
|
_device = file;
|
||||||
|
_endian = 0;
|
||||||
|
_timestamp = 0;
|
||||||
|
|
||||||
|
if (!parseHeader())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
tracks.append(TrackData());
|
||||||
|
TrackData &track = tracks.last();
|
||||||
|
|
||||||
|
while (_len)
|
||||||
|
if ((ret = parseRecord(track)) == false)
|
||||||
|
break;
|
||||||
|
|
||||||
|
clearDefinitions();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
66
src/fitparser.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#ifndef FITPARSER_H
|
||||||
|
#define FITPARSER_H
|
||||||
|
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
class FITParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FITParser();
|
||||||
|
~FITParser() {}
|
||||||
|
|
||||||
|
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||||
|
QList<Waypoint> &waypoints);
|
||||||
|
QString errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return 0;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct FileHeader {
|
||||||
|
quint8 headerSize;
|
||||||
|
quint8 protocolVersion;
|
||||||
|
quint16 profileVersion;
|
||||||
|
quint32 dataSize;
|
||||||
|
quint32 magic;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Field {
|
||||||
|
quint8 id;
|
||||||
|
quint8 size;
|
||||||
|
quint8 type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MessageDefinition {
|
||||||
|
quint8 endian;
|
||||||
|
quint16 globalId;
|
||||||
|
quint8 numFields;
|
||||||
|
Field *fields;
|
||||||
|
quint8 numDevFields;
|
||||||
|
Field *devFields;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void warning(const char *text) const;
|
||||||
|
void clearDefinitions();
|
||||||
|
|
||||||
|
bool readData(char *data, size_t size);
|
||||||
|
template<class T> bool readValue(T &val);
|
||||||
|
bool skipValue(size_t size);
|
||||||
|
|
||||||
|
bool parseHeader();
|
||||||
|
bool parseRecord(TrackData &track);
|
||||||
|
bool parseDefinitionMessage(quint8 header);
|
||||||
|
bool parseCompressedMessage(TrackData &track, quint8 header);
|
||||||
|
bool parseDataMessage(TrackData &track, quint8 header);
|
||||||
|
bool parseData(TrackData &track, MessageDefinition *def, quint8 offset);
|
||||||
|
bool readField(Field *f, quint32 &val);
|
||||||
|
|
||||||
|
QIODevice *_device;
|
||||||
|
QString _errorString;
|
||||||
|
|
||||||
|
quint32 _len;
|
||||||
|
quint8 _endian;
|
||||||
|
quint32 _timestamp;
|
||||||
|
MessageDefinition _defs[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FITPARSER_H
|
53
src/format.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#include <QApplication>
|
||||||
|
#include "coordinates.h"
|
||||||
|
#include "format.h"
|
||||||
|
|
||||||
|
QString Format::timeSpan(qreal time)
|
||||||
|
{
|
||||||
|
unsigned h, m, s;
|
||||||
|
|
||||||
|
h = time / 3600;
|
||||||
|
m = (time - (h * 3600)) / 60;
|
||||||
|
s = time - (h * 3600) - (m * 60);
|
||||||
|
|
||||||
|
return QString("%1:%2:%3").arg(h).arg(m, 2, 10, QChar('0'))
|
||||||
|
.arg(s, 2, 10, QChar('0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Format::distance(qreal value, Units units)
|
||||||
|
{
|
||||||
|
if (units == Imperial) {
|
||||||
|
if (value < MIINM)
|
||||||
|
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "ft");
|
||||||
|
else
|
||||||
|
return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "mi");
|
||||||
|
} else {
|
||||||
|
if (value < KMINM)
|
||||||
|
return QString::number(value, 'f', 0) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "m");
|
||||||
|
else
|
||||||
|
return QString::number(value * M2KM, 'f', 1) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "km");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Format::elevation(qreal value, Units units)
|
||||||
|
{
|
||||||
|
if (units == Metric)
|
||||||
|
return QString::number(value, 'f', 0) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "m");
|
||||||
|
else
|
||||||
|
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "ft");
|
||||||
|
}
|
||||||
|
|
||||||
|
QString Format::coordinates(const Coordinates &value)
|
||||||
|
{
|
||||||
|
QChar yH = (value.lat() < 0) ? 'S' : 'N';
|
||||||
|
QChar xH = (value.lon() < 0) ? 'W' : 'E';
|
||||||
|
|
||||||
|
return QString::number(qAbs(value.lat()), 'f', 5) + yH + "," + QChar(0x00A0)
|
||||||
|
+ QString::number(qAbs(value.lon()), 'f', 5) + xH;
|
||||||
|
}
|
17
src/format.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#ifndef FORMAT_H
|
||||||
|
#define FORMAT_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include "units.h"
|
||||||
|
|
||||||
|
class Coordinates;
|
||||||
|
|
||||||
|
namespace Format
|
||||||
|
{
|
||||||
|
QString timeSpan(qreal time);
|
||||||
|
QString distance(qreal value, Units units);
|
||||||
|
QString elevation(qreal value, Units units);
|
||||||
|
QString coordinates(const Coordinates &value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // FORMAT_H
|
28
src/gpx.cpp
@ -1,28 +0,0 @@
|
|||||||
#include <QFile>
|
|
||||||
#include <QLineF>
|
|
||||||
#include "ll.h"
|
|
||||||
#include "gpx.h"
|
|
||||||
|
|
||||||
|
|
||||||
bool GPX::loadFile(const QString &fileName)
|
|
||||||
{
|
|
||||||
QFile file(fileName);
|
|
||||||
bool ret;
|
|
||||||
|
|
||||||
_tracks.clear();
|
|
||||||
_error.clear();
|
|
||||||
_errorLine = 0;
|
|
||||||
|
|
||||||
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
|
||||||
_error = qPrintable(file.errorString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(ret = _parser.loadFile(&file))) {
|
|
||||||
_error = _parser.errorString();
|
|
||||||
_errorLine = _parser.errorLine();
|
|
||||||
}
|
|
||||||
file.close();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
33
src/gpx.h
@ -1,33 +0,0 @@
|
|||||||
#ifndef GPX_H
|
|
||||||
#define GPX_H
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
#include <QList>
|
|
||||||
#include <QPointF>
|
|
||||||
#include <QString>
|
|
||||||
#include "waypoint.h"
|
|
||||||
#include "track.h"
|
|
||||||
#include "parser.h"
|
|
||||||
|
|
||||||
class GPX
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
GPX() : _parser(_tracks, _waypoints), _errorLine(0) {}
|
|
||||||
bool loadFile(const QString &fileName);
|
|
||||||
const QString &errorString() const {return _error;}
|
|
||||||
int errorLine() const {return _errorLine;}
|
|
||||||
|
|
||||||
int trackCount() const {return _tracks.count();}
|
|
||||||
Track track(int i) const {return Track(_tracks.at(i));}
|
|
||||||
const QList<Waypoint> &waypoints() const {return _waypoints;}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Parser _parser;
|
|
||||||
QString _error;
|
|
||||||
int _errorLine;
|
|
||||||
|
|
||||||
QList<QVector<Trackpoint> > _tracks;
|
|
||||||
QList<Waypoint> _waypoints;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // GPX_H
|
|
202
src/gpxparser.cpp
Normal file
@ -0,0 +1,202 @@
|
|||||||
|
#include "gpxparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
qreal GPXParser::number()
|
||||||
|
{
|
||||||
|
bool res;
|
||||||
|
qreal ret = _reader.readElementText().toDouble(&res);
|
||||||
|
if (!res)
|
||||||
|
_reader.raiseError(QString("Invalid %1").arg(
|
||||||
|
_reader.name().toString()));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDateTime GPXParser::time()
|
||||||
|
{
|
||||||
|
QDateTime d = QDateTime::fromString(_reader.readElementText(),
|
||||||
|
Qt::ISODate);
|
||||||
|
if (!d.isValid())
|
||||||
|
_reader.raiseError(QString("Invalid %1").arg(
|
||||||
|
_reader.name().toString()));
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
Coordinates GPXParser::coordinates()
|
||||||
|
{
|
||||||
|
bool res;
|
||||||
|
qreal lon, lat;
|
||||||
|
const QXmlStreamAttributes &attr = _reader.attributes();
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
lon = attr.value("lon").toString().toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
lon = attr.value("lon").toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res || (lon < -180.0 || lon > 180.0)) {
|
||||||
|
_reader.raiseError("Invalid longitude");
|
||||||
|
return Coordinates();
|
||||||
|
}
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
lat = attr.value("lat").toString().toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
lat = attr.value("lat").toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res || (lat < -90.0 || lat > 90.0)) {
|
||||||
|
_reader.raiseError("Invalid latitude");
|
||||||
|
return Coordinates();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Coordinates(lon, lat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::tpExtension(Trackpoint &trackpoint)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "hr")
|
||||||
|
trackpoint.setHeartRate(number());
|
||||||
|
else if (_reader.name() == "atemp")
|
||||||
|
trackpoint.setTemperature(number());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::extensions(Trackpoint &trackpoint)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "speed")
|
||||||
|
trackpoint.setSpeed(number());
|
||||||
|
else if (_reader.name() == "hr" || _reader.name() == "heartrate")
|
||||||
|
trackpoint.setHeartRate(number());
|
||||||
|
else if (_reader.name() == "temp")
|
||||||
|
trackpoint.setTemperature(number());
|
||||||
|
else if (_reader.name() == "cadence")
|
||||||
|
trackpoint.setCadence(number());
|
||||||
|
else if (_reader.name() == "power")
|
||||||
|
trackpoint.setPower(number());
|
||||||
|
else if (_reader.name() == "TrackPointExtension")
|
||||||
|
tpExtension(trackpoint);
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::trackpointData(Trackpoint &trackpoint)
|
||||||
|
{
|
||||||
|
qreal gh = NAN;
|
||||||
|
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "ele")
|
||||||
|
trackpoint.setElevation(number());
|
||||||
|
else if (_reader.name() == "time")
|
||||||
|
trackpoint.setTimestamp(time());
|
||||||
|
else if (_reader.name() == "geoidheight")
|
||||||
|
gh = number();
|
||||||
|
else if (_reader.name() == "extensions")
|
||||||
|
extensions(trackpoint);
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!std::isnan(gh) && !std::isnan(trackpoint.elevation()))
|
||||||
|
trackpoint.setElevation(trackpoint.elevation() - gh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::waypointData(Waypoint &waypoint)
|
||||||
|
{
|
||||||
|
qreal gh = NAN;
|
||||||
|
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "name")
|
||||||
|
waypoint.setName(_reader.readElementText());
|
||||||
|
else if (_reader.name() == "desc")
|
||||||
|
waypoint.setDescription(_reader.readElementText());
|
||||||
|
else if (_reader.name() == "ele")
|
||||||
|
waypoint.setElevation(number());
|
||||||
|
else if (_reader.name() == "geoidheight")
|
||||||
|
gh = number();
|
||||||
|
else if (_reader.name() == "time")
|
||||||
|
waypoint.setTimestamp(time());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!std::isnan(gh) && !std::isnan(waypoint.elevation()))
|
||||||
|
waypoint.setElevation(waypoint.elevation() - gh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::trackpoints(TrackData &track)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "trkpt") {
|
||||||
|
track.append(Trackpoint(coordinates()));
|
||||||
|
trackpointData(track.last());
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::routepoints(RouteData &route)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "rtept") {
|
||||||
|
route.append(Waypoint(coordinates()));
|
||||||
|
waypointData(route.last());
|
||||||
|
} else if (_reader.name() == "name")
|
||||||
|
route.setName(_reader.readElementText());
|
||||||
|
else if (_reader.name() == "desc")
|
||||||
|
route.setDescription(_reader.readElementText());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::track(TrackData &track)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "trkseg")
|
||||||
|
trackpoints(track);
|
||||||
|
else if (_reader.name() == "name")
|
||||||
|
track.setName(_reader.readElementText());
|
||||||
|
else if (_reader.name() == "desc")
|
||||||
|
track.setDescription(_reader.readElementText());
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPXParser::gpx(QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||||
|
QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "trk") {
|
||||||
|
tracks.append(TrackData());
|
||||||
|
track(tracks.back());
|
||||||
|
} else if (_reader.name() == "rte") {
|
||||||
|
routes.append(RouteData());
|
||||||
|
routepoints(routes.back());
|
||||||
|
} else if (_reader.name() == "wpt") {
|
||||||
|
waypoints.append(Waypoint(coordinates()));
|
||||||
|
waypointData(waypoints.last());
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GPXParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
_reader.clear();
|
||||||
|
_reader.setDevice(file);
|
||||||
|
|
||||||
|
if (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "gpx")
|
||||||
|
gpx(tracks, routes, waypoints);
|
||||||
|
else
|
||||||
|
_reader.raiseError("Not a GPX file");
|
||||||
|
}
|
||||||
|
|
||||||
|
return !_reader.error();
|
||||||
|
}
|
35
src/gpxparser.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef GPXPARSER_H
|
||||||
|
#define GPXPARSER_H
|
||||||
|
|
||||||
|
#include <QXmlStreamReader>
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class GPXParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
~GPXParser() {}
|
||||||
|
|
||||||
|
bool parse(QFile *file, QList<TrackData> &tracks,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints);
|
||||||
|
QString errorString() const {return _reader.errorString();}
|
||||||
|
int errorLine() const {return _reader.lineNumber();}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void gpx(QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||||
|
QList<Waypoint> &waypoints);
|
||||||
|
void track(TrackData &track);
|
||||||
|
void trackpoints(TrackData &track);
|
||||||
|
void routepoints(RouteData &route);
|
||||||
|
void tpExtension(Trackpoint &trackpoint);
|
||||||
|
void extensions(Trackpoint &trackpoint);
|
||||||
|
void trackpointData(Trackpoint &trackpoint);
|
||||||
|
void waypointData(Waypoint &waypoint);
|
||||||
|
qreal number();
|
||||||
|
QDateTime time();
|
||||||
|
Coordinates coordinates();
|
||||||
|
|
||||||
|
QXmlStreamReader _reader;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GPXPARSER_H
|
10
src/graph.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "graph.h"
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug dbg, const GraphPoint &point)
|
||||||
|
{
|
||||||
|
const bool ais = dbg.autoInsertSpaces();
|
||||||
|
dbg.nospace() << "GraphPoint(" << point.s() << ", " << point.t() << ", "
|
||||||
|
<< point.y() << ")";
|
||||||
|
dbg.setAutoInsertSpaces(ais);
|
||||||
|
return dbg.maybeSpace();
|
||||||
|
}
|
36
src/graph.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef GRAPH_H
|
||||||
|
#define GRAPH_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
enum GraphType {Distance, Time};
|
||||||
|
|
||||||
|
class GraphPoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GraphPoint(qreal s = NAN, qreal t = NAN, qreal y = NAN)
|
||||||
|
: _s(s), _t(t), _y(y) {}
|
||||||
|
|
||||||
|
qreal s() const {return _s;}
|
||||||
|
qreal t() const {return _t;}
|
||||||
|
qreal y() const {return _y;}
|
||||||
|
qreal x(GraphType type) const {return (type == Distance) ? _s : _t;}
|
||||||
|
|
||||||
|
void setS(qreal s) {_s = s;}
|
||||||
|
void setT(qreal t) {_t = t;}
|
||||||
|
void setY(qreal y) {_y = y;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
qreal _s;
|
||||||
|
qreal _t;
|
||||||
|
qreal _y;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_TYPEINFO(GraphPoint, Q_PRIMITIVE_TYPE);
|
||||||
|
QDebug operator<<(QDebug dbg, const GraphPoint &point);
|
||||||
|
|
||||||
|
typedef QVector<GraphPoint> Graph;
|
||||||
|
|
||||||
|
#endif // GRAPH_H
|
201
src/graphitem.cpp
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
#include <QPainter>
|
||||||
|
#include "graphitem.h"
|
||||||
|
|
||||||
|
|
||||||
|
GraphItem::GraphItem(const Graph &graph, QGraphicsItem *parent)
|
||||||
|
: QGraphicsObject(parent)
|
||||||
|
{
|
||||||
|
_id = 0;
|
||||||
|
_width = 1;
|
||||||
|
|
||||||
|
_pen = QPen(Qt::black, _width);
|
||||||
|
|
||||||
|
_type = Distance;
|
||||||
|
_graph = graph;
|
||||||
|
_sx = 1.0; _sy = 1.0;
|
||||||
|
|
||||||
|
_time = true;
|
||||||
|
for (int i = 0; i < _graph.size(); i++) {
|
||||||
|
if (std::isnan(_graph.at(i).t())) {
|
||||||
|
_time = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setZValue(1.0);
|
||||||
|
|
||||||
|
updatePath();
|
||||||
|
updateBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget)
|
||||||
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
|
||||||
|
painter->setPen(_pen);
|
||||||
|
painter->drawPath(_path);
|
||||||
|
|
||||||
|
/*
|
||||||
|
QPen p = QPen(QBrush(Qt::red), 0);
|
||||||
|
painter->setPen(p);
|
||||||
|
painter->drawRect(boundingRect());
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::setGraphType(GraphType type)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_type = type;
|
||||||
|
updatePath();
|
||||||
|
updateBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::setColor(const QColor &color)
|
||||||
|
{
|
||||||
|
_pen.setColor(color);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::setWidth(int width)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_width = width;
|
||||||
|
_pen.setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal GraphItem::yAtX(qreal x)
|
||||||
|
{
|
||||||
|
int low = 0;
|
||||||
|
int high = _graph.count() - 1;
|
||||||
|
int mid = 0;
|
||||||
|
|
||||||
|
Q_ASSERT(high > low);
|
||||||
|
Q_ASSERT(x >= _graph.at(low).x(_type) && x <= _graph.at(high).x(_type));
|
||||||
|
|
||||||
|
while (low <= high) {
|
||||||
|
mid = low + ((high - low) / 2);
|
||||||
|
const GraphPoint &p = _graph.at(mid);
|
||||||
|
if (p.x(_type) > x)
|
||||||
|
high = mid - 1;
|
||||||
|
else if (p.x(_type) < x)
|
||||||
|
low = mid + 1;
|
||||||
|
else
|
||||||
|
return -p.y();
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF l;
|
||||||
|
if (_graph.at(mid).x(_type) < x)
|
||||||
|
l = QLineF(_graph.at(mid).x(_type), _graph.at(mid).y(),
|
||||||
|
_graph.at(mid+1).x(_type), _graph.at(mid+1).y());
|
||||||
|
else
|
||||||
|
l = QLineF(_graph.at(mid-1).x(_type), _graph.at(mid-1).y(),
|
||||||
|
_graph.at(mid).x(_type), _graph.at(mid).y());
|
||||||
|
|
||||||
|
return -l.pointAt((x - l.p1().x()) / (l.p2().x() - l.p1().x())).y();
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal GraphItem::distanceAtTime(qreal time)
|
||||||
|
{
|
||||||
|
int low = 0;
|
||||||
|
int high = _graph.count() - 1;
|
||||||
|
int mid = 0;
|
||||||
|
|
||||||
|
Q_ASSERT(high > low);
|
||||||
|
Q_ASSERT(time >= _graph.at(low).t() && time <= _graph.at(high).t());
|
||||||
|
|
||||||
|
while (low <= high) {
|
||||||
|
mid = low + ((high - low) / 2);
|
||||||
|
const GraphPoint &p = _graph.at(mid);
|
||||||
|
if (p.t() > time)
|
||||||
|
high = mid - 1;
|
||||||
|
else if (p.t() < time)
|
||||||
|
low = mid + 1;
|
||||||
|
else
|
||||||
|
return _graph.at(mid).s();
|
||||||
|
}
|
||||||
|
|
||||||
|
QLineF l;
|
||||||
|
if (_graph.at(mid).t() < time)
|
||||||
|
l = QLineF(_graph.at(mid).t(), _graph.at(mid).s(), _graph.at(mid+1).t(),
|
||||||
|
_graph.at(mid+1).s());
|
||||||
|
else
|
||||||
|
l = QLineF(_graph.at(mid-1).t(), _graph.at(mid-1).s(),
|
||||||
|
_graph.at(mid).t(), _graph.at(mid).s());
|
||||||
|
|
||||||
|
return l.pointAt((time - l.p1().x()) / (l.p2().x() - l.p1().x())).y();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::emitSliderPositionChanged(qreal pos)
|
||||||
|
{
|
||||||
|
if (_type == Time) {
|
||||||
|
if (_time) {
|
||||||
|
if (pos >= _graph.first().t() && pos <= _graph.last().t())
|
||||||
|
emit sliderPositionChanged(distanceAtTime(pos));
|
||||||
|
else
|
||||||
|
emit sliderPositionChanged(NAN);
|
||||||
|
} else
|
||||||
|
emit sliderPositionChanged(NAN);
|
||||||
|
} else
|
||||||
|
emit sliderPositionChanged(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::selected(bool selected)
|
||||||
|
{
|
||||||
|
if (selected) {
|
||||||
|
_pen.setWidth(_width + 1);
|
||||||
|
setZValue(zValue() + 1.0);
|
||||||
|
} else {
|
||||||
|
_pen.setWidth(_width);
|
||||||
|
setZValue(zValue() - 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::setScale(qreal sx, qreal sy)
|
||||||
|
{
|
||||||
|
if (_sx == sx && _sy == sy)
|
||||||
|
return;
|
||||||
|
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_sx = sx; _sy = sy;
|
||||||
|
updatePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::updatePath()
|
||||||
|
{
|
||||||
|
_path = QPainterPath();
|
||||||
|
|
||||||
|
if (_type == Time && !_time)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_path.moveTo(_graph.first().x(_type) * _sx, -_graph.first().y() * _sy);
|
||||||
|
for (int i = 1; i < _graph.size(); i++)
|
||||||
|
_path.lineTo(_graph.at(i).x(_type) * _sx, -_graph.at(i).y() * _sy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphItem::updateBounds()
|
||||||
|
{
|
||||||
|
if (_type == Time && !_time) {
|
||||||
|
_bounds = QRectF();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal bottom, top, left, right;
|
||||||
|
|
||||||
|
QPointF p = QPointF(_graph.first().x(_type), -_graph.first().y());
|
||||||
|
bottom = p.y(); top = p.y(); left = p.x(); right = p.x();
|
||||||
|
|
||||||
|
for (int i = 1; i < _graph.size(); i++) {
|
||||||
|
p = QPointF(_graph.at(i).x(_type), -_graph.at(i).y());
|
||||||
|
bottom = qMax(bottom, p.y()); top = qMin(top, p.y());
|
||||||
|
right = qMax(right, p.x()); left = qMin(left, p.x());
|
||||||
|
}
|
||||||
|
|
||||||
|
_bounds = QRectF(QPointF(left, top), QPointF(right, bottom));
|
||||||
|
}
|
57
src/graphitem.h
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#ifndef GRAPHITEM_H
|
||||||
|
#define GRAPHITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsObject>
|
||||||
|
#include <QPen>
|
||||||
|
#include "graph.h"
|
||||||
|
|
||||||
|
class GraphItem : public QGraphicsObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GraphItem(const Graph &graph, QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
|
QRectF boundingRect() const
|
||||||
|
{return _path.boundingRect();}
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget);
|
||||||
|
|
||||||
|
const QRectF &bounds() const {return _bounds;}
|
||||||
|
void setScale(qreal sx, qreal sy);
|
||||||
|
|
||||||
|
void setGraphType(GraphType type);
|
||||||
|
int id() const {return _id;}
|
||||||
|
void setId(int id) {_id = id;}
|
||||||
|
void setColor(const QColor &color);
|
||||||
|
void setWidth(int width);
|
||||||
|
|
||||||
|
qreal yAtX(qreal x);
|
||||||
|
qreal distanceAtTime(qreal time);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void sliderPositionChanged(qreal);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void emitSliderPositionChanged(qreal);
|
||||||
|
void selected(bool selected);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updatePath();
|
||||||
|
void updateBounds();
|
||||||
|
|
||||||
|
int _id;
|
||||||
|
QPen _pen;
|
||||||
|
int _width;
|
||||||
|
|
||||||
|
Graph _graph;
|
||||||
|
GraphType _type;
|
||||||
|
|
||||||
|
QPainterPath _path;
|
||||||
|
QRectF _bounds;
|
||||||
|
qreal _sx, _sy;
|
||||||
|
|
||||||
|
bool _time;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GRAPHITEM_H
|
29
src/graphtab.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#ifndef GRAPHTAB_H
|
||||||
|
#define GRAPHTAB_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include "graphview.h"
|
||||||
|
#include "units.h"
|
||||||
|
#include "timetype.h"
|
||||||
|
|
||||||
|
class Data;
|
||||||
|
class PathItem;
|
||||||
|
|
||||||
|
class GraphTab : public GraphView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GraphTab(QWidget *parent = 0) : GraphView(parent)
|
||||||
|
{setFrameShape(QFrame::NoFrame);}
|
||||||
|
|
||||||
|
virtual QString label() const = 0;
|
||||||
|
virtual void loadData(const Data &data, const QList<PathItem *> &paths) = 0;
|
||||||
|
virtual void clear() {}
|
||||||
|
virtual void setUnits(enum Units units) {Q_UNUSED(units)}
|
||||||
|
virtual void setTimeType(enum TimeType type) {Q_UNUSED(type)}
|
||||||
|
virtual void showTracks(bool show) {Q_UNUSED(show)}
|
||||||
|
virtual void showRoutes(bool show) {Q_UNUSED(show)}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GRAPHTAB_H
|
@ -1,59 +1,63 @@
|
|||||||
#include <QGraphicsView>
|
#include <QGraphicsScene>
|
||||||
#include <QGraphicsSceneMouseEvent>
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QMouseEvent>
|
||||||
#include <QPaintEngine>
|
#include <QPaintEngine>
|
||||||
#include <QPaintDevice>
|
#include <QPaintDevice>
|
||||||
|
#include "opengl.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "axisitem.h"
|
#include "axisitem.h"
|
||||||
#include "slideritem.h"
|
#include "slideritem.h"
|
||||||
#include "sliderinfoitem.h"
|
#include "sliderinfoitem.h"
|
||||||
#include "infoitem.h"
|
#include "infoitem.h"
|
||||||
|
#include "griditem.h"
|
||||||
|
#include "graph.h"
|
||||||
|
#include "graphitem.h"
|
||||||
|
#include "pathitem.h"
|
||||||
#include "graphview.h"
|
#include "graphview.h"
|
||||||
|
|
||||||
|
|
||||||
#define MARGIN 10.0
|
#define MARGIN 10.0
|
||||||
|
|
||||||
void Scene::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
|
||||||
{
|
|
||||||
if (e->button() == Qt::LeftButton)
|
|
||||||
emit mouseClicked(e->scenePos());
|
|
||||||
|
|
||||||
QGraphicsScene::mousePressEvent(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GraphView::GraphView(QWidget *parent)
|
GraphView::GraphView(QWidget *parent)
|
||||||
: QGraphicsView(parent)
|
: QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
_scene = new Scene(this);
|
_scene = new QGraphicsScene(this);
|
||||||
setScene(_scene);
|
setScene(_scene);
|
||||||
|
|
||||||
|
setBackgroundBrush(QBrush(Qt::white));
|
||||||
|
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||||
|
setRenderHint(QPainter::Antialiasing, true);
|
||||||
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
_xAxis = new AxisItem(AxisItem::X);
|
_xAxis = new AxisItem(AxisItem::X);
|
||||||
|
_xAxis->setZValue(2.0);
|
||||||
_yAxis = new AxisItem(AxisItem::Y);
|
_yAxis = new AxisItem(AxisItem::Y);
|
||||||
|
_yAxis->setZValue(2.0);
|
||||||
_slider = new SliderItem();
|
_slider = new SliderItem();
|
||||||
_slider->setZValue(2.0);
|
_slider->setZValue(3.0);
|
||||||
|
_sliderInfo = new SliderInfoItem(_slider);
|
||||||
|
_sliderInfo->setZValue(3.0);
|
||||||
|
_info = new InfoItem();
|
||||||
|
_grid = new GridItem();
|
||||||
|
|
||||||
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
|
connect(_slider, SIGNAL(positionChanged(const QPointF&)), this,
|
||||||
SLOT(emitSliderPositionChanged(const QPointF&)));
|
SLOT(emitSliderPositionChanged(const QPointF&)));
|
||||||
connect(_scene, SIGNAL(mouseClicked(const QPointF&)), this,
|
|
||||||
SLOT(newSliderPosition(const QPointF&)));
|
|
||||||
|
|
||||||
_info = new InfoItem();
|
_width = 1;
|
||||||
|
|
||||||
_sliderInfo = new SliderInfoItem(_slider);
|
|
||||||
_sliderInfo->setZValue(2.0);
|
|
||||||
|
|
||||||
_xScale = 1;
|
_xScale = 1;
|
||||||
_yScale = 1;
|
_yScale = 1;
|
||||||
|
_yOffset = 0;
|
||||||
|
|
||||||
_precision = 0;
|
_precision = 0;
|
||||||
_minYRange = 0.01;
|
_minYRange = 0.01;
|
||||||
|
|
||||||
_sliderPos = 0;
|
_sliderPos = 0;
|
||||||
|
|
||||||
|
_units = Metric;
|
||||||
|
_graphType = Distance;
|
||||||
|
_xLabel = tr("Distance");
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphView::~GraphView()
|
GraphView::~GraphView()
|
||||||
@ -62,24 +66,16 @@ GraphView::~GraphView()
|
|||||||
delete _xAxis;
|
delete _xAxis;
|
||||||
if (_yAxis->scene() != _scene)
|
if (_yAxis->scene() != _scene)
|
||||||
delete _yAxis;
|
delete _yAxis;
|
||||||
|
|
||||||
if (_slider->scene() != _scene)
|
if (_slider->scene() != _scene)
|
||||||
delete _slider;
|
delete _slider;
|
||||||
|
|
||||||
if (_info->scene() != _scene)
|
if (_info->scene() != _scene)
|
||||||
delete _info;
|
delete _info;
|
||||||
}
|
if (_grid->scene() != _scene)
|
||||||
|
delete _grid;
|
||||||
|
|
||||||
void GraphView::updateBounds(const QPointF &point)
|
for (int i = 0; i < _graphs.count(); i++)
|
||||||
{
|
if (_graphs.at(i)->scene() != _scene)
|
||||||
if (point.x() < _bounds.left())
|
delete _graphs[i];
|
||||||
_bounds.setLeft(point.x());
|
|
||||||
if (point.x() > _bounds.right())
|
|
||||||
_bounds.setRight(point.x());
|
|
||||||
if (point.y() > _bounds.bottom())
|
|
||||||
_bounds.setBottom(point.y());
|
|
||||||
if (point.y() < _bounds.top())
|
|
||||||
_bounds.setTop(point.y());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::createXLabel()
|
void GraphView::createXLabel()
|
||||||
@ -92,72 +88,155 @@ void GraphView::createYLabel()
|
|||||||
_yAxis->setLabel(QString("%1 [%2]").arg(_yLabel).arg(_yUnits));
|
_yAxis->setLabel(QString("%1 [%2]").arg(_yLabel).arg(_yUnits));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::setXLabel(const QString &label)
|
|
||||||
{
|
|
||||||
_xLabel = label;
|
|
||||||
createXLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphView::setYLabel(const QString &label)
|
void GraphView::setYLabel(const QString &label)
|
||||||
{
|
{
|
||||||
_yLabel = label;
|
_yLabel = label;
|
||||||
createYLabel();
|
createYLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::setXUnits(const QString &units)
|
|
||||||
{
|
|
||||||
_xUnits = units;
|
|
||||||
createXLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GraphView::setYUnits(const QString &units)
|
void GraphView::setYUnits(const QString &units)
|
||||||
{
|
{
|
||||||
_yUnits = units;
|
_yUnits = units;
|
||||||
createYLabel();
|
createYLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::setXScale(qreal scale)
|
void GraphView::setXUnits()
|
||||||
{
|
{
|
||||||
_xScale = scale;
|
if (_graphType == Distance) {
|
||||||
}
|
if (_units == Metric) {
|
||||||
|
if (bounds().width() < KMINM) {
|
||||||
void GraphView::setYScale(qreal scale)
|
_xUnits = tr("m");
|
||||||
{
|
_xScale = 1;
|
||||||
_yScale = scale;
|
} else {
|
||||||
}
|
_xUnits = tr("km");
|
||||||
|
_xScale = M2KM;
|
||||||
void GraphView::loadData(const QVector<QPointF> &data)
|
}
|
||||||
{
|
} else {
|
||||||
QPainterPath path;
|
if (bounds().width() < MIINM) {
|
||||||
QGraphicsPathItem *pi;
|
_xUnits = tr("ft");
|
||||||
|
_xScale = M2FT;
|
||||||
|
} else {
|
||||||
if (data.size() < 2)
|
_xUnits = tr("mi");
|
||||||
return;
|
_xScale = M2MI;
|
||||||
|
}
|
||||||
if (!_graphs.size())
|
}
|
||||||
_bounds.moveTo(data.at(0));
|
} else {
|
||||||
|
if (bounds().width() < MININS) {
|
||||||
updateBounds(data.at(0));
|
_xUnits = tr("s");
|
||||||
path.moveTo(data.at(0).x(), -data.at(0).y());
|
_xScale = 1;
|
||||||
for (int i = 1; i < data.size(); i++) {
|
} else if (bounds().width() < HINS) {
|
||||||
const QPointF &p = data.at(i);
|
_xUnits = tr("min");
|
||||||
path.lineTo(p.x(), -p.y());
|
_xScale = MIN2S;
|
||||||
updateBounds(p);
|
} else {
|
||||||
|
_xUnits = tr("h");
|
||||||
|
_xScale = H2S;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pi = new QGraphicsPathItem(path);
|
createXLabel();
|
||||||
QBrush brush(_palette.color(), Qt::SolidPattern);
|
}
|
||||||
QPen pen(brush, 0);
|
|
||||||
pi->setPen(pen);
|
void GraphView::setUnits(Units units)
|
||||||
_scene->addItem(pi);
|
{
|
||||||
_graphs.append(pi);
|
_units = units;
|
||||||
|
setXUnits();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::setGraphType(GraphType type)
|
||||||
|
{
|
||||||
|
_graphType = type;
|
||||||
|
_bounds = QRectF();
|
||||||
|
|
||||||
|
for (int i = 0; i < _graphs.count(); i++) {
|
||||||
|
_graphs.at(i)->setGraphType(type);
|
||||||
|
if (_graphs.at(i)->scene() == _scene)
|
||||||
|
_bounds |= _graphs.at(i)->bounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == Distance)
|
||||||
|
_xLabel = tr("Distance");
|
||||||
|
else
|
||||||
|
_xLabel = tr("Time");
|
||||||
|
setXUnits();
|
||||||
|
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::showGrid(bool show)
|
||||||
|
{
|
||||||
|
_grid->setVisible(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::loadGraph(const Graph &graph, PathItem *path, int id)
|
||||||
|
{
|
||||||
|
if (graph.size() < 2)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GraphItem *gi = new GraphItem(graph);
|
||||||
|
gi->setGraphType(_graphType);
|
||||||
|
gi->setId(id);
|
||||||
|
gi->setColor(_palette.nextColor());
|
||||||
|
gi->setWidth(_width);
|
||||||
|
|
||||||
|
connect(this, SIGNAL(sliderPositionChanged(qreal)), gi,
|
||||||
|
SLOT(emitSliderPositionChanged(qreal)));
|
||||||
|
connect(gi, SIGNAL(sliderPositionChanged(qreal)), path,
|
||||||
|
SLOT(moveMarker(qreal)));
|
||||||
|
connect(path, SIGNAL(selected(bool)), gi, SLOT(selected(bool)));
|
||||||
|
|
||||||
|
_graphs.append(gi);
|
||||||
|
|
||||||
|
if (!_hide.contains(id)) {
|
||||||
|
_visible.append(gi);
|
||||||
|
_scene->addItem(gi);
|
||||||
|
_bounds |= gi->bounds();
|
||||||
|
setXUnits();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::removeItem(QGraphicsItem *item)
|
||||||
|
{
|
||||||
|
if (item->scene() == _scene)
|
||||||
|
_scene->removeItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::addItem(QGraphicsItem *item)
|
||||||
|
{
|
||||||
|
if (item->scene() != _scene)
|
||||||
|
_scene->addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::showGraph(bool show, int id)
|
||||||
|
{
|
||||||
|
if (show)
|
||||||
|
_hide.remove(id);
|
||||||
|
else
|
||||||
|
_hide.insert(id);
|
||||||
|
|
||||||
|
_visible.clear();
|
||||||
|
_bounds = QRectF();
|
||||||
|
for (int i = 0; i < _graphs.count(); i++) {
|
||||||
|
GraphItem* gi = _graphs.at(i);
|
||||||
|
if (_hide.contains(gi->id()))
|
||||||
|
removeItem(gi);
|
||||||
|
else {
|
||||||
|
addItem(gi);
|
||||||
|
_visible.append(gi);
|
||||||
|
_bounds |= gi->bounds();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::redraw()
|
void GraphView::redraw()
|
||||||
{
|
{
|
||||||
if (!_graphs.isEmpty())
|
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||||
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
}
|
||||||
|
|
||||||
|
QRectF GraphView::bounds() const
|
||||||
|
{
|
||||||
|
QRectF br(_bounds);
|
||||||
|
br.moveTopLeft(QPointF(br.left(), -br.top() - br.height()));
|
||||||
|
return br;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::redraw(const QSizeF &size)
|
void GraphView::redraw(const QSizeF &size)
|
||||||
@ -165,24 +244,28 @@ void GraphView::redraw(const QSizeF &size)
|
|||||||
QRectF r;
|
QRectF r;
|
||||||
QSizeF mx, my;
|
QSizeF mx, my;
|
||||||
RangeF rx, ry;
|
RangeF rx, ry;
|
||||||
QTransform transform;
|
qreal sx, sy;
|
||||||
qreal xs, ys;
|
|
||||||
|
|
||||||
|
|
||||||
if (_xAxis->scene() == _scene)
|
if (_visible.isEmpty() || _bounds.isNull()) {
|
||||||
_scene->removeItem(_xAxis);
|
removeItem(_xAxis);
|
||||||
if (_yAxis->scene() == _scene)
|
removeItem(_yAxis);
|
||||||
_scene->removeItem(_yAxis);
|
removeItem(_slider);
|
||||||
if (_slider->scene() == _scene)
|
removeItem(_info);
|
||||||
_scene->removeItem(_slider);
|
removeItem(_grid);
|
||||||
if (_info->scene() == _scene)
|
_scene->setSceneRect(QRectF());
|
||||||
_scene->removeItem(_info);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _graphs.size(); i++)
|
addItem(_xAxis);
|
||||||
_graphs.at(i)->resetTransform();
|
addItem(_yAxis);
|
||||||
|
addItem(_slider);
|
||||||
|
addItem(_info);
|
||||||
|
addItem(_grid);
|
||||||
|
|
||||||
rx = RangeF(_bounds.left() * _xScale, _bounds.right() * _xScale);
|
rx = RangeF(bounds().left() * _xScale, bounds().right() * _xScale);
|
||||||
ry = RangeF(_bounds.top() * _yScale, _bounds.bottom() * _yScale);
|
ry = RangeF(bounds().top() * _yScale + _yOffset, bounds().bottom() * _yScale
|
||||||
|
+ _yOffset);
|
||||||
if (ry.size() < _minYRange)
|
if (ry.size() < _minYRange)
|
||||||
ry.resize(_minYRange);
|
ry.resize(_minYRange);
|
||||||
|
|
||||||
@ -191,50 +274,56 @@ void GraphView::redraw(const QSizeF &size)
|
|||||||
mx = _xAxis->margin();
|
mx = _xAxis->margin();
|
||||||
my = _yAxis->margin();
|
my = _yAxis->margin();
|
||||||
|
|
||||||
r = _scene->itemsBoundingRect();
|
r = _bounds;
|
||||||
if (r.height() < _minYRange)
|
if (r.height() < _minYRange)
|
||||||
r.adjust(0, -(_minYRange/2 - r.height()/2), 0,
|
r.adjust(0, -(_minYRange/2 - r.height()/2), 0,
|
||||||
_minYRange/2 - r.height()/2);
|
_minYRange/2 - r.height()/2);
|
||||||
|
|
||||||
xs = (size.width() - (my.width() + mx.width())) / r.width();
|
sx = (size.width() - (my.width() + mx.width())) / r.width();
|
||||||
ys = (size.height() - (mx.height() + my.height())
|
sy = (size.height() - (mx.height() + my.height())
|
||||||
- _info->boundingRect().height()) / r.height();
|
- _info->boundingRect().height()) / r.height();
|
||||||
transform.scale(xs, ys);
|
|
||||||
|
|
||||||
for (int i = 0; i < _graphs.size(); i++)
|
for (int i = 0; i < _visible.size(); i++)
|
||||||
_graphs.at(i)->setTransform(transform);
|
_visible.at(i)->setScale(sx, sy);
|
||||||
|
|
||||||
r = _scene->itemsBoundingRect();
|
QPointF p(r.left() * sx, r.top() * sy);
|
||||||
if (r.height() < _minYRange * ys)
|
QSizeF s(r.width() * sx, r.height() * sy);
|
||||||
r.adjust(0, -(_minYRange/2 * ys - r.height()/2), 0,
|
r = QRectF(p, s);
|
||||||
(_minYRange/2) * ys - r.height()/2);
|
if (r.height() < _minYRange * sy)
|
||||||
|
r.adjust(0, -(_minYRange/2 * sy - r.height()/2), 0,
|
||||||
|
(_minYRange/2) * sy - r.height()/2);
|
||||||
|
|
||||||
_xAxis->setSize(r.width());
|
_xAxis->setSize(r.width());
|
||||||
_yAxis->setSize(r.height());
|
_yAxis->setSize(r.height());
|
||||||
_xAxis->setPos(r.bottomLeft());
|
_xAxis->setPos(r.bottomLeft());
|
||||||
_yAxis->setPos(r.bottomLeft());
|
_yAxis->setPos(r.bottomLeft());
|
||||||
_scene->addItem(_xAxis);
|
|
||||||
_scene->addItem(_yAxis);
|
_grid->setSize(r.size());
|
||||||
|
_grid->setTicks(_xAxis->ticks(), _yAxis->ticks());
|
||||||
|
_grid->setPos(r.bottomLeft());
|
||||||
|
|
||||||
_slider->setArea(r);
|
_slider->setArea(r);
|
||||||
_slider->setPos((_sliderPos / _bounds.width()) * _slider->area().width(),
|
updateSliderPosition();
|
||||||
r.bottom());
|
|
||||||
_scene->addItem(_slider);
|
|
||||||
|
|
||||||
updateSliderInfo();
|
r |= _xAxis->sceneBoundingRect();
|
||||||
|
r |= _yAxis->sceneBoundingRect();
|
||||||
r = _scene->itemsBoundingRect();
|
|
||||||
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
_info->setPos(r.topLeft() + QPointF(r.width()/2
|
||||||
- _info->boundingRect().width()/2, -_info->boundingRect().height()));
|
- _info->boundingRect().width()/2, -_info->boundingRect().height()));
|
||||||
_scene->addItem(_info);
|
|
||||||
|
|
||||||
_scene->setSceneRect(_scene->itemsBoundingRect());
|
_scene->setSceneRect(_scene->itemsBoundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::resizeEvent(QResizeEvent *)
|
void GraphView::resizeEvent(QResizeEvent *)
|
||||||
{
|
{
|
||||||
if (!_graphs.empty())
|
redraw();
|
||||||
redraw();
|
}
|
||||||
|
|
||||||
|
void GraphView::mousePressEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
if (e->button() == Qt::LeftButton)
|
||||||
|
newSliderPosition(mapToScene(e->pos()));
|
||||||
|
|
||||||
|
QGraphicsView::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::plot(QPainter *painter, const QRectF &target)
|
void GraphView::plot(QPainter *painter, const QRectF &target)
|
||||||
@ -255,19 +344,14 @@ void GraphView::plot(QPainter *painter, const QRectF &target)
|
|||||||
|
|
||||||
void GraphView::clear()
|
void GraphView::clear()
|
||||||
{
|
{
|
||||||
if (_xAxis->scene() == _scene)
|
|
||||||
_scene->removeItem(_xAxis);
|
|
||||||
if (_yAxis->scene() == _scene)
|
|
||||||
_scene->removeItem(_yAxis);
|
|
||||||
if (_slider->scene() == _scene)
|
|
||||||
_scene->removeItem(_slider);
|
|
||||||
if (_info->scene() == _scene)
|
|
||||||
_scene->removeItem(_info);
|
|
||||||
|
|
||||||
_slider->clear();
|
_slider->clear();
|
||||||
_info->clear();
|
_info->clear();
|
||||||
_scene->clear();
|
|
||||||
|
for (int i = 0; i < _graphs.count(); i++)
|
||||||
|
delete _graphs[i];
|
||||||
|
|
||||||
_graphs.clear();
|
_graphs.clear();
|
||||||
|
_visible.clear();
|
||||||
_palette.reset();
|
_palette.reset();
|
||||||
|
|
||||||
_bounds = QRectF();
|
_bounds = QRectF();
|
||||||
@ -276,95 +360,73 @@ void GraphView::clear()
|
|||||||
_scene->setSceneRect(0, 0, 0, 0);
|
_scene->setSceneRect(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static qreal yAtX(const QPainterPath &path, qreal x)
|
void GraphView::updateSliderPosition()
|
||||||
{
|
{
|
||||||
int low = 0;
|
if (bounds().width() <= 0)
|
||||||
int high = path.elementCount() - 1;
|
return;
|
||||||
int mid = 0;
|
|
||||||
|
|
||||||
Q_ASSERT(high > low);
|
if (_sliderPos <= bounds().right() && _sliderPos >= bounds().left()) {
|
||||||
Q_ASSERT(x >= path.elementAt(low).x && x <= path.elementAt(high).x);
|
_slider->setPos((_sliderPos / bounds().width())
|
||||||
|
* _slider->area().width(), _slider->area().bottom());
|
||||||
while (low <= high) {
|
_slider->setVisible(!_visible.isEmpty());
|
||||||
mid = low + ((high - low) / 2);
|
} else {
|
||||||
const QPainterPath::Element &e = path.elementAt(mid);
|
_slider->setPos(_slider->area().left(), _slider->area().bottom());
|
||||||
if (e.x > x)
|
_slider->setVisible(false);
|
||||||
high = mid - 1;
|
|
||||||
else if (e.x < x)
|
|
||||||
low = mid + 1;
|
|
||||||
else
|
|
||||||
return e.y;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QLineF l;
|
updateSliderInfo();
|
||||||
if (path.elementAt(mid).x < x)
|
|
||||||
l = QLineF(path.elementAt(mid).x, path.elementAt(mid).y,
|
|
||||||
path.elementAt(mid+1).x, path.elementAt(mid+1).y);
|
|
||||||
else
|
|
||||||
l = QLineF(path.elementAt(mid-1).x, path.elementAt(mid-1).y,
|
|
||||||
path.elementAt(mid).x, path.elementAt(mid).y);
|
|
||||||
|
|
||||||
return l.pointAt((x - l.p1().x()) / (l.p2().x() - l.p1().x())).y();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::updateSliderInfo()
|
void GraphView::updateSliderInfo()
|
||||||
{
|
{
|
||||||
_sliderInfo->setVisible(_graphs.size() == 1);
|
_sliderInfo->setVisible(_visible.count() == 1);
|
||||||
|
if (!_sliderInfo->isVisible())
|
||||||
if (_graphs.size() != 1)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QPainterPath &path = _graphs.at(0)->path();
|
QRectF br(_visible.first()->bounds());
|
||||||
QRectF br = path.boundingRect();
|
|
||||||
if (br.height() < _minYRange)
|
if (br.height() < _minYRange)
|
||||||
br.adjust(0, -(_minYRange/2 - br.height()/2), 0,
|
br.adjust(0, -(_minYRange/2 - br.height()/2), 0,
|
||||||
_minYRange/2 - br.height()/2);
|
_minYRange/2 - br.height()/2);
|
||||||
|
|
||||||
qreal y = yAtX(path, _sliderPos);
|
qreal y = _visible.first()->yAtX(_sliderPos);
|
||||||
qreal r = (y - br.bottom()) / br.height();
|
qreal r = (y - br.bottom()) / br.height();
|
||||||
|
|
||||||
qreal pos = (_sliderPos / _bounds.width()) * _slider->area().width();
|
qreal pos = (_sliderPos / bounds().width()) * _slider->area().width();
|
||||||
SliderInfoItem::Side s = (pos + _sliderInfo->boundingRect().width()
|
SliderInfoItem::Side s = (pos + _sliderInfo->boundingRect().width()
|
||||||
> _slider->area().right()) ? SliderInfoItem::Left : SliderInfoItem::Right;
|
> _slider->area().right()) ? SliderInfoItem::Left : SliderInfoItem::Right;
|
||||||
|
|
||||||
_sliderInfo->setSide(s);
|
_sliderInfo->setSide(s);
|
||||||
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
|
_sliderInfo->setPos(QPointF(0, _slider->boundingRect().height() * r));
|
||||||
_sliderInfo->setText(QString::number(-y * _yScale, 'f', _precision));
|
_sliderInfo->setText(QString::number(-y * _yScale + _yOffset, 'f',
|
||||||
|
_precision));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
void GraphView::emitSliderPositionChanged(const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (_graphs.isEmpty())
|
if (_slider->area().width() <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_sliderPos = (pos.x() / _slider->area().width()) * _bounds.width();
|
_sliderPos = (pos.x() / _slider->area().width()) * bounds().width();
|
||||||
emit sliderPositionChanged(_sliderPos);
|
_sliderPos = qMax(_sliderPos, bounds().left());
|
||||||
|
_sliderPos = qMin(_sliderPos, bounds().right());
|
||||||
|
updateSliderPosition();
|
||||||
|
|
||||||
updateSliderInfo();
|
emit sliderPositionChanged(_sliderPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::setSliderPosition(qreal pos)
|
void GraphView::setSliderPosition(qreal pos)
|
||||||
{
|
{
|
||||||
_sliderPos = pos;
|
if (_visible.isEmpty())
|
||||||
|
|
||||||
if (_graphs.isEmpty())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pos > _bounds.right() || pos < _bounds.left())
|
_sliderPos = pos;
|
||||||
_slider->setVisible(false);
|
updateSliderPosition();
|
||||||
else {
|
|
||||||
_slider->setPos((pos / _bounds.width()) * _slider->area().width(), 0);
|
|
||||||
_slider->setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::newSliderPosition(const QPointF &pos)
|
void GraphView::newSliderPosition(const QPointF &pos)
|
||||||
{
|
{
|
||||||
if (_slider->area().contains(pos)) {
|
if (_slider->area().contains(pos))
|
||||||
_slider->setPos(pos);
|
_slider->setPos(pos);
|
||||||
_slider->setVisible(true);
|
|
||||||
emitSliderPositionChanged(pos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::addInfo(const QString &key, const QString &value)
|
void GraphView::addInfo(const QString &key, const QString &value)
|
||||||
@ -376,3 +438,28 @@ void GraphView::clearInfo()
|
|||||||
{
|
{
|
||||||
_info->clear();
|
_info->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphView::setPalette(const Palette &palette)
|
||||||
|
{
|
||||||
|
_palette = palette;
|
||||||
|
_palette.reset();
|
||||||
|
|
||||||
|
for (int i = 0; i < _graphs.count(); i++)
|
||||||
|
_graphs.at(i)->setColor(_palette.nextColor());
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::setGraphWidth(int width)
|
||||||
|
{
|
||||||
|
_width = width;
|
||||||
|
|
||||||
|
for (int i = 0; i < _graphs.count(); i++)
|
||||||
|
_graphs.at(i)->setWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphView::useOpenGL(bool use)
|
||||||
|
{
|
||||||
|
if (use)
|
||||||
|
setViewport(new OPENGL_WIDGET);
|
||||||
|
else
|
||||||
|
setViewport(new QWidget);
|
||||||
|
}
|
||||||
|
@ -2,29 +2,20 @@
|
|||||||
#define GRAPHVIEW_H
|
#define GRAPHVIEW_H
|
||||||
|
|
||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QVector>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QPointF>
|
#include <QSet>
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
#include "units.h"
|
||||||
|
#include "graph.h"
|
||||||
|
|
||||||
|
|
||||||
class AxisItem;
|
class AxisItem;
|
||||||
class SliderItem;
|
class SliderItem;
|
||||||
class SliderInfoItem;
|
class SliderInfoItem;
|
||||||
class InfoItem;
|
class InfoItem;
|
||||||
|
class GraphItem;
|
||||||
class Scene : public QGraphicsScene
|
class PathItem;
|
||||||
{
|
class GridItem;
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
Scene(QObject *parent = 0) : QGraphicsScene(parent) {}
|
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *e);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void mouseClicked(const QPointF &pos);
|
|
||||||
};
|
|
||||||
|
|
||||||
class GraphView : public QGraphicsView
|
class GraphView : public QGraphicsView
|
||||||
{
|
{
|
||||||
@ -34,26 +25,27 @@ public:
|
|||||||
GraphView(QWidget *parent = 0);
|
GraphView(QWidget *parent = 0);
|
||||||
~GraphView();
|
~GraphView();
|
||||||
|
|
||||||
void loadData(const QVector<QPointF> &data);
|
void loadGraph(const Graph &graph, PathItem *path, int id = 0);
|
||||||
|
int count() const {return _graphs.count();}
|
||||||
void redraw();
|
void redraw();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
int count() const {return _graphs.count();}
|
void showGraph(bool show, int id = 0);
|
||||||
|
void setGraphType(GraphType type);
|
||||||
|
void setUnits(Units units);
|
||||||
|
void showGrid(bool show);
|
||||||
|
|
||||||
|
void setPalette(const Palette &palette);
|
||||||
|
void setGraphWidth(int width);
|
||||||
|
|
||||||
const QString &xLabel() const {return _xLabel;}
|
|
||||||
const QString &yLabel() const {return _yLabel;}
|
const QString &yLabel() const {return _yLabel;}
|
||||||
const QString &xUnits() const {return _xUnits;}
|
|
||||||
const QString &yUnits() const {return _yUnits;}
|
const QString &yUnits() const {return _yUnits;}
|
||||||
qreal xScale() const {return _xScale;}
|
|
||||||
qreal yScale() const {return _yScale;}
|
qreal yScale() const {return _yScale;}
|
||||||
|
qreal yOffset() const {return _yOffset;}
|
||||||
void setXLabel(const QString &label);
|
|
||||||
void setYLabel(const QString &label);
|
void setYLabel(const QString &label);
|
||||||
void setXUnits(const QString &units);
|
|
||||||
void setYUnits(const QString &units);
|
void setYUnits(const QString &units);
|
||||||
void setXScale(qreal scale);
|
void setYScale(qreal scale) {_yScale = scale;}
|
||||||
void setYScale(qreal scale);
|
void setYOffset(qreal offset) {_yOffset = offset;}
|
||||||
|
|
||||||
void setSliderPrecision(int precision) {_precision = precision;}
|
void setSliderPrecision(int precision) {_precision = precision;}
|
||||||
void setMinYRange(qreal range) {_minYRange = range;}
|
void setMinYRange(qreal range) {_minYRange = range;}
|
||||||
@ -63,44 +55,59 @@ public:
|
|||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target);
|
void plot(QPainter *painter, const QRectF &target);
|
||||||
|
|
||||||
|
void useOpenGL(bool use);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sliderPositionChanged(qreal);
|
void sliderPositionChanged(qreal);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const QRectF &bounds() const {return _bounds;}
|
QRectF bounds() const;
|
||||||
void resizeEvent(QResizeEvent *);
|
|
||||||
void redraw(const QSizeF &size);
|
void redraw(const QSizeF &size);
|
||||||
void addInfo(const QString &key, const QString &value);
|
void addInfo(const QString &key, const QString &value);
|
||||||
void clearInfo();
|
void clearInfo();
|
||||||
void skipColor() {_palette.color();}
|
void skipColor() {_palette.nextColor();}
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void emitSliderPositionChanged(const QPointF &pos);
|
void emitSliderPositionChanged(const QPointF &pos);
|
||||||
void newSliderPosition(const QPointF &pos);
|
void newSliderPosition(const QPointF &pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setXUnits();
|
||||||
void createXLabel();
|
void createXLabel();
|
||||||
void createYLabel();
|
void createYLabel();
|
||||||
void updateBounds(const QPointF &point);
|
void updateSliderPosition();
|
||||||
void updateSliderInfo();
|
void updateSliderInfo();
|
||||||
|
void removeItem(QGraphicsItem *item);
|
||||||
|
void addItem(QGraphicsItem *item);
|
||||||
|
|
||||||
|
void resizeEvent(QResizeEvent *);
|
||||||
|
void mousePressEvent(QMouseEvent *);
|
||||||
|
|
||||||
qreal _xScale, _yScale;
|
qreal _xScale, _yScale;
|
||||||
|
qreal _yOffset;
|
||||||
QString _xUnits, _yUnits;
|
QString _xUnits, _yUnits;
|
||||||
QString _xLabel, _yLabel;
|
QString _xLabel, _yLabel;
|
||||||
int _precision;
|
int _precision;
|
||||||
qreal _minYRange;
|
qreal _minYRange;
|
||||||
qreal _sliderPos;
|
qreal _sliderPos;
|
||||||
|
|
||||||
Scene *_scene;
|
QGraphicsScene *_scene;
|
||||||
|
|
||||||
AxisItem *_xAxis, *_yAxis;
|
AxisItem *_xAxis, *_yAxis;
|
||||||
SliderItem *_slider;
|
SliderItem *_slider;
|
||||||
SliderInfoItem *_sliderInfo;
|
SliderInfoItem *_sliderInfo;
|
||||||
InfoItem *_info;
|
InfoItem *_info;
|
||||||
|
GridItem *_grid;
|
||||||
|
|
||||||
QList<QGraphicsPathItem*> _graphs;
|
QList<GraphItem*> _graphs;
|
||||||
|
QList<GraphItem*> _visible;
|
||||||
|
QSet<int> _hide;
|
||||||
QRectF _bounds;
|
QRectF _bounds;
|
||||||
Palette _palette;
|
Palette _palette;
|
||||||
|
int _width;
|
||||||
|
|
||||||
|
Units _units;
|
||||||
|
GraphType _graphType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GRAPHVIEW_H
|
#endif // GRAPHVIEW_H
|
||||||
|
50
src/griditem.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include <QPainter>
|
||||||
|
#include "griditem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define GRID_WIDTH 0
|
||||||
|
|
||||||
|
GridItem::GridItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget)
|
||||||
|
{
|
||||||
|
Q_UNUSED(option);
|
||||||
|
Q_UNUSED(widget);
|
||||||
|
QBrush brush(Qt::gray);
|
||||||
|
QPen pen = QPen(brush, GRID_WIDTH, Qt::DotLine);
|
||||||
|
|
||||||
|
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
painter->setPen(pen);
|
||||||
|
|
||||||
|
for (int i = 0; i < _xTicks.size(); i++)
|
||||||
|
painter->drawLine(_xTicks.at(i), 0, _xTicks.at(i),
|
||||||
|
-_boundingRect.height());
|
||||||
|
for (int i = 0; i < _yTicks.size(); i++)
|
||||||
|
painter->drawLine(0, -_yTicks.at(i), boundingRect().width(),
|
||||||
|
-_yTicks.at(i));
|
||||||
|
|
||||||
|
/*
|
||||||
|
painter->setPen(Qt::red);
|
||||||
|
painter->drawRect(boundingRect());
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridItem::setTicks(const QList<qreal> &x, const QList<qreal> &y)
|
||||||
|
{
|
||||||
|
_xTicks = x; _yTicks = y;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GridItem::setSize(const QSizeF &size)
|
||||||
|
{
|
||||||
|
prepareGeometryChange();
|
||||||
|
|
||||||
|
_boundingRect = QRectF(QPointF(0, -size.height()), size);
|
||||||
|
}
|
23
src/griditem.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef GRIDITEM_H
|
||||||
|
#define GRIDITEM_H
|
||||||
|
|
||||||
|
#include <QGraphicsItem>
|
||||||
|
|
||||||
|
class GridItem : public QGraphicsItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GridItem(QGraphicsItem *parent = 0);
|
||||||
|
|
||||||
|
QRectF boundingRect() const {return _boundingRect;}
|
||||||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||||
|
QWidget *widget);
|
||||||
|
|
||||||
|
void setTicks(const QList<qreal> &x, const QList<qreal> &y);
|
||||||
|
void setSize(const QSizeF &size);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QRectF _boundingRect;
|
||||||
|
QList<qreal> _xTicks, _yTicks;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GRIDITEM_H
|
1511
src/gui.cpp
119
src/gui.h
@ -6,8 +6,13 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
|
#include "units.h"
|
||||||
|
#include "timetype.h"
|
||||||
|
#include "graph.h"
|
||||||
#include "poi.h"
|
#include "poi.h"
|
||||||
#include "margins.h"
|
#include "exportdialog.h"
|
||||||
|
#include "optionsdialog.h"
|
||||||
|
|
||||||
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
@ -18,19 +23,17 @@ class QLabel;
|
|||||||
class QSignalMapper;
|
class QSignalMapper;
|
||||||
class QPrinter;
|
class QPrinter;
|
||||||
class FileBrowser;
|
class FileBrowser;
|
||||||
class GraphView;
|
class GraphTab;
|
||||||
class ElevationGraph;
|
class PathView;
|
||||||
class SpeedGraph;
|
|
||||||
class HeartRateGraph;
|
|
||||||
class TrackView;
|
|
||||||
class Map;
|
class Map;
|
||||||
|
class MapList;
|
||||||
|
|
||||||
class GUI : public QMainWindow
|
class GUI : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GUI(QWidget *parent = 0);
|
GUI();
|
||||||
~GUI();
|
~GUI();
|
||||||
|
|
||||||
bool openFile(const QString &fileName);
|
bool openFile(const QString &fileName);
|
||||||
@ -46,14 +49,17 @@ private slots:
|
|||||||
void reloadFile();
|
void reloadFile();
|
||||||
void openPOIFile();
|
void openPOIFile();
|
||||||
void closePOIFiles();
|
void closePOIFiles();
|
||||||
void showPOI(bool checked);
|
void showGraphs(bool show);
|
||||||
void showMap(bool checked);
|
void showGraphGrids(bool show);
|
||||||
void showGraphs(bool checked);
|
void showToolbars(bool show);
|
||||||
void showToolbars(bool checked);
|
void showFullscreen(bool show);
|
||||||
void showFullscreen(bool checked);
|
void showTracks(bool show);
|
||||||
|
void showRoutes(bool show);
|
||||||
|
void loadMap();
|
||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
void nextMap();
|
void nextMap();
|
||||||
void prevMap();
|
void prevMap();
|
||||||
|
void openOptions();
|
||||||
|
|
||||||
void mapChanged(int);
|
void mapChanged(int);
|
||||||
void graphChanged(int);
|
void graphChanged(int);
|
||||||
@ -64,15 +70,19 @@ private slots:
|
|||||||
void last();
|
void last();
|
||||||
void first();
|
void first();
|
||||||
|
|
||||||
void setMetricUnits();
|
void setTotalTime() {setTimeType(Total);}
|
||||||
void setImperialUnits();
|
void setMovingTime() {setTimeType(Moving);}
|
||||||
|
void setMetricUnits() {setUnits(Metric);}
|
||||||
|
void setImperialUnits() {setUnits(Imperial);}
|
||||||
|
void setDistanceGraph() {setGraphType(Distance);}
|
||||||
|
void setTimeGraph() {setGraphType(Time);}
|
||||||
|
|
||||||
void sliderPositionChanged(qreal pos);
|
void sliderPositionChanged(qreal pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QPair<GraphView *, QString> GraphTab;
|
|
||||||
typedef QPair<QDate, QDate> DateRange;
|
typedef QPair<QDate, QDate> DateRange;
|
||||||
|
|
||||||
|
void loadDatums();
|
||||||
void loadMaps();
|
void loadMaps();
|
||||||
void loadPOIs();
|
void loadPOIs();
|
||||||
void closeFiles();
|
void closeFiles();
|
||||||
@ -85,8 +95,9 @@ private:
|
|||||||
void createMenus();
|
void createMenus();
|
||||||
void createToolBars();
|
void createToolBars();
|
||||||
void createStatusBar();
|
void createStatusBar();
|
||||||
void createTrackView();
|
void createPathView();
|
||||||
void createTrackGraphs();
|
void createGraphTabs();
|
||||||
|
void createBrowser();
|
||||||
|
|
||||||
bool openPOIFile(const QString &fileName);
|
bool openPOIFile(const QString &fileName);
|
||||||
bool loadFile(const QString &fileName);
|
bool loadFile(const QString &fileName);
|
||||||
@ -95,30 +106,35 @@ private:
|
|||||||
void updateWindowTitle();
|
void updateWindowTitle();
|
||||||
void updateNavigationActions();
|
void updateNavigationActions();
|
||||||
void updateGraphTabs();
|
void updateGraphTabs();
|
||||||
void updateTrackView();
|
void updatePathView();
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent * event);
|
TimeType timeType() const;
|
||||||
void closeEvent(QCloseEvent *event);
|
Units units() const;
|
||||||
|
void setTimeType(TimeType type);
|
||||||
|
void setUnits(Units units);
|
||||||
|
void setGraphType(GraphType type);
|
||||||
|
|
||||||
|
qreal distance() const;
|
||||||
|
qreal time() const;
|
||||||
|
qreal movingTime() const;
|
||||||
int mapIndex(const QString &name);
|
int mapIndex(const QString &name);
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
|
||||||
QMenu *_fileMenu;
|
void keyPressEvent(QKeyEvent *event);
|
||||||
QMenu *_helpMenu;
|
void closeEvent(QCloseEvent *event);
|
||||||
QMenu *_poiMenu;
|
void dragEnterEvent(QDragEnterEvent *event);
|
||||||
QMenu *_mapMenu;
|
void dropEvent(QDropEvent *event);
|
||||||
QMenu *_settingsMenu;
|
|
||||||
QMenu *_unitsMenu;
|
|
||||||
QMenu *_poiFilesMenu;
|
|
||||||
|
|
||||||
QToolBar *_fileToolBar;
|
QToolBar *_fileToolBar;
|
||||||
QToolBar *_showToolBar;
|
QToolBar *_showToolBar;
|
||||||
QToolBar *_navigationToolBar;
|
QToolBar *_navigationToolBar;
|
||||||
QTabWidget *_trackGraphs;
|
QMenu *_poiFilesMenu;
|
||||||
|
QMenu *_mapMenu;
|
||||||
|
|
||||||
QActionGroup *_fileActionGroup;
|
QActionGroup *_fileActionGroup;
|
||||||
QActionGroup *_navigationActionGroup;
|
QActionGroup *_navigationActionGroup;
|
||||||
|
QActionGroup *_mapsActionGroup;
|
||||||
QAction *_exitAction;
|
QAction *_exitAction;
|
||||||
QAction *_keysAction;
|
QAction *_keysAction;
|
||||||
QAction *_dataSourcesAction;
|
QAction *_dataSourcesAction;
|
||||||
@ -132,10 +148,16 @@ private:
|
|||||||
QAction *_openPOIAction;
|
QAction *_openPOIAction;
|
||||||
QAction *_closePOIAction;
|
QAction *_closePOIAction;
|
||||||
QAction *_showPOIAction;
|
QAction *_showPOIAction;
|
||||||
|
QAction *_overlapPOIAction;
|
||||||
|
QAction *_showPOILabelsAction;
|
||||||
QAction *_showMapAction;
|
QAction *_showMapAction;
|
||||||
QAction *_fullscreenAction;
|
QAction *_fullscreenAction;
|
||||||
|
QAction *_loadMapAction;
|
||||||
QAction *_clearMapCacheAction;
|
QAction *_clearMapCacheAction;
|
||||||
QAction *_showGraphsAction;
|
QAction *_showGraphsAction;
|
||||||
|
QAction *_showGraphGridAction;
|
||||||
|
QAction *_distanceGraphAction;
|
||||||
|
QAction *_timeGraphAction;
|
||||||
QAction *_showToolbarsAction;
|
QAction *_showToolbarsAction;
|
||||||
QAction *_nextAction;
|
QAction *_nextAction;
|
||||||
QAction *_prevAction;
|
QAction *_prevAction;
|
||||||
@ -143,44 +165,55 @@ private:
|
|||||||
QAction *_firstAction;
|
QAction *_firstAction;
|
||||||
QAction *_metricUnitsAction;
|
QAction *_metricUnitsAction;
|
||||||
QAction *_imperialUnitsAction;
|
QAction *_imperialUnitsAction;
|
||||||
|
QAction *_totalTimeAction;
|
||||||
|
QAction *_movingTimeAction;
|
||||||
QAction *_nextMapAction;
|
QAction *_nextMapAction;
|
||||||
QAction *_prevMapAction;
|
QAction *_prevMapAction;
|
||||||
|
QAction *_showTracksAction;
|
||||||
|
QAction *_showRoutesAction;
|
||||||
|
QAction *_showWaypointsAction;
|
||||||
|
QAction *_showWaypointLabelsAction;
|
||||||
|
QAction *_showRouteWaypointsAction;
|
||||||
|
QAction *_openOptionsAction;
|
||||||
|
QAction *_mapsEnd;
|
||||||
QList<QAction*> _mapActions;
|
QList<QAction*> _mapActions;
|
||||||
QList<QAction*> _poiFilesActions;
|
QList<QAction*> _poiFilesActions;
|
||||||
|
|
||||||
QSignalMapper *_poiFilesSM;
|
QSignalMapper *_poiFilesSignalMapper;
|
||||||
|
QSignalMapper *_mapsSignalMapper;
|
||||||
|
|
||||||
QLabel *_fileNameLabel;
|
QLabel *_fileNameLabel;
|
||||||
QLabel *_distanceLabel;
|
QLabel *_distanceLabel;
|
||||||
QLabel *_timeLabel;
|
QLabel *_timeLabel;
|
||||||
|
|
||||||
TrackView *_track;
|
PathView *_pathView;
|
||||||
ElevationGraph *_elevationGraph;
|
QTabWidget *_graphTabWidget;
|
||||||
SpeedGraph *_speedGraph;
|
QList<GraphTab*> _tabs;
|
||||||
HeartRateGraph *_heartRateGraph;
|
|
||||||
QList<GraphTab> _tabs;
|
|
||||||
|
|
||||||
POI _poi;
|
POI *_poi;
|
||||||
QList<Map*> _maps;
|
MapList *_ml;
|
||||||
|
|
||||||
FileBrowser *_browser;
|
FileBrowser *_browser;
|
||||||
QList<QString> _files;
|
QList<QString> _files;
|
||||||
Map *_currentMap;
|
|
||||||
|
|
||||||
|
Map *_map;
|
||||||
int _trackCount;
|
int _trackCount;
|
||||||
qreal _distance;
|
int _routeCount;
|
||||||
|
int _waypointCount;
|
||||||
|
qreal _trackDistance;
|
||||||
|
qreal _routeDistance;
|
||||||
qreal _time;
|
qreal _time;
|
||||||
|
qreal _movingTime;
|
||||||
DateRange _dateRange;
|
DateRange _dateRange;
|
||||||
|
QString _pathName;
|
||||||
|
|
||||||
qreal _sliderPos;
|
qreal _sliderPos;
|
||||||
|
|
||||||
int _frameStyle;
|
int _frameStyle;
|
||||||
bool _showGraphs;
|
bool _showGraphs;
|
||||||
|
|
||||||
QString _exportFileName;
|
Export _export;
|
||||||
QPrinter::PaperSize _exportPaperSize;
|
Options _options;
|
||||||
QPrinter::Orientation _exportOrientation;
|
|
||||||
MarginsF _exportMargins;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GUI_H
|
#endif // GUI_H
|
||||||
|
@ -1,51 +1,56 @@
|
|||||||
#include "gpx.h"
|
#include "data.h"
|
||||||
#include "heartrategraph.h"
|
#include "heartrategraph.h"
|
||||||
|
|
||||||
|
|
||||||
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphView(parent)
|
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
|
||||||
{
|
{
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
|
_showTracks = true;
|
||||||
|
|
||||||
GraphView::setYUnits(tr("1/min"));
|
GraphView::setYUnits(tr("1/min"));
|
||||||
setXLabel(tr("Distance"));
|
|
||||||
setYLabel(tr("Heart rate"));
|
setYLabel(tr("Heart rate"));
|
||||||
|
|
||||||
setSliderPrecision(0);
|
setSliderPrecision(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::addInfo()
|
void HeartRateGraph::setInfo()
|
||||||
{
|
{
|
||||||
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f', 0)
|
if (_showTracks) {
|
||||||
+ UNIT_SPACE + yUnits());
|
GraphView::addInfo(tr("Average"), QString::number(avg() * yScale(), 'f',
|
||||||
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f', 0)
|
0) + UNIT_SPACE + yUnits());
|
||||||
+ UNIT_SPACE + yUnits());
|
GraphView::addInfo(tr("Maximum"), QString::number(max() * yScale(), 'f',
|
||||||
|
0) + UNIT_SPACE + yUnits());
|
||||||
redraw();
|
} else
|
||||||
|
clearInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::loadGPX(const GPX &gpx)
|
void HeartRateGraph::loadData(const Data &data, const QList<PathItem *> &paths)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < gpx.trackCount(); i++) {
|
for (int i = 0; i < data.tracks().count(); i++) {
|
||||||
QVector<QPointF> data;
|
const Graph &graph = data.tracks().at(i)->heartRate();
|
||||||
qreal sum = 0, w = 0;
|
qreal sum = 0, w = 0;
|
||||||
|
|
||||||
gpx.track(i).heartRateGraph(data);
|
if (graph.size() < 2) {
|
||||||
if (data.count() < 2) {
|
|
||||||
skipColor();
|
skipColor();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 1; j < data.size(); j++) {
|
for (int j = 1; j < graph.size(); j++) {
|
||||||
sum += data.at(j).y() * (data.at(j).x() - data.at(j-1).x());
|
qreal ds = graph.at(j).s() - graph.at(j-1).s();
|
||||||
w += data.at(j).x() - data.at(j-1).x();
|
sum += graph.at(j).y() * ds;
|
||||||
|
w += ds;
|
||||||
}
|
}
|
||||||
_avg.append(QPointF(gpx.track(i).distance(), sum/w));
|
_avg.append(QPointF(data.tracks().at(i)->distance(), sum/w));
|
||||||
|
|
||||||
loadData(data);
|
GraphView::loadGraph(graph, paths.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
setXUnits();
|
for (int i = 0; i < data.routes().count(); i++)
|
||||||
addInfo();
|
skipColor();
|
||||||
|
|
||||||
|
setInfo();
|
||||||
|
|
||||||
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal HeartRateGraph::avg() const
|
qreal HeartRateGraph::avg() const
|
||||||
@ -68,32 +73,12 @@ void HeartRateGraph::clear()
|
|||||||
GraphView::clear();
|
GraphView::clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateGraph::setXUnits()
|
void HeartRateGraph::showTracks(bool show)
|
||||||
{
|
{
|
||||||
if (_units == Metric) {
|
_showTracks = show;
|
||||||
if (bounds().width() < KMINM) {
|
|
||||||
GraphView::setXUnits(tr("m"));
|
|
||||||
setXScale(1);
|
|
||||||
} else {
|
|
||||||
GraphView::setXUnits(tr("km"));
|
|
||||||
setXScale(M2KM);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (bounds().width() < MIINM) {
|
|
||||||
GraphView::setXUnits(tr("ft"));
|
|
||||||
setXScale(M2FT);
|
|
||||||
} else {
|
|
||||||
GraphView::setXUnits(tr("mi"));
|
|
||||||
setXScale(M2MI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void HeartRateGraph::setUnits(enum Units units)
|
showGraph(show);
|
||||||
{
|
setInfo();
|
||||||
_units = units;
|
|
||||||
setXUnits();
|
|
||||||
|
|
||||||
clearInfo();
|
redraw();
|
||||||
addInfo();
|
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,29 @@
|
|||||||
#ifndef HEARTRATEGRAPH_H
|
#ifndef HEARTRATEGRAPH_H
|
||||||
#define HEARTRATEGRAPH_H
|
#define HEARTRATEGRAPH_H
|
||||||
|
|
||||||
#include "graphview.h"
|
#include "graphtab.h"
|
||||||
#include "units.h"
|
|
||||||
|
|
||||||
class GPX;
|
class HeartRateGraph : public GraphTab
|
||||||
|
|
||||||
class HeartRateGraph : public GraphView
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HeartRateGraph(QWidget *parent = 0);
|
HeartRateGraph(QWidget *parent = 0);
|
||||||
|
|
||||||
void loadGPX(const GPX &gpx);
|
QString label() const {return tr("Heart rate");}
|
||||||
|
void loadData(const Data &data, const QList<PathItem *> &paths);
|
||||||
void clear();
|
void clear();
|
||||||
void setUnits(enum Units units);
|
void showTracks(bool show);
|
||||||
|
|
||||||
qreal avg() const;
|
|
||||||
qreal max() const {return bounds().bottom();}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setXUnits();
|
qreal avg() const;
|
||||||
void addInfo();
|
qreal max() const {return bounds().bottom();}
|
||||||
|
void setInfo();
|
||||||
|
|
||||||
QList<QPointF> _avg;
|
QList<QPointF> _avg;
|
||||||
|
|
||||||
enum Units _units;
|
enum Units _units;
|
||||||
|
bool _showTracks;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // HEARTRATEGRAPH_H
|
#endif // HEARTRATEGRAPH_H
|
||||||
|
38
src/icons.h
@ -1,19 +1,29 @@
|
|||||||
#ifndef ICONS_H
|
#ifndef ICONS_H
|
||||||
#define ICONS_H
|
#define ICONS_H
|
||||||
|
|
||||||
#define APP_ICON ":/icons/gpxsee.png"
|
#define APP_ICON ":/icons/gpxsee.png"
|
||||||
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
|
||||||
#define EXPORT_FILE_ICON ":/icons/document-export.png"
|
// Toolbar/menu icons
|
||||||
#define PRINT_FILE_ICON ":/icons/document-print.png"
|
#define OPEN_FILE_ICON ":/icons/document-open.png"
|
||||||
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
|
#define EXPORT_FILE_ICON ":/icons/document-export.png"
|
||||||
#define SHOW_POI_ICON ":/icons/flag.png"
|
#define PRINT_FILE_ICON ":/icons/document-print.png"
|
||||||
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
#define CLOSE_FILE_ICON ":/icons/dialog-close.png"
|
||||||
#define QUIT_ICON ":/icons/application-exit.png"
|
#define SHOW_POI_ICON ":/icons/flag.png"
|
||||||
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
#define SHOW_MAP_ICON ":/icons/applications-internet.png"
|
||||||
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
|
#define SHOW_GRAPHS_ICON ":/icons/office-chart-line.png"
|
||||||
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
#define QUIT_ICON ":/icons/application-exit.png"
|
||||||
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
|
#define RELOAD_FILE_ICON ":/icons/view-refresh.png"
|
||||||
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
|
#define NEXT_FILE_ICON ":/icons/arrow-right.png"
|
||||||
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
|
#define PREV_FILE_ICON ":/icons/arrow-left.png"
|
||||||
|
#define LAST_FILE_ICON ":/icons/arrow-right-double.png"
|
||||||
|
#define FIRST_FILE_ICON ":/icons/arrow-left-double.png"
|
||||||
|
#define FULLSCREEN_ICON ":/icons/view-fullscreen.png"
|
||||||
|
|
||||||
|
// Options dialog icons
|
||||||
|
#define APPEARANCE_ICON ":/icons/preferences-desktop-display.png"
|
||||||
|
#define POI_ICON ":/icons/flag_48.png"
|
||||||
|
#define SYSTEM_ICON ":/icons/system-run.png"
|
||||||
|
#define PRINT_EXPORT_ICON ":/icons/document-print-preview.png"
|
||||||
|
#define DATA_ICON ":/icons/view-filter.png"
|
||||||
|
|
||||||
#endif /* ICONS_H */
|
#endif /* ICONS_H */
|
||||||
|
251
src/igcparser.cpp
Normal file
@ -0,0 +1,251 @@
|
|||||||
|
#include <cstring>
|
||||||
|
#include "misc.h"
|
||||||
|
#include "igcparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
static bool readLat(const char *data, qreal &lat)
|
||||||
|
{
|
||||||
|
int d = str2int(data, 2);
|
||||||
|
int mi = str2int(data + 2, 2);
|
||||||
|
int mf = str2int(data + 4, 3);
|
||||||
|
if (d < 0 || mi < 0 || mf < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(data[7] == 'N' || data[7] == 'S'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
lat = d + (((qreal)mi + (qreal)mf/1000) / 60);
|
||||||
|
if (lat > 90)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[7] == 'S')
|
||||||
|
lat = -lat;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readLon(const char *data, qreal &lon)
|
||||||
|
{
|
||||||
|
int d = str2int(data, 3);
|
||||||
|
int mi = str2int(data + 3, 2);
|
||||||
|
int mf = str2int(data + 5, 3);
|
||||||
|
if (d < 0 || mi < 0 || mf < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!(data[8] == 'E' || data[8] == 'W'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
lon = d + (((qreal)mi + (qreal)mf/1000) / 60);
|
||||||
|
if (lon > 180)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[8] == 'W')
|
||||||
|
lon = -lon;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readAltitude(const char *data, qreal &ele)
|
||||||
|
{
|
||||||
|
int p;
|
||||||
|
|
||||||
|
if (!(data[0] == 'A' || data[0] == 'V'))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[1] == '-')
|
||||||
|
p = str2int(data + 2, 4);
|
||||||
|
else
|
||||||
|
p = str2int(data + 1, 5);
|
||||||
|
|
||||||
|
int g = str2int(data + 6, 5);
|
||||||
|
if (p < 0 || g < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (data[0] == 'A')
|
||||||
|
ele = (qreal)g;
|
||||||
|
else
|
||||||
|
ele = NAN;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readTimestamp(const char *data, QTime &time)
|
||||||
|
{
|
||||||
|
int h = str2int(data, 2);
|
||||||
|
int m = str2int(data + 2, 2);
|
||||||
|
int s = str2int(data + 4, 2);
|
||||||
|
|
||||||
|
if (h < 0 || m < 0 || s < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
time = QTime(h, m, s);
|
||||||
|
if (!time.isValid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool readARecord(const char *line, qint64 len)
|
||||||
|
{
|
||||||
|
if (len < 9 || line[0] != 'A')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (int i = 1; i < 7; i++)
|
||||||
|
if (!::isprint(line[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::readHRecord(const char *line, int len)
|
||||||
|
{
|
||||||
|
if (len < 10 || ::strncmp(line, "HFDTE", 5))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
int d = str2int(line + 5, 2);
|
||||||
|
int m = str2int(line + 7, 2);
|
||||||
|
int y = str2int(line + 9, 2);
|
||||||
|
|
||||||
|
if (y < 0 || m < 0 || d < 0) {
|
||||||
|
_errorString = "Invalid date header format";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_date = QDate(y + 2000 < QDate::currentDate().year() ? 2000 + y : 1900 + y,
|
||||||
|
m, d);
|
||||||
|
if (!_date.isValid()) {
|
||||||
|
_errorString = "Invalid date";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::readBRecord(TrackData &track, const char *line, int len)
|
||||||
|
{
|
||||||
|
qreal lat, lon, ele;
|
||||||
|
QTime time;
|
||||||
|
|
||||||
|
|
||||||
|
if (len < 35)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!readTimestamp(line + 1, time)) {
|
||||||
|
_errorString = "Invalid timestamp";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readLat(line + 7, lat)) {
|
||||||
|
_errorString = "Invalid latitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!readLon(line + 15, lon)) {
|
||||||
|
_errorString = "Invalid longitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readAltitude(line + 24, ele)) {
|
||||||
|
_errorString = "Invalid altitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (time < _time)
|
||||||
|
_date = _date.addDays(1);
|
||||||
|
_time = time;
|
||||||
|
|
||||||
|
Trackpoint t(Coordinates(lon, lat));
|
||||||
|
t.setTimestamp(QDateTime(_date, _time, Qt::UTC));
|
||||||
|
t.setElevation(ele);
|
||||||
|
track.append(t);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::readCRecord(RouteData &route, const char *line, int len)
|
||||||
|
{
|
||||||
|
qreal lat, lon;
|
||||||
|
|
||||||
|
|
||||||
|
if (len < 18)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!readLat(line + 1, lat)) {
|
||||||
|
_errorString = "Invalid latitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!readLon(line + 9, lon)) {
|
||||||
|
_errorString = "Invalid longitude";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(lat == 0 && lon == 0)) {
|
||||||
|
QByteArray ba(line + 18, len - 19);
|
||||||
|
|
||||||
|
Waypoint w(Coordinates(lon, lat));
|
||||||
|
w.setName(QString(ba.trimmed()));
|
||||||
|
route.append(w);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IGCParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
Q_UNUSED(waypoints);
|
||||||
|
qint64 len;
|
||||||
|
char line[76 + 2 + 1 + 1];
|
||||||
|
bool route = false, track = false;
|
||||||
|
|
||||||
|
|
||||||
|
_errorLine = 1;
|
||||||
|
_errorString.clear();
|
||||||
|
|
||||||
|
while (!file->atEnd()) {
|
||||||
|
len = file->readLine(line, sizeof(line));
|
||||||
|
|
||||||
|
if (len < 0) {
|
||||||
|
_errorString = "I/O error";
|
||||||
|
return false;
|
||||||
|
} else if (len > (qint64)sizeof(line) - 1) {
|
||||||
|
_errorString = "Line limit exceeded";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_errorLine == 1) {
|
||||||
|
if (!readARecord(line, len)) {
|
||||||
|
_errorString = "Invalid/missing A record";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (line[0] == 'H') {
|
||||||
|
if (!readHRecord(line, len))
|
||||||
|
return false;
|
||||||
|
} else if (line[0] == 'C') {
|
||||||
|
if (route) {
|
||||||
|
if (!readCRecord(routes.last() ,line, len))
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
route = true;
|
||||||
|
routes.append(RouteData());
|
||||||
|
}
|
||||||
|
} else if (line[0] == 'B') {
|
||||||
|
if (_date.isNull()) {
|
||||||
|
_errorString = "Missing date header";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!track) {
|
||||||
|
tracks.append(TrackData());
|
||||||
|
_time = QTime(0, 0);
|
||||||
|
track = true;
|
||||||
|
}
|
||||||
|
if (!readBRecord(tracks.last(), line, len))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_errorLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
32
src/igcparser.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef IGCPARSER_H
|
||||||
|
#define IGCPARSER_H
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
#include <QTime>
|
||||||
|
#include "parser.h"
|
||||||
|
|
||||||
|
|
||||||
|
class IGCParser : public Parser
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IGCParser() : _errorLine(0) {}
|
||||||
|
~IGCParser() {}
|
||||||
|
|
||||||
|
bool parse(QFile *file, QList<TrackData> &tracks,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints);
|
||||||
|
QString errorString() const {return _errorString;}
|
||||||
|
int errorLine() const {return _errorLine;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool readHRecord(const char *line, int len);
|
||||||
|
bool readBRecord(TrackData &track, const char *line, int len);
|
||||||
|
bool readCRecord(RouteData &route, const char *line, int len);
|
||||||
|
|
||||||
|
int _errorLine;
|
||||||
|
QString _errorString;
|
||||||
|
|
||||||
|
QDate _date;
|
||||||
|
QTime _time;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // IGCPARSER_H
|
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
InfoItem::InfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
|
||||||
{
|
{
|
||||||
|
#ifndef Q_OS_MAC
|
||||||
|
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
|
||||||
|
#endif // Q_OS_MAC
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoItem::updateBoundingRect()
|
void InfoItem::updateBoundingRect()
|
||||||
@ -40,6 +42,9 @@ void InfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|||||||
QList<KV>::const_iterator i;
|
QList<KV>::const_iterator i;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
|
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
|
||||||
for (i = _list.constBegin(); i != _list.constEnd(); i++) {
|
for (i = _list.constBegin(); i != _list.constEnd(); i++) {
|
||||||
painter->drawText(width, fm.height() - fm.descent(), i->key + ": ");
|
painter->drawText(width, fm.height() - fm.descent(), i->key + ": ");
|
||||||
width += fm.width(i->key + ": ");
|
width += fm.width(i->key + ": ");
|
||||||
@ -73,6 +78,7 @@ void InfoItem::insert(const QString &key, const QString &value)
|
|||||||
_list[i] = kv;
|
_list[i] = kv;
|
||||||
|
|
||||||
updateBoundingRect();
|
updateBoundingRect();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoItem::clear()
|
void InfoItem::clear()
|
||||||
|
40
src/keys.h
@ -4,26 +4,32 @@
|
|||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
#define NEXT_KEY Qt::Key_Space
|
#define NEXT_KEY Qt::Key_Space
|
||||||
#define PREV_KEY Qt::Key_Backspace
|
#define PREV_KEY Qt::Key_Backspace
|
||||||
#define FIRST_KEY Qt::Key_Home
|
#define FIRST_KEY Qt::Key_Home
|
||||||
#define LAST_KEY Qt::Key_End
|
#define LAST_KEY Qt::Key_End
|
||||||
#define MODIFIER Qt::ShiftModifier
|
#define MODIFIER Qt::ShiftModifier
|
||||||
|
|
||||||
|
#define ZOOM_IN QKeySequence::ZoomIn
|
||||||
|
#define ZOOM_OUT QKeySequence::ZoomOut
|
||||||
|
|
||||||
|
#define QUIT_SHORTCUT QKeySequence(QKeySequence::Quit)
|
||||||
|
#define OPEN_SHORTCUT QKeySequence(QKeySequence::Open)
|
||||||
|
#define CLOSE_SHORTCUT QKeySequence(QKeySequence::Close)
|
||||||
|
#define RELOAD_SHORTCUT QKeySequence(QKeySequence::Refresh)
|
||||||
|
#define EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E)
|
||||||
|
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
|
||||||
|
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
|
||||||
|
#define NEXT_MAP_SHORTCUT QKeySequence(QKeySequence::Forward)
|
||||||
|
#define PREV_MAP_SHORTCUT QKeySequence(QKeySequence::Back)
|
||||||
|
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
|
||||||
|
#define DISTANCE_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_D)
|
||||||
|
#define TIME_GRAPH_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_T)
|
||||||
|
|
||||||
#define QUIT_SHORTCUT QKeySequence::Quit
|
|
||||||
#define OPEN_SHORTCUT QKeySequence::Open
|
|
||||||
#define CLOSE_SHORTCUT QKeySequence::Close
|
|
||||||
#define RELOAD_SHORTCUT QKeySequence::Refresh
|
|
||||||
#define EXPORT_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_E)
|
|
||||||
#define SHOW_POI_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_P)
|
|
||||||
#define SHOW_MAP_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_M)
|
|
||||||
#define NEXT_MAP_SHORTCUT QKeySequence::Forward
|
|
||||||
#define PREV_MAP_SHORTCUT QKeySequence::Back
|
|
||||||
#define SHOW_GRAPHS_SHORTCUT QKeySequence(Qt::CTRL + Qt::Key_G)
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::META + Qt::CTRL + Qt::Key_F)
|
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::META + Qt::CTRL + Qt::Key_F)
|
||||||
#else // Q_OS_MAC
|
#else // Q_OS_MAC
|
||||||
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::Key_F11)
|
#define FULLSCREEN_SHORTCUT QKeySequence(Qt::Key_F11)
|
||||||
#endif // Q_OS_MAC
|
#endif // Q_OS_MAC
|
||||||
|
|
||||||
#endif // KEYS_H
|
#endif // KEYS_H
|
||||||
|
368
src/kmlparser.cpp
Normal file
@ -0,0 +1,368 @@
|
|||||||
|
#include "kmlparser.h"
|
||||||
|
|
||||||
|
|
||||||
|
qreal KMLParser::number()
|
||||||
|
{
|
||||||
|
bool res;
|
||||||
|
qreal ret = _reader.readElementText().toDouble(&res);
|
||||||
|
if (!res)
|
||||||
|
_reader.raiseError(QString("Invalid %1").arg(
|
||||||
|
_reader.name().toString()));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDateTime KMLParser::time()
|
||||||
|
{
|
||||||
|
QDateTime d = QDateTime::fromString(_reader.readElementText(),
|
||||||
|
Qt::ISODate);
|
||||||
|
if (!d.isValid())
|
||||||
|
_reader.raiseError(QString("Invalid %1").arg(
|
||||||
|
_reader.name().toString()));
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KMLParser::coord(Trackpoint &trackpoint)
|
||||||
|
{
|
||||||
|
QString data = _reader.readElementText();
|
||||||
|
const QChar *sp, *ep, *cp, *vp;
|
||||||
|
int c = 0;
|
||||||
|
qreal val[3];
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
|
||||||
|
sp = data.constData();
|
||||||
|
ep = sp + data.size();
|
||||||
|
|
||||||
|
for (cp = sp; cp < ep; cp++)
|
||||||
|
if (!cp->isSpace())
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (vp = cp; cp <= ep; cp++) {
|
||||||
|
if (cp->isSpace() || cp->isNull()) {
|
||||||
|
if (c > 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
val[c] = QString(vp, cp - vp).toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
val[c] = QStringRef(&data, vp - sp, cp - vp).toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (c == 1) {
|
||||||
|
trackpoint.setCoordinates(Coordinates(val[0], val[1]));
|
||||||
|
if (!trackpoint.coordinates().isValid())
|
||||||
|
return false;
|
||||||
|
} else if (c == 2)
|
||||||
|
trackpoint.setElevation(val[2]);
|
||||||
|
|
||||||
|
while (cp->isSpace())
|
||||||
|
cp++;
|
||||||
|
vp = cp;
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KMLParser::pointCoordinates(Waypoint &waypoint)
|
||||||
|
{
|
||||||
|
QString data = _reader.readElementText();
|
||||||
|
const QChar *sp, *ep, *cp, *vp;
|
||||||
|
int c = 0;
|
||||||
|
qreal val[3];
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
|
||||||
|
sp = data.constData();
|
||||||
|
ep = sp + data.size();
|
||||||
|
|
||||||
|
for (cp = sp; cp < ep; cp++)
|
||||||
|
if (!cp->isSpace())
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (vp = cp; cp <= ep; cp++) {
|
||||||
|
if (*cp == ',') {
|
||||||
|
if (c > 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
val[c] = QString(vp, cp - vp).toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
val[c] = QStringRef(&data, vp - sp, cp - vp).toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
c++;
|
||||||
|
vp = cp + 1;
|
||||||
|
} else if (cp->isSpace() || cp->isNull()) {
|
||||||
|
if (c < 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
val[c] = QString(vp, cp - vp).toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
val[c] = QStringRef(&data, vp - sp, cp - vp).toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
waypoint.setCoordinates(Coordinates(val[0], val[1]));
|
||||||
|
if (!waypoint.coordinates().isValid())
|
||||||
|
return false;
|
||||||
|
if (c == 2)
|
||||||
|
waypoint.setElevation(val[2]);
|
||||||
|
|
||||||
|
while (cp->isSpace())
|
||||||
|
cp++;
|
||||||
|
c = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KMLParser::lineCoordinates(TrackData &track)
|
||||||
|
{
|
||||||
|
QString data = _reader.readElementText();
|
||||||
|
const QChar *sp, *ep, *cp, *vp;
|
||||||
|
int c = 0;
|
||||||
|
qreal val[3];
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
|
||||||
|
sp = data.constData();
|
||||||
|
ep = sp + data.size();
|
||||||
|
|
||||||
|
for (cp = sp; cp < ep; cp++)
|
||||||
|
if (!cp->isSpace())
|
||||||
|
break;
|
||||||
|
|
||||||
|
for (vp = cp; cp <= ep; cp++) {
|
||||||
|
if (*cp == ',') {
|
||||||
|
if (c > 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
val[c] = QString(vp, cp - vp).toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
val[c] = QStringRef(&data, vp - sp, cp - vp).toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
c++;
|
||||||
|
vp = cp + 1;
|
||||||
|
} else if (cp->isSpace() || cp->isNull()) {
|
||||||
|
if (c < 1 || c > 2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
val[c] = QString(vp, cp - vp).toDouble(&res);
|
||||||
|
#else // QT_VERSION < 5
|
||||||
|
val[c] = QStringRef(&data, vp - sp, cp - vp).toDouble(&res);
|
||||||
|
#endif // QT_VERSION < 5
|
||||||
|
if (!res)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
track.append(Trackpoint(Coordinates(val[0], val[1])));
|
||||||
|
if (!track.last().coordinates().isValid())
|
||||||
|
return false;
|
||||||
|
if (c == 2)
|
||||||
|
track.last().setElevation(val[2]);
|
||||||
|
|
||||||
|
while (cp->isSpace())
|
||||||
|
cp++;
|
||||||
|
c = 0;
|
||||||
|
vp = cp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDateTime KMLParser::timeStamp()
|
||||||
|
{
|
||||||
|
QDateTime ts;
|
||||||
|
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "when")
|
||||||
|
ts = time();
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::lineString(TrackData &track)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "coordinates") {
|
||||||
|
if (!lineCoordinates(track))
|
||||||
|
_reader.raiseError("Invalid coordinates");
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::point(Waypoint &waypoint)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "coordinates") {
|
||||||
|
if (!pointCoordinates(waypoint))
|
||||||
|
_reader.raiseError("Invalid coordinates");
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (waypoint.coordinates().isNull())
|
||||||
|
_reader.raiseError("Missing Point coordinates");
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::track(TrackData &track)
|
||||||
|
{
|
||||||
|
const char mismatchError[] = "gx:coord/when element count mismatch";
|
||||||
|
int i = track.size();
|
||||||
|
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "when") {
|
||||||
|
track.append(Trackpoint());
|
||||||
|
track.last().setTimestamp(time());
|
||||||
|
} else if (_reader.name() == "coord") {
|
||||||
|
if (i == track.size()) {
|
||||||
|
_reader.raiseError(mismatchError);
|
||||||
|
return;
|
||||||
|
} else if (!coord(track[i])) {
|
||||||
|
_reader.raiseError("Invalid coordinates");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != track.size())
|
||||||
|
_reader.raiseError(mismatchError);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::multiGeometry(QList<TrackData> &tracks,
|
||||||
|
QList<Waypoint> &waypoints, const QString &name, const QString &desc,
|
||||||
|
const QDateTime timestamp)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Point") {
|
||||||
|
waypoints.append(Waypoint());
|
||||||
|
Waypoint &w = waypoints.last();
|
||||||
|
w.setName(name);
|
||||||
|
w.setDescription(desc);
|
||||||
|
w.setTimestamp(timestamp);
|
||||||
|
point(w);
|
||||||
|
} else if (_reader.name() == "LineString") {
|
||||||
|
tracks.append(TrackData());
|
||||||
|
TrackData &t = tracks.last();
|
||||||
|
t.setName(name);
|
||||||
|
t.setDescription(desc);
|
||||||
|
lineString(t);
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::placemark(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
QString name, desc;
|
||||||
|
QDateTime timestamp;
|
||||||
|
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "name")
|
||||||
|
name = _reader.readElementText();
|
||||||
|
else if (_reader.name() == "description")
|
||||||
|
desc = _reader.readElementText();
|
||||||
|
else if (_reader.name() == "TimeStamp")
|
||||||
|
timestamp = timeStamp();
|
||||||
|
else if (_reader.name() == "MultiGeometry")
|
||||||
|
multiGeometry(tracks, waypoints, name, desc, timestamp);
|
||||||
|
else if (_reader.name() == "Point") {
|
||||||
|
waypoints.append(Waypoint());
|
||||||
|
Waypoint &w = waypoints.last();
|
||||||
|
w.setName(name);
|
||||||
|
w.setDescription(desc);
|
||||||
|
w.setTimestamp(timestamp);
|
||||||
|
point(w);
|
||||||
|
} else if (_reader.name() == "LineString"
|
||||||
|
|| _reader.name() == "LinearRing") {
|
||||||
|
tracks.append(TrackData());
|
||||||
|
TrackData &t = tracks.last();
|
||||||
|
t.setName(name);
|
||||||
|
t.setDescription(desc);
|
||||||
|
lineString(t);
|
||||||
|
} else if (_reader.name() == "Track") {
|
||||||
|
tracks.append(TrackData());
|
||||||
|
TrackData &t = tracks.last();
|
||||||
|
t.setName(name);
|
||||||
|
t.setDescription(desc);
|
||||||
|
track(t);
|
||||||
|
} else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::folder(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Placemark")
|
||||||
|
placemark(tracks, waypoints);
|
||||||
|
else if (_reader.name() == "Folder")
|
||||||
|
folder(tracks, waypoints);
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::document(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Placemark")
|
||||||
|
placemark(tracks, waypoints);
|
||||||
|
else if (_reader.name() == "Folder")
|
||||||
|
folder(tracks, waypoints);
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void KMLParser::kml(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
while (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "Document")
|
||||||
|
document(tracks, waypoints);
|
||||||
|
else if (_reader.name() == "Placemark")
|
||||||
|
placemark(tracks, waypoints);
|
||||||
|
else
|
||||||
|
_reader.skipCurrentElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KMLParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||||
|
QList<RouteData> &routes, QList<Waypoint> &waypoints)
|
||||||
|
{
|
||||||
|
Q_UNUSED(routes);
|
||||||
|
|
||||||
|
_reader.clear();
|
||||||
|
_reader.setDevice(file);
|
||||||
|
|
||||||
|
if (_reader.readNextStartElement()) {
|
||||||
|
if (_reader.name() == "kml")
|
||||||
|
kml(tracks, waypoints);
|
||||||
|
else
|
||||||
|
_reader.raiseError("Not a KML file");
|
||||||
|
}
|
||||||
|
|
||||||
|
return !_reader.error();
|
||||||
|
}
|