From 7912fd5f1a7a52783ba6f663437e915d332d96a7 Mon Sep 17 00:00:00 2001 From: panaaj <38519157+panaaj@users.noreply.github.com> Date: Sat, 22 Jun 2024 14:32:50 +0930 Subject: [PATCH] Use AIS shiptype to format AIS vessel display. (#162, #164) --- src/app/modules/map/mapconfig.ts | 145 +++++++++++++++++- .../resources/layer-skvessels.component.ts | 19 ++- .../modules/skresources/resource-dialogs.ts | 7 +- src/assets/help/index.html | 38 ++++- src/assets/img/ais_cargo.png | Bin 0 -> 286 bytes src/assets/img/ais_inactive.png | Bin 473 -> 249 bytes src/assets/img/ais_passenger.png | Bin 0 -> 249 bytes src/assets/img/ais_special.png | Bin 0 -> 237 bytes src/assets/img/ais_tanker.png | Bin 0 -> 269 bytes 9 files changed, 203 insertions(+), 6 deletions(-) create mode 100644 src/assets/img/ais_cargo.png create mode 100644 src/assets/img/ais_passenger.png create mode 100644 src/assets/img/ais_special.png create mode 100644 src/assets/img/ais_tanker.png diff --git a/src/app/modules/map/mapconfig.ts b/src/app/modules/map/mapconfig.ts index db0524b2..0e87943a 100644 --- a/src/app/modules/map/mapconfig.ts +++ b/src/app/modules/map/mapconfig.ts @@ -318,7 +318,150 @@ export const aisVesselStyles = { text: '', offsetY: -12 }) - }) + }), + // vessel state + moored: new Style({ + // moored state + image: new Circle({ + radius: 5, + stroke: new Stroke({ + width: 2, + color: 'white' + }), + fill: new Fill({ + color: '#FF00FF' + }) + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }), + // vessel type & state + 50: { + // special + default: new Style({ + image: new Icon({ + src: './assets/img/ais_special.png', + rotateWithView: true, + rotation: 0 + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }), + moored: new Style({ + // moored state + image: new Circle({ + radius: 5, + stroke: new Stroke({ + width: 2, + color: '#000000' + }), + fill: new Fill({ + color: '#808080' + }) + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }) + }, + 60: { + // passenger + default: new Style({ + image: new Icon({ + src: './assets/img/ais_passenger.png', + rotateWithView: true, + rotation: 0 + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }), + moored: new Style({ + // moored state + image: new Circle({ + radius: 5, + stroke: new Stroke({ + width: 2, + color: '#7F6A00' + }), + fill: new Fill({ + color: '#FFE97F' + }) + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }) + }, + 70: { + // cargo + default: new Style({ + image: new Icon({ + src: './assets/img/ais_cargo.png', + rotateWithView: true, + rotation: 0 + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }), + moored: new Style({ + // moored state + image: new Circle({ + radius: 5, + stroke: new Stroke({ + width: 2, + color: '#267F00' + }), + fill: new Fill({ + color: '#4CFF00' + }) + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }) + }, + 80: { + // tanker + default: new Style({ + image: new Icon({ + src: './assets/img/ais_tanker.png', + rotateWithView: true, + rotation: 0 + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }), + moored: new Style({ + // moored state + image: new Circle({ + radius: 5, + stroke: new Stroke({ + width: 2, + color: '#0026FF' + }), + fill: new Fill({ + color: '#0094FF' + }) + }), + text: new Text({ + text: '', + offsetY: -12 + }) + }) + } }; export const atonStyles = { diff --git a/src/app/modules/map/ol/lib/resources/layer-skvessels.component.ts b/src/app/modules/map/ol/lib/resources/layer-skvessels.component.ts index e9e471d7..b68aa51d 100644 --- a/src/app/modules/map/ol/lib/resources/layer-skvessels.component.ts +++ b/src/app/modules/map/ol/lib/resources/layer-skvessels.component.ts @@ -338,12 +338,13 @@ export class SKVesselsLayerComponent implements OnInit, OnDestroy, OnChanges { } // build target style - buildTargetStyle(id: string, item, setStale = false): Style { + buildTargetStyle(id: string, item: SKVessel, setStale = false): Style { let s: Style; const lbl = item.name ?? item.callsign ?? item.mmsi ?? ''; // ** stale check time ref const now = new Date().valueOf(); + const st = item.type.id ? Math.floor(item.type.id / 10) * 10 : -1; if (typeof this.targetStyles !== 'undefined') { if (id === this.focusId && this.targetStyles.focus) { s = this.targetStyles.focus; @@ -354,10 +355,24 @@ export class SKVesselsLayerComponent implements OnInit, OnDestroy, OnChanges { ) { // stale s = this.targetStyles.inactive; + } else if (item.type && this.targetStyles[st]) { + // ship type & state + if (item.state && this.targetStyles[st][item.state]) { + s = this.targetStyles[st][item.state]; + } else { + s = this.targetStyles[st]['default']; + } } else if (item.buddy && this.targetStyles.buddy) { + // buddy s = this.targetStyles.buddy; } else { - s = this.targetStyles.default; + // all others + if (item.state && this.targetStyles[item.state]) { + // state only + s = this.targetStyles[item.state]; + } else { + s = this.targetStyles.default; + } } } else if (this.layerProperties && this.layerProperties.style) { s = this.layerProperties.style; diff --git a/src/app/modules/skresources/resource-dialogs.ts b/src/app/modules/skresources/resource-dialogs.ts index 70ad019d..f79d5ac1 100644 --- a/src/app/modules/skresources/resource-dialogs.ts +++ b/src/app/modules/skresources/resource-dialogs.ts @@ -248,7 +248,12 @@ export class ResourceDialog implements OnInit {
MMSI:
{{ vInfo.mmsi }}
- @if(vInfo.flag) { + @if(vInfo.shipType) { +
+
Type:
+
{{ vInfo.shipType }}
+
+ } @if(vInfo.flag) {
Flag:
{{ vInfo.flag }}
diff --git a/src/assets/help/index.html b/src/assets/help/index.html index 707b2f10..5aa77586 100644 --- a/src/assets/help/index.html +++ b/src/assets/help/index.html @@ -1508,17 +1508,51 @@

Vessels

Vessel associated Signal K "self"
+
+
+ +
+
Focussed Vessel
+
-
Vessel with updated data (<6 mins since last update)
+
+ Vessel with updated data (<6 mins since last update) +
-
Vessel with stale data (>6 mins since last update)
+
+ Vessel with stale data (>6 mins since last update) +
+
+
+
+ +
+
Special Vessel (AIS type 50-59)
+
+
+
+ +
+
Passenger Vessel (AIS type 60-69)
+
+
+
+ +
+
Cargo Vessel (AIS type 70-79)
+
+
+
+ +
+
Tanker Vessel (AIS type 80-89)
diff --git a/src/assets/img/ais_cargo.png b/src/assets/img/ais_cargo.png new file mode 100644 index 0000000000000000000000000000000000000000..d15d2924f9e4dcb0aa5bfb467bc82c35661cf4e4 GIT binary patch literal 286 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEX7WqAsj$Z!;#VfDU_+CTO`Py}rO)&>+(=akh%3*_ZUoZl3stYuishzccgw*H$~( zYDR_yFROOF$zd?h&}Rr2PN+EW-dI-T0Z+l!)w=AH3YzBUDrrsm{^_Qi)NOZ>1@A0F hbE_Slgy&pY#lBt1JX%~>?m5td44$rjF6*2UngGW1ZIS>0 literal 0 HcmV?d00001 diff --git a/src/assets/img/ais_inactive.png b/src/assets/img/ais_inactive.png index 9dfe7ff0c67d43cf7413836cfb6aa4b31b11d9af..9e0dcecf32983c15d51818e4b0889be03e03c9c7 100644 GIT binary patch delta 232 zcmV#$C7!OSi(xT!>)}?!ae(7C}DqfOOoBIbrT(1`|8UM?=?vU>1=UcnKw)v;q>8`x2yOE0U~-sq zKi;f>h_5tbn>@bpe5?|5ma`U@1!B^50+C&iLD2h5w-s0mLw!*tlk|@0<4AmzgUixY iZb=BW(X{JxXOIt5BVI!$wg6ZF0000NS%G}U;vjb?hIQv;UIICs1s;*b z3=DjSL74G){)!Z!;JN^x5LfpCpVelX6GZsy85n@5nVG4TofX0clI>jV-Mn0f!ySA0 zdD=NSdj)vA`MA#}c`ekG@8aQXtLI?r;ACrNW7* zm>{wE`@QN#<@f#{&8dC2Rr&P)HB5VSd-X4ebNsm%dbfR{)x_(+nSF1|eVMn*Z;qUf z<~cX9XWU)ir@p-S!)c;!@h0bsPkht!R?iQ({rQVP=DltknR2@cf2?!5QpJmY8c0V+ oub3j_pp~Z(%)rp%`KLyI!V{qlGnAYQfo@^&boFyt=akR{01s%ix&QzG diff --git a/src/assets/img/ais_passenger.png b/src/assets/img/ais_passenger.png new file mode 100644 index 0000000000000000000000000000000000000000..634e5f102efdb342e71453c886f954ca7bd0cead GIT binary patch literal 249 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEX7WqAsj$Z!;#Vf>$j2L*j;#1Q3KshDdvs2ox@`>wftE|Mai_ z7amk`5I&qZ~F?)T#u1hBY2r^czSNEKg!tG%?MTy&kb+K5$eWoudUZLDlQqq!A%MCLoWpTze qgt-(y5LkYODW>hgWNB6xW`;`=Ax{=GJcOe7N7D`G?c2hyw=>eAvHm;X`|7 zl^HA@7Y}$WdRV|W#W%oyXQ6|M!Zjw=oTf88XE<9-grr?G4l*+zVG%a8J0Lx?#YoOj zY>)f11;3xzAO8P$N>oFlhGO9)U4^RwT{;S)Jy8y|+!<0Q0}h*dZfy~8&|73#&=H)* hDCfK)=^zI?!+$TG1ewMTcc6P2JYD@<);T3K0RY=pQxgCH literal 0 HcmV?d00001 diff --git a/src/assets/img/ais_tanker.png b/src/assets/img/ais_tanker.png new file mode 100644 index 0000000000000000000000000000000000000000..8c1bc21b2f1ff2ad852a3ff23ab694395de2158f GIT binary patch literal 269 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjEX7WqAsj$Z!;#Vf=j`Us zuT_^;;N++_Ygg_vI9=O$_;7x@V8{wSh6@WUC#M?;xfTdIiWC+|dv`51v#;$DZg_L$ z&muX487#@ZYXjxC#zc4SJAFA>V{#Sq+L^Zw2eS&re?RCVb!`5}!nrC84fCJ=H23E| z;k%sEL+l_=(-M76ag~Ir*R9=>#7piwWn8>BVQzB1k>8tt^;X*wp7O2^)p^A>ZNg@t Pe;7Pn{an^LB{Ts5wS;1y literal 0 HcmV?d00001