diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3697a6d..638f5f6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -36,7 +36,7 @@ import { RoadComponent } from './data/road/road.component'; import { RoadServiceComponent } from './data/road-service/road-service.component'; import { SettlementAddressLinkComponent } from './data/settlement-address-link/settlement-address-link.component'; import { MapComponent } from './data/map/map.component'; -import { MapItemsComponent } from './data/map-items/map-items-component'; +import { MapItemsComponent } from './data/map-items/map-items.component'; // Services import { BusStopCreateService } from '../services/bus-stop-create.service'; diff --git a/src/app/data/map-items/map-items-component.ts b/src/app/data/map-items/map-items-component.ts deleted file mode 100644 index e113eb3..0000000 --- a/src/app/data/map-items/map-items-component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Component, Input, Output, OnInit } from '@angular/core'; -import * as L from 'leaflet'; -@Component({ - selector: 'map-items', - template:` -
-
-
`, - styleUrls: ['map-items.scss'] -}) - -export class MapItemsComponent implements OnInit{ - @Input() position: string; - public map: L.Map; - public icon: L.Icon; - - ngOnInit(){ - this.icon = L.icon({ - iconUrl: '/assets/icons/marker-icon.png', - iconSize: [25, 41], // size of the icon - popupAnchor: [-3, -76], // point from which the popup should open relative to the iconAnchor - }); - this.map = L.map('mapItemsId').setView([51.505, -0.09], 13); - L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { - maxZoom: 18, - }).addTo(this.map); - if(this.position != null){ - let options = { - draggable:true, - icon: this.icon, - }; - let latLng = this.position.split(','); - let marker = L.marker(new L.LatLng(parseInt(latLng[0]),parseInt(latLng[1])),options); - this.map.addLayer(marker); - - } - } -} \ No newline at end of file diff --git a/src/app/data/map-items/map-items.component.ts b/src/app/data/map-items/map-items.component.ts new file mode 100644 index 0000000..e113eb3 --- /dev/null +++ b/src/app/data/map-items/map-items.component.ts @@ -0,0 +1,38 @@ +import { Component, Input, Output, OnInit } from '@angular/core'; +import * as L from 'leaflet'; +@Component({ + selector: 'map-items', + template:` +
+
+
`, + styleUrls: ['map-items.scss'] +}) + +export class MapItemsComponent implements OnInit{ + @Input() position: string; + public map: L.Map; + public icon: L.Icon; + + ngOnInit(){ + this.icon = L.icon({ + iconUrl: '/assets/icons/marker-icon.png', + iconSize: [25, 41], // size of the icon + popupAnchor: [-3, -76], // point from which the popup should open relative to the iconAnchor + }); + this.map = L.map('mapItemsId').setView([51.505, -0.09], 13); + L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 18, + }).addTo(this.map); + if(this.position != null){ + let options = { + draggable:true, + icon: this.icon, + }; + let latLng = this.position.split(','); + let marker = L.marker(new L.LatLng(parseInt(latLng[0]),parseInt(latLng[1])),options); + this.map.addLayer(marker); + + } + } +} \ No newline at end of file -- libgit2 0.21.4