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,6 +7,7 @@ | ||
7 | </ag-grid-ng2> | 7 | </ag-grid-ng2> |
8 | <div class="control_button"> | 8 | <div class="control_button"> |
9 | <div *tdLoading="'loading'; mode:'indeterminate'; type:'circle'; strategy:'replace'; color:'accent'"></div> | 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 | <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> | 11 | <button md-fab color="accent" [disabled]="isNew || isSelected" (click)="addNewRow()" type="button"><md-icon>add</md-icon></button> |
11 | <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> | 12 | <button md-fab color="warn" [disabled]="!isSelected" (click)="deleteRows()" type="button"><md-icon>delete</md-icon></button> |
12 | </div> | 13 | </div> |
src/app/data/bus-stop/bus-stop.component.ts
@@ -29,14 +29,13 @@ import { routerTransition } from '../../../animations/router.animation'; | @@ -29,14 +29,13 @@ import { routerTransition } from '../../../animations/router.animation'; | ||
29 | encapsulation: ViewEncapsulation.None, | 29 | encapsulation: ViewEncapsulation.None, |
30 | }) | 30 | }) |
31 | export class BusStopComponent extends StatementBase { | 31 | export class BusStopComponent extends StatementBase { |
32 | - @ViewChild(MapItemsComponent) mapItems: MapItemsComponent | 32 | + @ViewChild(MapItemsComponent) mapItems: MapItemsComponent; |
33 | public regions: RegionSelectList[]; | 33 | public regions: RegionSelectList[]; |
34 | public states: StateCommonSelectList[]; | 34 | public states: StateCommonSelectList[]; |
35 | public surfaceTypes: SurfaceTypeSelectList[]; | 35 | public surfaceTypes: SurfaceTypeSelectList[]; |
36 | public settlements: SettlementSelectList[]; | 36 | public settlements: SettlementSelectList[]; |
37 | public roads: RoadSelectList[]; | 37 | public roads: RoadSelectList[]; |
38 | public boolean: BooleanSelectList[]; | 38 | public boolean: BooleanSelectList[]; |
39 | - public position: string; | ||
40 | 39 | ||
41 | constructor( | 40 | constructor( |
42 | protected service: BusStopService, | 41 | protected service: BusStopService, |
@@ -45,9 +44,10 @@ export class BusStopComponent extends StatementBase { | @@ -45,9 +44,10 @@ export class BusStopComponent extends StatementBase { | ||
45 | protected loadingService: TdLoadingService, | 44 | protected loadingService: TdLoadingService, |
46 | ) { | 45 | ) { |
47 | super(); | 46 | super(); |
48 | - this.position = '51.513015907156756,-0.10334014892578126'; | ||
49 | } | 47 | } |
50 | - | 48 | + public showOnMap(): void { |
49 | + this.mapItems.showMap(); | ||
50 | + } | ||
51 | protected createColumnDefs(): any[] { | 51 | protected createColumnDefs(): any[] { |
52 | return [ | 52 | return [ |
53 | { | 53 | { |
src/app/data/map-items/map-items.component.ts
@@ -3,7 +3,7 @@ import * as L from 'leaflet'; | @@ -3,7 +3,7 @@ import * as L from 'leaflet'; | ||
3 | @Component({ | 3 | @Component({ |
4 | selector: 'map-items', | 4 | selector: 'map-items', |
5 | template:` | 5 | template:` |
6 | - <div class="map-items"> | 6 | + <div class="map-items" [class.show]="show"> |
7 | <div id="mapItemsId"></div> | 7 | <div id="mapItemsId"></div> |
8 | </div>`, | 8 | </div>`, |
9 | styleUrls: ['map-items.scss'] | 9 | styleUrls: ['map-items.scss'] |
@@ -14,16 +14,9 @@ export class MapItemsComponent implements OnInit{ | @@ -14,16 +14,9 @@ export class MapItemsComponent implements OnInit{ | ||
14 | public map: L.Map; | 14 | public map: L.Map; |
15 | public icon: L.Icon; | 15 | public icon: L.Icon; |
16 | public markersGroup: L.FeatureGroup; | 16 | public markersGroup: L.FeatureGroup; |
17 | + public show = false; | ||
17 | ngOnInit(){ | 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 | // if(this.position != null){ | 20 | // if(this.position != null){ |
28 | // let options = { | 21 | // let options = { |
29 | // draggable:true, | 22 | // draggable:true, |
@@ -36,6 +29,18 @@ export class MapItemsComponent implements OnInit{ | @@ -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 | refreshMap(rows): void{ | 44 | refreshMap(rows): void{ |
40 | if(this.markersGroup != null){ | 45 | if(this.markersGroup != null){ |
41 | this.map.removeLayer(this.markersGroup); | 46 | this.map.removeLayer(this.markersGroup); |
src/app/data/map-items/map-items.scss