Add polyLine to layerGroup
This commit is contained in:
parent
357c1a56b8
commit
088789a366
@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="js">
|
<script lang="js">
|
||||||
import { LMap, LMarker } from 'vue2-leaflet'
|
import {LMap, LMarker} from 'vue2-leaflet'
|
||||||
import L from 'leaflet'
|
import L from 'leaflet'
|
||||||
import LEdit from 'leaflet-editable/src/Leaflet.Editable.js'
|
import LEdit from 'leaflet-editable/src/Leaflet.Editable.js'
|
||||||
import {readGroundnetXML, addFeature} from '../loaders/groundnet_loader'
|
import {readGroundnetXML, addFeature} from '../loaders/groundnet_loader'
|
||||||
@ -35,12 +35,12 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
load (icao) {
|
load (icao) {
|
||||||
if (this.groundnet !== undefined) {
|
if (this.groundnetLayerGroup !== undefined) {
|
||||||
this.groundnet.removeFrom(this.$parent.mapObject)
|
this.groundnetLayerGroup.removeFrom(this.$parent.mapObject)
|
||||||
}
|
}
|
||||||
this.groundnet = readGroundnetXML(this.$store.state.Settings.settings.airportsDirectory, icao)
|
this.groundnetLayerGroup = readGroundnetXML(this.$store.state.Settings.settings.airportsDirectory, icao)
|
||||||
/*
|
/*
|
||||||
this.groundnet.eachLayer(l => {
|
this.groundnetLayerGroup.eachLayer(l => {
|
||||||
if (l instanceof L.TaxiwaySegment) {
|
if (l instanceof L.TaxiwaySegment) {
|
||||||
var decorator = L.polylineDecorator(l, {
|
var decorator = L.polylineDecorator(l, {
|
||||||
pattern: [
|
pattern: [
|
||||||
@ -53,9 +53,9 @@
|
|||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
|
|
||||||
console.log(this.groundnet.maxId)
|
console.log(this.groundnetLayerGroup.maxId)
|
||||||
|
|
||||||
this.groundnet.addTo(this.$parent.mapObject)
|
this.groundnetLayerGroup.addTo(this.$parent.mapObject)
|
||||||
this.icao = icao
|
this.icao = icao
|
||||||
},
|
},
|
||||||
visible (feature) {
|
visible (feature) {
|
||||||
@ -82,7 +82,7 @@
|
|||||||
},
|
},
|
||||||
enableEdit () {
|
enableEdit () {
|
||||||
this.editable = true
|
this.editable = true
|
||||||
this.groundnet.eachLayer(l => {
|
this.groundnetLayerGroup.eachLayer(l => {
|
||||||
l.enableEdit()
|
l.enableEdit()
|
||||||
if (typeof l.extensions === 'function') {
|
if (typeof l.extensions === 'function') {
|
||||||
l.extensions()
|
l.extensions()
|
||||||
@ -92,12 +92,13 @@
|
|||||||
},
|
},
|
||||||
disableEdit () {
|
disableEdit () {
|
||||||
this.editable = false
|
this.editable = false
|
||||||
this.groundnet.eachLayer(l => {
|
this.groundnetLayerGroup.eachLayer(l => {
|
||||||
l.disableEdit()
|
l.disableEdit()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
drawPolyline () {
|
drawPolyline () {
|
||||||
this.$parent.mapObject.editTools.startPolyline()
|
var polyLine = this.$parent.mapObject.editTools.startPolyline()
|
||||||
|
polyLine.addTo(this.groundnetLayerGroup)
|
||||||
},
|
},
|
||||||
drawParking () {
|
drawParking () {
|
||||||
this.$parent.mapObject.on('click', this.addParking)
|
this.$parent.mapObject.on('click', this.addParking)
|
||||||
@ -108,19 +109,20 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const circle = new L.ParkingSpot(event.latlng, {attributes: {radius: 20, heading: 0}})
|
const circle = new L.ParkingSpot(event.latlng, {attributes: {radius: 20, heading: 0}})
|
||||||
circle.id = (++this.groundnet.maxId)
|
circle.id = (++this.groundnetLayerGroup.maxId)
|
||||||
circle.addTo(this.groundnet)
|
circle.addTo(this.groundnetLayerGroup)
|
||||||
circle.enableEdit()
|
circle.enableEdit()
|
||||||
circle.extensions()
|
circle.extensions()
|
||||||
circle.addListeners()
|
circle.addListeners()
|
||||||
addFeature(circle)
|
addFeature(circle)
|
||||||
// console.log(this.groundnet)
|
// console.log(this.groundnetLayerGroup)
|
||||||
this.$parent.mapObject.off('click', this.addParking)
|
this.$parent.mapObject.off('click', this.addParking)
|
||||||
},
|
},
|
||||||
reload () {
|
reload () {
|
||||||
this.load(this.icao)
|
this.load(this.icao)
|
||||||
},
|
},
|
||||||
save () {
|
save () {
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
Loading…
Reference in New Issue
Block a user