Bi Directional Wheelpos

This commit is contained in:
portree_kid 2020-06-02 23:15:48 +02:00
parent 3aea131727
commit 0f890d1593
3 changed files with 91 additions and 49 deletions

View File

@ -365,6 +365,7 @@
// element.extensions();
element.updateMiddleMarker();
element.updateVertexFromDirection();
element.updateWheelPos();
}
else if (element instanceof L.Polyline) {
if (Number(element.begin) === Number(index)) {
@ -480,6 +481,9 @@
console.error(error);
}
},
stopDrawing () {
this.$parent.mapObject.editTools.stopDrawing()
},
drawPolyline () {
var polyLine = this.$parent.mapObject.editTools.startPolyline()
polyLine.addTo(this.groundnetLayerGroup)
@ -562,7 +566,8 @@
this.featureLookup[this.$store.state.Editable.index].forEach((element,index) => {
if (element instanceof L.ParkingSpot) {
element.options.attributes = Object.assign({}, this.$store.state.Editable.data.parking)
element.updateVertexFromDirection();
element.updateVertexFromDirection();
element.updateWheelPos();
}
})
if (this.$store.state.Editable.data.parking.coords) {
@ -603,11 +608,11 @@
*/
},
editedArc() {
console.log('Edited Arc : ' + this.$store.state.Editable.index);
if (!this.groundnetLayerGroup)
return;
var arc = this.groundnetLayerGroup.getLayer(this.$store.state.Editable.index);
if (arc && arc instanceof L.Polyline) {
console.log('Edited Arc : ' + this.$store.state.Editable.index);
arc.options.attributes = Object.assign({}, this.$store.state.Editable.data.arc)
arc.updateStyle();
}

View File

@ -120,7 +120,7 @@ L.ParkingSpot = L.Circle.extend({
var style = {};
style['color'] = 'red';
this.setStyle(style);
element.updateWheelPos();
this.updateWheelPos();
},
deselect() {
var style = {};
@ -151,6 +151,7 @@ L.ParkingSpot = L.Circle.extend({
console.debug("DragEnd Parking : ", event);
store.default.dispatch('setParking', event.target.options.attributes);
store.default.dispatch('setParkingCoords', event.target.getLatLng().lat.toFixed(5) + ' ' + event.target.getLatLng().lng.toFixed(5));
event.target.updateWheelPos();
/*
store.default.dispatch('setParkingHeading', this.options.attributes.heading)
store.default.dispatch('setParkingRadius', this.options.attributes.radius)
@ -215,6 +216,29 @@ L.ParkingSpot = L.Circle.extend({
},
updateStyle: function () {
},
selectParking() {
store.default.dispatch('setParking', this.options.attributes);
store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(5) + ' ' + this.getLatLng().lng.toFixed(5));
this.select();
this.unwatch = store.default.watch(
function (state) {
return state.Editable.data.parking;
},
(state) => {
if(state === undefined ||
state.index !== Number(this.options.attributes.index)) {
this.deselect();
this.unwatch();
}
}
,
{
deep: true //add this if u need to watch object properties change etc.
}
);
},
turfToLatLng: function (turfPoint) {
return {lat: turfPoint.geometry.coordinates[1], lng: turfPoint.geometry.coordinates[0]};

View File

@ -132,52 +132,58 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
console.log(event)
});
this.on('editable:vertex:clicked', function (event) {
store.default.dispatch('setNode', event.vertex.latlng)
if(event.vertex._icon!=null) {
event.vertex._icon.style['background-color'] = 'red';
} else if(event.vertex.icon!=null ) {
if(event.vertex.icon.style!=null) {
event.vertex.icon.style['background-color'] = 'red';
} else {
event.vertex.setStyle({color : 'red'})
}
} else if(event.vertex.options.icon!=null ) {
if(event.vertex.options.icon.style!=null) {
event.vertex.options.icon.style['background-color'] = 'red';
} else {
event.vertex.options.icon._setIconStyles({color : 'red'})
}
}
this.unwatch = store.default.watch(
function (state) {
return state.Editable.data.node;
},
(state) => {
if( state === undefined ||
state.index !== Number(event.vertex.latlng.glueindex)) {
if(event.vertex._icon!=null) {
event.vertex._icon.style['background-color'] = 'white';
} else if(event.vertex.icon!=null ) {
if(event.vertex.icon.style!=null) {
event.vertex.icon.style['background-color'] = 'white';
} else {
event.vertex.setStyle({color : 'white'})
}
} else if(event.vertex.options.icon!=null ) {
if(event.vertex.options.icon.style!=null) {
event.vertex.options.icon.style['background-color'] = 'white';
} else {
event.vertex.options.icon._setIconStyles({color : 'white'})
}
var parking = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.ParkingSpot);
if(parking.length>0) {
parking[0].selectParking();
} else {
this.editLayer.featureLookup[event.vertex.latlng.glueindex].forEach
store.default.dispatch('setNode', event.vertex.latlng)
if(event.vertex._icon!=null) {
event.vertex._icon.style['background-color'] = 'red';
} else if(event.vertex.icon!=null ) {
if(event.vertex.icon.style!=null) {
event.vertex.icon.style['background-color'] = 'red';
} else {
event.vertex.setStyle({color : 'red'})
}
} else if(event.vertex.options.icon!=null ) {
if(event.vertex.options.icon.style!=null) {
event.vertex.options.icon.style['background-color'] = 'red';
} else {
event.vertex.options.icon._setIconStyles({color : 'red'})
}
}
this.unwatch = store.default.watch(
function (state) {
return state.Editable.data.node;
},
(state) => {
if( state === undefined ||
state.index !== Number(event.vertex.latlng.glueindex)) {
if(event.vertex._icon!=null) {
event.vertex._icon.style['background-color'] = 'white';
} else if(event.vertex.icon!=null ) {
if(event.vertex.icon.style!=null) {
event.vertex.icon.style['background-color'] = 'white';
} else {
event.vertex.setStyle({color : 'white'})
}
} else if(event.vertex.options.icon!=null ) {
if(event.vertex.options.icon.style!=null) {
event.vertex.options.icon.style['background-color'] = 'white';
} else {
event.vertex.options.icon._setIconStyles({color : 'white'})
}
}
this.unwatch();
}
this.unwatch();
}
}
,
{
deep: true //add this if u need to watch object properties change etc.
}
);
}
,
{
deep: true //add this if u need to watch object properties change etc.
}
);
}
});
var dragIndex = -1;
this.on('editable:vertex:dragstart', function (event) {
@ -199,7 +205,13 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
});
}
dragIndex = -1;
store.default.dispatch('setNode', event.vertex.latlng)
var parking = this.featureLookup[event.vertex.latlng.glueindex].filter(n => n instanceof L.ParkingSpot);
if(parking.length>0) {
parking[0].selectParking();
} else {
store.default.dispatch('setNode', event.vertex.latlng)
}
});
};
/**
@ -222,6 +234,7 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
// element.extensions();
element.updateMiddleMarker();
element.updateVertexFromDirection();
element.updateWheelPos();
}
else if (element instanceof L.Polyline) {
if (Number(element.begin) === Number(dragIndex)) {