diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index a9f2cb0..75294e2 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -310,7 +310,7 @@ You should have received a copy of the GNU General Public License along with FG latlng.lat = e1.lat; latlng.lng = e1.lng; this.$store.dispatch('setCenter', latlng); - if(e1.__vertex._icon.style!=null) { + if(e1.__vertex !== undefined && e1.__vertex !== null && e1.__vertex._icon.style!=null) { e1.__vertex._icon.style['background-color'] = 'red'; } return; diff --git a/src/renderer/components/Upload.vue b/src/renderer/components/Upload.vue index 1400755..a7df017 100644 --- a/src/renderer/components/Upload.vue +++ b/src/renderer/components/Upload.vue @@ -127,7 +127,9 @@ 'name': o.options.attributes.name, 'radius': String(o.options.attributes.radius), 'lat': o._latlng.lat, - 'lng': o._latlng.lng }; + 'lng': o._latlng.lng, + 'box': o.box!==undefined?o.box.getLatLngs():null + }; } else if (o instanceof L.RunwayNode) { console.log(o) return { 'index': Number(o['glueindex']), '_leaflet_id': o._leaflet_id, 'type': 'runway' }; diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index 8fcc0bc..2fb6458 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -126,8 +126,6 @@ L.ParkingSpot = L.Circle.extend({ this._mRadius = output; this.options.attributes.radius = this._mRadius; this.direction.setLatLngs([start, end]); - - } }, updateWheelPos() { @@ -156,6 +154,7 @@ L.ParkingSpot = L.Circle.extend({ var thirdRadiusKM = radiusKM/3; if (parkingSize>=0) { + this.setStyle({ opacity: 0, fill: false }); var frontWheelEnd = turf.destination(start, validN2M[parkingSize] / 1000, this.options.attributes.heading, options); var front = turf.destination(start, radiusKM, this.options.attributes.heading, options); @@ -173,10 +172,10 @@ L.ParkingSpot = L.Circle.extend({ var leftIntermediate = turf.destination(leftFront, halfRadiusKM, backwards, options); var rightIntermediate = turf.destination(rightFront, halfRadiusKM, backwards, options); - if(this.box === undefined && this.editor !== undefined) { + if(this.box === undefined) { var latlngs = [leftBack, rightBack, rightMiddle, rightIntermediate, rightFront, leftFront, leftIntermediate, leftMiddle].map(l => this.turfToLatLng(l)); this.box = L.polygon(latlngs); - this.box.addTo(this.editor.editLayer); + //this.box.addTo(this.editor.editLayer); this.box._parkingSpot = this; this.box.on('click', function (event) { console.debug("Click Parking Box : " + event.target); @@ -207,7 +206,7 @@ L.ParkingSpot = L.Circle.extend({ return angle + 360; } return angle; - }, + }, select() { store.default.dispatch('setParking', this.options.attributes); store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(6) + ' ' + this.getLatLng().lng.toFixed(6)); @@ -257,6 +256,19 @@ L.ParkingSpot = L.Circle.extend({ event.target.updateBox(); } }); + this.on('add', function (event) { + console.log(event); + event.target.updateBox(); + if(event.target.box !== undefined) { + event.target.box.addTo(event.target._map); + } + }); + this.on('remove', function (event) { + console.log(event); + if(event.target.box !== undefined) { + event.target.box.removeFrom(event.target._map); + } + }); this.on('editable:vertex:drag', function (event) { console.debug("Drag Parking : ", event); }); diff --git a/src/renderer/utils/check.js b/src/renderer/utils/check.js index 5af134a..5099a38 100644 --- a/src/renderer/utils/check.js +++ b/src/renderer/utils/check.js @@ -59,6 +59,7 @@ async function checkGroundnet(data) { var boxes = {}; //debugger; data.forEach(element => { + //debugger; if(element.box!==undefined && element.box!==null) { boxes[element.index] = element.box[0].map(latlng => [latlng.lat, latlng.lng] ); boxes[element.index].push(boxes[element.index][0]);