Commit 72dfa80e2b0cb05b753554f82af013dd99eef3fe

Authored by lsagona
1 parent 287033a627
Exists in master

eache vessel have different color on map

Showing 4 changed files with 4 additions and 13 deletions Side-by-side Diff

src/app/component/list-vessel/list-vessel.component.ts View file @ 72dfa80
... ... @@ -32,13 +32,5 @@
32 32 });
33 33 }
34 34  
35   - // ngAfterViewInit(): void {
36   - // this.vesselsService.currentVessels.subscribe(vessels => {
37   - // setTimeout(() =>
38   - // this.vessels = vessels
39   - // );
40   - // });
41   - // }
42   -
43 35 }
src/app/component/map/map.component.ts View file @ 72dfa80
... ... @@ -13,6 +13,7 @@
13 13 export class MapComponent implements OnInit {
14 14 vessels: Vessels;
15 15 public map: L.Map;
  16 + renderer = L.canvas({ padding: 0.5 });
16 17 circleMarkers: Map<number, CircleMarker> = new Map<number, CircleMarker>();
17 18  
18 19 constructor(private vesselsService: VesselsService) {
... ... @@ -31,9 +32,7 @@
31 32 }
32 33  
33 34 initMap(): void {
34   - this.map = L.map('map', {
35   - preferCanvas: true
36   - }).setView([0, 0], 1);
  35 + this.map = L.map('map').setView([0, 0], 1);
37 36 L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
38 37 attribution: 'map',
39 38 }).addTo(this.map);
... ... @@ -42,6 +41,7 @@
42 41 addCircleMarker(message: Message, color: string): void {
43 42 const circleMarker = L.circleMarker([+message.latitude, +message.longitude],
44 43 {
  44 + renderer: this.renderer,
45 45 radius: 0.1,
46 46 color
47 47 }).addTo(this.map);
src/app/model/vessel.ts View file @ 72dfa80
... ... @@ -20,7 +20,7 @@
20 20 }
21 21  
22 22 public getColor(): string {
23   - return (+this.getMMSI()).toString(16);
  23 + return '#' + (+this.getMMSI()).toString(16).substr(0, 6);
24 24 }
25 25  
26 26 }
src/app/model/vessels.ts View file @ 72dfa80
1 1 import {Vessel} from './vessel';
2 2 import {Message} from './message';
3   -import { delay } from 'rxjs/operators';
4 3  
5 4 export class Vessels {
6 5 vessels: Map<number, Vessel>;