This commit is contained in:
Keith Paterson 2021-01-13 13:22:49 +01:00
parent ab32e6849b
commit fbf0e5cbab
3 changed files with 41 additions and 27 deletions

View File

@ -657,10 +657,10 @@ You should have received a copy of the GNU General Public License along with FG
}
console.debug('Edited Parkings : ' + this.$store.state.Parkings.items)
this.$store.state.Parkings.items.forEach( newElement => {
console.debug(newElement);
if(this.featureLookup[newElement.index]) {
this.featureLookup[newElement.index].forEach((element,index) => {
if (element instanceof L.ParkingSpot) {
console.debug(element);
element.options.attributes.name = newElement.name
element.options.attributes.number = newElement.number
element.options.attributes.type = newElement.type

View File

@ -132,7 +132,7 @@
<el-col :span="7">
<span class="label">Heading :</span>
</el-col>
<el-col :span="17">
<el-col :span="13">
<el-input-number
v-model="heading"
:min="-361"
@ -142,6 +142,11 @@
:disabled="!editing || calculate ==='Heading'"
></el-input-number>
</el-col>
<el-col :span="4">
<el-button @click="rotate" class="button">
<i class="fas fa-ruler-combined"></i>
</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
@ -193,6 +198,37 @@
export default {
methods: {
rotate() {
var heading = this.$store.state.Editable.data.parking.heading + 90;
while (heading>=360) {
heading -= 360
}
while (heading<0) {
heading += 360
}
this.headingChange(heading);
},
headingChange( newValue ) {
while (newValue>=360) {
newValue -= 360
}
while (newValue<0) {
newValue += 360
}
if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) {
this.$store.commit('SET_EDIT_PARKING_HEADING', newValue)
}
if(this.calculate === 'Center') {
// we change center
const noseWheelLatLng = convert(this.noseWheel);
const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius);
if (parkingSize>=0) {
var reverseHeading = this.normalizeAngle(this.$store.state.Editable.data.parking.heading+180);
var newCenter = turf.destination(this.latToTurf(noseWheelLatLng), this.validN2M[parkingSize]/1000, reverseHeading, turfOptions);
this.$store.commit('SET_EDIT_PARKING_COORDS', this.turfToLatLng(newCenter));
}
}
},
show (idx) {
this.$parent.$parent.$parent.$refs.editLayer.show(idx)
},
@ -356,25 +392,7 @@
},
// setter
set: function (newValue) {
while (newValue>=360) {
newValue -= 360
}
while (newValue<0) {
newValue += 360
}
if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) {
this.$store.commit('SET_EDIT_PARKING_HEADING', newValue)
}
if(this.calculate === 'Center') {
// we change center
const noseWheelLatLng = convert(this.noseWheel);
const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius);
if (parkingSize>=0) {
var reverseHeading = this.normalizeAngle(this.$store.state.Editable.data.parking.heading+180);
var newCenter = turf.destination(this.latToTurf(noseWheelLatLng), this.validN2M[parkingSize]/1000, reverseHeading, turfOptions);
this.$store.commit('SET_EDIT_PARKING_COORDS', this.turfToLatLng(newCenter));
}
}
this.headingChange(newValue)
}
},
wingspan: {

View File

@ -277,7 +277,7 @@ L.ParkingSpot = L.Circle.extend({
}
});
this.on('add', function (event) {
console.log(event);
console.debug(event);
event.target.updateBox();
if(event.target.box !== undefined) {
event.target.box.addTo(event.target._map);
@ -285,7 +285,7 @@ L.ParkingSpot = L.Circle.extend({
event.target.setInteractive(false);
});
this.on('remove', function (event) {
console.log(event);
console.debug(event);
if(event.target.box !== undefined) {
event.target.box.removeFrom(event.target._map);
}
@ -351,10 +351,6 @@ L.ParkingSpot = L.Circle.extend({
}
});
}
store.default.dispatch('setParking', this.options.attributes);
store.default.dispatch('setParkingCoords', this.getLatLng().lat.toFixed(6) + ' ' + this.getLatLng().lng.toFixed(6));
this.select();
},
turfToLatLng: function (turfPoint) {