-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcities.service.ts
37 lines (31 loc) · 981 Bytes
/
cities.service.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {Injectable} from '@angular/core';
import {Coordinates} from "../model/coordinates";
interface Cities {
[city: string]: Coordinates
}
@Injectable({
providedIn: 'root'
})
export class CitiesService {
private cities: Cities = {
GRENOBLE: new Coordinates(45.183916, 5.703630),
SINGAPOUR: new Coordinates(1.295600, 103.858995),
BORDEAUX: new Coordinates(44.848089, -0.571017),
BREST: new Coordinates(48.389397, -4.499237),
MONTREAL: new Coordinates(45.523000, -73.581700),
LYON: new Coordinates(45.767443, 4.858798),
RENNES: new Coordinates(48.113409, -1.661249),
NANTES: new Coordinates(47.207408, -1.556187),
LILLE: new Coordinates(50.648670, 3.075520),
PARIS: new Coordinates(48.878932, 2.328487)
}
getCities(): string[] {
return Object.keys(this.cities);
}
getCitiesPosition(): Cities {
return this.cities;
}
getCityPosition(cityName): Coordinates {
return this.getCitiesPosition()[cityName]
}
}