diff --git a/src/renderer/components/Airport.vue b/src/renderer/components/Airport.vue index 5b44f15..2509fc6 100644 --- a/src/renderer/components/Airport.vue +++ b/src/renderer/components/Airport.vue @@ -58,9 +58,12 @@ You should have received a copy of the GNU General Public License along with FG const $ = require('jquery'); import 'element-ui/lib/theme-chalk/index.css' import {removeWip} from '../loaders/groundnet_functions' + import Vue from 'vue' + import { EventBus } from './event-bus.js'; export default { name: 'airport', + components: { }, props: {airport: Object, editing: Boolean}, mounted () { this.$forceUpdate(); @@ -83,7 +86,14 @@ You should have received a copy of the GNU General Public License along with FG this.$store.dispatch('removeWip', this.airport.icao); }, upload() { - + let airports = this.$store.state.Airports.airports + .filter(a => a.properties.icao.match(this.airport.icao)) + if (airports.length > 0) { + this.$store.commit('CENTER', [airports[0].geometry.coordinates[1], airports[0].geometry.coordinates[0]]) + } + Vue.set(this.$parent.$parent.$parent, 'uploadVisible', true) + this.$parent.$parent.$parent.$refs.upload.status() + this.$parent.$parent.$parent.$refs.upload.check() } }, computed: { diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index 3b864b2..b57ad19 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -22,6 +22,8 @@ You should have received a copy of the GNU General Public License along with FG import L2 from 'leaflet-textpath' import Vue from 'vue' import { MessageBox } from 'element-ui'; + import { EventBus } from './event-bus.js'; + const turf = require('@turf/turf') @@ -131,24 +133,12 @@ You should have received a copy of the GNU General Public License along with FG l.addListeners() } }) - /* - this.groundnetLayerGroup.eachLayer(l => { - if (l instanceof L.TaxiwaySegment) { - var decorator = L.polylineDecorator(l, { - pattern: [ - // defines a pattern of 10px-wide dashes, repeated every 20px on the line - {offset: 5, repeat: 50, symbol: L.Symbol.arrowHead({pixelSize: 15, pathOptions: {fillOpacity: 1, weight: 0}})} - ] - }) - decorator.addTo(this.$parent.mapObject) - } - }) - */ - console.log(this.groundnetLayerGroup.maxId) this.groundnetLayerGroup.addTo(this.$parent.mapObject) this.icao = icao + console.log(EventBus) + EventBus.$emit('i-got-clicked', 1); }, visible (feature) { let bounds = this.$store.state.Settings.bounds @@ -644,7 +634,7 @@ You should have received a copy of the GNU General Public License along with FG if (this.featureLookup===undefined) { return } - console.log('Edited Parkings : ' + this.$store.state.Parkings.items) + console.debug('Edited Parkings : ' + this.$store.state.Parkings.items) this.$store.state.Parkings.items.forEach( newElement => { console.debug(newElement); if(this.featureLookup[newElement.index]) { diff --git a/src/renderer/components/FlightgearMap.vue b/src/renderer/components/FlightgearMap.vue index e5f7682..5256ded 100644 --- a/src/renderer/components/FlightgearMap.vue +++ b/src/renderer/components/FlightgearMap.vue @@ -78,6 +78,64 @@ You should have received a copy of the GNU General Public License along with FG name: 'flightgear-map', components: { LMap, LTileLayer, LMarker, LCircle, LeafletSidebar, AiLayer, EditBar, ToolBar, EditLayer, PavementLayer, LLayerGroup, LControl, ThresholdLayer, ToolLayer }, props: [], + created () { + this.loadingInstance = null + this.$store.watch( + function (state) { + return state.Loading.groundnetLoaded + }, + (newValue, oldValue) => { + // debugger + console.log('groundnetLoaded ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance) + if (newValue !== oldValue) { + this.groundnetLoaded = newValue + if (!(this.groundnetLoaded && + this.pavementLoaded) && + (this.loadingInstance === null || this.loadingInstance === undefined)) { + this.loadingInstance = Loading.service({ fullscreen: false }) + } + if (this.groundnetLoaded && + this.pavementLoaded && + this.loadingInstance !== null) { + this.loadingInstance.close() + this.loadingInstance = null + } + } + } + , + { + deep: false, + immediate: true + } + ) + this.$store.watch( + function (state) { + return state.Loading.pavementLoaded + }, + (newValue, oldValue) => { + console.log('pavementLoaded ' + oldValue + ' => ' + newValue + ' ' + this.groundnetLoaded + ' ' + this.pavementLoaded + ' ' + this.loadingInstance) + if (newValue !== oldValue) { + this.pavementLoaded = newValue + if (!(this.groundnetLoaded && + this.pavementLoaded) && + (this.loadingInstance === null || this.loadingInstance === undefined)) { + this.loadingInstance = Loading.service({ fullscreen: false }) + } + if (this.groundnetLoaded && + this.pavementLoaded && + this.loadingInstance !== null) { + this.loadingInstance.close() + this.loadingInstance = null + } + } + } + , + { + deep: false, + immediate: true + } + ) + }, mounted () { this.$store.dispatch('getAirports') this.$store.subscribe((mutation, state) => { @@ -88,13 +146,10 @@ You should have received a copy of the GNU General Public License along with FG .filter(feature => this.visible(feature)) .map(feature => feature.properties.icao) if (airportsToLoad.length > 0 && airportsToLoad[0] !== this.editingAirport && this.zoom > 12) { - let loadingInstance = Loading.service({ fullscreen: true }) - this.$nextTick(() => { // Loading should be closed asynchronously this.$refs.pavementLayer.load(airportsToLoad[0]) this.$refs.editLayer.load(airportsToLoad[0]) this.$refs.thresholdLayer.load(airportsToLoad[0]) - loadingInstance.close() this.editingAirport = airportsToLoad[0] }) } @@ -111,6 +166,9 @@ You should have received a copy of the GNU General Public License along with FG }, data () { return { + loadingInstance: Object, + groundnetLoaded: false, + pavementLoaded: false, url: 'https://a.tile.openstreetmap.de/{z}/{x}/{y}.png', attribution: 'Flightgear Airports ' + require('electron').remote.app.getVersion() + ' Electron ' + diff --git a/src/renderer/components/LeafletSidebar.vue b/src/renderer/components/LeafletSidebar.vue index 3d16c98..6f6b406 100644 --- a/src/renderer/components/LeafletSidebar.vue +++ b/src/renderer/components/LeafletSidebar.vue @@ -11,6 +11,7 @@ You should have received a copy of the GNU General Public License along with FG -->