Move Projectlevel Buttons

This commit is contained in:
portree_kid 2020-08-16 17:17:35 +02:00
parent a1fca579af
commit 67c8814691
9 changed files with 109 additions and 44 deletions

View File

@ -1,5 +1,17 @@
<!--
Copyright 2020 Keith Paterson
This file is part of FG Airports.
FG Airports is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
FG Airports is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with FG Airports. If not, see http://www.gnu.org/licenses/.
-->
<template> <template>
<div v-if="airport"> <div v-if="airport">
<Upload :visible.sync="uploadVisible" ref="upload"></Upload>
<el-dialog <el-dialog
title="Add Airline" title="Add Airline"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@ -11,7 +23,6 @@
v-model="airlineCode" v-model="airlineCode"
maxlength="3" maxlength="3"
></el-input> ></el-input>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button> <el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="addAirline">Confirm</el-button> <el-button type="primary" @click="addAirline">Confirm</el-button>
@ -42,7 +53,42 @@
<h1 class="leaflet-sidebar-header">{{ icao }} {{ name }}</h1> <h1 class="leaflet-sidebar-header">{{ icao }} {{ name }}</h1>
<div width="100%" > <div width="100%" >
<el-row> <el-row>
<el-button @click="showImportFile = true" v-if="!editing" ><i class="fas fa-file-import"></i></el-button> <el-popover
placement="top-start"
title="Description"
width="200"
trigger="hover"
content="Edit"
>
<el-button @click="edit" v-if="!editing" slot="reference"><i class="fas fa-edit"></i></el-button>
</el-popover>
<el-popover
placement="top-start"
title="Description"
width="200"
trigger="hover"
content="Import groundnet"
>
<el-button @click="showImportFile = true" v-if="!editing" slot="reference"><i class="fas fa-file-import"></i></el-button>
</el-popover>
<el-popover
placement="top-start"
title="Description"
width="220"
trigger="hover"
content="Export groundnet to export directory"
>
<el-button @click="test" v-if="!editing" slot="reference"><i class="fas fa-file-export"></i></el-button>
</el-popover>
<el-popover
placement="top-start"
title="Description"
width="200"
trigger="hover"
content="Upload Airport"
>
<el-button @click="upload" v-if="!editing" slot="reference"><i class="fas fa-upload"></i></el-button>
</el-popover>
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="7"><span class="label"> Airlines :</span></el-col> <el-col :span="7"><span class="label"> Airlines :</span></el-col>
@ -104,21 +150,34 @@
import FileSelect from './FileSelect' import FileSelect from './FileSelect'
import Frequency from './Frequency' import Frequency from './Frequency'
import ParkingList from './ParkingList' import ParkingList from './ParkingList'
import Upload from './Upload'
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
export default { export default {
data () { data () {
return {showImportFile: false, activeTab: 'first', editing: false, dialogVisible: false, airlineCode: '', fileImport: null} return {showImportFile: false, activeTab: 'first', editing: false, uploadVisible: false, dialogVisible: false, airlineCode: '', fileImport: null}
}, },
components: { components: {
EditButton, FileSelect, Frequency, ParkingList EditButton, FileSelect, Frequency, ParkingList, Upload
}, },
methods: { methods: {
fileImportFileName (f) { fileImportFileName (f) {
this.fileImport = f this.fileImport = f
}, },
edit () {
this.isEditing = true
this.$emit('edit', true)
},
upload () {
this.uploadVisible = true
this.$refs.upload.status()
this.$refs.upload.check()
},
test () {
this.$parent.$parent.$parent.$refs.editLayer.test()
},
importFile () { importFile () {
this.showImportFile = false this.showImportFile = false
var fDir = this.$store.state.Settings.settings.airportsDirectory var fDir = this.$store.state.Settings.settings.airportsDirectory

View File

@ -11,14 +11,12 @@ You should have received a copy of the GNU General Public License along with FG
--> -->
<template> <template>
<div id="EditBar"> <div id="EditBar">
<Upload :visible.sync="uploadVisible" ref="upload"></Upload>
<ZoomButton icon="fas fa-th" v-on:click="zoomin" :show="true" tooltip="Zoomin"></ZoomButton> <ZoomButton icon="fas fa-th" v-on:click="zoomin" :show="true" tooltip="Zoomin"></ZoomButton>
<ZoomButton icon="fas fa-th-large" v-on:click="zoomout" :show="!editing" tooltip="Zoomout"></ZoomButton> <ZoomButton icon="fas fa-th-large" v-on:click="zoomout" :show="!editing" tooltip="Zoomout"></ZoomButton>
<!--<ZoomButton icon="far fa-eye-slash" v-on:click="hideAPT" :show='true' tooltip="Hide APT"></ZoomButton>--> <!--<ZoomButton icon="far fa-eye-slash" v-on:click="hideAPT" :show='true' tooltip="Hide APT"></ZoomButton>-->
<EditButton icon="fas fa-upload" v-on:click="upload" :show="!editing" tooltip="Upload"></EditButton> <!--<EditButton icon="fas fa-upload" v-on:click="upload" :show="!editing" tooltip="Upload"></EditButton>-->
<EditButton icon="fas fa-plane" v-on:click="test" :show="!editing" tooltip="Export"></EditButton> <!--<EditButton icon="fas fa-edit" v-on:click="edit" :show="!editing" tooltip="Edit"></EditButton>-->
<EditButton icon="fas fa-edit" v-on:click="edit" :show="!editing" tooltip="Edit"></EditButton>
<EditButton <EditButton
icon="fas fa-undo" icon="fas fa-undo"
v-on:click="centerDialogVisible = true" v-on:click="centerDialogVisible = true"
@ -80,24 +78,18 @@ You should have received a copy of the GNU General Public License along with FG
import EditButton from './EditButton' import EditButton from './EditButton'
import ZoomButton from './ZoomButton'; import ZoomButton from './ZoomButton';
import Upload from './Upload'
import Vue from 'vue' import Vue from 'vue'
import fileUrl from 'file-url' import fileUrl from 'file-url'
export default { export default {
components: { EditButton, Upload, ZoomButton }, components: { EditButton, ZoomButton },
data () { data () {
return {isEditing: false, uploadVisible: false, centerDialogVisible: false, saveDialogVisible: false, checkDialogVisible: false, checking: false, progress: 0, max: 0, pavementLayerVisible: true} return {isEditing: false, uploadVisible: false, centerDialogVisible: false, saveDialogVisible: false, checkDialogVisible: false, checking: false, progress: 0, max: 0, pavementLayerVisible: true}
}, },
created () { created () {
}, },
methods: { methods: {
upload() {
this.uploadVisible = true
this.$refs.upload.status()
this.$refs.upload.check()
},
zoomout() { zoomout() {
this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.stopDrawing()
this.$parent.$parent.zoomUpdated(9) this.$parent.$parent.zoomUpdated(9)
@ -112,11 +104,14 @@ You should have received a copy of the GNU General Public License along with FG
}, },
edit () { edit () {
this.isEditing = true this.isEditing = true
this.$emit('edit') this.$emit('edit', true)
},
setEditing (editing) {
this.isEditing = editing
}, },
undoFirst () { undoFirst () {
this.isEditing = false this.isEditing = false
this.$emit('edit') this.$emit('edit', false)
this.centerDialogVisible = false this.centerDialogVisible = false
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1; this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
this.$parent.$parent.$refs.editLayer.disableEdit() this.$parent.$parent.$refs.editLayer.disableEdit()
@ -124,7 +119,7 @@ You should have received a copy of the GNU General Public License along with FG
}, },
undoLast () { undoLast () {
this.isEditing = false this.isEditing = false
this.$emit('edit') this.$emit('edit', false)
this.centerDialogVisible = false this.centerDialogVisible = false
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1; this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
this.$parent.$parent.$refs.editLayer.disableEdit() this.$parent.$parent.$refs.editLayer.disableEdit()
@ -133,10 +128,10 @@ You should have received a copy of the GNU General Public License along with FG
save () { save () {
this.$parent.$parent.$refs.editLayer.stopDrawing() this.$parent.$parent.$refs.editLayer.stopDrawing()
this.isEditing = false this.isEditing = false
this.$emit('edit') this.$emit('edit', false)
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1; this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
Vue.set(this, 'saveDialogVisible', true) Vue.set(this, 'saveDialogVisible', true)
this.$emit('edit') this.$emit('edit', false)
Vue.nextTick( function () { Vue.nextTick( function () {
setTimeout( this.saveDefered.bind(this), 100); setTimeout( this.saveDefered.bind(this), 100);
}, this) }, this)
@ -192,9 +187,6 @@ You should have received a copy of the GNU General Public License along with FG
} }
}, 500) }, 500)
}, },
test() {
this.$parent.$parent.$refs.editLayer.test()
},
check () { check () {
try { try {
this.scanning = true this.scanning = true

View File

@ -976,11 +976,18 @@ You should have received a copy of the GNU General Public License along with FG
try { fs.mkdirSync(path.join(this.$store.state.Settings.settings.testDirectory, 'Airports', this.icao[0], this.icao[1]), { recursive: true })} catch (err) { } try { fs.mkdirSync(path.join(this.$store.state.Settings.settings.testDirectory, 'Airports', this.icao[0], this.icao[1]), { recursive: true })} catch (err) { }
try { fs.mkdirSync(path.join(this.$store.state.Settings.settings.testDirectory, 'Airports', this.icao[0], this.icao[1], this.icao[2]), { recursive: true })} catch (err) { } try { fs.mkdirSync(path.join(this.$store.state.Settings.settings.testDirectory, 'Airports', this.icao[0], this.icao[1], this.icao[2]), { recursive: true })} catch (err) { }
try {
fs.copyFileSync(f, fNew) fs.copyFileSync(f, fNew)
this.$message({ this.$message({
type: 'info', type: 'info',
message: `Copied to ${fNew}` message: `Copied to ${fNew}`
}); });
} catch (error) {
this.$message({
type: 'error',
message: `Copy error : ${error}`
});
}
}, },
setVisible(visible) { setVisible(visible) {
if (this.layerGroup) { if (this.layerGroup) {

View File

@ -28,7 +28,7 @@ You should have received a copy of the GNU General Public License along with FG
</l-control> </l-control>
--> -->
<!--<l-marker :lat-lng="marker"></l-marker>--> <!--<l-marker :lat-lng="marker"></l-marker>-->
<LeafletSidebar ref="sidebar" @edit="onEditSidebar"></LeafletSidebar> <LeafletSidebar ref="sidebar" @editParking="onEditSidebar" @edit="onEdit($event)"></LeafletSidebar>
<AiLayer ref="aiLayer"></AiLayer> <AiLayer ref="aiLayer"></AiLayer>
<PavementLayer ref="pavementLayer"></PavementLayer> <PavementLayer ref="pavementLayer"></PavementLayer>
<ThresholdLayer ref="thresholdLayer"></ThresholdLayer> <ThresholdLayer ref="thresholdLayer"></ThresholdLayer>
@ -45,7 +45,7 @@ You should have received a copy of the GNU General Public License along with FG
</l-layer-group> </l-layer-group>
<EditLayer ref="editLayer"></EditLayer> <EditLayer ref="editLayer"></EditLayer>
<ToolLayer ref="toolLayer" @select-poly="onSelectedPolygon"></ToolLayer> <ToolLayer ref="toolLayer" @select-poly="onSelectedPolygon"></ToolLayer>
<EditBar ref="editBar" @edit="onEdit"></EditBar> <EditBar ref="editBar" @edit="onEdit($event)"></EditBar>
<ToolBar ref="toolBar"></ToolBar> <ToolBar ref="toolBar"></ToolBar>
</l-map> </l-map>
</template> </template>
@ -228,14 +228,15 @@ You should have received a copy of the GNU General Public License along with FG
this.$refs.sidebar.setData(parkings) this.$refs.sidebar.setData(parkings)
}, },
onEdit (event) { onEdit (event) {
if (this.$refs.editBar.isEditing) { if (event) {
this.$refs.map.mapObject.options.minZoom = 13 this.$refs.map.mapObject.options.minZoom = 13
} else { } else {
this.$refs.map.mapObject.options.minZoom = 1 this.$refs.map.mapObject.options.minZoom = 1
} }
this.$refs.editLayer.enableEdit() this.$refs.editLayer.enableEdit()
this.$refs.toolBar.setEdit(this.$refs.editBar.isEditing) this.$refs.editBar.setEditing(event)
this.$refs.sidebar.setEditing(this.$refs.editBar.isEditing) this.$refs.toolBar.setEditing(event)
this.$refs.sidebar.setEditing(event)
}, },
onEditSidebar (event) { onEditSidebar (event) {
this.$refs.editLayer.onEdit(event) this.$refs.editLayer.onEdit(event)

View File

@ -40,8 +40,8 @@ You should have received a copy of the GNU General Public License along with FG
<ParkingEdit></ParkingEdit> <ParkingEdit></ParkingEdit>
<ArcEdit></ArcEdit> <ArcEdit></ArcEdit>
<NodeEdit></NodeEdit> <NodeEdit></NodeEdit>
<ParkingGroupEdit ref="parkingGroupEdit" @edit="(msg) => $emit('edit', msg)"></ParkingGroupEdit> <ParkingGroupEdit ref="parkingGroupEdit" @editParking="(msg) => $emit('editParking', msg)"></ParkingGroupEdit>
<AirportEdit ref="airportEdit"></AirportEdit> <AirportEdit ref="airportEdit" @edit="$emit('edit', $event)"></AirportEdit>
</div> </div>
<!-- <!--
<div class="leaflet-sidebar-pane" id="parking"> <div class="leaflet-sidebar-pane" id="parking">

View File

@ -173,7 +173,7 @@ const convert = require('geo-coordinates-parser');
}, },
wingspanChange( newValue ) { wingspanChange( newValue ) {
if ( newValue ) { if ( newValue ) {
this.$emit('edit', {type: 'parking-group-wingspan', wingspan: newValue} ) this.$emit('editParking', {type: 'parking-group-wingspan', wingspan: newValue} )
} }
}, },
headingChange( newValue ) { headingChange( newValue ) {

View File

@ -30,15 +30,19 @@
if (this.editLayer === null) { if (this.editLayer === null) {
this.initLayer() this.initLayer()
} }
if (this.editLayer) {
return this.editLayer.show(idx) return this.editLayer.show(idx)
}
}, },
initLayer () { initLayer () {
var parent = this.$parent var parent = this.$parent
while (parent.$refs.editLayer === undefined) { while (parent && !parent.$refs.editLayer) {
parent = parent.$parent parent = parent.$parent
} }
if (parent) {
this.editLayer = parent.$refs.editLayer this.editLayer = parent.$refs.editLayer
} }
}
}, },
computed: { computed: {
options: function () { options: function () {

View File

@ -42,7 +42,7 @@ You should have received a copy of the GNU General Public License along with FG
this.$parent.$parent.$refs.toolLayer.stopDrawing() this.$parent.$parent.$refs.toolLayer.stopDrawing()
this.$parent.$parent.$refs.toolLayer.drawPolyline() this.$parent.$parent.$refs.toolLayer.drawPolyline()
}, },
setEdit (edit) { setEditing (edit) {
this.isEditing = edit; this.isEditing = edit;
if(!this.isEditing) { if(!this.isEditing) {
this.$parent.$parent.$refs.toolLayer.stopDrawing() this.$parent.$parent.$refs.toolLayer.stopDrawing()

View File

@ -253,10 +253,12 @@
} }
}, },
editLayer () { editLayer () {
if(this.$parent.$parent.$parent.icao) { var parent = this.$parent;
return this.$parent.$parent.$parent.$refs.editLayer while (!parent.icao) {
} else { parent = this.$parent;
return this.$parent.$parent.$parent.$parent.$parent.$parent.$refs.editLayer if (parent.icao) {
return parent.$refs.editLayer;
}
} }
}, },
pavementLayer () { pavementLayer () {