dependabot/npm_and_yarn/mathjs-7.5.1
Keith Paterson 4 years ago
parent 737f9a7b56
commit 41b7b0498f

@ -668,7 +668,7 @@ You should have received a copy of the GNU General Public License along with FG
this.featureLookup===undefined) { this.featureLookup===undefined) {
return return
} }
console.log('Edited Parking : ' + this.$store.state.Editable.data.parking) console.debug('Edited Parking : ' + this.$store.state.Editable.data.parking)
//Notify list //Notify list
if (this.featureLookup[this.$store.state.Editable.index]===undefined) { if (this.featureLookup[this.$store.state.Editable.index]===undefined) {
return return

@ -16,13 +16,21 @@
<span class="label">Name :</span> <span class="label">Name :</span>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-input placeholder="Name" v-model="name" :disabled="!editing"></el-input> <el-input
placeholder="Name"
v-model="name"
:disabled="!editing"
></el-input>
</el-col> </el-col>
<el-col :span="5"> <el-col :span="5">
<span class="label">Number :</span> <span class="label">Number :</span>
</el-col> </el-col>
<el-col :span="7"> <el-col :span="7">
<el-input placeholder="Number" v-model="number" :disabled="!editing"></el-input> <el-input
placeholder="Number"
v-model="number"
:disabled="!editing"
></el-input>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -40,7 +48,11 @@
--> -->
<el-radio-group v-model="wingspan" :disabled="!editing"> <el-radio-group v-model="wingspan" :disabled="!editing">
<el-tooltip content="PIPER PA-31/CESSNA 404 Titan" placement="top" effect="light"> <el-tooltip
content="PIPER PA-31/CESSNA 404 Titan"
placement="top"
effect="light"
>
<el-radio :label="15">A (7.5)</el-radio> <el-radio :label="15">A (7.5)</el-radio>
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip
@ -48,14 +60,14 @@
placement="top" placement="top"
effect="light" effect="light"
> >
<el-radio :label="20">- (10)</el-radio> <el-radio :label="20">- (10)</el-radio>
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip
content="BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6" content="BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6"
placement="top" placement="top"
effect="light" effect="light"
> >
<el-radio :label="28">B (14)</el-radio> <el-radio :label="28">B (14)</el-radio>
</el-tooltip> </el-tooltip>
<el-tooltip <el-tooltip
content="BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100" content="BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100"
@ -64,13 +76,25 @@
> >
<el-radio :label="36">C (18)</el-radio> <el-radio :label="36">C (18)</el-radio>
</el-tooltip> </el-tooltip>
<el-tooltip content="B767 Series/AIRBUS A-310" placement="top" effect="light"> <el-tooltip
content="B767 Series/AIRBUS A-310"
placement="top"
effect="light"
>
<el-radio :label="52">D (26)</el-radio> <el-radio :label="52">D (26)</el-radio>
</el-tooltip> </el-tooltip>
<el-tooltip content="B777 Series/B787 Series/A330 Family" placement="top" effect="light"> <el-tooltip
content="B777 Series/B787 Series/A330 Family"
placement="top"
effect="light"
>
<el-radio :label="66">E (33)</el-radio> <el-radio :label="66">E (33)</el-radio>
</el-tooltip> </el-tooltip>
<el-tooltip content="BOEING 747-8/AIRBUS A-380-800" placement="top" effect="light"> <el-tooltip
content="BOEING 747-8/AIRBUS A-380-800"
placement="top"
effect="light"
>
<el-radio :label="80">F (40)</el-radio> <el-radio :label="80">F (40)</el-radio>
</el-tooltip> </el-tooltip>
</el-radio-group> </el-radio-group>
@ -80,9 +104,9 @@
<el-col :span="7"> <el-col :span="7">
<span class="label">Aircraft :</span> <span class="label">Aircraft :</span>
</el-col> </el-col>
<el-col :span="17">{{type}}</el-col> <el-col :span="17">{{ type }}</el-col>
</el-row> </el-row>
<el-row v-if="editing"> <el-row v-if="editing">
<el-col :span="7"> <el-col :span="7">
<span class="label">Calculate :</span> <span class="label">Calculate :</span>
</el-col> </el-col>
@ -91,7 +115,6 @@
<el-radio-button label="Nose Wheel"></el-radio-button> <el-radio-button label="Nose Wheel"></el-radio-button>
<el-radio-button label="Center"></el-radio-button> <el-radio-button label="Center"></el-radio-button>
</el-radio-group> </el-radio-group>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -107,7 +130,14 @@
content="D.DDD, DMS, DM supported" content="D.DDD, DMS, DM supported"
:disabled="!editing || calculate === 'Center'" :disabled="!editing || calculate === 'Center'"
> >
<el-input placeholder="Please input" v-model="coordinates" slot="reference" :disabled="!editing || calculate ==='Center'"></el-input> <el-input
placeholder="Please input"
v-model="coordinates"
slot="reference"
:disabled="!editing || calculate === 'Center'"
@focus="coordFocussed = true"
@blur="coordFocussed = false"
></el-input>
</el-popover> </el-popover>
</el-col> </el-col>
</el-row> </el-row>
@ -124,7 +154,14 @@
content="D.DDD, DMS, DM supported" content="D.DDD, DMS, DM supported"
:disabled="!editing || calculate === 'Nose Wheel'" :disabled="!editing || calculate === 'Nose Wheel'"
> >
<el-input placeholder="Please input" v-model="noseCoordinates" slot="reference" :disabled="!editing || calculate === 'Nose Wheel'"></el-input> <el-input
placeholder="Please input"
v-model="noseCoordinates"
slot="reference"
:disabled="!editing || calculate === 'Nose Wheel'"
@focus="noseCoordFocussed = true"
@blur="noseCoordFocussed = false"
></el-input>
</el-popover> </el-popover>
</el-col> </el-col>
</el-row> </el-row>
@ -139,13 +176,15 @@
:max="720" :max="720"
:step="0.1" :step="0.1"
:precision="1" :precision="1"
:disabled="!editing || calculate ==='Heading'" :disabled="!editing || calculate === 'Heading'"
@focus="headingFocussed = true"
@blur="headingFocussed = false"
></el-input-number> ></el-input-number>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-button @click="rotate" class="button"> <el-button @click="rotate" class="button">
<i class="fas fa-ruler-combined"></i> <i class="fas fa-ruler-combined"></i>
</el-button> </el-button>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -153,7 +192,11 @@
<span class="label">Parking Type :</span> <span class="label">Parking Type :</span>
</el-col> </el-col>
<el-col :span="17"> <el-col :span="17">
<el-select v-model="parking_type" placeholder="Select" :disabled="!editing"> <el-select
v-model="parking_type"
placeholder="Select"
:disabled="!editing"
>
<el-option <el-option
v-for="type in options" v-for="type in options"
:key="type.value" :key="type.value"
@ -169,7 +212,12 @@
<span class="label">Airline :</span> <span class="label">Airline :</span>
</el-col> </el-col>
<el-col :span="17"> <el-col :span="17">
<el-select v-model="airlineCodes" multiple placeholder="Select" :disabled="!editing"> <el-select
v-model="airlineCodes"
multiple
placeholder="Select"
:disabled="!editing"
>
<el-option <el-option
v-for="item in airlines" v-for="item in airlines"
:key="item.value" :key="item.value"
@ -183,7 +231,7 @@
<el-col :span="7"> <el-col :span="7">
<span class="label">Pushback Route End :</span> <span class="label">Pushback Route End :</span>
</el-col> </el-col>
<el-col :span="17">{{pushbackEnd}}</el-col> <el-col :span="17">{{ pushbackEnd }}</el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
@ -191,7 +239,7 @@
<script lang="js"> <script lang="js">
/* eslint-disable */ /* eslint-disable */
const convert = require('geo-coordinates-parser'); const convert = require('geo-coordinates-parser');
const turf = require('@turf/turf'); const turf = require('@turf/turf');
const turfOptions = { units: 'kilometers' }; const turfOptions = { units: 'kilometers' };
@ -206,7 +254,9 @@
while (heading<0) { while (heading<0) {
heading += 360 heading += 360
} }
this.rotateFocussed = true;
this.headingChange(heading); this.headingChange(heading);
this.rotateFocussed = false;
}, },
headingChange( newValue ) { headingChange( newValue ) {
while (newValue>=360) { while (newValue>=360) {
@ -215,18 +265,21 @@
while (newValue<0) { while (newValue<0) {
newValue += 360 newValue += 360
} }
if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) { if ( Math.abs( ( this.$store.state.Editable.data.parking.heading - newValue ) >= 0 && Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) <= 0.1 )
this.$store.commit('SET_EDIT_PARKING_HEADING', newValue) || this.headingFocussed || this.rotateFocussed) {
} if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) {
if(this.calculate === 'Center') { this.$store.commit('SET_EDIT_PARKING_HEADING', newValue)
// we change center }
const noseWheelLatLng = convert(this.noseWheel); if(this.calculate === 'Center') {
const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius); // we change center
if (parkingSize>=0) { const noseWheelLatLng = convert(this.$store.state.Editable.data.parking.nosecoords);
var reverseHeading = this.normalizeAngle(this.$store.state.Editable.data.parking.heading+180); const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius);
var newCenter = turf.destination(this.latToTurf(noseWheelLatLng), this.validN2M[parkingSize]/1000, reverseHeading, turfOptions); if (parkingSize>=0) {
this.$store.commit('SET_EDIT_PARKING_COORDS', this.turfToLatLng(newCenter)); 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) { show (idx) {
@ -244,35 +297,41 @@
latToTurf (turfPoint) { latToTurf (turfPoint) {
return [turfPoint.decimalLongitude, turfPoint.decimalLatitude]; return [turfPoint.decimalLongitude, turfPoint.decimalLatitude];
}, },
turfToLatLng: function (turfPoint) { turfToLatLng (turfPoint) {
return '' + turfPoint.geometry.coordinates[1].toFixed(6) + ',' + turfPoint.geometry.coordinates[0].toFixed(6); return '' + turfPoint.geometry.coordinates[1].toFixed(6) + ',' + turfPoint.geometry.coordinates[0].toFixed(6);
}, },
beautify (coordString) {
var a = coordString.split(' ');
if (a.length === 2) {
return '' + Number(a[0]).toFixed(6) + ' ' + Number(a[1]).toFixed(6);
} else {
return coordString;
}
},
calcWheel () { calcWheel () {
var centerCoords = convert(this.$store.state.Editable.data.parking.coords); if(this.calculate === 'Nose Wheel') {
if(this.calculate === 'Nose Wheel') { // we change nosewheel
// we change center const centerLatLng = convert(this.beautify(this.$store.state.Editable.data.parking.coords));
const centerLatLng = convert(this.$store.state.Editable.data.parking.coords); const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius);
const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius);
if (parkingSize>=0) { if (parkingSize>=0) {
var newNoseWheel = turf.destination(this.latToTurf(centerLatLng), this.validN2M[parkingSize]/1000, this.$store.state.Editable.data.parking.heading, turfOptions); var newNoseWheel = turf.destination(this.latToTurf(centerLatLng), this.validN2M[parkingSize]/1000, this.$store.state.Editable.data.parking.heading, turfOptions);
this.$store.commit('SET_EDIT_PARKING_NOSE_COORDS', this.turfToLatLng(newNoseWheel)); this.$store.commit('SET_EDIT_PARKING_NOSE_COORDS', this.turfToLatLng(newNoseWheel));
} }
} }
}, },
calcCenter () { calcCenter () {
var centerCoords = convert(this.$store.state.Editable.data.parking.coords); if (this.calculate === 'Center') {
if (this.calculate === 'Center') {
// we change center // we change center
const noseWheelLatLng = convert(this.$store.state.Editable.data.parking.nosecoords); const noseWheelLatLng = convert(this.beautify(this.$store.state.Editable.data.parking.nosecoords));
const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius); const parkingSize = this.validRadii.indexOf(this.$store.state.Editable.data.parking.radius);
if (parkingSize>=0) { if (parkingSize>=0) {
var newCenter = turf.destination(this.latToTurf(noseWheelLatLng), this.validN2M[parkingSize]/1000, this.$store.state.Editable.data.parking.heading - 180, turfOptions); var newCenter = turf.destination(this.latToTurf(noseWheelLatLng), this.validN2M[parkingSize]/1000, this.$store.state.Editable.data.parking.heading - 180, turfOptions);
this.$store.commit('SET_EDIT_PARKING_COORDS', this.turfToLatLng(newCenter)); this.$store.commit('SET_EDIT_PARKING_COORDS', this.turfToLatLng(newCenter));
} }
} }
} }
}, },
data () { return {calculateState: 'Nose Wheel', noseWheel: '', validRadii: [7.5, 10, 14, 18, 26, 33, 40], validN2M: [5, 5, 6, 10, 15, 24, 24] } }, data () { return {rotateFocussed: false, headingFocussed: false, coordFocussed: false, noseCoordFocussed: false, calculateState: 'Nose Wheel', noseWheel: '', validRadii: [7.5, 10, 14, 18, 26, 33, 40], validN2M: [5, 5, 6, 10, 15, 24, 24] } },
computed: { computed: {
editing: { editing: {
get: function () { get: function () {
@ -298,16 +357,16 @@
}, },
airlineCodes: { airlineCodes: {
// getter // getter
get: function () { get: function () {
var codes = this.$store.state.Editable.data.parking.airlineCodes var codes = this.$store.state.Editable.data.parking.airlineCodes
if (Array.isArray(codes)) { if (Array.isArray(codes)) {
return codes return codes
} else if (codes !== undefined && typeof codes === 'string') { } else if (codes !== undefined && typeof codes === 'string') {
return codes.split(',') return codes.split(',')
} else { } else {
return [] return []
} }
return return
}, },
// setter // setter
set: function (newValue) { set: function (newValue) {
@ -341,9 +400,9 @@
set: function (newValue) { set: function (newValue) {
this.calculateState = newValue; this.calculateState = newValue;
if (newValue==='Center') { if (newValue==='Center') {
this.calcWheel();
} else {
this.calcCenter(); this.calcCenter();
} else {
this.calcWheel();
} }
} }
}, },
@ -357,12 +416,14 @@
// setter // setter
set: function (newValue) { set: function (newValue) {
if (newValue==='unknown') { if (newValue==='unknown') {
} }
if( newValue.match(/,/g) !== null && newValue.match(/,/g).length === 3) { if( newValue.match(/,/g) !== null && newValue.match(/,/g).length === 3) {
newValue = newValue.replace(', ', ' ').replace(/,/g, '.').replace(' ', ', '); newValue = newValue.replace(', ', ' ').replace(/,/g, '.').replace(' ', ', ');
} }
this.$store.commit('SET_EDIT_PARKING_COORDS', newValue) if (this.coordFocussed) {
this.$store.commit('SET_EDIT_PARKING_COORDS', newValue)
}
this.calcWheel(); this.calcWheel();
} }
}, },
@ -370,25 +431,30 @@
// getter // getter
get: function () { get: function () {
if(this.$store.state.Editable.index!==undefined) { if(this.$store.state.Editable.index!==undefined) {
if(!this.$store.state.Editable.data.parking.nosecoords && this.calculate === 'Nose Wheel') {
this.calcWheel();
}
return this.$store.state.Editable.data.parking.nosecoords; return this.$store.state.Editable.data.parking.nosecoords;
} }
}, },
// setter // setter
set: function (newValue) { set: function (newValue) {
if (newValue==='unknown') { if (newValue==='unknown') {
} }
if( newValue.match(/,/g) !== null && newValue.match(/,/g).length === 3) { if( newValue.match(/,/g) !== null && newValue.match(/,/g).length === 3) {
newValue = newValue.replace(', ', ' ').replace(/,/g, '.').replace(' ', ', '); newValue = newValue.replace(', ', ' ').replace(/,/g, '.').replace(' ', ', ');
} }
this.$store.commit('SET_EDIT_PARKING_NOSE_COORDS', newValue); if (this.noseCoordFocussed) {
this.$store.commit('SET_EDIT_PARKING_NOSE_COORDS', newValue);
}
this.calcCenter(); this.calcCenter();
} }
}, },
heading: { heading: {
// getter // getter
get: function () { get: function () {
return Number(this.$store.state.Editable.data.parking.heading) return this.$store.state.Editable.data.parking.heading
}, },
// setter // setter
set: function (newValue) { set: function (newValue) {

@ -25,10 +25,10 @@ L.ParkingSpot = L.Circle.extend({
if (this.direction === undefined ) { if (this.direction === undefined ) {
var center = this._latlng; var center = this._latlng;
var options = { units: 'kilometers' }; var options = { units: 'kilometers' };
var start = turf.destination([center.lng, center.lat], this.options.attributes.radius / 1000, this.normalizeAngle(this.options.attributes.heading+180), options); var start = turf.destination([center.lng, center.lat], this.options.attributes.radius / 1000, this.normalizeAngle(this.options.attributes.heading+180), options);
var end = turf.destination([center.lng, center.lat], this.options.attributes.radius / 1000, this.normalizeAngle(this.options.attributes.heading), options); var end = turf.destination([center.lng, center.lat], this.options.attributes.radius / 1000, this.normalizeAngle(this.options.attributes.heading), options);
// Resize, since leaflet is wrong // Resize, since leaflet is wrong
var rad2 = center.distanceTo(this.turfToLatLng(end), options); var rad2 = center.distanceTo(this.turfToLatLng(end), options);
console.debug('Dist ', center, [center.lng, center.lat], end.geometry.coordinates, this.options.attributes.radius, rad2); console.debug('Dist ', center, [center.lng, center.lat], end.geometry.coordinates, this.options.attributes.radius, rad2);
this.setRadius(rad2); this.setRadius(rad2);
@ -53,7 +53,7 @@ L.ParkingSpot = L.Circle.extend({
try { try {
console.debug("Update Middle ", this.editor.editLayer._layers[0]); console.debug("Update Middle ", this.editor.editLayer._layers[0]);
var o = this.editor.editLayer._layers; var o = this.editor.editLayer._layers;
console.debug(o); console.debug(o);
for (var key in o) { for (var key in o) {
if (o.hasOwnProperty(key)) { if (o.hasOwnProperty(key)) {
@ -63,7 +63,7 @@ L.ParkingSpot = L.Circle.extend({
console.debug(o[key] == this.direction); console.debug(o[key] == this.direction);
if (this.editor._resizeLatLng.__vertex!=o[key] && if (this.editor._resizeLatLng.__vertex!=o[key] &&
o[key] != this.direction && o[key] != this.direction &&
o[key] != this.frontWheel && o[key] != this.frontWheel &&
o[key] != this.box) { o[key] != this.box) {
o[key].setLatLng(this.getLatLng()); o[key].setLatLng(this.getLatLng());
} }
@ -72,9 +72,9 @@ L.ParkingSpot = L.Circle.extend({
//Object.values(o); //Object.values(o);
/* /*
.forEach(vertex => { .forEach(vertex => {
console.debug(this.editor._resizeLatLng.__vertex==vertex); console.debug(this.editor._resizeLatLng.__vertex==vertex);
}); });
*/ */
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
@ -85,15 +85,15 @@ L.ParkingSpot = L.Circle.extend({
}, },
updateHeading(heading) { updateHeading(heading) {
this.options.attributes.heading = heading; this.options.attributes.heading = heading;
this.updateVertexFromDirection(); this.updateVertexFromDirection();
this.updateWheelPos(); this.updateWheelPos();
this.updateBox(); this.updateBox();
}, },
updateRadius(radius) { updateRadius(radius) {
this._mRadius = radius; this._mRadius = radius;
this.updateDirectionFromVertex(); this.updateDirectionFromVertex();
this.updateVertexFromDirection(); this.updateVertexFromDirection();
this.updateWheelPos(); this.updateWheelPos();
this.updateBox(); this.updateBox();
}, },
// Update the direction vertex from the direction // Update the direction vertex from the direction
@ -131,14 +131,15 @@ L.ParkingSpot = L.Circle.extend({
updateWheelPos() { updateWheelPos() {
var start = this._latlng; var start = this._latlng;
var options = { units: 'kilometers' }; var options = { units: 'kilometers' };
const parkingSize = validRadii.indexOf(this.options.attributes.radius); const parkingSize = validRadii.indexOf(this.options.attributes.radius);
if (parkingSize>=0) { if (parkingSize>=0) {
var frontWheelEnd = turf.destination([start.lng, start.lat], validN2M[parkingSize] / 1000, this.options.attributes.heading, options); var frontWheelEnd = turf.destination([start.lng, start.lat], validN2M[parkingSize] / 1000, this.options.attributes.heading, options);
if(this.frontWheel!==undefined) { if(this.frontWheel!==undefined) {
this.frontWheel.setLatLng(this.turfToLatLng(frontWheelEnd)); this.frontWheel.setLatLng(this.turfToLatLng(frontWheelEnd));
return this.turfToLatLng(frontWheelEnd);
} }
} }
}, },
updateBox() { updateBox() {
var start = [this._latlng.lng, this._latlng.lat]; var start = [this._latlng.lng, this._latlng.lat];
@ -176,7 +177,7 @@ L.ParkingSpot = L.Circle.extend({
var latlngs = [leftBack, rightBack, rightMiddle, rightIntermediate, rightFront, leftFront, leftIntermediate, leftMiddle].map(l => this.turfToLatLng(l)); var latlngs = [leftBack, rightBack, rightMiddle, rightIntermediate, rightFront, leftFront, leftIntermediate, leftMiddle].map(l => this.turfToLatLng(l));
this.box = L.polygon(latlngs); this.box = L.polygon(latlngs);
//this.box.addTo(this.editor.editLayer); //this.box.addTo(this.editor.editLayer);
this.box._parkingSpot = this; this.box._parkingSpot = this;
this.box.on('click', function (event) { this.box.on('click', function (event) {
console.debug("Click Parking Box : " + event.target); console.debug("Click Parking Box : " + event.target);
if (Number(store.default.state.Editable.index) >= 0 && if (Number(store.default.state.Editable.index) >= 0 &&
@ -188,7 +189,7 @@ L.ParkingSpot = L.Circle.extend({
} }
}); });
} }
event.target._parkingSpot.select(); event.target._parkingSpot.select();
}); });
if(this.editor && this.editor.editLayer) { if(this.editor && this.editor.editLayer) {
this.box.addTo(this.editor.editLayer); this.box.addTo(this.editor.editLayer);
@ -199,7 +200,7 @@ L.ParkingSpot = L.Circle.extend({
console.debug(latlngs); console.debug(latlngs);
this.box.setLatLngs(latlngs); this.box.setLatLngs(latlngs);
} }
} }
}, },
normalizeAngle( angle ) { normalizeAngle( angle ) {
if(angle >= 180) { if(angle >= 180) {
@ -217,21 +218,25 @@ L.ParkingSpot = L.Circle.extend({
style['color'] = 'red'; style['color'] = 'red';
this.setStyle(style); this.setStyle(style);
if(this.direction) { if(this.direction) {
this.direction.setStyle(style); this.direction.setStyle(style);
this.frontWheel.setStyle(style); this.frontWheel.setStyle(style);
} }
this.updateWheelPos(); var wheelPos = this.updateWheelPos();
if(wheelPos) {
store.default.dispatch('setParkingNoseCoords', wheelPos.lat.toFixed(6) + ' ' + wheelPos.lng.toFixed(6));
}
this.updateBox(); this.updateBox();
if(this.box) { if(this.box) {
this.box.setStyle(style); this.box.setStyle(style);
} }
}, },
deselect() { deselect() {
var style = {}; var style = {};
style['color'] = '#3388ff'; style['color'] = '#3388ff';
this.setStyle(style); this.setStyle(style);
if(this.direction) { if(this.direction) {
this.direction.setStyle(style); this.direction.setStyle(style);
this.frontWheel.setStyle(style); this.frontWheel.setStyle(style);
} }
this.updateWheelPos(); this.updateWheelPos();
@ -267,11 +272,11 @@ L.ParkingSpot = L.Circle.extend({
event.target.updateVertexFromDirection(); event.target.updateVertexFromDirection();
event.target.updateWheelPos(); event.target.updateWheelPos();
event.target.updateBox(); event.target.updateBox();
this.follow(event.target.id, event); this.follow(event.target.id, event);
} }
else if(event.target.editor._resizeLatLng.__vertex._icon === event.sourceTarget._element) { else if(event.target.editor._resizeLatLng.__vertex._icon === event.sourceTarget._element) {
event.target.updateDirectionFromVertex(); event.target.updateDirectionFromVertex();
event.target.updateVertexFromDirection(); event.target.updateVertexFromDirection();
event.target.updateWheelPos(); event.target.updateWheelPos();
event.target.updateBox(); event.target.updateBox();
} }
@ -290,14 +295,15 @@ L.ParkingSpot = L.Circle.extend({
event.target.box.removeFrom(event.target._map); event.target.box.removeFrom(event.target._map);
} }
}); });
this.on('editable:vertex:drag', function (event) { this.on('editable:vertex:drag', function (event) {
console.debug("Drag Parking : ", event); console.debug("Drag Parking : ", event);
}); });
this.on('editable:vertex:dragend', function (event) { this.on('editable:vertex:dragend', function (event) {
console.debug("DragEnd Parking : ", event); console.debug("DragEnd Parking : ", event);
store.default.dispatch('setParking', event.target.options.attributes); store.default.dispatch('setParking', event.target.options.attributes);
store.default.dispatch('setParkingCoords', event.target.getLatLng().lat.toFixed(6) + ' ' + event.target.getLatLng().lng.toFixed(6)); store.default.dispatch('setParkingCoords', event.target.getLatLng().lat.toFixed(6) + ' ' + event.target.getLatLng().lng.toFixed(6));
event.target.updateWheelPos(); var wheelPos = event.target.updateWheelPos();
store.default.dispatch('setParkingNoseCoords', wheelPos.lat.toFixed(6) + ' ' + wheelPos.lng.toFixed(6));
event.target.updateBox(); event.target.updateBox();
/* /*
store.default.dispatch('setParkingHeading', this.options.attributes.heading) store.default.dispatch('setParkingHeading', this.options.attributes.heading)
@ -314,8 +320,8 @@ L.ParkingSpot = L.Circle.extend({
} }
}); });
} }
event.target.select(); event.target.select();
}); });
this.on('editable:vertex:clicked', function (event) { this.on('editable:vertex:clicked', function (event) {
console.debug(this.featureLookup[event.vertex.glueindex]); console.debug(this.featureLookup[event.vertex.glueindex]);
if (Number(store.default.state.Editable.index) >= 0 && if (Number(store.default.state.Editable.index) >= 0 &&
@ -330,14 +336,14 @@ L.ParkingSpot = L.Circle.extend({
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){ if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){
event.vertex._icon.style['background-color'] = 'red'; event.vertex._icon.style['background-color'] = 'red';
store.default.dispatch('setParking', event.target.options.attributes); store.default.dispatch('setParking', event.target.options.attributes);
this.select(); this.select();
} }
}); });
this.on('editable:disable', function (event) { this.on('editable:disable', function (event) {
event.target.removeDirection(); event.target.removeDirection();
}); });
}, },
updateStyle: function () { updateStyle: function () {
@ -357,14 +363,14 @@ L.ParkingSpot = L.Circle.extend({
return {lat: turfPoint.geometry.coordinates[1], lng: turfPoint.geometry.coordinates[0]}; return {lat: turfPoint.geometry.coordinates[1], lng: turfPoint.geometry.coordinates[0]};
}, },
extensions: function (editLayer) { extensions: function (editLayer) {
this.createDirection(); this.createDirection();
if (typeof this.featureLookup[this.id] === 'undefined') { if (typeof this.featureLookup[this.id] === 'undefined') {
this.featureLookup[this.id] = []; this.featureLookup[this.id] = [];
} }
this.featureLookup[this.id].push(this); this.featureLookup[this.id].push(this);
}, },
/** /**
* *
*/ */
follow (dragIndex, event) { follow (dragIndex, event) {
@ -410,7 +416,7 @@ L.ParkingSpot = L.Circle.extend({
}); });
element.editor.feature.setLatLngs(element.latlngs); element.editor.feature.setLatLngs(element.latlngs);
element.editor.feature.updateMiddle(); element.editor.feature.updateMiddle();
} }
} }
}) })
}, },
@ -445,21 +451,21 @@ lat="N44 52.799"
lon="W93 11.947" lon="W93 11.947"
heading="-147.51" heading="-147.51"
radius="18" radius="18"
pushBackRoute="541" pushBackRoute="541"
airlineCodes="VIR,KAL,DAL,KLM" /> airlineCodes="VIR,KAL,DAL,KLM" />
*/ */
//circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) }; //circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) };
$.each( n.attrs, function( key, value ) { $.each( n.attrs, function( key, value ) {
console.debug( '$', circle.id, key , value); console.debug( '$', circle.id, key , value);
if(isNaN(value)) if(isNaN(value))
circle.options.attributes[ key ] = value; circle.options.attributes[ key ] = value;
else else
circle.options.attributes[ key ] = Number( value); circle.options.attributes[ key ] = Number( value);
}); });
circle.addListeners(); circle.addListeners();
circle.addTo(layerGroup); circle.addTo(layerGroup);
return circle; return circle;
} }

Loading…
Cancel
Save