Forward/Backward/Bidirection

This commit is contained in:
portree_kid 2020-03-09 19:58:40 +01:00
parent aba6ac6df5
commit 62823feedd
5 changed files with 65 additions and 13 deletions

View File

@ -27,6 +27,21 @@
<el-switch v-model="isPushback"></el-switch> <el-switch v-model="isPushback"></el-switch>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="7">
<span class="demo-input-label">Direction :</span>
</el-col>
<el-col :span="15">
<el-select v-model="direction" 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> </div>
</template> </template>
@ -36,6 +51,14 @@
arc: function () { arc: function () {
return this.$store.state.Editable.type === 'arc' return this.$store.state.Editable.type === 'arc'
}, },
// ga (general aviation), cargo (cargo), gate (commercial passenger traffic),
// mil-fighter (military fighter), mil-cargo (military transport)
options: function () {
return [{value: 'bi-directional', label: 'bi-directional'},
{value: 'forward', label: 'forward'},
{value: 'backward', label: 'backward'}
]
},
name: { name: {
// getter // getter
get: function () { get: function () {
@ -55,6 +78,16 @@
set: function (newValue) { set: function (newValue) {
this.$store.commit('SET_EDIT_PUSHBACK', newValue ? '1' : '0') this.$store.commit('SET_EDIT_PUSHBACK', newValue ? '1' : '0')
} }
},
direction: {
// getter
get: function () {
return this.$store.state.Editable.data.arc.direction
},
// setter
set: function (newValue) {
this.$store.commit('SET_EDIT_DIRECTION', newValue)
}
} }
} }
} }

View File

@ -107,6 +107,9 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
}); });
this.on('editable:vertex:clicked', function (event) { this.on('editable:vertex:clicked', function (event) {
console.log(this.featureLookup[event.vertex.glueindex]); console.log(this.featureLookup[event.vertex.glueindex]);
if (this.edit) {
}
store.default.dispatch('setNode', event.vertex.latlng.attributes) store.default.dispatch('setNode', event.vertex.latlng.attributes)
if(event.vertex._icon!=null) { if(event.vertex._icon!=null) {
@ -235,10 +238,14 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
style.color = '#3388ff'; style.color = '#3388ff';
} }
this.setStyle(style); this.setStyle(style);
if (!this.bidirectional) { if (this.options.attributes.direction === 'forward') {
this.setText(' ► ', {repeat: true, attributes: {fill: 'red', size: 20}}) this.setText(null);
} else { this.setText(' ⮞ ', {repeat: true, attributes: {fill: 'red', size: 30}})
this.setText('') } else if (this.options.attributes.direction === 'backward') {
this.setText(null);
this.setText(' ⮜ ', {repeat: true, attributes: {fill: 'red', size: 30}})
}else {
this.setText(null);
} }
}; };
}; };

View File

@ -53,6 +53,8 @@ exports.readGroundnetXML = function (fDir, icao, force) {
var merged = new Array(); var merged = new Array();
var nodesLookup = {}; var nodesLookup = {};
featureLookup = [];
parkingNodes.map(n => { parkingNodes.map(n => {
var circle = parkingSpot(n, layerGroup); var circle = parkingSpot(n, layerGroup);
@ -102,6 +104,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
featureLookup[n.attr('begin')].forEach(element => { featureLookup[n.attr('begin')].forEach(element => {
if (element instanceof L.Polyline && element.end === n.attr('begin') && element.begin === n.attr('end')) { if (element instanceof L.Polyline && element.end === n.attr('begin') && element.begin === n.attr('end')) {
element.bidirectional = true; element.bidirectional = true;
element.options.attributes.direction = 'bi-directional'
bidirectional = true; bidirectional = true;
element.updateStyle(); element.updateStyle();
} }
@ -111,7 +114,8 @@ exports.readGroundnetXML = function (fDir, icao, force) {
featureLookup[n.attr('end')].forEach(element => { featureLookup[n.attr('end')].forEach(element => {
if (element instanceof L.Polyline && element.end === n.attr('begin') && element.begin === n.attr('end')) { if (element instanceof L.Polyline && element.end === n.attr('begin') && element.begin === n.attr('end')) {
element.bidirectional = true; element.bidirectional = true;
bidirectional = true; element.options.attributes.direction = 'bi-directional'
bidirectional = true;
element.updateStyle(); element.updateStyle();
} }
}); });
@ -148,6 +152,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
else else
polyline.options.attributes[key] = Number(value); polyline.options.attributes[key] = Number(value);
}); });
polyline.options.attributes.direction = 'forward'
polyline.updateStyle(); polyline.updateStyle();
polyline.begin = beginNode.attr('index'); polyline.begin = beginNode.attr('index');

View File

@ -55,14 +55,18 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
if (featureLookup[latlng.__vertex.glueindex] == undefined) { if (featureLookup[latlng.__vertex.glueindex] == undefined) {
featureLookup[latlng.__vertex.glueindex] = []; featureLookup[latlng.__vertex.glueindex] = [];
} }
arc = { '@begin': startIndex, '@end': String(latlng.__vertex.glueindex) }; if( currentArc.direction === 'bi-directional' || currentArc.direction === 'forward' ){
styleArc(currentArc, arc); arc = { '@begin': startIndex, '@end': String(latlng.__vertex.glueindex) };
arcList.push(arc); styleArc(currentArc, arc);
featureLookup[startIndex][latlng.__vertex.glueindex] = arc; arcList.push(arc);
arc = { '@begin': String(latlng.__vertex.glueindex), '@end': startIndex }; featureLookup[startIndex][latlng.__vertex.glueindex] = arc;
styleArc(currentArc, arc); }
arcList.push(arc); if( currentArc.direction === 'bi-directional' || currentArc.direction === 'backward' ){
featureLookup[latlng.__vertex.glueindex][startIndex] = arc; arc = { '@begin': String(latlng.__vertex.glueindex), '@end': startIndex };
styleArc(currentArc, arc);
arcList.push(arc);
featureLookup[latlng.__vertex.glueindex][startIndex] = arc;
}
} }
startIndex = latlng.__vertex.glueindex; startIndex = latlng.__vertex.glueindex;
} }

View File

@ -63,6 +63,9 @@ const mutations = {
'SET_EDIT_PUSHBACK' (state, isPushBackRoute) { 'SET_EDIT_PUSHBACK' (state, isPushBackRoute) {
Vue.set(state.data.arc, 'isPushBackRoute', isPushBackRoute) Vue.set(state.data.arc, 'isPushBackRoute', isPushBackRoute)
}, },
'SET_EDIT_DIRECTION' (state, direction) {
Vue.set(state.data.arc, 'direction', direction)
},
'SET_EDIT_HOLDPOINTTYPE' (state, holdPointType) { 'SET_EDIT_HOLDPOINTTYPE' (state, holdPointType) {
Vue.set(state.data.node, 'holdPointType', holdPointType) Vue.set(state.data.node, 'holdPointType', holdPointType)
}, },