@mxtommy/kip 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.angulardoc.json +3 -3
- package/CHANGELOG.md +145 -124
- package/CONTRIBUTORS.md +16 -13
- package/README.md +102 -101
- package/angular.json +162 -152
- package/karma.conf.js +31 -31
- package/package.json +87 -80
- package/public/3rdpartylicenses.txt +317 -62
- package/public/assets/NoSleep.min.js +1 -1
- package/public/assets/fontawesome6/css/all.min.css +6 -0
- package/public/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
- package/public/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
- package/public/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
- package/public/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
- package/public/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
- package/public/assets/icon-192x192.png +0 -0
- package/public/assets/icon-256x256.png +0 -0
- package/public/assets/icon-384x384.png +0 -0
- package/public/assets/icon-512x512.png +0 -0
- package/public/assets/steelseries-min.js +25 -25
- package/public/assets/steelseries-min.js.map +8 -8
- package/public/assets/steelseries.js +15834 -15834
- package/public/assets/svg-autopilot-inkscape-plain.svg +983 -983
- package/public/assets/svg-wind-inkscape.svg +1358 -1358
- package/public/assets/tween.js +381 -381
- package/public/index.html +19 -20
- package/public/main-es2018.98175eb4c61ccaf7eb17.js +1 -0
- package/public/main-es5.98175eb4c61ccaf7eb17.js +1 -0
- package/public/manifest.json +33 -0
- package/public/polyfills-es2018.3a61665863c173cd6ba3.js +1 -0
- package/public/polyfills-es5.44827ae4ff4e41de51fb.js +1 -0
- package/public/runtime-es2018.baedb88c6d2abacae2b8.js +1 -0
- package/public/runtime-es5.baedb88c6d2abacae2b8.js +1 -0
- package/public/styles.b92ae2c466c89712209d.css +5 -0
- package/src/app/alarm-menu/alarm-menu.component.html +55 -55
- package/src/app/alarm-menu/alarm-menu.component.scss +52 -53
- package/src/app/alarm-menu/alarm-menu.component.spec.ts +25 -25
- package/src/app/alarm-menu/alarm-menu.component.ts +186 -186
- package/src/app/app-help/app-help.component.css +4 -4
- package/src/app/app-help/app-help.component.html +135 -121
- package/src/app/app-help/app-help.component.ts +45 -45
- package/src/app/app.component.css +39 -39
- package/src/app/app.component.html +93 -93
- package/src/app/app.component.scss +79 -79
- package/src/app/app.component.spec.ts +32 -32
- package/src/app/app.component.ts +191 -192
- package/src/app/app.module.ts +200 -200
- package/src/app/config.blank.const.ts +51 -51
- package/src/app/config.blank.notification.const.ts +19 -19
- package/src/app/config.blank.units.const.ts +23 -23
- package/src/app/config.demo.const.ts +383 -382
- package/src/app/data-browser/data-browser.component.css +29 -29
- package/src/app/data-browser/data-browser.component.html +44 -44
- package/src/app/data-browser/data-browser.component.spec.ts +25 -25
- package/src/app/data-browser/data-browser.component.ts +91 -91
- package/src/app/data-browser-row/data-browser-row-unit-modal.html +17 -17
- package/src/app/data-browser-row/data-browser-row.component.css +9 -9
- package/src/app/data-browser-row/data-browser-row.component.html +4 -4
- package/src/app/data-browser-row/data-browser-row.component.ts +78 -78
- package/src/app/data-set.service.ts +273 -273
- package/src/app/dynamic-widget.directive.ts +11 -11
- package/src/app/gauge-steel/gauge-steel.component.css +4 -4
- package/src/app/gauge-steel/gauge-steel.component.html +4 -4
- package/src/app/gauge-steel/gauge-steel.component.spec.ts +25 -25
- package/src/app/gauge-steel/gauge-steel.component.ts +282 -282
- package/src/app/gauges-module/base-gauge.ts +301 -0
- package/src/app/gauges-module/gauges.module.ts +17 -0
- package/src/app/gauges-module/linear-gauge.ts +50 -0
- package/src/app/gauges-module/radial-gauge.ts +48 -0
- package/src/app/layout-split/layout-split.component.html +30 -30
- package/src/app/layout-split/layout-split.component.scss +33 -33
- package/src/app/layout-split/layout-split.component.spec.ts +25 -25
- package/src/app/layout-split/layout-split.component.ts +59 -59
- package/src/app/layout-splits.service.ts +284 -284
- package/src/app/modal-path-selector/modal-path-selector.component.html +62 -62
- package/src/app/modal-path-selector/modal-path-selector.component.scss +39 -39
- package/src/app/modal-path-selector/modal-path-selector.component.spec.ts +25 -25
- package/src/app/modal-path-selector/modal-path-selector.component.ts +132 -132
- package/src/app/modal-widget/modal-widget.component.css +32 -32
- package/src/app/modal-widget/modal-widget.component.html +341 -334
- package/src/app/modal-widget/modal-widget.component.spec.ts +25 -25
- package/src/app/modal-widget/modal-widget.component.ts +84 -84
- package/src/app/notifications.service.ts +392 -387
- package/src/app/object-keys.pipe.spec.ts +8 -8
- package/src/app/object-keys.pipe.ts +13 -13
- package/src/app/reset-config/reset-config.component.html +3 -3
- package/src/app/reset-config/reset-config.component.spec.ts +25 -25
- package/src/app/reset-config/reset-config.component.ts +31 -31
- package/src/app/root-display/root-display.component.html +4 -4
- package/src/app/root-display/root-display.component.spec.ts +25 -25
- package/src/app/root-display/root-display.component.ts +57 -57
- package/src/app/safe.pipe.ts +15 -15
- package/src/app/settings/settings.component.css +9 -9
- package/src/app/settings/settings.component.html +25 -25
- package/src/app/settings/settings.component.spec.ts +25 -25
- package/src/app/settings/settings.component.ts +22 -22
- package/src/app/settings-config/settings-config.component.css +38 -38
- package/src/app/settings-config/settings-config.component.spec.ts +25 -25
- package/src/app/settings-config/settings-config.component.ts +161 -161
- package/src/app/settings-datasets/settings-datasets.component.html +43 -43
- package/src/app/settings-datasets/settings-datasets.component.scss +39 -39
- package/src/app/settings-datasets/settings-datasets.component.spec.ts +25 -25
- package/src/app/settings-datasets/settings-datasets.component.ts +98 -98
- package/src/app/settings-datasets/settings-datasets.modal.html +54 -54
- package/src/app/settings-notifications/settings-notifications.component.html +65 -65
- package/src/app/settings-notifications/settings-notifications.component.spec.ts +25 -25
- package/src/app/settings-notifications/settings-notifications.component.ts +29 -29
- package/src/app/settings-signalk/settings-signalk.component.html +8 -8
- package/src/app/settings-signalk/settings-signalk.component.spec.ts +25 -25
- package/src/app/settings-signalk/settings-signalk.component.ts +6 -17
- package/src/app/settings-units/settings-units.component.css +4 -4
- package/src/app/settings-units/settings-units.component.html +19 -19
- package/src/app/settings-units/settings-units.component.spec.ts +25 -25
- package/src/app/settings-units/settings-units.component.ts +62 -62
- package/src/app/settings-zones/settings-zones.component.css +21 -21
- package/src/app/settings-zones/settings-zones.component.html +70 -70
- package/src/app/settings-zones/settings-zones.modal.html +38 -38
- package/src/app/signalk-connection.service.ts +344 -344
- package/src/app/signalk-delta.service.spec.ts +15 -15
- package/src/app/signalk-delta.service.ts +97 -97
- package/src/app/signalk-full.service.ts +99 -99
- package/src/app/signalk-interfaces.ts +129 -129
- package/src/app/signalk-requests.service.spec.ts +12 -12
- package/src/app/signalk-requests.service.ts +180 -180
- package/src/app/svg-autopilot/svg-autopilot.component.html +1036 -1036
- package/src/app/svg-autopilot/svg-autopilot.component.spec.ts +25 -25
- package/src/app/svg-autopilot/svg-autopilot.component.ts +174 -174
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.html +119 -119
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.spec.ts +25 -25
- package/src/app/svg-simple-linear-gauge/svg-simple-linear-gauge.component.ts +49 -49
- package/src/app/svg-wind/svg-wind.component.html +969 -969
- package/src/app/svg-wind/svg-wind.component.scss +76 -76
- package/src/app/svg-wind/svg-wind.component.spec.ts +25 -25
- package/src/app/svg-wind/svg-wind.component.ts +280 -280
- package/src/app/unit-window/unit-window.component.css +37 -37
- package/src/app/unit-window/unit-window.component.html +8 -8
- package/src/app/unit-window/unit-window.component.spec.ts +25 -25
- package/src/app/unit-window/unit-window.component.ts +134 -134
- package/src/app/unit-window/unit-window.modal.html +24 -24
- package/src/app/units.service.ts +300 -300
- package/src/app/widget-autopilot/widget-autopilot.component.html +78 -85
- package/src/app/widget-autopilot/widget-autopilot.component.scss +191 -191
- package/src/app/widget-autopilot/widget-autopilot.component.spec.ts +25 -25
- package/src/app/widget-autopilot/widget-autopilot.component.ts +774 -781
- package/src/app/widget-blank/widget-blank.component.scss +21 -22
- package/src/app/widget-blank/widget-blank.component.spec.ts +25 -25
- package/src/app/widget-blank/widget-blank.component.ts +17 -17
- package/src/app/widget-gauge/widget-gauge.component.css +25 -25
- package/src/app/widget-gauge/widget-gauge.component.html +29 -29
- package/src/app/widget-gauge/widget-gauge.component.spec.ts +25 -25
- package/src/app/widget-gauge/widget-gauge.component.ts +120 -120
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.html +126 -126
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.scss +94 -93
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.spec.ts +25 -25
- package/src/app/widget-gauge-ng-linear/widget-gauge-ng-linear.component.ts +424 -424
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.html +122 -122
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.scss +69 -69
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.spec.ts +25 -25
- package/src/app/widget-gauge-ng-radial/widget-gauge-ng-radial.component.ts +553 -553
- package/src/app/widget-historical/widget-historical.component.html +14 -14
- package/src/app/widget-historical/widget-historical.component.spec.ts +25 -25
- package/src/app/widget-historical/widget-historical.component.ts +306 -307
- package/src/app/widget-iframe/widget-iframe.component.css +11 -11
- package/src/app/widget-iframe/widget-iframe.component.html +21 -21
- package/src/app/widget-iframe/widget-iframe.component.spec.ts +25 -25
- package/src/app/widget-iframe/widget-iframe.component.ts +63 -63
- package/src/app/widget-list.service.ts +135 -135
- package/src/app/widget-manager.service.ts +141 -140
- package/src/app/widget-numeric/widget-numeric.component.html +1 -1
- package/src/app/widget-numeric/widget-numeric.component.scss +3 -3
- package/src/app/widget-numeric/widget-numeric.component.spec.ts +25 -25
- package/src/app/widget-simple-linear/widget-simple-linear.component.html +28 -28
- package/src/app/widget-simple-linear/widget-simple-linear.component.scss +64 -64
- package/src/app/widget-simple-linear/widget-simple-linear.component.spec.ts +25 -25
- package/src/app/widget-simple-linear/widget-simple-linear.component.ts +199 -199
- package/src/app/widget-state/widget-state.component.html +27 -27
- package/src/app/widget-state/widget-state.component.scss +68 -68
- package/src/app/widget-state/widget-state.component.spec.ts +25 -25
- package/src/app/widget-state/widget-state.component.ts +178 -178
- package/src/app/widget-switch/widget-switch.component.css +69 -69
- package/src/app/widget-switch/widget-switch.component.html +17 -17
- package/src/app/widget-switch/widget-switch.component.spec.ts +25 -25
- package/src/app/widget-switch/widget-switch.component.ts +134 -134
- package/src/app/widget-text-generic/widget-text-generic.component.html +9 -9
- package/src/app/widget-text-generic/widget-text-generic.component.spec.ts +25 -25
- package/src/app/widget-tutorial/widget-tutorial.component.html +34 -34
- package/src/app/widget-tutorial/widget-tutorial.component.spec.ts +25 -25
- package/src/app/widget-tutorial/widget-tutorial.component.ts +18 -18
- package/src/app/widget-unknown/widget-unknown.component.spec.ts +25 -25
- package/src/app/widget-wind/widget-wind.component.css +23 -23
- package/src/app/widget-wind/widget-wind.component.html +20 -20
- package/src/app/widget-wind/widget-wind.component.spec.ts +25 -25
- package/src/app/widget-wind/widget-wind.component.ts +369 -369
- package/src/assets/NoSleep.min.js +1 -1
- package/src/assets/fontawesome6/css/all.min.css +6 -0
- package/src/assets/fontawesome6/webfonts/fa-brands-400.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-brands-400.woff2 +0 -0
- package/src/assets/fontawesome6/webfonts/fa-regular-400.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-regular-400.woff2 +0 -0
- package/src/assets/fontawesome6/webfonts/fa-solid-900.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-solid-900.woff2 +0 -0
- package/src/assets/fontawesome6/webfonts/fa-v4compatibility.ttf +0 -0
- package/src/assets/fontawesome6/webfonts/fa-v4compatibility.woff2 +0 -0
- package/src/assets/icon-192x192.png +0 -0
- package/src/assets/icon-256x256.png +0 -0
- package/src/assets/icon-384x384.png +0 -0
- package/src/assets/icon-512x512.png +0 -0
- package/src/assets/steelseries-min.js +25 -25
- package/src/assets/steelseries-min.js.map +8 -8
- package/src/assets/steelseries.js +15834 -15834
- package/src/assets/svg-autopilot-inkscape-plain.svg +983 -983
- package/src/assets/svg-wind-inkscape.svg +1358 -1358
- package/src/assets/tween.js +381 -381
- package/src/index.html +20 -20
- package/src/main.ts +11 -11
- package/src/manifest.json +33 -0
- package/src/polyfills.ts +80 -76
- package/src/styles.scss +11 -11
- package/src/themes/darkBlueTheme.scss +117 -116
- package/src/themes/defaultTheme.scss +50 -49
- package/src/themes/highContrastTheme.scss +47 -46
- package/src/themes/modernTheme.scss +143 -142
- package/src/themes/nightMode.scss +185 -184
- package/src/themes/platypusTheme.scss +80 -79
- package/src/themes/signalkTheme.scss +112 -111
- package/src/tsconfig.app.json +15 -15
- package/src/tsconfig.spec.json +20 -20
- package/tsconfig.json +23 -23
- package/tslint.json +143 -143
- package/public/assets/font-awesome/HELP-US-OUT.txt +0 -7
- package/public/assets/font-awesome/css/font-awesome.css +0 -2337
- package/public/assets/font-awesome/css/font-awesome.min.css +0 -4
- package/public/assets/font-awesome/desktop.ini +0 -4
- package/public/assets/font-awesome/fonts/FontAwesome.otf +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
- package/public/assets/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/public/assets/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/public/assets/font-awesome/less/animated.less +0 -34
- package/public/assets/font-awesome/less/bordered-pulled.less +0 -25
- package/public/assets/font-awesome/less/core.less +0 -12
- package/public/assets/font-awesome/less/fixed-width.less +0 -6
- package/public/assets/font-awesome/less/font-awesome.less +0 -18
- package/public/assets/font-awesome/less/icons.less +0 -789
- package/public/assets/font-awesome/less/larger.less +0 -13
- package/public/assets/font-awesome/less/list.less +0 -19
- package/public/assets/font-awesome/less/mixins.less +0 -60
- package/public/assets/font-awesome/less/path.less +0 -15
- package/public/assets/font-awesome/less/rotated-flipped.less +0 -20
- package/public/assets/font-awesome/less/screen-reader.less +0 -5
- package/public/assets/font-awesome/less/stacked.less +0 -20
- package/public/assets/font-awesome/less/variables.less +0 -800
- package/public/assets/font-awesome/scss/_animated.scss +0 -34
- package/public/assets/font-awesome/scss/_bordered-pulled.scss +0 -25
- package/public/assets/font-awesome/scss/_core.scss +0 -12
- package/public/assets/font-awesome/scss/_fixed-width.scss +0 -6
- package/public/assets/font-awesome/scss/_icons.scss +0 -789
- package/public/assets/font-awesome/scss/_larger.scss +0 -13
- package/public/assets/font-awesome/scss/_list.scss +0 -19
- package/public/assets/font-awesome/scss/_mixins.scss +0 -60
- package/public/assets/font-awesome/scss/_path.scss +0 -15
- package/public/assets/font-awesome/scss/_rotated-flipped.scss +0 -20
- package/public/assets/font-awesome/scss/_screen-reader.scss +0 -5
- package/public/assets/font-awesome/scss/_stacked.scss +0 -20
- package/public/assets/font-awesome/scss/_variables.scss +0 -800
- package/public/assets/font-awesome/scss/font-awesome.scss +0 -18
- package/public/main-es2018.625fb92c9cbb6a4131de.js +0 -1
- package/public/main-es5.625fb92c9cbb6a4131de.js +0 -1
- package/public/polyfills-es2018.713f95af1f028e444854.js +0 -1
- package/public/polyfills-es5.c78877945523541d2597.js +0 -1
- package/public/runtime-es2018.a4dadbc03350107420a4.js +0 -1
- package/public/runtime-es5.a4dadbc03350107420a4.js +0 -1
- package/public/styles.71bb0d04cad96b5efbe1.css +0 -19
- package/src/assets/font-awesome/HELP-US-OUT.txt +0 -7
- package/src/assets/font-awesome/css/font-awesome.css +0 -2337
- package/src/assets/font-awesome/css/font-awesome.min.css +0 -4
- package/src/assets/font-awesome/desktop.ini +0 -4
- package/src/assets/font-awesome/fonts/FontAwesome.otf +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.svg +0 -2671
- package/src/assets/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/src/assets/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/src/assets/font-awesome/less/animated.less +0 -34
- package/src/assets/font-awesome/less/bordered-pulled.less +0 -25
- package/src/assets/font-awesome/less/core.less +0 -12
- package/src/assets/font-awesome/less/fixed-width.less +0 -6
- package/src/assets/font-awesome/less/font-awesome.less +0 -18
- package/src/assets/font-awesome/less/icons.less +0 -789
- package/src/assets/font-awesome/less/larger.less +0 -13
- package/src/assets/font-awesome/less/list.less +0 -19
- package/src/assets/font-awesome/less/mixins.less +0 -60
- package/src/assets/font-awesome/less/path.less +0 -15
- package/src/assets/font-awesome/less/rotated-flipped.less +0 -20
- package/src/assets/font-awesome/less/screen-reader.less +0 -5
- package/src/assets/font-awesome/less/stacked.less +0 -20
- package/src/assets/font-awesome/less/variables.less +0 -800
- package/src/assets/font-awesome/scss/_animated.scss +0 -34
- package/src/assets/font-awesome/scss/_bordered-pulled.scss +0 -25
- package/src/assets/font-awesome/scss/_core.scss +0 -12
- package/src/assets/font-awesome/scss/_fixed-width.scss +0 -6
- package/src/assets/font-awesome/scss/_icons.scss +0 -789
- package/src/assets/font-awesome/scss/_larger.scss +0 -13
- package/src/assets/font-awesome/scss/_list.scss +0 -19
- package/src/assets/font-awesome/scss/_mixins.scss +0 -60
- package/src/assets/font-awesome/scss/_path.scss +0 -15
- package/src/assets/font-awesome/scss/_rotated-flipped.scss +0 -20
- package/src/assets/font-awesome/scss/_screen-reader.scss +0 -5
- package/src/assets/font-awesome/scss/_stacked.scss +0 -20
- package/src/assets/font-awesome/scss/_variables.scss +0 -800
- package/src/assets/font-awesome/scss/font-awesome.scss +0 -18
|
@@ -1,369 +1,369 @@
|
|
|
1
|
-
import { Component, Input, OnInit, OnDestroy, Inject } from '@angular/core';
|
|
2
|
-
import { Subscription , Observable, interval } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
import { MatDialog } from '@angular/material/dialog';
|
|
5
|
-
|
|
6
|
-
import { ModalWidgetComponent } from '../modal-widget/modal-widget.component';
|
|
7
|
-
import { SignalKService } from '../signalk.service';
|
|
8
|
-
import { WidgetManagerService, IWidget, IWidgetConfig } from '../widget-manager.service';
|
|
9
|
-
import { UnitsService } from '../units.service';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const defaultConfig: IWidgetConfig = {
|
|
13
|
-
filterSelfPaths: true,
|
|
14
|
-
paths: {
|
|
15
|
-
"headingPath": {
|
|
16
|
-
description: "Heading",
|
|
17
|
-
path: 'self.navigation.courseOverGroundTrue',
|
|
18
|
-
source: 'default',
|
|
19
|
-
pathType: "number",
|
|
20
|
-
isPathConfigurable: true,
|
|
21
|
-
convertUnitTo: "deg"
|
|
22
|
-
},
|
|
23
|
-
"trueWindAngle": {
|
|
24
|
-
description: "True Wind Angle",
|
|
25
|
-
path: 'self.environment.wind.angleTrueWater',
|
|
26
|
-
source: 'default',
|
|
27
|
-
pathType: "number",
|
|
28
|
-
isPathConfigurable: true,
|
|
29
|
-
convertUnitTo: "deg"
|
|
30
|
-
},
|
|
31
|
-
"trueWindSpeed": {
|
|
32
|
-
description: "True Wind Speed",
|
|
33
|
-
path: 'self.environment.wind.speedTrue',
|
|
34
|
-
source: 'default',
|
|
35
|
-
pathType: "number",
|
|
36
|
-
isPathConfigurable: true,
|
|
37
|
-
convertUnitTo: "knots"
|
|
38
|
-
},
|
|
39
|
-
"appWindAngle": {
|
|
40
|
-
description: "Apparent Wind Angle",
|
|
41
|
-
path: 'self.environment.wind.angleApparent',
|
|
42
|
-
source: 'default',
|
|
43
|
-
pathType: "number",
|
|
44
|
-
isPathConfigurable: true,
|
|
45
|
-
convertUnitTo: "deg"
|
|
46
|
-
},
|
|
47
|
-
"appWindSpeed": {
|
|
48
|
-
description: "Apparent Wind Speed",
|
|
49
|
-
path: 'self.environment.wind.speedApparent',
|
|
50
|
-
source: 'default',
|
|
51
|
-
pathType: "number",
|
|
52
|
-
isPathConfigurable: true,
|
|
53
|
-
convertUnitTo: "knots"
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
windSectorEnable: true,
|
|
57
|
-
windSectorWindowSeconds: 10,
|
|
58
|
-
laylineEnable: true,
|
|
59
|
-
laylineAngle: 35,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@Component({
|
|
64
|
-
selector: 'app-widget-wind',
|
|
65
|
-
templateUrl: './widget-wind.component.html',
|
|
66
|
-
styleUrls: ['./widget-wind.component.css']
|
|
67
|
-
})
|
|
68
|
-
export class WidgetWindComponent implements OnInit, OnDestroy {
|
|
69
|
-
|
|
70
|
-
@Input('widgetUUID') widgetUUID: string;
|
|
71
|
-
@Input('unlockStatus') unlockStatus: boolean;
|
|
72
|
-
|
|
73
|
-
activeWidget: IWidget;
|
|
74
|
-
config: IWidgetConfig;
|
|
75
|
-
|
|
76
|
-
currentHeading: number = 0;
|
|
77
|
-
headingSub: Subscription = null;
|
|
78
|
-
|
|
79
|
-
appWindAngle: number = null;
|
|
80
|
-
appWindAngleSub: Subscription = null;
|
|
81
|
-
|
|
82
|
-
appWindSpeed: number = null;
|
|
83
|
-
appWindSpeedSub: Subscription = null;
|
|
84
|
-
|
|
85
|
-
trueWindAngle: number = null;
|
|
86
|
-
trueWindAngleSub: Subscription = null;
|
|
87
|
-
|
|
88
|
-
trueWindSpeed: number = null;
|
|
89
|
-
trueWindSpeedSub: Subscription = null;
|
|
90
|
-
|
|
91
|
-
trueWindHistoric: {
|
|
92
|
-
timestamp: number;
|
|
93
|
-
heading: number;
|
|
94
|
-
}[] = [];
|
|
95
|
-
trueWindMinHistoric: number;
|
|
96
|
-
trueWindMidHistoric: number;
|
|
97
|
-
trueWindMaxHistoric: number;
|
|
98
|
-
|
|
99
|
-
windSectorObservableSub: Subscription;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
constructor(
|
|
103
|
-
public dialog:MatDialog,
|
|
104
|
-
private SignalKService: SignalKService,
|
|
105
|
-
private WidgetManagerService: WidgetManagerService,
|
|
106
|
-
private UnitsService: UnitsService) {
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
ngOnInit() {
|
|
111
|
-
this.activeWidget = this.WidgetManagerService.getWidget(this.widgetUUID);
|
|
112
|
-
if (this.activeWidget.config === null) {
|
|
113
|
-
// no data, let's set some!
|
|
114
|
-
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, defaultConfig);
|
|
115
|
-
this.config = defaultConfig; // load default config.
|
|
116
|
-
} else {
|
|
117
|
-
this.config = this.activeWidget.config;
|
|
118
|
-
}
|
|
119
|
-
this.startAll();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
ngOnDestroy() {
|
|
123
|
-
this.stopAll();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
startAll() {
|
|
127
|
-
this.subscribeHeading();
|
|
128
|
-
this.subscribeAppWindAngle();
|
|
129
|
-
this.subscribeAppWindSpeed();
|
|
130
|
-
this.subscribeTrueWindAngle();
|
|
131
|
-
this.subscribeTrueWindSpeed();
|
|
132
|
-
this.startWindSectors();
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
stopAll() {
|
|
136
|
-
this.unsubscribeHeading();
|
|
137
|
-
this.unsubscribeAppWindAngle();
|
|
138
|
-
this.unsubscribeAppWindSpeed();
|
|
139
|
-
this.unsubscribeTrueWindAngle();
|
|
140
|
-
this.unsubscribeTrueWindSpeed();
|
|
141
|
-
this.stopWindSectors();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
subscribeHeading() {
|
|
145
|
-
this.unsubscribeHeading();
|
|
146
|
-
if (typeof(this.config.paths['headingPath'].path) != 'string') { return } // nothing to sub to...
|
|
147
|
-
this.headingSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['headingPath'].path, this.config.paths['headingPath'].source).subscribe(
|
|
148
|
-
newValue => {
|
|
149
|
-
if (newValue.value === null) {
|
|
150
|
-
this.currentHeading = 0;
|
|
151
|
-
} else {
|
|
152
|
-
this.currentHeading = this.UnitsService.convertUnit('deg', newValue.value);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
subscribeAppWindAngle() {
|
|
160
|
-
this.unsubscribeAppWindAngle();
|
|
161
|
-
if (typeof(this.config.paths['appWindAngle'].path) != 'string') { return } // nothing to sub to...
|
|
162
|
-
|
|
163
|
-
this.appWindAngleSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['appWindAngle'].path, this.config.paths['appWindAngle'].source).subscribe(
|
|
164
|
-
newValue => {
|
|
165
|
-
if (newValue.value === null) {
|
|
166
|
-
this.appWindAngle = null;
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let converted = this.UnitsService.convertUnit('deg', newValue.value);
|
|
171
|
-
// 0-180+ for stb
|
|
172
|
-
// -0 to -180 for port
|
|
173
|
-
// need in 0-360
|
|
174
|
-
if (converted < 0) {// stb
|
|
175
|
-
this.appWindAngle= 360 + converted; // adding a negative number subtracts it...
|
|
176
|
-
} else {
|
|
177
|
-
this.appWindAngle = converted;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
subscribeAppWindSpeed() {
|
|
185
|
-
this.unsubscribeAppWindSpeed();
|
|
186
|
-
if (typeof(this.config.paths['appWindSpeed'].path) != 'string') { return } // nothing to sub to...
|
|
187
|
-
|
|
188
|
-
this.appWindSpeedSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['appWindSpeed'].path, this.config.paths['appWindSpeed'].source).subscribe(
|
|
189
|
-
newValue => {
|
|
190
|
-
this.appWindSpeed = this.UnitsService.convertUnit(this.config.paths['appWindSpeed'].convertUnitTo, newValue.value);
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
subscribeTrueWindAngle() {
|
|
196
|
-
this.unsubscribeTrueWindAngle();
|
|
197
|
-
if (typeof(this.config.paths['trueWindAngle'].path) != 'string') { return } // nothing to sub to...
|
|
198
|
-
|
|
199
|
-
this.trueWindAngleSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['trueWindAngle'].path, this.config.paths['trueWindAngle'].source).subscribe(
|
|
200
|
-
newValue => {
|
|
201
|
-
if (newValue.value === null) {
|
|
202
|
-
this.trueWindAngle = null;
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
let converted = this.UnitsService.convertUnit('deg', newValue.value);
|
|
207
|
-
|
|
208
|
-
// Depending on path, this number can either be the magnetic compass heading, true compass heading, or heading relative to boat heading (-180 to 180deg)... Ugh...
|
|
209
|
-
// 0-180+ for stb
|
|
210
|
-
// -0 to -180 for port
|
|
211
|
-
// need in 0-360
|
|
212
|
-
|
|
213
|
-
if (this.config.paths['trueWindAngle'].path.match('angleTrueWater')||
|
|
214
|
-
this.config.paths['trueWindAngle'].path.match('angleTrueGround')) {
|
|
215
|
-
//-180 to 180
|
|
216
|
-
this.trueWindAngle = this.addHeading(this.currentHeading, converted);
|
|
217
|
-
} else if (this.config.paths['trueWindAngle'].path.match('direction')) {
|
|
218
|
-
//0-360
|
|
219
|
-
this.trueWindAngle = converted;
|
|
220
|
-
} else {
|
|
221
|
-
// some other path... assume it's the angle
|
|
222
|
-
this.trueWindAngle = converted;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
//add to historical for wind sectors
|
|
226
|
-
if (this.config.windSectorEnable) {
|
|
227
|
-
this.addHistoricalTrue(this.trueWindAngle);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
subscribeTrueWindSpeed() {
|
|
234
|
-
this.unsubscribeTrueWindSpeed();
|
|
235
|
-
if (typeof(this.config.paths['trueWindSpeed'].path) != 'string') { return } // nothing to sub to...
|
|
236
|
-
|
|
237
|
-
this.trueWindSpeedSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['trueWindSpeed'].path, this.config.paths['trueWindSpeed'].source).subscribe(
|
|
238
|
-
newValue => {
|
|
239
|
-
this.trueWindSpeed = this.UnitsService.convertUnit(this.config.paths['trueWindSpeed'].convertUnitTo, newValue.value);
|
|
240
|
-
}
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
startWindSectors() {
|
|
245
|
-
this.windSectorObservableSub = interval (500).subscribe(x => {
|
|
246
|
-
this.historicalCleanup();
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
addHistoricalTrue (windHeading) {
|
|
251
|
-
this.trueWindHistoric.push({
|
|
252
|
-
timestamp: Date.now(),
|
|
253
|
-
heading: windHeading
|
|
254
|
-
});
|
|
255
|
-
let arr = this.arcForAngles(this.trueWindHistoric.map(d => d.heading));
|
|
256
|
-
this.trueWindMinHistoric = arr[0];
|
|
257
|
-
this.trueWindMaxHistoric = arr[1];
|
|
258
|
-
this.trueWindMidHistoric = arr[2];
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
arcForAngles (data) {
|
|
262
|
-
return data.slice(1).reduce((acc, theValue) => {
|
|
263
|
-
let value = theValue
|
|
264
|
-
while (value < acc[0] - 180) {
|
|
265
|
-
value += 360
|
|
266
|
-
}
|
|
267
|
-
while (value > acc[1] + 180) {
|
|
268
|
-
value -= 360
|
|
269
|
-
}
|
|
270
|
-
acc[0] = Math.min(acc[0], value)
|
|
271
|
-
acc[1] = Math.max(acc[1], value)
|
|
272
|
-
acc[2] = ((acc[1]-acc[0])/2)+acc[0];
|
|
273
|
-
return acc
|
|
274
|
-
}, [data[0], data[0]])
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
historicalCleanup() {
|
|
278
|
-
let n = Date.now()-(this.config.windSectorWindowSeconds*1000);
|
|
279
|
-
for (var i = this.trueWindHistoric.length - 1; i >= 0; --i) {
|
|
280
|
-
if (this.trueWindHistoric[i].timestamp < n) {
|
|
281
|
-
this.trueWindHistoric.splice(i,1);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
stopWindSectors() {
|
|
287
|
-
this.windSectorObservableSub.unsubscribe();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
unsubscribeHeading() {
|
|
291
|
-
if (this.headingSub !== null) {
|
|
292
|
-
this.headingSub.unsubscribe();
|
|
293
|
-
this.headingSub = null;
|
|
294
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['headingPath'].path);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
unsubscribeAppWindAngle() {
|
|
299
|
-
if (this.appWindAngleSub !== null) {
|
|
300
|
-
this.appWindAngleSub.unsubscribe();
|
|
301
|
-
this.appWindAngleSub = null;
|
|
302
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['appWindAngle'].path);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
unsubscribeAppWindSpeed() {
|
|
307
|
-
if (this.appWindSpeedSub !== null) {
|
|
308
|
-
this.appWindSpeedSub.unsubscribe();
|
|
309
|
-
this.appWindSpeedSub = null;
|
|
310
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['appWindSpeed'].path);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
unsubscribeTrueWindAngle() {
|
|
315
|
-
if (this.trueWindAngleSub !== null) {
|
|
316
|
-
this.trueWindAngleSub.unsubscribe();
|
|
317
|
-
this.trueWindAngleSub = null;
|
|
318
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['trueWindAngle'].path);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
unsubscribeTrueWindSpeed() {
|
|
323
|
-
if (this.trueWindSpeedSub !== null) {
|
|
324
|
-
this.trueWindSpeedSub.unsubscribe();
|
|
325
|
-
this.trueWindSpeedSub = null;
|
|
326
|
-
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['trueWindSpeed'].path);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
addHeading(h1: number, h2: number) {
|
|
334
|
-
let h3 = h1 + h2;
|
|
335
|
-
while (h3 > 359) { h3 = h3 - 359; }
|
|
336
|
-
while (h3 < 0) { h3 = h3 + 359; }
|
|
337
|
-
return h3;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
openWidgetSettings() {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
let dialogRef = this.dialog.open(ModalWidgetComponent, {
|
|
352
|
-
width: '80%',
|
|
353
|
-
data: this.config
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
dialogRef.afterClosed().subscribe(result => {
|
|
357
|
-
// save new settings
|
|
358
|
-
if (result) {
|
|
359
|
-
console.log(result);
|
|
360
|
-
this.stopAll();//unsub now as we will change variables so wont know what was subbed before...
|
|
361
|
-
this.config = result;
|
|
362
|
-
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
|
|
363
|
-
this.startAll();
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
}
|
|
1
|
+
import { Component, Input, OnInit, OnDestroy, Inject } from '@angular/core';
|
|
2
|
+
import { Subscription , Observable, interval } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
import { MatDialog } from '@angular/material/dialog';
|
|
5
|
+
|
|
6
|
+
import { ModalWidgetComponent } from '../modal-widget/modal-widget.component';
|
|
7
|
+
import { SignalKService } from '../signalk.service';
|
|
8
|
+
import { WidgetManagerService, IWidget, IWidgetConfig } from '../widget-manager.service';
|
|
9
|
+
import { UnitsService } from '../units.service';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const defaultConfig: IWidgetConfig = {
|
|
13
|
+
filterSelfPaths: true,
|
|
14
|
+
paths: {
|
|
15
|
+
"headingPath": {
|
|
16
|
+
description: "Heading",
|
|
17
|
+
path: 'self.navigation.courseOverGroundTrue',
|
|
18
|
+
source: 'default',
|
|
19
|
+
pathType: "number",
|
|
20
|
+
isPathConfigurable: true,
|
|
21
|
+
convertUnitTo: "deg"
|
|
22
|
+
},
|
|
23
|
+
"trueWindAngle": {
|
|
24
|
+
description: "True Wind Angle",
|
|
25
|
+
path: 'self.environment.wind.angleTrueWater',
|
|
26
|
+
source: 'default',
|
|
27
|
+
pathType: "number",
|
|
28
|
+
isPathConfigurable: true,
|
|
29
|
+
convertUnitTo: "deg"
|
|
30
|
+
},
|
|
31
|
+
"trueWindSpeed": {
|
|
32
|
+
description: "True Wind Speed",
|
|
33
|
+
path: 'self.environment.wind.speedTrue',
|
|
34
|
+
source: 'default',
|
|
35
|
+
pathType: "number",
|
|
36
|
+
isPathConfigurable: true,
|
|
37
|
+
convertUnitTo: "knots"
|
|
38
|
+
},
|
|
39
|
+
"appWindAngle": {
|
|
40
|
+
description: "Apparent Wind Angle",
|
|
41
|
+
path: 'self.environment.wind.angleApparent',
|
|
42
|
+
source: 'default',
|
|
43
|
+
pathType: "number",
|
|
44
|
+
isPathConfigurable: true,
|
|
45
|
+
convertUnitTo: "deg"
|
|
46
|
+
},
|
|
47
|
+
"appWindSpeed": {
|
|
48
|
+
description: "Apparent Wind Speed",
|
|
49
|
+
path: 'self.environment.wind.speedApparent',
|
|
50
|
+
source: 'default',
|
|
51
|
+
pathType: "number",
|
|
52
|
+
isPathConfigurable: true,
|
|
53
|
+
convertUnitTo: "knots"
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
windSectorEnable: true,
|
|
57
|
+
windSectorWindowSeconds: 10,
|
|
58
|
+
laylineEnable: true,
|
|
59
|
+
laylineAngle: 35,
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@Component({
|
|
64
|
+
selector: 'app-widget-wind',
|
|
65
|
+
templateUrl: './widget-wind.component.html',
|
|
66
|
+
styleUrls: ['./widget-wind.component.css']
|
|
67
|
+
})
|
|
68
|
+
export class WidgetWindComponent implements OnInit, OnDestroy {
|
|
69
|
+
|
|
70
|
+
@Input('widgetUUID') widgetUUID: string;
|
|
71
|
+
@Input('unlockStatus') unlockStatus: boolean;
|
|
72
|
+
|
|
73
|
+
activeWidget: IWidget;
|
|
74
|
+
config: IWidgetConfig;
|
|
75
|
+
|
|
76
|
+
currentHeading: number = 0;
|
|
77
|
+
headingSub: Subscription = null;
|
|
78
|
+
|
|
79
|
+
appWindAngle: number = null;
|
|
80
|
+
appWindAngleSub: Subscription = null;
|
|
81
|
+
|
|
82
|
+
appWindSpeed: number = null;
|
|
83
|
+
appWindSpeedSub: Subscription = null;
|
|
84
|
+
|
|
85
|
+
trueWindAngle: number = null;
|
|
86
|
+
trueWindAngleSub: Subscription = null;
|
|
87
|
+
|
|
88
|
+
trueWindSpeed: number = null;
|
|
89
|
+
trueWindSpeedSub: Subscription = null;
|
|
90
|
+
|
|
91
|
+
trueWindHistoric: {
|
|
92
|
+
timestamp: number;
|
|
93
|
+
heading: number;
|
|
94
|
+
}[] = [];
|
|
95
|
+
trueWindMinHistoric: number;
|
|
96
|
+
trueWindMidHistoric: number;
|
|
97
|
+
trueWindMaxHistoric: number;
|
|
98
|
+
|
|
99
|
+
windSectorObservableSub: Subscription;
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
constructor(
|
|
103
|
+
public dialog:MatDialog,
|
|
104
|
+
private SignalKService: SignalKService,
|
|
105
|
+
private WidgetManagerService: WidgetManagerService,
|
|
106
|
+
private UnitsService: UnitsService) {
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
ngOnInit() {
|
|
111
|
+
this.activeWidget = this.WidgetManagerService.getWidget(this.widgetUUID);
|
|
112
|
+
if (this.activeWidget.config === null) {
|
|
113
|
+
// no data, let's set some!
|
|
114
|
+
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, defaultConfig);
|
|
115
|
+
this.config = defaultConfig; // load default config.
|
|
116
|
+
} else {
|
|
117
|
+
this.config = this.activeWidget.config;
|
|
118
|
+
}
|
|
119
|
+
this.startAll();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
ngOnDestroy() {
|
|
123
|
+
this.stopAll();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
startAll() {
|
|
127
|
+
this.subscribeHeading();
|
|
128
|
+
this.subscribeAppWindAngle();
|
|
129
|
+
this.subscribeAppWindSpeed();
|
|
130
|
+
this.subscribeTrueWindAngle();
|
|
131
|
+
this.subscribeTrueWindSpeed();
|
|
132
|
+
this.startWindSectors();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
stopAll() {
|
|
136
|
+
this.unsubscribeHeading();
|
|
137
|
+
this.unsubscribeAppWindAngle();
|
|
138
|
+
this.unsubscribeAppWindSpeed();
|
|
139
|
+
this.unsubscribeTrueWindAngle();
|
|
140
|
+
this.unsubscribeTrueWindSpeed();
|
|
141
|
+
this.stopWindSectors();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
subscribeHeading() {
|
|
145
|
+
this.unsubscribeHeading();
|
|
146
|
+
if (typeof(this.config.paths['headingPath'].path) != 'string') { return } // nothing to sub to...
|
|
147
|
+
this.headingSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['headingPath'].path, this.config.paths['headingPath'].source).subscribe(
|
|
148
|
+
newValue => {
|
|
149
|
+
if (newValue.value === null) {
|
|
150
|
+
this.currentHeading = 0;
|
|
151
|
+
} else {
|
|
152
|
+
this.currentHeading = this.UnitsService.convertUnit('deg', newValue.value);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
subscribeAppWindAngle() {
|
|
160
|
+
this.unsubscribeAppWindAngle();
|
|
161
|
+
if (typeof(this.config.paths['appWindAngle'].path) != 'string') { return } // nothing to sub to...
|
|
162
|
+
|
|
163
|
+
this.appWindAngleSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['appWindAngle'].path, this.config.paths['appWindAngle'].source).subscribe(
|
|
164
|
+
newValue => {
|
|
165
|
+
if (newValue.value === null) {
|
|
166
|
+
this.appWindAngle = null;
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let converted = this.UnitsService.convertUnit('deg', newValue.value);
|
|
171
|
+
// 0-180+ for stb
|
|
172
|
+
// -0 to -180 for port
|
|
173
|
+
// need in 0-360
|
|
174
|
+
if (converted < 0) {// stb
|
|
175
|
+
this.appWindAngle= 360 + converted; // adding a negative number subtracts it...
|
|
176
|
+
} else {
|
|
177
|
+
this.appWindAngle = converted;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
subscribeAppWindSpeed() {
|
|
185
|
+
this.unsubscribeAppWindSpeed();
|
|
186
|
+
if (typeof(this.config.paths['appWindSpeed'].path) != 'string') { return } // nothing to sub to...
|
|
187
|
+
|
|
188
|
+
this.appWindSpeedSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['appWindSpeed'].path, this.config.paths['appWindSpeed'].source).subscribe(
|
|
189
|
+
newValue => {
|
|
190
|
+
this.appWindSpeed = this.UnitsService.convertUnit(this.config.paths['appWindSpeed'].convertUnitTo, newValue.value);
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
subscribeTrueWindAngle() {
|
|
196
|
+
this.unsubscribeTrueWindAngle();
|
|
197
|
+
if (typeof(this.config.paths['trueWindAngle'].path) != 'string') { return } // nothing to sub to...
|
|
198
|
+
|
|
199
|
+
this.trueWindAngleSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['trueWindAngle'].path, this.config.paths['trueWindAngle'].source).subscribe(
|
|
200
|
+
newValue => {
|
|
201
|
+
if (newValue.value === null) {
|
|
202
|
+
this.trueWindAngle = null;
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let converted = this.UnitsService.convertUnit('deg', newValue.value);
|
|
207
|
+
|
|
208
|
+
// Depending on path, this number can either be the magnetic compass heading, true compass heading, or heading relative to boat heading (-180 to 180deg)... Ugh...
|
|
209
|
+
// 0-180+ for stb
|
|
210
|
+
// -0 to -180 for port
|
|
211
|
+
// need in 0-360
|
|
212
|
+
|
|
213
|
+
if (this.config.paths['trueWindAngle'].path.match('angleTrueWater')||
|
|
214
|
+
this.config.paths['trueWindAngle'].path.match('angleTrueGround')) {
|
|
215
|
+
//-180 to 180
|
|
216
|
+
this.trueWindAngle = this.addHeading(this.currentHeading, converted);
|
|
217
|
+
} else if (this.config.paths['trueWindAngle'].path.match('direction')) {
|
|
218
|
+
//0-360
|
|
219
|
+
this.trueWindAngle = converted;
|
|
220
|
+
} else {
|
|
221
|
+
// some other path... assume it's the angle
|
|
222
|
+
this.trueWindAngle = converted;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
//add to historical for wind sectors
|
|
226
|
+
if (this.config.windSectorEnable) {
|
|
227
|
+
this.addHistoricalTrue(this.trueWindAngle);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
subscribeTrueWindSpeed() {
|
|
234
|
+
this.unsubscribeTrueWindSpeed();
|
|
235
|
+
if (typeof(this.config.paths['trueWindSpeed'].path) != 'string') { return } // nothing to sub to...
|
|
236
|
+
|
|
237
|
+
this.trueWindSpeedSub = this.SignalKService.subscribePath(this.widgetUUID, this.config.paths['trueWindSpeed'].path, this.config.paths['trueWindSpeed'].source).subscribe(
|
|
238
|
+
newValue => {
|
|
239
|
+
this.trueWindSpeed = this.UnitsService.convertUnit(this.config.paths['trueWindSpeed'].convertUnitTo, newValue.value);
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
startWindSectors() {
|
|
245
|
+
this.windSectorObservableSub = interval (500).subscribe(x => {
|
|
246
|
+
this.historicalCleanup();
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
addHistoricalTrue (windHeading) {
|
|
251
|
+
this.trueWindHistoric.push({
|
|
252
|
+
timestamp: Date.now(),
|
|
253
|
+
heading: windHeading
|
|
254
|
+
});
|
|
255
|
+
let arr = this.arcForAngles(this.trueWindHistoric.map(d => d.heading));
|
|
256
|
+
this.trueWindMinHistoric = arr[0];
|
|
257
|
+
this.trueWindMaxHistoric = arr[1];
|
|
258
|
+
this.trueWindMidHistoric = arr[2];
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
arcForAngles (data) {
|
|
262
|
+
return data.slice(1).reduce((acc, theValue) => {
|
|
263
|
+
let value = theValue
|
|
264
|
+
while (value < acc[0] - 180) {
|
|
265
|
+
value += 360
|
|
266
|
+
}
|
|
267
|
+
while (value > acc[1] + 180) {
|
|
268
|
+
value -= 360
|
|
269
|
+
}
|
|
270
|
+
acc[0] = Math.min(acc[0], value)
|
|
271
|
+
acc[1] = Math.max(acc[1], value)
|
|
272
|
+
acc[2] = ((acc[1]-acc[0])/2)+acc[0];
|
|
273
|
+
return acc
|
|
274
|
+
}, [data[0], data[0]])
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
historicalCleanup() {
|
|
278
|
+
let n = Date.now()-(this.config.windSectorWindowSeconds*1000);
|
|
279
|
+
for (var i = this.trueWindHistoric.length - 1; i >= 0; --i) {
|
|
280
|
+
if (this.trueWindHistoric[i].timestamp < n) {
|
|
281
|
+
this.trueWindHistoric.splice(i,1);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
stopWindSectors() {
|
|
287
|
+
this.windSectorObservableSub.unsubscribe();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
unsubscribeHeading() {
|
|
291
|
+
if (this.headingSub !== null) {
|
|
292
|
+
this.headingSub.unsubscribe();
|
|
293
|
+
this.headingSub = null;
|
|
294
|
+
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['headingPath'].path);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
unsubscribeAppWindAngle() {
|
|
299
|
+
if (this.appWindAngleSub !== null) {
|
|
300
|
+
this.appWindAngleSub.unsubscribe();
|
|
301
|
+
this.appWindAngleSub = null;
|
|
302
|
+
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['appWindAngle'].path);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
unsubscribeAppWindSpeed() {
|
|
307
|
+
if (this.appWindSpeedSub !== null) {
|
|
308
|
+
this.appWindSpeedSub.unsubscribe();
|
|
309
|
+
this.appWindSpeedSub = null;
|
|
310
|
+
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['appWindSpeed'].path);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
unsubscribeTrueWindAngle() {
|
|
315
|
+
if (this.trueWindAngleSub !== null) {
|
|
316
|
+
this.trueWindAngleSub.unsubscribe();
|
|
317
|
+
this.trueWindAngleSub = null;
|
|
318
|
+
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['trueWindAngle'].path);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
unsubscribeTrueWindSpeed() {
|
|
323
|
+
if (this.trueWindSpeedSub !== null) {
|
|
324
|
+
this.trueWindSpeedSub.unsubscribe();
|
|
325
|
+
this.trueWindSpeedSub = null;
|
|
326
|
+
this.SignalKService.unsubscribePath(this.widgetUUID, this.config.paths['trueWindSpeed'].path);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
addHeading(h1: number, h2: number) {
|
|
334
|
+
let h3 = h1 + h2;
|
|
335
|
+
while (h3 > 359) { h3 = h3 - 359; }
|
|
336
|
+
while (h3 < 0) { h3 = h3 + 359; }
|
|
337
|
+
return h3;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
openWidgetSettings() {
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
let dialogRef = this.dialog.open(ModalWidgetComponent, {
|
|
352
|
+
width: '80%',
|
|
353
|
+
data: this.config
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
357
|
+
// save new settings
|
|
358
|
+
if (result) {
|
|
359
|
+
console.log(result);
|
|
360
|
+
this.stopAll();//unsub now as we will change variables so wont know what was subbed before...
|
|
361
|
+
this.config = result;
|
|
362
|
+
this.WidgetManagerService.updateWidgetConfig(this.widgetUUID, this.config);
|
|
363
|
+
this.startAll();
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
}
|