Commit 90d0b43c34019de575f7fa1237668d49857fd32e
Merge remote-tracking branch 'origin/master'
Showing
4 changed files
with
23 additions
and
15 deletions
Show diff stats
src/app/data/bus-stop/bus-stop.component.html
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 | </ag-grid-ng2> |
8 | 8 | <div class="control_button"> |
9 | 9 | <div *tdLoading="'loading'; mode:'indeterminate'; type:'circle'; strategy:'replace'; color:'accent'"></div> |
10 | + <button md-fab color="accent" (click)="showOnMap()" type="button"><md-icon>map</md-icon></button> | |
10 | 11 | <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> |
11 | 12 | <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> |
12 | 13 | </div> | ... | ... |
src/app/data/bus-stop/bus-stop.component.ts
... | ... | @@ -29,14 +29,13 @@ import { routerTransition } from '../../../animations/router.animation'; |
29 | 29 | encapsulation: ViewEncapsulation.None, |
30 | 30 | }) |
31 | 31 | export class BusStopComponent extends StatementBase { |
32 | - @ViewChild(MapItemsComponent) mapItems: MapItemsComponent | |
32 | + @ViewChild(MapItemsComponent) mapItems: MapItemsComponent; | |
33 | 33 | public regions: RegionSelectList[]; |
34 | 34 | public states: StateCommonSelectList[]; |
35 | 35 | public surfaceTypes: SurfaceTypeSelectList[]; |
36 | 36 | public settlements: SettlementSelectList[]; |
37 | 37 | public roads: RoadSelectList[]; |
38 | 38 | public boolean: BooleanSelectList[]; |
39 | - public position: string; | |
40 | 39 | |
41 | 40 | constructor( |
42 | 41 | protected service: BusStopService, |
... | ... | @@ -45,9 +44,10 @@ export class BusStopComponent extends StatementBase { |
45 | 44 | protected loadingService: TdLoadingService, |
46 | 45 | ) { |
47 | 46 | super(); |
48 | - this.position = '51.513015907156756,-0.10334014892578126'; | |
49 | 47 | } |
50 | - | |
48 | + public showOnMap(): void { | |
49 | + this.mapItems.showMap(); | |
50 | + } | |
51 | 51 | protected createColumnDefs(): any[] { |
52 | 52 | return [ |
53 | 53 | { | ... | ... |
src/app/data/map-items/map-items.component.ts
... | ... | @@ -3,7 +3,7 @@ import * as L from 'leaflet'; |
3 | 3 | @Component({ |
4 | 4 | selector: 'map-items', |
5 | 5 | template:` |
6 | - <div class="map-items"> | |
6 | + <div class="map-items" [class.show]="show"> | |
7 | 7 | <div id="mapItemsId"></div> |
8 | 8 | </div>`, |
9 | 9 | styleUrls: ['map-items.scss'] |
... | ... | @@ -14,16 +14,9 @@ export class MapItemsComponent implements OnInit{ |
14 | 14 | public map: L.Map; |
15 | 15 | public icon: L.Icon; |
16 | 16 | public markersGroup: L.FeatureGroup; |
17 | + public show = false; | |
17 | 18 | ngOnInit(){ |
18 | - this.icon = L.icon({ | |
19 | - iconUrl: '/assets/icons/marker-icon.png', | |
20 | - iconSize: [25, 41], // size of the icon | |
21 | - popupAnchor: [-3, -76], // point from which the popup should open relative to the iconAnchor | |
22 | - }); | |
23 | - this.map = L.map('mapItemsId').setView([51.505, -0.09], 13); | |
24 | - L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
25 | - maxZoom: 18, | |
26 | - }).addTo(this.map); | |
19 | + | |
27 | 20 | // if(this.position != null){ |
28 | 21 | // let options = { |
29 | 22 | // draggable:true, |
... | ... | @@ -36,6 +29,18 @@ export class MapItemsComponent implements OnInit{ |
36 | 29 | // } |
37 | 30 | } |
38 | 31 | |
32 | + showMap(){ | |
33 | + this.show = true; | |
34 | + this.icon = L.icon({ | |
35 | + iconUrl: '/assets/icons/marker-icon.png', | |
36 | + iconSize: [25, 41], // size of the icon | |
37 | + popupAnchor: [-3, -76], // point from which the popup should open relative to the iconAnchor | |
38 | + }); | |
39 | + this.map = L.map('mapItemsId').setView([51.505, -0.09], 13); | |
40 | + L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |
41 | + maxZoom: 18, | |
42 | + }).addTo(this.map); | |
43 | + } | |
39 | 44 | refreshMap(rows): void{ |
40 | 45 | if(this.markersGroup != null){ |
41 | 46 | this.map.removeLayer(this.markersGroup); | ... | ... |