@mxtommy/kip 1.2.3 → 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 -135
- package/CONTRIBUTORS.md +16 -16
- package/README.md +102 -102
- package/angular.json +162 -153
- package/karma.conf.js +31 -31
- package/package.json +87 -84
- package/public/3rdpartylicenses.txt +301 -21
- 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 -135
- 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 -383
- 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 +300 -300
- package/src/app/gauges-module/linear-gauge.ts +49 -49
- package/src/app/gauges-module/radial-gauge.ts +47 -47
- 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 -341
- 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 -392
- 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 +174 -174
- 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 +1 -1
- 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 -306
- 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 -141
- 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.ab0adc5af3ab3e70c849.js +0 -1
- package/public/main-es5.ab0adc5af3ab3e70c849.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,280 +1,280 @@
|
|
|
1
|
-
import { Component, Input, ViewChild, ElementRef, SimpleChanges } from '@angular/core';
|
|
2
|
-
import { isNumber } from 'util';
|
|
3
|
-
|
|
4
|
-
const angle = ([a,b],[c,d],[e,f]) => (Math.atan2(f-d,e-c)-Math.atan2(b-d,a-c)+3*Math.PI)%(2*Math.PI)-Math.PI;
|
|
5
|
-
|
|
6
|
-
@Component({
|
|
7
|
-
selector: 'app-svg-wind',
|
|
8
|
-
templateUrl: './svg-wind.component.html',
|
|
9
|
-
styleUrls: ['./svg-wind.component.css']
|
|
10
|
-
})
|
|
11
|
-
export class SvgWindComponent {
|
|
12
|
-
|
|
13
|
-
@ViewChild('compassAnimate') compassAnimate: ElementRef;
|
|
14
|
-
@ViewChild('appWindAnimate') appWindAnimate: ElementRef;
|
|
15
|
-
@ViewChild('trueWindAnimate') trueWindAnimate: ElementRef;
|
|
16
|
-
//@ViewChild('laylinePortAnimate') laylinePortAnimate: ElementRef;
|
|
17
|
-
//@ViewChild('laylineStbAnimate') laylineStbAnimate: ElementRef;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@Input('compassHeading') compassHeading: number;
|
|
21
|
-
@Input('trueWindAngle') trueWindAngle: number;
|
|
22
|
-
@Input('trueWindSpeed') trueWindSpeed: number;
|
|
23
|
-
@Input('appWindAngle') appWindAngle: number;
|
|
24
|
-
@Input('appWindSpeed') appWindSpeed: number;
|
|
25
|
-
@Input('laylineAngle') laylineAngle : number;
|
|
26
|
-
@Input('laylineEnable') laylineEnable: boolean;
|
|
27
|
-
@Input('windSectorEnable') windSectorEnable: boolean;
|
|
28
|
-
@Input('trueWindMinHistoric') trueWindMinHistoric: number;
|
|
29
|
-
@Input('trueWindMidHistoric') trueWindMidHistoric: number;
|
|
30
|
-
@Input('trueWindMaxHistoric') trueWindMaxHistoric: number;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
constructor() { }
|
|
35
|
-
|
|
36
|
-
oldCompassRotate: number = 0;
|
|
37
|
-
newCompassRotate: number = 0;
|
|
38
|
-
headingValue: string ="0";
|
|
39
|
-
|
|
40
|
-
//Appwind
|
|
41
|
-
oldAppWindAngle: string = "0";
|
|
42
|
-
newAppWindAngle: string = "0";
|
|
43
|
-
appWindSpeedDisplay: string = "";
|
|
44
|
-
|
|
45
|
-
//truewind
|
|
46
|
-
oldTrueWindRotateAngle: string = "0";
|
|
47
|
-
newTrueWindRotateAngle: string = "0";
|
|
48
|
-
trueWindHeading: number = 0;
|
|
49
|
-
trueWindSpeedDisplay: string = "";
|
|
50
|
-
|
|
51
|
-
//laylines
|
|
52
|
-
laylinePortPath: string = "M 250,250 250,90";
|
|
53
|
-
laylineStbdPath: string = "M 250,250 250,90";
|
|
54
|
-
|
|
55
|
-
//WindSectors
|
|
56
|
-
portWindSectorPath: string = "none";
|
|
57
|
-
stbdWindSectorPath: string = "none";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
61
|
-
|
|
62
|
-
//heading
|
|
63
|
-
if (changes.compassHeading) {
|
|
64
|
-
if (! changes.compassHeading.firstChange) {
|
|
65
|
-
this.oldCompassRotate = this.newCompassRotate;
|
|
66
|
-
this.newCompassRotate = changes.compassHeading.currentValue;// .toString();
|
|
67
|
-
this.headingValue = this.newCompassRotate.toFixed(0);
|
|
68
|
-
this.compassAnimate.nativeElement.beginElement();
|
|
69
|
-
this.updateTrueWind();// rotates with heading change
|
|
70
|
-
this.updateWindSectors();// they need to update to new heading too
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//appWindAngle
|
|
75
|
-
if (changes.appWindAngle) {
|
|
76
|
-
if (! changes.appWindAngle.firstChange) {
|
|
77
|
-
this.oldAppWindAngle = this.newAppWindAngle;
|
|
78
|
-
this.newAppWindAngle = changes.appWindAngle.currentValue.toFixed(0);
|
|
79
|
-
|
|
80
|
-
let oldAngle = Number(this.oldAppWindAngle)
|
|
81
|
-
let newAngle = Number(this.newAppWindAngle);
|
|
82
|
-
let diff = oldAngle - newAngle;
|
|
83
|
-
|
|
84
|
-
// only update if on DOM and value rounded changed
|
|
85
|
-
if (this.appWindAnimate && (diff != 0)) {
|
|
86
|
-
// Special cases to smooth out passing between 359 to/from 0
|
|
87
|
-
// if more than half the circle, it could need to go over the 359 / 0 values
|
|
88
|
-
if ( Math.abs(diff) > 180 ) {
|
|
89
|
-
// In what direction are we moving?
|
|
90
|
-
if (Math.sign(diff) == 1) {
|
|
91
|
-
if (oldAngle == 359) {
|
|
92
|
-
// special cases
|
|
93
|
-
this.oldAppWindAngle = "0";
|
|
94
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
95
|
-
} else {
|
|
96
|
-
this.newAppWindAngle = "359";
|
|
97
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
98
|
-
this.oldAppWindAngle = "0";
|
|
99
|
-
this.newAppWindAngle = changes.appWindAngle.currentValue.toFixed(0);
|
|
100
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
101
|
-
}
|
|
102
|
-
} else {
|
|
103
|
-
if (oldAngle == 0) {
|
|
104
|
-
// special cases
|
|
105
|
-
this.oldAppWindAngle = "359";
|
|
106
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
107
|
-
} else {
|
|
108
|
-
this.newAppWindAngle = "0";
|
|
109
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
110
|
-
this.oldAppWindAngle = "359";
|
|
111
|
-
this.newAppWindAngle = changes.appWindAngle.currentValue.toFixed(0);
|
|
112
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
this.appWindAnimate.nativeElement.beginElement();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
//appWindSpeed
|
|
122
|
-
if (changes.appWindSpeed) {
|
|
123
|
-
if (! changes.appWindSpeed.firstChange) {
|
|
124
|
-
this.appWindSpeedDisplay = changes.appWindSpeed.currentValue.toFixed(1);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
//trueWindAngle
|
|
129
|
-
if (changes.trueWindAngle) {
|
|
130
|
-
if (! changes.trueWindAngle.firstChange) {
|
|
131
|
-
this.trueWindHeading = changes.trueWindAngle.currentValue;
|
|
132
|
-
this.updateTrueWind();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
//trueWindSpeed
|
|
137
|
-
if (changes.trueWindSpeed) {
|
|
138
|
-
if (! changes.trueWindSpeed.firstChange) {
|
|
139
|
-
this.trueWindSpeedDisplay = changes.trueWindSpeed.currentValue.toFixed(1);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
//Min/Max
|
|
144
|
-
if (changes.trueWindMinHistoric || changes.trueWindMaxHistoric) {
|
|
145
|
-
if (isNaN(Number((this.trueWindMinHistoric))) && isNaN(Number(this.trueWindMaxHistoric))) {
|
|
146
|
-
this.updateWindSectors();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
updateTrueWind(){
|
|
153
|
-
this.oldTrueWindRotateAngle = this.newTrueWindRotateAngle;
|
|
154
|
-
this.newTrueWindRotateAngle = this.addHeading(this.trueWindHeading, (this.newCompassRotate*-1)).toFixed(0); //compass rotate is negative as we actually have to rotate counter clockwise
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
let oldAngle = Number(this.oldTrueWindRotateAngle)
|
|
158
|
-
let newAngle = Number(this.newTrueWindRotateAngle);
|
|
159
|
-
let diff = oldAngle - newAngle;
|
|
160
|
-
|
|
161
|
-
// only update if on DOM and value rounded changed
|
|
162
|
-
if (this.trueWindAnimate && (diff != 0)) {
|
|
163
|
-
// Special cases to smooth out passing between 359 to/from 0
|
|
164
|
-
// if more than half the circle, it could need to go over the 359 / 0 values
|
|
165
|
-
if ( Math.abs(diff) > 180 ) {
|
|
166
|
-
// In what direction are we moving?
|
|
167
|
-
if (Math.sign(diff) == 1) {
|
|
168
|
-
if (oldAngle == 359) {
|
|
169
|
-
// special cases
|
|
170
|
-
this.oldTrueWindRotateAngle = "0";
|
|
171
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
172
|
-
} else {
|
|
173
|
-
this.newTrueWindRotateAngle = "359";
|
|
174
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
175
|
-
this.oldTrueWindRotateAngle = "0";
|
|
176
|
-
this.newTrueWindRotateAngle = this.addHeading(this.trueWindHeading, (this.newCompassRotate*-1)).toFixed(0);
|
|
177
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
if (oldAngle == 0) {
|
|
181
|
-
// special cases
|
|
182
|
-
this.oldTrueWindRotateAngle = "359";
|
|
183
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
184
|
-
} else {
|
|
185
|
-
this.newTrueWindRotateAngle = "0";
|
|
186
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
187
|
-
this.oldTrueWindRotateAngle = "359";
|
|
188
|
-
this.newTrueWindRotateAngle = this.addHeading(this.trueWindHeading, (this.newCompassRotate*-1)).toFixed(0);
|
|
189
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
} else {
|
|
193
|
-
this.trueWindAnimate.nativeElement.beginElement();
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
//calculate laylines
|
|
198
|
-
|
|
199
|
-
let portLaylineRotate = this.addHeading(Number(this.newTrueWindRotateAngle), (this.laylineAngle*-1));
|
|
200
|
-
//find xy of that rotation (160 = radius of inner circle)
|
|
201
|
-
let portX = 160 * Math.sin((portLaylineRotate*Math.PI)/180) + 250; //250 is middle
|
|
202
|
-
let portY = (160 * Math.cos((portLaylineRotate*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
203
|
-
this.laylinePortPath = 'M 250,250 ' + portX +',' + portY;
|
|
204
|
-
|
|
205
|
-
let stbdLaylineRotate = this.addHeading(Number(this.newTrueWindRotateAngle), (this.laylineAngle));
|
|
206
|
-
//find xy of that rotation (160 = radius of inner circle)
|
|
207
|
-
let stbdX = 160 * Math.sin((stbdLaylineRotate*Math.PI)/180) + 250; //250 is middle
|
|
208
|
-
let stbdY = (160 * Math.cos((stbdLaylineRotate*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
209
|
-
this.laylineStbdPath = 'M 250,250 ' + stbdX +',' + stbdY;
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
updateWindSectors() {
|
|
215
|
-
let portMin = this.addHeading(this.addHeading(this.trueWindMinHistoric, (this.newCompassRotate*-1)), (this.laylineAngle*-1));
|
|
216
|
-
let portMid = this.addHeading(this.addHeading(this.trueWindMidHistoric, (this.newCompassRotate*-1)), (this.laylineAngle*-1));
|
|
217
|
-
let portMax = this.addHeading(this.addHeading(this.trueWindMaxHistoric, (this.newCompassRotate*-1)), (this.laylineAngle*-1));
|
|
218
|
-
|
|
219
|
-
//console.log(this.trueWindMinHistoric.toFixed(0) + ' ' + this.trueWindMaxHistoric.toFixed(0) + ' ' + portMin.toFixed(0) + ' ' + portMax.toFixed(0));
|
|
220
|
-
let portMinX = 160 * Math.sin((portMin*Math.PI)/180) + 250; //250 is middle
|
|
221
|
-
let portMinY = (160 * Math.cos((portMin*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
222
|
-
let portMidX = 160 * Math.sin((portMid*Math.PI)/180) + 250; //250 is middle
|
|
223
|
-
let portMidY = (160 * Math.cos((portMid*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
224
|
-
let portMaxX = 160 * Math.sin((portMax*Math.PI)/180) + 250; //250 is middle
|
|
225
|
-
let portMaxY = (160 * Math.cos((portMax*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
226
|
-
|
|
227
|
-
//calculate angles for arc options https://stackoverflow.com/questions/21816286/svg-arc-how-to-determine-sweep-and-larg-arc-flags-given-start-end-via-point
|
|
228
|
-
let portLgArcFl = Math.abs(angle([portMinX,portMinY],[portMidX,portMidY],[portMaxX,portMaxY])) > Math.PI/2 ? 0 : 1;
|
|
229
|
-
let portSweepFl = angle([portMaxX,portMaxY],[portMinX,portMinY],[portMidX,portMidY]) > 0 ? 0 : 1;
|
|
230
|
-
|
|
231
|
-
this.portWindSectorPath = 'M 250,250 L ' + portMinX + ',' + portMinY + ' A 160,160 0 ' + portLgArcFl + ' ' + portSweepFl + ' ' + portMaxX + ',' + portMaxY +' z';
|
|
232
|
-
//////////
|
|
233
|
-
let stbdMin = this.addHeading(this.addHeading(this.trueWindMinHistoric, (this.newCompassRotate*-1)), (this.laylineAngle));
|
|
234
|
-
let stbdMid = this.addHeading(this.addHeading(this.trueWindMidHistoric, (this.newCompassRotate*-1)), (this.laylineAngle));
|
|
235
|
-
let stbdMax = this.addHeading(this.addHeading(this.trueWindMaxHistoric, (this.newCompassRotate*-1)), (this.laylineAngle));
|
|
236
|
-
|
|
237
|
-
let stbdMinX = 160 * Math.sin((stbdMin*Math.PI)/180) + 250; //250 is middle
|
|
238
|
-
let stbdMinY = (160 * Math.cos((stbdMin*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
239
|
-
let stbdMidX = 160 * Math.sin((stbdMid*Math.PI)/180) + 250; //250 is middle
|
|
240
|
-
let stbdMidY = (160 * Math.cos((stbdMid*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
241
|
-
let stbdMaxX = 160 * Math.sin((stbdMax*Math.PI)/180) + 250; //250 is middle
|
|
242
|
-
let stbdMaxY = (160 * Math.cos((stbdMax*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
243
|
-
|
|
244
|
-
let stbdLgArcFl = Math.abs(angle([stbdMinX,stbdMinY],[stbdMidX,stbdMidY],[stbdMaxX,stbdMaxY])) > Math.PI/2 ? 0 : 1;
|
|
245
|
-
let stbdSweepFl = angle([stbdMaxX,stbdMaxY],[stbdMinX,stbdMinY],[stbdMidX,stbdMidY]) > 0 ? 0 : 1;
|
|
246
|
-
|
|
247
|
-
this.stbdWindSectorPath = 'M 250,250 L ' + stbdMinX + ',' + stbdMinY + ' A 160,160 0 ' + stbdLgArcFl + ' ' + stbdSweepFl + ' ' + stbdMaxX + ',' + stbdMaxY +' z';
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
addHeading(h1: number = 0, h2: number = 0) {
|
|
255
|
-
let h3 = h1 + h2;
|
|
256
|
-
while (h3 > 359) { h3 = h3 - 359; }
|
|
257
|
-
while (h3 < 0) { h3 = h3 + 359; }
|
|
258
|
-
return h3;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
/*
|
|
270
|
-
<animateTransform #compassAnimate attributeName="transform"
|
|
271
|
-
type="rotate"
|
|
272
|
-
[attr.from]="'-'+oldCompassRotate+' 250 250'"
|
|
273
|
-
[attr.to]="'-'+newCompassRotate+' 250 250'"
|
|
274
|
-
begin="indefinite"
|
|
275
|
-
dur="0.5s"
|
|
276
|
-
additive="replace"
|
|
277
|
-
fill="freeze"
|
|
278
|
-
/>
|
|
279
|
-
|
|
280
|
-
*/
|
|
1
|
+
import { Component, Input, ViewChild, ElementRef, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { isNumber } from 'util';
|
|
3
|
+
|
|
4
|
+
const angle = ([a,b],[c,d],[e,f]) => (Math.atan2(f-d,e-c)-Math.atan2(b-d,a-c)+3*Math.PI)%(2*Math.PI)-Math.PI;
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'app-svg-wind',
|
|
8
|
+
templateUrl: './svg-wind.component.html',
|
|
9
|
+
styleUrls: ['./svg-wind.component.css']
|
|
10
|
+
})
|
|
11
|
+
export class SvgWindComponent {
|
|
12
|
+
|
|
13
|
+
@ViewChild('compassAnimate') compassAnimate: ElementRef;
|
|
14
|
+
@ViewChild('appWindAnimate') appWindAnimate: ElementRef;
|
|
15
|
+
@ViewChild('trueWindAnimate') trueWindAnimate: ElementRef;
|
|
16
|
+
//@ViewChild('laylinePortAnimate') laylinePortAnimate: ElementRef;
|
|
17
|
+
//@ViewChild('laylineStbAnimate') laylineStbAnimate: ElementRef;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@Input('compassHeading') compassHeading: number;
|
|
21
|
+
@Input('trueWindAngle') trueWindAngle: number;
|
|
22
|
+
@Input('trueWindSpeed') trueWindSpeed: number;
|
|
23
|
+
@Input('appWindAngle') appWindAngle: number;
|
|
24
|
+
@Input('appWindSpeed') appWindSpeed: number;
|
|
25
|
+
@Input('laylineAngle') laylineAngle : number;
|
|
26
|
+
@Input('laylineEnable') laylineEnable: boolean;
|
|
27
|
+
@Input('windSectorEnable') windSectorEnable: boolean;
|
|
28
|
+
@Input('trueWindMinHistoric') trueWindMinHistoric: number;
|
|
29
|
+
@Input('trueWindMidHistoric') trueWindMidHistoric: number;
|
|
30
|
+
@Input('trueWindMaxHistoric') trueWindMaxHistoric: number;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
constructor() { }
|
|
35
|
+
|
|
36
|
+
oldCompassRotate: number = 0;
|
|
37
|
+
newCompassRotate: number = 0;
|
|
38
|
+
headingValue: string ="0";
|
|
39
|
+
|
|
40
|
+
//Appwind
|
|
41
|
+
oldAppWindAngle: string = "0";
|
|
42
|
+
newAppWindAngle: string = "0";
|
|
43
|
+
appWindSpeedDisplay: string = "";
|
|
44
|
+
|
|
45
|
+
//truewind
|
|
46
|
+
oldTrueWindRotateAngle: string = "0";
|
|
47
|
+
newTrueWindRotateAngle: string = "0";
|
|
48
|
+
trueWindHeading: number = 0;
|
|
49
|
+
trueWindSpeedDisplay: string = "";
|
|
50
|
+
|
|
51
|
+
//laylines
|
|
52
|
+
laylinePortPath: string = "M 250,250 250,90";
|
|
53
|
+
laylineStbdPath: string = "M 250,250 250,90";
|
|
54
|
+
|
|
55
|
+
//WindSectors
|
|
56
|
+
portWindSectorPath: string = "none";
|
|
57
|
+
stbdWindSectorPath: string = "none";
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
ngOnChanges(changes: SimpleChanges) {
|
|
61
|
+
|
|
62
|
+
//heading
|
|
63
|
+
if (changes.compassHeading) {
|
|
64
|
+
if (! changes.compassHeading.firstChange) {
|
|
65
|
+
this.oldCompassRotate = this.newCompassRotate;
|
|
66
|
+
this.newCompassRotate = changes.compassHeading.currentValue;// .toString();
|
|
67
|
+
this.headingValue = this.newCompassRotate.toFixed(0);
|
|
68
|
+
this.compassAnimate.nativeElement.beginElement();
|
|
69
|
+
this.updateTrueWind();// rotates with heading change
|
|
70
|
+
this.updateWindSectors();// they need to update to new heading too
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
//appWindAngle
|
|
75
|
+
if (changes.appWindAngle) {
|
|
76
|
+
if (! changes.appWindAngle.firstChange) {
|
|
77
|
+
this.oldAppWindAngle = this.newAppWindAngle;
|
|
78
|
+
this.newAppWindAngle = changes.appWindAngle.currentValue.toFixed(0);
|
|
79
|
+
|
|
80
|
+
let oldAngle = Number(this.oldAppWindAngle)
|
|
81
|
+
let newAngle = Number(this.newAppWindAngle);
|
|
82
|
+
let diff = oldAngle - newAngle;
|
|
83
|
+
|
|
84
|
+
// only update if on DOM and value rounded changed
|
|
85
|
+
if (this.appWindAnimate && (diff != 0)) {
|
|
86
|
+
// Special cases to smooth out passing between 359 to/from 0
|
|
87
|
+
// if more than half the circle, it could need to go over the 359 / 0 values
|
|
88
|
+
if ( Math.abs(diff) > 180 ) {
|
|
89
|
+
// In what direction are we moving?
|
|
90
|
+
if (Math.sign(diff) == 1) {
|
|
91
|
+
if (oldAngle == 359) {
|
|
92
|
+
// special cases
|
|
93
|
+
this.oldAppWindAngle = "0";
|
|
94
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
95
|
+
} else {
|
|
96
|
+
this.newAppWindAngle = "359";
|
|
97
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
98
|
+
this.oldAppWindAngle = "0";
|
|
99
|
+
this.newAppWindAngle = changes.appWindAngle.currentValue.toFixed(0);
|
|
100
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
if (oldAngle == 0) {
|
|
104
|
+
// special cases
|
|
105
|
+
this.oldAppWindAngle = "359";
|
|
106
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
107
|
+
} else {
|
|
108
|
+
this.newAppWindAngle = "0";
|
|
109
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
110
|
+
this.oldAppWindAngle = "359";
|
|
111
|
+
this.newAppWindAngle = changes.appWindAngle.currentValue.toFixed(0);
|
|
112
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
} else {
|
|
116
|
+
this.appWindAnimate.nativeElement.beginElement();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//appWindSpeed
|
|
122
|
+
if (changes.appWindSpeed) {
|
|
123
|
+
if (! changes.appWindSpeed.firstChange) {
|
|
124
|
+
this.appWindSpeedDisplay = changes.appWindSpeed.currentValue.toFixed(1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//trueWindAngle
|
|
129
|
+
if (changes.trueWindAngle) {
|
|
130
|
+
if (! changes.trueWindAngle.firstChange) {
|
|
131
|
+
this.trueWindHeading = changes.trueWindAngle.currentValue;
|
|
132
|
+
this.updateTrueWind();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//trueWindSpeed
|
|
137
|
+
if (changes.trueWindSpeed) {
|
|
138
|
+
if (! changes.trueWindSpeed.firstChange) {
|
|
139
|
+
this.trueWindSpeedDisplay = changes.trueWindSpeed.currentValue.toFixed(1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
//Min/Max
|
|
144
|
+
if (changes.trueWindMinHistoric || changes.trueWindMaxHistoric) {
|
|
145
|
+
if (isNaN(Number((this.trueWindMinHistoric))) && isNaN(Number(this.trueWindMaxHistoric))) {
|
|
146
|
+
this.updateWindSectors();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
updateTrueWind(){
|
|
153
|
+
this.oldTrueWindRotateAngle = this.newTrueWindRotateAngle;
|
|
154
|
+
this.newTrueWindRotateAngle = this.addHeading(this.trueWindHeading, (this.newCompassRotate*-1)).toFixed(0); //compass rotate is negative as we actually have to rotate counter clockwise
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
let oldAngle = Number(this.oldTrueWindRotateAngle)
|
|
158
|
+
let newAngle = Number(this.newTrueWindRotateAngle);
|
|
159
|
+
let diff = oldAngle - newAngle;
|
|
160
|
+
|
|
161
|
+
// only update if on DOM and value rounded changed
|
|
162
|
+
if (this.trueWindAnimate && (diff != 0)) {
|
|
163
|
+
// Special cases to smooth out passing between 359 to/from 0
|
|
164
|
+
// if more than half the circle, it could need to go over the 359 / 0 values
|
|
165
|
+
if ( Math.abs(diff) > 180 ) {
|
|
166
|
+
// In what direction are we moving?
|
|
167
|
+
if (Math.sign(diff) == 1) {
|
|
168
|
+
if (oldAngle == 359) {
|
|
169
|
+
// special cases
|
|
170
|
+
this.oldTrueWindRotateAngle = "0";
|
|
171
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
172
|
+
} else {
|
|
173
|
+
this.newTrueWindRotateAngle = "359";
|
|
174
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
175
|
+
this.oldTrueWindRotateAngle = "0";
|
|
176
|
+
this.newTrueWindRotateAngle = this.addHeading(this.trueWindHeading, (this.newCompassRotate*-1)).toFixed(0);
|
|
177
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
if (oldAngle == 0) {
|
|
181
|
+
// special cases
|
|
182
|
+
this.oldTrueWindRotateAngle = "359";
|
|
183
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
184
|
+
} else {
|
|
185
|
+
this.newTrueWindRotateAngle = "0";
|
|
186
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
187
|
+
this.oldTrueWindRotateAngle = "359";
|
|
188
|
+
this.newTrueWindRotateAngle = this.addHeading(this.trueWindHeading, (this.newCompassRotate*-1)).toFixed(0);
|
|
189
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
this.trueWindAnimate.nativeElement.beginElement();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
//calculate laylines
|
|
198
|
+
|
|
199
|
+
let portLaylineRotate = this.addHeading(Number(this.newTrueWindRotateAngle), (this.laylineAngle*-1));
|
|
200
|
+
//find xy of that rotation (160 = radius of inner circle)
|
|
201
|
+
let portX = 160 * Math.sin((portLaylineRotate*Math.PI)/180) + 250; //250 is middle
|
|
202
|
+
let portY = (160 * Math.cos((portLaylineRotate*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
203
|
+
this.laylinePortPath = 'M 250,250 ' + portX +',' + portY;
|
|
204
|
+
|
|
205
|
+
let stbdLaylineRotate = this.addHeading(Number(this.newTrueWindRotateAngle), (this.laylineAngle));
|
|
206
|
+
//find xy of that rotation (160 = radius of inner circle)
|
|
207
|
+
let stbdX = 160 * Math.sin((stbdLaylineRotate*Math.PI)/180) + 250; //250 is middle
|
|
208
|
+
let stbdY = (160 * Math.cos((stbdLaylineRotate*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
209
|
+
this.laylineStbdPath = 'M 250,250 ' + stbdX +',' + stbdY;
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
updateWindSectors() {
|
|
215
|
+
let portMin = this.addHeading(this.addHeading(this.trueWindMinHistoric, (this.newCompassRotate*-1)), (this.laylineAngle*-1));
|
|
216
|
+
let portMid = this.addHeading(this.addHeading(this.trueWindMidHistoric, (this.newCompassRotate*-1)), (this.laylineAngle*-1));
|
|
217
|
+
let portMax = this.addHeading(this.addHeading(this.trueWindMaxHistoric, (this.newCompassRotate*-1)), (this.laylineAngle*-1));
|
|
218
|
+
|
|
219
|
+
//console.log(this.trueWindMinHistoric.toFixed(0) + ' ' + this.trueWindMaxHistoric.toFixed(0) + ' ' + portMin.toFixed(0) + ' ' + portMax.toFixed(0));
|
|
220
|
+
let portMinX = 160 * Math.sin((portMin*Math.PI)/180) + 250; //250 is middle
|
|
221
|
+
let portMinY = (160 * Math.cos((portMin*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
222
|
+
let portMidX = 160 * Math.sin((portMid*Math.PI)/180) + 250; //250 is middle
|
|
223
|
+
let portMidY = (160 * Math.cos((portMid*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
224
|
+
let portMaxX = 160 * Math.sin((portMax*Math.PI)/180) + 250; //250 is middle
|
|
225
|
+
let portMaxY = (160 * Math.cos((portMax*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
226
|
+
|
|
227
|
+
//calculate angles for arc options https://stackoverflow.com/questions/21816286/svg-arc-how-to-determine-sweep-and-larg-arc-flags-given-start-end-via-point
|
|
228
|
+
let portLgArcFl = Math.abs(angle([portMinX,portMinY],[portMidX,portMidY],[portMaxX,portMaxY])) > Math.PI/2 ? 0 : 1;
|
|
229
|
+
let portSweepFl = angle([portMaxX,portMaxY],[portMinX,portMinY],[portMidX,portMidY]) > 0 ? 0 : 1;
|
|
230
|
+
|
|
231
|
+
this.portWindSectorPath = 'M 250,250 L ' + portMinX + ',' + portMinY + ' A 160,160 0 ' + portLgArcFl + ' ' + portSweepFl + ' ' + portMaxX + ',' + portMaxY +' z';
|
|
232
|
+
//////////
|
|
233
|
+
let stbdMin = this.addHeading(this.addHeading(this.trueWindMinHistoric, (this.newCompassRotate*-1)), (this.laylineAngle));
|
|
234
|
+
let stbdMid = this.addHeading(this.addHeading(this.trueWindMidHistoric, (this.newCompassRotate*-1)), (this.laylineAngle));
|
|
235
|
+
let stbdMax = this.addHeading(this.addHeading(this.trueWindMaxHistoric, (this.newCompassRotate*-1)), (this.laylineAngle));
|
|
236
|
+
|
|
237
|
+
let stbdMinX = 160 * Math.sin((stbdMin*Math.PI)/180) + 250; //250 is middle
|
|
238
|
+
let stbdMinY = (160 * Math.cos((stbdMin*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
239
|
+
let stbdMidX = 160 * Math.sin((stbdMid*Math.PI)/180) + 250; //250 is middle
|
|
240
|
+
let stbdMidY = (160 * Math.cos((stbdMid*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
241
|
+
let stbdMaxX = 160 * Math.sin((stbdMax*Math.PI)/180) + 250; //250 is middle
|
|
242
|
+
let stbdMaxY = (160 * Math.cos((stbdMax*Math.PI)/180)*-1) + 250; //-1 since SVG 0 is at top
|
|
243
|
+
|
|
244
|
+
let stbdLgArcFl = Math.abs(angle([stbdMinX,stbdMinY],[stbdMidX,stbdMidY],[stbdMaxX,stbdMaxY])) > Math.PI/2 ? 0 : 1;
|
|
245
|
+
let stbdSweepFl = angle([stbdMaxX,stbdMaxY],[stbdMinX,stbdMinY],[stbdMidX,stbdMidY]) > 0 ? 0 : 1;
|
|
246
|
+
|
|
247
|
+
this.stbdWindSectorPath = 'M 250,250 L ' + stbdMinX + ',' + stbdMinY + ' A 160,160 0 ' + stbdLgArcFl + ' ' + stbdSweepFl + ' ' + stbdMaxX + ',' + stbdMaxY +' z';
|
|
248
|
+
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
addHeading(h1: number = 0, h2: number = 0) {
|
|
255
|
+
let h3 = h1 + h2;
|
|
256
|
+
while (h3 > 359) { h3 = h3 - 359; }
|
|
257
|
+
while (h3 < 0) { h3 = h3 + 359; }
|
|
258
|
+
return h3;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
/*
|
|
270
|
+
<animateTransform #compassAnimate attributeName="transform"
|
|
271
|
+
type="rotate"
|
|
272
|
+
[attr.from]="'-'+oldCompassRotate+' 250 250'"
|
|
273
|
+
[attr.to]="'-'+newCompassRotate+' 250 250'"
|
|
274
|
+
begin="indefinite"
|
|
275
|
+
dur="0.5s"
|
|
276
|
+
additive="replace"
|
|
277
|
+
fill="freeze"
|
|
278
|
+
/>
|
|
279
|
+
|
|
280
|
+
*/
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
.unitContainer {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.unitWindow {
|
|
8
|
-
position: absolute;
|
|
9
|
-
/*padding: 20px;*/
|
|
10
|
-
width: 100%;
|
|
11
|
-
height: 100%;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.mat-card {
|
|
15
|
-
display: block;
|
|
16
|
-
position: absolute !important;
|
|
17
|
-
width: calc(100% - 4px);
|
|
18
|
-
height: calc(100% - 5px);
|
|
19
|
-
margin: 3px auto auto 2px;
|
|
20
|
-
padding: 0px;
|
|
21
|
-
transition: none;
|
|
22
|
-
transition-property: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.unitMenu {
|
|
26
|
-
position: absolute;
|
|
27
|
-
right: 5%;
|
|
28
|
-
bottom: 5%;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.mat-select-trigger {
|
|
32
|
-
min-width: 30px !important;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.full-width {
|
|
36
|
-
width: 100%;
|
|
37
|
-
}
|
|
1
|
+
.unitContainer {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.unitWindow {
|
|
8
|
+
position: absolute;
|
|
9
|
+
/*padding: 20px;*/
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.mat-card {
|
|
15
|
+
display: block;
|
|
16
|
+
position: absolute !important;
|
|
17
|
+
width: calc(100% - 4px);
|
|
18
|
+
height: calc(100% - 5px);
|
|
19
|
+
margin: 3px auto auto 2px;
|
|
20
|
+
padding: 0px;
|
|
21
|
+
transition: none;
|
|
22
|
+
transition-property: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.unitMenu {
|
|
26
|
+
position: absolute;
|
|
27
|
+
right: 5%;
|
|
28
|
+
bottom: 5%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mat-select-trigger {
|
|
32
|
+
min-width: 30px !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.full-width {
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<div class="unitContainer">
|
|
2
|
-
<mat-card>
|
|
3
|
-
<ng-template dynamic-widget></ng-template>
|
|
4
|
-
</mat-card>
|
|
5
|
-
<div class="unitMenu">
|
|
6
|
-
<button *ngIf="unlockStatus" color="accent" mat-mini-fab class="selector-fab" (click)="selectWidget()"><span class="fa fa-list"></span></button>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
1
|
+
<div class="unitContainer">
|
|
2
|
+
<mat-card>
|
|
3
|
+
<ng-template dynamic-widget></ng-template>
|
|
4
|
+
</mat-card>
|
|
5
|
+
<div class="unitMenu">
|
|
6
|
+
<button *ngIf="unlockStatus" color="accent" mat-mini-fab class="selector-fab" (click)="selectWidget()"><span class="fa-solid fa-list"></span></button>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|