Commit 1af45d9626a41a34803785c17b7768b817377f70

Authored by lsagona
1 parent 76c0c81912
Exists in master

fix offset

Showing 1 changed file with 1 additions and 2 deletions Inline Diff

src/app/model/vessel.ts View file @ 1af45d9
import {Message} from './message'; 1 1 import {Message} from './message';
2 2
export class Vessel { 3 3 export class Vessel {
messages: Array<Message>; 4 4 messages: Array<Message>;
firstAppearance: number; 5 5 firstAppearance: number;
6 6
constructor(messages: Array<Message>) { 7 7 constructor(messages: Array<Message>) {
this.messages = messages; 8 8 this.messages = messages;
} 9 9 }
10 10
addMessage(message: Message): void { 11 11 addMessage(message: Message): void {
this.messages.push(message); 12 12 this.messages.push(message);
this.determineFirstAppearance(message); 13 13 this.determineFirstAppearance(message);
14
} 15 14 }
16 15
getMMSI(): string { 17 16 getMMSI(): string {
if (this.messages.length === 0) { 18 17 if (this.messages.length === 0) {
return ''; 19 18 return '';
} 20 19 }
return this.messages[0].mmsi; 21 20 return this.messages[0].mmsi;
} 22 21 }
23 22
getName(): string { 24 23 getName(): string {
return this.messages[0].vesselName; 25 24 return this.messages[0].vesselName;
} 26 25 }
27 26
public getColor(): string { 28 27 public getColor(): string {
return '#' + (+this.getMMSI()).toString(16).substr(0, 6); 29 28 return '#' + (+this.getMMSI()).toString(16).substr(0, 6);
} 30 29 }
31 30