diff --git a/src/app/model/vessels.ts b/src/app/model/vessels.ts index 282f727..af0f4f5 100644 --- a/src/app/model/vessels.ts +++ b/src/app/model/vessels.ts @@ -3,6 +3,7 @@ import {Message} from './message'; export class Vessels { vessels: Map; + firstAppearance: number; constructor() { this.vessels = new Map(); @@ -12,8 +13,15 @@ export class Vessels { if (!this.vessels.get(Number(message.mmsi))) { this.vessels.set(Number(message.mmsi), new Vessel(new Array())); } - + this.determineFirstAppearance(message); this.vessels.get(Number(message.mmsi)).addMessage(message); } + determineFirstAppearance(message: Message): void { + const timeInS = Date.parse(message.time) / 1000; + if (this.firstAppearance > timeInS) { + this.firstAppearance = timeInS; + } + } + }