1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-30 21:09:15 +02:00

Compare commits

...

56 Commits

Author SHA1 Message Date
1480f8ad02 Cosmetics 2023-02-10 00:17:07 +01:00
b73ad9772f Fixed broken waypoint settings 2023-02-10 00:16:16 +01:00
e6bc548524 Merge remote-tracking branch 'weblate/master' 2023-02-09 00:37:04 +01:00
0d71e34665 Translated using Weblate (Danish)
Currently translated at 100.0% (466 of 466 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/da/
2023-02-09 00:36:28 +01:00
f575e79a70 Merge remote-tracking branch 'weblate/master' 2023-02-09 00:35:58 +01:00
903b73d9a4 Set OpenStreetMap as the default map 2023-02-09 00:35:22 +01:00
42f2f3377b Merge branch 'origin/master' into Weblate. 2023-02-07 23:13:13 +01:00
3b798e627b Be much more greedy when promoting the supported file types
File association on Android is broken by design resulting in two options:
1) associate almost everything
2) associate only some extensions which does not work most of the time

Lets choose #1
2023-02-07 23:09:10 +01:00
be5291a6c6 Merge branch 'origin/master' into Weblate. 2023-02-07 00:32:51 +01:00
7bb2c3a09d Added Android "desktop" integration 2023-02-07 00:32:36 +01:00
5467b55ff2 Translated using Weblate (Finnish)
Currently translated at 97.4% (454 of 466 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2023-02-06 00:41:05 +01:00
820350d60b Fixed Android build 2023-02-05 00:06:02 +01:00
3801ff7bcb Settings refactoring 2023-02-04 23:59:47 +01:00
3b6e6c03a7 Fix the module name 2023-02-01 22:57:41 +01:00
a1a6fade92 Update the CI configurations to fetch the Qt serialport module 2023-02-01 22:54:59 +01:00
c001235e91 Code cleanup 2023-02-01 22:49:03 +01:00
c01b9da10c Version++
As we require the serialport Qt plugin now, increase the major number.
2023-02-01 22:41:57 +01:00
e4d42453a0 Require the serialport Qt module
The serialport module is a dependency of the nmea positioning plugin. Without
being explicitly specified, the Qt deploy tools skip the nmea positioning plugin
when creating the application package.
2023-02-01 22:36:41 +01:00
d6d316676c Properly use the default positioning plugin as the default option 2023-02-01 22:26:36 +01:00
973abedf3e A better current path macro 2023-02-01 09:41:18 +01:00
505f01a990 Code cleanup 2023-01-31 19:21:14 +01:00
78b091fbbc Fixed license info 2023-01-31 19:20:30 +01:00
80ec7f624e Moved maps and csv from pkg to data 2023-01-26 01:51:46 +01:00
bfeb6d266e Some more iso8211 code cleanup 2023-01-26 01:13:15 +01:00
af3e5d41c2 Split the config header to config+hash headers 2023-01-26 01:11:56 +01:00
51511a9bf9 Fixed broken parsing of KML tracks with empty coordinates 2023-01-25 09:01:20 +01:00
2549204662 Use CFBundleLocalizations instead of lproj directories 2023-01-24 23:01:40 +01:00
b826c856fc Extended Info.plist with some more bundle info 2023-01-24 09:19:13 +01:00
1afe74242a Properly handle locales with sub-languages 2023-01-24 08:33:48 +01:00
b43412b135 Added Korean localization 2023-01-23 23:48:00 +01:00
bbad4eb8d9 Merge branch 'origin/master' into Weblate. 2023-01-23 23:10:54 +01:00
f6c128fbf6 Create localization lproj directories on OS X
+ pkg dir structure cleanup
2023-01-23 23:11:05 +01:00
b955c4d45e Translated using Weblate (Korean)
Currently translated at 100.0% (440 of 440 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ko/
2023-01-23 15:50:01 +01:00
e26a776576 Translated using Weblate (Esperanto)
Currently translated at 93.1% (434 of 466 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/eo/
2023-01-23 15:49:59 +01:00
52c4e97be5 Translated using Weblate (Russian)
Currently translated at 100.0% (466 of 466 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2023-01-23 15:49:59 +01:00
49bd2b9501 Translated using Weblate (Finnish)
Currently translated at 97.2% (453 of 466 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2023-01-23 15:49:59 +01:00
ab76521990 ISO8211 API cleanup 2023-01-19 10:08:17 +01:00
ee73908231 Do not treat Ozimaps as directories
Directory parsing was stopped at the level of the map which is not what we
want - users would have to create separate directories for every Ozimap.
2023-01-19 10:04:03 +01:00
3af98b6785 Fixed typo 2023-01-16 21:16:20 +01:00
05657ccdce Version++ 2023-01-15 10:10:48 +01:00
a698aa96cd Trying to fix the Android CI build...
no. 5
2023-01-14 15:20:40 +01:00
a7fef63461 Trying to fix the Android CI build...
no. 4
2023-01-14 15:08:58 +01:00
83217d31a7 Trying to fix the Android CI build...
no. 3
2023-01-14 14:46:45 +01:00
4191f5414f Trying to fix the Android CI build...
no. 2
2023-01-14 14:20:04 +01:00
bf81994aa0 Trying to fix the Android CI build... 2023-01-14 14:00:43 +01:00
21c02010f7 Improved marine charts render style 2023-01-14 13:00:36 +01:00
c209e24db8 Optimization/code cleanup 2023-01-14 08:45:18 +01:00
9ff7ecea97 ENC signal stations 2023-01-11 23:03:54 +01:00
78e3c78197 Added safety zone lines 2023-01-09 23:58:03 +01:00
38cd871178 Cleanup 2023-01-05 22:13:26 +01:00
5594bf74b6 Run the CodeQL action manually only 2023-01-05 22:02:25 +01:00
65515143eb Added missing include guard prefix 2023-01-05 21:44:03 +01:00
29895420b6 Fixed broken temperature units translations 2023-01-01 16:54:44 +01:00
88f7e13500 Added alignment check 2022-12-23 08:35:59 +01:00
51335a0f84 Added missing build dependencies 2022-12-16 16:34:32 +01:00
077cc20934 Create codeql.yml 2022-12-16 16:23:59 +01:00
73 changed files with 1984 additions and 1780 deletions

View File

@ -1,4 +1,4 @@
version: 11.11.{build}
version: 12.0.{build}
configuration:
- Release
@ -28,9 +28,9 @@ build_script:
md installer
copy release\GPXSee.exe installer
windeployqt --release installer\GPXSee.exe
copy pkg\gpxsee64.nsi installer
xcopy pkg\csv installer\csv /i
xcopy pkg\maps installer\maps /i
copy pkg\windows\gpxsee64.nsi installer
xcopy data\csv installer\csv /i
xcopy data\maps installer\maps /i
xcopy lang\*.qm installer\translations\ /sy
xcopy icons\symbols installer\symbols /i
copy licence.txt installer

View File

@ -37,7 +37,7 @@ jobs:
version: '6.4.0'
target: 'android'
arch: 'android_armv7'
modules: qtpositioning qt5compat
modules: qtpositioning qt5compat qtserialport
- name: Install Android OpenSSL
run: git clone https://github.com/KDAB/android_openssl.git
- name: Create localization

45
.github/workflows/codeql.yml vendored Normal file
View File

@ -0,0 +1,45 @@
name: "CodeQL"
on: [workflow_dispatch]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'cpp' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qt5-qmake qttools5-dev-tools libqt5opengl5-dev qtpositioning5-dev libqt5svg5-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

View File

@ -15,7 +15,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qt5-qmake qttools5-dev-tools libqt5opengl5-dev qtpositioning5-dev libqt5svg5-dev
sudo apt-get install qtbase5-dev qtbase5-private-dev qtbase5-dev-tools qt5-qmake qttools5-dev-tools libqt5opengl5-dev qtpositioning5-dev libqt5svg5-dev libqt5serialport5-dev
- name: Create localization
run: lrelease gpxsee.pro
- name: Configure build

View File

@ -64,7 +64,7 @@ GPXSee is licensed under GPL-3.0 (only). However, some 3rd party parts are using
different, GPL compatible, licenses:
* [Oxygen icons](icons/GUI) - LGPLv3
* [Mapbox Maki icons](icons/map/IMG/POI) - CC0
* [Mapbox Maki icons](icons/map/POI) - CC0
* [Map Icons Collection](icons/symbols) - CC BY SA 3.0
* [RTree implementation](src/common/rtree.h) - Public domain
* [Albers](src/map/proj/albersequal.cpp), [Geocentric](src/map/geocentric.cpp),

View File

Can't render this file because it is too large.

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else {
TARGET = GPXSee
}
VERSION = 11.11
VERSION = 12.0
QT += core \
gui \
@ -14,7 +14,8 @@ QT += core \
widgets \
printsupport \
positioning \
svg
svg \
serialport
greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets \
core5compat
@ -29,6 +30,7 @@ HEADERS += src/common/config.h \
src/GUI/pluginparameters.h \
src/common/garmin.h \
src/common/coordinates.h \
src/common/hash.h \
src/common/linec.h \
src/common/range.h \
src/common/rectc.h \
@ -262,6 +264,7 @@ SOURCES += src/main.cpp \
src/GUI/motioninfoitem.cpp \
src/GUI/navigationwidget.cpp \
src/GUI/pluginparameters.cpp \
src/GUI/settings.cpp \
src/common/coordinates.cpp \
src/common/rectc.cpp \
src/common/range.cpp \
@ -472,23 +475,26 @@ TRANSLATIONS = lang/gpxsee_en.ts \
lang/gpxsee_it.ts \
lang/gpxsee_eo.ts \
lang/gpxsee_zh.ts \
lang/gpxsee_ca.ts
lang/gpxsee_ca.ts \
lang/gpxsee_ko.ts
macx {
ICON = icons/app/gpxsee.icns
QMAKE_INFO_PLIST = pkg/Info.plist
QMAKE_INFO_PLIST = pkg/mac/Info.plist
locale.path = Contents/Resources/translations
locale.files = $$files(lang/*.qm)
csv.path = Contents/Resources
csv.files = pkg/csv
csv.files = data/csv
maps.path = Contents/Resources
maps.files = pkg/maps
maps.files = data/maps
symbols.path = Contents/Resources/symbols
symbols.files = $$files(icons/symbols/*.png)
icons.path = Contents/Resources/icons
icons.files = $$files(icons/formats/*.icns)
lproj.path = Contents/Resources
lproj.files = $$files(pkg/mac/lproj/*)
QMAKE_BUNDLE_DATA += locale maps symbols icons csv
QMAKE_BUNDLE_DATA += locale maps symbols icons csv lproj
}
win32 {
@ -533,9 +539,9 @@ win32 {
unix:!macx:!android {
isEmpty(PREFIX):PREFIX = /usr/local
maps.files = $$files(pkg/maps/*)
maps.files = $$files(data/maps/*)
maps.path = $$PREFIX/share/gpxsee/maps
csv.files = $$files(pkg/csv/*)
csv.files = $$files(data/csv/*)
csv.path = $$PREFIX/share/gpxsee/csv
symbols.files = $$files(icons/symbols/*.png)
symbols.path = $$PREFIX/share/gpxsee/symbols
@ -543,12 +549,14 @@ unix:!macx:!android {
locale.path = $$PREFIX/share/gpxsee/translations
icon.files = $$files(icons/app/hicolor/*)
icon.path = $$PREFIX/share/icons/hicolor
desktop.files = pkg/gpxsee.desktop
desktop.files = pkg/linux/gpxsee.desktop
desktop.path = $$PREFIX/share/applications
mime.files = pkg/gpxsee.xml
mime.files = pkg/linux/gpxsee.xml
mime.path = $$PREFIX/share/mime/packages
appdata.files = pkg/linux/gpxsee.appdata.xml
appdata.path = $$PREFIX/share/metainfo
target.path = $$PREFIX/bin
INSTALLS += target maps csv symbols locale icon desktop mime
INSTALLS += target maps csv symbols locale icon desktop mime appdata
}
android {
@ -581,9 +589,9 @@ android {
pkg/android/build.gradle \
pkg/android/res/values/libs.xml
maps.files = $$files(pkg/maps/*)
maps.files = $$files(data/maps/*)
maps.path = /assets/maps
csv.files = $$files(pkg/csv/*)
csv.files = $$files(data/csv/*)
csv.path = /assets/csv
symbols.files = $$files(icons/symbols/*.png)
symbols.path = /assets/symbols

View File

@ -188,6 +188,7 @@
<file alias="silo.png">icons/map/marine/silo.png</file>
<file alias="turning-basin.png">icons/map/marine/turning-basin.png</file>
<file alias="entry-prohibited-line.png">icons/map/marine/entry-prohibited-line.png</file>
<file alias="safety-zone-line.png">icons/map/marine/safety-zone-line.png</file>
<file alias="cable-area-line.png">icons/map/marine/cable-area-line.png</file>
<file alias="pipeline-area-line.png">icons/map/marine/pipeline-area-line.png</file>
<file alias="windmotor.png">icons/map/marine/windmotor.png</file>
@ -203,7 +204,7 @@
<!-- Mapsforge rendertheme -->
<qresource prefix="/mapsforge">
<file alias="default.xml">data/default.xml</file>
<file alias="default.xml">data/mapsforge/default.xml</file>
<file alias="patterns/hills.svg">icons/map/mapsforge/patterns/hills.svg</file>
<file alias="patterns/farmland.svg">icons/map/mapsforge/patterns/farmland.svg</file>

View File

@ -1,4 +1,4 @@
The IMG style icons are Mapbox Maki icons (https://labs.mapbox.com/maki-icons/)
The POI icons are Mapbox Maki icons (https://labs.mapbox.com/maki-icons/)
licensed under CC0.
-----

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

File diff suppressed because it is too large Load Diff

View File

@ -556,7 +556,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="432"/>
<source>Use styles</source>
<translation type="unfinished"></translation>
<translation>Uzi stilojn</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="439"/>
@ -603,7 +603,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="482"/>
<source>Show tabs</source>
<translation type="unfinished"></translation>
<translation>Montri langetojn</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="491"/>
@ -1241,7 +1241,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="158"/>
<source>Electronic Navigational Charts</source>
<translation type="unfinished"></translation>
<translation>ENC-mapoj</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="165"/>

View File

@ -557,7 +557,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="432"/>
<source>Use styles</source>
<translation type="unfinished"></translation>
<translation>Käytä tyylejä</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="439"/>
@ -1246,7 +1246,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="158"/>
<source>Electronic Navigational Charts</source>
<translation type="unfinished"></translation>
<translation>ENC-merikartat</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="165"/>

View File

@ -2397,12 +2397,12 @@
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="111"/>
<source>C</source>
<translation>°C</translation>
<translation>C</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraph.cpp" line="115"/>
<source>F</source>
<translation>°F</translation>
<translation>F</translation>
</message>
</context>
<context>
@ -2410,12 +2410,12 @@
<message>
<location filename="../src/GUI/temperaturegraphitem.cpp" line="21"/>
<source>C</source>
<translation>°C</translation>
<translation>C</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraphitem.cpp" line="21"/>
<source>F</source>
<translation>°F</translation>
<translation>F</translation>
</message>
<message>
<location filename="../src/GUI/temperaturegraphitem.cpp" line="24"/>

File diff suppressed because it is too large Load Diff

View File

@ -557,7 +557,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="432"/>
<source>Use styles</source>
<translation type="unfinished"></translation>
<translation>Использовать стили</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="439"/>
@ -1247,7 +1247,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="158"/>
<source>Electronic Navigational Charts</source>
<translation type="unfinished"></translation>
<translation>Морские карты ENC</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="165"/>

View File

@ -4,11 +4,24 @@
<!-- %%INSERT_FEATURES -->
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:smallScreens="true"/>
<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:extractNativeLibs="true" android:hardwareAccelerated="true" android:label="-- %%INSERT_APP_NAME%% --" android:requestLegacyExternalStorage="true" android:allowNativeHeapPointerTagging="false" android:icon="@drawable/icon">
<activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
<activity android:name="org.gpxsee.gpxsee.Activity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="-- %%INSERT_APP_NAME%% --" android:launchMode="singleTop" android:screenOrientation="unspecified" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="content" android:mimeType="application/*"/>
<data android:scheme="content" android:mimeType="text/plain"/>
<data android:scheme="content" android:mimeType="text/xml"/>
<data android:scheme="content" android:mimeType="text/csv"/>
<data android:scheme="content" android:mimeType="image/jpeg"/>
<data android:scheme="content" android:mimeType="image/tiff"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.arguments" android:value="-- %%INSERT_APP_ARGUMENTS%% --"/>
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>

View File

@ -34,8 +34,10 @@ android {
* Changing them manually might break the compilation!
*******************************************************/
compileSdkVersion androidCompileSdkVersion.toInteger()
buildToolsVersion androidBuildToolsVersion
//compileSdkVersion androidCompileSdkVersion.toInteger()
compileSdkVersion 31
//buildToolsVersion androidBuildToolsVersion
buildToolsVersion '31.0.0'
ndkVersion androidNdkVersion
sourceSets {

View File

@ -1,14 +0,0 @@
# Project-wide Gradle settings.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2500m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# Enable building projects in parallel
org.gradle.parallel=true
# Gradle caching allows reusing the build artifacts from a previous
# build with the same inputs. However, over time, the cache size will
# grow. Uncomment the following line to enable it.
#org.gradle.caching=true

View File

@ -0,0 +1,26 @@
package org.gpxsee.gpxsee;
import android.content.Intent;
public class Activity extends org.qtproject.qt.android.bindings.QtActivity
{
@Override
public void onNewIntent(Intent intent)
{
setIntent(intent);
}
public String intentPath()
{
String path = "";
Intent intent = getIntent();
if (intent != null) {
if (intent.getAction() == Intent.ACTION_VIEW)
path = intent.getDataString();
setIntent(null);
}
return path;
}
}

View File

@ -2,8 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>GPXSee</string>
<key>CFBundleIconFile</key>
<string>@ICON@</string>
<key>CFBundlePackageType</key>
@ -16,6 +20,34 @@
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>org.gpxsee.GPXSee</string>
<key>CFBundleVersion</key>
<string>@FULL_VERSION@</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleLocalizations</key>
<array>
<string>ca</string>
<string>cs</string>
<string>da</string>
<string>de</string>
<string>en</string>
<string>eo</string>
<string>es</string>
<string>fi</string>
<string>fr</string>
<string>hu</string>
<string>it</string>
<string>ko</string>
<string>nb</string>
<string>pl</string>
<string>pt_BR</string>
<string>ru</string>
<string>sv</string>
<string>tr</string>
<string>uk</string>
<string>zh_CN</string>
</array>
<key>CFBundleDocumentTypes</key>
<array>

View File

@ -37,7 +37,7 @@ Unicode true
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "11.11"
!define VERSION "12.0"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"
@ -325,6 +325,7 @@ SectionGroup "Localization" SEC_LOCALIZATION
!insertmacro LOCALIZATION "German" "de"
!insertmacro LOCALIZATION "Hungarian" "hu"
!insertmacro LOCALIZATION "Italian" "it"
!insertmacro LOCALIZATION "Korean" "ko"
!insertmacro LOCALIZATION "Norwegian" "nb"
!insertmacro LOCALIZATION "Polish" "pl"
!insertmacro LOCALIZATION "Portuguese (Brazil)" "pt_BR"

View File

@ -6,6 +6,10 @@
#include <QNetworkAccessManager>
#include <QLibraryInfo>
#include <QSurfaceFormat>
#ifdef Q_OS_ANDROID
#include <QCoreApplication>
#include <QJniObject>
#endif // Q_OS_ANDROID
#include "common/programpaths.h"
#include "common/config.h"
#include "common/downloader.h"
@ -28,10 +32,10 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
#endif
setApplicationVersion(APP_VERSION);
QTranslator *gpxsee = new QTranslator(this);
if (gpxsee->load(QLocale::system(), "gpxsee", "_",
QTranslator *app = new QTranslator(this);
if (app->load(QLocale::system(), "gpxsee", "_",
ProgramPaths::translationsDir()))
installTranslator(gpxsee);
installTranslator(app);
QTranslator *qt = new QTranslator(this);
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
@ -102,6 +106,21 @@ void App::appStateChanged(Qt::ApplicationState state)
{
if (state == Qt::ApplicationSuspended)
_gui->writeSettings();
else if (state == Qt::ApplicationActive) {
QJniObject activity = QNativeInterface::QAndroidApplication::context();
QString path(activity.callObjectMethod<jstring>("intentPath").toString());
if (!path.isEmpty()) {
if (!_gui->openFile(path, true)) {
MapAction *a;
if (!_gui->loadMap(path, a, true))
_gui->openFile(path, false);
else {
if (a)
a->trigger();
}
}
}
}
}
#endif // Q_OS_ANDROID

View File

@ -6,7 +6,7 @@
CadenceGraph::CadenceGraph(QWidget *parent) : GraphTab(parent)
{
_showTracks = true;
_showTracks = false;
GraphView::setYUnits(tr("rpm"));
setYLabel(tr("Cadence"));

View File

@ -33,8 +33,8 @@ ElevationGraph::ElevationGraph(QWidget *parent) : GraphTab(parent)
_routeMin = NAN;
_routeMax = NAN;
_showRoutes = true;
_showTracks = true;
_showRoutes = false;
_showTracks = false;
setYUnits(Metric);
setYLabel(tr("Elevation"));

View File

@ -6,7 +6,7 @@
GearRatioGraph::GearRatioGraph(QWidget *parent) : GraphTab(parent)
{
_showTracks = true;
_showTracks = false;
GraphView::setYUnits("");
setYLabel(tr("Gear ratio"));

File diff suppressed because it is too large Load Diff

View File

@ -179,6 +179,9 @@ private:
void loadInitialMaps(const QString &selected);
void loadInitialPOIs(const QStringList &disabled);
void loadOptions();
void updateOptions(const Options &options);
#ifndef Q_OS_ANDROID
void keyPressEvent(QKeyEvent *event);
#endif // Q_OS_ANDROID
@ -224,7 +227,7 @@ private:
QAction *_showPositionAction;
QAction *_followPositionAction;
QAction *_showPositionCoordinatesAction;
QAction *_showMotionInfo;
QAction *_showMotionInfoAction;
QAction *_loadMapAction;
QAction *_loadMapDirAction;
QAction *_clearMapCacheAction;

View File

@ -6,7 +6,7 @@
HeartRateGraph::HeartRateGraph(QWidget *parent) : GraphTab(parent)
{
_showTracks = true;
_showTracks = false;
GraphView::setYUnits(tr("bpm"));
setYLabel(tr("Heart rate"));

View File

@ -35,8 +35,7 @@
#define COORDINATES_OFFSET SCALE_OFFSET
MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
QWidget *parent) : QGraphicsView(parent)
MapView::MapView(Map *map, POI *poi, QWidget *parent) : QGraphicsView(parent)
{
Q_ASSERT(map != 0);
Q_ASSERT(poi != 0);
@ -72,10 +71,7 @@ MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
_poi = poi;
connect(_poi, &POI::pointsChanged, this, &MapView::updatePOI);
_positionSource = source;
if (_positionSource)
connect(_positionSource, &QGeoPositionInfoSource::positionUpdated, this,
&MapView::updatePosition);
_positionSource = 0;
_crosshair = new CrosshairItem();
_crosshair->setZValue(2.0);
_crosshair->setVisible(false);
@ -95,19 +91,19 @@ MapView::MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
_backgroundColor = Qt::white;
_markerColor = Qt::red;
_showMap = true;
_showTracks = true;
_showRoutes = true;
_showAreas = true;
_showWaypoints = true;
_showWaypointLabels = true;
_showMap = false;
_showTracks = false;
_showRoutes = false;
_showAreas = false;
_showWaypoints = false;
_showWaypointLabels = false;
_showWaypointIcons = false;
_showPOI = true;
_showPOILabels = true;
_showPOI = false;
_showPOILabels = false;
_showPOIIcons = false;
_overlapPOIs = true;
_showRouteWaypoints = true;
_showMarkers = true;
_overlapPOIs = false;
_showRouteWaypoints = false;
_showMarkers = false;
_markerInfoType = MarkerInfoItem::None;
_showPathTicks = false;
_trackWidth = 3;
@ -189,7 +185,7 @@ PathItem *MapView::addRoute(const Route &route)
ri->setVisible(_showRoutes);
ri->showWaypoints(_showRouteWaypoints);
ri->showWaypointLabels(_showWaypointLabels);
ri->showWaypointIcons(_showWaypointLabels);
ri->showWaypointIcons(_showWaypointIcons);
ri->setDigitalZoom(_digitalZoom);
ri->setMarkerColor(_markerColor);
ri->showMarker(_showMarkers);
@ -1375,19 +1371,21 @@ void MapView::showPosition(bool show)
{
_showPosition = show;
if (!_positionSource) {
_crosshair->setVisible(false);
_positionCoordinates->setVisible(false);
_motionInfo->setVisible(false);
} else if (_showPosition) {
_crosshair->setVisible(true);
if (_showPositionCoordinates)
_positionCoordinates->setVisible(true);
if (_showMotionInfo)
_motionInfo->setVisible(true);
_positionSource->startUpdates();
if (_positionSource) {
if (_showPosition) {
_crosshair->setVisible(true);
if (_showPositionCoordinates)
_positionCoordinates->setVisible(true);
if (_showMotionInfo)
_motionInfo->setVisible(true);
_positionSource->startUpdates();
} else {
_positionSource->stopUpdates();
_crosshair->setVisible(false);
_positionCoordinates->setVisible(false);
_motionInfo->setVisible(false);
}
} else {
_positionSource->stopUpdates();
_crosshair->setVisible(false);
_positionCoordinates->setVisible(false);
_motionInfo->setVisible(false);

View File

@ -7,7 +7,6 @@
#include <QList>
#include <QFlags>
#include "common/rectc.h"
#include "common/config.h"
#include "data/waypoint.h"
#include "map/projection.h"
#include "searchpointer.h"
@ -54,8 +53,7 @@ public:
};
Q_DECLARE_FLAGS(PlotFlags, Flag)
MapView(Map *map, POI *poi, QGeoPositionInfoSource *source,
QWidget *parent = 0);
MapView(Map *map, POI *poi, QWidget *parent = 0);
QList<PathItem *> loadData(const Data &data);
void loadMaps(const QList<MapAction*> &maps);

View File

@ -2,6 +2,7 @@
#define MARKERINFOITEM_H
#include <QGraphicsItem>
#include <QFont>
#include "format.h"
class Coordinates;

View File

@ -6,7 +6,7 @@
PowerGraph::PowerGraph(QWidget *parent) : GraphTab(parent)
{
_showTracks = true;
_showTracks = false;
GraphView::setYUnits(tr("W"));
setYLabel(tr("Power"));

View File

@ -1,7 +1,7 @@
#ifndef SEARCHPOINTER_H
#define SEARCHPOINTER_H
#include "common/config.h"
#include "common/hash.h"
template <class T>
class SearchPointer

267
src/GUI/settings.cpp Normal file
View File

@ -0,0 +1,267 @@
#include <QLocale>
#include <QDir>
#include <QPageLayout>
#include <QPageSize>
#include <QGeoPositionInfoSource>
#include "common/config.h"
#include "common/util.h"
#include "data/graph.h"
#include "format.h"
#include "units.h"
#include "timetype.h"
#include "markerinfoitem.h"
#include "timezoneinfo.h"
#include "settings.h"
#define SETTING(varName, name, defVal) \
const Settings::Setting Settings::varName = Settings::Setting(name, defVal)
#define IMPERIAL_UNITS() \
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
#define CWD(filename) \
QDir::current().filePath(filename)
#define UNITS() \
(IMPERIAL_UNITS() ? Imperial : Metric)
#define TIMEZONE() \
QVariant::fromValue(TimeZoneInfo())
#define POI_RADIUS() \
(int)(IMPERIAL_UNITS() ? MIINM : KMINM)
#define PAPER_SIZE() \
(IMPERIAL_UNITS() \
? QPageSize::PageSizeId::Letter \
: QPageSize::PageSizeId::A4)
#ifdef Q_OS_ANDROID
#define PIXMAP_CACHE 256
#else // Q_OS_ANDROID
#define PIXMAP_CACHE 512
#endif // Q_OS_ANDROID
static QString defaultPlugin()
{
QString source;
QGeoPositionInfoSource *ps = QGeoPositionInfoSource::createDefaultSource(0);
if (ps) {
source = ps->sourceName();
delete ps;
}
return source;
}
QMap<QString, QVariantMap> Settings::SettingMap::read(QSettings &settings) const
{
QMap<QString, QVariantMap> map;
int size = settings.beginReadArray(_prefix);
for (int i = 0; i < size; i++) {
settings.setArrayIndex(i);
map.insert(settings.value(_key).toString(),
settings.value(_value).toMap());
}
settings.endArray();
return map;
}
void Settings::SettingMap::write(QSettings &settings,
const QMap<QString, QVariantMap> &map) const
{
int index = 0;
if (map.isEmpty())
return;
settings.beginWriteArray(_prefix);
for (QMap<QString, QVariantMap>::const_iterator it = map.constBegin();
it != map.constEnd(); ++it) {
if (!it.value().isEmpty()) {
settings.setArrayIndex(index++);
settings.setValue(_key, it.key());
settings.setValue(_value, it.value());
}
}
settings.endArray();
}
QStringList Settings::SettingList::read(QSettings &settings) const
{
QStringList list;
int size = settings.beginReadArray(_prefix);
for (int i = 0; i < size; i++) {
settings.setArrayIndex(i);
list.append(settings.value(_value).toString());
}
settings.endArray();
return list;
}
void Settings::SettingList::write(QSettings &settings,
const QStringList &list) const
{
if (list.isEmpty())
return;
settings.beginWriteArray(_prefix);
for (int i = 0; i < list.size(); i++) {
settings.setArrayIndex(i);
settings.setValue(_value, list.at(i));
}
settings.endArray();
}
const Settings::Setting &Settings::positionPlugin()
{
static Setting s("positionPlugin", defaultPlugin());
return s;
}
/* Window */
#ifndef Q_OS_ANDROID
SETTING(windowGeometry, "geometry", QByteArray() );
SETTING(windowState, "state", QByteArray() );
#endif // Q_OS_ANDROID
/* Settings */
SETTING(timeType, "timeType", Total );
SETTING(units, "units", UNITS() );
SETTING(coordinatesFormat, "coordinates", DecimalDegrees );
#ifndef Q_OS_ANDROID
SETTING(showToolbars, "toolbar", true );
#endif // Q_OS_ANDROID
/* Map */
SETTING(activeMap, "map", "Open Street Map" );
SETTING(showMap, "show", true );
SETTING(cursorCoordinates, "coordinates", false );
/* Graph */
SETTING(showGraphs, "show", true );
SETTING(graphType, "type", Distance );
SETTING(showGrid, "grid", true );
SETTING(sliderInfo, "sliderInfo", true );
#ifdef Q_OS_ANDROID
SETTING(showGraphTabs, "tabs", true );
#endif // Q_OS_ANDROID
/* POI */
SETTING(poiIcons, "icons", true );
SETTING(poiLabels, "labels", true );
SETTING(showPoi, "show", false );
SETTING(poiOverlap, "overlap", false );
/* Data */
SETTING(tracks, "tracks", true );
SETTING(routes, "routes", true );
SETTING(waypoints, "waypoints", true );
SETTING(areas, "areas", true );
SETTING(routeWaypoints, "routeWaypoints", true );
SETTING(waypointIcons, "waypointIcons", false );
SETTING(waypointLabels, "waypointLabels", true );
SETTING(pathTicks, "pathTicks", false );
SETTING(positionMarkers, "positionMarkers", true );
SETTING(markerInfo, "markerInfo", MarkerInfoItem::None );
SETTING(useStyles, "styles", true );
/* Position */
SETTING(showPosition, "show", false );
SETTING(followPosition, "follow", true );
SETTING(positionCoordinates, "coordinates", true );
SETTING(motionInfo, "motionInfo", true );
/* PDF export */
SETTING(pdfOrientation, "orientation", QPageLayout::Orientation::Portrait);
SETTING(pdfSize, "size", PAPER_SIZE() );
SETTING(pdfMarginLeft, "marginLeft", 5 );
SETTING(pdfMarginTop, "marginTop", 5 );
SETTING(pdfMarginRight, "marginRight", 5 );
SETTING(pdfMarginBottom, "marginBottom", 5 );
SETTING(pdfFileName, "fileName", CWD("export.pdf") );
SETTING(pdfResolution, "resolution", 600 );
/* PNG export */
SETTING(pngWidth, "width", 600 );
SETTING(pngHeight, "height", 800 );
SETTING(pngMarginLeft, "marginLeft", 5 );
SETTING(pngMarginTop, "marginTop", 5 );
SETTING(pngMarginRight, "marginRight", 5 );
SETTING(pngMarginBottom, "marginBottom", 5 );
SETTING(pngAntialiasing, "antialiasing", true );
SETTING(pngFileName, "fileName", CWD("export.png") );
/* Options */
SETTING(paletteColor, "paletteColor", QColor(Qt::blue) );
SETTING(paletteShift, "paletteShift", 0.62 );
SETTING(mapOpacity, "mapOpacity", 100 );
SETTING(backgroundColor, "backgroundColor", QColor(Qt::white) );
SETTING(crosshairColor, "crosshairColor", QColor(Qt::red) );
SETTING(infoColor, "infoColor", QColor(Qt::black) );
SETTING(infoBackground, "infoBackground", false );
SETTING(trackWidth, "trackWidth", 3 );
SETTING(routeWidth, "routeWidth", 3 );
SETTING(areaWidth, "areaWidth", 2 );
SETTING(trackStyle, "trackStyle", (int)Qt::SolidLine );
SETTING(routeStyle, "routeStyle", (int)Qt::DotLine );
SETTING(areaStyle, "areaStyle", (int)Qt::SolidLine );
SETTING(areaOpacity, "areaOpacity", 50 );
SETTING(waypointSize, "waypointSize", 8 );
SETTING(waypointColor, "waypointColor", QColor(Qt::black) );
SETTING(poiSize, "poiSize", 8 );
SETTING(poiColor, "poiColor", QColor(Qt::black) );
SETTING(graphWidth, "graphWidth", 1 );
SETTING(pathAntiAliasing, "pathAntiAliasing", true );
SETTING(graphAntiAliasing, "graphAntiAliasing", true );
SETTING(elevationFilter, "elevationFilter", 3 );
SETTING(speedFilter, "speedFilter", 5 );
SETTING(heartRateFilter, "heartrateFilter", 3 );
SETTING(cadenceFilter, "cadenceFilter", 3 );
SETTING(powerFilter, "powerFilter", 3 );
SETTING(outlierEliminate, "outlierEliminate", true );
SETTING(automaticPause, "automaticPause", true );
SETTING(pauseSpeed, "pauseSpeed", 0.5 );
SETTING(pauseInterval, "pauseInterval", 10 );
SETTING(useReportedSpeed, "useReportedSpeed", false );
SETTING(dataUseDEM, "dataUseDEM", false );
SETTING(secondaryElevation, "showSecondaryElevation", false );
SETTING(secondarySpeed, "showSecondarySpeed", false );
SETTING(timeZone, "timeZone", TIMEZONE() );
SETTING(useSegments, "useSegments", true );
SETTING(poiRadius, "poiRadius", POI_RADIUS() );
SETTING(demURL, "demURL", DEM_TILES_URL );
SETTING(demAuthentication, "demAuthentication", false );
SETTING(demUsername, "demUsername", "" );
SETTING(demPassword, "demPassword", "" );
SETTING(useOpenGL, "useOpenGL", false );
SETTING(enableHTTP2, "enableHTTP2", true );
SETTING(pixmapCache, "pixmapCache", PIXMAP_CACHE );
SETTING(connectionTimeout, "connectionTimeout", 30 );
SETTING(hiresPrint, "hiresPrint", false );
SETTING(printName, "printName", true );
SETTING(printDate, "printDate", true );
SETTING(printDistance, "printDistance", true );
SETTING(printTime, "printTime", true );
SETTING(printMovingTime, "printMovingTime", false );
SETTING(printItemCount, "printItemCount", true );
SETTING(separateGraphPage, "separateGraphPage", false );
SETTING(sliderColor, "sliderColor", QColor(Qt::red) );
SETTING(outputProjection, "outputProjection", 3857 );
SETTING(inputProjection, "inputProjection", 4326 );
SETTING(hidpiMap, "HiDPIMap", true );
SETTING(poiPath, "poiPath", "" );
SETTING(mapsPath, "mapsPath", "" );
SETTING(dataPath, "dataPath", "" );
const Settings::SettingMap Settings::positionPluginParameters
= Settings::SettingMap("pluginParameters", "plugin", "parameters");
const Settings::SettingList Settings::disabledPoiFiles
= Settings::SettingList("disabled", "file");

View File

@ -1,262 +1,212 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QtGlobal>
#include <QMap>
#include <QVariant>
#include <QSettings>
#define IMPERIAL_UNITS() \
(QLocale::system().measurementSystem() == QLocale::ImperialSystem)
#define POSITION_PLUGIN() \
(QGeoPositionInfoSource::availableSources().isEmpty() \
? "" : QGeoPositionInfoSource::availableSources().first())
#define SETTINGS_WINDOW "Window"
#define SETTINGS_SETTINGS "Settings"
#define SETTINGS_MAP "Map"
#define SETTINGS_GRAPH "Graph"
#define SETTINGS_POI "POI"
#define SETTINGS_DATA "Data"
#define SETTINGS_POSITION "Position"
#define SETTINGS_PDF_EXPORT "Export"
#define SETTINGS_PNG_EXPORT "PNGExport"
#define SETTINGS_OPTIONS "Options"
#define WINDOW_SETTINGS_GROUP "Window"
#define WINDOW_GEOMETRY_SETTING "geometry"
#define WINDOW_STATE_SETTING "state"
class Settings
{
public:
class Setting
{
public:
Setting(const QString &name, const QVariant &defVal)
: _name(name), _defVal(defVal) {}
#define SETTINGS_SETTINGS_GROUP "Settings"
#define TIME_TYPE_SETTING "timeType"
#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
void write(QSettings &settings, const QVariant &value) const
{
if (value != _defVal)
settings.setValue(_name, value);
}
QVariant read(const QSettings &settings) const
{
return settings.value(_name, _defVal);
}
#define GRAPH_SETTINGS_GROUP "Graph"
#define SHOW_GRAPHS_SETTING "show"
#define SHOW_GRAPHS_DEFAULT true
#define GRAPH_TYPE_SETTING "type"
#define GRAPH_TYPE_DEFAULT Distance
#define SHOW_GRAPH_GRIDS_SETTING "grid"
#define SHOW_GRAPH_GRIDS_DEFAULT true
#define SHOW_GRAPH_SLIDER_INFO_SETTING "sliderInfo"
#define SHOW_GRAPH_SLIDER_INFO_DEFAULT true
#define SHOW_GRAPH_TABS_SETTING "tabs"
#define SHOW_GRAPH_TABS_DEFAULT true
#define SHOW_TICKS_SETTING "pathTicks"
#define SHOW_TICKS_DEFAULT false
private:
QString _name;
QVariant _defVal;
};
#define MAP_SETTINGS_GROUP "Map"
#define CURRENT_MAP_SETTING "map"
#define SHOW_MAP_SETTING "show"
#define SHOW_MAP_DEFAULT true
#define SHOW_CURSOR_COORDINATES_SETTING "coordinates"
#define SHOW_CURSOR_COORDINATES_DEFAULT false
class SettingMap
{
public:
SettingMap(const QString &prefix, const QString &key, const QString &value)
: _prefix(prefix), _key(key), _value(value) {}
#define POI_SETTINGS_GROUP "POI"
#define OVERLAP_POI_SETTING "overlap"
#define OVERLAP_POI_DEFAULT false
void write(QSettings &settings, const QMap<QString, QVariantMap> &map) const;
QMap<QString, QVariantMap> read(QSettings &settings) const;
#define POSITION_SETTINGS_GROUP "Position"
#define SHOW_POSITION_SETTING "show"
#define SHOW_POSITION_DEFAULT false
#define FOLLOW_POSITION_SETTING "follow"
#define FOLLOW_POSITION_DEFAULT true
#define SHOW_POSITION_COORDINATES_SETTING "coordinates"
#define SHOW_POSITION_COORDINATES_DEFAULT true
#define SHOW_MOTION_INFO_SETTING "motionInfo"
#define SHOW_MOTION_INFO_DEFAULT true
private:
QString _prefix;
QString _key;
QString _value;
};
#define SHOW_POI_ICONS_SETTING "icons"
#define SHOW_POI_ICONS_DEFAULT true
#define SHOW_POI_LABELS_SETTING "labels"
#define SHOW_POI_LABELS_DEFAULT true
#define SHOW_POI_SETTING "show"
#define SHOW_POI_DEFAULT false
#define DISABLED_POI_FILE_SETTINGS_PREFIX "disabled"
#define DISABLED_POI_FILE_SETTING "file"
class SettingList
{
public:
SettingList(const QString &prefix, const QString &value)
: _prefix(prefix), _value(value) {}
#define DATA_SETTINGS_GROUP "Data"
#define SHOW_TRACKS_SETTING "tracks"
#define SHOW_TRACKS_DEFAULT true
#define SHOW_ROUTES_SETTING "routes"
#define SHOW_ROUTES_DEFAULT true
#define SHOW_WAYPOINTS_SETTING "waypoints"
#define SHOW_WAYPOINTS_DEFAULT true
#define SHOW_AREAS_SETTING "areas"
#define SHOW_AREAS_DEFAULT true
#define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints"
#define SHOW_ROUTE_WAYPOINTS_DEFAULT true
#define SHOW_WAYPOINT_ICONS_SETTING "waypointIcons"
#define SHOW_WAYPOINT_ICONS_DEFAULT false
#define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels"
#define SHOW_WAYPOINT_LABELS_DEFAULT true
#define SHOW_MARKERS_SETTING "positionMarkers"
#define SHOW_MARKERS_DEFAULT true
#define SHOW_MARKER_INFO_SETTING "markerInfo"
#define SHOW_MARKER_INFO_DEFAULT MarkerInfoItem::None
#define USE_STYLES_SETTING "styles"
#define USE_STYLES_DEFAULT true
void write(QSettings &settings, const QStringList &list) const;
QStringList read(QSettings &settings) const;
#define PDF_EXPORT_SETTINGS_GROUP "Export"
#define PAPER_ORIENTATION_SETTING "orientation"
#define PAPER_ORIENTATION_DEFAULT QPageLayout::Orientation::Portrait
#define PAPER_SIZE_SETTING "size"
#define PAPER_SIZE_DEFAULT (IMPERIAL_UNITS() \
? QPageSize::PageSizeId::Letter \
: QPageSize::PageSizeId::A4)
#define PDF_MARGIN_LEFT_SETTING "marginLeft"
#define PDF_MARGIN_LEFT_DEFAULT 5 /* mm */
#define PDF_MARGIN_TOP_SETTING "marginTop"
#define PDF_MARGIN_TOP_DEFAULT 5 /* mm */
#define PDF_MARGIN_RIGHT_SETTING "marginRight"
#define PDF_MARGIN_RIGHT_DEFAULT 5 /* mm */
#define PDF_MARGIN_BOTTOM_SETTING "marginBottom"
#define PDF_MARGIN_BOTTOM_DEFAULT 5 /* mm */
#define PDF_FILENAME_SETTING "fileName"
#define PDF_FILENAME_DEFAULT QString("%1/export.pdf"). \
arg(QDir::currentPath())
#define RESOLUTION_SETTING "resolution"
#define RESOLUTION_DEFAULT 600
private:
QString _prefix;
QString _value;
};
#define PNG_EXPORT_SETTINGS_GROUP "PNGExport"
#define PNG_WIDTH_SETTING "width"
#define PNG_WIDTH_DEFAULT 600
#define PNG_HEIGHT_SETTING "height"
#define PNG_HEIGHT_DEFAULT 800
#define PNG_MARGIN_LEFT_SETTING "marginLeft"
#define PNG_MARGIN_LEFT_DEFAULT 5 /* px */
#define PNG_MARGIN_TOP_SETTING "marginTop"
#define PNG_MARGIN_TOP_DEFAULT 5 /* px */
#define PNG_MARGIN_RIGHT_SETTING "marginRight"
#define PNG_MARGIN_RIGHT_DEFAULT 5 /* px */
#define PNG_MARGIN_BOTTOM_SETTING "marginBottom"
#define PNG_MARGIN_BOTTOM_DEFAULT 5 /* px */
#define PNG_ANTIALIASING_SETTING "antialiasing"
#define PNG_ANTIALIASING_DEFAULT true
#define PNG_FILENAME_SETTING "fileName"
#define PNG_FILENAME_DEFAULT QString("%1/export.png"). \
arg(QDir::currentPath())
#define OPTIONS_SETTINGS_GROUP "Options"
#define PALETTE_COLOR_SETTING "paletteColor"
#define PALETTE_COLOR_DEFAULT QColor(Qt::blue)
#define PALETTE_SHIFT_SETTING "paletteShift"
#define PALETTE_SHIFT_DEFAULT 0.62
#define MAP_OPACITY_SETTING "mapOpacity"
#define MAP_OPACITY_DEFAULT 100
#define BACKGROUND_COLOR_SETTING "backgroundColor"
#define BACKGROUND_COLOR_DEFAULT QColor(Qt::white)
#define CROSSHAIR_COLOR_SETTING "crosshairColor"
#define CROSSHAIR_COLOR_DEFAULT QColor(Qt::red)
#define INFO_COLOR_SETTING "infoColor"
#define INFO_COLOR_DEFAULT QColor(Qt::black)
#define INFO_BACKGROUND_SETTING "infoBackground"
#define INFO_BACKGROUND_DEFAULT false
#define TRACK_WIDTH_SETTING "trackWidth"
#define TRACK_WIDTH_DEFAULT 3
#define ROUTE_WIDTH_SETTING "routeWidth"
#define ROUTE_WIDTH_DEFAULT 3
#define AREA_WIDTH_SETTING "areaWidth"
#define AREA_WIDTH_DEFAULT 2
#define TRACK_STYLE_SETTING "trackStyle"
#define TRACK_STYLE_DEFAULT Qt::SolidLine
#define ROUTE_STYLE_SETTING "routeStyle"
#define ROUTE_STYLE_DEFAULT Qt::DotLine
#define AREA_STYLE_SETTING "areaStyle"
#define AREA_STYLE_DEFAULT Qt::SolidLine
#define AREA_OPACITY_SETTING "areaOpacity"
#define AREA_OPACITY_DEFAULT 50
#define WAYPOINT_SIZE_SETTING "waypointSize"
#define WAYPOINT_SIZE_DEFAULT 8
#define WAYPOINT_COLOR_SETTING "waypointColor"
#define WAYPOINT_COLOR_DEFAULT QColor(Qt::black)
#define POI_SIZE_SETTING "poiSize"
#define POI_SIZE_DEFAULT 8
#define POI_COLOR_SETTING "poiColor"
#define POI_COLOR_DEFAULT QColor(Qt::black)
#define GRAPH_WIDTH_SETTING "graphWidth"
#define GRAPH_WIDTH_DEFAULT 1
#define PATH_AA_SETTING "pathAntiAliasing"
#define PATH_AA_DEFAULT true
#define GRAPH_AA_SETTING "graphAntiAliasing"
#define GRAPH_AA_DEFAULT true
#define ELEVATION_FILTER_SETTING "elevationFilter"
#define ELEVATION_FILTER_DEFAULT 3
#define SPEED_FILTER_SETTING "speedFilter"
#define SPEED_FILTER_DEFAULT 5
#define HEARTRATE_FILTER_SETTING "heartrateFilter"
#define HEARTRATE_FILTER_DEFAULT 3
#define CADENCE_FILTER_SETTING "cadenceFilter"
#define CADENCE_FILTER_DEFAULT 3
#define POWER_FILTER_SETTING "powerFilter"
#define POWER_FILTER_DEFAULT 3
#define OUTLIER_ELIMINATE_SETTING "outlierEliminate"
#define OUTLIER_ELIMINATE_DEFAULT true
#define AUTOMATIC_PAUSE_SETTING "automaticPause"
#define AUTOMATIC_PAUSE_DEFAULT true
#define PAUSE_SPEED_SETTING "pauseSpeed"
#define PAUSE_SPEED_DEFAULT 0.5 /* m/s */
#define PAUSE_INTERVAL_SETTING "pauseInterval"
#define PAUSE_INTERVAL_DEFAULT 10 /* s */
#define USE_REPORTED_SPEED_SETTING "useReportedSpeed"
#define USE_REPORTED_SPEED_DEFAULT false
#define DATA_USE_DEM_SETTING "dataUseDEM"
#define DATA_USE_DEM_DEFAULT false
#define SHOW_SECONDARY_ELEVATION_SETTING "showSecondaryElevation"
#define SHOW_SECONDARY_ELEVATION_DEFAULT false
#define SHOW_SECONDARY_SPEED_SETTING "showSecondarySpeed"
#define SHOW_SECONDARY_SPEED_DEFAULT false
#define TIME_ZONE_SETTING "timeZone"
#define USE_SEGMENTS_SETTING "useSegments"
#define USE_SEGMENTS_DEFAULT true
#define POI_RADIUS_SETTING "poiRadius"
#define POI_RADIUS_DEFAULT (int)(IMPERIAL_UNITS() ? MIINM : KMINM)
#define DEM_URL_SETTING "demURL"
#define DEM_URL_DEFAULT "http://dem.gpxsee.org/$lat/$lat$lon.hgt.zip"
#define DEM_AUTH_SETTING "demAuthentication"
#define DEM_AUTH_DEFAULT false
#define DEM_USERNAME_SETTING "demUsername"
#define DEM_USERNAME_DEFAULT ""
#define DEM_PASSWORD_SETTING "demPassword"
#define DEM_PASSWORD_DEFAULT ""
#define POSITION_PLUGIN_SETTING "positionPlugin"
#define POSITION_PLUGIN_DEFAULT POSITION_PLUGIN()
#define POSITION_PLUGIN_PARAMS_PREFIX "pluginParameters"
#define POSITION_PLUGIN_PARAMS_PLUGIN "plugin"
#define POSITION_PLUGIN_PARAMS_PARAM "parameters"
#define USE_OPENGL_SETTING "useOpenGL"
#define USE_OPENGL_DEFAULT false
#define ENABLE_HTTP2_SETTING "enableHTTP2"
#define ENABLE_HTTP2_DEFAULT true
#define PIXMAP_CACHE_SETTING "pixmapCache"
#ifdef Q_OS_ANDROID
#define PIXMAP_CACHE_DEFAULT 256 /* MB */
#else // Q_OS_ANDROID
#define PIXMAP_CACHE_DEFAULT 512 /* MB */
/* Window */
#ifndef Q_OS_ANDROID
static const Setting windowGeometry;
static const Setting windowState;
#endif // Q_OS_ANDROID
#define CONNECTION_TIMEOUT_SETTING "connectionTimeout"
#define CONNECTION_TIMEOUT_DEFAULT 30 /* s */
#define HIRES_PRINT_SETTING "hiresPrint"
#define HIRES_PRINT_DEFAULT false
#define PRINT_NAME_SETTING "printName"
#define PRINT_NAME_DEFAULT true
#define PRINT_DATE_SETTING "printDate"
#define PRINT_DATE_DEFAULT true
#define PRINT_DISTANCE_SETTING "printDistance"
#define PRINT_DISTANCE_DEFAULT true
#define PRINT_TIME_SETTING "printTime"
#define PRINT_TIME_DEFAULT true
#define PRINT_MOVING_TIME_SETTING "printMovingTime"
#define PRINT_MOVING_TIME_DEFAULT false
#define PRINT_ITEM_COUNT_SETTING "printItemCount"
#define PRINT_ITEM_COUNT_DEFAULT true
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
#define SEPARATE_GRAPH_PAGE_DEFAULT false
#define SLIDER_COLOR_SETTING "sliderColor"
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
#define OUTPUT_PROJECTION_SETTING "outputProjection"
#define OUTPUT_PROJECTION_DEFAULT 3857
#define INPUT_PROJECTION_SETTING "inputProjection"
#define INPUT_PROJECTION_DEFAULT 4326
#define HIDPI_MAP_SETTING "HiDPIMap"
#define HIDPI_MAP_DEFAULT true
#define DATA_PATH_SETTING "dataPath"
#define DATA_PATH_DEFAULT QString()
#define MAPS_PATH_SETTING "mapsPath"
#define MAPS_PATH_DEFAULT QString()
#define POI_PATH_SETTING "poiPath"
#define POI_PATH_DEFAULT QString()
/* Settings */
static const Setting timeType;
static const Setting units;
static const Setting coordinatesFormat;
#ifndef Q_OS_ANDROID
static const Setting showToolbars;
#endif // Q_OS_ANDROID
/* Map */
static const Setting activeMap;
static const Setting showMap;
static const Setting cursorCoordinates;
/* Graph */
static const Setting showGraphs;
static const Setting graphType;
static const Setting showGrid;
static const Setting sliderInfo;
#ifdef Q_OS_ANDROID
static const Setting showGraphTabs;
#endif // Q_OS_ANDROID
/* POI */
static const Setting poiIcons;
static const Setting poiLabels;
static const Setting showPoi;
static const Setting poiOverlap;
static const SettingList disabledPoiFiles;
/* Data */
static const Setting tracks;
static const Setting routes;
static const Setting waypoints;
static const Setting areas;
static const Setting routeWaypoints;
static const Setting waypointIcons;
static const Setting waypointLabels;
static const Setting pathTicks;
static const Setting positionMarkers;
static const Setting markerInfo;
static const Setting useStyles;
/* Position */
static const Setting showPosition;
static const Setting followPosition;
static const Setting positionCoordinates;
static const Setting motionInfo;
/* PDF export */
static const Setting pdfOrientation;
static const Setting pdfSize;
static const Setting pdfMarginLeft;
static const Setting pdfMarginTop;
static const Setting pdfMarginRight;
static const Setting pdfMarginBottom;
static const Setting pdfFileName;
static const Setting pdfResolution;
/* PNG export */
static const Setting pngWidth;
static const Setting pngHeight;
static const Setting pngMarginLeft;
static const Setting pngMarginTop;
static const Setting pngMarginRight;
static const Setting pngMarginBottom;
static const Setting pngAntialiasing;
static const Setting pngFileName;
/* Options */
static const Setting paletteColor;
static const Setting paletteShift;
static const Setting mapOpacity;
static const Setting backgroundColor;
static const Setting crosshairColor;
static const Setting infoColor;
static const Setting infoBackground;
static const Setting trackWidth;
static const Setting routeWidth;
static const Setting areaWidth;
static const Setting trackStyle;
static const Setting routeStyle;
static const Setting areaStyle;
static const Setting areaOpacity;
static const Setting waypointSize;
static const Setting waypointColor;
static const Setting poiSize;
static const Setting poiColor;
static const Setting graphWidth;
static const Setting pathAntiAliasing;
static const Setting graphAntiAliasing;
static const Setting elevationFilter;
static const Setting speedFilter;
static const Setting heartRateFilter;
static const Setting cadenceFilter;
static const Setting powerFilter;
static const Setting outlierEliminate;
static const Setting automaticPause;
static const Setting pauseSpeed;
static const Setting pauseInterval;
static const Setting useReportedSpeed;
static const Setting dataUseDEM;
static const Setting secondaryElevation;
static const Setting secondarySpeed;
static const Setting timeZone;
static const Setting useSegments;
static const Setting poiRadius;
static const Setting demURL;
static const Setting demAuthentication;
static const Setting demUsername;
static const Setting demPassword;
static const Setting useOpenGL;
static const Setting enableHTTP2;
static const Setting pixmapCache;
static const Setting connectionTimeout;
static const Setting hiresPrint;
static const Setting printName;
static const Setting printDate;
static const Setting printDistance;
static const Setting printTime;
static const Setting printMovingTime;
static const Setting printItemCount;
static const Setting separateGraphPage;
static const Setting sliderColor;
static const Setting outputProjection;
static const Setting inputProjection;
static const Setting hidpiMap;
static const Setting poiPath;
static const Setting mapsPath;
static const Setting dataPath;
static const Setting &positionPlugin();
static const SettingMap positionPluginParameters;
};
#endif // SETTINGS_H

View File

@ -10,7 +10,7 @@ SpeedGraph::SpeedGraph(QWidget *parent) : GraphTab(parent)
{
_units = Metric;
_timeType = Total;
_showTracks = true;
_showTracks = false;
setYUnits();
setYLabel(tr("Speed"));

View File

@ -6,7 +6,7 @@
TemperatureGraph::TemperatureGraph(QWidget *parent) : GraphTab(parent)
{
_showTracks = true;
_showTracks = false;
setYUnits(Metric);
setYLabel(tr("Temperature"));

View File

@ -38,7 +38,10 @@ public:
else
return (other._type == Custom && _customZone == other._customZone);
}
bool operator!=(const TimeZoneInfo &other) {return !(*this == other);}
bool operator!=(const TimeZoneInfo &other) const
{
return !(*this == other);
}
private:
friend QDataStream& operator<<(QDataStream &out, const TimeZoneInfo &info);

View File

@ -74,7 +74,7 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
QGraphicsItem *parent) : GraphicsItem(parent)
{
_waypoint = waypoint;
_showLabel = true;
_showLabel = false;
_showIcon = false;
_size = 8;
_color = Qt::black;

View File

@ -1,21 +1,8 @@
#ifndef CONFIG_H
#define CONFIG_H
#include <QtGlobal>
#include <QPoint>
#define APP_NAME "GPXSee"
#define APP_HOMEPAGE "http://www.gpxsee.org"
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#define HASH_T uint
#else // QT6
#define HASH_T size_t
#endif // QT6
inline HASH_T qHash(const QPoint &p)
{
return ::qHash(p.x()) ^ ::qHash(p.y());
}
#define DEM_TILES_URL "http://dem.gpxsee.org/$lat/$lat$lon.hgt.zip"
#endif /* CONFIG_H */

18
src/common/hash.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef HASH_H
#define HASH_H
#include <QtGlobal>
#include <QPoint>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#define HASH_T uint
#else // QT6
#define HASH_T size_t
#endif // QT6
inline HASH_T qHash(const QPoint &p)
{
return ::qHash(p.x()) ^ ::qHash(p.y());
}
#endif // HASH_H

View File

@ -4,7 +4,7 @@
#include <QString>
#include <QCache>
#include <QByteArray>
#include "common/config.h"
#include "common/hash.h"
#include "area.h"
class QString;

View File

@ -3,6 +3,7 @@
#include <QList>
#include <QVector>
#include <QColor>
#include <QDebug>
#include <cmath>

View File

@ -482,6 +482,7 @@ void KMLParser::track(SegmentData &segment)
{
const char error[] = "gx:coord/when element count mismatch";
int i = 0;
bool empty = false;
while (_reader.readNextStartElement()) {
if (_reader.name() == QLatin1String("when")) {
@ -495,6 +496,8 @@ void KMLParser::track(SegmentData &segment)
_reader.raiseError("Invalid coordinates");
return;
}
if (segment.at(i).coordinates().isNull())
empty = true;
i++;
} else if (_reader.name() == QLatin1String("ExtendedData"))
extendedData(segment);
@ -507,10 +510,15 @@ void KMLParser::track(SegmentData &segment)
return;
}
// empty (invalid) coordinates are allowed per KML specification!
for (int i = 0; i < segment.size(); i++)
if (segment.at(i).coordinates().isNull())
segment.remove(i);
/* empty (invalid) coordinates are allowed per KML specification, but
invalid in our data representation so get rid of the segment entries */
if (empty) {
SegmentData filtered;
for (int i = 0; i < segment.size(); i++)
if (!segment.at(i).coordinates().isNull())
filtered.append(segment.at(i));
segment = filtered;
}
}
void KMLParser::multiTrack(TrackData &t)

View File

@ -7,7 +7,7 @@
#include <QVector>
#include <QPixmap>
#include <QDebug>
#include "common/config.h"
#include "common/hash.h"
#include "common/coordinates.h"
#include "link.h"
#include "style.h"

View File

@ -10,6 +10,7 @@
#define CATMOR 40
#define CATTRK 54
#define CATREA 56
#define CATSIT 61
#define CATSCF 65
#define CATWAT 69
#define CATWRK 71
@ -24,6 +25,7 @@
#define WATLEV 187
#define I_CATACH 17000
#define I_CATSIT 17002
#define I_RESTRN 17004
#define I_CATHAF 17008
#define I_RDOCAL 17017

View File

@ -5,6 +5,13 @@
using namespace ENC;
#define UINT16(x) \
(((quint16)*(const uchar*)(x)) \
| ((quint16)(*((const uchar*)(x) + 1)) << 8))
#define INT32(x) ((qint32)UINT32(x))
#define INT16(x) ((qint16)UINT16(x))
struct DR {
char RecordLength[5];
char InterchangeLevel;
@ -91,13 +98,14 @@ bool ISO8211::fieldType(const QString &str, int cnt, FieldType &type, int &size)
return true;
}
int ISO8211::readDR(QFile &file, QVector<FieldDefinition> &fields) const
int ISO8211::readDR(QVector<FieldDefinition> &fields)
{
DR ddr;
QByteArray fieldLen, fieldPos;
int len, lenSize, posSize, tagSize, offset;
if (file.read((char*)&ddr, sizeof(ddr)) != sizeof(ddr))
static_assert(sizeof(ddr) == 24, "Invalid DR alignment");
if (_file.read((char*)&ddr, sizeof(ddr)) != sizeof(ddr))
return -1;
len = Util::str2int(ddr.RecordLength, sizeof(ddr.RecordLength));
@ -118,9 +126,9 @@ int ISO8211::readDR(QFile &file, QVector<FieldDefinition> &fields) const
r.tag.resize(tagSize);
if (file.read(r.tag.data(), tagSize) != tagSize
|| file.read(fieldLen.data(), lenSize) != lenSize
|| file.read(fieldPos.data(), posSize) != posSize)
if (_file.read(r.tag.data(), tagSize) != tagSize
|| _file.read(fieldLen.data(), lenSize) != lenSize
|| _file.read(fieldPos.data(), posSize) != posSize)
return -1;
r.pos = offset + Util::str2int(fieldPos.constData(), posSize);
@ -133,13 +141,13 @@ int ISO8211::readDR(QFile &file, QVector<FieldDefinition> &fields) const
return len;
}
bool ISO8211::readDDA(QFile &file, const FieldDefinition &def, SubFields &fields)
bool ISO8211::readDDA(const FieldDefinition &def, SubFields &fields)
{
static QRegularExpression re("(\\d*)(\\w+)\\(*(\\d*)\\)*");
QByteArray ba;
ba.resize(def.size);
if (!(file.seek(def.pos) && file.read(ba.data(), ba.size()) == ba.size()))
if (!(_file.seek(def.pos) && _file.read(ba.data(), ba.size()) == ba.size()))
return false;
QList<QByteArray> list(ba.split('\x1f'));
@ -187,12 +195,16 @@ bool ISO8211::readDDA(QFile &file, const FieldDefinition &def, SubFields &fields
return true;
}
bool ISO8211::readDDR(QFile &file)
bool ISO8211::readDDR()
{
QVector<FieldDefinition> fields;
qint64 pos = file.pos();
int len = readDR(file, fields);
if (!_file.open(QIODevice::ReadOnly)) {
_errorString = _file.errorString();
return false;
}
int len = readDR(fields);
if (len < 0) {
_errorString = "Not a ISO8211 file";
return false;
@ -200,7 +212,7 @@ bool ISO8211::readDDR(QFile &file)
for (int i = 0; i < fields.size(); i++) {
SubFields def;
if (!readDDA(file, fields.at(i), def)) {
if (!readDDA(fields.at(i), def)) {
_errorString = QString("Error reading %1 DDA field")
.arg(QString(fields.at(i).tag));
return false;
@ -208,7 +220,7 @@ bool ISO8211::readDDR(QFile &file)
_map.insert(fields.at(i).tag, def);
}
if (file.pos() != pos + len || fields.size() < 2) {
if (_file.pos() != len || fields.size() < 2) {
_errorString = "DDR format error";
return false;
}
@ -216,20 +228,21 @@ bool ISO8211::readDDR(QFile &file)
return true;
}
bool ISO8211::readUDA(QFile &file, quint64 pos, const FieldDefinition &def,
const SubFields &fields, Data &data) const
bool ISO8211::readUDA(quint64 pos, const FieldDefinition &def,
const SubFields &fields, Data &data)
{
QByteArray ba;
ba.resize(def.size);
if (!(file.seek(pos + def.pos)
&& file.read(ba.data(), ba.size()) == ba.size()))
if (!(_file.seek(pos + def.pos)
&& _file.read(ba.data(), ba.size()) == ba.size()))
return false;
const char *sp;
const char *dp = ba.constData();
const char *ep = ba.constData() + ba.size() - 1;
data.clear();
data.setFields(&fields);
do {
@ -286,11 +299,14 @@ bool ISO8211::readUDA(QFile &file, quint64 pos, const FieldDefinition &def,
return true;
}
bool ISO8211::readRecord(QFile &file, Record &record)
bool ISO8211::readRecord(Record &record)
{
if (_file.atEnd())
return false;
QVector<FieldDefinition> fields;
qint64 pos = file.pos();
int len = readDR(file, fields);
qint64 pos = _file.pos();
int len = readDR(fields);
if (len < 0) {
_errorString = "Error reading DR";
@ -312,7 +328,7 @@ bool ISO8211::readRecord(QFile &file, Record &record)
f.setTag(def.tag);
if (!readUDA(file, pos, def, it.value(), f.rdata())) {
if (!readUDA(pos, def, it.value(), f.rdata())) {
_errorString = QString("Error reading %1 record")
.arg(QString(def.tag));
return false;

View File

@ -1,25 +1,17 @@
#ifndef ENC_ISO8211_H
#define ENC_ISO8211_H
#include <QFile>
#include <QByteArray>
#include <QVariant>
#include <QDebug>
class QFile;
#define UINT32(x) \
(((quint32)*(const uchar*)(x)) \
| ((quint32)(*((const uchar*)(x) + 1)) << 8) \
| ((quint32)(*((const uchar*)(x) + 2)) << 16) \
| ((quint32)(*((const uchar*)(x) + 3)) << 24))
#define UINT16(x) \
(((quint16)*(const uchar*)(x)) \
| ((quint16)(*((const uchar*)(x) + 1)) << 8))
#define INT32(x) ((qint32)UINT32(x))
#define INT16(x) ((qint16)UINT16(x))
namespace ENC {
class ISO8211
@ -102,8 +94,9 @@ public:
}
};
bool readDDR(QFile &file);
bool readRecord(QFile &file, Record &record);
ISO8211(const QString &path) : _file(path) {}
bool readDDR();
bool readRecord(Record &record);
const QString &errorString() const {return _errorString;}
@ -113,11 +106,12 @@ private:
static bool fieldType(const QString &str, int cnt, FieldType &type,
int &size);
int readDR(QFile &file, QVector<FieldDefinition> &fields) const;
bool readDDA(QFile &file, const FieldDefinition &def, SubFields &fields);
bool readUDA(QFile &file, quint64 pos, const FieldDefinition &def,
const SubFields &fields, Data &data) const;
int readDR(QVector<FieldDefinition> &fields);
bool readDDA(const FieldDefinition &def, SubFields &fields);
bool readUDA(quint64 pos, const FieldDefinition &def,
const SubFields &fields, Data &data);
QFile _file;
FieldsMap _map;
QString _errorString;
};

View File

@ -1,4 +1,3 @@
#include <QFile>
#include "common/util.h"
#include "objects.h"
#include "attributes.h"
@ -51,22 +50,24 @@ static QMap<uint,uint> orderMapInit()
map.insert(TYPE(UWTROC), 26);
map.insert(TYPE(WATTUR), 27);
map.insert(TYPE(PILBOP), 28);
map.insert(TYPE(I_RDOCAL), 29);
map.insert(TYPE(I_TRNBSN), 30);
map.insert(TYPE(HRBFAC), 31);
map.insert(TYPE(I_HRBFAC), 31);
map.insert(TYPE(PILPNT), 32);
map.insert(TYPE(ACHBRT), 33);
map.insert(TYPE(I_ACHBRT), 33);
map.insert(TYPE(CRANES), 34);
map.insert(TYPE(I_CRANES), 34);
map.insert(TYPE(I_WTWGAG), 35);
map.insert(TYPE(PYLONS), 36);
map.insert(TYPE(LNDMRK), 37);
map.insert(TYPE(SILTNK), 38);
map.insert(TYPE(LNDELV), 39);
map.insert(TYPE(SMCFAC), 40);
map.insert(TYPE(BUISGL), 41);
map.insert(TYPE(SISTAT), 29);
map.insert(TYPE(I_SISTAT), 29);
map.insert(TYPE(I_RDOCAL), 30);
map.insert(TYPE(I_TRNBSN), 31);
map.insert(TYPE(HRBFAC), 32);
map.insert(TYPE(I_HRBFAC), 32);
map.insert(TYPE(PILPNT), 33);
map.insert(TYPE(ACHBRT), 34);
map.insert(TYPE(I_ACHBRT), 34);
map.insert(TYPE(CRANES), 35);
map.insert(TYPE(I_CRANES), 35);
map.insert(TYPE(I_WTWGAG), 36);
map.insert(TYPE(PYLONS), 37);
map.insert(TYPE(LNDMRK), 38);
map.insert(TYPE(SILTNK), 39);
map.insert(TYPE(LNDELV), 40);
map.insert(TYPE(SMCFAC), 41);
map.insert(TYPE(BUISGL), 42);
map.insert(TYPE(I_DISMAR), 0xFFFFFFFE);
map.insert(TYPE(SOUNDG), 0xFFFFFFFF);
@ -220,6 +221,22 @@ static QString hUnits(uint type)
}
}
static QString sistat(uint type)
{
switch (type) {
case 1:
return "SS (Port Control)";
case 3:
return "SS (INT)";
case 6:
return "SS (Lock)";
case 8:
return "SS (Bridge)";
default:
return "SS";
}
}
MapData::Point::Point(uint type, const Coordinates &c, const QString &label,
const QVector<QByteArray> &params) : _type(type), _pos(c), _label(label)
{
@ -233,6 +250,10 @@ MapData::Point::Point(uint type, const Coordinates &c, const QString &label,
if (!params.at(1).isEmpty())
_label = QString("VHF ") + QString::fromLatin1(params.at(1));
_param = QVariant(params.at(0).toDouble());
} else if (type>>16 == I_SISTAT || type>>16 == SISTAT) {
if (_label.isEmpty())
_label = sistat(type & 0xFF);
_type = TYPE(SISTAT);
}
}
@ -509,7 +530,9 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
|| (OBJL == BUAARE && key == CATBUA)
|| (OBJL == SMCFAC && key == CATSCF)
|| (OBJL == BUISGL && key == FUNCTN)
|| (OBJL == WATTUR && key == CATWAT))
|| (OBJL == WATTUR && key == CATWAT)
|| (OBJL == SISTAT && key == CATSIT)
|| (OBJL == I_SISTAT && key == I_CATSIT))
subtype = av.at(1).toByteArray().toUInt();
else if (OBJL == I_DISMAR && key == CATDIS)
subtype |= av.at(1).toByteArray().toUInt();
@ -727,31 +750,25 @@ bool MapData::bounds(const QVector<ISO8211::Record> &gv, Rect &b)
MapData::MapData(const QString &path): _fileName(path)
{
QFile file(_fileName);
QVector<ISO8211::Record> gv;
ISO8211 ddf;
ISO8211 ddf(_fileName);
ISO8211::Record record;
uint COMF = 1;
if (!file.open(QIODevice::ReadOnly)) {
_errorString = file.errorString();
return;
}
if (!ddf.readDDR(file)) {
if (!ddf.readDDR()) {
_errorString = ddf.errorString();
return;
}
while (!file.atEnd()) {
ISO8211::Record record;
if (!ddf.readRecord(file, record)) {
_errorString = ddf.errorString();
return;
}
while (ddf.readRecord(record)) {
if (!processRecord(record, gv, COMF, _name)) {
_errorString = "Invalid S-57 record";
return;
}
}
if (!ddf.errorString().isNull()) {
_errorString = ddf.errorString();
return;
}
Rect b;
if (!bounds(gv, b)) {
@ -783,30 +800,22 @@ MapData::~MapData()
void MapData::load()
{
QFile file(_fileName);
RecordMap vi, vc, ve, vf;
QVector<ISO8211::Record> fe;
uint COMF = 1, SOMF = 1;
ISO8211 ddf;
uint PRIM, OBJL;
ISO8211 ddf(_fileName);
ISO8211::Record record;
uint PRIM, OBJL, COMF = 1, SOMF = 1;
Poly *poly;
Line *line;
Point *point;
double min[2], max[2];
if (!file.open(QIODevice::ReadOnly))
if (!ddf.readDDR())
return;
if (!ddf.readDDR(file))
return;
while (!file.atEnd()) {
ISO8211::Record record;
if (!ddf.readRecord(file, record))
return;
while (ddf.readRecord(record))
if (!processRecord(record, fe, vi, vc, ve, vf, COMF, SOMF))
return;
}
qWarning("Invalid S-57 record");
for (int i = 0; i < fe.size(); i++) {
const ISO8211::Record &r = fe.at(i);

View File

@ -71,6 +71,7 @@
#define RIVERS 114
#define ROADWY 116
#define SLCONS 122
#define SISTAT 123
#define SILTNK 125
#define SLOTOP 126
#define SMCFAC 128
@ -90,6 +91,7 @@
#define I_ACHARE 17001
#define I_DISMAR 17004
#define I_RESARE 17005
#define I_SISTAT 17007
#define I_BERTHS 17010
#define I_BRIDGE 17011
#define I_CBLOHD 17012

View File

@ -67,6 +67,9 @@ void Style::polygonStyle()
QImage(":/marine/entry-prohibited-line.png"));
_polygons[SUBTYPE(I_RESARE, 17)] = Polygon(
QImage(":/marine/entry-prohibited-line.png"));
_polygons[SUBTYPE(RESARE, 12)] = Polygon(QImage(":/marine/safety-zone-line.png"));
_polygons[SUBTYPE(I_RESARE, 12)] = Polygon(QImage(":/marine/safety-zone-line.png"));
_polygons[SUBTYPE(RESARE, 1)] = Polygon(QImage(":/marine/safety-zone-line.png"));
_polygons[SUBTYPE(ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png"));
_polygons[SUBTYPE(I_ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png"));
_polygons[TYPE(PRCARE)] = Polygon(QBrush(QColor("#eb49eb"),
@ -117,7 +120,8 @@ void Style::polygonStyle()
<< TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN) << TYPE(UWTROC)
<< TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) << SUBTYPE(I_ACHARE, 1)
<< SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2) << SUBTYPE(I_RESARE, 2)
<< SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) << TYPE(CBLARE)
<< SUBTYPE(RESARE, 17) << SUBTYPE(I_RESARE, 17) << SUBTYPE(RESARE, 12)
<< SUBTYPE(I_RESARE, 12) << SUBTYPE(RESARE, 1) << TYPE(CBLARE)
<< TYPE(PIPARE) << TYPE(PRCARE) << SUBTYPE(MARKUL, 3);
}
@ -241,6 +245,7 @@ void Style::pointStyle()
_points[SUBTYPE(I_DISMAR, 2)].setTextFontSize(Small);
_points[SUBTYPE(I_DISMAR, 2)].setHaloColor(QColor());
_points[SUBTYPE(I_DISMAR, 3)] = _points[SUBTYPE(I_DISMAR, 2)];
_points[SUBTYPE(I_DISMAR, 4)] = _points[SUBTYPE(I_DISMAR, 2)];
_points[TYPE(CGUSTA)] = Point(QImage(":/marine/coast-guard.png"));
_points[TYPE(RDOSTA)] = Point(QImage(":/marine/radio.png"));
_points[TYPE(RADSTA)] = Point(QImage(":/marine/radar.png"));
@ -255,6 +260,7 @@ void Style::pointStyle()
_points[SUBTYPE(WATTUR, 3)] = Point(QImage(":/marine/overfalls.png"));
_points[SUBTYPE(WATTUR, 4)] = Point(QImage(":/marine/overfalls.png"));
_points[TYPE(PILBOP)] = Point(QImage(":/marine/boarding-place.png"));
_points[TYPE(SISTAT)] = Point(QImage(":/marine/pylon.png"));
_points[SUBTYPE(SMCFAC, 7)] = Point(QImage(":/POI/restaurant-11.png"));
_points[SUBTYPE(SMCFAC, 11)] = Point(QImage(":/POI/pharmacy-11.png"));

View File

@ -301,7 +301,7 @@ void RasterTile::processPolygons(QList<TextItem*> &textItems)
QList<TextItem *> labels;
for (int i = 0; i < _polygons.size(); i++) {
MapData::Poly &poly = _polygons[i];
const MapData::Poly &poly = _polygons.at(i);
bool exists = set.contains(poly.label.text());
if (poly.label.text().isEmpty())
@ -343,7 +343,7 @@ void RasterTile::processLines(QList<TextItem*> &textItems)
void RasterTile::processStreetNames(QList<TextItem*> &textItems)
{
for (int i = 0; i < _lines.size(); i++) {
MapData::Poly &poly = _lines[i];
const MapData::Poly &poly = _lines.at(i);
const Style::Line &style = _style->line(poly.type);
if (style.img().isNull() && style.foreground() == Qt::NoPen)
@ -433,7 +433,7 @@ void RasterTile::processPoints(QList<TextItem*> &textItems)
std::sort(_points.begin(), _points.end());
for (int i = 0; i < _points.size(); i++) {
MapData::Point &point = _points[i];
const MapData::Point &point = _points.at(i);
const Style::Point &style = _style->point(point.type);
bool poi = Style::isPOI(point.type);

View File

@ -1,5 +1,5 @@
#ifndef SECTION_H
#define SECTION_H
#ifndef IMG_SECTION_H
#define IMG_SECTION_H
#include <QtGlobal>
@ -14,4 +14,4 @@ struct Section {
}
#endif // SECTION_H
#endif // IMG_SECTION_H

View File

@ -2,7 +2,7 @@
#define IMG_SHIELD_H
#include <QString>
#include "common/config.h"
#include "common/hash.h"
#define FIRST_SHIELD Shield::USInterstate
#define LAST_SHIELD Shield::Oval

View File

@ -384,10 +384,13 @@ void Style::defaultLineStyle()
_lines[0x10307] = Line(QPen(QColor("#05620e"), 1, Qt::SolidLine));
_lines[0x10401] = Line(QImage(":/marine/cable.png"));
_lines[0x10402] = Line(QImage(":/marine/pipeline.png"));
_lines[0x10405] = Line(QPen(QColor("#e728e7"), 1, Qt::DashLine));
_lines[0x10404] = Line(QImage(":/marine/fishing-farm-line.png"));
_lines[0x10405] = Line(QImage(":/marine/pipeline-area-line.png"));
_lines[0x10406] = Line(QImage(":/marine/cable-area-line.png"));
_lines[0x10409] = Line(QPen(QColor("#000000"), 1, Qt::DotLine));
_lines[0x10501] = Line(QImage(":/marine/noanchor-line.png"));
_lines[0x10503] = Line(QPen(QColor("#e728e7"), 1, Qt::DashLine));
_lines[0x10505] = Line(QImage(":/marine/safety-zone-line.png"));
_lines[0x10507] = Line(QPen(QColor("#e728e7"), 1, Qt::DashLine));
_lines[0x10601] = Line(QPen(QColor("#000000"), 1, Qt::SolidLine));
_lines[0x10606] = Line(QImage(":/marine/anchor-line.png"));
@ -663,8 +666,10 @@ void Style::defaultPointStyle()
_points[0x10216] = Point(QImage(":/marine/mooring-buoy.png"));
_points[0x10305] = Point(QImage(":/marine/chimney.png"));
_points[0x10306] = Point(QImage(":/marine/church.png"));
_points[0x10307] = Point(QImage(":/marine/silo.png"));
_points[0x10308] = Point(QImage(":/marine/tower.png"));
_points[0x1030a] = Point(QImage(":/marine/triangulation-point.png"));
_points[0x1030b] = Point(QImage(":/marine/radio.png"));
_points[0x10400] = Point(QImage(":/marine/obstruction.png"));
_points[0x10401] = Point(QImage(":/marine/obstruction.png"));
_points[0x10402] = Point(QImage(":/marine/wreck.png"));
@ -673,9 +678,12 @@ void Style::defaultPointStyle()
_points[0x1040a] = Point(QImage(":/marine/rock-dangerous.png"));
_points[0x1040c] = Point(QImage(":/marine/rock-exposed.png"));
_points[0x10701] = Point(QImage(":/marine/anchorage.png"));
_points[0x10702] = Point(QImage(":/marine/boarding-place.png"));
_points[0x10703] = Point(QImage(":/marine/yacht-harbor.png"));
_points[0x10704] = Point(QImage(":/marine/pile.png"));
_points[0x10705] = Point(QImage(":/marine/anchoring-prohibited.png"));
_points[0x1070a] = Point(QImage(":/marine/coast-guard.png"));
_points[0x1070b] = Point(QImage(":/marine/fishing-harbor.png"));
}
bool Style::itemInfo(SubFile *file, SubFile::Handle &hdl,

View File

@ -4,6 +4,7 @@
#include <QImageReader>
#include <QBuffer>
#include <QtConcurrent>
#include "common/hash.h"
#include "osm.h"
#include "tile.h"
#include "aqmmap.h"

View File

@ -4,7 +4,6 @@
#include <QDebug>
#include <QFile>
#include <QHash>
#include "common/config.h"
#include "map.h"
class AQMMap : public Map

View File

@ -4,7 +4,7 @@
#include <QFile>
#include <QCache>
#include <QPainterPath>
#include "common/config.h"
#include "common/hash.h"
#include "common/rectc.h"
#include "common/rtree.h"
#include "common/range.h"

View File

@ -8,7 +8,6 @@
#include <QRegularExpression>
#include "common/coordinates.h"
#include "common/rectc.h"
#include "common/config.h"
#include "tar.h"
#include "ozf.h"
#include "image.h"
@ -381,7 +380,7 @@ void OziMap::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio)
Map *OziMap::createTAR(const QString &path, const Projection &, bool *isDir)
{
if (isDir)
*isDir = true;
*isDir = false;
return new OziMap(path, true);
}
@ -389,7 +388,7 @@ Map *OziMap::createTAR(const QString &path, const Projection &, bool *isDir)
Map *OziMap::createMAP(const QString &path, const Projection &, bool *isDir)
{
if (isDir)
*isDir = true;
*isDir = false;
return new OziMap(path, false);
}

View File

@ -6,7 +6,7 @@
#include <QSet>
#include <QList>
#include <QHash>
#include "common/config.h"
#include "common/hash.h"
#include "common/rectc.h"
#include "common/kv.h"
#include "common/downloader.h"