diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c2bc9a..4b87a843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG: Freeboard +### v2.11.1 + +- **Fixed**: Display of AIS COG vector does not honor setting value. (#180) +- **Added**: Separate setting for AIS COG vector. + ### v2.11.0 - **Added**: COG vector for AIS vessels. (#180) diff --git a/package.json b/package.json index 037280d8..1d7ed6e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@signalk/freeboard-sk", - "version": "2.11.0", + "version": "2.11.1", "description": "Openlayers chart plotter implementation for Signal K", "keywords": [ "signalk-webapp", diff --git a/src/app/app.info.ts b/src/app/app.info.ts index c5a9b070..e18a9a25 100644 --- a/src/app/app.info.ts +++ b/src/app/app.info.ts @@ -160,7 +160,7 @@ export class AppInfo extends Info { this.name = 'Freeboard-SK'; this.shortName = 'Freeboard'; this.description = `Signal K Chart Plotter.`; - this.version = '2.11.0'; + this.version = '2.11.1'; this.url = 'https://github.com/signalk/freeboard-sk'; this.logo = './assets/img/app_logo.png'; diff --git a/src/app/app.settings.ts b/src/app/app.settings.ts index c9cb576b..1a2eb036 100644 --- a/src/app/app.settings.ts +++ b/src/app/app.settings.ts @@ -46,6 +46,9 @@ export function cleanConfig( if (typeof settings.selections.vessel.laylines === 'undefined') { settings.selections.vessel.laylines = false; } + if (typeof settings.selections.vessel.aisCogLine === 'undefined') { + settings.selections.vessel.aisCogLine = 10; + } // changeover 2.7 - for removal // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -335,8 +338,8 @@ export const DefaultConfig: IAppConfig = { trail: false, // display trail windVectors: true, // display vessel TWD, AWD vectors laylines: false, - cogLine: 10, // display COG line - aisCogLine: 10, + cogLine: 10, // self COG line time (mins) + aisCogLine: 10, // self COG line time (mins) headingLineSize: -1 // mode for display of heading line -1 = default }, positionFormat: 'XY', diff --git a/src/app/modules/map/fb-map.component.html b/src/app/modules/map/fb-map.component.html index 35a4a2e0..5e15ddfa 100644 --- a/src/app/modules/map/fb-map.component.html +++ b/src/app/modules/map/fb-map.component.html @@ -296,6 +296,7 @@ [filterIds]="app.config.selections.aisTargets" [filterByShipType]="app.config.selections.aisFilterByShipType" [filterShipTypes]="app.config.selections.aisTargetTypes" + [cogLineLength]="app.config.selections.vessel.aisCogLine" > } diff --git a/src/app/modules/map/ol/lib/resources/layer-aisvessels.component.ts b/src/app/modules/map/ol/lib/resources/layer-aisvessels.component.ts index f479abcb..b42cb521 100644 --- a/src/app/modules/map/ol/lib/resources/layer-aisvessels.component.ts +++ b/src/app/modules/map/ol/lib/resources/layer-aisvessels.component.ts @@ -4,7 +4,9 @@ import { Component, OnChanges, OnDestroy, - OnInit + OnInit, + Input, + SimpleChanges } from '@angular/core'; import { Feature } from 'ol'; import { Style, RegularShape, Fill, Stroke, Circle } from 'ol/style'; @@ -26,6 +28,8 @@ export class AISVesselsLayerComponent extends AISBaseLayerComponent implements OnInit, OnDestroy, OnChanges { + @Input() cogLineLength = 0; + constructor( protected mapComponent: MapComponent, protected changeDetectorRef: ChangeDetectorRef @@ -38,6 +42,14 @@ export class AISVesselsLayerComponent this.labelPrefixes = ['ais-']; } + ngOnChanges(changes: SimpleChanges) { + super.ngOnChanges(changes); + if ('cogLineLength' in changes) { + this.cogLineLength = changes['cogLineLength'].currentValue ?? 0; + this.onUpdateTargets(this.extractKeys(this.targets)); + } + } + // reload all Features from this.targets override onReloadTargets() { this.extractKeys(this.targets).forEach((id) => { @@ -292,6 +304,6 @@ export class AISVesselsLayerComponent // ok to show cog lines okToRenderCogLines() { - return this.mapZoom >= this.labelMinZoom; + return this.cogLineLength !== 0 && this.mapZoom >= this.labelMinZoom; } } diff --git a/src/app/modules/map/ol/lib/vessel/layer-vessel.component.ts b/src/app/modules/map/ol/lib/vessel/layer-vessel.component.ts index a29188ab..54e0ca6e 100644 --- a/src/app/modules/map/ol/lib/vessel/layer-vessel.component.ts +++ b/src/app/modules/map/ol/lib/vessel/layer-vessel.component.ts @@ -270,11 +270,12 @@ export class VesselComponent implements OnInit, OnDestroy, OnChanges { if ('cog' in this.vesselLines) { this.cogLine = this.updateLine(this.cogLine, this.vesselLines.cog); this.cogLine.setStyle((feature: Feature) => { + const color = 'rgba(204, 12, 225, 0.7)'; const geometry = feature.getGeometry() as LineString; const styles = []; styles.push( new Style({ - stroke: new Stroke({ color: 'rgba(204, 12, 225, 0.7)', width: 1 }) + stroke: new Stroke({ color: color, width: 1 }) }) ); geometry.forEachSegment((start: Coordinate, end: Coordinate) => { @@ -282,9 +283,9 @@ export class VesselComponent implements OnInit, OnDestroy, OnChanges { new Style({ geometry: new Point(end), image: new Circle({ - radius: 3, + radius: 2, stroke: new Stroke({ - color: 'rgba(204, 12, 225, 0.7)', + color: color, width: 1 }), fill: new Fill({ color: 'transparent' }) diff --git a/src/app/modules/settings/components/settings-dialog.html b/src/app/modules/settings/components/settings-dialog.html index 0b81354e..ca17949e 100644 --- a/src/app/modules/settings/components/settings-dialog.html +++ b/src/app/modules/settings/components/settings-dialog.html @@ -837,6 +837,21 @@ +