Parking Radius

This commit is contained in:
portree_kid 2020-02-24 21:25:02 +01:00
parent dad1c69c29
commit 9cc4a5fcf6
5 changed files with 87 additions and 43 deletions

View File

@ -1,39 +0,0 @@
<template>
<div v-if="parking">
<!--
airlineCodes: 0
heading: 341.34
index: 13
lat: "N59 52.610885"
lon: "W1 17.855144"
name: "Western_Apron_Hanger"
pushBackRoute: 27
radius: 18
type: "gate"
-->
<el-row>
<el-col :span="7"><span class="demo-input-label">Name :</span></el-col>
<el-col :span="15"><el-input placeholder="Please input" v-model="name"></el-input></el-col>
</el-row>
</div>
</template>
<script lang="js">
export default {
computed: {
parking: function () {
return this.$store.state.Editable.type === 'parking'
},
name: {
// getter
get: function () {
return this.$store.state.Editable.data.parking.name
},
// setter
set: function (newValue) {
this.$store.commit('SET_EDIT_PARKING_NAME', newValue)
}
}
}
}
</script>

View File

@ -29,7 +29,7 @@
<div class="leaflet-sidebar-close"><i class="fa fa-caret-left"></i></div>
</h1>
<AirportEdit></AirportEdit>
<GroundnetEdit></GroundnetEdit>
<ParkingEdit></ParkingEdit>
<ArcEdit></ArcEdit>
<NodeEdit></NodeEdit>
</div>
@ -52,7 +52,7 @@
import {} from 'leaflet-sidebar-v2'
import L from 'leaflet'
import AirportEdit from './AirportEdit'
import GroundnetEdit from './GroundnetEdit'
import ParkingEdit from './ParkingEdit'
import ArcEdit from './ArcEdit'
import NodeEdit from './NodeEdit'
import SettingsPanel from './SettingsPanel'
@ -62,7 +62,7 @@
export default {
name: 'leaflet-sidebar',
components: { AirportEdit, ArcEdit, NodeEdit, GroundnetEdit, SettingsPanel, RunScan, FileSelect, Search },
components: { AirportEdit, ArcEdit, NodeEdit, ParkingEdit, SettingsPanel, RunScan, FileSelect, Search },
props: [],
mounted () {
this.add()

View File

@ -0,0 +1,80 @@
<template>
<div v-if="parking">
<!--
airlineCodes: 0
heading: 341.34
index: 13
lat: "N59 52.610885"
lon: "W1 17.855144"
name: "Western_Apron_Hanger"
pushBackRoute: 27
radius: 18
type: "gate"
-->
<el-row>
<el-col :span="7">
<span class="demo-input-label">Name :</span>
</el-col>
<el-col :span="15">
<el-input placeholder="Please input" v-model="name"></el-input>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Size :</span>
</el-col>
<el-col :span="15">
<el-radio-group v-model="radius">
<el-tooltip content="PIPER PA-31/CESSNA 404 Titan" placement="bottom" effect="light">
<el-radio :label="15">A</el-radio>
</el-tooltip>
<el-tooltip content="BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6" placement="bottom" effect="light">
<el-radio :label="24">B</el-radio>
</el-tooltip>
<el-tooltip content="BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100" placement="bottom" effect="light">
<el-radio :label="36">C</el-radio>
</el-tooltip>
<el-tooltip content="B767 Series/AIRBUS A-310" placement="bottom" effect="light">
<el-radio :label="52">D</el-radio>
</el-tooltip>
<el-tooltip content="B777 Series/B787 Series/A330 Family" placement="bottom" effect="light">
<el-radio :label="65">E</el-radio>
</el-tooltip>
<el-tooltip content="BOEING 747-8/AIRBUS A-380-800" placement="bottom" effect="light">
<el-radio :label="80">F</el-radio>
</el-tooltip>
</el-radio-group>
</el-col>
</el-row>
</div>
</template>
<script lang="js">
export default {
computed: {
parking: function () {
return this.$store.state.Editable.type === 'parking'
},
name: {
// getter
get: function () {
return this.$store.state.Editable.data.parking.name
},
// setter
set: function (newValue) {
this.$store.commit('SET_EDIT_PARKING_NAME', newValue)
}
},
radius: {
// getter
get: function () {
return this.$store.state.Editable.data.parking.radius
},
// setter
set: function (newValue) {
this.$store.commit('SET_EDIT_PARKING_RADIUS', newValue)
}
}
}
}
</script>

View File

@ -79,7 +79,7 @@ L.ParkingSpot = L.Circle.extend({
var end = this.editor._resizeLatLng.__vertex.getLatLng();
var heading = turf.bearing([start.lng, start.lat], [end.lng, end.lat]);
this.options.attributes.heading = heading + 180;
const counts = [14, 18, 26, 33, 40];
const counts = [15, 24, 36, 52, 65, 80];
const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev);

View File

@ -43,6 +43,9 @@ const mutations = {
'SET_EDIT_PARKING_NAME' (state, parkingName) {
Vue.set(state.data.parking, 'name', parkingName)
},
'SET_EDIT_PARKING_RADIUS' (state, radius) {
Vue.set(state.data.parking, 'radius', radius)
},
'SET_EDIT_ARC_NAME' (state, arcName) {
Vue.set(state.data.arc, 'name', arcName)
},