This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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]) {
|
||||
|
||||
@@ -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: '<A href="https://github.com/Portree-Kid/flightgear-airports" target="_blank">Flightgear Airports ' + require('electron').remote.app.getVersion() +
|
||||
'</A> <A href="https://www.electronjs.org/" target="_blank">Electron</A> ' +
|
||||
|
||||
@@ -11,6 +11,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
-->
|
||||
<template>
|
||||
<div id="sidebar" class="leaflet-sidebar collapsed">
|
||||
<Upload :visible.sync="uploadVisible" ref="upload"></Upload>
|
||||
<!-- Nav tabs -->
|
||||
<div class="leaflet-sidebar-tabs">
|
||||
<ul role="tablist"> <!-- top aligned tabs -->
|
||||
@@ -83,11 +84,12 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
import RunScan from './RunScan'
|
||||
import SettingsPanel from './SettingsPanel'
|
||||
import Search from './Search'
|
||||
import Upload from './Upload'
|
||||
import WorkInProgress from './WorkInProgress'
|
||||
|
||||
export default {
|
||||
name: 'leaflet-sidebar',
|
||||
components: { Help, AirportEdit, ArcEdit, CheckPanel, NodeEdit, ParkingEdit, ParkingGroupEdit, RunScan, FileSelect, SettingsPanel, Search, WorkInProgress },
|
||||
components: { Help, AirportEdit, ArcEdit, CheckPanel, NodeEdit, ParkingEdit, ParkingGroupEdit, RunScan, FileSelect, SettingsPanel, Search, Upload, WorkInProgress },
|
||||
props: [],
|
||||
created () {
|
||||
window.addEventListener('keydown', this.doCommand)
|
||||
@@ -102,7 +104,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
this.remove()
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
return { uploadVisible: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -26,6 +26,31 @@
|
||||
name: 'upload',
|
||||
props: [],
|
||||
mounted () {
|
||||
this.$store.watch(
|
||||
function (state) {
|
||||
return state.Loading.groundnetLoaded;
|
||||
},
|
||||
() => { if(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded &&
|
||||
this.visible) this.check() }
|
||||
,
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
);
|
||||
this.$store.watch(
|
||||
function (state) {
|
||||
return state.Loading.pavementLoaded;
|
||||
},
|
||||
() => { if(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded &&
|
||||
this.visible) this.check() }
|
||||
,
|
||||
{
|
||||
deep: false
|
||||
}
|
||||
);
|
||||
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
@@ -44,6 +69,7 @@
|
||||
|
||||
},
|
||||
status () {
|
||||
this.azure = false;
|
||||
var xhr = new XMLHttpRequest();
|
||||
var parent = this.$parent;
|
||||
|
||||
@@ -151,14 +177,18 @@
|
||||
},
|
||||
check () {
|
||||
try {
|
||||
if(!(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded)) {
|
||||
return
|
||||
}
|
||||
this.scanning = true
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080/src/renderer/utils/check.js`
|
||||
: `file://${process.resourcesPath}/workers/check.js`
|
||||
console.log('make a check worker: ', path.resolve(__dirname, 'check.js'))
|
||||
console.debug('make a check worker: ', path.resolve(__dirname, 'check.js'))
|
||||
|
||||
const worker = new Worker(winURL)
|
||||
console.log(fileUrl('src/renderer/utils/check.js'))
|
||||
console.debug(fileUrl('src/renderer/utils/check.js'))
|
||||
|
||||
worker.checking = this.checking
|
||||
worker.max = this.max
|
||||
@@ -169,13 +199,13 @@
|
||||
this.worker = worker
|
||||
var groundnet = []
|
||||
|
||||
if (!this.$parent.$parent.$parent.$refs.editLayer.groundnetLayerGroup) {
|
||||
if (!this.editLayer().groundnetLayerGroup) {
|
||||
this.message = 'Groundnet not visible'
|
||||
}
|
||||
if (!this.$parent.$parent.$parent.$refs.pavementLayer.pavement) {
|
||||
if (!this.pavementLayer().pavement) {
|
||||
this.message = 'Pavement not visible'
|
||||
}
|
||||
this.$parent.$parent.$parent.$refs.editLayer.groundnetLayerGroup.eachLayer(l => {
|
||||
this.editLayer().groundnetLayerGroup.eachLayer(l => {
|
||||
console.log(l)
|
||||
if (l instanceof L.Polyline) {
|
||||
l._latlngs[0].glueindex = this.begin;
|
||||
@@ -186,7 +216,7 @@
|
||||
})
|
||||
var features = groundnet.map(mapper.checkMapper).filter(n => n)
|
||||
var pavement = []
|
||||
this.$parent.$parent.$parent.$refs.pavementLayer.pavement.eachLayer(l => {
|
||||
this.pavementLayer().pavement.eachLayer(l => {
|
||||
console.log(l)
|
||||
pavement.push(l)
|
||||
})
|
||||
@@ -221,7 +251,21 @@
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
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
|
||||
}
|
||||
},
|
||||
pavementLayer () {
|
||||
if(this.$parent.$parent.$parent.icao) {
|
||||
return this.$parent.$parent.$parent.$refs.pavementLayer
|
||||
} else {
|
||||
return this.$parent.$parent.$parent.$parent.$parent.$parent.$refs.pavementLayer
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
@@ -238,7 +282,11 @@
|
||||
return !this.error?'center':'error'
|
||||
},
|
||||
title: function () {
|
||||
return `Upload ${this.$parent.$parent.$parent.icao} to groundweb.`
|
||||
if(this.$parent.$parent.$parent.icao !== undefined) {
|
||||
return `Upload ${this.$parent.$parent.$parent.icao} to groundweb.`
|
||||
} else if (this.$parent.$parent.$parent.$refs.editLayer !== undefined) {
|
||||
return `Upload ${this.$parent.$parent.$parent.$refs.editLayer.icao} to groundweb.`
|
||||
}
|
||||
},
|
||||
icao: {
|
||||
get: function () {
|
||||
@@ -253,7 +301,7 @@
|
||||
results: function () {
|
||||
return this.$store.state.Check.results.filter(a => a.id>=0)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
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/.
|
||||
*/
|
||||
|
||||
import Vue from 'vue'
|
||||
export const EventBus = new Vue()
|
||||
Reference in New Issue
Block a user