Wellknown radius

This commit is contained in:
portree_kid 2020-02-25 19:58:39 +01:00
parent 9cc4a5fcf6
commit cbee301ac5
4 changed files with 107 additions and 14 deletions

View File

@ -50,6 +50,16 @@
deep: true //add this if u need to watch object properties change etc.
}
);
this.$store.watch(
function (state) {
return state.Editable.data.parking;
},
() => { this.editedParking() }
,
{
deep: true //add this if u need to watch object properties change etc.
}
);
},
beforeDestroy () {
this.remove()
@ -210,13 +220,27 @@
event.target.addTo(this.groundnetLayerGroup)
})
},
editedParking() {
console.log(this.$store.state.Editable.data.parking)
if (this.$store.state.Editable.index === undefined ||
this.$store.state.Editable.data.parking === undefined ||
this.featureLookup===undefined) {
return
}
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();
}
})
},
editedArc() {
console.log('Edited Arc');
},
editedNode() {
if (this.$store.state.Editable.index === undefined ||
this.$store.state.Editable.data.node === undefined ||
this.featureLookup===undefined) {
this.featureLookup===undefined) {
return;
}
var isOnRunway = Number(this.$store.state.Editable.data.node.isOnRunway);

View File

@ -24,28 +24,51 @@
<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-group v-model="wingspan">
<el-tooltip content="PIPER PA-31/CESSNA 404 Titan" placement="top" 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-tooltip content="BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6" placement="top" 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-tooltip content="BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100" placement="top" effect="light">
<el-radio :label="36">C</el-radio>
</el-tooltip>
<el-tooltip content="B767 Series/AIRBUS A-310" placement="bottom" effect="light">
<el-tooltip content="B767 Series/AIRBUS A-310" placement="top" 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-tooltip content="B777 Series/B787 Series/A330 Family" placement="top" 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-tooltip content="BOEING 747-8/AIRBUS A-380-800" placement="top" effect="light">
<el-radio :label="80">F</el-radio>
</el-tooltip>
</el-radio-group>
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Aircraft :</span>
</el-col>
<el-col :span="15">
{{type}}
</el-col>
</el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Parking Type :</span>
</el-col>
<el-col :span="15">
<el-select v-model="parking_type" placeholder="Select">
<el-option
v-for="type in options"
:key="type.value"
:label="type.label"
:value="type.value"
></el-option>
</el-select>
</el-col>
</el-row>
</div>
</template>
@ -65,14 +88,56 @@
this.$store.commit('SET_EDIT_PARKING_NAME', newValue)
}
},
radius: {
wingspan: {
// getter
get: function () {
return this.$store.state.Editable.data.parking.radius
return this.$store.state.Editable.data.parking.radius * 2
},
// setter
set: function (newValue) {
this.$store.commit('SET_EDIT_PARKING_RADIUS', newValue)
this.$store.commit('SET_EDIT_PARKING_RADIUS', newValue / 2)
}
},
type: function () {
switch (this.$store.state.Editable.data.parking.radius * 2) {
case 15:
return 'PIPER PA-31/CESSNA 404 Titan'
case 24:
return 'BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6'
case 36:
return 'BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100'
case 52:
return 'B767 Series/AIRBUS A-310'
case 65:
return 'B777 Series/B787 Series/A330 Family'
case 80:
return 'BOEING 747-8/AIRBUS A-380-800'
default:
return 'Unknown radius : ' + this.$store.state.Editable.data.parking.radius
}
},
// ga (general aviation), cargo (cargo), gate (commercial passenger traffic),
// mil-fighter (military fighter), mil-cargo (military transport)
options: function () {
return [{value: 'none', label: 'none'},
{value: 'ga', label: 'general aviation'},
{value: 'cargo', label: 'cargo'},
{value: 'gate', label: 'commercial passenger traffic'},
{value: 'mil-fighter', label: 'military fighter'},
{value: 'mil-cargo', label: 'commercial passenger traffic'}
]
},
parking_type: {
// getter
get: function () {
if (this.$store.state.Editable.data.parking.type === undefined) {
return 'none'
}
return this.$store.state.Editable.data.parking.type
},
// setter
set: function (newValue) {
this.$store.commit('SET_EDIT_PARKING_TYPE', newValue)
}
}
}

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 = [15, 24, 36, 52, 65, 80];
const counts = [7.5, 12, 18, 26, 32.5, 40];
const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev);

View File

@ -18,8 +18,9 @@ const mutations = {
},
SET_EDIT_PARKING (state, parking) {
Vue.set(state, 'data', {})
Vue.set(state.data, 'parking', parking)
Vue.set(state, 'index', parking.index)
var p = Object.assign({}, parking)
Vue.set(state.data, 'parking', p)
Vue.set(state, 'index', p.index)
Vue.set(state, 'type', 'parking')
},
'SET_EDIT_NODE' (state, node) {
@ -43,6 +44,9 @@ const mutations = {
'SET_EDIT_PARKING_NAME' (state, parkingName) {
Vue.set(state.data.parking, 'name', parkingName)
},
'SET_EDIT_PARKING_TYPE' (state, type) {
Vue.set(state.data.parking, 'type', type)
},
'SET_EDIT_PARKING_RADIUS' (state, radius) {
Vue.set(state.data.parking, 'radius', radius)
},