-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#20 Add dummy marker storage service
- Loading branch information
1 parent
b84e3be
commit d5a6d7b
Showing
5 changed files
with
130 additions
and
21 deletions.
There are no files selected for viewing
28 changes: 18 additions & 10 deletions
28
src/src/app/main/components/google-map/google-map.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
<ng-container *ngIf="loaded$ | async"> | ||
<google-map | ||
class="map" | ||
(mapClick)="addMarker($event)" | ||
height="100%" | ||
width="100%" | ||
> | ||
<ng-container *ngFor="let position of markerPositions"> | ||
<map-marker [position]="position"></map-marker> | ||
</ng-container> | ||
</google-map> | ||
<ng-container *ngIf="markers$ | async as markers"> | ||
<google-map | ||
class="map" | ||
height="100%" | ||
(mapClick)="addMarker($event, markers)" | ||
[options]="options" | ||
width="100%" | ||
> | ||
<ng-container *ngFor="let marker of markers"> | ||
<map-marker | ||
[position]="{ | ||
lat: marker.coordinates.latitude, | ||
lng: marker.coordinates.longitude | ||
}" | ||
></map-marker> | ||
</ng-container> | ||
</google-map> | ||
</ng-container> | ||
</ng-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const MapOptions: google.maps.MapOptions = { | ||
center: { lat: 61.783333, lng: 34.333333 }, | ||
zoom: 13, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface Marker { | ||
coordinates: MarkerCoordinates; | ||
} | ||
|
||
export interface MarkerCoordinates { | ||
latitude: number; | ||
longitude: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Observable, of } from 'rxjs'; | ||
|
||
import { Marker } from '../models/marker'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class MarkerStorageService { | ||
getAllMarkers(): Observable<Marker[]> { | ||
return of([ | ||
<Marker>{ | ||
coordinates: { | ||
latitude: 61.77625594945171, | ||
longitude: 34.30834442808107, | ||
}, | ||
}, | ||
<Marker>{ | ||
coordinates: { | ||
latitude: 61.784380796376816, | ||
longitude: 34.3447208404541, | ||
}, | ||
}, | ||
<Marker>{ | ||
coordinates: { | ||
latitude: 61.7900890068273, | ||
longitude: 34.37491568247985, | ||
}, | ||
}, | ||
<Marker>{ | ||
coordinates: { | ||
latitude: 61.79136849012713, | ||
longitude: 34.3645658348205, | ||
}, | ||
}, | ||
<Marker>{ | ||
coordinates: { | ||
latitude: 61.79573094898839, | ||
longitude: 34.375072717666626, | ||
}, | ||
}, | ||
]); | ||
} | ||
|
||
createMarker(): Observable<string> { | ||
return of('Marker was added successfully'); | ||
} | ||
} |