portree_kid 2020-07-12 20:58:12 +02:00
parent d372170fe9
commit d61dc7c955
4 changed files with 22 additions and 7 deletions

View File

@ -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;

View File

@ -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' };

View File

@ -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);
@ -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);
});

View File

@ -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]);