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>
<div v-if="airport">
<Upload :visible.sync="uploadVisible" ref="upload"></Upload>
<el-dialog
title="Add Airline"
:visible.sync="dialogVisible"
@ -11,7 +23,6 @@
v-model="airlineCode"
maxlength="3"
></el-input>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">Cancel</el-button>
<el-button type="primary" @click="addAirline">Confirm</el-button>
@ -42,7 +53,42 @@
<h1 class="leaflet-sidebar-header">{{ icao }} {{ name }}</h1>
<div width="100%" >
<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-col :span="7"><span class="label"> Airlines :</span></el-col>
@ -104,21 +150,34 @@
import FileSelect from './FileSelect'
import Frequency from './Frequency'
import ParkingList from './ParkingList'
import Upload from './Upload'
const fs = require('fs')
const path = require('path')
export default {
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: {
EditButton, FileSelect, Frequency, ParkingList
EditButton, FileSelect, Frequency, ParkingList, Upload
},
methods: {
fileImportFileName (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 () {
this.showImportFile = false
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>
<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-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>-->
<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-upload" v-on:click="upload" :show="!editing" tooltip="Upload"></EditButton>-->
<!--<EditButton icon="fas fa-edit" v-on:click="edit" :show="!editing" tooltip="Edit"></EditButton>-->
<EditButton
icon="fas fa-undo"
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 ZoomButton from './ZoomButton';
import Upload from './Upload'
import Vue from 'vue'
import fileUrl from 'file-url'
export default {
components: { EditButton, Upload, ZoomButton },
components: { EditButton, ZoomButton },
data () {
return {isEditing: false, uploadVisible: false, centerDialogVisible: false, saveDialogVisible: false, checkDialogVisible: false, checking: false, progress: 0, max: 0, pavementLayerVisible: true}
},
created () {
},
methods: {
upload() {
this.uploadVisible = true
this.$refs.upload.status()
this.$refs.upload.check()
},
zoomout() {
this.$parent.$parent.$refs.editLayer.stopDrawing()
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 () {
this.isEditing = true
this.$emit('edit')
this.$emit('edit', true)
},
setEditing (editing) {
this.isEditing = editing
},
undoFirst () {
this.isEditing = false
this.$emit('edit')
this.$emit('edit', false)
this.centerDialogVisible = false
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
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 () {
this.isEditing = false
this.$emit('edit')
this.$emit('edit', false)
this.centerDialogVisible = false
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
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 () {
this.$parent.$parent.$refs.editLayer.stopDrawing()
this.isEditing = false
this.$emit('edit')
this.$emit('edit', false)
this.$parent.$parent.$refs.map.mapObject.options.minZoom = 1;
Vue.set(this, 'saveDialogVisible', true)
this.$emit('edit')
this.$emit('edit', false)
Vue.nextTick( function () {
setTimeout( this.saveDefered.bind(this), 100);
}, this)
@ -192,9 +187,6 @@ You should have received a copy of the GNU General Public License along with FG
}
}, 500)
},
test() {
this.$parent.$parent.$refs.editLayer.test()
},
check () {
try {
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], this.icao[2]), { recursive: true })} catch (err) { }
fs.copyFileSync(f, fNew)
this.$message({
type: 'info',
message: `Copied to ${fNew}`
});
try {
fs.copyFileSync(f, fNew)
this.$message({
type: 'info',
message: `Copied to ${fNew}`
});
} catch (error) {
this.$message({
type: 'error',
message: `Copy error : ${error}`
});
}
},
setVisible(visible) {
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-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>
<PavementLayer ref="pavementLayer"></PavementLayer>
<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>
<EditLayer ref="editLayer"></EditLayer>
<ToolLayer ref="toolLayer" @select-poly="onSelectedPolygon"></ToolLayer>
<EditBar ref="editBar" @edit="onEdit"></EditBar>
<EditBar ref="editBar" @edit="onEdit($event)"></EditBar>
<ToolBar ref="toolBar"></ToolBar>
</l-map>
</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)
},
onEdit (event) {
if (this.$refs.editBar.isEditing) {
if (event) {
this.$refs.map.mapObject.options.minZoom = 13
} else {
this.$refs.map.mapObject.options.minZoom = 1
}
this.$refs.editLayer.enableEdit()
this.$refs.toolBar.setEdit(this.$refs.editBar.isEditing)
this.$refs.sidebar.setEditing(this.$refs.editBar.isEditing)
this.$refs.editBar.setEditing(event)
this.$refs.toolBar.setEditing(event)
this.$refs.sidebar.setEditing(event)
},
onEditSidebar (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>
<ArcEdit></ArcEdit>
<NodeEdit></NodeEdit>
<ParkingGroupEdit ref="parkingGroupEdit" @edit="(msg) => $emit('edit', msg)"></ParkingGroupEdit>
<AirportEdit ref="airportEdit"></AirportEdit>
<ParkingGroupEdit ref="parkingGroupEdit" @editParking="(msg) => $emit('editParking', msg)"></ParkingGroupEdit>
<AirportEdit ref="airportEdit" @edit="$emit('edit', $event)"></AirportEdit>
</div>
<!--
<div class="leaflet-sidebar-pane" id="parking">

View File

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

View File

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

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.drawPolyline()
},
setEdit (edit) {
setEditing (edit) {
this.isEditing = edit;
if(!this.isEditing) {
this.$parent.$parent.$refs.toolLayer.stopDrawing()

View File

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