├── src ├── interfaces.d.ts ├── components │ ├── app-root │ │ ├── app-root.css │ │ └── app-root.tsx │ ├── app-tabs │ │ ├── app-tabs.css │ │ └── app-tabs.tsx │ ├── app-history │ │ ├── app-history.css │ │ ├── app-history.tsx │ │ └── app-history-details.tsx │ ├── app-home │ │ ├── guiding-setup.css │ │ ├── guiding-interface.css │ │ ├── icon-arrow.tsx │ │ ├── guiding-helper.tsx │ │ ├── accuracy-helper.tsx │ │ ├── galileo-modal.tsx │ │ ├── guiding-interface.tsx │ │ └── guiding-setup.tsx │ ├── app-offline │ │ ├── app-offline.css │ │ └── app-offline.tsx │ ├── app-about │ │ ├── app-about.css │ │ └── app-about.tsx │ └── app-gpsstatus │ │ ├── app-gpsstatus.css │ │ └── app-gpsstatus.tsx ├── assets │ ├── usegalileo.png │ └── icon │ │ ├── favicon.ico │ │ ├── icon192.png │ │ ├── icon512.png │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ └── apple-touch-icon.png ├── global │ ├── app.ts │ ├── app.css │ └── lang.ts ├── manifest.json ├── statemanagement │ ├── localStorage.ts │ ├── store.ts │ ├── reducers.ts │ └── app │ │ ├── HistoryStateManagement.ts │ │ ├── AppStateManagement.ts │ │ ├── DeviceStateManagement.ts │ │ ├── GnssMeasurementsStateManagement.ts │ │ ├── MapStateManagement.ts │ │ ├── RecordingStateManagement.ts │ │ └── GuidingStateManagement.ts ├── index.html ├── helpers │ ├── loadingIndicator.tsx │ ├── utils.ts │ └── geolocationsimulator.js └── components.d.ts ├── android ├── app │ ├── .npmignore │ ├── src │ │ ├── main │ │ │ ├── ic_launcher-web.png │ │ │ ├── res │ │ │ │ ├── drawable │ │ │ │ │ ├── screen.png │ │ │ │ │ ├── launch_splash.xml │ │ │ │ │ ├── ic_icon.xml │ │ │ │ │ └── ic_launcher_background.xml │ │ │ │ ├── drawable-hdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-land │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-ldpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-mdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-land-hdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-land-ldpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-land-mdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-port-hdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-port-mdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-land-xhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-land-xxhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-port-xhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-port-xxhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ ├── ic_launcher_round.png │ │ │ │ │ └── ic_launcher_foreground.png │ │ │ │ ├── drawable-land-xxxhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── drawable-port-xxxhdpi │ │ │ │ │ └── screen.png │ │ │ │ ├── values │ │ │ │ │ ├── ic_launcher_background.xml │ │ │ │ │ ├── strings.xml │ │ │ │ │ └── styles.xml │ │ │ │ ├── xml │ │ │ │ │ ├── file_paths.xml │ │ │ │ │ └── config.xml │ │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ │ ├── ic_launcher.xml │ │ │ │ │ └── ic_launcher_round.xml │ │ │ │ ├── layout │ │ │ │ │ └── activity_main.xml │ │ │ │ └── drawable-v24 │ │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── assets │ │ │ │ └── capacitor.config.json │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── tractornavigator │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── MathUtils.java │ │ │ └── AndroidManifest.xml │ │ ├── test │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── getcapacitor │ │ │ │ └── myapp │ │ │ │ └── ExampleUnitTest.java │ │ └── androidTest │ │ │ └── java │ │ │ └── com │ │ │ └── getcapacitor │ │ │ └── myapp │ │ │ └── ExampleInstrumentedTest.java │ ├── capacitor.build.gradle │ ├── proguard-rules.pro │ └── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── settings.gradle ├── capacitor.settings.gradle ├── build.gradle ├── gradle.properties ├── .gitignore ├── gradlew.bat └── gradlew ├── landingpage ├── appstore.png ├── favicon.ico ├── googleplay.png ├── favicon-16x16.png ├── favicon-32x32.png ├── ic_launcher-web.png ├── apple-touch-icon.png └── logo.svg ├── ios ├── App │ ├── App │ │ ├── Assets.xcassets │ │ │ ├── Contents.json │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── 100.png │ │ │ │ ├── 114.png │ │ │ │ ├── 120.png │ │ │ │ ├── 128.png │ │ │ │ ├── 144.png │ │ │ │ ├── 152.png │ │ │ │ ├── 16.png │ │ │ │ ├── 167.png │ │ │ │ ├── 172.png │ │ │ │ ├── 180.png │ │ │ │ ├── 196.png │ │ │ │ ├── 20.png │ │ │ │ ├── 216.png │ │ │ │ ├── 256.png │ │ │ │ ├── 29.png │ │ │ │ ├── 32.png │ │ │ │ ├── 40.png │ │ │ │ ├── 48.png │ │ │ │ ├── 50.png │ │ │ │ ├── 512.png │ │ │ │ ├── 55.png │ │ │ │ ├── 57.png │ │ │ │ ├── 58.png │ │ │ │ ├── 60.png │ │ │ │ ├── 64.png │ │ │ │ ├── 72.png │ │ │ │ ├── 76.png │ │ │ │ ├── 80.png │ │ │ │ ├── 87.png │ │ │ │ ├── 88.png │ │ │ │ ├── 1024.png │ │ │ │ └── Contents.json │ │ │ └── Splash.imageset │ │ │ │ ├── splash-2732x2732.png │ │ │ │ ├── splash-2732x2732-1.png │ │ │ │ ├── splash-2732x2732-2.png │ │ │ │ └── Contents.json │ │ ├── config.xml │ │ ├── capacitor.config.json │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ ├── Info.plist │ │ └── AppDelegate.swift │ ├── App.xcodeproj │ │ └── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ ├── App.xcworkspace │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── contents.xcworkspacedata │ └── Podfile └── .gitignore ├── .editorconfig ├── stencil.config.ts ├── PRIVATE_POLICY.html ├── .gitignore ├── capacitor.config.json ├── tsconfig.json ├── LICENSE ├── readme.md ├── package.json └── index.html /src/interfaces.d.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/app-root/app-root.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/app-tabs/app-tabs.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/app-history/app-history.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/app-home/guiding-setup.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/app-offline/app-offline.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/app-home/guiding-interface.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/app/.npmignore: -------------------------------------------------------------------------------- 1 | /build/* 2 | !/build/.npmkeep 3 | -------------------------------------------------------------------------------- /landingpage/appstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/appstore.png -------------------------------------------------------------------------------- /landingpage/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/favicon.ico -------------------------------------------------------------------------------- /landingpage/googleplay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/googleplay.png -------------------------------------------------------------------------------- /src/assets/usegalileo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/usegalileo.png -------------------------------------------------------------------------------- /landingpage/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/favicon-16x16.png -------------------------------------------------------------------------------- /landingpage/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/favicon-32x32.png -------------------------------------------------------------------------------- /src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /src/assets/icon/icon192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/icon/icon192.png -------------------------------------------------------------------------------- /src/assets/icon/icon512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/icon/icon512.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /landingpage/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/ic_launcher-web.png -------------------------------------------------------------------------------- /landingpage/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/landingpage/apple-touch-icon.png -------------------------------------------------------------------------------- /src/assets/icon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/icon/favicon-16x16.png -------------------------------------------------------------------------------- /src/assets/icon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/icon/favicon-32x32.png -------------------------------------------------------------------------------- /src/assets/icon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/src/assets/icon/apple-touch-icon.png -------------------------------------------------------------------------------- /android/app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/components/app-about/app-about.css: -------------------------------------------------------------------------------- 1 | 2 | .text-bold { 3 | font-weight: 700; 4 | } 5 | 6 | .text-small { 7 | font-size: 0.9em; 8 | } -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable/screen.png -------------------------------------------------------------------------------- /src/components/app-gpsstatus/app-gpsstatus.css: -------------------------------------------------------------------------------- 1 | .text-bold { 2 | font-weight: 700; 3 | } 4 | 5 | .text-small { 6 | font-size: 0.9em; 7 | } -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-hdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-ldpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-ldpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-mdpi/screen.png -------------------------------------------------------------------------------- /src/global/app.ts: -------------------------------------------------------------------------------- 1 | import '@ionic/core'; 2 | 3 | // import { setupConfig } from '@ionic/core'; 4 | 5 | // setupConfig({ 6 | // mode: 'ios' 7 | // }); 8 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-xhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-xxhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land-hdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land-ldpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land-ldpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land-mdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-port-hdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-port-hdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-port-mdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-port-mdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-xxxhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-xxxhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/100.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/114.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/128.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/144.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/152.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/16.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/167.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/172.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/172.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/196.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/20.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/216.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/216.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/256.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/29.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/32.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/48.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/50.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/512.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/55.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/57.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/60.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/64.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/72.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/76.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/88.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/88.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land-xhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land-xxhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land-xxhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-port-xhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-port-xhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-port-xxhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-port-xxhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-land-xxxhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-land-xxxhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-port-xxxhdpi/screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/drawable-port-xxxhdpi/screen.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tdurand/tractornavigator/HEAD/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png -------------------------------------------------------------------------------- /android/app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | include ':capacitor-cordova-android-plugins' 3 | project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/') 4 | 5 | apply from: 'capacitor.settings.gradle' -------------------------------------------------------------------------------- /android/capacitor.settings.gradle: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN 2 | include ':capacitor-android' 3 | project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Sep 12 11:18:20 CEST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | # NPM renames .gitignore to .npmignore 2 | # In order to prevent that, we remove the initial "." 3 | # And the CLI then renames it 4 | 5 | App/build 6 | App/Pods 7 | App/public 8 | App/Podfile.lock 9 | xcuserdata 10 | 11 | # Cordova plugins for Capacitor 12 | capacitor-cordova-ios-plugins 13 | 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | 3 | root = true 4 | 5 | [*] 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | 13 | [*.md] 14 | insert_final_newline = false 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /ios/App/App/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/app/src/main/res/xml/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ios/App/App.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /stencil.config.ts: -------------------------------------------------------------------------------- 1 | import { Config } from '@stencil/core'; 2 | import nodePolyfills from 'rollup-plugin-node-polyfills'; 3 | 4 | // https://stenciljs.com/docs/config 5 | 6 | export const config: Config = { 7 | outputTargets: [{ 8 | type: 'www', 9 | serviceWorker: null 10 | }], 11 | globalScript: 'src/global/app.ts', 12 | globalStyle: 'src/global/app.css', 13 | plugins: [ 14 | nodePolyfills(), 15 | ] 16 | }; 17 | -------------------------------------------------------------------------------- /PRIVATE_POLICY.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Tractor navigator Private policy 8 | 9 | 10 |

Private policy

11 |

We don’t store your data, period.

12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tractornavigator", 3 | "short_name": "tractornavigator", 4 | "start_url": "/", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/icon/icon192.png", 8 | "sizes": "192x192", 9 | "type": "image/png" 10 | },{ 11 | "src": "assets/icon/icon512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | }], 15 | "background_color": "#488aff", 16 | "theme_color": "#488aff" 17 | } -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Tractor Navigator 4 | Tractor Navigator 5 | com.tractornavigator 6 | com.tractornavigator.fileprovider 7 | com.tractornavigator 8 | 9 | -------------------------------------------------------------------------------- /android/app/capacitor.build.gradle: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN 2 | 3 | android { 4 | compileOptions { 5 | sourceCompatibility JavaVersion.VERSION_1_8 6 | targetCompatibility JavaVersion.VERSION_1_8 7 | } 8 | } 9 | 10 | apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" 11 | dependencies { 12 | 13 | 14 | } 15 | 16 | 17 | if (hasProperty('postBuildExtras')) { 18 | postBuildExtras() 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | !www/favicon.ico 3 | www/ 4 | 5 | *~ 6 | *.sw[mnpcod] 7 | *.log 8 | *.lock 9 | *.tmp 10 | *.tmp.* 11 | log.txt 12 | *.sublime-project 13 | *.sublime-workspace 14 | 15 | .stencil/ 16 | .idea/ 17 | .vscode/ 18 | .sass-cache/ 19 | .versions/ 20 | node_modules/ 21 | $RECYCLE.BIN/ 22 | 23 | .DS_Store 24 | Thumbs.db 25 | UserInterfaceState.xcuserstate 26 | .env 27 | 28 | src/config.json 29 | src/assets/font 30 | src/assets/countries 31 | 32 | android/*/.* 33 | android/.* 34 | 35 | android/app/release/ 36 | -------------------------------------------------------------------------------- /android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.getcapacitor.myapp; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/Splash.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "splash-2732x2732-2.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "splash-2732x2732-1.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "splash-2732x2732.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /src/statemanagement/localStorage.ts: -------------------------------------------------------------------------------- 1 | export const loadState = (key) => { 2 | try { 3 | const serializedState = localStorage.getItem(key); 4 | if (serializedState === null) { 5 | return undefined; 6 | } 7 | return JSON.parse(serializedState); 8 | } catch (err) { 9 | return undefined; 10 | } 11 | }; 12 | 13 | // localStorage.js 14 | export const persistState = (state, key) => { 15 | try { 16 | const serializedState = JSON.stringify(state); 17 | localStorage.setItem(key, serializedState); 18 | } catch { 19 | // ignore write errors 20 | } 21 | }; -------------------------------------------------------------------------------- /capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "com.tractornavigator", 3 | "appName": "TractorNavigator", 4 | "bundledWebRuntime": false, 5 | "npmClient": "npm", 6 | "webDir": "www", 7 | "plugins": { 8 | "SplashScreen": { 9 | "launchShowDuration": 10000, 10 | "launchAutoHide": true, 11 | "backgroundColor": "#ffffffff", 12 | "androidSplashResourceName": "screen", 13 | "androidScaleType": "CENTER_CROP", 14 | "androidSpinnerStyle": "large", 15 | "iosSpinnerStyle": "small", 16 | "spinnerColor": "#999999", 17 | "showSpinner": false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /ios/App/App/capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "com.tractornavigator", 3 | "appName": "TractorNavigator", 4 | "bundledWebRuntime": false, 5 | "npmClient": "npm", 6 | "webDir": "www", 7 | "plugins": { 8 | "SplashScreen": { 9 | "launchShowDuration": 10000, 10 | "launchAutoHide": true, 11 | "backgroundColor": "#ffffffff", 12 | "androidSplashResourceName": "screen", 13 | "androidScaleType": "CENTER_CROP", 14 | "androidSpinnerStyle": "large", 15 | "iosSpinnerStyle": "small", 16 | "spinnerColor": "#999999", 17 | "showSpinner": false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/app/src/main/assets/capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "com.tractornavigator", 3 | "appName": "TractorNavigator", 4 | "bundledWebRuntime": false, 5 | "npmClient": "npm", 6 | "webDir": "www", 7 | "plugins": { 8 | "SplashScreen": { 9 | "launchShowDuration": 10000, 10 | "launchAutoHide": true, 11 | "backgroundColor": "#ffffffff", 12 | "androidSplashResourceName": "screen", 13 | "androidScaleType": "CENTER_CROP", 14 | "androidSpinnerStyle": "large", 15 | "iosSpinnerStyle": "small", 16 | "spinnerColor": "#999999", 17 | "showSpinner": false 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "allowUnreachableCode": false, 5 | "declaration": false, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2017", 10 | "esnext.asynciterable" 11 | ], 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "module": "esnext", 15 | "target": "es2017", 16 | "noUnusedLocals": true, 17 | "noUnusedParameters": true, 18 | "jsx": "react", 19 | "jsxFactory": "h" 20 | }, 21 | "include": [ 22 | "src" 23 | ], 24 | "exclude": [ 25 | "node_modules" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/tractornavigator/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.tractornavigator; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.getcapacitor.BridgeActivity; 6 | import com.getcapacitor.Plugin; 7 | 8 | import java.util.ArrayList; 9 | 10 | public class MainActivity extends BridgeActivity { 11 | @Override 12 | public void onCreate(Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | 15 | // Initializes the Bridge 16 | this.init(savedInstanceState, new ArrayList>() {{ 17 | // Additional plugins you've installed go here 18 | add(GnssMeasurements.class); 19 | }}); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ios/App/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '11.0' 2 | use_frameworks! 3 | 4 | # workaround to avoid Xcode 10 caching of Pods that requires 5 | # Product -> Clean Build Folder after new Cordova plugins installed 6 | # Requires CocoaPods 1.6 or newer 7 | install! 'cocoapods', :disable_input_output_paths => true 8 | 9 | def capacitor_pods 10 | # Automatic Capacitor Pod dependencies, do not delete 11 | pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' 12 | pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' 13 | pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins' 14 | # Do not delete 15 | end 16 | 17 | target 'App' do 18 | capacitor_pods 19 | # Add your Pods here 20 | end 21 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:4.0.0' 11 | classpath 'com.google.gms:google-services:4.2.0' 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /src/statemanagement/store.ts: -------------------------------------------------------------------------------- 1 | import { createStore, applyMiddleware } from "redux"; 2 | import thunk from "redux-thunk"; 3 | //import logger from "redux-logger"; 4 | import rootReducer from "./reducers"; 5 | import { composeWithDevTools } from "redux-devtools-extension"; 6 | 7 | 8 | let middlewares = [] 9 | 10 | /* 11 | if (process.env.NODE_ENV === `development`) { 12 | const { logger } = require(`redux-logger`); 13 | 14 | middlewares.push(logger); 15 | } 16 | */ 17 | 18 | middlewares.push(thunk); 19 | //middlewares.push(logger); 20 | 21 | export const configureStore = (preloadedState: any) => 22 | createStore( 23 | rootReducer, 24 | preloadedState, 25 | composeWithDevTools(applyMiddleware(...middlewares)) 26 | ); -------------------------------------------------------------------------------- /src/statemanagement/reducers.ts: -------------------------------------------------------------------------------- 1 | import geolocation from "./app/GeolocationStateManagement"; 2 | import guiding from "./app/GuidingStateManagement"; 3 | import recording from "./app/RecordingStateManagement"; 4 | import history from "./app/HistoryStateManagement"; 5 | import map from "./app/MapStateManagement"; 6 | import device from "./app/DeviceStateManagement"; 7 | import gnssmeasurements from "./app/GnssMeasurementsStateManagement"; 8 | import app from "./app/AppStateManagement"; 9 | 10 | import { combineReducers } from "redux"; 11 | 12 | export const rootReducer = combineReducers({ 13 | geolocation, 14 | guiding, 15 | recording, 16 | history, 17 | map, 18 | device, 19 | gnssmeasurements, 20 | app 21 | }); 22 | 23 | export default rootReducer; -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.getcapacitor.myapp; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.getcapacitor.app", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 17 | 18 | 19 | 22 | 23 | -------------------------------------------------------------------------------- /src/components/app-home/icon-arrow.tsx: -------------------------------------------------------------------------------- 1 | import { h } from '@stencil/core'; 2 | 3 | const IconArrow = ({ direction, fillColor }) => { 4 | return ( 5 | 11 | {direction === "left" && 12 | 13 | 16 | 19 | 20 | } 21 | {direction === "right" && 22 | 23 | 26 | 29 | 30 | } 31 | 32 | ); 33 | } 34 | 35 | export default IconArrow; 36 | -------------------------------------------------------------------------------- /ios/App/App/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Thibault Durand 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/components/app-root/app-root.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h } from '@stencil/core'; 2 | import { store } from "@stencil/redux"; 3 | import { configureStore } from "../../statemanagement/store"; 4 | 5 | @Component({ 6 | tag: 'app-root', 7 | styleUrl: 'app-root.css' 8 | }) 9 | export class AppRoot { 10 | 11 | componentWillLoad() { 12 | store.setStore(configureStore({})); 13 | } 14 | 15 | render() { 16 | return ( 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/global/app.css: -------------------------------------------------------------------------------- 1 | /* Document Level Styles */ 2 | 3 | /* 4 | The imports below are needed to include our light dom css for global styles such as fonts and colors. 5 | You can comment out any of these imports if you do not need that css. For example, if you have your own 6 | global font family css then you can comment out the typography.css import. 7 | */ 8 | 9 | /** Core CSS required for ionic components to work property */ 10 | @import "~@ionic/core/css/core.css"; 11 | 12 | /** Basic CSS for apps built with Ionic */ 13 | @import "~@ionic/core/css/normalize.css"; 14 | @import "~@ionic/core/css/structure.css"; 15 | @import "~@ionic/core/css/typography.css"; 16 | 17 | /** Optional CSS utils that can be commented out */ 18 | @import "~@ionic/core/css/padding.css"; 19 | @import "~@ionic/core/css/float-elements.css"; 20 | @import "~@ionic/core/css/text-alignment.css"; 21 | @import "~@ionic/core/css/text-transformation.css"; 22 | @import "~@ionic/core/css/flex-utils.css"; 23 | 24 | /* 25 | The CSS Variables below can be used to theme your app. 26 | For more info on CSS variables check out: 27 | https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables 28 | 29 | More info about color theming using Ionic: 30 | https://beta.ionicframework.com/docs/theming/color-generator 31 | */ 32 | -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Tractor Navigator 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/components/app-home/guiding-helper.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, Prop } from '@stencil/core'; 2 | import IconArrow from './icon-arrow'; 3 | 4 | @Component({ 5 | tag: 'guiding-helper' 6 | }) 7 | export class GuidingHelper { 8 | 9 | @Prop() distanceToClosestGuidingLine: number; 10 | @Prop() isGuidingLineOnRightOrLeft: string; 11 | 12 | render() { 13 | return ( 14 |
15 |
16 | 1 ? "blue" : "#DADADA"} 19 | /> 20 |
21 |
22 | {this.distanceToClosestGuidingLine <= 1 && 23 |
OK
24 | } 25 | {this.distanceToClosestGuidingLine > 1 && 26 |
{Math.round(this.distanceToClosestGuidingLine)} m
27 | } 28 |
29 |
30 | 1 ? "blue" : "#DADADA"} 33 | /> 34 |
35 |
36 | ); 37 | } 38 | } -------------------------------------------------------------------------------- /src/helpers/loadingIndicator.tsx: -------------------------------------------------------------------------------- 1 | import { loadingController } from '@ionic/core'; 2 | 3 | export default class LoadingIndicator { 4 | 5 | isLoading: boolean 6 | isDismissed: boolean 7 | message: string 8 | 9 | modal: any 10 | 11 | constructor(message) { 12 | this.isLoading = false; 13 | this.isDismissed = true; 14 | this.message = message; 15 | } 16 | 17 | setMessage(message) { 18 | if(this.modal) { 19 | this.modal.message = message; 20 | } 21 | } 22 | 23 | async present() { 24 | if(this.isLoading) { 25 | return; 26 | } 27 | this.isLoading = true; 28 | this.isDismissed = false; 29 | return await loadingController.create({ 30 | message: this.message 31 | }).then(modal => { 32 | this.modal = modal; 33 | modal.present().then(() => { 34 | //console.log('presented'); 35 | if (!this.isLoading) { 36 | modal.dismiss().then(() => { 37 | //console.log('abort presenting') 38 | }); 39 | } 40 | }); 41 | }); 42 | } 43 | 44 | async dismiss() { 45 | this.isLoading = false; 46 | if(this.isDismissed) { return; } 47 | return await loadingController.dismiss().then(() => { 48 | this.isDismissed = true; 49 | //console.log('dismissed') 50 | }); 51 | } 52 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Tractor Navigator 2 | 3 | Tractor navigator provides guidance for farmers driving tractors. It is a navigation app (like your car 4 | gps) that enables you to: 5 | 6 | - Visualize current position and trajectory on an open field (no road) 7 | - Follow accurately a predefined trajectory with live feedback to correct deviation 8 | - Record and visualized saved trajectories 9 | 10 | See demo video: https://www.youtube.com/watch?v=9yNK1JyhWI4 11 | 12 | [![Demo video](https://img.youtube.com/vi/jX0ccm-nKyk/0.jpg)](https://www.youtube.com/watch?v=9yNK1JyhWI4) 13 | 14 | Download for [APK for Android](https://github.com/tdurand/tractornavigator/raw/master/build/tractornavigator-v1.1.apk) 15 | 16 | First version developed for #MyGalileoApp Challenge 2019. 17 | 18 | ### Dev notes 19 | 20 | When cloning on a new machine 21 | 22 | - create a `config.json` file at root with a `mapboxToken` 23 | 24 | ```json 25 | { 26 | "mapboxToken": "your_mapbox_token" 27 | } 28 | ``` 29 | 30 | - run `npx cap update android` , `npm i`, `npm run build` , `npx cap copy` 31 | 32 | - open in native IDE (android studio / Xcode) 33 | 34 | ### Acknowledgements: 35 | 36 | Based on [Ionic PWA toolkit](https://github.com/ionic-team/ionic-pwa-toolkit) augmented with capacitor [https://capacitor.ionicframework.com](https://capacitor.ionicframework.com) 37 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | # NPM renames .gitignore to .npmignore 2 | # In order to prevent that, we remove the initial "." 3 | # And the CLI then renames it 4 | 5 | # Using Android gitignore template: https://github.com/github/gitignore/blob/master/Android.gitignore 6 | 7 | # Built application files 8 | *.apk 9 | *.ap_ 10 | 11 | # Files for the ART/Dalvik VM 12 | *.dex 13 | 14 | # Java class files 15 | *.class 16 | 17 | # Generated files 18 | bin/ 19 | gen/ 20 | out/ 21 | 22 | # Gradle files 23 | .gradle/ 24 | build/ 25 | 26 | # Local configuration file (sdk path, etc) 27 | local.properties 28 | 29 | # Proguard folder generated by Eclipse 30 | proguard/ 31 | 32 | # Log Files 33 | *.log 34 | 35 | # Android Studio Navigation editor temp files 36 | .navigation/ 37 | 38 | # Android Studio captures folder 39 | captures/ 40 | 41 | # IntelliJ 42 | *.iml 43 | .idea/workspace.xml 44 | .idea/tasks.xml 45 | .idea/gradle.xml 46 | .idea/dictionaries 47 | .idea/libraries 48 | 49 | # Keystore files 50 | # Uncomment the following line if you do not want to check your keystore files in. 51 | #*.jks 52 | 53 | # External native build folder generated in Android Studio 2.2 and later 54 | .externalNativeBuild 55 | 56 | # Freeline 57 | freeline.py 58 | freeline/ 59 | freeline_project_description.json 60 | 61 | # fastlane 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | fastlane/readme.md 67 | 68 | # Cordova plugins for Capacitor 69 | capacitor-cordova-android-plugins 70 | 71 | # Copied web assets 72 | app/src/main/assets/public 73 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | defaultConfig { 6 | applicationId "com.tractornavigator" 7 | minSdkVersion 21 8 | targetSdkVersion 29 9 | versionCode 7 10 | versionName "1.2" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | repositories { 22 | maven { 23 | url "https://dl.bintray.com/ionic-team/capacitor" 24 | } 25 | flatDir{ 26 | dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs' 27 | } 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(include: ['*.jar'], dir: 'libs') 32 | implementation 'androidx.appcompat:appcompat:1.0.0' 33 | implementation project(':capacitor-android') 34 | testImplementation 'junit:junit:4.12' 35 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 36 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' 37 | implementation project(':capacitor-cordova-android-plugins') 38 | } 39 | 40 | apply from: 'capacitor.build.gradle' 41 | 42 | try { 43 | def servicesJSON = file('google-services.json') 44 | if (servicesJSON.text) { 45 | apply plugin: 'com.google.gms.google-services' 46 | } 47 | } catch(Exception e) { 48 | logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work") 49 | } 50 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tractornavigator", 3 | "private": true, 4 | "version": "0.0.1", 5 | "description": "tractornavigator", 6 | "license": "MIT", 7 | "files": [ 8 | "dist/" 9 | ], 10 | "scripts": { 11 | "build": "stencil build", 12 | "start": "stencil build --dev --watch --serve" 13 | }, 14 | "dependencies": { 15 | "@capacitor/android": "^2.4.1", 16 | "@capacitor/cli": "^2.4.1", 17 | "@capacitor/core": "^2.4.1", 18 | "@capacitor/ios": "^2.4.1", 19 | "@ionic/core": "5.3.2", 20 | "@mapbox/mapbox-gl-draw": "^1.2.0", 21 | "@stencil/redux": "^0.2.0", 22 | "@turf/area": "^6.0.1", 23 | "@turf/bbox": "^6.0.1", 24 | "@turf/bbox-polygon": "^6.0.1", 25 | "@turf/bearing": "^6.0.1", 26 | "@turf/boolean-contains": "^6.0.1", 27 | "@turf/center": "^6.0.1", 28 | "@turf/circle": "^6.0.1", 29 | "@turf/destination": "^6.0.1", 30 | "@turf/distance": "^6.0.1", 31 | "@turf/helpers": "^6.1.4", 32 | "@turf/line-intersect": "^6.0.2", 33 | "@turf/line-offset": "^5.1.5", 34 | "@turf/sector": "^5.1.5", 35 | "@turf/square": "^5.1.5", 36 | "@turf/transform-scale": "^5.1.5", 37 | "cordova-plugin-insomnia": "^4.3.0", 38 | "dayjs": "^1.8.35", 39 | "mapbox-gl": "^1.12.0", 40 | "mapbox-gl-draw-rectangle-mode": "^1.0.4", 41 | "redux": "^4.0.5", 42 | "redux-devtools-extension": "^2.13.8", 43 | "redux-logger": "^3.0.6", 44 | "redux-thunk": "^2.3.0" 45 | }, 46 | "devDependencies": { 47 | "@stencil/core": "2.0.3", 48 | "@types/jest": "26.0.13", 49 | "@types/puppeteer": "3.0.2", 50 | "jest": "26.4.2", 51 | "jest-cli": "26.4.2", 52 | "puppeteer": "5.3.0", 53 | "rollup-plugin-node-polyfills": "^0.2.1" 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ios/App/App/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/components/app-home/accuracy-helper.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State } from '@stencil/core'; 2 | import { store } from "@stencil/redux"; 3 | import { AccuracyStatus } from '../../statemanagement/app/GeolocationStateManagement'; 4 | import { getString } from '../../global/lang'; 5 | 6 | @Component({ 7 | tag: 'accuracy-helper' 8 | }) 9 | // @ts-ignore 10 | export class AccuracyHelper { 11 | 12 | // @ts-ignore 13 | @State() accuracyStatus: AccuracyStatus; 14 | // @ts-ignore 15 | @State() position: any; 16 | 17 | @State() lang: any; 18 | 19 | componentWillLoad() { 20 | store.mapStateToProps(this, state => { 21 | const { 22 | geolocation: { accuracyStatus, position }, 23 | device: { lang } 24 | } = state; 25 | return { 26 | accuracyStatus, 27 | position, 28 | lang 29 | }; 30 | }); 31 | } 32 | 33 | getAccuracyStatusString(accuracyStatus: AccuracyStatus) { 34 | switch(accuracyStatus) { 35 | case AccuracyStatus.Good: 36 | return "good"; 37 | case AccuracyStatus.Medium: 38 | return "medium"; 39 | case AccuracyStatus.Poor: 40 | return "poor" 41 | } 42 | } 43 | 44 | render() { 45 | return ( 46 | 47 |
48 | {this.accuracyStatus === AccuracyStatus.Poor && 49 |

{getString('POOR_ACCURACY', this.lang)}

50 | } 51 | {this.accuracyStatus === AccuracyStatus.Medium && 52 |

{getString('MEDIUM_ACCURACY', this.lang)}

53 | } 54 | {this.accuracyStatus === AccuracyStatus.Good && 55 |

{getString('GOOD_ACCURACY', this.lang)}

56 | } 57 |
58 |
59 | ); 60 | } 61 | } -------------------------------------------------------------------------------- /src/components/app-tabs/app-tabs.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State } from "@stencil/core"; 2 | import { store } from "@stencil/redux"; 3 | import { getString } from "../../global/lang"; 4 | 5 | @Component({ 6 | tag: "app-tabs", 7 | styleUrl: "app-tabs.css" 8 | }) 9 | export class AppTabs { 10 | 11 | @State() lang: any; 12 | 13 | componentWillLoad() { 14 | 15 | store.mapStateToProps(this, state => { 16 | return { 17 | lang: state.device.lang 18 | } 19 | }); 20 | 21 | // Here add action to restore a recording 22 | //this.store.mapDispatchToProps(this, {}); 23 | } 24 | 25 | render() { 26 | return this.lang ? [ 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | {getString("TAB_NAVIGATION", this.lang)} 39 | 40 | 41 | 42 | {getString("TAB_GPSSTATUS", this.lang)} 43 | 44 | 45 | 46 | {getString("TAB_HISTORY", this.lang)} 47 | 48 | 49 | 50 | {getString("TAB_ABOUT", this.lang)} 51 | 52 | 53 | 54 | ] : []; 55 | } 56 | } -------------------------------------------------------------------------------- /src/components/app-offline/app-offline.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h } from '@stencil/core'; 2 | import { toastController, alertController } from '@ionic/core'; 3 | 4 | @Component({ 5 | tag: 'app-offline', 6 | styleUrl: 'app-offline.css' 7 | }) 8 | export class AppOffline { 9 | 10 | async presentToastHistoryM2() { 11 | const toast = await toastController.create({ 12 | message: "Feature Offline mode will be implemented in M2, it will consist in caching the satellite tiles for a selected area", 13 | color: 'dark', 14 | position: 'top', 15 | buttons: [ 16 | { 17 | text: 'OK', 18 | role: 'cancel' 19 | } 20 | ] 21 | }); 22 | 23 | return await toast.present(); 24 | } 25 | 26 | async presentAlertM2Offline() { 27 | const alert = await alertController.create({ 28 | header: 'Download Offline', 29 | subHeader: 'To be implemented in M2', 30 | message: 'This will download satellite imagery of this for offline use, estimated 30 MB', 31 | buttons: ['Cancel', 'Confirm'] 32 | }); 33 | return await alert.present(); 34 | } 35 | 36 | componentDidLoad() { 37 | this.presentToastHistoryM2(); 38 | } 39 | 40 | render() { 41 | return [ 42 | 43 | 44 | 45 | 46 | 47 | Offline mode 48 | 49 | , 50 | 51 | 52 | 53 | 54 | Make area available offline 55 | { 60 | if(event.detail.checked) { 61 | this.presentAlertM2Offline() 62 | } 63 | }} 64 | > 65 | 66 | 67 | 68 | ]; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /ios/App/App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | $(PRODUCT_NAME) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleURLTypes 22 | 23 | 24 | CFBundleURLName 25 | com.getcapacitor.capacitor 26 | CFBundleURLSchemes 27 | 28 | capacitor 29 | 30 | 31 | 32 | CFBundleVersion 33 | $(CURRENT_PROJECT_VERSION) 34 | LSRequiresIPhoneOS 35 | 36 | NSAppTransportSecurity 37 | 38 | NSAllowsArbitraryLoads 39 | 40 | 41 | NSLocationWhenInUseUsageDescription 42 | Allow geolocation for guiding ? 43 | NSPhotoLibraryUsageDescription 44 | To Pick Photos from Library 45 | UILaunchStoryboardName 46 | LaunchScreen 47 | UIMainStoryboardFile 48 | Main 49 | UIRequiredDeviceCapabilities 50 | 51 | armv7 52 | 53 | UISupportedInterfaceOrientations 54 | 55 | UIInterfaceOrientationPortrait 56 | 57 | UISupportedInterfaceOrientations~ipad 58 | 59 | UIInterfaceOrientationPortrait 60 | UIInterfaceOrientationPortraitUpsideDown 61 | UIInterfaceOrientationLandscapeLeft 62 | UIInterfaceOrientationLandscapeRight 63 | 64 | UIViewControllerBasedStatusBarAppearance 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/statemanagement/app/HistoryStateManagement.ts: -------------------------------------------------------------------------------- 1 | // TODO create an object , and probably store as a Map for O(1) read 2 | import { loadState, persistState } from '../../statemanagement/localStorage'; 3 | 4 | 5 | interface HistoryState { 6 | recordings: Array 7 | } 8 | 9 | const getInitialState = (): HistoryState => { 10 | return { 11 | recordings: [] 12 | }; 13 | }; 14 | 15 | 16 | const SAVE_RECORDING = 'History/SAVE_RECORDING'; 17 | const RESTORE_ALL_RECORDINGS = 'History/RESTORE_ALL_RECORDINGS'; 18 | 19 | export function saveRecording(recording) { 20 | return (dispatch) => { 21 | 22 | dispatch({ 23 | type: SAVE_RECORDING, 24 | payload: recording 25 | }) 26 | 27 | dispatch(persistHistory()); 28 | } 29 | } 30 | 31 | export function restoreHistory() { 32 | return (dispatch) => { 33 | const savedState = loadState('history'); 34 | if(savedState) { 35 | dispatch({ 36 | type: RESTORE_ALL_RECORDINGS, 37 | payload: savedState.recordings 38 | }) 39 | } 40 | } 41 | } 42 | 43 | export function persistHistory() { 44 | // @ts-ignore 45 | return (dispatch, getState) => { 46 | persistState(getState().history, 'history'); 47 | } 48 | } 49 | 50 | const historyStateReducer = ( 51 | state = getInitialState(), 52 | action: any 53 | ): HistoryState => { 54 | switch (action.type) { 55 | case SAVE_RECORDING: { 56 | const MAX_ITEMS = 20; 57 | if(state.recordings.length > MAX_ITEMS) { 58 | // Remove oldest item before concat (index 0) 59 | // .filter((_value, index) => index > 0) 60 | return { 61 | ...state, 62 | recordings: state.recordings.concat([action.payload]).filter((_value, index) => index > 0) 63 | }; 64 | } else { 65 | return { 66 | ...state, 67 | recordings: state.recordings.concat([action.payload]) 68 | }; 69 | } 70 | } 71 | case RESTORE_ALL_RECORDINGS: { 72 | return { 73 | ...state, 74 | recordings: action.payload 75 | } 76 | } 77 | } 78 | return state; 79 | }; 80 | 81 | export default historyStateReducer; -------------------------------------------------------------------------------- /src/statemanagement/app/AppStateManagement.ts: -------------------------------------------------------------------------------- 1 | import { loadState, persistState } from '../../statemanagement/localStorage'; 2 | 3 | 4 | interface AppState { 5 | isFirstStart: boolean, 6 | nbOpeningBeforeDisplayingGalileoNotificationAgain: number 7 | } 8 | 9 | const getInitialState = (): AppState => { 10 | return { 11 | isFirstStart: true, 12 | nbOpeningBeforeDisplayingGalileoNotificationAgain: 14 13 | }; 14 | }; 15 | 16 | 17 | const REGISTER_APP_OPENING = 'App/REGISTER_APP_OPENING'; 18 | const RESTORE_APPSTATE = 'App/RESTORE_APPSTATE'; 19 | const RESET_NB_OPENING = 'App/RESET_NB_OPENING'; 20 | 21 | export function registerAppOpening() { 22 | return (dispatch, getState) => { 23 | dispatch({ 24 | type: REGISTER_APP_OPENING, 25 | }) 26 | 27 | if(getState().app.nbOpeningBeforeDisplayingGalileoNotificationAgain < 0) { 28 | dispatch({ 29 | type: RESET_NB_OPENING 30 | }) 31 | } 32 | 33 | persistState(getState().app, 'app'); 34 | } 35 | } 36 | 37 | export function restoreAppState() { 38 | return (dispatch) => { 39 | const savedState = loadState('app'); 40 | if(savedState) { 41 | dispatch({ 42 | type: RESTORE_APPSTATE, 43 | payload: savedState 44 | }) 45 | } 46 | } 47 | } 48 | 49 | 50 | 51 | 52 | const appStateReducer = ( 53 | state = getInitialState(), 54 | action: any 55 | ): AppState => { 56 | switch (action.type) { 57 | case REGISTER_APP_OPENING: { 58 | return { 59 | ...state, 60 | isFirstStart: getInitialState().nbOpeningBeforeDisplayingGalileoNotificationAgain === state.nbOpeningBeforeDisplayingGalileoNotificationAgain && state.isFirstStart, 61 | nbOpeningBeforeDisplayingGalileoNotificationAgain: state.nbOpeningBeforeDisplayingGalileoNotificationAgain - 1 62 | }; 63 | } 64 | case RESET_NB_OPENING: { 65 | return { 66 | ...state, 67 | nbOpeningBeforeDisplayingGalileoNotificationAgain: getInitialState().nbOpeningBeforeDisplayingGalileoNotificationAgain 68 | } 69 | } 70 | case RESTORE_APPSTATE: { 71 | return { 72 | ...state, 73 | ...action.payload 74 | } 75 | } 76 | } 77 | return state; 78 | }; 79 | 80 | export default appStateReducer; -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Tractor Navigator 8 | 9 | 14 | 15 | 16 | 17 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 63 | 64 |
65 | 69 |

Tractor Navigator

70 |
71 | 80 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/components/app-history/app-history.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State } from '@stencil/core'; 2 | import { store } from "@stencil/redux"; 3 | import dayjs from 'dayjs'; 4 | import { getString } from '../../global/lang'; 5 | 6 | 7 | @Component({ 8 | tag: 'app-history', 9 | styleUrl: 'app-history.css' 10 | }) 11 | export class AppHistory { 12 | 13 | @State() recordings: Array 14 | @State() lang: any 15 | 16 | componentWillLoad() { 17 | store.mapStateToProps(this, state => { 18 | const { 19 | history: { recordings }, 20 | device: { lang } 21 | } = state; 22 | return { 23 | recordings, 24 | lang 25 | }; 26 | }); 27 | } 28 | 29 | computeTimeRecording(dateStart, dateEnd) { 30 | var diff = Math.abs(new Date(dateStart).getTime() - new Date(dateEnd).getTime()); 31 | var seconds = Math.floor(diff/1000) % 60; 32 | var minutes = Math.floor((diff/1000)/60); 33 | return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}` 34 | } 35 | 36 | render() { 37 | return [ 38 | 39 | 40 | 41 | 42 | 43 | {getString('TAB_HISTORY', this.lang)} 44 | 45 | , 46 | 47 | 48 | {this.recordings.length > 0 && 49 | 50 | {this.recordings.slice().reverse().map((recording, index) => 51 | 52 | 53 |

{dayjs(recording.dateStart).format('MMM DD, YYYY')}

54 |

{dayjs(recording.dateStart).format('hh:mm a')} - {dayjs(recording.dateEnd).format('hh:mm a')}

55 |
56 |
57 | 58 |
{this.computeTimeRecording(recording.dateStart, recording.dateEnd)}
59 |
60 |
61 | 62 |
{recording.area} ha
63 |
64 |
65 |
66 | 70 | 71 | Details 72 | 73 |
74 | )} 75 |
76 | } 77 | {this.recordings.length === 0 && 78 |
{getString('HISTORY_NO_RECORDING', this.lang)}
79 | } 80 |
81 | ]; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/statemanagement/app/DeviceStateManagement.ts: -------------------------------------------------------------------------------- 1 | import { Plugins } from '@capacitor/core'; 2 | import { simulateGeolocation } from './GeolocationStateManagement'; 3 | const { Device, Network } = Plugins; 4 | 5 | interface DeviceState { 6 | deviceInfo: any 7 | offline: any, 8 | lang: any 9 | } 10 | 11 | const getInitialState = (): DeviceState => { 12 | return { 13 | deviceInfo: null, 14 | offline: false, 15 | lang: 'en' 16 | }; 17 | }; 18 | 19 | const SET_DEVICE_INFO = 'DEVICE/SET_DEVICE_INFO'; 20 | const SET_OFFLINE = 'DEVICE/SET_OFFLINE'; 21 | const SET_LANGUAGE = 'DEVICE/SET_LANGUAGE'; 22 | 23 | export function initNetworkListener() { 24 | return (dispatch) => { 25 | Network.addListener('networkStatusChange', (status) => { 26 | if(status.connected) { 27 | dispatch({ 28 | type: SET_OFFLINE, 29 | payload: false 30 | }) 31 | } else { 32 | dispatch({ 33 | type: SET_OFFLINE, 34 | payload: true 35 | }) 36 | } 37 | }); 38 | Network.getStatus().then((status) => { 39 | if(!status.connected) { 40 | dispatch({ 41 | type: SET_OFFLINE, 42 | payload: true 43 | }) 44 | } 45 | }); 46 | } 47 | } 48 | 49 | export function getDeviceInfo() { 50 | return (dispatch) => { 51 | Device.getInfo().then((deviceInfo) => { 52 | dispatch({ 53 | type: SET_DEVICE_INFO, 54 | payload: deviceInfo 55 | }) 56 | 57 | //console.log(deviceInfo); 58 | 59 | if(deviceInfo.platform === "web") { 60 | //Simulate geolocation 61 | console.log('simulateGeolocation') 62 | simulateGeolocation(); 63 | } else { 64 | // enable do not sleep 65 | // @ts-ignore 66 | window.plugins.insomnia.keepAwake(); 67 | } 68 | }); 69 | 70 | Device.getLanguageCode().then((languageCode) => { 71 | dispatch({ 72 | type: SET_LANGUAGE, 73 | payload: languageCode.value 74 | }) 75 | }) 76 | } 77 | } 78 | 79 | const deviceStateReducer = ( 80 | state = getInitialState(), 81 | action: any 82 | ): DeviceState => { 83 | switch (action.type) { 84 | case SET_DEVICE_INFO: { 85 | return { 86 | ...state, 87 | deviceInfo: action.payload 88 | }; 89 | } 90 | case SET_OFFLINE: { 91 | return { 92 | ...state, 93 | offline: action.payload 94 | } 95 | } 96 | case SET_LANGUAGE: { 97 | return { 98 | ...state, 99 | lang: action.payload 100 | } 101 | } 102 | } 103 | return state; 104 | }; 105 | 106 | export default deviceStateReducer; -------------------------------------------------------------------------------- /src/helpers/utils.ts: -------------------------------------------------------------------------------- 1 | import lineOffset from '@turf/line-offset'; 2 | import { point } from '@turf/helpers'; 3 | import transformScale from '@turf/transform-scale'; 4 | import bboxFromGeojson from '@turf/bbox'; 5 | import bboxPolygon from '@turf/bbox-polygon'; 6 | import computeBearing from '@turf/bearing' 7 | 8 | export function geopositionToObject(geoposition) { 9 | return { 10 | timestamp: geoposition.timestamp, 11 | coords: { 12 | accuracy: geoposition.coords.accuracy, 13 | altitude: geoposition.coords.altitude, 14 | altitudeAccuracy: geoposition.coords.altitudeAccuracy, 15 | heading: geoposition.coords.heading, 16 | latitude: geoposition.coords.latitude, 17 | longitude: geoposition.coords.longitude, 18 | speed: geoposition.coords.speed 19 | } 20 | } 21 | } 22 | 23 | export const blankMapStyle = { 24 | "version": 8, 25 | "sources": { 26 | "point": { 27 | "type": "geojson", 28 | "data": { 29 | "type": "Point", 30 | "coordinates": [0,0] 31 | } 32 | }, 33 | // "mapbox-satellite": { 34 | // "type": "raster", 35 | // "tiles": [`https://api.mapbox.com/styles/v1/mapbox/satellite-v9/tiles/{z}/{x}/{y}?access_token=${config.mapboxToken}`], 36 | // "tileSize": 512 37 | // } 38 | }, 39 | "layers": [ 40 | // { 41 | // "id": "satellite", 42 | // "source": "mapbox-satellite", 43 | // "type": "raster" 44 | // } 45 | // , 46 | { 47 | "id": "point", 48 | "source": "point", 49 | "type": "circle", 50 | "paint": { 51 | "circle-radius": 0.1, 52 | "circle-color": "transparent" 53 | } 54 | }] 55 | } 56 | 57 | // Using this because turf buffer funciton isn't working properly for some reason 58 | // Width in meters 59 | export function lineToPolygon(line, width) { 60 | let offsetLineRight = lineOffset(line, width / 2, {units: 'meters'}); 61 | let offsetLineLeft = lineOffset(line, -width / 2, {units: 'meters'}); 62 | let linePolygonCoordinates = []; 63 | linePolygonCoordinates.push(offsetLineLeft.geometry.coordinates[0]); 64 | offsetLineRight.geometry.coordinates.map((coordinate) => { 65 | linePolygonCoordinates.push(coordinate); 66 | }) 67 | offsetLineLeft.geometry.coordinates.reverse().map((coordinate) => { 68 | linePolygonCoordinates.push(coordinate); 69 | }) 70 | return [linePolygonCoordinates] 71 | } 72 | 73 | // TODO, this probably should go inside the guiding line library 74 | // Bearing of point is -180 - 180 75 | export function isPointOnLeftOfRight(currentHeading, bearingOfPoint) { 76 | // Convert bearing to 0 - 360 77 | var bearing = bearingOfPoint; 78 | if(bearing < 0) { 79 | bearing += 360; 80 | } 81 | if((currentHeading - bearing) > 180 || 82 | (currentHeading - bearing) < 0) { 83 | return "right"; 84 | } else { 85 | return "left"; 86 | } 87 | 88 | } 89 | 90 | export function computeHeading(pointA, pointB) { 91 | // bearing in -180 <-> 180 92 | let heading = computeBearing(point(pointA), point(pointB)); 93 | // Convert bearing to 0 - 360 94 | if(heading < 0) { 95 | heading += 360; 96 | } 97 | return heading; 98 | } 99 | 100 | export function computeLargerBbox(bbox, scaleFactor) { 101 | const bboxAsPolygon = bboxPolygon(bbox); 102 | const scaledBboxPolygon = transformScale(bboxAsPolygon, scaleFactor); 103 | return bboxFromGeojson(scaledBboxPolygon); 104 | } -------------------------------------------------------------------------------- /src/components/app-home/galileo-modal.tsx: -------------------------------------------------------------------------------- 1 | import { Component, State, Element, h } from '@stencil/core'; 2 | import { store } from "@stencil/redux"; 3 | import { AccuracyStatus } from '../../statemanagement/app/GeolocationStateManagement'; 4 | import { getString } from '../../global/lang'; 5 | 6 | @Component({ 7 | tag: 'galileo-modal' 8 | }) 9 | export class GalileoModal { 10 | @Element() el: any; 11 | 12 | @State() rawMeasurements: any 13 | @State() satelliteData: any 14 | @State() isGalileoSupported: any 15 | @State() dualFreqSupported: any 16 | @State() accuracyStatus: AccuracyStatus 17 | 18 | @State() lang: any 19 | 20 | dismiss() { 21 | // dismiss this modal and pass back data 22 | (this.el.closest('ion-modal') as any).dismiss(); 23 | } 24 | 25 | componentWillLoad() { 26 | store.mapStateToProps(this, state => { 27 | const { 28 | gnssmeasurements: { isGalileoSupported, satelliteData, rawMeasurements, dualFreqSupported }, 29 | geolocation: { accuracyStatus }, 30 | device: { lang } 31 | } = state; 32 | return { 33 | isGalileoSupported, 34 | dualFreqSupported, 35 | satelliteData, 36 | rawMeasurements, 37 | accuracyStatus, 38 | lang 39 | }; 40 | }); 41 | } 42 | 43 | render() { 44 | return [ 45 | 46 | 47 | {this.rawMeasurements !== null && 48 | 49 | this.dismiss()}> 50 | 51 | 52 | 53 | } 54 | 55 | Galileo Status 56 | 57 | 58 | , 59 | 60 | 61 | {this.rawMeasurements === null && 62 |
63 |
{getString('FETCHING_GALILEO_STATUS', this.lang)}
64 | 65 |
66 | } 67 | {this.rawMeasurements !== null && 68 |
69 |
70 | {this.isGalileoSupported === true && 71 | this.dualFreqSupported === true && 72 |

{getString('GALILEO_GALILEO_DUALFREQ', this.lang)}

73 | } 74 | {this.isGalileoSupported === true && this.dualFreqSupported !== true && 75 |
76 |

{getString('GALILEO_GALILEO_NO_DUALFREQ', this.lang)}

77 |

You should consider upgrading to a phone that supports dual frequency signals offered by Galileo

78 |
79 | } 80 | {this.isGalileoSupported !== true && 81 |
82 |

{getString('GALILEO_NO_GALILEO_NO_DUALFREQ', this.lang)}

83 |

You will be able to get better accuracy by upgrading to a phone that supports Galileo

84 |
85 | } 86 | Use galileo 87 |
88 |
89 | } 90 |
, 91 | 92 | 93 | 94 | {this.rawMeasurements !== null && 95 | this.dismiss()}>Ok 96 | } 97 | 98 | 99 | ]; 100 | } 101 | } -------------------------------------------------------------------------------- /ios/App/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Capacitor 3 | 4 | @UIApplicationMain 5 | class AppDelegate: UIResponder, UIApplicationDelegate { 6 | 7 | var window: UIWindow? 8 | 9 | 10 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 11 | // Override point for customization after application launch. 12 | return true 13 | } 14 | 15 | func applicationWillResignActive(_ application: UIApplication) { 16 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 17 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 18 | } 19 | 20 | func applicationDidEnterBackground(_ application: UIApplication) { 21 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 22 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 23 | } 24 | 25 | func applicationWillEnterForeground(_ application: UIApplication) { 26 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 27 | } 28 | 29 | func applicationDidBecomeActive(_ application: UIApplication) { 30 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 31 | } 32 | 33 | func applicationWillTerminate(_ application: UIApplication) { 34 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 35 | } 36 | 37 | func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { 38 | // Called when the app was launched with a url. Feel free to add additional processing here, 39 | // but if you want the App API to support tracking app url opens, make sure to keep this call 40 | return CAPBridge.handleOpenUrl(url, options) 41 | } 42 | 43 | func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { 44 | // Called when the app was launched with an activity, including Universal Links. 45 | // Feel free to add additional processing here, but if you want the App API to support 46 | // tracking app url opens, make sure to keep this call 47 | return CAPBridge.handleContinueActivity(userActivity, restorationHandler) 48 | } 49 | 50 | override func touchesBegan(_ touches: Set, with event: UIEvent?) { 51 | super.touchesBegan(touches, with: event) 52 | 53 | let statusBarRect = UIApplication.shared.statusBarFrame 54 | guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return } 55 | 56 | if statusBarRect.contains(touchPoint) { 57 | NotificationCenter.default.post(CAPBridge.statusBarTappedNotification) 58 | } 59 | } 60 | 61 | #if USE_PUSH 62 | 63 | func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { 64 | NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidRegisterForRemoteNotificationsWithDeviceToken.name()), object: deviceToken) 65 | } 66 | 67 | func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { 68 | NotificationCenter.default.post(name: Notification.Name(CAPNotifications.DidFailToRegisterForRemoteNotificationsWithError.name()), object: error) 69 | } 70 | 71 | #endif 72 | 73 | } 74 | 75 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_icon.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /landingpage/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 62 | 64 | 66 | 68 | 70 | 72 | 74 | 75 | -------------------------------------------------------------------------------- /src/statemanagement/app/GnssMeasurementsStateManagement.ts: -------------------------------------------------------------------------------- 1 | import { Plugins } from '@capacitor/core'; 2 | const { GnssMeasurements } = Plugins; 3 | 4 | interface GnssMeasurementsState { 5 | isInitializing: boolean 6 | rawMeasurements: any, 7 | satelliteData: any, 8 | isGalileoSupported: any, 9 | dualFreqSupported: any 10 | } 11 | 12 | /* 13 | { 14 | nbSatellitesInRange 15 | dualFreqSupported 16 | nbGalileoSatelliteInRange 17 | nbGalileoE5SatelliteInRange 18 | nbSatelliteInFix 19 | nbGalileoSatelliteInFix 20 | nbGalileoE5SatelliteInFix 21 | } 22 | */ 23 | 24 | const getInitialState = (): GnssMeasurementsState => { 25 | return { 26 | isInitializing: false, 27 | rawMeasurements: null, 28 | satelliteData: null, 29 | isGalileoSupported: null, 30 | dualFreqSupported: null 31 | }; 32 | }; 33 | 34 | 35 | const SET_GNSSMEASUREMENTS_SUPPORTED = 'GnssMeasurements/SET_GNSSMEASUREMENTS_SUPPORTED'; 36 | const UPDATE_SATELLITE_DATA = 'GnssMeasurements/UPDATE_SATELLITE_DATA'; 37 | const SET_GALILEO_SUPPORT = 'GnssMeasurements/SET_GALILEO_SUPPORT'; 38 | const SET_DUALFREQ_SUPPORT = 'GnssMeasurements/SET_DUALFREQ_SUPPORT'; 39 | const SET_INITIALIZING = 'GnssMeasurements/SET_INITIALIZING'; 40 | 41 | export function initGnssMeasurements(platform) { 42 | return (dispatch) => { 43 | if(platform === "android") { 44 | // dispatch(GnssMeasurements.areGnssMeasurementsSupported()) 45 | GnssMeasurements.init((data) => { 46 | 47 | dispatch({ 48 | type: SET_INITIALIZING, 49 | payload: true 50 | }) 51 | 52 | if(data.gnssMeasurementsSupported) { 53 | 54 | dispatch(setGnssMeasurementsSupported(true)) 55 | 56 | GnssMeasurements.watchSatellite((satelliteData) => { 57 | 58 | if(satelliteData.nbGalileoSatelliteInRange > 0) { 59 | dispatch(setGalileoSupport(true)); 60 | } 61 | 62 | if(satelliteData.dualFreqSupported) { 63 | dispatch(setDualFreqSupport(satelliteData.dualFreqSupported)); 64 | } 65 | 66 | // new satellite update 67 | dispatch({ 68 | type: UPDATE_SATELLITE_DATA, 69 | payload: satelliteData 70 | }) 71 | }); 72 | } else { 73 | dispatch(setGnssMeasurementsSupported(false)) 74 | } 75 | 76 | dispatch({ 77 | type: SET_INITIALIZING, 78 | payload: false 79 | }) 80 | }) 81 | } else if(platform === "web") { 82 | // simulate raw measurements to work on API 83 | dispatch(setGnssMeasurementsSupported(true)) 84 | dispatch(setGalileoSupport(true)) 85 | dispatch(setDualFreqSupport(true)) 86 | } else { 87 | dispatch(setGnssMeasurementsSupported(false)) 88 | dispatch(setGalileoSupport(true)) 89 | dispatch(setDualFreqSupport(false)) 90 | // TODO hardcode from deviceName for iOS 91 | } 92 | } 93 | } 94 | 95 | export function setGalileoSupport(isSupported) { 96 | return { 97 | type: SET_GALILEO_SUPPORT, 98 | payload: isSupported 99 | } 100 | } 101 | 102 | export function setDualFreqSupport(isSupported) { 103 | return { 104 | type: SET_DUALFREQ_SUPPORT, 105 | payload: isSupported 106 | } 107 | } 108 | 109 | 110 | export function setGnssMeasurementsSupported(areSupported) { 111 | return { 112 | type: SET_GNSSMEASUREMENTS_SUPPORTED, 113 | payload: areSupported 114 | } 115 | } 116 | 117 | const GnssMeasurementsStateStateReducer = ( 118 | state = getInitialState(), 119 | action: any 120 | ): GnssMeasurementsState => { 121 | switch (action.type) { 122 | case SET_GNSSMEASUREMENTS_SUPPORTED: { 123 | return { 124 | ...state, 125 | rawMeasurements: action.payload 126 | }; 127 | } 128 | case UPDATE_SATELLITE_DATA: { 129 | return { 130 | ...state, 131 | satelliteData: action.payload 132 | }; 133 | } 134 | case SET_GALILEO_SUPPORT: { 135 | return { 136 | ...state, 137 | isGalileoSupported: action.payload 138 | } 139 | } 140 | case SET_DUALFREQ_SUPPORT: { 141 | return { 142 | ...state, 143 | dualFreqSupported: action.payload 144 | } 145 | } 146 | case SET_INITIALIZING: { 147 | return { 148 | ...state, 149 | isInitializing: action.payload 150 | } 151 | } 152 | } 153 | return state; 154 | }; 155 | 156 | export default GnssMeasurementsStateStateReducer; -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /src/helpers/geolocationsimulator.js: -------------------------------------------------------------------------------- 1 | var KM_IN_DEGREE = 110.562, 2 | SECONDS_IN_HOUR = 3600, 3 | UPDATE_INTERVAL = 1000; 4 | 5 | export default function Geosimulation(params) { 6 | var self = {}; 7 | //private vars 8 | var _watchTimer = null, 9 | _coords = params.coords, 10 | _speed = (params.speed || 40) / SECONDS_IN_HOUR, // km/second (defaults to 40kmh or 25mph) 11 | _current = { 12 | coords: { 13 | latitude: 0, 14 | longitude: 0, 15 | accuracy: 3, 16 | altitude: null, 17 | altitudeAccuracy: null, 18 | heading: null, 19 | speed: null 20 | }, 21 | timestamp: 1 22 | }, 23 | _rate = { latitude: 0, longitude: 0 }, 24 | _index = -1, 25 | _pauseTimeout, 26 | _numSteps, 27 | _currentStep; 28 | 29 | //public functions 30 | self.start = function () { 31 | nextCoord(); 32 | }; 33 | 34 | /** 35 | * Since not all browsers implement this we have our own utility that will 36 | * convert from radians into degrees 37 | * 38 | * @param rad - The radians to be converted into degrees 39 | * @return degrees 40 | */ 41 | function _toDeg(rad) { 42 | return rad * 180 / Math.PI; 43 | } 44 | 45 | /** 46 | * Calculate the bearing between two positions as a value from 0-360 47 | * 48 | * @param lat1 - The latitude of the first position 49 | * @param lng1 - The longitude of the first position 50 | * @param lat2 - The latitude of the second position 51 | * @param lng2 - The longitude of the second position 52 | * 53 | * @return int - The bearing between 0 and 360 54 | */ 55 | function bearing(lat1,lng1,lat2,lng2) { 56 | var dLon = (lng2-lng1); 57 | var y = Math.sin(dLon) * Math.cos(lat2); 58 | var x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon); 59 | var brng = _toDeg(Math.atan2(y, x)); 60 | return 360 - ((brng + 360) % 360); 61 | } 62 | 63 | //private functions 64 | 65 | //advance to next coordinate in array 66 | function nextCoord() { 67 | _index++; 68 | //check if route completed 69 | if (_index < _coords.length - 1) { 70 | var coord = _coords[_index]; 71 | 72 | //set current coordinate, to make sure it makes the jump 73 | _current.coords.latitude = coord.latitude; 74 | _current.coords.longitude = coord.longitude; 75 | _current.coords.heading = coord.heading; 76 | 77 | //set rate of change 78 | //distance between points with direction for lat and lon (km) 79 | var deltaLat = (_coords[_index + 1].latitude - coord.latitude) * KM_IN_DEGREE, 80 | deltaLon = (_coords[_index + 1].longitude - coord.longitude) * KM_IN_DEGREE; 81 | 82 | //as the crow flies distance (km) 83 | var deltaDist = Math.sqrt((deltaLat * deltaLat) + (deltaLon * deltaLon)); 84 | 85 | //total time between points at desired speed (sec) 86 | var deltaSeconds = Math.floor(deltaDist / _speed); 87 | 88 | //rate of change for each update (1 sec) in lat/lon 89 | _rate.latitude = deltaLat / deltaSeconds / KM_IN_DEGREE; 90 | _rate.longitude = deltaLon / deltaSeconds / KM_IN_DEGREE; 91 | 92 | //total steps aka number of seconds 93 | _numSteps = deltaSeconds; 94 | _currentStep = 0; 95 | 96 | //check for pause request 97 | if (coord.pause) { 98 | console.log('(stops to smell the roses* for', Math.floor(coord.pause / 1000), 'seconds)'); 99 | _pauseTimeout = setTimeout(step, coord.pause); 100 | } else { 101 | //prpceed at regular interval 102 | setTimeout(step, UPDATE_INTERVAL); 103 | } 104 | } else { 105 | //path is complete 106 | alert('you have arrived!'); 107 | } 108 | } 109 | 110 | //advance to next update along path between points 111 | function step() { 112 | _currentStep++; 113 | if (_currentStep < _numSteps) { 114 | var _previousLat = _current.coords.latitude; 115 | var _previousLng = _current.coords.longitude; 116 | _current.coords.latitude += _rate.latitude; 117 | _current.coords.longitude += _rate.longitude; 118 | _current.coords.heading = bearing( 119 | _previousLat, 120 | _previousLng, 121 | _current.coords.latitude, 122 | _current.coords.longitude 123 | ) 124 | setTimeout(step, UPDATE_INTERVAL); 125 | } else { 126 | nextCoord(); 127 | } 128 | } 129 | 130 | //override native geolocation 131 | navigator.geolocation.getCurrentPosition = function (cb, error, options) { 132 | cb(_current); 133 | }; 134 | 135 | navigator.geolocation.watchPosition = function (cb, error, options) { 136 | var sendPos = function () { 137 | cb(_current); 138 | _watchTimer = setTimeout(sendPos, 1000); 139 | }; 140 | sendPos(); 141 | }; 142 | 143 | navigator.geolocation.clearWatch = function () { 144 | clearTimeout(_watchTimer); 145 | }; 146 | 147 | return self; 148 | }; 149 | 150 | //utils 151 | //add convert to radian method for numbers 152 | if (typeof (Number.prototype.toRad) === "undefined") { 153 | Number.prototype.toRad = function () { 154 | return this * Math.PI / 180; 155 | } 156 | } -------------------------------------------------------------------------------- /src/components/app-home/guiding-interface.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State, Prop } from '@stencil/core'; 2 | import { store, Action } from "@stencil/redux"; 3 | import { startRecording, resumeRecording, stopRecordingAndSave, cancelRecording, pauseRecording, RecordingStatus } from '../../statemanagement/app/RecordingStateManagement'; 4 | import { startDefiningGuidingLines } from '../../statemanagement/app/GuidingStateManagement'; 5 | import { GeolocationPosition } from '@capacitor/core'; 6 | import { getString } from '../../global/lang'; 7 | 8 | @Component({ 9 | tag: 'guiding-interface', 10 | styleUrl: 'guiding-interface.css' 11 | }) 12 | export class GuidingInterface { 13 | 14 | @State() status: RecordingStatus; 15 | 16 | @State() lang: any; 17 | 18 | startRecording: Action; 19 | resumeRecording: Action; 20 | pauseRecording: Action; 21 | stopRecordingAndSave: Action; 22 | startDefiningGuidingLines: Action; 23 | cancelRecording: Action; 24 | 25 | dateStart: string; 26 | area: number; 27 | equipmentWidth: number; 28 | 29 | 30 | @Prop() position: GeolocationPosition; 31 | 32 | 33 | @State() distanceToClosestGuidingLine: number; 34 | @State() isGuidingLineOnRightOrLeft: string; 35 | 36 | private router: HTMLIonRouterElement = document.querySelector('ion-router') 37 | 38 | componentWillLoad() { 39 | store.mapStateToProps(this, state => { 40 | const { 41 | recording: { status, dateStart, area }, 42 | guiding: { distanceToClosestGuidingLine, isGuidingLineOnRightOrLeft, equipmentWidth }, 43 | device: { lang } 44 | } = state; 45 | return { 46 | status, 47 | distanceToClosestGuidingLine, 48 | isGuidingLineOnRightOrLeft, 49 | dateStart, 50 | area, 51 | equipmentWidth, 52 | lang 53 | }; 54 | }); 55 | 56 | store.mapDispatchToProps(this, { 57 | startRecording, 58 | resumeRecording, 59 | pauseRecording, 60 | stopRecordingAndSave, 61 | startDefiningGuidingLines, 62 | cancelRecording 63 | }); 64 | } 65 | 66 | goToHistory() { 67 | this.router.push('history', 'forward'); 68 | } 69 | 70 | render() { 71 | 72 | const isRecordingOrPaused = (this.status === RecordingStatus.Recording || this.status === RecordingStatus.Paused) 73 | 74 | if(isRecordingOrPaused) { 75 | var diff = Math.abs(new Date(this.dateStart).getTime() - new Date().getTime()); 76 | var seconds = Math.floor(diff/1000) % 60; 77 | var minutes = Math.floor((diff/1000)/60); 78 | } 79 | 80 | return ( 81 |
82 |
83 | {isRecordingOrPaused && 84 |
85 |
86 | 87 |
{minutes.toString().padStart(2, '0')}:{seconds.toString().padStart(2, '0')}
88 |
89 |
90 | 91 |
{this.area} ha
92 |
93 |
94 | 95 |
{this.equipmentWidth} m
96 |
97 |
98 | } 99 |
100 | 104 |
105 |
106 |
107 | {this.status === RecordingStatus.Idle && 108 |
109 | this.startDefiningGuidingLines() } 112 | > 113 | 114 | 115 | { 118 | this.startRecording() 119 | }} 120 | > 121 | {getString('START_RECORDING_CTA', this.lang)} 122 | 123 |
124 | } 125 | {isRecordingOrPaused && 126 |
127 | this.cancelRecording() } 130 | > 131 | {getString('CANCEL', this.lang)} 132 | 133 | { 136 | this.stopRecordingAndSave() 137 | this.goToHistory() 138 | }} 139 | > 140 | {getString('SAVE_CTA', this.lang)} 141 | 142 | 143 | {this.status === RecordingStatus.Recording && 144 | this.pauseRecording()}> 145 | 146 | 147 | } 148 | {this.status === RecordingStatus.Paused && 149 | this.resumeRecording()}> 150 | 151 | 152 | } 153 | 154 |
155 | } 156 | 157 |
158 |
159 | ); 160 | } 161 | } -------------------------------------------------------------------------------- /src/global/lang.ts: -------------------------------------------------------------------------------- 1 | const en = { 2 | CANCEL: "Cancel", 3 | GETTING_POSITION: "Getting your position...", 4 | LOADING_MAP: "Loading map...", 5 | START_GUIDING_CTA: "Start guiding", 6 | DEFINING_GUIDING_LINE_START: "Defining guiding reference line, go to starting point and confirm", 7 | CONFIRM: "Confirm", 8 | BACK: "Back", 9 | OK: "OK", 10 | CONFIRM_POINT_A: "Start reference", 11 | CONFIRM_POINT_B: "End reference", 12 | DEFINING_GUIDING_LINE_START_CONFIRMED: "Starting point of reference line defined, go to end point and confirm", 13 | SPECIFY_EQUIPMENT_WIDTH: "Specify equipment width (meters)", 14 | START_RECORDING_CTA: "Start recording", 15 | SAVE_CTA: "Save", 16 | POOR_ACCURACY: "Poor positioning accuracy", 17 | MEDIUM_ACCURACY: "Medium positioning accuracy", 18 | GOOD_ACCURACY: "Good positioning accuracy", 19 | TAB_NAVIGATION: "Navigation", 20 | TAB_GPSSTATUS: "GPS Status", 21 | TAB_HISTORY: "History", 22 | TAB_ABOUT: "About", 23 | FETCHING_GALILEO_STATUS: "Fetching Galileo status...", 24 | POOR_GALILEO_DUAL_FREQ: "Your phone supports Galileo and can receive dual frequency signals, you should be able to get a much better accuracy... Try to move in an open sky environment", 25 | POOR_GALILEO_NO_DUAL_FREQ: "Your phone supports Galileo but can't receive dual frequency signals, you should be able to get medium accuracy ... Try to move in an open sky environment", 26 | POOR_NO_GALILEO_NO_DUAL_FREQ: "Your phone does not support Galileo and can't receive dual frequency signals, your positioning accuracy will be limited.", 27 | MEDIUM_GALILEO_DUAL_FREQ: "Your phone supports Galileo and can receive dual frequency signals, you should be able to get a better accuracy. Try to move in an open sky environment", 28 | MEDIUM_GALILEO_NO_DUAL_FREQ: "Your phone supports Galileo but can't receive dual frequency signals, you won't be able to get a better accuracy than this with this phone.", 29 | GOOD_GALILEO_DUAL_FREQ: "Your phone supports Galileo and can receive dual frequency signals, you have the best accuracy possible thanks to Galileo.", 30 | GALILEO_GALILEO_DUALFREQ: "Your phone supports Galileo and can receive dual frequency signals, you are able to get the best accuracy possible thanks to Galileo.", 31 | GALILEO_GALILEO_NO_DUALFREQ: "Your phone supports Galileo but can't receive dual frequency signals.", 32 | GALILEO_NO_GALILEO_NO_DUALFREQ: "Your phone does not support Galileo, your positioning accuracy will be limited.", 33 | HISTORY_NO_RECORDING: "No recording yet.", 34 | SATELLITE_STATUS: "Satellite status", 35 | NB_SATELLITE_IN_RANGE: "Number of satellites in range", 36 | NB_GALILEO_SATELLITE_IN_RANGE: "Number of Galileo satellites in range", 37 | NB_SATELLITE_USED: "Number of satellites used", 38 | NB_GALILEO_SATELLITE_USED: "Number of Galileo satellites used", 39 | } 40 | 41 | const fr = { 42 | CANCEL: "Annuler", 43 | GETTING_POSITION: "En attente de votre position...", 44 | LOADING_MAP: "Chargement carte...", 45 | START_GUIDING_CTA: "Démarrer guidage", 46 | DEFINING_GUIDING_LINE_START: "Définition de la ligne de référence, allez au point de départ et confirmez", 47 | CONFIRM: "Confirmer", 48 | BACK: "Retour", 49 | OK: "OK", 50 | CONFIRM_POINT_A: "Début référence", 51 | CONFIRM_POINT_B: "Fin référence", 52 | EFINING_GUIDING_LINE_START_CONFIRMED: "Point de départ de la ligne de référence confirmé, aller à la fin de votre première ligne et confirmez", 53 | SPECIFY_EQUIPMENT_WIDTH: "Taille de l'outil (en mètres)", 54 | START_RECORDING_CTA: "Démarrer enregistrement", 55 | SAVE_CTA: "Sauvegarder", 56 | POOR_ACCURACY: "Mauvais positionnement GPS", 57 | MEDIUM_ACCURACY: "Positionnement GPS moyen", 58 | GOOD_ACCURACY: "Bon positionnement GPS", 59 | TAB_NAVIGATION: "Navigation", 60 | TAB_GPSSTATUS: "GPS Status", 61 | TAB_HISTORY: "Historique", 62 | TAB_ABOUT: "A propos", 63 | FETCHING_GALILEO_STATUS: "Chargement du status Galileo...", 64 | POOR_GALILEO_DUAL_FREQ: "Votre téléphone supporte Galileo et peut recevoir les signaux double fréquence, vous devriez pouvoir avoir une meilleure précision... Essayez d’aller dans un endroit dégagé.", 65 | POOR_GALILEO_NO_DUAL_FREQ: "Votre téléphone supporte Galileo mais ne peut pas recevoir les signaux double fréquence, cependant vous devriez pouvoir avoir une meilleure précision... Essayez d’aller dans un endroit dégagé.", 66 | POOR_NO_GALILEO_NO_DUAL_FREQ: "Votre téléphone ne supporte pas Galileo, votre précision sera limitée.", 67 | MEDIUM_GALILEO_DUAL_FREQ: "Votre téléphone supporte Galileo et peut recevoir les signaux double fréquence, vous devriez pouvoir avoir une meilleure précision... Essayez d’aller dans un endroit dégagé.", 68 | MEDIUM_GALILEO_NO_DUAL_FREQ: "Votre téléphone supporte Galileo mais ne peut pas recevoir les signaux double fréquence, vous n’aurez pas de bien meilleure précision", 69 | GOOD_GALILEO_DUAL_FREQ: "Votre téléphone supporte Galileo et peut recevoir les signaux double fréquence, vous avez la meilleure précision possible grâce à Galileo.", 70 | GALILEO_GALILEO_DUALFREQ: "Votre téléphone supporte Galileo et peut recevoir les signaux double fréquence, vous avez la meilleure précision possible grâce à Galileo.", 71 | GALILEO_GALILEO_NO_DUALFREQ: "Votre téléphone supporte galileo mais ne peut pas recevoir les signaux double fréquence", 72 | GALILEO_NO_GALILEO_NO_DUALFREQ: "Votre téléphone ne supporte pas galileo, votre précision sera limitée.", 73 | HISTORY_NO_RECORDING: "Pas d'enregistrement pour l'instant", 74 | SATELLITE_STATUS: "Satellite status", 75 | NB_SATELLITE_IN_RANGE: "Nombre de satellite dans le champs de vision", 76 | NB_GALILEO_SATELLITE_IN_RANGE: "Nombre de satellite Galileo dans le champs de vision", 77 | NB_SATELLITE_USED: "Nombre de satellite utilisés", 78 | NB_GALILEO_SATELLITE_USED: "Nombre de satellite Galileo utilisés", 79 | } 80 | 81 | export function getString(id, lang) { 82 | if(lang.indexOf('fr') > -1) { 83 | return fr[id] || ''; 84 | } else { 85 | return en[id] || ''; 86 | } 87 | } -------------------------------------------------------------------------------- /ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"72x72","expected-size":"72","filename":"72.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"76x76","expected-size":"152","filename":"152.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"50x50","expected-size":"100","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"76x76","expected-size":"76","filename":"76.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"50x50","expected-size":"50","filename":"50.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"72x72","expected-size":"144","filename":"144.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"40x40","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"83.5x83.5","expected-size":"167","filename":"167.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"size":"20x20","expected-size":"20","filename":"20.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"1x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"ipad","scale":"2x"},{"idiom":"watch","filename":"172.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"86x86","expected-size":"172","role":"quickLook"},{"idiom":"watch","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"40x40","expected-size":"80","role":"appLauncher"},{"idiom":"watch","filename":"88.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"40mm","scale":"2x","size":"44x44","expected-size":"88","role":"appLauncher"},{"idiom":"watch","filename":"100.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"44mm","scale":"2x","size":"50x50","expected-size":"100","role":"appLauncher"},{"idiom":"watch","filename":"196.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"42mm","scale":"2x","size":"98x98","expected-size":"196","role":"quickLook"},{"idiom":"watch","filename":"216.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"44mm","scale":"2x","size":"108x108","expected-size":"216","role":"quickLook"},{"idiom":"watch","filename":"48.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"38mm","scale":"2x","size":"24x24","expected-size":"48","role":"notificationCenter"},{"idiom":"watch","filename":"55.png","folder":"Assets.xcassets/AppIcon.appiconset/","subtype":"42mm","scale":"2x","size":"27.5x27.5","expected-size":"55","role":"notificationCenter"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"watch","role":"companionSettings","scale":"3x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"watch","role":"companionSettings","scale":"2x"},{"size":"1024x1024","expected-size":"1024","filename":"1024.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"watch-marketing","scale":"1x"},{"size":"128x128","expected-size":"128","filename":"128.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"256x256","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"128x128","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"256x256","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"512x512","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"16","filename":"16.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"64","filename":"64.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"512x512","expected-size":"1024","filename":"1024.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"}]} -------------------------------------------------------------------------------- /src/components/app-gpsstatus/app-gpsstatus.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State } from '@stencil/core'; 2 | import { store } from "@stencil/redux"; 3 | import { AccuracyStatus } from '../../statemanagement/app/GeolocationStateManagement'; 4 | import { getString } from '../../global/lang'; 5 | 6 | @Component({ 7 | tag: 'app-gpsstatus', 8 | styleUrl: 'app-gpsstatus.css' 9 | }) 10 | export class AppGPSStatus { 11 | 12 | @State() rawMeasurements: any 13 | @State() satelliteData: any 14 | @State() isGalileoSupported: any 15 | @State() dualFreqSupported: any 16 | @State() accuracyStatus: AccuracyStatus 17 | 18 | @State() lang: any 19 | 20 | componentWillLoad() { 21 | store.mapStateToProps(this, state => { 22 | const { 23 | gnssmeasurements: { isGalileoSupported, satelliteData, rawMeasurements, dualFreqSupported }, 24 | geolocation: { accuracyStatus }, 25 | device: { lang } 26 | } = state; 27 | return { 28 | isGalileoSupported, 29 | dualFreqSupported, 30 | satelliteData, 31 | rawMeasurements, 32 | accuracyStatus, 33 | lang 34 | }; 35 | }); 36 | } 37 | 38 | render() { 39 | return [ 40 | 41 | 42 | 43 | 44 | 45 | {getString('TAB_GPSSTATUS', this.lang)} 46 | 47 | , 48 | 49 | {this.rawMeasurements === null && 50 |
51 |
{getString('FETCHING_GALILEO_STATUS', this.lang)}
52 | 53 |
54 | } 55 | {this.rawMeasurements !== null && 56 |
57 | 58 | {this.accuracyStatus === AccuracyStatus.Poor && 59 |
60 | {this.isGalileoSupported === true && this.dualFreqSupported === true && 61 |

{getString('POOR_GALILEO_DUAL_FREQ', this.lang)}

62 | } 63 | {this.isGalileoSupported === true && this.dualFreqSupported !== true && 64 |

{getString('POOR_GALILEO_NO_DUAL_FREQ', this.lang)}

65 | } 66 | {this.isGalileoSupported !== true && this.dualFreqSupported !== true && 67 |

{getString('POOR_NO_GALILEO_NO_DUAL_FREQ', this.lang)}

68 | } 69 |
70 | } 71 | {this.accuracyStatus === AccuracyStatus.Medium && 72 |
73 | {this.isGalileoSupported === true && this.dualFreqSupported === true && 74 |

{getString('MEDIUM_GALILEO_DUAL_FREQ', this.lang)}

75 | } 76 | {this.isGalileoSupported === true && this.dualFreqSupported !== true && 77 |
78 |

{getString('MEDIUM_GALILEO_NO_DUAL_FREQ', this.lang)}

79 |
80 | } 81 |
82 | } 83 | {this.accuracyStatus === AccuracyStatus.Good && 84 |
85 | {this.isGalileoSupported === true && 86 | this.dualFreqSupported === true && 87 |

{getString('GOOD_GALILEO_DUAL_FREQ', this.lang)}

88 | } 89 |
90 | } 91 |
92 | {this.isGalileoSupported === true && this.dualFreqSupported === false && 93 |

You will be able to get better accuracy by upgrading to a phone that supports dual frequency signals offered by Galileo

94 | } 95 | {this.isGalileoSupported === false && 96 |

You will be able to get better accuracy by upgrading to a phone that supports Galileo

97 | } 98 | Use galileo 99 |
100 |
101 | } 102 | {this.rawMeasurements !== null && this.satelliteData && 103 |
104 |

{getString('SATELLITE_STATUS', this.lang)}

105 |
    106 |
  • {getString('NB_SATELLITE_IN_RANGE', this.lang)}: {this.satelliteData.nbSatellitesInRange}
  • 107 |
  • {getString('NB_GALILEO_SATELLITE_IN_RANGE', this.lang)}: {this.satelliteData.nbGalileoSatelliteInRange}
  • 108 |
  • {getString('NB_SATELLITE_USED', this.lang)}: {this.satelliteData.nbSatelliteInFix}
  • 109 |
  • {getString('NB_GALILEO_SATELLITE_USED', this.lang)}: {this.satelliteData.nbGalileoSatelliteInFix}
  • 110 |
111 |
112 | } 113 | {this.lang.indexOf('fr') > -1 && 114 |
115 |

A propos de la précision de positionnement

116 |

La précision de positionnement renvoyée par votre téléphone dépend de plusieurs facteurs:

117 |
    118 |
  • Est-ce que votre téléphone est compatibles avec la constellation de satellites Galileo ?
  • 119 |
  • Est ce qu’il supporte les signaux doubles fréquences ?
  • 120 |
  • Combien de satellites sont dans le champs de vision de l’antenne ?
  • 121 |
  • Êtes-vous dans une environnement ouvert, en ville, ou proche d’obstacles ?
  • 122 |
123 |
124 | } 125 | {this.lang.indexOf('fr') <= -1 && 126 |
127 |

About positioning accuracy

128 |

Your phone positioning accuracy depends on multiple factors:

129 |
    130 |
  • Is it compatible with the Galileo constellation ?
  • 131 |
  • Does it support receiving multiple frequency signals ?
  • 132 |
  • How many satellites does it has currently in sight ?
  • 133 |
  • Are you in an open sky or urban area environment ?
  • 134 |
135 |
136 | } 137 |
138 | ]; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/components/app-history/app-history-details.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State, Prop, Watch } from '@stencil/core'; 2 | import { store } from "@stencil/redux"; 3 | import mapboxgl from 'mapbox-gl'; 4 | import { lineString, multiPolygon } from '@turf/helpers'; 5 | import bbox from '@turf/bbox'; 6 | import config from '../../config.json'; 7 | import dayjs from 'dayjs'; 8 | 9 | import { lineToPolygon } from '../../helpers/utils'; 10 | 11 | //import { styleMapboxOffline } from '../../helpers/utils'; 12 | // import { blankMapStyle } from '../../helpers/utils'; 13 | 14 | @Component({ 15 | tag: 'app-history-details' 16 | }) 17 | export class AppHistoryDetails { 18 | 19 | @Prop() indexOfRecording: number; 20 | 21 | @State() recording: any; 22 | @Watch('recording') 23 | recordingChangeHandler() { 24 | this.updateMapDisplay(); 25 | } 26 | 27 | map: any; 28 | mapIsReady: boolean = false; 29 | mapFirstRender: boolean = false; 30 | 31 | componentWillLoad() { 32 | 33 | store.mapStateToProps(this, state => { 34 | return { 35 | recording: state.history.recordings[this.indexOfRecording] 36 | } 37 | }); 38 | 39 | // Here add action to restore a recording 40 | //this.store.mapDispatchToProps(this, {}); 41 | } 42 | 43 | componentDidLoad() { 44 | 45 | // if online 46 | let mapStyle = 'mapbox://styles/mapbox/satellite-v9'; 47 | // else 48 | // mapStyle = blankMapStyle; 49 | // TODO implement a reducer that watch network status and change 50 | // blankMap -> satellite map 51 | // // If online, set satellite 52 | //this.map.setStyle('mapbox://styles/mapbox/satellite-v9'); 53 | 54 | mapboxgl.accessToken = config.mapboxToken; 55 | this.map = new mapboxgl.Map({ 56 | container: 'mapHistoryDetails', 57 | style: mapStyle, 58 | zoom: 18 59 | }); 60 | 61 | var nav = new mapboxgl.NavigationControl({ 62 | showCompass: false 63 | }); 64 | this.map.addControl(nav, 'top-right'); 65 | 66 | //const navControl = new mapboxgl.NavigationControl(); 67 | //this.map.addControl(navControl, 'top-right'); 68 | 69 | this.map.on('render', () => { 70 | if (!this.mapFirstRender) { 71 | this.mapFirstRender = true; 72 | this.map.resize(); 73 | } 74 | }) 75 | 76 | this.map.on('style.load', () => { 77 | // Triggered when `setStyle` is called. 78 | this.updateMapDisplay(); 79 | }); 80 | 81 | this.map.on('load', () => { 82 | this.mapIsReady = true; 83 | this.map.resize(); 84 | 85 | // Init source 86 | // Position 87 | this.updateMapDisplay(); 88 | }); 89 | } 90 | 91 | addOrUpdateTraceHistory(positionsHistory, equipmentWidth) { 92 | const layerAndSourceId = 'trace-history'; 93 | if (positionsHistory[0].length > 1) { 94 | let source = this.map.getSource(layerAndSourceId); 95 | // TODO replace 10 by tool width 96 | // Could improve perfs of this by avoiding recomputing everything each new position, but just push the new ones... 97 | const traceAsPolygons = positionsHistory.map((positions) => { 98 | if(positions.length > 1) { 99 | let linePositionHistory = lineString(positions); 100 | // This doesn't work if line history contains duplicates 101 | // Using this because turf buffer funciton isn't working properly for some reason 102 | let traceAsPolygon = lineToPolygon(linePositionHistory, equipmentWidth) 103 | return traceAsPolygon; 104 | } 105 | }).filter((polygon) => polygon !== undefined); 106 | 107 | const traceAsMultiPolygon = multiPolygon(traceAsPolygons); 108 | const bboxOfTrace = bbox(traceAsMultiPolygon); 109 | // Fit map to bbox 110 | this.map.fitBounds(bboxOfTrace, { 111 | padding: {top: 50, bottom:50, left: 50, right: 50}, 112 | duration: 1, 113 | maxZoom: 18 114 | }); 115 | if (source) { 116 | source.setData(traceAsMultiPolygon) 117 | } else { 118 | console.log('Create position source and layer'); 119 | this.map.addSource(layerAndSourceId, { 120 | "type": "geojson", 121 | "data": traceAsMultiPolygon 122 | }); 123 | this.map.addLayer({ 124 | "id": layerAndSourceId, 125 | "source": layerAndSourceId, 126 | "type": "fill", 127 | "paint": { 128 | "fill-color": "blue", 129 | "fill-opacity": 0.4 130 | } 131 | }) 132 | } 133 | return layerAndSourceId; 134 | } 135 | } 136 | 137 | removeSourceAndLayerIfExists(id) { 138 | if(this.map.getSource(id)) { 139 | this.map.removeLayer(id); 140 | this.map.removeSource(id); 141 | } 142 | } 143 | 144 | updateMapDisplay() { 145 | if(!this.mapIsReady) { 146 | return; 147 | } 148 | this.addOrUpdateTraceHistory(this.recording.trace, this.recording.equipmentWidth); 149 | 150 | } 151 | 152 | computeTimeRecording(dateStart, dateEnd) { 153 | var diff = Math.abs(new Date(dateStart).getTime() - new Date(dateEnd).getTime()); 154 | var seconds = Math.floor(diff/1000) % 60; 155 | var minutes = Math.floor((diff/1000)/60); 156 | return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}` 157 | } 158 | 159 | render() { 160 | return [ 161 | 162 | 163 | 164 | 165 | 166 | Map 167 | 168 | , 169 | 170 | 171 |
172 | {this.recording && 173 | 187 | } 188 |
189 |
190 |
191 | ]; 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /src/components/app-home/guiding-setup.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, Prop, State } from '@stencil/core'; 2 | import { store, Action } from "@stencil/redux"; 3 | import { setReferenceLine, setEquipmentWidth, resetGuidingState } from '../../statemanagement/app/GuidingStateManagement'; 4 | import { GeolocationPosition } from '@capacitor/core'; 5 | import distance from '@turf/distance'; 6 | import { point } from '@turf/helpers'; 7 | import { getString } from '../../global/lang'; 8 | 9 | 10 | @Component({ 11 | tag: 'guiding-setup', 12 | styleUrl: 'guiding-setup.css' 13 | }) 14 | export class GuidingSetup { 15 | 16 | position: GeolocationPosition; 17 | 18 | @State() referenceLine: Array>; 19 | @State() equipmentWidth: number; 20 | 21 | @State() lang: any; 22 | 23 | @Prop() handleGuidingLinesDefined: Function; 24 | setReferenceLine: Action; 25 | setEquipmentWidth: Action; 26 | resetGuidingState: Action; 27 | 28 | componentWillLoad() { 29 | store.mapStateToProps(this, state => { 30 | const { 31 | guiding: { referenceLine, equipmentWidth }, 32 | geolocation: { position }, 33 | device: { lang } 34 | } = state; 35 | return { 36 | referenceLine, 37 | equipmentWidth, 38 | position, 39 | lang 40 | }; 41 | }); 42 | 43 | store.mapDispatchToProps(this, { 44 | setReferenceLine, 45 | setEquipmentWidth, 46 | resetGuidingState 47 | }); 48 | } 49 | 50 | render() { 51 | return ( 52 |
53 | {this.referenceLine.length === 0 && 54 |
55 |
56 | {getString('DEFINING_GUIDING_LINE_START', this.lang)} 57 |
58 |
59 | 62 | this.resetGuidingState() 63 | } 64 | > 65 | {getString('BACK', this.lang)} 66 | 67 | 70 | this.setReferenceLine([[this.position.coords.longitude, this.position.coords.latitude]]) 71 | } 72 | > 73 | {getString('CONFIRM_POINT_A', this.lang)} 74 | 75 |
76 |
77 | } 78 | {this.referenceLine.length === 1 && 79 |
80 |
81 | {getString('DEFINING_GUIDING_LINE_START_CONFIRMED', this.lang)} 82 |
83 |
84 | this.setReferenceLine([]) } 87 | > 88 | {getString('BACK', this.lang)} 89 | 90 | { 93 | // only confirm is distance between two points is more than 1 meter 94 | if( 95 | distance( 96 | point(this.referenceLine[0]), 97 | point([this.position.coords.longitude, this.position.coords.latitude]) 98 | ) > 0.001 99 | ) { 100 | this.setReferenceLine([this.referenceLine[0], [this.position.coords.longitude, this.position.coords.latitude]]) 101 | } 102 | }} 103 | > 104 | {getString('CONFIRM_POINT_B', this.lang)} 105 | 106 |
107 |
108 | } 109 | {this.referenceLine.length === 2 && 110 |
111 |
112 |
113 | 114 | {getString('SPECIFY_EQUIPMENT_WIDTH', this.lang)} 115 | { 121 | this.setEquipmentWidth(Math.round( event.target.value * 10) / 10) 122 | }} 123 | > 124 | 125 |
126 | this.setReferenceLine([this.referenceLine[0]]) } 129 | > 130 | {getString('BACK', this.lang)} 131 | 132 | this.handleGuidingLinesDefined()} 135 | > 136 | {getString('OK', this.lang)} 137 | 138 |
139 |
140 |
141 | } 142 |
143 | ); 144 | } 145 | } -------------------------------------------------------------------------------- /src/statemanagement/app/MapStateManagement.ts: -------------------------------------------------------------------------------- 1 | import distance from '@turf/distance'; 2 | import { point } from '@turf/helpers'; 3 | import computeBearing from '@turf/bearing'; 4 | 5 | const MIN_DISTANCE_TO_MOVE_VIEW = 5; 6 | const ZOOMED_OUT = 18; 7 | const ZOOMED_IN = 19; 8 | 9 | interface MapState { 10 | mapView: any 11 | } 12 | 13 | const getInitialState = (): MapState => { 14 | return { 15 | mapView: null 16 | }; 17 | }; 18 | 19 | const SET_MAP_VIEW = 'Map/SET_MAP_VIEW'; 20 | const DO_ZOOM_IN = 'Map/ZOOM_IN'; 21 | const DO_ZOOM_OUT = 'Map/DO_ZOOM_OUT'; 22 | const SET_PITCH = 'Map/SET_PITCH'; 23 | const SET_ZOOM = 'Map/SET_ZOOM'; 24 | 25 | 26 | export function setMapView(mapView) { 27 | return { 28 | type: SET_MAP_VIEW, 29 | payload: mapView 30 | } 31 | } 32 | 33 | export function zoomIn() { 34 | return { 35 | type: DO_ZOOM_IN 36 | } 37 | } 38 | 39 | export function zoomOut() { 40 | return { 41 | type: DO_ZOOM_OUT 42 | } 43 | } 44 | 45 | export function setZoom(zoom) { 46 | return { 47 | type: SET_ZOOM, 48 | payload: zoom 49 | } 50 | } 51 | 52 | 53 | export function set2D() { 54 | return { 55 | type: SET_PITCH, 56 | payload: 0 57 | } 58 | } 59 | 60 | export function set3D() { 61 | return { 62 | type: SET_PITCH, 63 | payload: 60 64 | } 65 | } 66 | 67 | export function handleNewPosition(newPosition, forceRefresh = false) { 68 | return (dispatch, getState) => { 69 | let currentMapView = getState().map.mapView; 70 | let guidingLines = getState().guiding.guidingLines; 71 | 72 | // Init mapview 73 | if(currentMapView === null) { 74 | dispatch(setMapView({ 75 | center: [newPosition.coords.longitude, newPosition.coords.latitude], 76 | bearing: 0, 77 | pitch: 0, 78 | zoom: ZOOMED_OUT 79 | })) 80 | } else { 81 | // Check if newPosition distance to lastPosition 82 | let lastViewPosition = point(currentMapView.center) 83 | let distanceFromLastView = distance(lastViewPosition, [newPosition.coords.longitude, newPosition.coords.latitude]) * 1000; 84 | // In case of guidingLines status defined / undefined, need to forceRefresh 85 | if(distanceFromLastView > MIN_DISTANCE_TO_MOVE_VIEW || forceRefresh) { 86 | // Define bearing (maybe reason on average 2-3 last positions...) 87 | let currentBearing = currentMapView.bearing; 88 | let newBearing = newPosition.coords.heading; 89 | let pitch = currentMapView.pitch; 90 | let zoom = currentMapView.zoom; 91 | let center = [newPosition.coords.longitude, newPosition.coords.latitude]; 92 | if(newBearing) { 93 | if(guidingLines) { 94 | let bearingGuidingLines = computeBearing(point(guidingLines.referenceLine[0]), point(guidingLines.referenceLine[1])) 95 | // Convert bearingGuidingLines to [ 0º - 360º ] 96 | if(bearingGuidingLines < 0) { 97 | bearingGuidingLines += 360; 98 | } 99 | // Change currentBearing to the closest guidingLine bearing (one side of the other) 100 | if(Math.abs(newBearing - bearingGuidingLines) < 90) { 101 | newBearing = bearingGuidingLines; 102 | } else { 103 | // Reverse bearingGuidingLines 104 | if(bearingGuidingLines > 180) { 105 | newBearing = bearingGuidingLines - 180; 106 | } else { 107 | newBearing = bearingGuidingLines + 180; 108 | } 109 | } 110 | 111 | if(forceRefresh) { 112 | // Zoom and pitch 113 | pitch = 60; 114 | zoom = ZOOMED_IN; 115 | } 116 | 117 | } else { 118 | // Update bearing in view only if bearing changed 119 | // more than -90º / +90º from current bearing 120 | if(Math.abs(newBearing - currentBearing) < 90) { 121 | newBearing = currentBearing; 122 | } else { 123 | newBearing = newBearing; 124 | } 125 | 126 | if(forceRefresh) { 127 | // Zoom and pitch 128 | pitch = 0; 129 | zoom = ZOOMED_OUT; 130 | } 131 | } 132 | } else { 133 | newBearing = currentBearing; 134 | } 135 | 136 | dispatch(setMapView({ 137 | center: center, 138 | bearing: newBearing, 139 | pitch: pitch, 140 | zoom: zoom, 141 | offset: [0, 60] // TODO set offset depending on map size on screen 142 | })) 143 | } 144 | } 145 | } 146 | } 147 | 148 | const mapStateReducer = ( 149 | state = getInitialState(), 150 | action: any 151 | ): MapState => { 152 | switch (action.type) { 153 | case SET_MAP_VIEW: { 154 | return { 155 | ...state, 156 | mapView: action.payload 157 | }; 158 | } 159 | case DO_ZOOM_IN: { 160 | return { 161 | ...state, 162 | mapView: { 163 | ...state.mapView, 164 | zoom: Math.min(state.mapView.zoom + 1, 22) 165 | } 166 | } 167 | } 168 | case DO_ZOOM_OUT: { 169 | return { 170 | ...state, 171 | mapView: { 172 | ...state.mapView, 173 | zoom: Math.max(state.mapView.zoom - 1, 15) 174 | } 175 | } 176 | } 177 | case SET_PITCH: { 178 | return { 179 | ...state, 180 | mapView: { 181 | ...state.mapView, 182 | pitch: action.payload 183 | } 184 | } 185 | } 186 | case SET_ZOOM: { 187 | return { 188 | ...state, 189 | mapView: { 190 | ...state.mapView, 191 | zoom: action.payload 192 | } 193 | } 194 | } 195 | } 196 | return state; 197 | }; 198 | 199 | export default mapStateReducer; -------------------------------------------------------------------------------- /src/statemanagement/app/RecordingStateManagement.ts: -------------------------------------------------------------------------------- 1 | import { saveRecording } from "./HistoryStateManagement"; 2 | import { resetGuidingState } from "./GuidingStateManagement"; 3 | import { lineToPolygon } from "../../helpers/utils"; 4 | import { lineString, multiPolygon } from '@turf/helpers'; 5 | import computeArea from "@turf/area"; 6 | 7 | export enum RecordingStatus { Idle, Recording, Paused} 8 | 9 | interface RecordingState { 10 | status: RecordingStatus 11 | recordedPositions: Array>> 12 | area: number 13 | equipmentWidth: number 14 | dateStart: string 15 | 16 | } 17 | 18 | const getInitialState = (): RecordingState => { 19 | return { 20 | status: RecordingStatus.Idle, 21 | recordedPositions: [[]], 22 | area: 0.00, 23 | equipmentWidth: null, 24 | dateStart: null 25 | }; 26 | }; 27 | 28 | 29 | const SET_STATUS = 'Recording/SET_STATUS'; 30 | const ADD_RECORDED_POSITION = 'Recording/ADD_RECORDED_POSITION'; 31 | const PAUSE_RECORDING = 'Recording/PAUSE_RECORDING'; 32 | const SET_AREA = 'Recording/SET_AREA'; 33 | const INIT_RECORDING_METADATA = 'Recording/INIT_RECORDING_METADATA'; 34 | const RESET = 'Recording/RESET'; 35 | 36 | export function setStatus(status: RecordingStatus) { 37 | return { 38 | type: SET_STATUS, 39 | payload: status 40 | } 41 | } 42 | 43 | export function setArea(area) { 44 | return { 45 | type: SET_AREA, 46 | payload: area 47 | } 48 | } 49 | 50 | export function addRecordedPosition(position) { 51 | return { 52 | type: ADD_RECORDED_POSITION, 53 | payload: position 54 | } 55 | } 56 | 57 | export function resetRecordingState() { 58 | return { 59 | type: RESET 60 | } 61 | } 62 | 63 | export function initRecordingMetadata(dateStart, equipmentWidth) { 64 | return { 65 | type: INIT_RECORDING_METADATA, 66 | payload: { 67 | dateStart: dateStart, 68 | equipmentWidth: equipmentWidth 69 | } 70 | } 71 | } 72 | 73 | export function recordingOnNewPosition(newPosition) { 74 | return (dispatch, getState) => { 75 | // If is recording, add to history 76 | if(getState().recording.status === RecordingStatus.Recording) { 77 | dispatch(addRecordedPosition(newPosition)); 78 | 79 | const traceAsPolygons = getState().recording.recordedPositions.map((positions) => { 80 | if(positions.length > 1) { 81 | let linePositionHistory = lineString(positions); 82 | // This doesn't work if line history contains duplicates 83 | // Using this because turf buffer funciton isn't working properly for some reason 84 | let traceAsPolygon = lineToPolygon(linePositionHistory, getState().recording.equipmentWidth) 85 | return traceAsPolygon; 86 | } 87 | }).filter((polygon) => polygon !== undefined); 88 | 89 | if(traceAsPolygons.length > 0) { 90 | const traceAsMultiPolygon = multiPolygon(traceAsPolygons); 91 | // Area in ha 92 | const area = Math.round((computeArea(traceAsMultiPolygon) / 10000) * 100) / 100; 93 | dispatch(setArea(area)); 94 | } 95 | } 96 | } 97 | } 98 | 99 | export function startRecording() { 100 | return (dispatch, getState) => { 101 | // get equipmentWidth 102 | const equipmentWidth = getState().guiding.equipmentWidth; 103 | // set metadata 104 | dispatch(initRecordingMetadata(new Date().toISOString(), equipmentWidth)) 105 | dispatch(setStatus(RecordingStatus.Recording)) 106 | } 107 | } 108 | 109 | export function pauseRecording() { 110 | return (dispatch) => { 111 | // set status 112 | dispatch(setStatus(RecordingStatus.Paused)) 113 | dispatch({ 114 | type: PAUSE_RECORDING 115 | }) 116 | } 117 | } 118 | 119 | export function resumeRecording() { 120 | return (dispatch) => { 121 | // set status 122 | dispatch(setStatus(RecordingStatus.Recording)) 123 | } 124 | } 125 | 126 | export function cancelRecording() { 127 | return (dispatch) => { 128 | dispatch(setStatus(RecordingStatus.Idle)) 129 | // Reset state 130 | dispatch(resetRecordingState()); 131 | } 132 | } 133 | 134 | export function stopRecordingAndSave() { 135 | return (dispatch, getState) => { 136 | dispatch(setStatus(RecordingStatus.Idle)) 137 | // Save recording in history 138 | dispatch(saveRecording({ 139 | dateStart: getState().recording.dateStart, 140 | dateEnd: new Date().toISOString(), 141 | area: getState().recording.area, 142 | trace: getState().recording.recordedPositions, 143 | equipmentWidth: getState().recording.equipmentWidth 144 | })) 145 | // Reset state 146 | dispatch(resetRecordingState()); 147 | // Reset guiding 148 | dispatch(resetGuidingState()); 149 | 150 | } 151 | } 152 | 153 | 154 | 155 | const recordingStateReducer = ( 156 | state = getInitialState(), 157 | action: any 158 | ): RecordingState => { 159 | switch (action.type) { 160 | case INIT_RECORDING_METADATA: { 161 | return { 162 | ...state, 163 | dateStart: action.payload.dateStart, 164 | equipmentWidth: action.payload.equipmentWidth 165 | }; 166 | } 167 | case ADD_RECORDED_POSITION: { 168 | if(state.recordedPositions.length > 1) { 169 | const newRecordedPositions = [ 170 | ...state.recordedPositions.slice(0, state.recordedPositions.length - 1), 171 | state.recordedPositions[state.recordedPositions.length - 1].concat([action.payload]) 172 | ] 173 | return { 174 | ...state, 175 | recordedPositions: newRecordedPositions 176 | }; 177 | } else { 178 | return { 179 | ...state, 180 | recordedPositions: [ 181 | state.recordedPositions[state.recordedPositions.length - 1].concat([action.payload]) 182 | ] 183 | }; 184 | } 185 | } 186 | case PAUSE_RECORDING: { 187 | return { 188 | ...state, 189 | recordedPositions: [ 190 | ...state.recordedPositions, 191 | [] 192 | ] 193 | }; 194 | } 195 | case SET_STATUS: { 196 | return { 197 | ...state, 198 | status: action.payload 199 | }; 200 | } 201 | case SET_AREA: { 202 | return { 203 | ...state, 204 | area: action.payload 205 | }; 206 | } 207 | case RESET: { 208 | return getInitialState() 209 | } 210 | } 211 | return state; 212 | }; 213 | 214 | export default recordingStateReducer; -------------------------------------------------------------------------------- /src/components/app-about/app-about.tsx: -------------------------------------------------------------------------------- 1 | import { Component, h, State } from '@stencil/core'; 2 | import { getString } from '../../global/lang'; 3 | import { store } from "@stencil/redux"; 4 | 5 | @Component({ 6 | tag: 'app-about', 7 | styleUrl: 'app-about.css' 8 | }) 9 | export class AppAbout { 10 | 11 | @State() lang: any 12 | 13 | componentWillLoad() { 14 | store.mapStateToProps(this, state => { 15 | const { 16 | device: { lang } 17 | } = state; 18 | return { 19 | lang 20 | }; 21 | }); 22 | } 23 | 24 | render() { 25 | return [ 26 | 27 | 28 | 29 | 30 | 31 | {getString('TAB_HISTORY', this.lang)} 32 | 33 | , 34 | 35 | 36 | 37 | {this.lang.indexOf('fr') > -1 && 38 |
39 |

Cette application a été développée dans le cadre du MyGalileoApp Challenge 2019

40 |

Le projet est OpenSource (license MIT)

41 |

https://github.com/tdurand/tractornavigator

42 |

Equipe

43 |
    44 |
  • Vincent Duret
  • 45 |
  • Thibault Durand
  • 46 |
47 |

A propos de MyGalileoApp Challenge

48 |

L’agence du GNSS européen (GSA) a organisé un concours dans lequel des développeurs conçoivent, développent, testent et rendent disponible une application fonctionnelle afin de mettre en avant les avantages liés à Galileo en terme de précision et de disponibilité de signaux de localisation.

49 |

Les gagnants de ce challenge reçoivent un prix pouvant aller jusqu’à 100 000 euros. Quelque soit les domaines d’applications, la réalité augmentée, le geo-marketing, la navigation adaptative, les réseaux sociaux, etc… GSA souhaite soutenir les développeurs afin que leurs idées prennent forme et deviennent réalité..

50 |

Le concours “MyGalileoApp Challenge” a pour but de lancer une application mobile qui fournit une géolocalisation grâce aux smartphones recevant les signaux de Galileo que ce soit sur la plateforme Android ou iOS. Elle doit également mettre en avant l’importance de Galileo en terme de précision et de disponibilité de signal dans une solution multi constellation / multi fréquences dans le cadre de son utilisation.

51 |

A propos de Galileo

52 |

Galileo est le système de positionnement par satellites (GNSS) sous contrôle civile qui fournit des information de localisation, navigation et de temps pour les utilisateurs du monde entier.

53 |

Galileo améliore le quotidien de nombreux services, entreprises et utilisateurs européens. Par exemple, des utilisateurs peuvent connaîtres leur position exacte avec une précision accrue grâce à la prise en compte de la constellation de satellites Galileo. Le fonctionnement double fréquence avec Galileo offre de nombreux avantages et améliorations en terme de précision et de stabilité de signal.

54 |

Aussi, dans un monde où la navigation par satellite a une importance grandissante et dans lequel de nombreux services en sont dépendant, des perturbations ou erreurs ne sont plus acceptables. Galileo permet à l’Europe d’être indépendante sur ce secteur et ainsi d’assurer une stabilité économique en maintenant une disponibilité des ses applications et services. En résumé, Galileo est un catalyseur pour l’innovation Européenne en contribuant directement à la création de nombreux nouveaux produits, emplois tout en permettant à l’Europe d’avoir une part encore plus importante sur le marché mondial des ces services.

55 |

Comment la navigation par satellites fonctionne ? GNSS (constellation de satellites) envoie des signaux aux antennes terrestres qui elles même renvoient à l’utilisateur des informations de positions et de temps. Afin d’avoir une mesure précise de cette position et temps, un minimum de 4 satellites est nécessaire. Le nombre de satellites visibles par l’antenne de l’utilisateur est ce qui détermine la précision. Plus il y aura de satellites disponibles ou visibles plus précise sera l’information renvoyée par l’antenne à l’utilisateur.

56 |
57 | } 58 | {this.lang.indexOf('fr') === -1 && 59 |
60 |

This app is developed as part of the MyGalileoApp Challenge 2019

61 |

It is an Open Source project (license MIT)

62 |

https://github.com/tdurand/tractornavigator

63 |

Team

64 |
    65 |
  • Vincent Duret
  • 66 |
  • Thibault Durand
  • 67 |
68 |

About MyGalileoApp Challenge

69 |

The European GNSS Agency’s (GSA) MyGalileoApp prize competition challenges developers to design, develop, test and launch a mobile application that takes advantage of the increased accuracy and availability provided by Galileo.

70 |

The winners take home up to EUR 100,000. Whether it be in the area of augmented reality, geo- marketing, smart navigation, social networking or otherwise – the GSA wants to help you take your idea from concept to reality.

71 |

The MyGalileoApp prize Competition challenges to launch a mobile application that provides a position and/or time fix using a Galileo-enabled smartphone equipped with Android /iOS operating system. It must also demonstrate how the increased accuracy/availability provided by Galileo within a multi-constellation/multi- frequency solution adds value to the application.

72 |

About Galileo

73 |

Galileo is the European Global Navigation Satellite System (GNSS) under civilian control, providing a range of positioning, navigation and timing services to users worldwide. Galileo offers benefits for many European services, businesses and users. For example, users can know their exact position with greater precision thanks to the multi- constellation of receivers that Galileo add to. Galileo’s dual frequency capability offers significant advantages in terms of achievable accuracy, but also in terms of improved resistance to jamming.

74 |

Last but not least, due to the ever-growing importance and dependence of satellite navigation applications a potential disruption of a satellite navigation service is unacceptable. Galileo ensures independence that is important to the EU economy, securing the availability of those applications and services. In short, Galileo boosts European innovation, contributing to the creation of many new products and services, creating jobs and allowing Europe to own a greater share of the global market for added value services.

75 |

How does satellite navigation work? Global Navigation Satellite Systems send signals to receivers, giving time and positioning information to users. To get an accurate measurement of your time and position, a minimum of four satellites in view are needed. The number of satellites in view of the user’s receiver is what determines how accurately time and location can be worked out. The more satellites in view, the more precise the information received will be.

76 |
77 | } 78 |
79 | ]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/tractornavigator/MathUtils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2013-2018 The Android Open Source Project, Sean J. Barbeau (sjbarbeau@gmail.com), 3 | * Google (fuzzyEquals() is from Guava) 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.tractornavigator; 18 | 19 | import android.util.Base64; 20 | 21 | import java.io.UnsupportedEncodingException; 22 | import java.text.NumberFormat; 23 | import java.text.ParseException; 24 | 25 | /** 26 | * A utility class containing arithmetic and geometry helper methods. 27 | * 28 | */ 29 | public class MathUtils { 30 | 31 | /** 32 | * Calculates {@code a mod b} in a way that respects negative values (for example, 33 | * {@code mod(-1, 5) == 4}, rather than {@code -1}). 34 | * 35 | * (from Glass Compass sample) 36 | * 37 | * @param a the dividend 38 | * @param b the divisor 39 | * @return {@code a mod b} 40 | */ 41 | public static float mod(float a, float b) { 42 | return (a % b + b) % b; 43 | } 44 | 45 | /** 46 | * Converts the provided number in Hz to MHz 47 | * @param hertz value to be converted 48 | * @return value converted to MHz 49 | */ 50 | public static float toMhz(float hertz) { 51 | return hertz / 1000000.00f; 52 | } 53 | 54 | /** 55 | * Returns {@code true} if {@code a} and {@code b} are within {@code tolerance} of each other. 56 | * 57 | *

Technically speaking, this is equivalent to {@code Math.abs(a - b) <= tolerance || 58 | * Double.valueOf(a).equals(Double.valueOf(b))}. 59 | * 60 | *

Notable special cases include: 61 | * 62 | *

    63 | *
  • All NaNs are fuzzily equal. 64 | *
  • If {@code a == b}, then {@code a} and {@code b} are always fuzzily equal. 65 | *
  • Positive and negative zero are always fuzzily equal. 66 | *
  • If {@code tolerance} is zero, and neither {@code a} nor {@code b} is NaN, then {@code a} 67 | * and {@code b} are fuzzily equal if and only if {@code a == b}. 68 | *
  • With {@link Double#POSITIVE_INFINITY} tolerance, all non-NaN values are fuzzily equal. 69 | *
  • With finite tolerance, {@code Double.POSITIVE_INFINITY} and {@code 70 | * Double.NEGATIVE_INFINITY} are fuzzily equal only to themselves. 71 | *
72 | * 73 | *

This is reflexive and symmetric, but not transitive, so it is not an 74 | * equivalence relation and not suitable for use in {@link Object#equals} 75 | * implementations. 76 | * 77 | * @throws IllegalArgumentException if {@code tolerance} is {@code < 0} or NaN 78 | * @since 13.0 79 | */ 80 | public static boolean fuzzyEquals(double a, double b, double tolerance) { 81 | checkNonNegative("tolerance", tolerance); 82 | return Math.copySign(a - b, 1.0) <= tolerance 83 | // copySign(x, 1.0) is a branch-free version of abs(x), but with different NaN semantics 84 | || (a == b) // needed to ensure that infinities equal themselves 85 | || (Double.isNaN(a) && Double.isNaN(b)); 86 | } 87 | 88 | static double checkNonNegative(String role, double x) { 89 | if (!(x >= 0)) { // not x < 0, to work with NaN. 90 | throw new IllegalArgumentException(role + " (" + x + ") must be >= 0"); 91 | } 92 | return x; 93 | } 94 | 95 | /** 96 | * Converts the provided value "a" value to a value "b" given a range of possible values for "a" 97 | * ("minA" and "maxA") and a range of possible values for b ("minB" and "maxB"). 98 | * 99 | * If a is less than minA, then minB is returned. If a is more than maxA, then maxB is returned. 100 | * 101 | * @param a the value to be mapped to the range between minB and maxB 102 | * @param minA the minimum value of the range of a 103 | * @param maxA the maximum value of the range of a 104 | * @param minB the minimum value of the range of b 105 | * @param maxB the maximum value of the range of b 106 | * @return the value of b as it relates to the values minB and maxB, based on the provided value a 107 | * and it's range of minA and maxA 108 | */ 109 | public static float mapToRange(float a, float minA, float maxA, 110 | float minB, float maxB) { 111 | // If the value is outside the range return the min or max accordingly 112 | if (a < minA) { 113 | return minB; 114 | } 115 | if (a > maxA) { 116 | return maxB; 117 | } 118 | 119 | // Shift ranges to calculate percentages (because default min value may not be 0) 120 | final float maxBshifted = maxB - minB; 121 | final float maxAshifted = maxA - minA; 122 | 123 | // Calculate percentage of given a value to the a range 124 | final float aPercent = (100 * (a - minA)) / maxAshifted; 125 | 126 | // Apply percentage to adjusted b range 127 | final float bShifted = (maxBshifted * aPercent) / 100; 128 | 129 | // Shift b value back using original b range offset and return 130 | return bShifted + minB; 131 | } 132 | 133 | /** 134 | * Returns true if the provided value is a valid floating point value for signal strength, or false if it's not 135 | * @return true if the provided value is a valid floating point value for signal strength, or false if it's not 136 | */ 137 | public static boolean isValidFloat(float value) { 138 | return value != 0.0f && !Float.isNaN(value); 139 | } 140 | 141 | /** 142 | * Clamps a value between the given positive min and max. If abs(value) is less than 143 | * min, then min is returned. If abs(value) is greater than max, then max is returned. 144 | * If abs(value) is between min and max, then abs(value) is returned. 145 | * 146 | * @param min minimum allowed value 147 | * @param value value to be evaluated 148 | * @param max maximum allowed value 149 | * @return clamped value between the min and max 150 | */ 151 | public static double clamp(double min, double value, double max) { 152 | value = Math.abs(value); 153 | if (value >= min && value <= max) { 154 | return value; 155 | } else { 156 | return (value < min ? value : max); 157 | } 158 | } 159 | 160 | /** 161 | * Converts the provided base 64 string to UTF-8 162 | * @param base64 the base 64 string to convert to UTF-8 163 | * @return the input string converted to UTF-8 164 | */ 165 | public static String fromBase64(String base64) throws UnsupportedEncodingException { 166 | byte[] data = Base64.decode(base64, Base64.DEFAULT); 167 | return new String(data, "UTF-8"); 168 | } 169 | 170 | /** 171 | * Converts the provided string input to a double, and handles locale issues such as commas 172 | * instead of periods. Does NOT validate input. 173 | * @param input string version of double to be converted 174 | * @return double value of the input string, or null if there is a parsing error 175 | */ 176 | public static Double toDouble(String input) { 177 | try { 178 | return NumberFormat.getInstance().parse(input).doubleValue(); 179 | } catch (ParseException e) { 180 | e.printStackTrace(); 181 | return null; 182 | } 183 | } 184 | } -------------------------------------------------------------------------------- /src/components.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | /* tslint:disable */ 3 | /** 4 | * This is an autogenerated file created by the Stencil compiler. 5 | * It contains typing information for all components that exist in this project. 6 | */ 7 | import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; 8 | import { GeolocationPosition } from "@capacitor/core"; 9 | export namespace Components { 10 | interface AccuracyHelper { 11 | } 12 | interface AppAbout { 13 | } 14 | interface AppGpsstatus { 15 | } 16 | interface AppHistory { 17 | } 18 | interface AppHistoryDetails { 19 | "indexOfRecording": number; 20 | } 21 | interface AppHome { 22 | } 23 | interface AppOffline { 24 | } 25 | interface AppRoot { 26 | } 27 | interface AppTabs { 28 | } 29 | interface GalileoModal { 30 | } 31 | interface GuidingHelper { 32 | "distanceToClosestGuidingLine": number; 33 | "isGuidingLineOnRightOrLeft": string; 34 | } 35 | interface GuidingInterface { 36 | "position": GeolocationPosition; 37 | } 38 | interface GuidingSetup { 39 | "handleGuidingLinesDefined": Function; 40 | } 41 | } 42 | declare global { 43 | interface HTMLAccuracyHelperElement extends Components.AccuracyHelper, HTMLStencilElement { 44 | } 45 | var HTMLAccuracyHelperElement: { 46 | prototype: HTMLAccuracyHelperElement; 47 | new (): HTMLAccuracyHelperElement; 48 | }; 49 | interface HTMLAppAboutElement extends Components.AppAbout, HTMLStencilElement { 50 | } 51 | var HTMLAppAboutElement: { 52 | prototype: HTMLAppAboutElement; 53 | new (): HTMLAppAboutElement; 54 | }; 55 | interface HTMLAppGpsstatusElement extends Components.AppGpsstatus, HTMLStencilElement { 56 | } 57 | var HTMLAppGpsstatusElement: { 58 | prototype: HTMLAppGpsstatusElement; 59 | new (): HTMLAppGpsstatusElement; 60 | }; 61 | interface HTMLAppHistoryElement extends Components.AppHistory, HTMLStencilElement { 62 | } 63 | var HTMLAppHistoryElement: { 64 | prototype: HTMLAppHistoryElement; 65 | new (): HTMLAppHistoryElement; 66 | }; 67 | interface HTMLAppHistoryDetailsElement extends Components.AppHistoryDetails, HTMLStencilElement { 68 | } 69 | var HTMLAppHistoryDetailsElement: { 70 | prototype: HTMLAppHistoryDetailsElement; 71 | new (): HTMLAppHistoryDetailsElement; 72 | }; 73 | interface HTMLAppHomeElement extends Components.AppHome, HTMLStencilElement { 74 | } 75 | var HTMLAppHomeElement: { 76 | prototype: HTMLAppHomeElement; 77 | new (): HTMLAppHomeElement; 78 | }; 79 | interface HTMLAppOfflineElement extends Components.AppOffline, HTMLStencilElement { 80 | } 81 | var HTMLAppOfflineElement: { 82 | prototype: HTMLAppOfflineElement; 83 | new (): HTMLAppOfflineElement; 84 | }; 85 | interface HTMLAppRootElement extends Components.AppRoot, HTMLStencilElement { 86 | } 87 | var HTMLAppRootElement: { 88 | prototype: HTMLAppRootElement; 89 | new (): HTMLAppRootElement; 90 | }; 91 | interface HTMLAppTabsElement extends Components.AppTabs, HTMLStencilElement { 92 | } 93 | var HTMLAppTabsElement: { 94 | prototype: HTMLAppTabsElement; 95 | new (): HTMLAppTabsElement; 96 | }; 97 | interface HTMLGalileoModalElement extends Components.GalileoModal, HTMLStencilElement { 98 | } 99 | var HTMLGalileoModalElement: { 100 | prototype: HTMLGalileoModalElement; 101 | new (): HTMLGalileoModalElement; 102 | }; 103 | interface HTMLGuidingHelperElement extends Components.GuidingHelper, HTMLStencilElement { 104 | } 105 | var HTMLGuidingHelperElement: { 106 | prototype: HTMLGuidingHelperElement; 107 | new (): HTMLGuidingHelperElement; 108 | }; 109 | interface HTMLGuidingInterfaceElement extends Components.GuidingInterface, HTMLStencilElement { 110 | } 111 | var HTMLGuidingInterfaceElement: { 112 | prototype: HTMLGuidingInterfaceElement; 113 | new (): HTMLGuidingInterfaceElement; 114 | }; 115 | interface HTMLGuidingSetupElement extends Components.GuidingSetup, HTMLStencilElement { 116 | } 117 | var HTMLGuidingSetupElement: { 118 | prototype: HTMLGuidingSetupElement; 119 | new (): HTMLGuidingSetupElement; 120 | }; 121 | interface HTMLElementTagNameMap { 122 | "accuracy-helper": HTMLAccuracyHelperElement; 123 | "app-about": HTMLAppAboutElement; 124 | "app-gpsstatus": HTMLAppGpsstatusElement; 125 | "app-history": HTMLAppHistoryElement; 126 | "app-history-details": HTMLAppHistoryDetailsElement; 127 | "app-home": HTMLAppHomeElement; 128 | "app-offline": HTMLAppOfflineElement; 129 | "app-root": HTMLAppRootElement; 130 | "app-tabs": HTMLAppTabsElement; 131 | "galileo-modal": HTMLGalileoModalElement; 132 | "guiding-helper": HTMLGuidingHelperElement; 133 | "guiding-interface": HTMLGuidingInterfaceElement; 134 | "guiding-setup": HTMLGuidingSetupElement; 135 | } 136 | } 137 | declare namespace LocalJSX { 138 | interface AccuracyHelper { 139 | } 140 | interface AppAbout { 141 | } 142 | interface AppGpsstatus { 143 | } 144 | interface AppHistory { 145 | } 146 | interface AppHistoryDetails { 147 | "indexOfRecording"?: number; 148 | } 149 | interface AppHome { 150 | } 151 | interface AppOffline { 152 | } 153 | interface AppRoot { 154 | } 155 | interface AppTabs { 156 | } 157 | interface GalileoModal { 158 | } 159 | interface GuidingHelper { 160 | "distanceToClosestGuidingLine"?: number; 161 | "isGuidingLineOnRightOrLeft"?: string; 162 | } 163 | interface GuidingInterface { 164 | "position"?: GeolocationPosition; 165 | } 166 | interface GuidingSetup { 167 | "handleGuidingLinesDefined"?: Function; 168 | } 169 | interface IntrinsicElements { 170 | "accuracy-helper": AccuracyHelper; 171 | "app-about": AppAbout; 172 | "app-gpsstatus": AppGpsstatus; 173 | "app-history": AppHistory; 174 | "app-history-details": AppHistoryDetails; 175 | "app-home": AppHome; 176 | "app-offline": AppOffline; 177 | "app-root": AppRoot; 178 | "app-tabs": AppTabs; 179 | "galileo-modal": GalileoModal; 180 | "guiding-helper": GuidingHelper; 181 | "guiding-interface": GuidingInterface; 182 | "guiding-setup": GuidingSetup; 183 | } 184 | } 185 | export { LocalJSX as JSX }; 186 | declare module "@stencil/core" { 187 | export namespace JSX { 188 | interface IntrinsicElements { 189 | "accuracy-helper": LocalJSX.AccuracyHelper & JSXBase.HTMLAttributes; 190 | "app-about": LocalJSX.AppAbout & JSXBase.HTMLAttributes; 191 | "app-gpsstatus": LocalJSX.AppGpsstatus & JSXBase.HTMLAttributes; 192 | "app-history": LocalJSX.AppHistory & JSXBase.HTMLAttributes; 193 | "app-history-details": LocalJSX.AppHistoryDetails & JSXBase.HTMLAttributes; 194 | "app-home": LocalJSX.AppHome & JSXBase.HTMLAttributes; 195 | "app-offline": LocalJSX.AppOffline & JSXBase.HTMLAttributes; 196 | "app-root": LocalJSX.AppRoot & JSXBase.HTMLAttributes; 197 | "app-tabs": LocalJSX.AppTabs & JSXBase.HTMLAttributes; 198 | "galileo-modal": LocalJSX.GalileoModal & JSXBase.HTMLAttributes; 199 | "guiding-helper": LocalJSX.GuidingHelper & JSXBase.HTMLAttributes; 200 | "guiding-interface": LocalJSX.GuidingInterface & JSXBase.HTMLAttributes; 201 | "guiding-setup": LocalJSX.GuidingSetup & JSXBase.HTMLAttributes; 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /src/statemanagement/app/GuidingStateManagement.ts: -------------------------------------------------------------------------------- 1 | import { isPointOnLeftOfRight, computeLargerBbox } from "../../helpers/utils"; 2 | import GuidingLines from '../../helpers/guidinglines'; 3 | import { loadState, persistState } from "../localStorage"; 4 | 5 | interface GuidingState { 6 | referenceLine: Array>; 7 | equipmentWidth: number; 8 | distanceToClosestGuidingLine: number; 9 | bearingToClosestGuidingLine: number; 10 | isGuidingLineOnRightOrLeft: string; 11 | guidingLines: any; 12 | closestLine: any; 13 | isDefiningGuidingLines: boolean; 14 | bboxContainer: any 15 | } 16 | 17 | const getInitialState = (): GuidingState => { 18 | return { 19 | referenceLine: [], 20 | equipmentWidth: 8, 21 | distanceToClosestGuidingLine: null, 22 | bearingToClosestGuidingLine: null, 23 | isGuidingLineOnRightOrLeft: null, 24 | guidingLines: null, 25 | closestLine: null, 26 | isDefiningGuidingLines: false, 27 | bboxContainer: null 28 | }; 29 | }; 30 | 31 | 32 | const SET_REFERENCE_LINE = 'Guiding/SET_REFERENCE_LINE'; 33 | const SET_EQUIPMENT_WIDTH = 'Guiding/SET_EQUIPMENT_WIDTH'; 34 | const SET_DISTANCE_TO_CLOSEST_GUIDINGLINE = 'Guiding/SET_DISTANCE_TO_CLOSEST_GUIDINGLINE'; 35 | const SET_BEARING_TO_CLOSEST_GUIDINGLINE = 'Guiding/SET_BEARING_TO_CLOSEST_GUIDINGLINE'; 36 | const SET_GUIDING_LINE_LEFT_OR_RIGHT = 'Guiding/SET_GUIDING_LINE_LEFT_OR_RIGHT'; 37 | const CREATE_OR_UPDATE_GUIDING_LINES = 'Guiding/CREATE_OR_UPDATE_GUIDING_LINES'; 38 | const START_DEFINING_GUIDINGLINES = 'Guiding/START_DEFINING_GUIDINGLINES'; 39 | const SET_BBOX_CONTAINER = 'Guiding/SET_BBOX_CONTAINER'; 40 | const SET_CLOSESTLINE = 'Guiding/SET_CLOSESTLINE'; 41 | const RESET = 'Guiding/RESET'; 42 | 43 | 44 | export function setReferenceLine(referenceLine) { 45 | return { 46 | type: SET_REFERENCE_LINE, 47 | payload: referenceLine 48 | } 49 | } 50 | 51 | export function setEquipmentWidth(equipmentWidth) { 52 | return (dispatch, getState) => { 53 | dispatch({ 54 | type: SET_EQUIPMENT_WIDTH, 55 | payload: equipmentWidth 56 | }); 57 | persistState(getState().guiding.equipmentWidth, 'equipmentWidth'); 58 | } 59 | } 60 | 61 | export function setDistanceToClosestGuidingLine(distanceToClosestGuidingLine) { 62 | return { 63 | type: SET_DISTANCE_TO_CLOSEST_GUIDINGLINE, 64 | payload: distanceToClosestGuidingLine 65 | } 66 | } 67 | 68 | export function startDefiningGuidingLines() { 69 | return { 70 | type: START_DEFINING_GUIDINGLINES 71 | } 72 | } 73 | 74 | export function setClosestLine(closestLine) { 75 | return { 76 | type: SET_CLOSESTLINE, 77 | payload: closestLine 78 | } 79 | } 80 | 81 | export function persistEquipmentWidth() { 82 | // @ts-ignore 83 | return (dispatch, getState) => { 84 | persistState(getState().guiding.equipmentWidth, 'equipmentWidth'); 85 | } 86 | } 87 | 88 | export function restoreEquipmentWidth() { 89 | return (dispatch) => { 90 | const equipmentWidth = loadState('equipmentWidth'); 91 | if(equipmentWidth) { 92 | dispatch({ 93 | type: SET_EQUIPMENT_WIDTH, 94 | payload: equipmentWidth 95 | }) 96 | } 97 | } 98 | } 99 | 100 | export function setBearingToClosestGuidingLine(bearingToClosestGuidingLine) { 101 | return (dispatch, getState) => { 102 | 103 | var heading = getState().geolocation.position.coords.heading; 104 | var isLeftOrRight = isPointOnLeftOfRight(heading, bearingToClosestGuidingLine); 105 | 106 | dispatch({ 107 | type: SET_GUIDING_LINE_LEFT_OR_RIGHT, 108 | payload: isLeftOrRight 109 | }) 110 | 111 | dispatch({ 112 | type: SET_BEARING_TO_CLOSEST_GUIDINGLINE, 113 | payload: bearingToClosestGuidingLine 114 | }) 115 | } 116 | } 117 | 118 | export function resetGuidingState() { 119 | return { 120 | type: RESET 121 | } 122 | } 123 | 124 | export function createOrUpdateGuidingLines(initialBbox) { 125 | return (dispatch, getState) => { 126 | 127 | // Enlarge bbox twice as big so we don't update on every frame 128 | let largerNewBbox = computeLargerBbox(initialBbox, 2); 129 | 130 | const equipmentWidth = getState().guiding.equipmentWidth; 131 | const referenceLine = getState().guiding.referenceLine; 132 | 133 | const guidingLines = new GuidingLines( 134 | equipmentWidth, 135 | referenceLine, 136 | largerNewBbox 137 | ); 138 | 139 | dispatch({ 140 | type: CREATE_OR_UPDATE_GUIDING_LINES, 141 | payload: guidingLines 142 | }) 143 | 144 | dispatch(setBboxContainer(largerNewBbox)); 145 | } 146 | } 147 | 148 | export function updateGuidingLinesOnNewPosition(position) { 149 | return (dispatch, getState) => { 150 | const guidingLines = getState().guiding.guidingLines; 151 | if(position && guidingLines) { 152 | const newClosests = guidingLines.getClosestLine([position.coords.longitude, position.coords.latitude]); 153 | let newClosest = newClosests[0]; 154 | let newSecondClosest = newClosests[1]; 155 | 156 | const previousClosest = getState().guiding.closestLine; 157 | 158 | // Add tolerance, only change closestLine when closestLine < 0.5m 159 | if(previousClosest && previousClosest.index !== newClosest.index) { 160 | if(newClosest.distance > 0.5 && 161 | previousClosest.index === newSecondClosest.index) { 162 | // Keep second closest 163 | newClosest = newSecondClosest; 164 | } 165 | } 166 | 167 | dispatch(setClosestLine(newClosest)); 168 | dispatch(setDistanceToClosestGuidingLine(newClosest.distance)) 169 | dispatch(setBearingToClosestGuidingLine(newClosest.bearingToLine)) 170 | 171 | 172 | } 173 | } 174 | } 175 | 176 | export function onBboxChanged(newBbox) { 177 | return (dispatch, getState) => { 178 | const guidingLines = getState().guiding.guidingLines; 179 | if(!guidingLines) { 180 | return; 181 | } 182 | // Only update bbox if new bbox isn't contained on the previous one 183 | if(guidingLines.needBboxUpdate(newBbox)) { 184 | // Enlarge bbox twice as big so we don't update on every frame 185 | let largerNewBbox = computeLargerBbox(newBbox, 2); 186 | guidingLines.updateBbox(largerNewBbox); 187 | dispatch(setBboxContainer(largerNewBbox)); 188 | // The watcher of bboxContainer on the frond-end will update the guidingLines 189 | // Maybe update reference guiding line also... 190 | } 191 | } 192 | } 193 | 194 | export function setBboxContainer(bbox) { 195 | return { 196 | type: SET_BBOX_CONTAINER, 197 | payload: bbox 198 | } 199 | } 200 | 201 | 202 | const guidingStateReducer = ( 203 | state = getInitialState(), 204 | action: any 205 | ): GuidingState => { 206 | switch (action.type) { 207 | case SET_REFERENCE_LINE: { 208 | return { 209 | ...state, 210 | referenceLine: action.payload 211 | }; 212 | } 213 | case SET_EQUIPMENT_WIDTH: { 214 | return { 215 | ...state, 216 | equipmentWidth: action.payload 217 | }; 218 | } 219 | case SET_DISTANCE_TO_CLOSEST_GUIDINGLINE: { 220 | return { 221 | ...state, 222 | distanceToClosestGuidingLine: action.payload 223 | }; 224 | } 225 | case SET_BEARING_TO_CLOSEST_GUIDINGLINE: { 226 | return { 227 | ...state, 228 | bearingToClosestGuidingLine: action.payload 229 | }; 230 | } 231 | case SET_GUIDING_LINE_LEFT_OR_RIGHT: { 232 | return { 233 | ...state, 234 | isGuidingLineOnRightOrLeft: action.payload 235 | }; 236 | } 237 | case START_DEFINING_GUIDINGLINES: { 238 | return { 239 | ...state, 240 | isDefiningGuidingLines: true, 241 | guidingLines: null 242 | }; 243 | } 244 | case CREATE_OR_UPDATE_GUIDING_LINES: { 245 | return { 246 | ...state, 247 | guidingLines: action.payload, 248 | isDefiningGuidingLines: false 249 | }; 250 | } 251 | case SET_BBOX_CONTAINER: { 252 | return { 253 | ...state, 254 | bboxContainer: action.payload 255 | } 256 | } 257 | case SET_CLOSESTLINE: { 258 | return { 259 | ...state, 260 | closestLine: action.payload 261 | } 262 | } 263 | case RESET: { 264 | return { 265 | ...getInitialState(), 266 | equipmentWidth: state.equipmentWidth 267 | } 268 | } 269 | 270 | } 271 | return state; 272 | }; 273 | 274 | export default guidingStateReducer; --------------------------------------------------------------------------------