Skip to content

Commit

Permalink
Zone.ts not staged for some reason.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGuardianWolf authored Apr 19, 2017
1 parent 8ab288f commit dc4eeb7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/app/shared/classes/zone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { IPoint, Point } from './storage';

export interface IZone {
label: string;
area: Array<IPoint>;
}

export class Zone implements IZone {
public label: string;
public area: Array<Point>;

constructor(label: string, area : Array<IPoint>) {
this.label = label;
this.area = area.map((point) => {
return Point.parse(point);
});
}

public contains(point: IPoint) {
return (point.x >= this.area[0].x && point.x < this.area[2].x &&
point.y >= this.area[1].y && point.y < this.area[2].y);
}

static parse(zone: IZone) {
return new Zone(zone.label, zone.area);
}
}

0 comments on commit dc4eeb7

Please sign in to comment.