Commit b02c6cc82579d62995fc894e1587465f2ab9dd7d
1 parent
c4e931730a
Exists in
master
rename vessel to message
Showing 6 changed files with 46 additions and 46 deletions Side-by-side Diff
src/app/component/import-vessels/import-vessels.component.ts
View file @
b02c6cc
1 | 1 | import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; |
2 | 2 | import {VesselsService} from '../../service/vessels.service'; |
3 | -import {Vessel} from '../../model/vessel'; | |
3 | +import {Message} from '../../model/message'; | |
4 | 4 | |
5 | 5 | @Component({ |
6 | 6 | selector: 'app-import-vessels', |
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | styleUrls: ['./import-vessels.component.scss'] |
9 | 9 | }) |
10 | 10 | export class ImportVesselsComponent implements OnInit { |
11 | - vessels: Map<number, Vessel>; | |
11 | + vessels: Map<number, Message>; | |
12 | 12 | |
13 | 13 | |
14 | 14 | constructor(private vesselsService: VesselsService) { |
... | ... | @@ -56,7 +56,7 @@ |
56 | 56 | nbLine = lines.length; |
57 | 57 | for (const line of lines) { |
58 | 58 | const splitLine = line.split(','); |
59 | - const newVessel = new Vessel(splitLine); | |
59 | + const newVessel = new Message(splitLine); | |
60 | 60 | this.vessels.set(Number(newVessel.mmsi), newVessel); |
61 | 61 | } |
62 | 62 | this.vesselsService.changeVesselsSet(this.vessels); |
src/app/component/list-vessel/list-vessel.component.ts
View file @
b02c6cc
1 | 1 | import {Component, OnInit} from '@angular/core'; |
2 | -import {Vessel} from '../../model/vessel'; | |
2 | +import {Message} from '../../model/message'; | |
3 | 3 | import {VesselsService} from '../../service/vessels.service'; |
4 | 4 | |
5 | 5 | @Component({ |
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | styleUrls: ['./list-vessel.component.scss'] |
9 | 9 | }) |
10 | 10 | export class ListVesselComponent implements OnInit { |
11 | - vessels: Map<number, Vessel>; | |
11 | + vessels: Map<number, Message>; | |
12 | 12 | |
13 | 13 | |
14 | 14 | constructor(private vesselsService: VesselsService) { |
src/app/model/message.ts
View file @
b02c6cc
1 | +export class Message { | |
2 | + mmsi: string; | |
3 | + time: string; | |
4 | + latitude: string; | |
5 | + longitude: string; | |
6 | + speedOverGround: string; | |
7 | + courseOverGround: string; | |
8 | + heading: string; | |
9 | + vesselName: string; | |
10 | + imo: string; | |
11 | + callSign: string; | |
12 | + vesselType: string; | |
13 | + status: string; | |
14 | + length: string; | |
15 | + width: string; | |
16 | + draft: string; | |
17 | + cargo: string; | |
18 | + | |
19 | + | |
20 | + constructor(splitLine: string[]) { | |
21 | + this.mmsi = splitLine[0]; | |
22 | + this.time = splitLine[1]; | |
23 | + this.latitude = splitLine[2]; | |
24 | + this.longitude = splitLine[3]; | |
25 | + this.speedOverGround = splitLine[4]; | |
26 | + this.courseOverGround = splitLine[5]; | |
27 | + this.heading = splitLine[6]; | |
28 | + this.vesselName = splitLine[7]; | |
29 | + this.imo = splitLine[8]; | |
30 | + this.callSign = splitLine[9]; | |
31 | + this.vesselType = splitLine[10]; | |
32 | + this.status = splitLine[11]; | |
33 | + this.length = splitLine[12]; | |
34 | + this.width = splitLine[13]; | |
35 | + this.draft = splitLine[14]; | |
36 | + this.cargo = splitLine[15]; | |
37 | + } | |
38 | +} |
src/app/model/vessel.spec.ts
View file @
b02c6cc
src/app/model/vessel.ts
View file @
b02c6cc
1 | -export class Vessel { | |
2 | - mmsi: string; | |
3 | - time: string; | |
4 | - latitude: string; | |
5 | - longitude: string; | |
6 | - speedOverGround: string; | |
7 | - courseOverGround: string; | |
8 | - heading: string; | |
9 | - vesselName: string; | |
10 | - imo: string; | |
11 | - callSign: string; | |
12 | - vesselType: string; | |
13 | - status: string; | |
14 | - length: string; | |
15 | - width: string; | |
16 | - draft: string; | |
17 | - cargo: string; | |
18 | - | |
19 | - | |
20 | - constructor(splitLine: string[]) { | |
21 | - this.mmsi = splitLine[0]; | |
22 | - this.time = splitLine[1]; | |
23 | - this.latitude = splitLine[2]; | |
24 | - this.longitude = splitLine[3]; | |
25 | - this.speedOverGround = splitLine[4]; | |
26 | - this.courseOverGround = splitLine[5]; | |
27 | - this.heading = splitLine[6]; | |
28 | - this.vesselName = splitLine[7]; | |
29 | - this.imo = splitLine[8]; | |
30 | - this.callSign = splitLine[9]; | |
31 | - this.vesselType = splitLine[10]; | |
32 | - this.status = splitLine[11]; | |
33 | - this.length = splitLine[12]; | |
34 | - this.width = splitLine[13]; | |
35 | - this.draft = splitLine[14]; | |
36 | - this.cargo = splitLine[15]; | |
37 | - } | |
38 | -} |
src/app/service/vessels.service.ts
View file @
b02c6cc
1 | 1 | import {Injectable} from '@angular/core'; |
2 | 2 | import {BehaviorSubject, Observable} from 'rxjs'; |
3 | -import {Vessel} from '../model/vessel'; | |
3 | +import {Message} from '../model/message'; | |
4 | 4 | |
5 | 5 | @Injectable({ |
6 | 6 | providedIn: 'root' |
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | constructor() { |
13 | 13 | } |
14 | 14 | |
15 | - changeVesselsSet(newVessels: Map<number, Vessel>): void { | |
15 | + changeVesselsSet(newVessels: Map<number, Message>): void { | |
16 | 16 | this.vessels.next(newVessels); |
17 | 17 | } |
18 | 18 | } |