mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-01 21:39:15 +02:00
Compare commits
108 Commits
Author | SHA1 | Date | |
---|---|---|---|
3202fc4c15 | |||
5852a9dc09 | |||
c587d8cd9a | |||
586f30a337 | |||
da06c032bc | |||
3def9f95b0 | |||
dc25290637 | |||
9fd5b1b80a | |||
94ee5b6e67 | |||
9556476f1b | |||
b6e798f5c3 | |||
e82f2a02c2 | |||
361ffacc35 | |||
18fc6cc3e2 | |||
9815f0bff2 | |||
805cbe921c | |||
d529055ea3 | |||
5d590b7c86 | |||
1003c7b56f | |||
820f967bd6 | |||
27632bf07e | |||
ee5b8fa333 | |||
7e42b57d73 | |||
292fc9b433 | |||
089d796194 | |||
2677bb77f8 | |||
13dba26d3e | |||
9675e19b94 | |||
8d3fcc7a17 | |||
8dc5cb7aa8 | |||
af99e4e05a | |||
d18c0d1643 | |||
b9a93d30c0 | |||
2b6d3799ec | |||
152828042f | |||
e1683a7560 | |||
444cf344a9 | |||
7ac0bcf6d2 | |||
a1ac306bfc | |||
db4a436ff5 | |||
84a6f6c875 | |||
06f2c883d4 | |||
fc95ebfe2b | |||
4b64ee467c | |||
331cb48e11 | |||
fce0c49504 | |||
f670fb0859 | |||
1e45713aa4 | |||
7265c85b83 | |||
4d156044d0 | |||
17c9416532 | |||
8e9db2354e | |||
544a838821 | |||
44d84bf19e | |||
4ca9c79dc4 | |||
cb77cc37c4 | |||
98dd8c264c | |||
84d860e2a2 | |||
e10f8e9c1b | |||
f433f855a4 | |||
c90a03e22c | |||
fbc0fd86cf | |||
aa07b20aa4 | |||
8a7edcfd8d | |||
04a145a2e7 | |||
66f0f6a202 | |||
5698b4c9b0 | |||
77c4eda385 | |||
d6de3acbd2 | |||
652ed8e919 | |||
58e1980b0d | |||
fda33cc95b | |||
02e724fefb | |||
da220c4b62 | |||
6ffc71fd36 | |||
635e2f1fe3 | |||
23e4e66c1b | |||
1739625896 | |||
e9ef68a81c | |||
06205470fe | |||
c535632eb6 | |||
9f1f06577c | |||
0e45831111 | |||
0c8e864d32 | |||
c9cac70e1f | |||
045cbe81bf | |||
bffd1d9172 | |||
b8102d6bb7 | |||
fc80bd1b7c | |||
2441c4996d | |||
89878fade1 | |||
83b7741ed9 | |||
f44b14473d | |||
699de8b133 | |||
b7dd11fa1f | |||
0a32a9b865 | |||
02ad65461c | |||
5fa52b0166 | |||
99fa39030f | |||
6ebf749bdc | |||
5e74642dc8 | |||
b1d1cae9dd | |||
84f41b5aa9 | |||
de2278ba04 | |||
e90f152432 | |||
8deab1c9ca | |||
51e0f9a9c6 | |||
e330abe180 |
@ -1,4 +1,4 @@
|
||||
version: 4.17.{build}
|
||||
version: 5.2.{build}
|
||||
configuration: Release
|
||||
platform: Any CPU
|
||||
environment:
|
||||
@ -34,11 +34,11 @@ build_script:
|
||||
|
||||
copy pkg\%NSI% installer
|
||||
|
||||
copy pkg\datums.csv installer
|
||||
xcopy pkg\csv installer\csv /i
|
||||
|
||||
copy pkg\ellipsoids.csv installer
|
||||
xcopy pkg\maps installer\maps /i
|
||||
|
||||
copy pkg\maps.txt installer
|
||||
xcopy lang\*.qm installer\translations\ /sy
|
||||
|
||||
copy licence.txt installer
|
||||
|
||||
@ -49,4 +49,4 @@ build_script:
|
||||
|
||||
makensis.exe installer\%NSI%
|
||||
artifacts:
|
||||
- path: installer\GPXSee-*.exe
|
||||
- path: installer\GPXSee-*.exe
|
||||
|
13
.gitignore
vendored
Normal file
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# C++ objects and libs
|
||||
*.o
|
||||
|
||||
# Qt-es
|
||||
/.qmake.stash
|
||||
moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
Makefile*
|
||||
*.qm
|
||||
|
||||
# Binary
|
||||
GPXSee
|
7
CONTRIBUTING.md
Normal file
7
CONTRIBUTING.md
Normal file
@ -0,0 +1,7 @@
|
||||
Only localization contributions are accepted at the moment, code pull requests will be rejected.
|
||||
|
||||
The rationale is, that I want leave the possibility to distribute GPXsee builds in the OS X/Windows
|
||||
stores under a non-GPL licence open. In the future, code pull requests under a QT-like contribution
|
||||
agreement [1] will be possible.
|
||||
|
||||
[1] https://d21tv0wm5mksdn.cloudfront.net/wp-content/uploads/2015/03/Qt-ContributionLicenseAgreement_v1_2_FINAL.pdf
|
@ -4,7 +4,7 @@ KML, FIT, IGC and NMEA files.
|
||||
|
||||
## Features
|
||||
* User-definable online maps.
|
||||
* Offline maps (OziExplorer maps and TrekBuddy maps/atlases).
|
||||
* Offline maps (OziExplorer maps, TrekBuddy maps/atlases, GeoTIFF images).
|
||||
* Elevation, speed, heart rate, cadence, power and temperature graphs.
|
||||
* Support for multiple tracks in one view.
|
||||
* Support for POI files.
|
||||
|
60
gpxsee.pro
60
gpxsee.pro
@ -1,5 +1,5 @@
|
||||
TARGET = GPXSee
|
||||
VERSION = 4.17
|
||||
VERSION = 5.2
|
||||
QT += core \
|
||||
gui \
|
||||
network
|
||||
@ -14,6 +14,7 @@ HEADERS += src/config.h \
|
||||
src/common/range.h \
|
||||
src/common/rectc.h \
|
||||
src/common/wgs84.h \
|
||||
src/common/str2int.h \
|
||||
src/GUI/app.h \
|
||||
src/GUI/icons.h \
|
||||
src/GUI/gui.h \
|
||||
@ -86,7 +87,11 @@ HEADERS += src/config.h \
|
||||
src/map/ozf.h \
|
||||
src/map/atlas.h \
|
||||
src/map/matrix.h \
|
||||
src/map/misc.h \
|
||||
src/map/geotiff.h \
|
||||
src/map/pcs.h \
|
||||
src/map/transform.h \
|
||||
src/map/mapfile.h \
|
||||
src/map/tifffile.h \
|
||||
src/data/graph.h \
|
||||
src/data/poi.h \
|
||||
src/data/waypoint.h \
|
||||
@ -106,11 +111,17 @@ HEADERS += src/config.h \
|
||||
src/data/fitparser.h \
|
||||
src/data/igcparser.h \
|
||||
src/data/nmeaparser.h \
|
||||
src/data/str2int.h
|
||||
src/map/gcs.h \
|
||||
src/map/angularunits.h \
|
||||
src/map/primemeridian.h \
|
||||
src/map/linearunits.h \
|
||||
src/map/ct.h \
|
||||
src/map/mapsource.h
|
||||
SOURCES += src/main.cpp \
|
||||
src/common/coordinates.cpp \
|
||||
src/common/rectc.cpp \
|
||||
src/common/range.cpp \
|
||||
src/common/str2int.cpp \
|
||||
src/GUI/app.cpp \
|
||||
src/GUI/gui.cpp \
|
||||
src/GUI/axisitem.cpp \
|
||||
@ -163,13 +174,17 @@ SOURCES += src/main.cpp \
|
||||
src/map/matrix.cpp \
|
||||
src/map/ellipsoid.cpp \
|
||||
src/map/datum.cpp \
|
||||
src/map/projection.cpp \
|
||||
src/map/mercator.cpp \
|
||||
src/map/transversemercator.cpp \
|
||||
src/map/utm.cpp \
|
||||
src/map/lambertconic.cpp \
|
||||
src/map/albersequal.cpp \
|
||||
src/map/lambertazimuthal.cpp \
|
||||
src/map/geotiff.cpp \
|
||||
src/map/pcs.cpp \
|
||||
src/map/transform.cpp \
|
||||
src/map/mapfile.cpp \
|
||||
src/map/tifffile.cpp \
|
||||
src/data/data.cpp \
|
||||
src/data/poi.cpp \
|
||||
src/data/track.cpp \
|
||||
@ -182,25 +197,40 @@ SOURCES += src/main.cpp \
|
||||
src/data/fitparser.cpp \
|
||||
src/data/igcparser.cpp \
|
||||
src/data/nmeaparser.cpp \
|
||||
src/data/str2int.cpp
|
||||
src/map/projection.cpp \
|
||||
src/map/gcs.cpp \
|
||||
src/map/angularunits.cpp \
|
||||
src/map/primemeridian.cpp \
|
||||
src/map/linearunits.cpp \
|
||||
src/map/mapsource.cpp
|
||||
RESOURCES += gpxsee.qrc
|
||||
TRANSLATIONS = lang/gpxsee_cs.ts \
|
||||
lang/gpxsee_sv.ts \
|
||||
lang/gpxsee_de.ts
|
||||
lang/gpxsee_de.ts \
|
||||
lang/gpxsee_ru.ts \
|
||||
lang/gpxsee_fi.ts \
|
||||
lang/gpxsee_fr.ts
|
||||
macx {
|
||||
ICON = icons/gpxsee.icns
|
||||
QMAKE_INFO_PLIST = Info.plist
|
||||
APP_RESOURCES.files = icons/gpx.icns \
|
||||
icons/tcx.icns \
|
||||
QMAKE_INFO_PLIST = pkg/Info.plist
|
||||
LOCALE.path = Contents/Resources/translations
|
||||
LOCALE.files = lang/gpxsee_cs.qm \
|
||||
lang/gpxsee_de.qm \
|
||||
lang/gpxsee_fi.qm \
|
||||
lang/gpxsee_fr.qm \
|
||||
lang/gpxsee_ru.qm \
|
||||
lang/gpxsee_sv.qm
|
||||
CSV.path = Contents/Resources
|
||||
CSV.files = pkg/csv
|
||||
MAPS.path = Contents/Resources
|
||||
MAPS.files = pkg/maps
|
||||
ICONS.path = Contents/Resources/icons
|
||||
ICONS.files = 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
|
||||
QMAKE_BUNDLE_DATA += APP_RESOURCES
|
||||
icons/nmea.icns
|
||||
QMAKE_BUNDLE_DATA += LOCALE MAPS ICONS CSV
|
||||
}
|
||||
win32 {
|
||||
RC_ICONS = icons/gpxsee.ico \
|
||||
|
@ -20,8 +20,5 @@
|
||||
<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_sv.qm</file>
|
||||
<file>lang/gpxsee_de.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1564
lang/gpxsee_fi.ts
Normal file
1564
lang/gpxsee_fi.ts
Normal file
File diff suppressed because it is too large
Load Diff
1564
lang/gpxsee_fr.ts
Normal file
1564
lang/gpxsee_fr.ts
Normal file
File diff suppressed because it is too large
Load Diff
1565
lang/gpxsee_ru.ts
Normal file
1565
lang/gpxsee_ru.ts
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,7 @@
|
||||
<string>application/gpx+xml</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>gpx.icns</string>
|
||||
<string>icons/gpx.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>GPS Exchange Format</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@ -45,7 +45,7 @@
|
||||
<string>application/tcx+xml</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>tcx.icns</string>
|
||||
<string>icons/tcx.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Training Center XML</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@ -61,7 +61,7 @@
|
||||
<string>application/vnd.google-earth.kml+xml</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>kml.icns</string>
|
||||
<string>icons/kml.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Keyhole Markup Language</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@ -77,7 +77,7 @@
|
||||
<string>application/vnd.ant.fit</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>fit.icns</string>
|
||||
<string>icons/fit.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Flexible and Interoperable Data Transfer</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@ -93,7 +93,7 @@
|
||||
<string>application/vnd.fai.igc</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>igc.icns</string>
|
||||
<string>icons/igc.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Flight Recorder Data Format</string>
|
||||
<key>CFBundleTypeRole</key>
|
||||
@ -109,7 +109,7 @@
|
||||
<string>application/vnd.nmea.nmea</string>
|
||||
</array>
|
||||
<key>CFBundleTypeIconFile</key>
|
||||
<string>nmea.icns</string>
|
||||
<string>icons/nmea.icns</string>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>NMEA 0183 data</string>
|
||||
<key>CFBundleTypeRole</key>
|
58
pkg/appdata.xml
Normal file
58
pkg/appdata.xml
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>gpxsee.desktop</id>
|
||||
<metadata_license>MIT</metadata_license>
|
||||
<project_license>GPL-3.0</project_license>
|
||||
|
||||
<name>GPXSee</name>
|
||||
<summary>GPS log file viewer and analyzer</summary>
|
||||
<description>
|
||||
<p>GPXSee is a GPS log file viewer and analyzer that supports GPX, TCX,
|
||||
KML, FIT, IGC and NMEA files.</p>
|
||||
|
||||
<p>Features:</p>
|
||||
<ul>
|
||||
<li>User-definable online maps.</li>
|
||||
<li>Offline maps (OziExplorer maps, TrekBuddy maps/atlases, GeoTIFF
|
||||
images).</li>
|
||||
<li>Elevation, speed, heart rate, cadence, power and temperature
|
||||
graphs.</li>
|
||||
<li>Support for multiple tracks in one view.</li>
|
||||
<li>Support for POI files.</li>
|
||||
<li>Print/export to PDF.</li>
|
||||
<li>Full-screen mode.</li>
|
||||
<li>Opens GPX, TCX, FIT, KML, IGC, NMEA and Garmin CSV files.</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
||||
<screenshots>
|
||||
<screenshot type="default">
|
||||
<image>http://www.gpxsee.org/gallery/lin1.png</image>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>http://www.gpxsee.org/gallery/lin2.png</image>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
|
||||
<categories>
|
||||
<category>Graphics</category>
|
||||
<category>Viewer</category>
|
||||
</categories>
|
||||
|
||||
<url type="homepage">http://www.gpxsee.org</url>
|
||||
|
||||
<launchable type="desktop-id">gpxsee.desktop</launchable>
|
||||
|
||||
<provides>
|
||||
<binary>gpxsee</binary>
|
||||
</provides>
|
||||
|
||||
<mimetypes>
|
||||
<mimetype>application/gpx+xml</mimetype>
|
||||
<mimetype>application/tcx+xml</mimetype>
|
||||
<mimetype>application/vnd.ant.fit</mimetype>
|
||||
<mimetype>application/vnd.google-earth.kml+xml</mimetype>
|
||||
<mimetype>application/vnd.fai.igc</mimetype>
|
||||
<mimetype>application/vnd.nmea.nmea</mimetype>
|
||||
</mimetypes>
|
||||
</component>
|
19
pkg/csv/ellipsoids.csv
Normal file
19
pkg/csv/ellipsoids.csv
Normal file
@ -0,0 +1,19 @@
|
||||
Airy 1830,7001,6377563.396,299.3249646
|
||||
Modified Airy,7002,6377340.189,299.3249646
|
||||
Australian National,7003,6378160.0,298.25
|
||||
Bessel 1841,7004,6377397.155,299.1528128
|
||||
Bessel 1841 (Norway),7005,6377492.0176,299.1528
|
||||
Clarke 1866,7008,6378206.4,294.9786982
|
||||
Clarke 1880 (Palestine),7010,6378300.789,293.466
|
||||
Clarke 1880 (IGN),7011,6378249.2,293.466021
|
||||
Clarke 1880,7012,6378249.145,293.465
|
||||
Everest 1830 (1937 Adjustment),7015,6377276.345,300.8017
|
||||
Everest 1830 Modified,7018,6377304.063,300.8017
|
||||
GRS 80,7019,6378137.0,298.257222101
|
||||
Helmert 1906,7020,6378200.0,298.3
|
||||
International 1924,7022,6378388.0,297.0
|
||||
Krassovsky 1940,7024,6378245.0,298.3
|
||||
South American 1969,7036,6378160.0,298.25
|
||||
WGS 72,7043,6378135.0,298.26
|
||||
Bessel 1841 (Namibia),7046,6377483.865,299.1528128
|
||||
Hough 1960,7053,6378270.0,297.0
|
|
121
pkg/csv/gcs.csv
Normal file
121
pkg/csv/gcs.csv
Normal file
@ -0,0 +1,121 @@
|
||||
Adindan,4201,6201,9122,7012,8901,9603,-162,-12,206
|
||||
Afgooye,4205,6205,9122,7024,8901,9603,-43,-163,45
|
||||
Ain el Abd 1970,4204,6204,9122,7022,8901,9603,-150,-251,-2
|
||||
Anna 1 Astro 1965,4708,6708,9122,7003,8901,9603,-491,-22,435
|
||||
Arc 1950,4209,6209,9122,7012,8901,9603,-143,-90,-294
|
||||
Arc 1960,4210,6210,9122,7012,8901,9603,-160,-8,-300
|
||||
Ascension Island 1958,4712,6712,9122,7022,8901,9603,-207,107,52
|
||||
Astro B4 Sorol Atoll,4707,6707,9122,7022,8901,9603,114,-116,-333
|
||||
Astro Beacon 1945,4709,6709,9122,7022,8901,9603,145,75,-272
|
||||
Astro DOS 71/4,4710,6710,9122,7022,8901,9603,-320,550,-494
|
||||
Astronomic Stn 1952,4711,6711,9122,7022,8901,9603,124,-234,-25
|
||||
Australian Geodetic 1966,4202,6202,9122,7003,8901,9603,-133,-48,148
|
||||
Australian Geodetic 1984,4203,6203,9122,7003,8901,9603,-134,-48,149
|
||||
Australian Geocentric 1994 (GDA94),4283,6283,9122,7019,8901,9603,0,0,0
|
||||
Austrian,4312,6312,9122,7004,8901,9603,594,84,471
|
||||
Bellevue (IGN),4714,6714,9122,7022,8901,9603,-127,-769,472
|
||||
Bermuda 1957,4216,6216,9122,7008,8901,9603,-73,213,296
|
||||
Bogota Observatory,4218,6218,9122,7022,8901,9603,307,304,-318
|
||||
Campo Inchauspe,4221,6221,9122,7022,8901,9603,-148,136,90
|
||||
Canton Astro 1966,4716,6716,9122,7022,8901,9603,298,-304,-375
|
||||
Cape,4222,6222,9122,7012,8901,9603,-136,-108,-292
|
||||
Cape Canaveral,4717,6717,9122,7008,8901,9603,-2,150,181
|
||||
Carthage,4223,6223,9122,7012,8901,9603,-263,6,431
|
||||
CH-1903,4149,6149,9122,7004,8901,9603,674,15,405
|
||||
Chatham 1971,4672,6672,9122,7022,8901,9603,175,-38,113
|
||||
Chua Astro,4224,6224,9122,7022,8901,9603,-134,229,-29
|
||||
Corrego Alegre,4225,6225,9122,7022,8901,9603,-206,172,-6
|
||||
Djakarta (Batavia),4211,6211,9122,7004,8901,9603,-377,681,-50
|
||||
DOS 1968,,,9122,7022,8901,9603,230,-199,-752
|
||||
Easter Island 1967,4719,6719,9122,7022,8901,9603,211,147,111
|
||||
Egypt,4199,6199,9122,7022,8901,9603,-130,-117,-151
|
||||
European 1950,4230,6230,9122,7022,8901,9603,-87,-98,-121
|
||||
European 1950 (Mean France),,,9122,7022,8901,9603,-87,-96,-120
|
||||
European 1950 (Spain and Portugal),,,9122,7022,8901,9603,-84,-107,-120
|
||||
European 1979,4668,6668,9122,7022,8901,9603,-86,-98,-119
|
||||
Finland Hayford,4123,6123,9122,7022,8901,9603,-78,-231,-97
|
||||
Gandajika Base,4233,6233,9122,7022,8901,9603,-133,-321,50
|
||||
Geodetic Datum 1949,4272,6272,9122,7022,8901,9603,84,-22,209
|
||||
GGRS 87,4121,6121,9122,7019,8901,9603,-199.87,74.79,246.62
|
||||
Guam 1963,4675,6675,9122,7008,8901,9603,-100,-248,259
|
||||
GUX 1 Astro,4718,6718,9122,7022,8901,9603,252,-209,-751
|
||||
Hartebeeshoek94,4148,6148,9122,7030,8901,9603,0,0,0
|
||||
Hermannskogel,3906,1031,9122,7004,8901,9603,653,-212,449
|
||||
Hjorsey 1955,4658,6658,9122,7022,8901,9603,-73,46,-86
|
||||
Hong Kong 1963,4739,6739,9122,7022,8901,9603,-156,-271,-189
|
||||
Hu-Tzu-Shan,4236,6236,9122,7022,8901,9603,-634,-549,-201
|
||||
Indian Bangladesh,4682,6682,9122,7015,8901,9603,289,734,257
|
||||
Indian Thailand,4240,6240,9122,7015,8901,9603,214,836,303
|
||||
Israeli,4281,6281,9122,7010,8901,9603,-235,-85,264
|
||||
Ireland 1965,4299,6299,9122,7002,8901,9603,506,-122,611
|
||||
ISTS 073 Astro 1969,4724,6724,9122,7022,8901,9603,208,-435,-229
|
||||
Johnston Island,4725,6725,9122,7022,8901,9603,191,-77,-204
|
||||
Kandawala,4244,6244,9122,7015,8901,9603,-97,787,86
|
||||
Kerguelen Island,4698,6698,9122,7022,8901,9603,145,-187,103
|
||||
Kertau 1948,4245,6245,9122,7018,8901,9603,-11,851,5
|
||||
L.C. 5 Astro,4726,6726,9122,7008,8901,9603,42,124,147
|
||||
Liberia 1964,4251,6251,9122,7012,8901,9603,-90,40,88
|
||||
Luzon Mindanao,,,9122,7008,8901,9603,-133,-79,-72
|
||||
Luzon Philippines,4253,6253,9122,7008,8901,9603,-133,-77,-51
|
||||
Mahe 1971,4256,6256,9122,7012,8901,9603,41,-220,-134
|
||||
Marco Astro,4616,6616,9122,7022,8901,9603,-289,-124,60
|
||||
Massawa,4262,6262,9122,7004,8901,9603,639,405,60
|
||||
Merchich,4261,6261,9122,7012,8901,9603,31,146,47
|
||||
Midway Astro 1961,4727,6727,9122,7022,8901,9603,912,-58,1227
|
||||
Minna,4263,6263,9122,7012,8901,9603,-92,-93,122
|
||||
NAD27 Alaska,,,9122,7008,8901,9603,-5,135,172
|
||||
NAD27 Bahamas,,,9122,7008,8901,9603,-4,154,178
|
||||
NAD27 Canada,,,9122,7008,8901,9603,-10,158,187
|
||||
NAD27 Canal Zone,,,9122,7008,8901,9603,0,125,201
|
||||
NAD27 Caribbean,,,9122,7008,8901,9603,-3,142,183
|
||||
NAD27 Central,,,9122,7008,8901,9603,0,125,194
|
||||
NAD27 CONUS,4267,6267,9122,7008,8901,9603,-8,160,176
|
||||
NAD27 Cuba,,,9122,7008,8901,9603,-9,152,178
|
||||
NAD27 Greenland,,,9122,7008,8901,9603,11,114,195
|
||||
NAD27 Mexico,,,9122,7008,8901,9603,-12,130,190
|
||||
NAD27 San Salvador,,,9122,7008,8901,9603,1,140,165
|
||||
NAD83,4269,6269,9122,7019,8901,9603,0,0,0
|
||||
Nahrwn Masirah Ilnd,,,9122,7012,8901,9603,-247,-148,369
|
||||
Nahrwn Saudi Arbia,,,9122,7012,8901,9603,-231,-196,482
|
||||
Nahrwn United Arab,4270,6270,9122,7012,8901,9603,-249,-156,381
|
||||
Naparima BWI,4271,6271,9122,7022,8901,9603,-2,374,172
|
||||
NGO1948,4273,6273,9122,7005,8901,9603,315,-217,528
|
||||
NTF France,4275,6275,9122,7011,8901,9603,-168,-60,320
|
||||
Norsk,4817,6817,9122,7005,8913,9603,278,93,474
|
||||
NZGD1949,4272,6272,9122,7022,8901,9603,84,-22,209
|
||||
NZGD2000,4167,6167,9122,7030,8901,9603,0,0,0
|
||||
Observatorio 1966,4182,6182,9122,7022,8901,9603,-425,-169,81
|
||||
Old Egyptian,4229,6229,9122,7020,8901,9603,-130,110,-13
|
||||
Old Hawaiian,4135,6135,9122,7008,8901,9603,61,-285,-181
|
||||
Oman,4232,6232,9122,7012,8901,9603,-346,-1,224
|
||||
Ord Srvy Grt Britn,4277,6277,9122,7001,8901,9603,375,-111,431
|
||||
Pico De Las Nieves,4728,6728,9122,7022,8901,9603,-307,-92,127
|
||||
Pitcairn Astro 1967,4729,6729,9122,7022,8901,9603,185,165,42
|
||||
Potsdam Rauenberg DHDN,4314,6314,9122,7004,8901,9603,606,23,413
|
||||
Prov So Amrican 1956,4248,6248,9122,7022,8901,9603,-288,175,-376
|
||||
Prov So Chilean 1963,4254,6254,9122,7022,8901,9603,16,196,93
|
||||
Puerto Rico,4139,6139,9122,7008,8901,9603,11,72,-101
|
||||
Pulkovo 1942 (1),4284,6284,9122,7024,8901,9603,28,-130,-95
|
||||
Pulkovo 1942 (2),,,9122,7024,8901,9603,28,-130,-95
|
||||
Qatar National,4285,6285,9122,7022,8901,9603,-128,-283,22
|
||||
Qornoq,4287,6287,9108,7022,8901,9603,164,138,-189
|
||||
Reunion,4626,6626,9122,7022,8901,9603,94,-948,-1262
|
||||
Rijksdriehoeksmeting,4289,6289,9122,7004,8901,9603,593,26,478
|
||||
Rome 1940,4806,6806,9122,7022,8906,9603,-225,-65,9
|
||||
RT 90,4124,6124,9122,7004,8901,9603,498,-36,568
|
||||
S42,4179,6179,9122,7024,8901,9603,28,-121,-77
|
||||
Santo (DOS),4730,6730,9122,7022,8901,9603,170,42,84
|
||||
Sao Braz,4184,6184,9122,7022,8901,9603,-203,141,53
|
||||
Sapper Hill 1943,4292,6292,9122,7022,8901,9603,-355,16,74
|
||||
Schwarzeck,4293,6293,9122,7046,8901,9603,616,97,-251
|
||||
South American 1969,4291,6291,9108,7036,8901,9603,-57,1,-41
|
||||
Southeast Base,4615,6615,9122,7022,8901,9603,-499,-249,314
|
||||
Southwest Base,4183,6183,9122,7022,8901,9603,-104,167,-38
|
||||
Timbalai 1948,4298,6298,9122,7015,8901,9603,-689,691,-46
|
||||
Tokyo,4301,6301,9122,7004,8901,9603,-128,481,664
|
||||
Tristan Astro 1968,4734,6734,9122,7022,8901,9603,-632,438,-609
|
||||
Viti Levu 1916,4731,6731,9122,7012,8901,9603,51,391,-36
|
||||
Wake-Eniwetok 1960,4732,6732,9122,7053,8901,9603,101,52,-39
|
||||
WGS 72,4322,6322,9122,7043,8901,9603,0,0,5
|
||||
Yacare,4309,6309,9122,7022,8901,9603,-155,171,37
|
||||
Zanderij,4311,6311,9122,7022,8901,9603,-265,120,-358
|
|
1626
pkg/csv/pcs.csv
Normal file
1626
pkg/csv/pcs.csv
Normal file
File diff suppressed because it is too large
Load Diff
123
pkg/datums.csv
123
pkg/datums.csv
@ -1,123 +0,0 @@
|
||||
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
|
|
@ -1,30 +0,0 @@
|
||||
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
|
|
12
pkg/gpxsee.desktop
Normal file
12
pkg/gpxsee.desktop
Normal file
@ -0,0 +1,12 @@
|
||||
[Desktop Entry]
|
||||
Name=GPXSee
|
||||
Comment=GPS log file viewer and analyzer
|
||||
Comment[cz]=Prohlížeč a analyzátor GPS logů
|
||||
Comment[fi]=Ohjelma GPS-lokien katseluun ja analysointiin
|
||||
Comment[ru]=Программа для просмотра и анализа GPS логов
|
||||
Exec=gpxsee %F
|
||||
Icon=gpxsee
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;Viewer;Maps;Qt;
|
||||
MimeType=application/gpx+xml;application/tcx+xml;application/vnd.ant.fit;application/vnd.google-earth.kml+xml;application/vnd.fai.igc;application/vnd.nmea.nmea;
|
@ -5,7 +5,7 @@
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "4.17"
|
||||
!define VERSION "5.2"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}.exe"
|
||||
@ -83,9 +83,8 @@ Section "GPXSee" SEC_APP
|
||||
|
||||
; Put the files there
|
||||
File "gpxsee.exe"
|
||||
File "maps.txt"
|
||||
File "ellipsoids.csv"
|
||||
File "datums.csv"
|
||||
File /r "maps"
|
||||
File /r "csv"
|
||||
|
||||
; Create start menu entry and add links
|
||||
SetShellVarContext all
|
||||
@ -195,6 +194,38 @@ Section "ANGLE" SEC_ANGLE
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroup "Localization" SEC_LOCALIZATION
|
||||
Section "Czech"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_cs.qm translations\gpxsee_cs.qm
|
||||
File /oname=translations\qt_cs.qm translations\qt_cs.qm
|
||||
SectionEnd
|
||||
Section "Finnish"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_fi.qm translations\gpxsee_fi.qm
|
||||
File /oname=translations\qt_fi.qm translations\qt_fi.qm
|
||||
SectionEnd
|
||||
Section "French"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_fr.qm translations\gpxsee_fr.qm
|
||||
File /oname=translations\qt_fr.qm translations\qt_fr.qm
|
||||
SectionEnd
|
||||
Section "German"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_de.qm translations\gpxsee_de.qm
|
||||
File /oname=translations\qt_de.qm translations\qt_de.qm
|
||||
SectionEnd
|
||||
Section "Russian"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_ru.qm translations\gpxsee_ru.qm
|
||||
File /oname=translations\qt_ru.qm translations\qt_ru.qm
|
||||
SectionEnd
|
||||
Section "Swedish"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_sv.qm translations\gpxsee_sv.qm
|
||||
SectionEnd
|
||||
SectionGroupEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
@ -246,6 +277,8 @@ LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||
LangString DESC_APP ${LANG_ENGLISH} \
|
||||
"GPXSee application"
|
||||
LangString DESC_LOCALIZATION ${LANG_ENGLISH} \
|
||||
"Localization"
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
@ -254,4 +287,5 @@ LangString DESC_APP ${LANG_ENGLISH} \
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_LOCALIZATION} $(DESC_LOCALIZATION)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
46
pkg/gpxsee.xml
Normal file
46
pkg/gpxsee.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
|
||||
<mime-type type="application/gpx+xml">
|
||||
<comment>GPS Exchange Format</comment>
|
||||
<sub-class-of type="application/xml"/>
|
||||
<generic-icon name="application-xml"/>
|
||||
<glob pattern="*.gpx"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/tcx+xml">
|
||||
<comment>Training Center XML</comment>
|
||||
<sub-class-of type="application/xml"/>
|
||||
<generic-icon name="application-xml"/>
|
||||
<glob pattern="*.tcx"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/kml+xml">
|
||||
<comment>Keyhole Markup Language</comment>
|
||||
<sub-class-of type="application/xml"/>
|
||||
<generic-icon name="application-xml"/>
|
||||
<glob pattern="*.kml"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.ant.fit">
|
||||
<comment>Flexible and Interoperable Data Transfer</comment>
|
||||
<sub-class-of type="application/octet-stream"/>
|
||||
<generic-icon name="application-octet-stream"/>
|
||||
<glob pattern="*.fit"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.fai.igc">
|
||||
<comment>Flight Recorder Data Format</comment>
|
||||
<sub-class-of type="text/plain"/>
|
||||
<generic-icon name="text-plain"/>
|
||||
<glob pattern="*.igc"/>
|
||||
</mime-type>
|
||||
|
||||
<mime-type type="application/vnd.nmea.nmea">
|
||||
<comment>NMEA 0183 data</comment>
|
||||
<sub-class-of type="text/plain"/>
|
||||
<generic-icon name="text-plain"/>
|
||||
<glob pattern="*.nmea"/>
|
||||
</mime-type>
|
||||
|
||||
</mime-info>
|
@ -5,7 +5,7 @@
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "4.17"
|
||||
!define VERSION "5.2"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
@ -90,9 +90,8 @@ Section "GPXSee" SEC_APP
|
||||
|
||||
; Put the files there
|
||||
File "gpxsee.exe"
|
||||
File "maps.txt"
|
||||
File "ellipsoids.csv"
|
||||
File "datums.csv"
|
||||
File /r "maps"
|
||||
File /r "csv"
|
||||
|
||||
; Create start menu entry and add links
|
||||
SetShellVarContext all
|
||||
@ -197,6 +196,38 @@ Section "ANGLE" SEC_ANGLE
|
||||
|
||||
SectionEnd
|
||||
|
||||
SectionGroup "Localization" SEC_LOCALIZATION
|
||||
Section "Czech"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_cs.qm translations\gpxsee_cs.qm
|
||||
File /oname=translations\qt_cs.qm translations\qt_cs.qm
|
||||
SectionEnd
|
||||
Section "Finnish"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_fi.qm translations\gpxsee_fi.qm
|
||||
File /oname=translations\qt_fi.qm translations\qt_fi.qm
|
||||
SectionEnd
|
||||
Section "French"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_fr.qm translations\gpxsee_fr.qm
|
||||
File /oname=translations\qt_fr.qm translations\qt_fr.qm
|
||||
SectionEnd
|
||||
Section "German"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_de.qm translations\gpxsee_de.qm
|
||||
File /oname=translations\qt_de.qm translations\qt_de.qm
|
||||
SectionEnd
|
||||
Section "Russian"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_ru.qm translations\gpxsee_ru.qm
|
||||
File /oname=translations\qt_ru.qm translations\qt_ru.qm
|
||||
SectionEnd
|
||||
Section "Swedish"
|
||||
CreateDirectory "$INSTDIR\translations"
|
||||
File /oname=translations\gpxsee_sv.qm translations\gpxsee_sv.qm
|
||||
SectionEnd
|
||||
SectionGroupEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
; Uninstaller
|
||||
@ -249,6 +280,8 @@ LangString DESC_ANGLE ${LANG_ENGLISH} \
|
||||
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
|
||||
LangString DESC_APP ${LANG_ENGLISH} \
|
||||
"GPXSee application"
|
||||
LangString DESC_LOCALIZATION ${LANG_ENGLISH} \
|
||||
"Localization"
|
||||
|
||||
;Assign language strings to sections
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
@ -257,4 +290,5 @@ LangString DESC_APP ${LANG_ENGLISH} \
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_LOCALIZATION} $(DESC_LOCALIZATION)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
@ -1,5 +0,0 @@
|
||||
Open Topo Map https://a.tile.opentopomap.org/$z/$x/$y.png 17
|
||||
4UMaps http://4umaps.eu/$z/$x/$y.png 15
|
||||
Open Street Map http://tile.openstreetmap.org/$z/$x/$y.png 19
|
||||
USGS Topo https://navigator.er.usgs.gov/tiles/tcr.cgi/$z/$x/$y.png 15
|
||||
USGS Imagery https://navigator.er.usgs.gov/tiles/aerial_Imagery.cgi/$z/$x/$y 15
|
8
pkg/maps/4UMaps.xml
Normal file
8
pkg/maps/4UMaps.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<name>4UMaps</name>
|
||||
<url>http://4umaps.eu/$z/$x/$y.png</url>
|
||||
<zoom min="2" max="15"/>
|
||||
<bounds bottom="-65"/>
|
||||
<copyright>Map data: © OpenStreetMap contributors (ODbL) | Rendering: © 4UMaps.eu</copyright>
|
||||
</map>
|
6
pkg/maps/OpenStreetMap.xml
Normal file
6
pkg/maps/OpenStreetMap.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<name>Open Street Map</name>
|
||||
<url>http://tile.openstreetmap.org/$z/$x/$y.png</url>
|
||||
<copyright>Map data: © OpenStreetMap contributors (ODbL) | Rendering: © OpenStreetMap (CC-BY-SA)</copyright>
|
||||
</map>
|
7
pkg/maps/OpenTopoMap.xml
Normal file
7
pkg/maps/OpenTopoMap.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<name>Open Topo Map</name>
|
||||
<url>https://a.tile.opentopomap.org/$z/$x/$y.png</url>
|
||||
<zoom max="17"/>
|
||||
<copyright>Map data: © OpenStreetMap contributors (ODbL), SRTM | Rendering: © OpenTopoMap (CC-BY-SA)</copyright>
|
||||
</map>
|
8
pkg/maps/USGS-imagery.xml
Normal file
8
pkg/maps/USGS-imagery.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<name>USGS Imagery</name>
|
||||
<url>https://navigator.er.usgs.gov/tiles/aerial_Imagery.cgi/$z/$x/$y</url>
|
||||
<zoom min="2" max="15"/>
|
||||
<bounds bottom="0" top="74"/>
|
||||
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
||||
</map>
|
7
pkg/maps/USGS-topo.xml
Normal file
7
pkg/maps/USGS-topo.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<map>
|
||||
<name>USGS Topo</name>
|
||||
<url>https://navigator.er.usgs.gov/tiles/tcr.cgi/$z/$x/$y.png</url>
|
||||
<zoom min="2" max="15"/>
|
||||
<copyright>Map services and data available from U.S. Geological Survey, National Geospatial Program.</copyright>
|
||||
</map>
|
@ -7,7 +7,8 @@
|
||||
#include "map/onlinemap.h"
|
||||
#include "map/downloader.h"
|
||||
#include "map/ellipsoid.h"
|
||||
#include "map/datum.h"
|
||||
#include "map/gcs.h"
|
||||
#include "map/pcs.h"
|
||||
#include "opengl.h"
|
||||
#include "gui.h"
|
||||
#include "config.h"
|
||||
@ -18,13 +19,16 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||
_argc(argc), _argv(argv)
|
||||
{
|
||||
QTranslator *gpxsee = new QTranslator(this);
|
||||
QString locale = QLocale::system().name();
|
||||
gpxsee->load(QString(":/lang/gpxsee_") + locale);
|
||||
gpxsee->load(QLocale::system(), "gpxsee", "_", TRANSLATIONS_DIR);
|
||||
installTranslator(gpxsee);
|
||||
|
||||
QTranslator *qt = new QTranslator(this);
|
||||
#if defined(Q_OS_WINDOWS) || defined(Q_OS_MAC)
|
||||
qt->load(QLocale::system(), "qt", "_", TRANSLATIONS_DIR);
|
||||
#else // Q_OS_WINDOWS || Q_OS_MAC
|
||||
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
|
||||
QLibraryInfo::TranslationsPath));
|
||||
#endif // Q_OS_WINDOWS || Q_OS_MAC
|
||||
installTranslator(qt);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
@ -35,6 +39,7 @@ App::App(int &argc, char **argv) : QApplication(argc, argv),
|
||||
OnlineMap::setDownloader(new Downloader(this));
|
||||
OPENGL_SET_SAMPLES(4);
|
||||
loadDatums();
|
||||
loadPCSs();
|
||||
|
||||
_gui = new GUI();
|
||||
}
|
||||
@ -67,7 +72,6 @@ bool App::event(QEvent *event)
|
||||
void App::loadDatums()
|
||||
{
|
||||
QString ef, df;
|
||||
bool ok = false;
|
||||
|
||||
if (QFile::exists(USER_ELLIPSOID_FILE))
|
||||
ef = USER_ELLIPSOID_FILE;
|
||||
@ -76,34 +80,32 @@ void App::loadDatums()
|
||||
else
|
||||
qWarning("No ellipsoids file found.");
|
||||
|
||||
if (QFile::exists(USER_DATUM_FILE))
|
||||
df = USER_DATUM_FILE;
|
||||
else if (QFile::exists(GLOBAL_DATUM_FILE))
|
||||
df = GLOBAL_DATUM_FILE;
|
||||
if (QFile::exists(USER_GCS_FILE))
|
||||
df = USER_GCS_FILE;
|
||||
else if (QFile::exists(GLOBAL_GCS_FILE))
|
||||
df = GLOBAL_GCS_FILE;
|
||||
else
|
||||
qWarning("No datums file found.");
|
||||
|
||||
if (!ef.isNull() && !df.isNull()) {
|
||||
if (!Ellipsoid::loadList(ef)) {
|
||||
if (Ellipsoid::errorLine())
|
||||
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
|
||||
Ellipsoid::errorLine(), qPrintable(Ellipsoid::errorString()));
|
||||
else
|
||||
qWarning("%s: %s", qPrintable(ef), qPrintable(
|
||||
Ellipsoid::errorString()));
|
||||
} else {
|
||||
if (!Datum::loadList(df)) {
|
||||
if (Datum::errorLine())
|
||||
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
|
||||
Datum::errorLine(), qPrintable(Datum::errorString()));
|
||||
else
|
||||
qWarning("%s: %s", qPrintable(ef), qPrintable(
|
||||
Datum::errorString()));
|
||||
} else
|
||||
ok = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
Ellipsoid::loadList(ef);
|
||||
GCS::loadList(df);
|
||||
} else
|
||||
qWarning("Maps based on a datum different from WGS84 won't work.");
|
||||
}
|
||||
|
||||
void App::loadPCSs()
|
||||
{
|
||||
QString file;
|
||||
|
||||
if (QFile::exists(USER_PCS_FILE))
|
||||
file = USER_PCS_FILE;
|
||||
else if (QFile::exists(GLOBAL_PCS_FILE))
|
||||
file = GLOBAL_PCS_FILE;
|
||||
else {
|
||||
qWarning("No PCS file found.");
|
||||
return;
|
||||
}
|
||||
|
||||
PCS::loadList(file);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ protected:
|
||||
|
||||
private:
|
||||
void loadDatums();
|
||||
void loadPCSs();
|
||||
|
||||
int &_argc;
|
||||
char **_argv;
|
||||
|
@ -62,12 +62,17 @@ ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
||||
_bottomMargin = new QDoubleSpinBox();
|
||||
_leftMargin = new QDoubleSpinBox();
|
||||
_rightMargin = new QDoubleSpinBox();
|
||||
QString us = (_export->units == Imperial) ? tr("in") : tr("mm");
|
||||
QString us = (_export->units == Metric) ? tr("mm") : tr("in");
|
||||
_topMargin->setSuffix(UNIT_SPACE + us);
|
||||
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
||||
_leftMargin->setSuffix(UNIT_SPACE + us);
|
||||
_rightMargin->setSuffix(UNIT_SPACE + us);
|
||||
if (_export->units == Imperial) {
|
||||
if (_export->units == Metric) {
|
||||
_topMargin->setValue(_export->margins.top());
|
||||
_bottomMargin->setValue(_export->margins.bottom());
|
||||
_leftMargin->setValue(_export->margins.left());
|
||||
_rightMargin->setValue(_export->margins.right());
|
||||
} else {
|
||||
_topMargin->setValue(_export->margins.top() * MM2IN);
|
||||
_bottomMargin->setValue(_export->margins.bottom() * MM2IN);
|
||||
_leftMargin->setValue(_export->margins.left() * MM2IN);
|
||||
@ -76,11 +81,6 @@ ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
||||
_bottomMargin->setSingleStep(0.1);
|
||||
_leftMargin->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();
|
||||
|
@ -2,6 +2,32 @@
|
||||
#include "common/coordinates.h"
|
||||
#include "format.h"
|
||||
|
||||
|
||||
static QString deg2DMS(double val)
|
||||
{
|
||||
int deg = val;
|
||||
double r1 = val - deg;
|
||||
|
||||
int min = r1 * 60.0;
|
||||
double r2 = r1 - (min / 60.0);
|
||||
|
||||
double sec = r2 * 3600.0;
|
||||
|
||||
return QString("%1°%2'%3\"").arg(deg).arg(min, 2, 10, QChar('0'))
|
||||
.arg(sec, 4, 'f', 1, QChar('0'));
|
||||
}
|
||||
|
||||
static QString deg2DMM(double val)
|
||||
{
|
||||
int deg = val;
|
||||
double r1 = val - deg;
|
||||
|
||||
double min = r1 * 60.0;
|
||||
|
||||
return QString("%1°%2'").arg(deg).arg(min, 6, 'f', 3, QChar('0'));
|
||||
}
|
||||
|
||||
|
||||
QString Format::timeSpan(qreal time, bool full)
|
||||
{
|
||||
unsigned h, m, s;
|
||||
@ -27,6 +53,13 @@ QString Format::distance(qreal value, Units units)
|
||||
else
|
||||
return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "mi");
|
||||
} else if (units == Nautical) {
|
||||
if (value < NMIINM)
|
||||
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "ft");
|
||||
else
|
||||
return QString::number(value * M2NMI, 'f', 1) + UNIT_SPACE
|
||||
+ qApp->translate("Format", "nmi");
|
||||
} else {
|
||||
if (value < KMINM)
|
||||
return QString::number(value, 'f', 0) + UNIT_SPACE
|
||||
@ -47,11 +80,22 @@ QString Format::elevation(qreal value, Units units)
|
||||
+ qApp->translate("Format", "ft");
|
||||
}
|
||||
|
||||
QString Format::coordinates(const Coordinates &value)
|
||||
QString Format::coordinates(const Coordinates &value, CoordinatesFormat type)
|
||||
{
|
||||
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;
|
||||
switch (type) {
|
||||
case DegreesMinutes:
|
||||
return deg2DMM(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
||||
+ deg2DMM(qAbs(value.lon())) + xH;
|
||||
break;
|
||||
case DMS:
|
||||
return deg2DMS(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
||||
+ deg2DMS(qAbs(value.lon())) + xH;
|
||||
break;
|
||||
default:
|
||||
return QString::number(qAbs(value.lat()), 'f', 5) + yH + ","
|
||||
+ QChar(0x00A0) + QString::number(qAbs(value.lon()), 'f', 5) + xH;
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,18 @@
|
||||
|
||||
class Coordinates;
|
||||
|
||||
enum CoordinatesFormat {
|
||||
DecimalDegrees,
|
||||
DegreesMinutes,
|
||||
DMS
|
||||
};
|
||||
|
||||
namespace Format
|
||||
{
|
||||
QString timeSpan(qreal time, bool full = true);
|
||||
QString distance(qreal value, Units units);
|
||||
QString elevation(qreal value, Units units);
|
||||
QString coordinates(const Coordinates &value);
|
||||
QString coordinates(const Coordinates &value, CoordinatesFormat type);
|
||||
}
|
||||
|
||||
#endif // FORMAT_H
|
||||
|
@ -104,15 +104,7 @@ void GraphView::setYUnits(const QString &units)
|
||||
void GraphView::setXUnits()
|
||||
{
|
||||
if (_graphType == Distance) {
|
||||
if (_units == Metric) {
|
||||
if (bounds().width() < KMINM) {
|
||||
_xUnits = tr("m");
|
||||
_xScale = 1;
|
||||
} else {
|
||||
_xUnits = tr("km");
|
||||
_xScale = M2KM;
|
||||
}
|
||||
} else {
|
||||
if (_units == Imperial) {
|
||||
if (bounds().width() < MIINM) {
|
||||
_xUnits = tr("ft");
|
||||
_xScale = M2FT;
|
||||
@ -120,6 +112,22 @@ void GraphView::setXUnits()
|
||||
_xUnits = tr("mi");
|
||||
_xScale = M2MI;
|
||||
}
|
||||
} else if (_units == Nautical) {
|
||||
if (bounds().width() < NMIINM) {
|
||||
_xUnits = tr("ft");
|
||||
_xScale = M2FT;
|
||||
} else {
|
||||
_xUnits = tr("nmi");
|
||||
_xScale = M2NMI;
|
||||
}
|
||||
} else {
|
||||
if (bounds().width() < KMINM) {
|
||||
_xUnits = tr("m");
|
||||
_xScale = 1;
|
||||
} else {
|
||||
_xUnits = tr("km");
|
||||
_xScale = M2KM;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (bounds().width() < MININS) {
|
||||
|
250
src/GUI/gui.cpp
250
src/GUI/gui.cpp
@ -40,7 +40,6 @@
|
||||
#include "filebrowser.h"
|
||||
#include "cpuarch.h"
|
||||
#include "graphtab.h"
|
||||
#include "format.h"
|
||||
#include "gui.h"
|
||||
|
||||
|
||||
@ -101,69 +100,31 @@ GUI::~GUI()
|
||||
void GUI::loadMaps()
|
||||
{
|
||||
_ml = new MapList(this);
|
||||
|
||||
QString offline, online;
|
||||
|
||||
if (QFile::exists(USER_MAP_FILE))
|
||||
online = USER_MAP_FILE;
|
||||
else if (QFile::exists(GLOBAL_MAP_FILE))
|
||||
online = GLOBAL_MAP_FILE;
|
||||
|
||||
if (!online.isNull() && !_ml->loadFile(online))
|
||||
qWarning("%s: %s", qPrintable(online), qPrintable(_ml->errorString()));
|
||||
|
||||
QString dir;
|
||||
|
||||
if (QFile::exists(USER_MAP_DIR))
|
||||
offline = USER_MAP_DIR;
|
||||
dir = USER_MAP_DIR;
|
||||
else if (QFile::exists(GLOBAL_MAP_DIR))
|
||||
offline = GLOBAL_MAP_DIR;
|
||||
dir = GLOBAL_MAP_DIR;
|
||||
|
||||
if (!offline.isNull()) {
|
||||
QDir md(offline);
|
||||
QFileInfoList ml = md.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
|
||||
for (int i = 0; i < ml.size(); i++) {
|
||||
QDir dir(ml.at(i).absoluteFilePath());
|
||||
QFileInfoList fl = dir.entryInfoList(MapList::filter(), QDir::Files);
|
||||
|
||||
if (fl.isEmpty())
|
||||
qWarning("%s: no map/atlas file found",
|
||||
qPrintable(ml.at(i).absoluteFilePath()));
|
||||
else if (fl.size() > 1)
|
||||
qWarning("%s: ambiguous directory content",
|
||||
qPrintable(ml.at(i).absoluteFilePath()));
|
||||
else
|
||||
if (!_ml->loadFile(fl.first().absoluteFilePath()))
|
||||
qWarning("%s: %s", qPrintable(fl.first().absoluteFilePath()),
|
||||
qPrintable(_ml->errorString()));
|
||||
}
|
||||
}
|
||||
if (!dir.isNull() && !_ml->loadDir(dir))
|
||||
qWarning("%s", qPrintable(_ml->errorString()));
|
||||
|
||||
_map = new EmptyMap(this);
|
||||
}
|
||||
|
||||
void GUI::loadPOIs()
|
||||
{
|
||||
QFileInfoList list;
|
||||
QDir userDir(USER_POI_DIR);
|
||||
QDir globalDir(GLOBAL_POI_DIR);
|
||||
|
||||
_poi = new POI(this);
|
||||
QString dir;
|
||||
|
||||
if (userDir.exists())
|
||||
list = userDir.entryInfoList(QStringList(), QDir::Files);
|
||||
else
|
||||
list = globalDir.entryInfoList(QStringList(), QDir::Files);
|
||||
if (QFile::exists(USER_POI_DIR))
|
||||
dir = USER_POI_DIR;
|
||||
else if (QFile::exists(GLOBAL_POI_DIR))
|
||||
dir = GLOBAL_POI_DIR;
|
||||
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (!_poi->loadFile(list.at(i).absoluteFilePath())) {
|
||||
qWarning("Error loading POI file: %s: %s\n",
|
||||
qPrintable(list.at(i).fileName()),
|
||||
qPrintable(_poi->errorString()));
|
||||
if (_poi->errorLine())
|
||||
qWarning("Line: %d\n", _poi->errorLine());
|
||||
}
|
||||
}
|
||||
if (!dir.isNull() && !_poi->loadDir(dir))
|
||||
qWarning("%s", qPrintable(_poi->errorString()));
|
||||
}
|
||||
|
||||
void GUI::createBrowser()
|
||||
@ -238,8 +199,8 @@ void GUI::createActions()
|
||||
addAction(_exitAction);
|
||||
|
||||
// Help & About
|
||||
_dataSourcesAction = new QAction(tr("Data sources"), this);
|
||||
connect(_dataSourcesAction, SIGNAL(triggered()), this, SLOT(dataSources()));
|
||||
_pathsAction = new QAction(tr("Paths"), this);
|
||||
connect(_pathsAction, SIGNAL(triggered()), this, SLOT(paths()));
|
||||
_keysAction = new QAction(tr("Keyboard controls"), this);
|
||||
connect(_keysAction, SIGNAL(triggered()), this, SLOT(keys()));
|
||||
_aboutAction = new QAction(QIcon(QPixmap(APP_ICON)),
|
||||
@ -411,6 +372,28 @@ void GUI::createActions()
|
||||
_imperialUnitsAction->setActionGroup(ag);
|
||||
connect(_imperialUnitsAction, SIGNAL(triggered()), this,
|
||||
SLOT(setImperialUnits()));
|
||||
_nauticalUnitsAction = new QAction(tr("Nautical"), this);
|
||||
_nauticalUnitsAction->setCheckable(true);
|
||||
_nauticalUnitsAction->setActionGroup(ag);
|
||||
connect(_nauticalUnitsAction, SIGNAL(triggered()), this,
|
||||
SLOT(setNauticalUnits()));
|
||||
ag = new QActionGroup(this);
|
||||
ag->setExclusive(true);
|
||||
_decimalDegreesAction = new QAction(tr("Decimal degrees (DD)"), this);
|
||||
_decimalDegreesAction->setCheckable(true);
|
||||
_decimalDegreesAction->setActionGroup(ag);
|
||||
connect(_decimalDegreesAction, SIGNAL(triggered()), this,
|
||||
SLOT(setDecimalDegrees()));
|
||||
_degreesMinutesAction = new QAction(tr("Degrees and decimal minutes (DMM)"),
|
||||
this);
|
||||
_degreesMinutesAction->setCheckable(true);
|
||||
_degreesMinutesAction->setActionGroup(ag);
|
||||
connect(_degreesMinutesAction, SIGNAL(triggered()), this,
|
||||
SLOT(setDegreesMinutes()));
|
||||
_DMSAction = new QAction(tr("Degrees, minutes, seconds (DMS)"), this);
|
||||
_DMSAction->setCheckable(true);
|
||||
_DMSAction->setActionGroup(ag);
|
||||
connect(_DMSAction, SIGNAL(triggered()), this, SLOT(setDMS()));
|
||||
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
||||
tr("Fullscreen mode"), this);
|
||||
_fullscreenAction->setCheckable(true);
|
||||
@ -501,6 +484,11 @@ void GUI::createMenus()
|
||||
QMenu *unitsMenu = settingsMenu->addMenu(tr("Units"));
|
||||
unitsMenu->addAction(_metricUnitsAction);
|
||||
unitsMenu->addAction(_imperialUnitsAction);
|
||||
unitsMenu->addAction(_nauticalUnitsAction);
|
||||
QMenu *coordinatesMenu = settingsMenu->addMenu(tr("Coordinates format"));
|
||||
coordinatesMenu->addAction(_decimalDegreesAction);
|
||||
coordinatesMenu->addAction(_degreesMinutesAction);
|
||||
coordinatesMenu->addAction(_DMSAction);
|
||||
settingsMenu->addSeparator();
|
||||
settingsMenu->addAction(_showToolbarsAction);
|
||||
settingsMenu->addAction(_fullscreenAction);
|
||||
@ -508,7 +496,7 @@ void GUI::createMenus()
|
||||
settingsMenu->addAction(_openOptionsAction);
|
||||
|
||||
QMenu *helpMenu = menuBar()->addMenu(tr("Help"));
|
||||
helpMenu->addAction(_dataSourcesAction);
|
||||
helpMenu->addAction(_pathsAction);
|
||||
helpMenu->addAction(_keysAction);
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(_aboutAction);
|
||||
@ -644,37 +632,26 @@ void GUI::keys()
|
||||
msgBox.exec();
|
||||
}
|
||||
|
||||
void GUI::dataSources()
|
||||
void GUI::paths()
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
|
||||
msgBox.setWindowTitle(tr("Data sources"));
|
||||
msgBox.setText("<h3>" + tr("Data sources") + "</h3>");
|
||||
msgBox.setWindowTitle(tr("Paths"));
|
||||
msgBox.setText("<h3>" + tr("Paths") + "</h3>");
|
||||
msgBox.setInformativeText(
|
||||
"<h4>" + tr("Online maps") + "</h4><p>"
|
||||
+ tr("Online map URLs are read on program startup from the "
|
||||
"following file:")
|
||||
+ "</p><p><code>" + USER_MAP_FILE + "</code></p><p>"
|
||||
+ tr("The file format is one map entry per line, consisting of the map "
|
||||
"name, tiles URL and an optional maximal zoom level delimited by "
|
||||
"a TAB character. The tile X and Y coordinates are replaced with $x "
|
||||
"and $y in the URL and the zoom level is replaced with $z. An example "
|
||||
"map file could look like:")
|
||||
+ "</p><p><code>Map1 http://tile.server.com/map/$z/$x/$y.png 15"
|
||||
"<br/>Map2 http://mapserver.org/map/$z-$x-$y</code></p>"
|
||||
|
||||
+ "<h4>" + tr("Offline maps") + "</h4><p>"
|
||||
+ tr("Offline maps are loaded on program startup from the following "
|
||||
"directory:")
|
||||
+ "</p><p><code>" + USER_MAP_DIR + "</code></p><p>"
|
||||
+ tr("The expected structure is one map/atlas in a separate subdirectory."
|
||||
" Supported map formats are OziExplorer maps and TrekBuddy maps/atlases"
|
||||
" (tared and non-tared).") + "</p>"
|
||||
|
||||
+ "<h4>" + tr("POIs") + "</h4><p>"
|
||||
+ tr("To make GPXSee load a POI file automatically on startup, add "
|
||||
"the file to the following directory:")
|
||||
+ "</p><p><code>" + USER_POI_DIR + "</code></p>"
|
||||
"<style>td {white-space: pre; padding-right: 1em;}</style>"
|
||||
"<div><table><tr><td>" + tr("Map directory:") + "</td><td><code>"
|
||||
+ QDir::cleanPath(GLOBAL_MAP_DIR) + "</code></td></tr><tr><td>"
|
||||
+ tr("POI directory:") + "</td><td><code>"
|
||||
+ QDir::cleanPath(GLOBAL_POI_DIR) + "</code></td></tr><tr><td>"
|
||||
+ tr("GCS file:") + "</td><td><code>" + QDir::cleanPath(GLOBAL_GCS_FILE)
|
||||
+ "</code></td></tr><tr><td>" + tr("PCS file:") + "</td><td><code>"
|
||||
+ QDir::cleanPath(GLOBAL_PCS_FILE) + "</code></td></tr><tr><td>"
|
||||
+ tr("Ellipsoids file:") + "</td><td><code>"
|
||||
+ QDir::cleanPath(GLOBAL_ELLIPSOID_FILE) + "</code></td></tr>"
|
||||
+ "<tr><td></td><td></td></tr></table></div><div><table><tr><td>"
|
||||
+ tr("User override directory:") + "</td><td><code>"
|
||||
+ QDir::cleanPath(USER_DIR) + "</td></tr></table></div>"
|
||||
);
|
||||
|
||||
msgBox.exec();
|
||||
@ -692,8 +669,6 @@ void GUI::openFile()
|
||||
|
||||
bool GUI::openFile(const QString &fileName)
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
if (fileName.isEmpty() || _files.contains(fileName))
|
||||
return false;
|
||||
|
||||
@ -708,13 +683,14 @@ bool GUI::openFile(const QString &fileName)
|
||||
updateWindowTitle();
|
||||
updateGraphTabs();
|
||||
updateMapView();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
if (_files.isEmpty())
|
||||
_fileActionGroup->setEnabled(false);
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool GUI::loadFile(const QString &fileName)
|
||||
@ -1148,30 +1124,38 @@ void GUI::showGraphSliderInfo(bool show)
|
||||
|
||||
void GUI::loadMap()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open map file"),
|
||||
QStringList files = QFileDialog::getOpenFileNames(this, tr("Open map file"),
|
||||
QString(), MapList::formats());
|
||||
QStringList list = files;
|
||||
|
||||
for (QStringList::Iterator it = list.begin(); it != list.end(); it++)
|
||||
loadMap(*it);
|
||||
}
|
||||
|
||||
bool GUI::loadMap(const QString &fileName)
|
||||
{
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
return false;
|
||||
|
||||
int count = _ml->maps().count();
|
||||
if (_ml->loadFile(fileName)) {
|
||||
for (int i = count; i < _ml->maps().count(); i++) {
|
||||
QAction *a = new QAction(_ml->maps().at(i)->name(), this);
|
||||
a->setCheckable(true);
|
||||
a->setActionGroup(_mapsActionGroup);
|
||||
_mapsSignalMapper->setMapping(a, i);
|
||||
connect(a, SIGNAL(triggered()), _mapsSignalMapper, SLOT(map()));
|
||||
_mapActions.append(a);
|
||||
_mapMenu->insertAction(_mapsEnd, a);
|
||||
}
|
||||
QAction *a = new QAction(_ml->maps().last()->name(), this);
|
||||
a->setCheckable(true);
|
||||
a->setActionGroup(_mapsActionGroup);
|
||||
_mapsSignalMapper->setMapping(a, _ml->maps().size() - 1);
|
||||
connect(a, SIGNAL(triggered()), _mapsSignalMapper, SLOT(map()));
|
||||
_mapActions.append(a);
|
||||
_mapMenu->insertAction(_mapsEnd, a);
|
||||
_showMapAction->setEnabled(true);
|
||||
_clearMapCacheAction->setEnabled(true);
|
||||
_mapActions.last()->activate(QAction::Trigger);
|
||||
_mapActions.last()->trigger();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
QString error = tr("Error loading map:") + "\n\n"
|
||||
+ fileName + "\n\n" + _ml->errorString();
|
||||
QMessageBox::critical(this, APP_NAME, error);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1335,6 +1319,11 @@ void GUI::setUnits(Units units)
|
||||
updateStatusBarInfo();
|
||||
}
|
||||
|
||||
void GUI::setCoordinatesFormat(CoordinatesFormat format)
|
||||
{
|
||||
_mapView->setCoordinatesFormat(format);
|
||||
}
|
||||
|
||||
void GUI::setGraphType(GraphType type)
|
||||
{
|
||||
_sliderPos = 0;
|
||||
@ -1405,15 +1394,15 @@ void GUI::keyPressEvent(QKeyEvent *event)
|
||||
|
||||
case TOGGLE_GRAPH_TYPE_KEY:
|
||||
if (_timeGraphAction->isChecked())
|
||||
_distanceGraphAction->activate(QAction::Trigger);
|
||||
_distanceGraphAction->trigger();
|
||||
else
|
||||
_timeGraphAction->activate(QAction::Trigger);
|
||||
_timeGraphAction->trigger();
|
||||
break;
|
||||
case TOGGLE_TIME_TYPE_KEY:
|
||||
if (_movingTimeAction->isChecked())
|
||||
_totalTimeAction->activate(QAction::Trigger);
|
||||
_totalTimeAction->trigger();
|
||||
else
|
||||
_movingTimeAction->activate(QAction::Trigger);
|
||||
_movingTimeAction->trigger();
|
||||
break;
|
||||
|
||||
case Qt::Key_Escape:
|
||||
@ -1479,11 +1468,15 @@ void GUI::writeSettings()
|
||||
if ((_movingTimeAction->isChecked() ? Moving : Total) !=
|
||||
TIME_TYPE_DEFAULT)
|
||||
settings.setValue(TIME_TYPE_SETTING, _movingTimeAction->isChecked()
|
||||
? Moving : Total);
|
||||
if ((_imperialUnitsAction->isChecked() ? Imperial : Metric) !=
|
||||
UNITS_DEFAULT)
|
||||
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
|
||||
? Imperial : Metric);
|
||||
? Moving : Total);
|
||||
Units units = _imperialUnitsAction->isChecked() ? Imperial
|
||||
: _nauticalUnitsAction->isChecked() ? Nautical : Metric;
|
||||
if (units != UNITS_DEFAULT)
|
||||
settings.setValue(UNITS_SETTING, units);
|
||||
CoordinatesFormat format = _DMSAction->isChecked() ? DMS
|
||||
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
||||
if (format != COORDINATES_DEFAULT)
|
||||
settings.setValue(COORDINATES_SETTING, format);
|
||||
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
||||
settings.setValue(SHOW_TOOLBARS_SETTING,
|
||||
_showToolbarsAction->isChecked());
|
||||
@ -1643,6 +1636,7 @@ void GUI::writeSettings()
|
||||
|
||||
void GUI::readSettings()
|
||||
{
|
||||
int value;
|
||||
QSettings settings(APP_NAME, APP_NAME);
|
||||
|
||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||
@ -1652,20 +1646,27 @@ void GUI::readSettings()
|
||||
|
||||
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
||||
if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt()
|
||||
== Moving) {
|
||||
setTimeType(Moving);
|
||||
_movingTimeAction->setChecked(true);
|
||||
} else {
|
||||
setTimeType(Total);
|
||||
_totalTimeAction->setChecked(true);
|
||||
}
|
||||
if (settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt() == Imperial) {
|
||||
setUnits(Imperial);
|
||||
_imperialUnitsAction->setChecked(true);
|
||||
} else {
|
||||
setUnits(Metric);
|
||||
_metricUnitsAction->setChecked(true);
|
||||
}
|
||||
== Moving)
|
||||
_movingTimeAction->trigger();
|
||||
else
|
||||
_totalTimeAction->trigger();
|
||||
|
||||
value = settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt();
|
||||
if (value == Imperial)
|
||||
_imperialUnitsAction->trigger();
|
||||
else if (value == Nautical)
|
||||
_nauticalUnitsAction->trigger();
|
||||
else
|
||||
_metricUnitsAction->trigger();
|
||||
|
||||
value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt();
|
||||
if (value == DMS)
|
||||
_DMSAction->trigger();
|
||||
else if (value == DegreesMinutes)
|
||||
_degreesMinutesAction->trigger();
|
||||
else
|
||||
_decimalDegreesAction->trigger();
|
||||
|
||||
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
|
||||
showToolbars(false);
|
||||
else
|
||||
@ -1675,6 +1676,8 @@ void GUI::readSettings()
|
||||
settings.beginGroup(MAP_SETTINGS_GROUP);
|
||||
if (settings.value(SHOW_MAP_SETTING, SHOW_MAP_DEFAULT).toBool())
|
||||
_showMapAction->setChecked(true);
|
||||
else
|
||||
_mapView->showMap(false);
|
||||
if (_ml->maps().count()) {
|
||||
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
|
||||
_mapActions.at(index)->trigger();
|
||||
@ -1909,7 +1912,8 @@ int GUI::mapIndex(const QString &name)
|
||||
|
||||
Units GUI::units() const
|
||||
{
|
||||
return _imperialUnitsAction->isChecked() ? Imperial : Metric;
|
||||
return _imperialUnitsAction->isChecked() ? Imperial
|
||||
: _nauticalUnitsAction->isChecked() ? Nautical : Metric;
|
||||
}
|
||||
|
||||
qreal GUI::distance() const
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "data/poi.h"
|
||||
#include "units.h"
|
||||
#include "timetype.h"
|
||||
#include "format.h"
|
||||
#include "exportdialog.h"
|
||||
#include "optionsdialog.h"
|
||||
|
||||
@ -40,7 +41,7 @@ public:
|
||||
private slots:
|
||||
void about();
|
||||
void keys();
|
||||
void dataSources();
|
||||
void paths();
|
||||
void printFile();
|
||||
void exportFile();
|
||||
void openFile();
|
||||
@ -73,8 +74,12 @@ private slots:
|
||||
void setMovingTime() {setTimeType(Moving);}
|
||||
void setMetricUnits() {setUnits(Metric);}
|
||||
void setImperialUnits() {setUnits(Imperial);}
|
||||
void setNauticalUnits() {setUnits(Nautical);}
|
||||
void setDistanceGraph() {setGraphType(Distance);}
|
||||
void setTimeGraph() {setGraphType(Time);}
|
||||
void setDecimalDegrees() {setCoordinatesFormat(DecimalDegrees);}
|
||||
void setDegreesMinutes() {setCoordinatesFormat(DegreesMinutes);}
|
||||
void setDMS() {setCoordinatesFormat(DMS);}
|
||||
|
||||
void sliderPositionChanged(qreal pos);
|
||||
|
||||
@ -99,6 +104,7 @@ private:
|
||||
|
||||
bool openPOIFile(const QString &fileName);
|
||||
bool loadFile(const QString &fileName);
|
||||
bool loadMap(const QString &fileName);
|
||||
void exportFile(const QString &fileName);
|
||||
void updateStatusBarInfo();
|
||||
void updateWindowTitle();
|
||||
@ -110,6 +116,7 @@ private:
|
||||
Units units() const;
|
||||
void setTimeType(TimeType type);
|
||||
void setUnits(Units units);
|
||||
void setCoordinatesFormat(CoordinatesFormat format);
|
||||
void setGraphType(GraphType type);
|
||||
|
||||
qreal distance() const;
|
||||
@ -135,7 +142,7 @@ private:
|
||||
QActionGroup *_mapsActionGroup;
|
||||
QAction *_exitAction;
|
||||
QAction *_keysAction;
|
||||
QAction *_dataSourcesAction;
|
||||
QAction *_pathsAction;
|
||||
QAction *_aboutAction;
|
||||
QAction *_aboutQtAction;
|
||||
QAction *_printFileAction;
|
||||
@ -164,6 +171,10 @@ private:
|
||||
QAction *_firstAction;
|
||||
QAction *_metricUnitsAction;
|
||||
QAction *_imperialUnitsAction;
|
||||
QAction *_nauticalUnitsAction;
|
||||
QAction *_decimalDegreesAction;
|
||||
QAction *_degreesMinutesAction;
|
||||
QAction *_DMSAction;
|
||||
QAction *_totalTimeAction;
|
||||
QAction *_movingTimeAction;
|
||||
QAction *_nextMapAction;
|
||||
|
@ -49,6 +49,7 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
||||
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
||||
|
||||
_units = Metric;
|
||||
_coordinatesFormat = DecimalDegrees;
|
||||
_opacity = 1.0;
|
||||
_backgroundColor = Qt::white;
|
||||
_markerColor = Qt::red;
|
||||
@ -137,6 +138,7 @@ PathItem *MapView::addRoute(const Route &route)
|
||||
ri->setWidth(_routeWidth);
|
||||
ri->setStyle(_routeStyle);
|
||||
ri->setUnits(_units);
|
||||
ri->setCoordinatesFormat(_coordinatesFormat);
|
||||
ri->setVisible(_showRoutes);
|
||||
ri->showWaypoints(_showRouteWaypoints);
|
||||
ri->showWaypointLabels(_showWaypointLabels);
|
||||
@ -162,7 +164,7 @@ void MapView::addWaypoints(const QList<Waypoint> &waypoints)
|
||||
wi->setSize(_waypointSize);
|
||||
wi->setColor(_waypointColor);
|
||||
wi->showLabel(_showWaypointLabels);
|
||||
wi->setUnits(_units);
|
||||
wi->setToolTipFormat(_units, _coordinatesFormat);
|
||||
wi->setVisible(_showWaypoints);
|
||||
wi->setDigitalZoom(_digitalZoom);
|
||||
_scene->addItem(wi);
|
||||
@ -348,28 +350,49 @@ void MapView::addPOI(const QList<Waypoint> &waypoints)
|
||||
pi->showLabel(_showPOILabels);
|
||||
pi->setVisible(_showPOI);
|
||||
pi->setDigitalZoom(_digitalZoom);
|
||||
pi->setToolTipFormat(_units, _coordinatesFormat);
|
||||
_scene->addItem(pi);
|
||||
|
||||
_pois.insert(SearchPointer<Waypoint>(&(pi->waypoint())), pi);
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::setUnits(enum Units units)
|
||||
void MapView::setUnits(Units units)
|
||||
{
|
||||
if (_units == units)
|
||||
return;
|
||||
|
||||
_units = units;
|
||||
|
||||
_mapScale->setUnits(units);
|
||||
_mapScale->setUnits(_units);
|
||||
|
||||
for (int i = 0; i < _tracks.count(); i++)
|
||||
_tracks[i]->setUnits(units);
|
||||
_tracks[i]->setUnits(_units);
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes[i]->setUnits(units);
|
||||
_routes[i]->setUnits(_units);
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->setUnits(units);
|
||||
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setUnits(units);
|
||||
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
||||
}
|
||||
|
||||
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
||||
{
|
||||
if (_coordinatesFormat == format)
|
||||
return;
|
||||
|
||||
_coordinatesFormat = format;
|
||||
|
||||
for (int i = 0; i < _waypoints.count(); i++)
|
||||
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
||||
for (int i = 0; i < _routes.count(); i++)
|
||||
_routes[i]->setCoordinatesFormat(_coordinatesFormat);
|
||||
|
||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
||||
}
|
||||
|
||||
void MapView::clearMapCache()
|
||||
@ -566,6 +589,9 @@ void MapView::clear()
|
||||
_wr = RectC();
|
||||
|
||||
digitalZoom(0);
|
||||
|
||||
// If not reset, causes huge redraw areas (and system memory exhaustion)
|
||||
resetCachedContent();
|
||||
}
|
||||
|
||||
void MapView::showTracks(bool show)
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "data/waypoint.h"
|
||||
#include "searchpointer.h"
|
||||
#include "units.h"
|
||||
#include "format.h"
|
||||
#include "palette.h"
|
||||
|
||||
class Data;
|
||||
@ -34,12 +35,13 @@ public:
|
||||
void setPalette(const Palette &palette);
|
||||
void setPOI(POI *poi);
|
||||
void setMap(Map *map);
|
||||
void setUnits(enum Units units);
|
||||
|
||||
void plot(QPainter *painter, const QRectF &target, qreal scale, bool hires);
|
||||
|
||||
void clear();
|
||||
|
||||
void setUnits(Units units);
|
||||
void setMarkerColor(const QColor &color);
|
||||
void setTrackWidth(int width);
|
||||
void setRouteWidth(int width);
|
||||
void setTrackStyle(Qt::PenStyle style);
|
||||
@ -52,7 +54,6 @@ public:
|
||||
void setBackgroundColor(const QColor &color);
|
||||
void useOpenGL(bool use);
|
||||
void useAntiAliasing(bool use);
|
||||
void setMarkerColor(const QColor &color);
|
||||
|
||||
public slots:
|
||||
void showMap(bool show);
|
||||
@ -65,6 +66,7 @@ public slots:
|
||||
void showWaypoints(bool show);
|
||||
void showRouteWaypoints(bool show);
|
||||
void clearMapCache();
|
||||
void setCoordinatesFormat(CoordinatesFormat format);
|
||||
|
||||
private slots:
|
||||
void updatePOI();
|
||||
@ -108,6 +110,7 @@ private:
|
||||
POI *_poi;
|
||||
Palette _palette;
|
||||
Units _units;
|
||||
CoordinatesFormat _coordinatesFormat;
|
||||
|
||||
qreal _opacity;
|
||||
QColor _backgroundColor;
|
||||
|
@ -1,9 +0,0 @@
|
||||
#include "margins.h"
|
||||
|
||||
|
||||
QDebug operator<<(QDebug dbg, const MarginsF &margins)
|
||||
{
|
||||
dbg.nospace() << "MarginsF(" << margins.left() << ", " << margins.top()
|
||||
<< ", " << margins.right() << margins.bottom() << ")";
|
||||
return dbg.maybeSpace();
|
||||
}
|
@ -25,6 +25,13 @@ private:
|
||||
qreal _left, _top, _right, _bottom;
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug dbg, const MarginsF &margins);
|
||||
#ifndef QT_NO_DEBUG
|
||||
inline QDebug operator<<(QDebug dbg, const MarginsF &margins)
|
||||
{
|
||||
dbg.nospace() << "MarginsF(" << margins.left() << ", " << margins.top()
|
||||
<< ", " << margins.right() << margins.bottom() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // MARGINS_H
|
||||
|
@ -291,6 +291,9 @@ QWidget *OptionsDialog::createDataPage()
|
||||
if (_options->units == Imperial) {
|
||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2MIH);
|
||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("mi/h"));
|
||||
} else if (_options->units == Nautical) {
|
||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2KN);
|
||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("kn"));
|
||||
} else {
|
||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2KMH);
|
||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("km/h"));
|
||||
@ -323,6 +326,9 @@ QWidget *OptionsDialog::createPOIPage()
|
||||
if (_options->units == Imperial) {
|
||||
_poiRadius->setValue(_options->poiRadius / MIINM);
|
||||
_poiRadius->setSuffix(UNIT_SPACE + tr("mi"));
|
||||
} else if (_options->units == Nautical) {
|
||||
_poiRadius->setValue(_options->poiRadius / NMIINM);
|
||||
_poiRadius->setSuffix(UNIT_SPACE + tr("nmi"));
|
||||
} else {
|
||||
_poiRadius->setValue(_options->poiRadius / KMINM);
|
||||
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
||||
@ -525,13 +531,15 @@ void OptionsDialog::accept()
|
||||
_options->powerFilter = _powerFilter->value();
|
||||
_options->outlierEliminate = _outlierEliminate->isChecked();
|
||||
qreal pauseSpeed = (_options->units == Imperial)
|
||||
? _pauseSpeed->value() / MS2MIH : _pauseSpeed->value() / MS2KMH;
|
||||
? _pauseSpeed->value() / MS2MIH : (_options->units == Nautical)
|
||||
? _pauseSpeed->value() / MS2KN : _pauseSpeed->value() / MS2KMH;
|
||||
if (qAbs(pauseSpeed - _options->pauseSpeed) > 0.01)
|
||||
_options->pauseSpeed = pauseSpeed;
|
||||
_options->pauseInterval = _pauseInterval->value();
|
||||
|
||||
qreal poiRadius = (_options->units == Imperial)
|
||||
? _poiRadius->value() * MIINM : _poiRadius->value() * KMINM;
|
||||
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
||||
? _poiRadius->value() * NMIINM : _poiRadius->value() * KMINM;
|
||||
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
||||
_options->poiRadius = poiRadius;
|
||||
|
||||
|
@ -37,9 +37,11 @@ void Palette::reset()
|
||||
_state = _h;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Palette &palette)
|
||||
{
|
||||
dbg.nospace() << "Palette(" << palette.color() << ", " << palette.shift()
|
||||
<< ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -28,6 +28,8 @@ private:
|
||||
qreal _state;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Palette &palette);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // PALLETE_H
|
||||
|
@ -30,6 +30,8 @@ RouteItem::RouteItem(const Route &route, Map *map, QGraphicsItem *parent)
|
||||
|
||||
_name = route.name();
|
||||
_desc = route.description();
|
||||
_units = Metric;
|
||||
_coordinatesFormat = DecimalDegrees;
|
||||
|
||||
setToolTip(toolTip(Metric));
|
||||
}
|
||||
@ -47,9 +49,38 @@ void RouteItem::setMap(Map *map)
|
||||
PathItem::setMap(map);
|
||||
}
|
||||
|
||||
void RouteItem::setUnits(enum Units units)
|
||||
void RouteItem::setUnits(Units units)
|
||||
{
|
||||
setToolTip(toolTip(units));
|
||||
if (_units == units)
|
||||
return;
|
||||
|
||||
_units = units;
|
||||
|
||||
setToolTip(toolTip(_units));
|
||||
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++) {
|
||||
if (childs.at(i) != _marker) {
|
||||
WaypointItem *wi = static_cast<WaypointItem*>(childs.at(i));
|
||||
wi->setToolTipFormat(_units, _coordinatesFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RouteItem::setCoordinatesFormat(CoordinatesFormat format)
|
||||
{
|
||||
if (_coordinatesFormat == format)
|
||||
return;
|
||||
|
||||
_coordinatesFormat = format;
|
||||
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++) {
|
||||
if (childs.at(i) != _marker) {
|
||||
WaypointItem *wi = static_cast<WaypointItem*>(childs.at(i));
|
||||
wi->setToolTipFormat(_units, _coordinatesFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RouteItem::showWaypoints(bool show)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "data/route.h"
|
||||
#include "pathitem.h"
|
||||
#include "units.h"
|
||||
#include "format.h"
|
||||
|
||||
class Map;
|
||||
|
||||
@ -17,6 +18,7 @@ public:
|
||||
void setMap(Map *map);
|
||||
|
||||
void setUnits(Units units);
|
||||
void setCoordinatesFormat(CoordinatesFormat format);
|
||||
void showWaypoints(bool show);
|
||||
void showWaypointLabels(bool show);
|
||||
|
||||
@ -25,6 +27,8 @@ private:
|
||||
|
||||
QString _name;
|
||||
QString _desc;
|
||||
Units _units;
|
||||
CoordinatesFormat _coordinatesFormat;
|
||||
};
|
||||
|
||||
#endif // ROUTEITEM_H
|
||||
|
@ -82,6 +82,9 @@ QString ScaleItem::units() const
|
||||
if (_units == Imperial)
|
||||
return _scale ? qApp->translate("ScaleItem", "mi")
|
||||
: qApp->translate("ScaleItem", "ft");
|
||||
else if (_units == Nautical)
|
||||
return _scale ? qApp->translate("ScaleItem", "nmi")
|
||||
: qApp->translate("ScaleItem", "ft");
|
||||
else
|
||||
return _scale ? qApp->translate("ScaleItem", "km")
|
||||
: qApp->translate("ScaleItem", "m");
|
||||
@ -94,8 +97,18 @@ void ScaleItem::computeScale()
|
||||
if (_units == Imperial) {
|
||||
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
if (_length >= MIINFT) {
|
||||
_length = niceNum((res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_width = (_length / (res * M2FT * FT2MI));
|
||||
_length = niceNum((res * M2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_width = (_length / (res * M2MI));
|
||||
_scale = true;
|
||||
} else {
|
||||
_width = (_length / (res * M2FT));
|
||||
_scale = false;
|
||||
}
|
||||
} else if (_units == Nautical) {
|
||||
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
if (_length >= NMIINFT) {
|
||||
_length = niceNum((res * M2NMI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||
_width = (_length / (res * M2NMI));
|
||||
_scale = true;
|
||||
} else {
|
||||
_width = (_length / (res * M2FT));
|
||||
|
@ -15,6 +15,8 @@
|
||||
#define TIME_TYPE_DEFAULT Total
|
||||
#define UNITS_SETTING "units"
|
||||
#define UNITS_DEFAULT (IMPERIAL_UNITS() ? Imperial : Metric)
|
||||
#define COORDINATES_SETTING "coordinates"
|
||||
#define COORDINATES_DEFAULT DecimalDegrees
|
||||
#define SHOW_TOOLBARS_SETTING "toolbar"
|
||||
#define SHOW_TOOLBARS_DEFAULT true
|
||||
|
||||
|
@ -79,12 +79,15 @@ void SpeedGraph::clear()
|
||||
|
||||
void SpeedGraph::setYUnits(Units units)
|
||||
{
|
||||
if (units == Metric) {
|
||||
GraphView::setYUnits(tr("km/h"));
|
||||
setYScale(MS2KMH);
|
||||
} else {
|
||||
if (units == Nautical) {
|
||||
GraphView::setYUnits(tr("kn"));
|
||||
setYScale(MS2KN);
|
||||
} else if (units == Imperial) {
|
||||
GraphView::setYUnits(tr("mi/h"));
|
||||
setYScale(MS2MIH);
|
||||
} else {
|
||||
GraphView::setYUnits(tr("km/h"));
|
||||
setYScale(MS2KMH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,8 +16,10 @@ SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type,
|
||||
QString SpeedGraphItem::toolTip() const
|
||||
{
|
||||
ToolTip tt;
|
||||
qreal scale = (_units == Metric) ? MS2KMH : MS2MIH;
|
||||
QString su = (_units == Metric) ? tr("km/h") : tr("mi/h");
|
||||
qreal scale = (_units == Imperial) ? MS2MIH : (_units == Nautical)
|
||||
? MS2KN : MS2KMH;
|
||||
QString su = (_units == Imperial) ? tr("mi/h") : (_units == Nautical)
|
||||
? tr("kn") : tr("km/h");
|
||||
|
||||
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 1)
|
||||
+ UNIT_SPACE + su);
|
||||
|
@ -3,24 +3,29 @@
|
||||
|
||||
enum Units {
|
||||
Metric,
|
||||
Imperial
|
||||
Imperial,
|
||||
Nautical
|
||||
};
|
||||
|
||||
#define M2KM 0.001000000000 // m -> km
|
||||
#define M2MI 0.000621371192 // m -> mi
|
||||
#define M2NMI 0.000539956803 // m -> nmi
|
||||
#define M2FT 3.280839900000 // m -> ft
|
||||
#define MS2KMH 3.600000000000 // m/s -> km/h
|
||||
#define MS2MIH 2.236936290000 // m/s -> mi/h
|
||||
#define MS2KN 1.943844490000 // m/s -> kn
|
||||
#define FT2MI 0.000189393939 // ft -> mi
|
||||
#define MM2IN 0.039370100000 // mm -> in
|
||||
#define H2S 0.000277777778 // h -> s
|
||||
#define MIN2S 0.016666666667 // min -> s
|
||||
|
||||
#define KMINM 1000.0 // 1 km in m
|
||||
#define MIINFT 5280.0 // 1 mi in ft
|
||||
#define MIINM 1609.344 // 1 mi in m
|
||||
#define MININS 60.0 // 1 min in s
|
||||
#define HINS 3600.0 // 1 hins
|
||||
#define KMINM 1000.0 // 1 km in m
|
||||
#define MIINFT 5280.0 // 1 mi in ft
|
||||
#define NMIINFT 6076.11549 // 1 nm in ft
|
||||
#define MIINM 1609.344 // 1 mi in m
|
||||
#define NMIINM 1852.0 // 1 nmi in m
|
||||
#define MININS 60.0 // 1 min in s
|
||||
#define HINS 3600.0 // 1 hins
|
||||
|
||||
#define C2FS 1.8 // Celsius to Farenheit - scale
|
||||
#define C2FO 32.0 // Celsius to Farenheit - offset
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include "config.h"
|
||||
#include "format.h"
|
||||
#include "tooltip.h"
|
||||
#include "waypointitem.h"
|
||||
|
||||
@ -11,14 +10,14 @@
|
||||
#define FS(size) \
|
||||
((int)((qreal)size * 1.41))
|
||||
|
||||
QString WaypointItem::toolTip(Units units)
|
||||
QString WaypointItem::toolTip(Units units, CoordinatesFormat format)
|
||||
{
|
||||
ToolTip tt;
|
||||
|
||||
if (!_waypoint.name().isEmpty())
|
||||
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
||||
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
||||
Format::coordinates(_waypoint.coordinates()));
|
||||
Format::coordinates(_waypoint.coordinates(), format));
|
||||
if (!std::isnan(_waypoint.elevation()))
|
||||
tt.insert(qApp->translate("WaypointItem", "Elevation"),
|
||||
Format::elevation(_waypoint.elevation(), units));
|
||||
@ -44,7 +43,7 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
||||
updateShape();
|
||||
|
||||
setPos(map->ll2xy(waypoint.coordinates()));
|
||||
setToolTip(toolTip(Metric));
|
||||
setToolTip(toolTip(Metric, DecimalDegrees));
|
||||
setCursor(Qt::ArrowCursor);
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
@ -108,6 +107,9 @@ void WaypointItem::paint(QPainter *painter,
|
||||
|
||||
void WaypointItem::setSize(int size)
|
||||
{
|
||||
if (_size == size)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
_size = size;
|
||||
updateShape();
|
||||
@ -115,17 +117,23 @@ void WaypointItem::setSize(int size)
|
||||
|
||||
void WaypointItem::setColor(const QColor &color)
|
||||
{
|
||||
if (_color == color)
|
||||
return;
|
||||
|
||||
_color = color;
|
||||
update();
|
||||
}
|
||||
|
||||
void WaypointItem::setUnits(enum Units units)
|
||||
void WaypointItem::setToolTipFormat(Units units, CoordinatesFormat format)
|
||||
{
|
||||
setToolTip(toolTip(units));
|
||||
setToolTip(toolTip(units, format));
|
||||
}
|
||||
|
||||
void WaypointItem::showLabel(bool show)
|
||||
{
|
||||
if (_showLabel == show)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
_showLabel = show;
|
||||
updateShape();
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "data/waypoint.h"
|
||||
#include "map/map.h"
|
||||
#include "units.h"
|
||||
#include "format.h"
|
||||
|
||||
class WaypointItem : public QGraphicsItem
|
||||
{
|
||||
@ -15,7 +16,7 @@ public:
|
||||
const Waypoint &waypoint() const {return _waypoint;}
|
||||
|
||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
||||
void setUnits(Units units);
|
||||
void setToolTipFormat(Units units, CoordinatesFormat format);
|
||||
void setSize(int size);
|
||||
void setColor(const QColor &color);
|
||||
void showLabel(bool show);
|
||||
@ -31,7 +32,7 @@ private:
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
||||
void updateShape();
|
||||
QString toolTip(Units units);
|
||||
QString toolTip(Units units, CoordinatesFormat format);
|
||||
|
||||
QPainterPath _shape;
|
||||
Waypoint _waypoint;
|
||||
|
@ -16,12 +16,6 @@ qreal Coordinates::distanceTo(const Coordinates &c) const
|
||||
return (WGS84_RADIUS * (2.0 * atan2(sqrt(a), sqrt(1.0 - a))));
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug dbg, const Coordinates &c)
|
||||
{
|
||||
dbg.nospace() << "Coordinates(" << c.lon() << ", " << c.lat() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
|
||||
QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
|
||||
{
|
||||
qreal radDist = distance / WGS84_RADIUS;
|
||||
@ -50,3 +44,11 @@ QPair<Coordinates, Coordinates> Coordinates::boundingRect(qreal distance) const
|
||||
maxLon)), rad2deg(qMin(minLat, maxLat))), Coordinates(rad2deg(qMax(minLon,
|
||||
maxLon)), rad2deg(qMax(minLat, maxLat))));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Coordinates &c)
|
||||
{
|
||||
dbg.nospace() << "Coordinates(" << c.lon() << ", " << c.lat() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -43,6 +43,8 @@ inline bool operator==(const Coordinates &c1, const Coordinates &c2)
|
||||
inline bool operator!=(const Coordinates &c1, const Coordinates &c2)
|
||||
{return !(c1 == c2);}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Coordinates &c);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // COORDINATES_H
|
||||
|
@ -8,6 +8,7 @@ void RangeF::resize(qreal size)
|
||||
_max += adj;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Range &range)
|
||||
{
|
||||
dbg.nospace() << "Range(" << range.min() << ", " << range.max() << ")";
|
||||
@ -19,3 +20,4 @@ QDebug operator<<(QDebug dbg, const RangeF &range)
|
||||
dbg.nospace() << "RangeF(" << range.min() << ", " << range.max() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -34,7 +34,9 @@ private:
|
||||
qreal _min, _max;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Range &range);
|
||||
QDebug operator<<(QDebug dbg, const RangeF &range);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // RANGE_H
|
||||
|
@ -61,8 +61,10 @@ void RectC::unite(const Coordinates &c)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const RectC &rect)
|
||||
{
|
||||
dbg.nospace() << "RectC(" << rect.topLeft() << ", " << rect.size() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -37,6 +37,8 @@ private:
|
||||
Coordinates _tl, _br;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const RectC &rect);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // RECTC_H
|
||||
|
15
src/config.h
15
src/config.h
@ -12,9 +12,9 @@
|
||||
#define FONT_FAMILY "Arial"
|
||||
#define FONT_SIZE 12 // px
|
||||
|
||||
#define ELLIPSOID_FILE QString("ellipsoids.csv")
|
||||
#define DATUM_FILE QString("datums.csv")
|
||||
#define MAP_FILE QString("maps.txt")
|
||||
#define ELLIPSOID_FILE QString("csv/ellipsoids.csv")
|
||||
#define GCS_FILE QString("csv/gcs.csv")
|
||||
#define PCS_FILE QString("csv/pcs.csv")
|
||||
#define MAP_DIR QString("maps")
|
||||
#define POI_DIR QString("POI")
|
||||
|
||||
@ -31,15 +31,16 @@
|
||||
#endif
|
||||
|
||||
#define USER_ELLIPSOID_FILE USER_DIR + QString("/") + ELLIPSOID_FILE
|
||||
#define USER_DATUM_FILE USER_DIR + QString("/") + DATUM_FILE
|
||||
#define USER_GCS_FILE USER_DIR + QString("/") + GCS_FILE
|
||||
#define USER_PCS_FILE USER_DIR + QString("/") + PCS_FILE
|
||||
#define USER_MAP_DIR USER_DIR + QString("/") + MAP_DIR
|
||||
#define USER_MAP_FILE USER_DIR + QString("/") + MAP_FILE
|
||||
#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_GCS_FILE GLOBAL_DIR + QString("/") + GCS_FILE
|
||||
#define GLOBAL_PCS_FILE GLOBAL_DIR + QString("/") + PCS_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")
|
||||
#define TRANSLATIONS_DIR GLOBAL_DIR + QString("/translations")
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
@ -7,7 +7,6 @@ class CSVParser : public Parser
|
||||
{
|
||||
public:
|
||||
CSVParser() : _errorLine(0) {}
|
||||
~CSVParser() {}
|
||||
|
||||
bool parse(QFile *file, QList<TrackData> &track, QList<RouteData> &routes,
|
||||
QList<Waypoint> &waypoints);
|
||||
|
@ -99,11 +99,12 @@ bool Data::loadFile(const QString &fileName)
|
||||
|
||||
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 (*)");
|
||||
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()
|
||||
|
@ -7,7 +7,6 @@ class FITParser : public Parser
|
||||
{
|
||||
public:
|
||||
FITParser();
|
||||
~FITParser() {}
|
||||
|
||||
bool parse(QFile *file, QList<TrackData> &tracks, QList<RouteData> &routes,
|
||||
QList<Waypoint> &waypoints);
|
||||
|
@ -8,8 +8,6 @@
|
||||
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();}
|
||||
|
@ -30,12 +30,14 @@ private:
|
||||
|
||||
Q_DECLARE_TYPEINFO(GraphPoint, Q_PRIMITIVE_TYPE);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
inline QDebug operator<<(QDebug dbg, const GraphPoint &point)
|
||||
{
|
||||
dbg.nospace() << "GraphPoint(" << point.s() << ", " << point.t() << ", "
|
||||
<< point.y() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
typedef QVector<GraphPoint> Graph;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <cstring>
|
||||
#include "str2int.h"
|
||||
#include "common/str2int.h"
|
||||
#include "igcparser.h"
|
||||
|
||||
|
||||
@ -47,22 +47,22 @@ static bool readLon(const char *data, qreal &lon)
|
||||
|
||||
static bool readAltitude(const char *data, qreal &ele)
|
||||
{
|
||||
int p;
|
||||
int ga;
|
||||
|
||||
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[6] == '-') {
|
||||
if ((ga = str2int(data + 7, 4)) < 0)
|
||||
return false;
|
||||
ga = -ga;
|
||||
} else {
|
||||
if ((ga = str2int(data + 6, 5)) < 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (data[0] == 'A')
|
||||
ele = (qreal)g;
|
||||
ele = (qreal)ga;
|
||||
else
|
||||
ele = NAN;
|
||||
|
||||
@ -87,7 +87,7 @@ static bool readTimestamp(const char *data, QTime &time)
|
||||
|
||||
static bool readARecord(const char *line, qint64 len)
|
||||
{
|
||||
if (len < 9 || line[0] != 'A')
|
||||
if (len < 7 || line[0] != 'A')
|
||||
return false;
|
||||
|
||||
for (int i = 1; i < 7; i++)
|
||||
|
@ -10,7 +10,6 @@ class IGCParser : public Parser
|
||||
{
|
||||
public:
|
||||
IGCParser() : _errorLine(0) {}
|
||||
~IGCParser() {}
|
||||
|
||||
bool parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<RouteData> &routes, QList<Waypoint> &waypoints);
|
||||
|
@ -8,8 +8,6 @@
|
||||
class KMLParser : public Parser
|
||||
{
|
||||
public:
|
||||
~KMLParser() {}
|
||||
|
||||
bool parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<RouteData> &routes, QList<Waypoint> &waypoints);
|
||||
QString errorString() const {return _reader.errorString();}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <cstring>
|
||||
#include "str2int.h"
|
||||
#include "common/str2int.h"
|
||||
#include "nmeaparser.h"
|
||||
|
||||
|
||||
|
@ -9,7 +9,6 @@ class NMEAParser : public Parser
|
||||
{
|
||||
public:
|
||||
NMEAParser() : _errorLine(0), _GGA(false) {}
|
||||
~NMEAParser() {}
|
||||
|
||||
bool parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<RouteData> &routes, QList<Waypoint> &waypoints);
|
||||
|
@ -13,9 +13,11 @@ RectC Path::boundingRect() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const PathPoint &point)
|
||||
{
|
||||
dbg.nospace() << "PathPoint(" << point.distance() << ", "
|
||||
<< point.coordinates() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -23,7 +23,9 @@ private:
|
||||
};
|
||||
|
||||
Q_DECLARE_TYPEINFO(PathPoint, Q_PRIMITIVE_TYPE);
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const PathPoint &point);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
|
||||
class Path : public QVector<PathPoint>
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include "data.h"
|
||||
#include "poi.h"
|
||||
|
||||
@ -9,20 +10,25 @@ POI::POI(QObject *parent) : QObject(parent)
|
||||
_radius = 1000;
|
||||
}
|
||||
|
||||
bool POI::loadFile(const QString &fileName)
|
||||
bool POI::loadFile(const QString &path, bool dir)
|
||||
{
|
||||
Data data;
|
||||
FileIndex index;
|
||||
|
||||
_errorString.clear();
|
||||
_errorLine = 0;
|
||||
|
||||
index.enabled = true;
|
||||
index.start = _data.size();
|
||||
|
||||
if (!data.loadFile(fileName)) {
|
||||
_errorString = data.errorString();
|
||||
_errorLine = data.errorLine();
|
||||
if (!data.loadFile(path)) {
|
||||
if (dir) {
|
||||
if (data.errorLine())
|
||||
_errorString += QString("%1:%2: %3\n").arg(path)
|
||||
.arg(data.errorLine()).arg(data.errorString());
|
||||
else
|
||||
_errorString += path + ": " + data.errorString() + "\n";
|
||||
} else {
|
||||
_errorString = data.errorString();
|
||||
_errorLine = data.errorLine();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -38,7 +44,7 @@ bool POI::loadFile(const QString &fileName)
|
||||
_tree.Insert(c, c, i);
|
||||
}
|
||||
|
||||
_files.append(fileName);
|
||||
_files.append(path);
|
||||
_indexes.append(index);
|
||||
|
||||
emit pointsChanged();
|
||||
@ -46,6 +52,39 @@ bool POI::loadFile(const QString &fileName)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool POI::loadFile(const QString &path)
|
||||
{
|
||||
_errorString.clear();
|
||||
_errorLine = 0;
|
||||
|
||||
return loadFile(path, false);
|
||||
}
|
||||
|
||||
bool POI::loadDir(const QString &path)
|
||||
{
|
||||
QDir md(path);
|
||||
md.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
QFileInfoList fl = md.entryInfoList();
|
||||
bool ret = true;
|
||||
|
||||
_errorString.clear();
|
||||
_errorLine = 0;
|
||||
|
||||
for (int i = 0; i < fl.size(); i++) {
|
||||
const QFileInfo &fi = fl.at(i);
|
||||
|
||||
if (fi.isDir()) {
|
||||
if (!loadDir(fi.absoluteFilePath()))
|
||||
ret = false;
|
||||
} else {
|
||||
if (!loadFile(fi.absoluteFilePath(), true))
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool cb(size_t data, void* context)
|
||||
{
|
||||
QSet<int> *set = (QSet<int>*) context;
|
||||
|
@ -18,7 +18,8 @@ class POI : public QObject
|
||||
public:
|
||||
POI(QObject *parent = 0);
|
||||
|
||||
bool loadFile(const QString &fileName);
|
||||
bool loadFile(const QString &path);
|
||||
bool loadDir(const QString &path);
|
||||
const QString &errorString() const {return _errorString;}
|
||||
int errorLine() const {return _errorLine;}
|
||||
|
||||
@ -43,6 +44,8 @@ private:
|
||||
bool enabled;
|
||||
};
|
||||
|
||||
bool loadFile(const QString &path, bool dir);
|
||||
|
||||
POITree _tree;
|
||||
QVector<Waypoint> _data;
|
||||
QStringList _files;
|
||||
|
@ -8,8 +8,6 @@
|
||||
class TCXParser : public Parser
|
||||
{
|
||||
public:
|
||||
~TCXParser() {}
|
||||
|
||||
bool parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<RouteData> &routes, QList<Waypoint> &waypoints);
|
||||
QString errorString() const {return _reader.errorString();}
|
||||
|
@ -49,9 +49,7 @@ static QSet<int> eliminate(const QVector<qreal> &v, int window)
|
||||
|
||||
static Graph filter(const Graph &g, int window)
|
||||
{
|
||||
if (g.size() < window)
|
||||
return Graph();
|
||||
if (window < 2)
|
||||
if (g.size() < window || window < 2)
|
||||
return Graph(g);
|
||||
|
||||
qreal acc = 0;
|
||||
@ -77,27 +75,32 @@ static Graph filter(const Graph &g, int window)
|
||||
Track::Track(const TrackData &data) : _data(data)
|
||||
{
|
||||
qreal dt, ds, total;
|
||||
int last;
|
||||
|
||||
|
||||
_time.append(0);
|
||||
_distance.append(0);
|
||||
_speed.append(0);
|
||||
|
||||
for (int i = 1; i < data.count(); i++) {
|
||||
ds = data.at(i).coordinates().distanceTo(data.at(i-1).coordinates());
|
||||
last = 0;
|
||||
|
||||
for (int i = 1; i < _data.count(); i++) {
|
||||
ds = _data.at(i).coordinates().distanceTo(_data.at(i-1).coordinates());
|
||||
_distance.append(ds);
|
||||
|
||||
if (data.first().hasTimestamp() && data.at(i).hasTimestamp())
|
||||
if (_data.first().hasTimestamp() && _data.at(i).hasTimestamp()
|
||||
&& _data.at(i).timestamp() > _data.at(last).timestamp()) {
|
||||
_time.append(_data.first().timestamp().msecsTo(
|
||||
_data.at(i).timestamp()) / 1000.0);
|
||||
else
|
||||
last = i;
|
||||
} else
|
||||
_time.append(NAN);
|
||||
|
||||
if (std::isnan(_time.at(i)) || std::isnan(_time.at(i-1)))
|
||||
_speed.append(NAN);
|
||||
else {
|
||||
dt = _time.at(i) - _time.at(i-1);
|
||||
if (!dt) {
|
||||
if (dt < 1e-3) {
|
||||
_speed.append(_speed.at(i-1));
|
||||
continue;
|
||||
}
|
||||
@ -106,7 +109,7 @@ Track::Track(const TrackData &data) : _data(data)
|
||||
}
|
||||
|
||||
_pause = 0;
|
||||
for (int i = 1; i < data.count(); i++) {
|
||||
for (int i = 1; i < _data.count(); i++) {
|
||||
if (_time.at(i) > _time.at(i-1) + _pauseInterval
|
||||
&& _speed.at(i) < _pauseSpeed) {
|
||||
_pause += _time.at(i) - _time.at(i-1);
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
|
||||
Q_DECLARE_TYPEINFO(Trackpoint, Q_MOVABLE_TYPE);
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
inline QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint)
|
||||
{
|
||||
dbg.nospace() << "Trackpoint(" << trackpoint.coordinates() << ", "
|
||||
@ -65,5 +66,6 @@ inline QDebug operator<<(QDebug dbg, const Trackpoint &trackpoint)
|
||||
<< trackpoint.temperature() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // TRACKPOINT_H
|
||||
|
@ -48,12 +48,14 @@ inline uint qHash(const Waypoint &key)
|
||||
return ::qHash(key.name());
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
inline QDebug operator<<(QDebug dbg, const Waypoint &waypoint)
|
||||
{
|
||||
dbg.nospace() << "Waypoint(" << waypoint.coordinates() << ", "
|
||||
<< waypoint.name() << ", " << waypoint.description() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
Q_DECLARE_TYPEINFO(Waypoint, Q_MOVABLE_TYPE);
|
||||
|
||||
|
@ -56,7 +56,7 @@ Defense.
|
||||
((clat) / sqrt(one_minus_sqr_es_sin))
|
||||
|
||||
|
||||
AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||
AlbersEqual::AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
|
||||
double standardParallel2, double latitudeOrigin, double longitudeOrigin,
|
||||
double falseEasting, double falseNorthing)
|
||||
{
|
||||
@ -78,7 +78,7 @@ AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||
sp1 = deg2rad(standardParallel1);
|
||||
sp2 = deg2rad(standardParallel2);
|
||||
|
||||
_es2 = 2 * _e.flattening() - _e.flattening() * _e.flattening();
|
||||
_es2 = 2 * _e->flattening() - _e->flattening() * _e->flattening();
|
||||
_es = sqrt(_es2);
|
||||
_one_minus_es2 = 1 - _es2;
|
||||
_two_es = 2 * _es;
|
||||
@ -108,7 +108,7 @@ AlbersEqual::AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||
_n = sin_lat1;
|
||||
|
||||
_C = sqr_m1 + _n * q1;
|
||||
_a_over_n = _e.radius() / _n;
|
||||
_a_over_n = _e->radius() / _n;
|
||||
nq0 = _n * q0;
|
||||
_rho0 = (_C < nq0) ? 0 : _a_over_n * sqrt(_C - nq0);
|
||||
}
|
||||
@ -171,7 +171,7 @@ Coordinates AlbersEqual::xy2ll(const QPointF &p) const
|
||||
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;
|
||||
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;
|
||||
|
@ -2,20 +2,22 @@
|
||||
#define ALBERSEQUAL_H
|
||||
|
||||
#include "ellipsoid.h"
|
||||
#include "projection.h"
|
||||
#include "ct.h"
|
||||
|
||||
class AlbersEqual : public Projection
|
||||
class AlbersEqual : public CT
|
||||
{
|
||||
public:
|
||||
AlbersEqual(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||
AlbersEqual(const Ellipsoid *ellipsoid, double standardParallel1,
|
||||
double standardParallel2, double latitudeOrigin, double longitudeOrigin,
|
||||
double falseEasting, double falseNorthing);
|
||||
|
||||
virtual CT *clone() const {return new AlbersEqual(*this);}
|
||||
|
||||
virtual QPointF ll2xy(const Coordinates &c) const;
|
||||
virtual Coordinates xy2ll(const QPointF &p) const;
|
||||
|
||||
private:
|
||||
Ellipsoid _e;
|
||||
const Ellipsoid *_e;
|
||||
|
||||
double _latitudeOrigin;
|
||||
double _longitudeOrigin;
|
||||
|
92
src/map/angularunits.cpp
Normal file
92
src/map/angularunits.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
#include "common/coordinates.h"
|
||||
#include "common/str2int.h"
|
||||
#include "angularunits.h"
|
||||
|
||||
static double sDMS2deg(double val)
|
||||
{
|
||||
double angle;
|
||||
const char *decimal;
|
||||
|
||||
QString qstr(QString::number(qAbs(val), 'f', 7));
|
||||
const char *str = qstr.toLatin1().constData();
|
||||
decimal = strrchr(str, '.');
|
||||
int deg = str2int(str, decimal - str);
|
||||
int min = str2int(decimal + 1, 2);
|
||||
int sec = str2int(decimal + 3, 2);
|
||||
int f = str2int(decimal + 5, 3);
|
||||
|
||||
angle = deg + min/60.0 + sec/3600.0 + (f/1000.0)/3600.0;
|
||||
|
||||
return (val < 0) ? -angle : angle;
|
||||
}
|
||||
|
||||
static double deg2sDMS(double val)
|
||||
{
|
||||
double aval = qAbs(val);
|
||||
|
||||
int deg = aval;
|
||||
double r1 = aval - deg;
|
||||
|
||||
int min = r1 * 60.0;
|
||||
double r2 = r1 - (min / 60.0);
|
||||
|
||||
int sec = r2 * 3600.0;
|
||||
double r3 = r2 - (sec / 3600.0);
|
||||
int f = (int)(r3 * 3600.0 * 1000.0);
|
||||
|
||||
QString str(QString("%1.%2%3%4").arg(deg).arg(min, 2, 10, QChar('0'))
|
||||
.arg(sec, 2, 10, QChar('0')).arg(f, 3, 10, QChar('0')));
|
||||
|
||||
return (val < 0) ? -str.toDouble() : str.toDouble();
|
||||
}
|
||||
|
||||
AngularUnits::AngularUnits(int code) : _code(code)
|
||||
{
|
||||
switch (code) {
|
||||
case 9101:
|
||||
_f = 180.0 / M_PI;
|
||||
break;
|
||||
case 9102:
|
||||
case 9107:
|
||||
case 9108:
|
||||
case 9110:
|
||||
case 9122:
|
||||
_f = 1.0;
|
||||
break;
|
||||
case 9103:
|
||||
_f = 1 / 60.0;
|
||||
break;
|
||||
case 9104:
|
||||
_f = 1 / 3600.0;
|
||||
break;
|
||||
case 9105:
|
||||
_f = 180.0 / 200.0;
|
||||
break;
|
||||
case 9106:
|
||||
_f = 180.0 / 200.0;
|
||||
break;
|
||||
case 9109:
|
||||
_f = 180.0 / (M_PI * 1000000.0);
|
||||
break;
|
||||
default:
|
||||
_f = NAN;
|
||||
}
|
||||
}
|
||||
|
||||
double AngularUnits::toDegrees(double val) const
|
||||
{
|
||||
return (_code == 9110) ? sDMS2deg(val) : val * _f;
|
||||
}
|
||||
|
||||
double AngularUnits::fromDegrees(double val) const
|
||||
{
|
||||
return (_code == 9110) ? deg2sDMS(val) : val / _f;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const AngularUnits &au)
|
||||
{
|
||||
dbg.nospace() << "AngularUnits(" << deg2rad(au._f) << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
35
src/map/angularunits.h
Normal file
35
src/map/angularunits.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef ANGULARUNITS_H
|
||||
#define ANGULARUNITS_H
|
||||
|
||||
#include <cmath>
|
||||
#include <QDebug>
|
||||
|
||||
class AngularUnits
|
||||
{
|
||||
public:
|
||||
AngularUnits() : _code(0), _f(NAN) {}
|
||||
AngularUnits(int code);
|
||||
|
||||
bool isNull() const {return std::isnan(_f);}
|
||||
bool isValid() const {return !std::isnan(_f);}
|
||||
|
||||
double toDegrees(double val) const;
|
||||
double fromDegrees(double val) const;
|
||||
|
||||
friend bool operator==(const AngularUnits &au1, const AngularUnits &au2);
|
||||
#ifndef QT_NO_DEBUG
|
||||
friend QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
||||
#endif // QT_NO_DEBUG
|
||||
private:
|
||||
int _code;
|
||||
double _f;
|
||||
};
|
||||
|
||||
inline bool operator==(const AngularUnits &au1, const AngularUnits &au2)
|
||||
{return (au1._f == au2._f);}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const AngularUnits &au);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // ANGULARUNITS_H
|
@ -31,37 +31,6 @@ 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);
|
||||
@ -111,16 +80,38 @@ void Atlas::computeBounds()
|
||||
|
||||
Atlas::Atlas(const QString &fileName, QObject *parent) : Map(parent)
|
||||
{
|
||||
Tar tar;
|
||||
QFileInfo fi(fileName);
|
||||
QByteArray ba;
|
||||
QString suffix = fi.suffix().toLower();
|
||||
Tar tar;
|
||||
|
||||
_valid = false;
|
||||
_zoom = 0;
|
||||
_name = fi.dir().dirName();
|
||||
_ci = -1; _cz = -1;
|
||||
|
||||
if (!isAtlas(tar, fileName))
|
||||
|
||||
if (suffix == "tar") {
|
||||
if (!tar.load(fileName)) {
|
||||
_errorString = "Error reading tar file";
|
||||
return;
|
||||
}
|
||||
QString tbaFileName = fi.completeBaseName() + ".tba";
|
||||
ba = tar.file(tbaFileName);
|
||||
} else if (suffix == "tba") {
|
||||
QFile tbaFile(fileName);
|
||||
if (!tbaFile.open(QIODevice::ReadOnly)) {
|
||||
_errorString = QString("Error opening tba file: %1")
|
||||
.arg(tbaFile.errorString());
|
||||
return;
|
||||
}
|
||||
ba = tbaFile.readAll();
|
||||
}
|
||||
if (!ba.startsWith("Atlas 1.0")) {
|
||||
_errorString = "Missing or invalid tba file";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QDir dir(fi.absolutePath());
|
||||
QFileInfoList layers = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||
@ -336,3 +327,20 @@ void Atlas::unload()
|
||||
for (int i = 0; i < _maps.count(); i++)
|
||||
_maps.at(i)->unload();
|
||||
}
|
||||
|
||||
bool Atlas::isAtlas(const QString &path)
|
||||
{
|
||||
QFileInfo fi(path);
|
||||
QString suffix = fi.suffix().toLower();
|
||||
Tar tar;
|
||||
|
||||
if (suffix == "tar") {
|
||||
if (!tar.load(path))
|
||||
return false;
|
||||
QString tbaFileName = fi.completeBaseName() + ".tba";
|
||||
return tar.contains(tbaFileName);
|
||||
} else if (suffix == "tba")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -35,9 +35,10 @@ public:
|
||||
bool isValid() const {return _valid;}
|
||||
const QString &errorString() const {return _errorString;}
|
||||
|
||||
static bool isAtlas(const QString &path);
|
||||
|
||||
private:
|
||||
void draw(QPainter *painter, const QRectF &rect, int mapIndex);
|
||||
bool isAtlas(Tar &tar, const QString &path);
|
||||
void computeZooms();
|
||||
void computeBounds();
|
||||
|
||||
|
17
src/map/ct.h
Normal file
17
src/map/ct.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef CT_H
|
||||
#define CT_H
|
||||
|
||||
#include <QPointF>
|
||||
#include "common/coordinates.h"
|
||||
|
||||
class CT {
|
||||
public:
|
||||
virtual ~CT() {}
|
||||
|
||||
virtual CT *clone() const = 0;
|
||||
|
||||
virtual QPointF ll2xy(const Coordinates &c) const = 0;
|
||||
virtual Coordinates xy2ll(const QPointF &p) const = 0;
|
||||
};
|
||||
|
||||
#endif // CT_H
|
@ -1,96 +1,14 @@
|
||||
#include <cmath>
|
||||
#include <QFile>
|
||||
#include "common/wgs84.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;
|
||||
}
|
||||
static Ellipsoid WGS84e = Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING);
|
||||
static Datum WGS84 = Datum(&WGS84e, 0.0, 0.0, 0.0);
|
||||
|
||||
// Abridged Molodensky transformation
|
||||
Coordinates Datum::toWGS84(const Coordinates &c) const
|
||||
static Coordinates molodensky(const Coordinates &c, const Datum &from,
|
||||
const Datum &to)
|
||||
{
|
||||
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());
|
||||
|
||||
@ -100,21 +18,54 @@ Coordinates Datum::toWGS84(const Coordinates &c) const
|
||||
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 dx = from.dx() - to.dx();
|
||||
double dy = from.dy() - to.dy();
|
||||
double dz = from.dz() - to.dz();
|
||||
|
||||
double from_f = from.ellipsoid()->flattening();
|
||||
double to_f = to.ellipsoid()->flattening();
|
||||
double df = to_f - from_f;
|
||||
double from_a = from.ellipsoid()->radius();
|
||||
double to_a = to.ellipsoid()->radius();
|
||||
double da = to_a - from_a;
|
||||
double from_esq = from_f * (2.0 - from_f);
|
||||
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
|
||||
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);
|
||||
|
||||
double dlon = (-dx * slon + dy * clon) / ((rn + from_h) * clat);
|
||||
|
||||
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
|
||||
}
|
||||
|
||||
Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz)
|
||||
: _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz)
|
||||
{
|
||||
_WGS84 = (_ellipsoid->radius() == WGS84_RADIUS
|
||||
&& _ellipsoid->flattening() == WGS84_FLATTENING && _dx == 0.0
|
||||
&& _dy == 0.0 && _dz == 0.0) ? true : false;
|
||||
}
|
||||
|
||||
Coordinates Datum::toWGS84(const Coordinates &c) const
|
||||
{
|
||||
return _WGS84 ? c : molodensky(c, *this, WGS84);
|
||||
}
|
||||
|
||||
Coordinates Datum::fromWGS84(const Coordinates &c) const
|
||||
{
|
||||
return _WGS84 ? c : molodensky(c, WGS84, *this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Datum &datum)
|
||||
{
|
||||
dbg.nospace() << "Datum(" << *datum.ellipsoid() << ", " << datum.dx()
|
||||
<< ", " << datum.dy() << ", " << datum.dz() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -1,40 +1,46 @@
|
||||
#ifndef DATUM_H
|
||||
#define DATUM_H
|
||||
|
||||
#include <QMap>
|
||||
#include <cmath>
|
||||
#include <QList>
|
||||
#include <QDebug>
|
||||
#include "ellipsoid.h"
|
||||
#include "common/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) {}
|
||||
Datum() : _ellipsoid(0), _dx(NAN), _dy(NAN), _dz(NAN),
|
||||
_WGS84(false) {}
|
||||
Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz);
|
||||
|
||||
const Ellipsoid &ellipsoid() const {return _ellipsoid;}
|
||||
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);}
|
||||
{return (!_ellipsoid && std::isnan(_dx) && std::isnan(_dy)
|
||||
&& std::isnan(_dz));}
|
||||
bool isValid() const
|
||||
{return (_ellipsoid && !std::isnan(_dx) && !std::isnan(_dy)
|
||||
&& !std::isnan(_dz));}
|
||||
|
||||
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);
|
||||
Coordinates fromWGS84(const Coordinates &c) const;
|
||||
|
||||
private:
|
||||
Ellipsoid _ellipsoid;
|
||||
const Ellipsoid *_ellipsoid;
|
||||
double _dx, _dy, _dz;
|
||||
|
||||
static QMap<QString, Datum> _datums;
|
||||
static QString _errorString;
|
||||
static int _errorLine;
|
||||
bool _WGS84;
|
||||
};
|
||||
|
||||
inline bool operator==(const Datum &d1, const Datum &d2)
|
||||
{return (d1.ellipsoid() == d2.ellipsoid() && d1.dx() == d2.dx()
|
||||
&& d1.dy() == d2.dy() && d1.dz() == d2.dz());}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Datum &datum);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // DATUM_H
|
||||
|
@ -1,62 +1,76 @@
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include "common/wgs84.h"
|
||||
#include "ellipsoid.h"
|
||||
|
||||
QMap<int, Ellipsoid> Ellipsoid::_ellipsoids;
|
||||
QString Ellipsoid::_errorString;
|
||||
int Ellipsoid::_errorLine = 0;
|
||||
QMap<int, Ellipsoid> Ellipsoid::_ellipsoids = WGS84();
|
||||
|
||||
Ellipsoid Ellipsoid::ellipsoid(int id)
|
||||
QMap<int, Ellipsoid> Ellipsoid::WGS84()
|
||||
{
|
||||
QMap<int, Ellipsoid> map;
|
||||
map.insert(7030, Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING));
|
||||
return map;
|
||||
}
|
||||
|
||||
const Ellipsoid *Ellipsoid::ellipsoid(int id)
|
||||
{
|
||||
QMap<int, Ellipsoid>::const_iterator it = _ellipsoids.find(id);
|
||||
|
||||
if (it == _ellipsoids.end())
|
||||
return Ellipsoid();
|
||||
|
||||
return it.value();
|
||||
return 0;
|
||||
else
|
||||
return &(it.value());
|
||||
}
|
||||
|
||||
bool Ellipsoid::loadList(const QString &path)
|
||||
void Ellipsoid::loadList(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
bool res;
|
||||
int ln = 0;
|
||||
|
||||
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
_errorString = qPrintable(file.errorString());
|
||||
return false;
|
||||
qWarning("Error opening ellipsoids file: %s: %s", qPrintable(path),
|
||||
qPrintable(file.errorString()));
|
||||
return;
|
||||
}
|
||||
|
||||
_errorLine = 1;
|
||||
_errorString.clear();
|
||||
|
||||
while (!file.atEnd()) {
|
||||
ln++;
|
||||
|
||||
QByteArray line = file.readLine();
|
||||
QList<QByteArray> list = line.split(',');
|
||||
if (list.size() != 4) {
|
||||
_errorString = "Format error";
|
||||
return false;
|
||||
qWarning("%s: %d: Format error", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
int id = list[0].trimmed().toInt(&res);
|
||||
int id = list[1].trimmed().toInt(&res);
|
||||
if (!res) {
|
||||
_errorString = "Invalid ellipsoid id";
|
||||
return false;
|
||||
qWarning("%s: %d: Invalid ellipsoid code", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
double radius = list[2].trimmed().toDouble(&res);
|
||||
if (!res) {
|
||||
_errorString = "Invalid ellipsoid radius";
|
||||
return false;
|
||||
qWarning("%s: %d: Invalid radius", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
double flattening = list[3].trimmed().toDouble(&res);
|
||||
if (!res) {
|
||||
_errorString = "Invalid ellipsoid flattening";
|
||||
return false;
|
||||
qWarning("%s: %d: Invalid flattening", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
Ellipsoid e(radius, 1.0/flattening);
|
||||
_ellipsoids.insert(id, e);
|
||||
|
||||
_errorLine++;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid)
|
||||
{
|
||||
dbg.nospace() << "Ellipsoid(" << ellipsoid.radius() << ", "
|
||||
<< 1.0 / ellipsoid.flattening() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
||||
|
@ -1,34 +1,42 @@
|
||||
#ifndef ELLIPSOID_H
|
||||
#define ELLIPSOID_H
|
||||
|
||||
#include <cmath>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
||||
class Ellipsoid
|
||||
{
|
||||
public:
|
||||
Ellipsoid() : _radius(0.0), _flattening(0.0) {}
|
||||
Ellipsoid() : _radius(NAN), _flattening(NAN) {}
|
||||
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);}
|
||||
bool isNull() const
|
||||
{return (std::isnan(_radius) && std::isnan(_flattening));}
|
||||
bool isValid() const
|
||||
{return !(std::isnan(_radius) || std::isnan(_flattening));}
|
||||
|
||||
static bool loadList(const QString &path);
|
||||
static const QString &errorString() {return _errorString;}
|
||||
static int errorLine() {return _errorLine;}
|
||||
|
||||
static Ellipsoid ellipsoid(int id);
|
||||
static const Ellipsoid *ellipsoid(int id);
|
||||
static void loadList(const QString &path);
|
||||
|
||||
private:
|
||||
double _radius;
|
||||
double _flattening;
|
||||
|
||||
static QMap<int, Ellipsoid> WGS84();
|
||||
static QMap<int, Ellipsoid> _ellipsoids;
|
||||
static QString _errorString;
|
||||
static int _errorLine;
|
||||
};
|
||||
|
||||
inline bool operator==(const Ellipsoid &e1, const Ellipsoid &e2)
|
||||
{return (e1.radius() == e2.radius() && e1.flattening() == e2.flattening());}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const Ellipsoid &ellipsoid);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // ELLIPSOID_H
|
||||
|
@ -3,14 +3,23 @@
|
||||
#include "common/coordinates.h"
|
||||
#include "common/rectc.h"
|
||||
#include "common/wgs84.h"
|
||||
#include "mercator.h"
|
||||
#include "misc.h"
|
||||
#include "emptymap.h"
|
||||
|
||||
|
||||
#define SCALE_MIN 0.5
|
||||
#define SCALE_MAX 1.0E-6
|
||||
|
||||
static QPointF ll2m(const Coordinates &c)
|
||||
{
|
||||
return QPointF(c.lon(), rad2deg(log(tan(M_PI/4.0 + deg2rad(c.lat())/2.0))));
|
||||
}
|
||||
|
||||
static Coordinates m2ll(const QPointF &p)
|
||||
{
|
||||
return Coordinates(p.x(), rad2deg(2 * atan(exp(deg2rad(p.y()))) - M_PI/2));
|
||||
}
|
||||
|
||||
|
||||
EmptyMap::EmptyMap(QObject *parent) : Map(parent)
|
||||
{
|
||||
_scale = SCALE_MAX;
|
||||
@ -18,7 +27,7 @@ EmptyMap::EmptyMap(QObject *parent) : Map(parent)
|
||||
|
||||
QRectF EmptyMap::bounds() const
|
||||
{
|
||||
return scaled(QRectF(QPointF(-180, -180), QSizeF(360, 360)), 1.0/_scale);
|
||||
return QRectF(ll2xy(Coordinates(-180, 85)), ll2xy(Coordinates(180, -85)));
|
||||
}
|
||||
|
||||
qreal EmptyMap::zoomFit(const QSize &size, const RectC &br)
|
||||
@ -26,8 +35,7 @@ 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()));
|
||||
QRectF tbr(ll2m(br.topLeft()), ll2m(br.bottomRight()));
|
||||
QPointF sc(tbr.width() / size.width(), tbr.height() / size.height());
|
||||
_scale = qMax(sc.x(), sc.y());
|
||||
}
|
||||
@ -72,14 +80,14 @@ void EmptyMap::draw(QPainter *painter, const QRectF &rect)
|
||||
painter->fillRect(rect, _backgroundColor);
|
||||
}
|
||||
|
||||
QPointF EmptyMap::ll2xy(const Coordinates &c)
|
||||
QPointF EmptyMap::ll2xy(const Coordinates &c) const
|
||||
{
|
||||
QPointF m = Mercator().ll2xy(c);
|
||||
QPointF m = ll2m(c);
|
||||
return QPointF(m.x() / _scale, m.y() / -_scale);
|
||||
}
|
||||
|
||||
Coordinates EmptyMap::xy2ll(const QPointF &p)
|
||||
Coordinates EmptyMap::xy2ll(const QPointF &p) const
|
||||
{
|
||||
QPointF m(p.x() * _scale, -p.y() * _scale);
|
||||
return Mercator().xy2ll(m);
|
||||
return m2ll(QPointF(p.x() * _scale, -p.y() * _scale));
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef EMPTYMAP_H
|
||||
#define EMPTYMAP_H
|
||||
|
||||
#include "common/coordinates.h"
|
||||
#include "map.h"
|
||||
|
||||
class EmptyMap : public Map
|
||||
@ -21,12 +22,17 @@ public:
|
||||
qreal zoomIn();
|
||||
qreal zoomOut();
|
||||
|
||||
QPointF ll2xy(const Coordinates &c);
|
||||
Coordinates xy2ll(const QPointF &p);
|
||||
QPointF ll2xy(const Coordinates &c)
|
||||
{return static_cast<const EmptyMap &>(*this).ll2xy(c);}
|
||||
Coordinates xy2ll(const QPointF &p)
|
||||
{return static_cast<const EmptyMap &>(*this).xy2ll(p);}
|
||||
|
||||
void draw(QPainter *painter, const QRectF &rect);
|
||||
|
||||
private:
|
||||
QPointF ll2xy(const Coordinates &c) const;
|
||||
Coordinates xy2ll(const QPointF &p) const;
|
||||
|
||||
QString _name;
|
||||
qreal _scale;
|
||||
};
|
||||
|
193
src/map/gcs.cpp
Normal file
193
src/map/gcs.cpp
Normal file
@ -0,0 +1,193 @@
|
||||
#include <QFile>
|
||||
#include "common/wgs84.h"
|
||||
#include "gcs.h"
|
||||
|
||||
|
||||
class GCS::Entry {
|
||||
public:
|
||||
Entry(int id, int gd, const QString &name, const GCS &gcs)
|
||||
: _id(id), _gd(gd), _name(name), _gcs(gcs) {}
|
||||
|
||||
int id() const {return _id;}
|
||||
int gd() const {return _gd;}
|
||||
const QString &name() const {return _name;}
|
||||
const GCS &gcs() const {return _gcs;}
|
||||
|
||||
private:
|
||||
int _id, _gd;
|
||||
QString _name;
|
||||
GCS _gcs;
|
||||
};
|
||||
|
||||
static Ellipsoid WGS84e = Ellipsoid(WGS84_RADIUS, WGS84_FLATTENING);
|
||||
static Datum WGS84d = Datum(&WGS84e, 0.0, 0.0, 0.0);
|
||||
|
||||
static int parameter(const QString &str, bool *res)
|
||||
{
|
||||
QString field = str.trimmed();
|
||||
if (field.isEmpty()) {
|
||||
*res = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return field.toInt(res);
|
||||
}
|
||||
|
||||
QList<GCS::Entry> GCS::_gcss = WGS84();
|
||||
|
||||
QList<GCS::Entry> GCS::WGS84()
|
||||
{
|
||||
QList<GCS::Entry> list;
|
||||
list.append(GCS::Entry(4326, 6326, "WGS 84", GCS(WGS84d, 8901, 9122)));
|
||||
return list;
|
||||
}
|
||||
|
||||
const GCS *GCS::gcs(int id)
|
||||
{
|
||||
for (int i = 0; i < _gcss.size(); i++)
|
||||
if (_gcss.at(i).id() == id)
|
||||
return &(_gcss.at(i).gcs());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const GCS *GCS::gcs(int geodeticDatum, int primeMeridian, int angularUnits)
|
||||
{
|
||||
for (int i = 0; i < _gcss.size(); i++) {
|
||||
const Entry &e = _gcss.at(i);
|
||||
if (e.gd() == geodeticDatum && e.gcs().primeMeridian() == primeMeridian
|
||||
&& e.gcs().angularUnits() == angularUnits)
|
||||
return &(e.gcs());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const GCS *GCS::gcs(const QString &name)
|
||||
{
|
||||
for (int i = 0; i < _gcss.size(); i++)
|
||||
if (_gcss.at(i).name() == name)
|
||||
return &(_gcss.at(i).gcs());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GCS::loadList(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
bool res;
|
||||
int ln = 0;
|
||||
const Ellipsoid *e;
|
||||
|
||||
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
qWarning("Error opening PCS file: %s: %s", qPrintable(path),
|
||||
qPrintable(file.errorString()));
|
||||
return;
|
||||
}
|
||||
|
||||
while (!file.atEnd()) {
|
||||
ln++;
|
||||
|
||||
QByteArray line = file.readLine();
|
||||
QList<QByteArray> list = line.split(',');
|
||||
if (list.size() < 10) {
|
||||
qWarning("%s: %d: Format error", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
int id = parameter(list[1], &res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid GCS code", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
int gd = parameter(list[2], &res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid geodetic datum code", qPrintable(path),
|
||||
ln);
|
||||
continue;
|
||||
}
|
||||
int au = list[3].trimmed().toInt(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid angular units code", qPrintable(path),
|
||||
ln);
|
||||
continue;
|
||||
}
|
||||
int el = list[4].trimmed().toInt(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid ellipsoid code", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
int pm = list[5].trimmed().toInt(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid prime meridian code", qPrintable(path),
|
||||
ln);
|
||||
continue;
|
||||
}
|
||||
int ct = list[6].trimmed().toInt(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid coordinates transformation code",
|
||||
qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
double dx = list[7].trimmed().toDouble(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid dx", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
double dy = list[8].trimmed().toDouble(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid dy", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
double dz = list[9].trimmed().toDouble(&res);
|
||||
if (!res) {
|
||||
qWarning("%s: %d: Invalid dz", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(e = Ellipsoid::ellipsoid(el))) {
|
||||
qWarning("%s: %d: Unknown ellipsoid code", qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
Datum datum;
|
||||
switch (ct) {
|
||||
case 9603:
|
||||
datum = Datum(e, dx, dy, dz);
|
||||
break;
|
||||
default:
|
||||
qWarning("%s: %d: Unknown coordinates transformation method",
|
||||
qPrintable(path), ln);
|
||||
continue;
|
||||
}
|
||||
|
||||
GCS gcs(datum, pm, au);
|
||||
if (gcs.isValid())
|
||||
_gcss.append(Entry(id, gd, list[0].trimmed(), gcs));
|
||||
else
|
||||
qWarning("%s: %d: Unknown prime meridian/angular units code",
|
||||
qPrintable(path), ln);
|
||||
}
|
||||
}
|
||||
|
||||
Coordinates GCS::toWGS84(const Coordinates &c) const
|
||||
{
|
||||
return datum().toWGS84(Coordinates(_primeMeridian.toGreenwich(c.lon()),
|
||||
c.lat()));
|
||||
}
|
||||
|
||||
Coordinates GCS::fromWGS84(const Coordinates &c) const
|
||||
{
|
||||
Coordinates ds(datum().fromWGS84(c));
|
||||
return Coordinates(_primeMeridian.fromGreenwich(ds.lon()), ds.lat());
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const GCS &gcs)
|
||||
{
|
||||
dbg.nospace() << "GCS(" << gcs.datum() << ", " << gcs.primeMeridian()
|
||||
<< ", " << gcs.angularUnits() << ")";
|
||||
return dbg.space();
|
||||
}
|
||||
#endif // QT_NO_DEBUG
|
57
src/map/gcs.h
Normal file
57
src/map/gcs.h
Normal file
@ -0,0 +1,57 @@
|
||||
#ifndef GCS_H
|
||||
#define GCS_H
|
||||
|
||||
#include "datum.h"
|
||||
#include "angularunits.h"
|
||||
#include "primemeridian.h"
|
||||
|
||||
class GCS
|
||||
{
|
||||
public:
|
||||
GCS() {}
|
||||
GCS(const Datum &datum, const PrimeMeridian &primeMeridian,
|
||||
const AngularUnits &angularUnits) : _datum(datum),
|
||||
_primeMeridian(primeMeridian), _angularUnits(angularUnits) {}
|
||||
|
||||
const PrimeMeridian &primeMeridian() const {return _primeMeridian;}
|
||||
const AngularUnits &angularUnits() const {return _angularUnits;}
|
||||
const Datum &datum() const {return _datum;}
|
||||
|
||||
bool isNull() const {return _datum.isNull() && _angularUnits.isNull()
|
||||
&& _primeMeridian.isNull();}
|
||||
bool isValid() const {return _datum.isValid() && _angularUnits.isValid()
|
||||
&& _primeMeridian.isValid();}
|
||||
|
||||
Coordinates toWGS84(const Coordinates &c) const;
|
||||
Coordinates fromWGS84(const Coordinates &c) const;
|
||||
|
||||
|
||||
static const GCS *gcs(int id);
|
||||
static const GCS *gcs(int geodeticDatum, int primeMeridian,
|
||||
int angularUnits);
|
||||
static const GCS *gcs(const QString &name);
|
||||
|
||||
static void loadList(const QString &path);
|
||||
|
||||
private:
|
||||
class Entry;
|
||||
|
||||
static QList<Entry> WGS84();
|
||||
|
||||
Datum _datum;
|
||||
PrimeMeridian _primeMeridian;
|
||||
AngularUnits _angularUnits;
|
||||
|
||||
static QList<Entry> _gcss;
|
||||
};
|
||||
|
||||
inline bool operator==(const GCS &gcs1, const GCS &gcs2)
|
||||
{return (gcs1.datum() == gcs2.datum()
|
||||
&& gcs1.primeMeridian() == gcs2.primeMeridian()
|
||||
&& gcs1.angularUnits() == gcs2.angularUnits());}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
QDebug operator<<(QDebug dbg, const GCS &gcs);
|
||||
#endif // QT_NO_DEBUG
|
||||
|
||||
#endif // GCS_H
|
484
src/map/geotiff.cpp
Normal file
484
src/map/geotiff.cpp
Normal file
@ -0,0 +1,484 @@
|
||||
#include <QFileInfo>
|
||||
#include <QtEndian>
|
||||
#include "pcs.h"
|
||||
#include "latlon.h"
|
||||
#include "geotiff.h"
|
||||
|
||||
|
||||
#define TIFF_DOUBLE 12
|
||||
#define TIFF_SHORT 3
|
||||
#define TIFF_LONG 4
|
||||
|
||||
#define ModelPixelScaleTag 33550
|
||||
#define ModelTiepointTag 33922
|
||||
#define ModelTransformationTag 34264
|
||||
#define GeoKeyDirectoryTag 34735
|
||||
#define GeoDoubleParamsTag 34736
|
||||
#define ImageWidth 256
|
||||
#define ImageHeight 257
|
||||
|
||||
#define GTModelTypeGeoKey 1024
|
||||
#define GTRasterTypeGeoKey 1025
|
||||
#define GeographicTypeGeoKey 2048
|
||||
#define GeogGeodeticDatumGeoKey 2050
|
||||
#define GeogPrimeMeridianGeoKey 2051
|
||||
#define GeogAngularUnitsGeoKey 2054
|
||||
#define ProjectedCSTypeGeoKey 3072
|
||||
#define ProjectionGeoKey 3074
|
||||
#define ProjCoordTransGeoKey 3075
|
||||
#define ProjLinearUnitsGeoKey 3076
|
||||
#define ProjStdParallel1GeoKey 3078
|
||||
#define ProjStdParallel2GeoKey 3079
|
||||
#define ProjNatOriginLongGeoKey 3080
|
||||
#define ProjNatOriginLatGeoKey 3081
|
||||
#define ProjFalseEastingGeoKey 3082
|
||||
#define ProjFalseNorthingGeoKey 3083
|
||||
#define ProjScaleAtNatOriginGeoKey 3092
|
||||
|
||||
#define ModelTypeProjected 1
|
||||
#define ModelTypeGeographic 2
|
||||
#define ModelTypeGeocentric 3
|
||||
|
||||
#define IS_SET(map, key) \
|
||||
((map).contains(key) && (map).value(key).SHORT != 32767)
|
||||
|
||||
#define ARRAY_SIZE(a) \
|
||||
(sizeof(a) / sizeof(*a))
|
||||
|
||||
typedef struct {
|
||||
quint16 KeyDirectoryVersion;
|
||||
quint16 KeyRevision;
|
||||
quint16 MinorRevision;
|
||||
quint16 NumberOfKeys;
|
||||
} Header;
|
||||
|
||||
typedef struct {
|
||||
quint16 KeyID;
|
||||
quint16 TIFFTagLocation;
|
||||
quint16 Count;
|
||||
quint16 ValueOffset;
|
||||
} KeyEntry;
|
||||
|
||||
|
||||
bool GeoTIFF::readEntry(TIFFFile &file, Ctx &ctx) const
|
||||
{
|
||||
quint16 tag;
|
||||
quint16 type;
|
||||
quint32 count, offset;
|
||||
|
||||
if (!file.readValue(tag))
|
||||
return false;
|
||||
if (!file.readValue(type))
|
||||
return false;
|
||||
if (!file.readValue(count))
|
||||
return false;
|
||||
if (!file.readValue(offset))
|
||||
return false;
|
||||
|
||||
switch (tag) {
|
||||
case ModelPixelScaleTag:
|
||||
if (type != TIFF_DOUBLE || count != 3)
|
||||
return false;
|
||||
ctx.scale = offset;
|
||||
break;
|
||||
case ModelTiepointTag:
|
||||
if (type != TIFF_DOUBLE || count < 6 || count % 6)
|
||||
return false;
|
||||
ctx.tiepoints = offset;
|
||||
ctx.tiepointCount = count / 6;
|
||||
break;
|
||||
case GeoKeyDirectoryTag:
|
||||
if (type != TIFF_SHORT)
|
||||
return false;
|
||||
ctx.keys = offset;
|
||||
break;
|
||||
case GeoDoubleParamsTag:
|
||||
if (type != TIFF_DOUBLE)
|
||||
return false;
|
||||
ctx.values = offset;
|
||||
break;
|
||||
case ModelTransformationTag:
|
||||
if (type != TIFF_DOUBLE || count != 16)
|
||||
return false;
|
||||
ctx.matrix = offset;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::readIFD(TIFFFile &file, quint32 &offset, Ctx &ctx) const
|
||||
{
|
||||
quint16 count;
|
||||
|
||||
if (!file.seek(offset))
|
||||
return false;
|
||||
if (!file.readValue(count))
|
||||
return false;
|
||||
|
||||
for (quint16 i = 0; i < count; i++)
|
||||
if (!readEntry(file, ctx))
|
||||
return false;
|
||||
|
||||
if (!file.readValue(offset))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::readScale(TIFFFile &file, quint32 offset, QPointF &scale) const
|
||||
{
|
||||
if (!file.seek(offset))
|
||||
return false;
|
||||
|
||||
if (!file.readValue(scale.rx()))
|
||||
return false;
|
||||
if (!file.readValue(scale.ry()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::readTiepoints(TIFFFile &file, quint32 offset, quint32 count,
|
||||
QList<ReferencePoint> &points) const
|
||||
{
|
||||
double z, pz;
|
||||
QPointF xy, pp;
|
||||
|
||||
if (!file.seek(offset))
|
||||
return false;
|
||||
|
||||
for (quint32 i = 0; i < count; i++) {
|
||||
if (!file.readValue(xy.rx()))
|
||||
return false;
|
||||
if (!file.readValue(xy.ry()))
|
||||
return false;
|
||||
if (!file.readValue(z))
|
||||
return false;
|
||||
|
||||
if (!file.readValue(pp.rx()))
|
||||
return false;
|
||||
if (!file.readValue(pp.ry()))
|
||||
return false;
|
||||
if (!file.readValue(pz))
|
||||
return false;
|
||||
|
||||
ReferencePoint p;
|
||||
p.xy = xy.toPoint();
|
||||
p.pp = pp;
|
||||
points.append(p);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::readMatrix(TIFFFile &file, quint32 offset, double matrix[16]) const
|
||||
{
|
||||
if (!file.seek(offset))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
if (!file.readValue(matrix[i]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::readKeys(TIFFFile &file, Ctx &ctx, QMap<quint16, Value> &kv) const
|
||||
{
|
||||
Header header;
|
||||
KeyEntry entry;
|
||||
Value value;
|
||||
|
||||
if (!file.seek(ctx.keys))
|
||||
return false;
|
||||
|
||||
if (!file.readValue(header.KeyDirectoryVersion))
|
||||
return false;
|
||||
if (!file.readValue(header.KeyRevision))
|
||||
return false;
|
||||
if (!file.readValue(header.MinorRevision))
|
||||
return false;
|
||||
if (!file.readValue(header.NumberOfKeys))
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < header.NumberOfKeys; i++) {
|
||||
if (!file.readValue(entry.KeyID))
|
||||
return false;
|
||||
if (!file.readValue(entry.TIFFTagLocation))
|
||||
return false;
|
||||
if (!file.readValue(entry.Count))
|
||||
return false;
|
||||
if (!file.readValue(entry.ValueOffset))
|
||||
return false;
|
||||
|
||||
switch (entry.KeyID) {
|
||||
case GTModelTypeGeoKey:
|
||||
case GTRasterTypeGeoKey:
|
||||
case GeographicTypeGeoKey:
|
||||
case GeogGeodeticDatumGeoKey:
|
||||
case GeogPrimeMeridianGeoKey:
|
||||
case GeogAngularUnitsGeoKey:
|
||||
case ProjectedCSTypeGeoKey:
|
||||
case ProjectionGeoKey:
|
||||
case ProjCoordTransGeoKey:
|
||||
case ProjLinearUnitsGeoKey:
|
||||
if (entry.TIFFTagLocation != 0 || entry.Count != 1)
|
||||
return false;
|
||||
value.SHORT = entry.ValueOffset;
|
||||
kv.insert(entry.KeyID, value);
|
||||
break;
|
||||
case ProjScaleAtNatOriginGeoKey:
|
||||
case ProjNatOriginLongGeoKey:
|
||||
case ProjNatOriginLatGeoKey:
|
||||
case ProjFalseEastingGeoKey:
|
||||
case ProjFalseNorthingGeoKey:
|
||||
case ProjStdParallel1GeoKey:
|
||||
case ProjStdParallel2GeoKey:
|
||||
if (!readGeoValue(file, ctx.values, entry.ValueOffset,
|
||||
value.DOUBLE))
|
||||
return false;
|
||||
kv.insert(entry.KeyID, value);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::readGeoValue(TIFFFile &file, quint32 offset, quint16 index,
|
||||
double &val) const
|
||||
{
|
||||
qint64 pos = file.pos();
|
||||
|
||||
if (!file.seek(offset + index * sizeof(double)))
|
||||
return false;
|
||||
if (!file.readValue(val))
|
||||
return false;
|
||||
|
||||
if (!file.seek(pos))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const GCS *GeoTIFF::gcs(QMap<quint16, Value> &kv)
|
||||
{
|
||||
const GCS *gcs = 0;
|
||||
|
||||
if (IS_SET(kv, GeographicTypeGeoKey)) {
|
||||
if (!(gcs = GCS::gcs(kv.value(GeographicTypeGeoKey).SHORT)))
|
||||
_errorString = QString("%1: unknown GCS")
|
||||
.arg(kv.value(GeographicTypeGeoKey).SHORT);
|
||||
} else if (IS_SET(kv, GeogGeodeticDatumGeoKey)) {
|
||||
int pm = IS_SET(kv, GeogPrimeMeridianGeoKey)
|
||||
? kv.value(GeogPrimeMeridianGeoKey).SHORT : 8901;
|
||||
int au = IS_SET(kv, GeogAngularUnitsGeoKey)
|
||||
? kv.value(GeogAngularUnitsGeoKey).SHORT : 9102;
|
||||
|
||||
if (!(gcs = GCS::gcs(kv.value(GeogGeodeticDatumGeoKey).SHORT, pm, au)))
|
||||
_errorString = QString("%1+%2: unknown geodetic datum + prime"
|
||||
" meridian combination")
|
||||
.arg(kv.value(GeogGeodeticDatumGeoKey).SHORT)
|
||||
.arg(kv.value(GeogPrimeMeridianGeoKey).SHORT);
|
||||
} else
|
||||
_errorString = "Can not determine GCS";
|
||||
|
||||
return gcs;
|
||||
}
|
||||
|
||||
Projection::Method GeoTIFF::method(QMap<quint16, Value> &kv)
|
||||
{
|
||||
if (!IS_SET(kv, ProjCoordTransGeoKey)) {
|
||||
_errorString = "Missing coordinate transformation method";
|
||||
return Projection::Method();
|
||||
}
|
||||
|
||||
switch (kv.value(ProjCoordTransGeoKey).SHORT) {
|
||||
case 1:
|
||||
return Projection::Method(9807);
|
||||
case 7:
|
||||
return Projection::Method(1024);
|
||||
case 8:
|
||||
return Projection::Method(9801);
|
||||
case 9:
|
||||
return Projection::Method(9802);
|
||||
case 10:
|
||||
return Projection::Method(9820);
|
||||
case 11:
|
||||
return Projection::Method(9822);
|
||||
default:
|
||||
_errorString = QString("%1: unknown coordinate transformation method")
|
||||
.arg(kv.value(ProjCoordTransGeoKey).SHORT);
|
||||
return Projection::Method();
|
||||
}
|
||||
}
|
||||
|
||||
bool GeoTIFF::projectedModel(QMap<quint16, Value> &kv)
|
||||
{
|
||||
if (IS_SET(kv, ProjectedCSTypeGeoKey)) {
|
||||
const PCS *pcs;
|
||||
if (!(pcs = PCS::pcs(kv.value(ProjectedCSTypeGeoKey).SHORT))) {
|
||||
_errorString = QString("%1: unknown PCS")
|
||||
.arg(kv.value(ProjectedCSTypeGeoKey).SHORT);
|
||||
return false;
|
||||
}
|
||||
_projection = Projection(pcs->gcs(), pcs->method(), pcs->setup(),
|
||||
pcs->units());
|
||||
} else if (IS_SET(kv, ProjectionGeoKey)) {
|
||||
const GCS *g = gcs(kv);
|
||||
if (!g)
|
||||
return false;
|
||||
const PCS *pcs = PCS::pcs(g, kv.value(ProjectionGeoKey).SHORT);
|
||||
if (!pcs) {
|
||||
_errorString = QString("%1: unknown projection code")
|
||||
.arg(kv.value(GeographicTypeGeoKey).SHORT)
|
||||
.arg(kv.value(ProjectionGeoKey).SHORT);
|
||||
return false;
|
||||
}
|
||||
_projection = Projection(pcs->gcs(), pcs->method(), pcs->setup(),
|
||||
pcs->units());
|
||||
} else {
|
||||
const GCS *g = gcs(kv);
|
||||
if (!g)
|
||||
return false;
|
||||
Projection::Method m(method(kv));
|
||||
if (m.isNull())
|
||||
return false;
|
||||
|
||||
AngularUnits au(IS_SET(kv, GeogAngularUnitsGeoKey)
|
||||
? kv.value(GeogAngularUnitsGeoKey).SHORT : 9102);
|
||||
LinearUnits lu(IS_SET(kv, ProjLinearUnitsGeoKey)
|
||||
? kv.value(ProjLinearUnitsGeoKey).SHORT : 9001);
|
||||
if (lu.isNull()) {
|
||||
_errorString = QString("%1: unknown projection linear units code")
|
||||
.arg(kv.value(ProjLinearUnitsGeoKey).SHORT);
|
||||
return false;
|
||||
}
|
||||
|
||||
Projection::Setup setup(
|
||||
au.toDegrees(kv.value(ProjNatOriginLatGeoKey).DOUBLE),
|
||||
au.toDegrees(kv.value(ProjNatOriginLongGeoKey).DOUBLE),
|
||||
kv.value(ProjScaleAtNatOriginGeoKey).DOUBLE,
|
||||
lu.toMeters(kv.value(ProjFalseEastingGeoKey).DOUBLE),
|
||||
lu.toMeters(kv.value(ProjFalseNorthingGeoKey).DOUBLE),
|
||||
au.toDegrees(kv.value(ProjStdParallel1GeoKey).DOUBLE),
|
||||
au.toDegrees(kv.value(ProjStdParallel2GeoKey).DOUBLE)
|
||||
);
|
||||
|
||||
_projection = Projection(g, m, setup, lu);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::geographicModel(QMap<quint16, Value> &kv)
|
||||
{
|
||||
const GCS *g = gcs(kv);
|
||||
if (!g)
|
||||
return false;
|
||||
|
||||
_projection = Projection(g);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoTIFF::load(const QString &path)
|
||||
{
|
||||
quint32 ifd;
|
||||
QList<ReferencePoint> points;
|
||||
QPointF scale;
|
||||
QMap<quint16, Value> kv;
|
||||
Ctx ctx;
|
||||
TIFFFile file;
|
||||
|
||||
|
||||
file.setFileName(path);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = QString("Error opening TIFF file: %1")
|
||||
.arg(file.errorString());
|
||||
return false;
|
||||
}
|
||||
if (!file.readHeader(ifd)) {
|
||||
_errorString = "Invalid TIFF header";
|
||||
return false;
|
||||
}
|
||||
|
||||
while (ifd) {
|
||||
if (!readIFD(file, ifd, ctx)) {
|
||||
_errorString = "Invalid IFD";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ctx.keys) {
|
||||
_errorString = "Not a GeoTIFF file";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ctx.scale) {
|
||||
if (!readScale(file, ctx.scale, scale)) {
|
||||
_errorString = "Error reading model pixel scale";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (ctx.tiepoints) {
|
||||
if (!readTiepoints(file, ctx.tiepoints, ctx.tiepointCount, points)) {
|
||||
_errorString = "Error reading raster->model tiepoint pairs";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!readKeys(file, ctx, kv)) {
|
||||
_errorString = "Error reading Geo key/value";
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (kv.value(GTModelTypeGeoKey).SHORT) {
|
||||
case ModelTypeProjected:
|
||||
if (!projectedModel(kv))
|
||||
return false;
|
||||
break;
|
||||
case ModelTypeGeographic:
|
||||
if (!geographicModel(kv))
|
||||
return false;
|
||||
break;
|
||||
case ModelTypeGeocentric:
|
||||
_errorString = "Geocentric models are not supported";
|
||||
return false;
|
||||
default:
|
||||
_errorString = "Unknown/missing model type";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ctx.scale && ctx.tiepoints) {
|
||||
const ReferencePoint &p = points.first();
|
||||
_transform = QTransform(scale.x(), 0, 0, -scale.y(), p.pp.x() - p.xy.x()
|
||||
/ scale.x(), p.pp.y() + p.xy.x() / scale.y()).inverted();
|
||||
} else if (ctx.tiepointCount > 1) {
|
||||
Transform t(points);
|
||||
if (t.isNull()) {
|
||||
_errorString = t.errorString();
|
||||
return false;
|
||||
}
|
||||
_transform = t.transform();
|
||||
} else if (ctx.matrix) {
|
||||
double m[16];
|
||||
if (!readMatrix(file, ctx.matrix, m)) {
|
||||
_errorString = "Error reading transformation matrix";
|
||||
return false;
|
||||
}
|
||||
if (m[2] != 0.0 || m[6] != 0.0 || m[8] != 0.0 || m[9] != 0.0
|
||||
|| m[10] != 0.0 || m[11] != 0.0) {
|
||||
_errorString = "Not a baseline transformation matrix";
|
||||
}
|
||||
_transform = QTransform(m[0], m[1], m[4], m[5], m[3], m[7]).inverted();
|
||||
} else {
|
||||
_errorString = "Incomplete/missing model transformation info";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
61
src/map/geotiff.h
Normal file
61
src/map/geotiff.h
Normal file
@ -0,0 +1,61 @@
|
||||
#ifndef GEOTIFF_H
|
||||
#define GEOTIFF_H
|
||||
|
||||
#include <QTransform>
|
||||
#include <QFile>
|
||||
#include <QMap>
|
||||
#include "gcs.h"
|
||||
#include "projection.h"
|
||||
#include "tifffile.h"
|
||||
#include "transform.h"
|
||||
#include "linearunits.h"
|
||||
|
||||
class GeoTIFF
|
||||
{
|
||||
public:
|
||||
bool load(const QString &path);
|
||||
const QString &errorString() const {return _errorString;}
|
||||
|
||||
const Projection &projection() const {return _projection;}
|
||||
const QTransform &transform() const {return _transform;}
|
||||
|
||||
private:
|
||||
union Value {
|
||||
quint16 SHORT;
|
||||
double DOUBLE;
|
||||
};
|
||||
|
||||
struct Ctx {
|
||||
quint32 scale;
|
||||
quint32 tiepoints;
|
||||
quint32 tiepointCount;
|
||||
quint32 matrix;
|
||||
quint32 keys;
|
||||
quint32 values;
|
||||
|
||||
Ctx() : scale(0), tiepoints(0), tiepointCount(0), matrix(0), keys(0),
|
||||
values(0) {}
|
||||
};
|
||||
|
||||
bool readEntry(TIFFFile &file, Ctx &ctx) const;
|
||||
bool readIFD(TIFFFile &file, quint32 &offset, Ctx &ctx) const;
|
||||
bool readScale(TIFFFile &file, quint32 offset, QPointF &scale) const;
|
||||
bool readTiepoints(TIFFFile &file, quint32 offset, quint32 count,
|
||||
QList<ReferencePoint> &points) const;
|
||||
bool readMatrix(TIFFFile &file, quint32 offset, double matrix[16]) const;
|
||||
bool readKeys(TIFFFile &file, Ctx &ctx, QMap<quint16, Value> &kv) const;
|
||||
bool readGeoValue(TIFFFile &file, quint32 offset, quint16 index,
|
||||
double &val) const;
|
||||
|
||||
const GCS *gcs(QMap<quint16, Value> &kv);
|
||||
Projection::Method method(QMap<quint16, Value> &kv);
|
||||
bool geographicModel(QMap<quint16, Value> &kv);
|
||||
bool projectedModel(QMap<quint16, Value> &kv);
|
||||
|
||||
QTransform _transform;
|
||||
Projection _projection;
|
||||
|
||||
QString _errorString;
|
||||
};
|
||||
|
||||
#endif // GEOTIFF_H
|
@ -48,19 +48,19 @@ Defense.
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#endif // M_PI_2
|
||||
|
||||
LambertAzimuthal::LambertAzimuthal(const Ellipsoid &ellipsoid,
|
||||
LambertAzimuthal::LambertAzimuthal(const Ellipsoid *ellipsoid,
|
||||
double latitudeOrigin, double longitudeOrigin, double falseEasting,
|
||||
double falseNorthing)
|
||||
{
|
||||
double es2, es4, es6;
|
||||
|
||||
_e = ellipsoid;
|
||||
es2 = 2 * _e.flattening() - _e.flattening() * _e.flattening();
|
||||
es2 = 2 * ellipsoid->flattening() - ellipsoid->flattening()
|
||||
* ellipsoid->flattening();
|
||||
|
||||
es4 = es2 * es2;
|
||||
es6 = es4 * es2;
|
||||
_ra = _e.radius() * (1.0 - es2 / 6.0 - 17.0 * es4 / 360.0 - 67.0 * es6
|
||||
/ 3024.0);
|
||||
_ra = ellipsoid->radius() * (1.0 - es2 / 6.0 - 17.0 * es4 / 360.0 - 67.0
|
||||
* es6 / 3024.0);
|
||||
_latOrigin = deg2rad(latitudeOrigin);
|
||||
_sinLatOrigin = sin(_latOrigin);
|
||||
_cosLatOrigin = cos(_latOrigin);
|
||||
|
@ -2,20 +2,20 @@
|
||||
#define LAMBERTAZIMUTHAL_H
|
||||
|
||||
#include "ellipsoid.h"
|
||||
#include "projection.h"
|
||||
#include "ct.h"
|
||||
|
||||
class LambertAzimuthal : public Projection
|
||||
class LambertAzimuthal : public CT
|
||||
{
|
||||
public:
|
||||
LambertAzimuthal(const Ellipsoid &ellipsoid, double latitudeOrigin,
|
||||
LambertAzimuthal(const Ellipsoid *ellipsoid, double latitudeOrigin,
|
||||
double longitudeOrigin, double falseEasting, double falseNorthing);
|
||||
|
||||
virtual CT *clone() const {return new LambertAzimuthal(*this);}
|
||||
|
||||
virtual QPointF ll2xy(const Coordinates &c) const;
|
||||
virtual Coordinates xy2ll(const QPointF &p) const;
|
||||
|
||||
private:
|
||||
Ellipsoid _e;
|
||||
|
||||
double _ra;
|
||||
double _sinLatOrigin;
|
||||
double _cosLatOrigin;
|
||||
|
@ -1,3 +1,46 @@
|
||||
/*
|
||||
* 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 <cmath>
|
||||
#include "lambertconic.h"
|
||||
|
||||
@ -5,76 +48,229 @@
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#endif // M_PI_2
|
||||
#ifndef M_PI_4
|
||||
#define M_PI_4 0.78539816339744830962
|
||||
#endif // M_PI_4
|
||||
#define M_PI_4 0.785398163397448309616
|
||||
#endif /* M_PI_4 */
|
||||
|
||||
static double q(const Ellipsoid &el, double b)
|
||||
#define LAMBERT_m(clat, essin) (clat / sqrt(1.0 - essin * essin))
|
||||
#define LAMBERT2_t(lat, essin, es_over_2) \
|
||||
(tan(M_PI_4 - lat / 2) * pow((1.0 + essin) / (1.0 - essin), es_over_2))
|
||||
#define LAMBERT1_t(lat, essin, es_over_2) \
|
||||
(tan(M_PI_4 - lat / 2) / pow((1.0 - essin) / (1.0 + essin), es_over_2))
|
||||
|
||||
|
||||
LambertConic1::LambertConic1(const Ellipsoid *ellipsoid, double latitudeOrigin,
|
||||
double longitudeOrigin, double scale, double falseEasting,
|
||||
double falseNorthing)
|
||||
{
|
||||
double e = sqrt(el.flattening() * (2. - el.flattening()));
|
||||
double esb = e * sin(b);
|
||||
return log(tan(M_PI_4 + b / 2.) * pow((1. - esb) / (1. + esb), e / 2.));
|
||||
double es2;
|
||||
double es_sin;
|
||||
double m0;
|
||||
double lat_orig;
|
||||
|
||||
|
||||
lat_orig = deg2rad(latitudeOrigin);
|
||||
_longitudeOrigin = deg2rad(longitudeOrigin);
|
||||
if (_longitudeOrigin > M_PI)
|
||||
_longitudeOrigin -= 2 * M_PI;
|
||||
|
||||
_falseEasting = falseEasting;
|
||||
_falseNorthing = falseNorthing;
|
||||
|
||||
es2 = 2.0 * ellipsoid->flattening() - ellipsoid->flattening()
|
||||
* ellipsoid->flattening();
|
||||
_es = sqrt(es2);
|
||||
_es_over_2 = _es / 2.0;
|
||||
|
||||
_n = sin(lat_orig);
|
||||
|
||||
es_sin = _es * sin(lat_orig);
|
||||
m0 = LAMBERT_m(cos(lat_orig), es_sin);
|
||||
_t0 = LAMBERT1_t(lat_orig, es_sin, _es_over_2);
|
||||
|
||||
_rho0 = ellipsoid->radius() * scale * m0 / _n;
|
||||
|
||||
_rho_olat = _rho0;
|
||||
}
|
||||
|
||||
static double iq(const Ellipsoid &el, double q)
|
||||
QPointF LambertConic1::ll2xy(const Coordinates &c) const
|
||||
{
|
||||
double e = sqrt(el.flattening() * (2. - el.flattening()));
|
||||
double b0 = 0.;
|
||||
double b = 2. * atan(exp(q)) - M_PI_2;
|
||||
double t;
|
||||
double rho;
|
||||
double dlam;
|
||||
double theta;
|
||||
double lat = deg2rad(c.lat());
|
||||
|
||||
do {
|
||||
b0 = b;
|
||||
double esb = e * sin(b);
|
||||
b = 2. * atan(exp(q) * pow((1. - esb) / (1. + esb), -e / 2.)) - M_PI_2;
|
||||
} while (fabs(b - b0) > 1e-10);
|
||||
|
||||
return b;
|
||||
if (fabs(fabs(lat) - M_PI_2) > 1.0e-10) {
|
||||
t = LAMBERT1_t(lat, _es * sin(lat), _es_over_2);
|
||||
rho = _rho0 * pow(t / _t0, _n);
|
||||
} else
|
||||
rho = 0.0;
|
||||
|
||||
dlam = deg2rad(c.lon()) - _longitudeOrigin;
|
||||
|
||||
if (dlam > M_PI)
|
||||
dlam -= 2 * M_PI;
|
||||
if (dlam < -M_PI)
|
||||
dlam += 2 * M_PI;
|
||||
|
||||
theta = _n * dlam;
|
||||
|
||||
return QPointF(rho * sin(theta) + _falseEasting, _rho_olat - rho
|
||||
* cos(theta) + _falseNorthing);
|
||||
}
|
||||
|
||||
static double nradius(const Ellipsoid &el, double phi)
|
||||
Coordinates LambertConic1::xy2ll(const QPointF &p) const
|
||||
{
|
||||
double sin_phi = sin(phi);
|
||||
return (el.radius() / sqrt(1. - (el.flattening() * (2. - el.flattening()))
|
||||
* sin_phi * sin_phi));
|
||||
double dx;
|
||||
double dy;
|
||||
double rho;
|
||||
double rho_olat_minus_dy;
|
||||
double t;
|
||||
double PHI;
|
||||
double es_sin;
|
||||
double tempPHI = 0.0;
|
||||
double theta = 0.0;
|
||||
double tolerance = 4.85e-10;
|
||||
int count = 30;
|
||||
double lat, lon;
|
||||
|
||||
|
||||
dy = p.y() - _falseNorthing;
|
||||
dx = p.x() - _falseEasting;
|
||||
rho_olat_minus_dy = _rho_olat - dy;
|
||||
rho = sqrt(dx * dx + (rho_olat_minus_dy) * (rho_olat_minus_dy));
|
||||
|
||||
if (_n < 0.0) {
|
||||
rho *= -1.0;
|
||||
dx *= -1.0;
|
||||
rho_olat_minus_dy *= -1.0;
|
||||
}
|
||||
|
||||
if (rho != 0.0) {
|
||||
theta = atan2(dx, rho_olat_minus_dy) / _n;
|
||||
t = _t0 * pow(rho / _rho0, 1 / _n);
|
||||
PHI = M_PI_2 - 2.0 * atan(t);
|
||||
while (fabs(PHI - tempPHI) > tolerance && count) {
|
||||
tempPHI = PHI;
|
||||
es_sin = _es * sin(PHI);
|
||||
PHI = M_PI_2 - 2.0 * atan(t * pow((1.0 - es_sin) / (1.0 + es_sin),
|
||||
_es_over_2));
|
||||
count--;
|
||||
}
|
||||
|
||||
if (!count)
|
||||
return Coordinates();
|
||||
|
||||
lat = PHI;
|
||||
lon = theta + _longitudeOrigin;
|
||||
|
||||
if (fabs(lat) < 2.0e-7)
|
||||
lat = 0.0;
|
||||
if (lat > M_PI_2)
|
||||
lat = M_PI_2;
|
||||
else if (lat < -M_PI_2)
|
||||
lat = -M_PI_2;
|
||||
|
||||
if (lon > M_PI) {
|
||||
if (lon - M_PI < 3.5e-6)
|
||||
lon = M_PI;
|
||||
else
|
||||
lon -= 2 * M_PI;
|
||||
}
|
||||
if (lon < -M_PI) {
|
||||
if (fabs(lon + M_PI) < 3.5e-6)
|
||||
lon = -M_PI;
|
||||
else
|
||||
lon += 2 * M_PI;
|
||||
}
|
||||
|
||||
if (fabs(lon) < 2.0e-7)
|
||||
lon = 0.0;
|
||||
if (lon > M_PI)
|
||||
lon = M_PI;
|
||||
else if (lon < -M_PI)
|
||||
lon = -M_PI;
|
||||
} else {
|
||||
if (_n > 0.0)
|
||||
lat = M_PI_2;
|
||||
else
|
||||
lat = -M_PI_2;
|
||||
lon = _longitudeOrigin;
|
||||
}
|
||||
|
||||
return Coordinates(rad2deg(lon), rad2deg(lat));
|
||||
}
|
||||
|
||||
LambertConic::LambertConic(const Ellipsoid &ellipsoid, double standardParallel1,
|
||||
double standardParallel2, double latitudeOrigin, double longitudeOrigin,
|
||||
double scale, double falseEasting, double falseNorthing) : _e(ellipsoid)
|
||||
LambertConic2::LambertConic2(const Ellipsoid *ellipsoid,
|
||||
double standardParallel1, double standardParallel2, double latitudeOrigin,
|
||||
double longitudeOrigin, double falseEasting, double falseNorthing)
|
||||
{
|
||||
_cm = deg2rad(longitudeOrigin);
|
||||
_fe = falseEasting;
|
||||
_fn = falseNorthing;
|
||||
double es, es_over_2, es2, es_sin;
|
||||
double lat0;
|
||||
double k0;
|
||||
double t0;
|
||||
double t1, t2;
|
||||
double t_olat;
|
||||
double m0;
|
||||
double m1;
|
||||
double m2;
|
||||
double n;
|
||||
double const_value;
|
||||
double sp1, sp2;
|
||||
double lat_orig;
|
||||
|
||||
double sp1 = deg2rad(standardParallel1);
|
||||
double sp2 = deg2rad(standardParallel2);
|
||||
|
||||
double N1 = nradius(_e, sp1);
|
||||
double N2 = nradius(_e, sp2);
|
||||
lat_orig = deg2rad(latitudeOrigin);
|
||||
sp1 = deg2rad(standardParallel1);
|
||||
sp2 = deg2rad(standardParallel2);
|
||||
|
||||
_q0 = q(_e, deg2rad(latitudeOrigin));
|
||||
double q1 = q(_e, sp1);
|
||||
double q2 = q(_e, sp2);
|
||||
if (fabs(sp1 - sp2) > 1.0e-10) {
|
||||
es2 = 2 * ellipsoid->flattening() - ellipsoid->flattening()
|
||||
* ellipsoid->flattening();
|
||||
es = sqrt(es2);
|
||||
es_over_2 = es / 2.0;
|
||||
|
||||
_n = log((N1 * cos(sp1)) / (N2 * cos(sp2))) / (q2 - q1);
|
||||
double R1 = N1 * cos(sp1) / _n;
|
||||
_R0 = scale * R1 * exp(_n * (q1 - _q0));
|
||||
es_sin = es * sin(lat_orig);
|
||||
t_olat = LAMBERT2_t(lat_orig, es_sin, es_over_2);
|
||||
|
||||
es_sin = es * sin(sp1);
|
||||
m1 = LAMBERT_m(cos(sp1), es_sin);
|
||||
t1 = LAMBERT2_t(sp1, es_sin, es_over_2);
|
||||
|
||||
es_sin = es * sin(sp2);
|
||||
m2 = LAMBERT_m(cos(sp2), es_sin);
|
||||
t2 = LAMBERT2_t(sp2, es_sin, es_over_2);
|
||||
|
||||
n = log(m1 / m2) / log(t1 / t2);
|
||||
|
||||
lat0 = asin(n);
|
||||
|
||||
es_sin = es * sin(lat0);
|
||||
m0 = LAMBERT_m(cos(lat0), es_sin);
|
||||
t0 = LAMBERT2_t(lat0, es_sin, es_over_2);
|
||||
|
||||
k0 = (m1 / m0) * (pow(t0 / t1, n));
|
||||
|
||||
const_value = ((ellipsoid->radius() * m2) / (n * pow(t2, n)));
|
||||
|
||||
falseNorthing += (const_value * pow(t_olat, n)) - (const_value
|
||||
* pow(t0, n));
|
||||
} else {
|
||||
lat0 = sp1;
|
||||
k0 = 1.0;
|
||||
}
|
||||
|
||||
_lc1 = LambertConic1(ellipsoid, rad2deg(lat0), longitudeOrigin, k0,
|
||||
falseEasting, falseNorthing);
|
||||
}
|
||||
|
||||
QPointF LambertConic::ll2xy(const Coordinates &c) const
|
||||
QPointF LambertConic2::ll2xy(const Coordinates &c) const
|
||||
{
|
||||
double dl = _n * (deg2rad(c.lon()) - _cm);
|
||||
double R = _R0 * exp(_n * (_q0 - q(_e, deg2rad(c.lat()))));
|
||||
|
||||
return QPointF(_fe + R * sin(dl), _fn + _R0 - R * cos(dl));
|
||||
return _lc1.ll2xy(c);
|
||||
}
|
||||
|
||||
Coordinates LambertConic::xy2ll(const QPointF &p) const
|
||||
Coordinates LambertConic2::xy2ll(const QPointF &p) const
|
||||
{
|
||||
double dl = atan((p.x() - _fe) / (_fn + _R0 - p.y()));
|
||||
double dx = p.x() - _fe;
|
||||
double dy = p.y() - _fn - _R0;
|
||||
double R = sqrt(dx * dx + dy * dy);
|
||||
double q = _q0 - log(fabs(R / _R0)) / _n;
|
||||
|
||||
return Coordinates(rad2deg(_cm + dl / _n), rad2deg(iq(_e, q)));
|
||||
return _lc1.xy2ll(p);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user