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-col>
</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>
</template>
@ -36,6 +51,14 @@
arc: function () {
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: {
// getter
get: function () {
@ -55,6 +78,16 @@
set: function (newValue) {
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) {
console.log(this.featureLookup[event.vertex.glueindex]);
if (this.edit) {
}
store.default.dispatch('setNode', event.vertex.latlng.attributes)
if(event.vertex._icon!=null) {
@ -235,10 +238,14 @@ exports.extendTaxiSegment = function (taxiwaySegment) {
style.color = '#3388ff';
}
this.setStyle(style);
if (!this.bidirectional) {
this.setText(' ► ', {repeat: true, attributes: {fill: 'red', size: 20}})
} else {
this.setText('')
if (this.options.attributes.direction === 'forward') {
this.setText(null);
this.setText(' ⮞ ', {repeat: true, attributes: {fill: 'red', size: 30}})
} 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 nodesLookup = {};
featureLookup = [];
parkingNodes.map(n => {
var circle = parkingSpot(n, layerGroup);
@ -102,6 +104,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
featureLookup[n.attr('begin')].forEach(element => {
if (element instanceof L.Polyline && element.end === n.attr('begin') && element.begin === n.attr('end')) {
element.bidirectional = true;
element.options.attributes.direction = 'bi-directional'
bidirectional = true;
element.updateStyle();
}
@ -111,6 +114,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
featureLookup[n.attr('end')].forEach(element => {
if (element instanceof L.Polyline && element.end === n.attr('begin') && element.begin === n.attr('end')) {
element.bidirectional = true;
element.options.attributes.direction = 'bi-directional'
bidirectional = true;
element.updateStyle();
}
@ -148,6 +152,7 @@ exports.readGroundnetXML = function (fDir, icao, force) {
else
polyline.options.attributes[key] = Number(value);
});
polyline.options.attributes.direction = 'forward'
polyline.updateStyle();
polyline.begin = beginNode.attr('index');

View File

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

View File

@ -63,6 +63,9 @@ const mutations = {
'SET_EDIT_PUSHBACK' (state, 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) {
Vue.set(state.data.node, 'holdPointType', holdPointType)
},