Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2378cd5eaa | |||
|
|
4fff310d76 | ||
|
|
09b0cba5b0 | ||
|
|
f5930e2039 | ||
|
|
cc80726ec7 | ||
|
|
b73f0bb1a1 | ||
|
|
1ac67e1e18 | ||
|
|
7a58b4bde1 | ||
|
|
ba533e8942 | ||
|
|
8b0afa9fcb | ||
|
|
8a4820d23c | ||
|
|
da597f80e4 | ||
|
|
1bd3b3b2e4 | ||
|
|
b9b6574614 | ||
|
|
089ce029ec | ||
|
|
9e7f41a5c9 | ||
|
|
60881eaf3e | ||
|
|
0f4b82807e | ||
|
|
f9d0469466 | ||
|
|
f56d8ad926 | ||
|
|
b2ddb08374 | ||
|
|
091e7853eb | ||
|
|
e52fcf9572 | ||
|
|
055897c0f6 | ||
|
|
cf2e5150e8 | ||
|
|
d8417c7fd9 | ||
|
|
ed25672448 | ||
|
|
5e0e2c9ea5 |
@@ -71,12 +71,12 @@ jobs:
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
draft: true
|
||||
name: '0.0.31'
|
||||
name: '0.0.33'
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: xBF7Jld2WbEXVg5QOxZIC/T2hlKOkajebrNi7kfE8vGVRuZG1cbHWEtBVPxggxmIWvzSyKOACSufFywx8rjgXNP3e310+dp1WuEnOBlkTr6HO3FneTue5gKoPsFB8/r8/BMPWqY50lS2Vei367eINsdNiw4wWv2bzbB6uNBlo9ILRZjbyWnUv+j8+h9gmCg2nHLmHBGhXRMLqYFEHYvq1LrV+tjMNtMBdNiRVYBjpeWI1y7TMsxpdwKvrYF84L7r9IOkjg2DHIACy4SMnIeKi6b7Lr83aK5QwksHByMETxjaNPxgvmg9hPFaRoJsvwOLdgSDU/VpEar8uweOnumt2bdqdwV2t+99A1g41KcvbUI1aATPOWhpGxW+WLBBz40hpDBBwWJ/Il4rMUHfsQ162xoO9NvlKp4IE7pgK3ydGlJx6mYzMx3QB2eKnTFySaIekrkzZPIS3GX50cMclRw6jS3fueUmtNxjIv4hNHgRqE6pQfxhQnaUkHjdP7nglYs0muJotM2Tksyw3YRlLoFzc/siktCDr8ZXxj+rlV3TeoH2vba7f4zr0tYY9vlGAUlcrkBoJ4kDeA8Hm0GnbpWHBsSY4g199jOkgbr/kJ0HDrELv/JJl1c8yp3uSlcN82UgNS15H60D+0zg3Ls4KxvqXslrPh815Se5FqKoEpvZ5VQ=
|
||||
file_glob: true
|
||||
secure: FElxoWQZKIcc9gHFY4yp1CsqvJr76BWdDrp7VsgPN7PuEoZht5Boic3fWbxKyT1fKGr8Yem6CJBXQjaqIZiWWMxuF3KYmsdOK0YRpj6WCePpl0AdZcnWDMsAGuC3ornb1CB3R6x8fx7SMMl8Ghc9/JFDUdjduvT9A0KZ1JrTZLYpP1iOq+aAW0H3byu+tNfTDvee9MzMAtjKriDz0L5z94VQ1lEmuc79qUmNvv9gIJUoNOI58QCDUuOEz2eZPooMz5cOdaupzBK130V7ki/UWbP3meXmzRKN6/iSA9iXiIrBerFtA4wG6hVvKMvKP7d7NalWAtpzOElFivlo7tp+Z1SfjSfZHmZG/PMyndVh1VPmMzX6a76qLyJFGIvOZKOkzzmVyGSVGlUHm8GCkw5wd0S3m6f1eA/YJO5c8aduC7M+qZSuEVdzaAW5xf8Fb1/rs7jELZPxuzio9i+T7vRQ1OFrCBtExQAuO9EyfaIvaVQAImvhOPiza6zkfEkF622LIQZIBL9HZ1OeKKrdWaWG98nUGWDIFXb+B4IBM1cJIPRYmaAbnWVVCBzIGxcb1pMb/zzSocu9poEWCY/CVHuOG7Xg45pghTunPS54E9qxvBx8jDIGz4s3bRwWnBI0DJ5b6aBNqMpghmpKYMCoviT+RwCIKOENlFdrPWH5pk9CmRc=wYHBe6BJtqhkjodvabd6fSX5blecd/y9sSfHV9prk7PRFxkpkp4Fw/sp086SFlunTGmTn359T1mhgr0MD/VDRXu34PEdn47Jpu8CTPfnihiK/3iRaGqW0qLqhmpd6GYc1ecm9sahxYwXgWyCtGZQbdHvrCIiS/Zm1hQtg3Q0O3eYeF+zQXrfCCTIhLLy2egID4Z23RbK620y3dqcSfbWfLzPpXr+2MYVrNZ3gukKiVauf2kBYPNzMTKEtIBfAGHiwQwlCm/fRN5NcL9bwMGmMGktJkIHgpAa2A9nnyw7EadKEKqVw4tI/j1813/FDWlJZBg89RNsZJ0QGSMQcMB0h1XkWZFPV02gqMN2z2eNXsvTJ882g8UkCBzPWYsRQGNKEx9FUFtZO9HAjOnnpAsdTcaQYTow7BiVmPBePtCFKsPyqMgJUsuz6WhUmfJ5FMbMDKn1N6ymyBYmTic5KrT3FRR3s7vFyTNdfNfwd7aNMnZSGb2uHLZyGjrC2QFK3AE/F+jP2bMu/9rcuLcp/CSLpxpN5F6RpVVfqY8X9joEUeXOSd4kO7OPBsg4lxDCqzVmER/X+MEwM57cmyutTtaREZEDTKCoEhWtcMHqLpCojPWbMsKnMh7NRARNWETe76tcwO88K2LqQFvhhILeTXKlWDpNcbGwqSinF62RXG4DxUQ=
|
||||
file_glob: true
|
||||
file: build/*
|
||||
on:
|
||||
branches: '0.0.31'
|
||||
branches: '0.0.33'
|
||||
repo: Portree-Kid/flightgear-airports
|
||||
|
||||
25
package-lock.json
generated
25
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flightgear-airports",
|
||||
"version": "0.0.30",
|
||||
"version": "0.0.33",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -12331,6 +12331,14 @@
|
||||
"resolved": "https://registry.npmjs.org/leaflet-rotatedmarker/-/leaflet-rotatedmarker-0.2.0.tgz",
|
||||
"integrity": "sha1-RGf0n5jRv9VpWb2cZwUgPdJgEnc="
|
||||
},
|
||||
"leaflet-search": {
|
||||
"version": "2.9.9",
|
||||
"resolved": "https://registry.npmjs.org/leaflet-search/-/leaflet-search-2.9.9.tgz",
|
||||
"integrity": "sha512-sGPjkMz9gQP+CKrY0G/RjQFWHdt1/KDJQiouv1dWogtN66rcE/aPR/DOduCXM3Um+VgsAmr5+jRQ0iK3Fs9I8A==",
|
||||
"requires": {
|
||||
"leaflet": "*"
|
||||
}
|
||||
},
|
||||
"leaflet-sidebar-v2": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/leaflet-sidebar-v2/-/leaflet-sidebar-v2-3.2.1.tgz",
|
||||
@@ -12341,6 +12349,21 @@
|
||||
"resolved": "https://registry.npmjs.org/leaflet-textpath/-/leaflet-textpath-1.2.0.tgz",
|
||||
"integrity": "sha512-anLGWptWb916MhEXi4WewYe08YKCawRvEXsMGj9fuYnUGd+irV3VG4UXcdW1l+Oa/TZoCTLQsg3LNwvFcroVog=="
|
||||
},
|
||||
"leaflet.pattern": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/leaflet.pattern/-/leaflet.pattern-0.1.0.tgz",
|
||||
"integrity": "sha512-E4sxvvK0XHi1EhE1yUTG1bzafXZoXUPqWPjHz5fSpv/pOcT4CtS0qR1lhFSRtSUYios8OwlZmUGB9n91zQEgcw==",
|
||||
"requires": {
|
||||
"leaflet": "~0.7.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"leaflet": {
|
||||
"version": "0.7.7",
|
||||
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-0.7.7.tgz",
|
||||
"integrity": "sha1-HjUrpU5j0HZFH6NjyQCJDLLPde4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"levn": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "flightgear-airports",
|
||||
"version": "0.0.31",
|
||||
"version": "0.0.34",
|
||||
"author": "portree_kid <keith.paterson@gmx.de>",
|
||||
"description": "An software to design Flightgear groundnets",
|
||||
"license": "GPL-3.0",
|
||||
@@ -106,8 +106,10 @@
|
||||
"leaflet": "^1.5.1",
|
||||
"leaflet-editable": "^1.2.0",
|
||||
"leaflet-polylinedecorator": "^1.6.0",
|
||||
"leaflet-search": "^2.9.9",
|
||||
"leaflet-sidebar-v2": "^3.2.1",
|
||||
"leaflet-textpath": "^1.2.0",
|
||||
"leaflet.pattern": "^0.1.0",
|
||||
"lokijs": "^1.5.8",
|
||||
"mathjs": "^6.2.5",
|
||||
"path": "^0.12.7",
|
||||
|
||||
@@ -31,7 +31,7 @@ export function checkMapper(o) {
|
||||
'box': o.box !== undefined ? o.box.getLatLngs() : null
|
||||
};
|
||||
} else if (o instanceof L.RunwayNode) {
|
||||
console.log(o)
|
||||
console.log(o)
|
||||
return { 'index': Number(o['glueindex']), '_leaflet_id': o._leaflet_id, 'lat': o._latlng.lat, 'lng': o._latlng.lng, 'type': 'runway' };
|
||||
} else if (o instanceof L.HoldNode) {
|
||||
console.log(o)
|
||||
@@ -41,6 +41,11 @@ export function checkMapper(o) {
|
||||
'type': 'runway_poly',
|
||||
'pavement': o.getLatLngs()
|
||||
}
|
||||
} else if (o instanceof L.TakeoffPolygon) {
|
||||
return {
|
||||
'type': 'takeoffpad_poly',
|
||||
'pavement': o.getLatLngs()
|
||||
}
|
||||
} else if (o instanceof L.Polyline) {
|
||||
console.log(o)
|
||||
var latLngs = o.getLatLngs().map(l => ({ lat: l.lat, lng: l.lng, index: l.glueindex }));
|
||||
@@ -56,7 +61,7 @@ export function checkMapper(o) {
|
||||
}
|
||||
|
||||
export function groMapper(o) {
|
||||
if (o instanceof L.Polygon) {
|
||||
if (o instanceof L.Polygon) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,10 @@ FG Airports is distributed in the hope that it will be useful, but WITHOUT ANY W
|
||||
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>
|
||||
<div v-for="item in traffic" v-bind:key="item.id">
|
||||
<div v-if="direction == 0">{{ item.departure.time }} {{ item.callsign }} {{ item.departure.port }} --> {{ item.arrival.port }}</div>
|
||||
<div v-if="direction == 1">{{ item.arrival.time }} {{ item.callsign }} {{ item.departure.port }} --> {{ item.arrival.port }}</div>
|
||||
|
||||
<div :key="airline.label + '-div'">
|
||||
<div v-for="item in traffic" v-bind:key="airline.label + '-' + item.id + '-innerdiv'">
|
||||
<div :key="item.id + '-dep'" v-if="direction == 0">{{ item.departure.time }} {{ item.callsign }} {{ item.departure.port }} --> {{ item.arrival.port }} {{ item['required-aircraft'] }} {{ item.flighttype }}</div>
|
||||
<div :key="item.id + '-arr'" v-if="direction == 1">{{ item.arrival.time }} {{ item.callsign }} {{ item.departure.port }} --> {{ item.arrival.port }} {{ item['required-aircraft'] }} {{ item.flighttype }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -68,12 +67,18 @@ export default {
|
||||
},
|
||||
traffic: function () {
|
||||
if (this.filename) {
|
||||
return this.trafficFile.filter(f => f.callsign).filter(f =>
|
||||
var aircraftLookup = this.trafficFile.filter(a => a['required-aircraft'])
|
||||
.reduce((req, acc) => {
|
||||
req[acc['required-aircraft']] = acc
|
||||
return req
|
||||
}, {})
|
||||
var ret = this.trafficFile.filter(f => f.callsign).filter(f =>
|
||||
(f.departure.port === this.$store.state.Airports.currentAirport.icao && this.direction === 0) ||
|
||||
(f.arrival.port === this.$store.state.Airports.currentAirport.icao && this.direction === 1)
|
||||
)
|
||||
(f.arrival.port === this.$store.state.Airports.currentAirport.icao && this.direction === 1))
|
||||
.map(obj => ({ ...obj, flighttype: aircraftLookup[obj['required-aircraft']].flighttype }))
|
||||
.filter((v, i, a) => a.findIndex(t => (t.id === v.id)) === i)
|
||||
return ret
|
||||
}
|
||||
console.debug(this.filename)
|
||||
},
|
||||
aircraft: function () {
|
||||
if (this.filename) {
|
||||
|
||||
@@ -5,24 +5,26 @@
|
||||
<div class="leaflet-sidebar-close">
|
||||
<i class="fa fa-caret-left"></i>
|
||||
</div>
|
||||
</h1>
|
||||
</h1>
|
||||
<div id="panel" width="100%">
|
||||
<el-row v-if="!results || results.length === 0 "><h3>Check not run</h3></el-row>
|
||||
<el-row v-for="(result,idx) in results" :key="idx">
|
||||
<el-col :span="2" v-if="result.id<0"><span class="label"><i class="far fa-check-circle"></i></span></el-col>
|
||||
<el-col :span="2" v-if="result.id>=0"><span class="label"><i class="fas fa-exclamation-triangle"></i></span></el-col>
|
||||
<el-col :span="2" v-if="result.id==-1"><span class="label"><i class="far fa-check-circle"></i></span></el-col>
|
||||
<el-col :span="2" v-if="result.id>=0"><span class="label"><i class="fas fa-exclamation-triangle"></i></span></el-col>
|
||||
<el-col :span="2" v-if="result.id==-2"><span class="label"><i class="fas fa-exclamation-triangle"></i></span></el-col>
|
||||
<el-col :span="15">
|
||||
<el-popover
|
||||
placement="top-start"
|
||||
title="Description"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
v-if="result.message"
|
||||
:content=result.message[1]
|
||||
>
|
||||
<span class="label" slot="reference">{{ result.message[0] }}</span>
|
||||
</el-popover>
|
||||
</el-col>
|
||||
<el-col :span="4" v-if="result.id>=0"><el-button v-on:click="show(result.id)" class="button"><i class="fas fa-bullseye"></i></el-button></el-col>
|
||||
<el-col :span="4" v-if="result.id>=0"><el-button v-on:click="show(result.id)" class="button"><i class="fas fa-bullseye"></i></el-button></el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -302,9 +302,16 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
console.log(l)
|
||||
pavement.push(l)
|
||||
})
|
||||
var features2 = pavement.map(mapper.checkMapper).filter(n => n)
|
||||
var thresholds = []
|
||||
this.$parent.$parent.$refs.thresholdLayer.getLayer().eachLayer(l => {
|
||||
console.log(l)
|
||||
thresholds.push(l)
|
||||
})
|
||||
var pavementFeatures = pavement.map(mapper.checkMapper).filter(n => n)
|
||||
//TODO
|
||||
var thresholdFeatures = thresholds.map(mapper.checkMapper).filter(n => n)
|
||||
|
||||
worker.postMessage(['check', features.concat(features2) ] )
|
||||
worker.postMessage(['check', features.concat(pavementFeatures).concat(thresholdFeatures) ] )
|
||||
this.pollData()
|
||||
// the reply
|
||||
var store = this.$store
|
||||
|
||||
@@ -110,6 +110,9 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getLayer () {
|
||||
return this.groundnetLayerGroup;
|
||||
},
|
||||
getIdLayerGroup() {
|
||||
return this.idLayerGroup;
|
||||
},
|
||||
@@ -213,6 +216,11 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
element.updateRadius(event.wingspan/2)
|
||||
});
|
||||
break;
|
||||
case 'parking-group-type':
|
||||
this.selection.forEach(element => {
|
||||
element.updateType(event.parking_type)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -224,6 +232,9 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
this.$store.commit('SET_EDIT', true)
|
||||
|
||||
this.featureLookup = [];
|
||||
if(!this.groundnetLayerGroup) {
|
||||
return;
|
||||
}
|
||||
this.groundnetLayerGroup.eachLayer(l => {
|
||||
l.enableEdit()
|
||||
l.featureLookup = this.featureLookup;
|
||||
@@ -366,9 +377,24 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
if(Number.isNaN(index)) {
|
||||
return;
|
||||
}
|
||||
if(this.featureLookup===undefined || this.featureLookup[index]===undefined) {
|
||||
console.error("Lookup " + index + " failed ");
|
||||
this.buildLookup()
|
||||
if (this.featureLookup===undefined || this.featureLookup[index]===undefined) {
|
||||
var found = false;
|
||||
this.groundnetLayerGroup.eachLayer((layer) => {
|
||||
if (layer instanceof L.Polyline && layer._leaflet_id == index) {
|
||||
layer.select();
|
||||
this.$store.dispatch('setCenter', layer.getCenter());
|
||||
found = true;
|
||||
} else {
|
||||
layer.deselect();
|
||||
}
|
||||
});
|
||||
if (found) {
|
||||
return;
|
||||
} else {
|
||||
console.error("Lookup " + index + " failed ");
|
||||
this.buildLookup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Number(this.$store.state.Editable.index) >= 0 &&
|
||||
this.featureLookup[this.$store.state.Editable.index]!==undefined) {
|
||||
@@ -380,7 +406,6 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
this.featureLookup[index].forEach((element, i) => {
|
||||
if (element instanceof L.Polyline) {
|
||||
element._latlngs.forEach((e1, index1) => {
|
||||
console.log(e1);
|
||||
if (e1.attributes.index===Number(index)) {
|
||||
var latlng = {};
|
||||
latlng.lat = e1.lat;
|
||||
|
||||
@@ -29,7 +29,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
-->
|
||||
<!--<l-marker :lat-lng="marker"></l-marker>-->
|
||||
<LeafletSidebar ref="sidebar" @editParking="onEditSidebar" @edit="onEdit($event)"></LeafletSidebar>
|
||||
<AiLayer ref="aiLayer"></AiLayer>
|
||||
<AiLayer ref="aiLayer"></AiLayer>
|
||||
<l-layer-group layerType="overlay" name="airports" ref="airportLayer">
|
||||
<l-circle
|
||||
v-for="(item, index) in this.$store.state.Airports.airports"
|
||||
@@ -42,7 +42,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
></l-circle>
|
||||
</l-layer-group>
|
||||
<EditLayer ref="editLayer"></EditLayer>
|
||||
<PavementLayer ref="pavementLayer"></PavementLayer>
|
||||
<PavementLayer ref="pavementLayer"></PavementLayer>
|
||||
<ThresholdLayer ref="thresholdLayer"></ThresholdLayer>
|
||||
<TowerLayer ref="towerLayer"></TowerLayer>
|
||||
<ToolLayer ref="toolLayer" @select-poly="onSelectedPolygon"></ToolLayer>
|
||||
@@ -53,8 +53,9 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
|
||||
<script lang="js">
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
import 'leaflet-search/dist/leaflet-search.src.css'
|
||||
import '@/assets/button.css'
|
||||
import { LMap, LTileLayer, LMarker, LCircle, LLayerGroup, LControl } from 'vue2-leaflet'
|
||||
import { LMap, LTileLayer, LMarker, LCircle, LLayerGroup, LControl, LTooltip } from 'vue2-leaflet'
|
||||
import LeafletSidebar from './LeafletSidebar'
|
||||
import AiLayer from './AiLayer'
|
||||
import EditBar from './EditBar'
|
||||
@@ -67,6 +68,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
|
||||
import { Loading } from 'element-ui'
|
||||
import L from 'leaflet'
|
||||
import { LeafletSearch } from 'leaflet-search'
|
||||
|
||||
// https://github.com/KoRiGaN/Vue2Leaflet/issues/103
|
||||
delete L.Icon.Default.prototype._getIconUrl
|
||||
@@ -77,7 +79,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
})
|
||||
export default {
|
||||
name: 'flightgear-map',
|
||||
components: { LMap, LTileLayer, LMarker, LCircle, LeafletSidebar, AiLayer, EditBar, ToolBar, EditLayer, TowerLayer, PavementLayer, LLayerGroup, LControl, ThresholdLayer, ToolLayer },
|
||||
components: { LMap, LTileLayer, LMarker, LCircle, LTooltip, LeafletSidebar, AiLayer, EditBar, ToolBar, EditLayer, TowerLayer, PavementLayer, LLayerGroup, LControl, ThresholdLayer, ToolLayer, LeafletSearch },
|
||||
props: [],
|
||||
created () {
|
||||
this.loadingInstance = null
|
||||
@@ -183,7 +185,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
loadingInstance: Object,
|
||||
groundnetLoaded: false,
|
||||
pavementLoaded: false,
|
||||
url: 'https://a.tile.openstreetmap.de/{z}/{x}/{y}.png',
|
||||
url: 'http://xjsjc.kongjian.xin:4200/tile/{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> ' +
|
||||
' <A href="https://element.eleme.io/#/en-US/" target="_blank">element.io</A> ' +
|
||||
@@ -241,6 +243,16 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
}
|
||||
this.$refs.towerLayer.zoomUpdated()
|
||||
}
|
||||
if (this.$refs.editLayer !== undefined && this.searchControl === undefined && this.$refs.editLayer.getLayer() === e.layer) {
|
||||
this.searchControl = new L.Control.Search({
|
||||
layer: this.$refs.editLayer.getLayer(),
|
||||
position: 'topleft',
|
||||
propertyName: 'searchTerm',
|
||||
marker: {animate: false},
|
||||
initial: false
|
||||
})
|
||||
this.searchControl.addTo(this.$refs.map.mapObject)
|
||||
}
|
||||
},
|
||||
onSelectedPolygon (ring) {
|
||||
var parkings = this.$refs.editLayer.getParkings(ring)
|
||||
@@ -324,6 +336,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
event.target.airport = item
|
||||
// console.log(event, item)
|
||||
this.normalStyle(event.target)
|
||||
event.target.bindTooltip(event.target.airport.properties.icao + ' ' + event.target.airport.properties.name)
|
||||
},
|
||||
onClick (event, item) {
|
||||
console.log(item)
|
||||
@@ -366,7 +379,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
},
|
||||
async centerUpdated (center) {
|
||||
if (center !== this.$store.state.Settings.center) {
|
||||
this.$store.dispatch('setCenter', center)
|
||||
this.$store.dispatch('setCenter', {lat: Number(center.lat), lng: Number(center.lng)})
|
||||
this.$refs.airportLayer.setVisible(this.zoom < 12)
|
||||
if (this.$refs.thresholdLayer) {
|
||||
this.$refs.thresholdLayer.setVisible(this.zoom >= 12)
|
||||
|
||||
@@ -177,8 +177,7 @@
|
||||
:step="0.1"
|
||||
:precision="1"
|
||||
:disabled="!editing || calculate === 'Heading'"
|
||||
@focus="headingFocussed = true"
|
||||
@blur="headingFocussed = false"
|
||||
@change="headingChange"
|
||||
></el-input-number>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
@@ -245,7 +244,24 @@
|
||||
const turfOptions = { units: 'kilometers' };
|
||||
|
||||
export default {
|
||||
mounted() {
|
||||
this.$store.watch(
|
||||
function (state) {
|
||||
return state.Editable.data.parking;
|
||||
},
|
||||
() => { this.editedParking() }
|
||||
,
|
||||
{
|
||||
deep: true //add this if u need to watch object properties change etc.
|
||||
}
|
||||
);
|
||||
},
|
||||
methods: {
|
||||
editedParking() {
|
||||
this.externalChange = true
|
||||
this.heading = Number(this.$store.state.Editable.data.parking.heading);
|
||||
this.externalChange = false
|
||||
},
|
||||
rotate() {
|
||||
var heading = this.$store.state.Editable.data.parking.heading + 90;
|
||||
while (heading>=360) {
|
||||
@@ -254,9 +270,7 @@
|
||||
while (heading<0) {
|
||||
heading += 360
|
||||
}
|
||||
this.rotateFocussed = true;
|
||||
this.headingChange(heading);
|
||||
this.rotateFocussed = false;
|
||||
},
|
||||
headingChange( newValue ) {
|
||||
while (newValue>=360) {
|
||||
@@ -265,8 +279,8 @@
|
||||
while (newValue<0) {
|
||||
newValue += 360
|
||||
}
|
||||
if ( Math.abs( ( this.$store.state.Editable.data.parking.heading - newValue ) >= 0 && Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) <= 0.1 )
|
||||
|| this.headingFocussed || this.rotateFocussed) {
|
||||
if ( ( Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) >= 0 && Math.abs( this.$store.state.Editable.data.parking.heading - newValue ) <= 0.1 )
|
||||
|| !this.externalChange) {
|
||||
if (Number(this.$store.state.Editable.data.parking.heading) !== newValue) {
|
||||
this.$store.commit('SET_EDIT_PARKING_HEADING', newValue)
|
||||
}
|
||||
@@ -331,7 +345,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
data () { return {rotateFocussed: false, headingFocussed: false, coordFocussed: false, noseCoordFocussed: false, calculateState: 'Nose Wheel', noseWheel: '', validRadii: [7.5, 10, 14, 18, 26, 33, 40], validN2M: [5, 5, 6, 10, 15, 24, 24] } },
|
||||
data () { return {rotateFocussed: false, externalChange: false, coordFocussed: false, noseCoordFocussed: false, calculateState: 'Nose Wheel', noseWheel: '', validRadii: [7.5, 10, 14, 18, 26, 33, 40], validN2M: [5, 5, 6, 10, 15, 24, 24], heading: 0 }},
|
||||
computed: {
|
||||
editing: {
|
||||
get: function () {
|
||||
@@ -451,16 +465,6 @@
|
||||
this.calcCenter();
|
||||
}
|
||||
},
|
||||
heading: {
|
||||
// getter
|
||||
get: function () {
|
||||
return this.$store.state.Editable.data.parking.heading
|
||||
},
|
||||
// setter
|
||||
set: function (newValue) {
|
||||
this.headingChange(newValue)
|
||||
}
|
||||
},
|
||||
wingspan: {
|
||||
// getter
|
||||
get: function () {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
radius: 18
|
||||
type: "gate"
|
||||
-->
|
||||
<!--
|
||||
<!--
|
||||
<el-row>
|
||||
<el-col :span="4">
|
||||
<span class="label">Name :</span>
|
||||
@@ -90,13 +90,12 @@
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<span class="label">Parking Type :</span>
|
||||
</el-col>
|
||||
<el-col :span="17">
|
||||
<el-select v-model="parking_type" placeholder="Select" :disabled="!editing">
|
||||
<el-select v-model="parking_type" @change="typeChange" placeholder="Select" :disabled="!editing">
|
||||
<el-option
|
||||
v-for="type in options"
|
||||
:key="type.value"
|
||||
@@ -107,6 +106,7 @@
|
||||
</el-select>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!--
|
||||
<el-row>
|
||||
<el-col :span="7">
|
||||
<span class="label">Airline :</span>
|
||||
@@ -128,15 +128,15 @@
|
||||
|
||||
<script lang="js">
|
||||
/* eslint-disable */
|
||||
import Vue from 'vue'
|
||||
import Vue from 'vue'
|
||||
|
||||
const convert = require('geo-coordinates-parser');
|
||||
const Coordinates = require('coordinate-parser');
|
||||
|
||||
export default {
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
data: Object, avgHeading: 5, editing: Boolean, wingspan: 0
|
||||
data: Object, avgHeading: 5, editing: Boolean, wingspan: 0, parking_type: ''
|
||||
}
|
||||
},
|
||||
|
||||
@@ -153,10 +153,11 @@ const convert = require('geo-coordinates-parser');
|
||||
},
|
||||
show (idx) {
|
||||
this.$parent.$parent.$parent.$refs.editLayer.show(idx)
|
||||
},
|
||||
},
|
||||
setData (data) {
|
||||
this.data = data;
|
||||
this.setAvgHeading();
|
||||
this.setAvgType();
|
||||
},
|
||||
setEditing(editing) {
|
||||
this.editing = editing
|
||||
@@ -164,18 +165,29 @@ const convert = require('geo-coordinates-parser');
|
||||
setAvgHeading() {
|
||||
if( this.data === null || this.data === undefined) {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
this.avgHeading = Number( this.data.reduce(function (r, parking) {
|
||||
r.sum = r.sum + parking.options.attributes.heading;
|
||||
r.avg = r.sum / ++r.count;
|
||||
return r;
|
||||
}, { sum: 0, count: 0, avg: 0 }).avg);
|
||||
},
|
||||
}, { sum: 0, count: 0, avg: 0 }).avg);
|
||||
},
|
||||
setAvgType() {
|
||||
if( this.data === null || this.data === undefined) {
|
||||
return 0
|
||||
}
|
||||
var types = this.data.map(parking => parking.options.attributes.type).filter((v, i, a) => a.indexOf(v) === i);
|
||||
if (types.length == 1) {
|
||||
this.parking_type = types[0];
|
||||
} else {
|
||||
this.parking_type = '';
|
||||
}
|
||||
},
|
||||
wingspanChange( newValue ) {
|
||||
if ( newValue ) {
|
||||
this.$emit('editParking', {type: 'parking-group-wingspan', wingspan: newValue} )
|
||||
}
|
||||
},
|
||||
},
|
||||
headingChange( newValue ) {
|
||||
while (newValue>=360) {
|
||||
newValue -= 360
|
||||
@@ -186,9 +198,14 @@ const convert = require('geo-coordinates-parser');
|
||||
if ( newValue ) {
|
||||
this.$emit('editParking', {type: 'parking-group-angle', angle: newValue} )
|
||||
}
|
||||
},
|
||||
typeChange( newValue ) {
|
||||
if ( newValue ) {
|
||||
this.$emit('editParking', {type: 'parking-group-type', parking_type: newValue} )
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
computed: {
|
||||
parking: function () {
|
||||
return this.data !== null && this.$store.state.Editable.type === 'parking-group'
|
||||
|
||||
@@ -209,7 +226,7 @@ const convert = require('geo-coordinates-parser');
|
||||
},
|
||||
airlineCodes: {
|
||||
// getter
|
||||
get: function () {
|
||||
get: function () {
|
||||
},
|
||||
// setter
|
||||
set: function (newValue) {
|
||||
@@ -271,19 +288,6 @@ const convert = require('geo-coordinates-parser');
|
||||
{value: 'mil-fighter', label: 'military fighter'},
|
||||
{value: 'mil-cargo', label: 'military cargo'}
|
||||
]
|
||||
},
|
||||
parking_type: {
|
||||
// getter
|
||||
get: function () {
|
||||
if (this.$store.state.Editable.data.parking.type === undefined) {
|
||||
return 'none'
|
||||
}
|
||||
return this.$store.state.Editable.data.parking.type
|
||||
},
|
||||
// setter
|
||||
set: function (newValue) {
|
||||
this.$store.commit('SET_EDIT_PARKING_TYPE', newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<el-link v-if="!editing" type="primary" @click="show(parking.index)">{{parking.name}} {{number}} {{parking.type}}</el-link>
|
||||
<el-link v-if="!editing" type="primary" @click="show(parking.index)">{{parking.name}} {{number}} {{parking.type}} {{type}}</el-link>
|
||||
<el-input @focus="show(parking.index)" v-if="editing" placeholder="Name" v-model="name" class="wide"></el-input>
|
||||
<el-input @focus="show(parking.index)" v-if="editing" placeholder="Number" v-model="number" class="narrow"></el-input>
|
||||
<el-select @focus="show(parking.index)" v-if="editing" v-model="parking_type" placeholder="Select">
|
||||
@@ -84,7 +84,11 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
number: {
|
||||
// getter
|
||||
get: function () {
|
||||
return this.parking.number
|
||||
if (this.parking.number && this.parking.number !== 'undefined') {
|
||||
return this.parking.number
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
// setter
|
||||
set: function (newValue) {
|
||||
@@ -103,8 +107,36 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
set: function (newValue) {
|
||||
this.$store.commit('SET_EDIT_PARKING_ITEM_TYPE', [this.parking.index, newValue])
|
||||
}
|
||||
}
|
||||
},
|
||||
type: function () {
|
||||
/**
|
||||
* Cat Models FG Radii N2M Radii
|
||||
* B Small Regionals ERJ CRJ ATR 14 6
|
||||
* C A319 A320 A321 B737 18 10
|
||||
* D B757, B767 26 15
|
||||
* E B777 B787 A330 A340 A360 33 24
|
||||
* F A380 40 24
|
||||
*/
|
||||
|
||||
switch (this.parking.radius * 2) {
|
||||
case 15:
|
||||
return 'Piper J-3 Cub/Cessna 172'
|
||||
case 20:
|
||||
return 'Beech 200/Cessna 425'
|
||||
case 28:
|
||||
return 'BOMBARDIER Regional Jet CRJ-200/DE HAVILLAND CANADA DHC-6'
|
||||
case 36:
|
||||
return 'BOEING 737-700/AIRBUS A-320/EMBRAER ERJ 190-100'
|
||||
case 52:
|
||||
return 'B767 Series/AIRBUS A-310'
|
||||
case 66:
|
||||
return 'B777 Series/B787 Series/A330 Family'
|
||||
case 80:
|
||||
return 'BOEING 747-8/AIRBUS A-380-800'
|
||||
default:
|
||||
return 'Unknown radius : ' + this.parking.radius
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
|
||||
<script lang="js">
|
||||
// import scanner from '../utils/scan'
|
||||
import fileUrl from 'file-url'
|
||||
import {Table, TableColumn} from 'element-ui'
|
||||
|
||||
const path = require('path')
|
||||
|
||||
export default {
|
||||
name: 'search',
|
||||
components: { [Table.name]: Table,
|
||||
@@ -46,82 +43,6 @@
|
||||
formatter (row, column) {
|
||||
console.log('Row ' + row)
|
||||
return row
|
||||
},
|
||||
scanAPT () {
|
||||
try {
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080/src/renderer/utils/worker.js`
|
||||
: `file://${__dirname}/worker.js`
|
||||
console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
|
||||
|
||||
const worker = new Worker(winURL)
|
||||
console.log(fileUrl('src/renderer/utils/worker.js'))
|
||||
|
||||
// var worker = new Worker(fileUrl('src/renderer/utils/worker.js'))
|
||||
worker.postMessage(['scanapt'])
|
||||
// the reply
|
||||
var store = this.$store
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'DONE') {
|
||||
console.log('DONE')
|
||||
store.dispatch('getAirports')
|
||||
worker.terminate()
|
||||
}
|
||||
console.log(e.data)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
},
|
||||
scanGroundnets () {
|
||||
try {
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080/src/renderer/utils/worker.js`
|
||||
: `file://${__dirname}/worker.js`
|
||||
console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
|
||||
|
||||
const worker = new Worker(winURL)
|
||||
console.log(fileUrl('src/renderer/utils/worker.js'))
|
||||
|
||||
worker.postMessage(['scan', this.$store.state.Settings.settings.airportsDirectory])
|
||||
// the reply
|
||||
var store = this.$store
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'DONE') {
|
||||
console.log('DONE')
|
||||
store.dispatch('getAirports')
|
||||
worker.terminate()
|
||||
}
|
||||
console.log(e.data)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
},
|
||||
scanTraffic () {
|
||||
// let flightgearDirectory = this.$store.state.settings.flightgearDirectory
|
||||
try {
|
||||
const winURL = process.env.NODE_ENV === 'development'
|
||||
? `http://localhost:9080/src/renderer/utils/worker.js`
|
||||
: `file://${__dirname}/worker.js`
|
||||
console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
|
||||
|
||||
const worker = new Worker(winURL)
|
||||
console.log(fileUrl('src/renderer/utils/worker.js'))
|
||||
worker.postMessage(['scanai', this.$store.state.Settings.settings.flightgearDirectory])
|
||||
// the reply
|
||||
var store = this.$store
|
||||
worker.onmessage = function (e) {
|
||||
if (e.data === 'DONE') {
|
||||
console.log('DONE')
|
||||
store.dispatch('getAirports')
|
||||
worker.terminate()
|
||||
}
|
||||
console.log(e.data)
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -136,12 +57,14 @@
|
||||
.filter(a => searchRegex.test(a.properties.icao) || searchRegex.test(a.properties.name))
|
||||
// .map(a => console.log(a.properties))
|
||||
.map(a => ({ icao: a.properties.icao, name: a.properties.name }))
|
||||
let icaoResult = result.filter(a => a.icao === this.searchterm)
|
||||
.filter((v, i, a) => a.findIndex(t => (t.icao === v.icao)) === i)
|
||||
let icaoResult = result.filter(a => a.icao === this.searchterm).filter((v, i, a) => a.findIndex(t => (t.icao === v.icao)) === i)
|
||||
if (result !== undefined &&
|
||||
icaoResult.length === 0 &&
|
||||
this.searchterm !== undefined &&
|
||||
this.searchterm.length >= 3 &&
|
||||
this.searchterm.length <= 4) {
|
||||
// Not found so it might have been excluded due to no traffic
|
||||
this.$store.dispatch('getAirport', this.searchterm)
|
||||
}
|
||||
this.lastResult = result
|
||||
|
||||
@@ -219,13 +219,25 @@
|
||||
name: 'settings-panel',
|
||||
components: { DirectorySelect, FileSelect },
|
||||
props: [],
|
||||
mounted () {
|
||||
},
|
||||
|
||||
data () {
|
||||
return { ok: true, activeName: '0' }
|
||||
return { ok: true, activeName: '0', scanStoreLogging: false }
|
||||
},
|
||||
mounted () {
|
||||
this.$store.watch(
|
||||
function (state) {
|
||||
return state.Settings.settings
|
||||
},
|
||||
() => { this.loggingChanged() }
|
||||
,
|
||||
{
|
||||
deep: true // add this if u need to watch object properties change etc.
|
||||
}
|
||||
)
|
||||
},
|
||||
methods: {
|
||||
loggingChanged () {
|
||||
this.scanStoreLogging = this.$store.state.Settings.settings.scanLogging === 1
|
||||
},
|
||||
flightgearDirectorySelect: function (flightgearDirectory) {
|
||||
console.log(flightgearDirectory)
|
||||
this.$store.commit('FLIGHTGEAR_DIRECTORY', flightgearDirectory)
|
||||
@@ -344,7 +356,7 @@
|
||||
scanLogging: {
|
||||
// getter
|
||||
get: function () {
|
||||
return this.$store.state.Settings.settings.scanLogging === 1
|
||||
return this.scanStoreLogging
|
||||
},
|
||||
// setter
|
||||
set: function (newValue) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<script lang="js">
|
||||
import { LMap, LMarker } from 'vue2-leaflet'
|
||||
import L from 'leaflet'
|
||||
import leafletPattern from 'leaflet.pattern'
|
||||
import LEdit from 'leaflet-editable/src/Leaflet.Editable.js'
|
||||
import {readThresholdXML} from '../loaders/threshold_loader'
|
||||
import {writeThresholdXML} from '../loaders/threshold_writer'
|
||||
@@ -13,7 +14,7 @@
|
||||
created () {
|
||||
},
|
||||
mounted () {
|
||||
console.debug(LMap, LMarker, L, LEdit)
|
||||
console.debug(LMap, LMarker, L, LEdit, leafletPattern)
|
||||
this.$store.watch(
|
||||
function (state) {
|
||||
return state.Editable.data.threshold
|
||||
@@ -24,6 +25,8 @@
|
||||
deep: true
|
||||
}
|
||||
)
|
||||
var stripes = new L.StripePattern({color: 'yellow'})
|
||||
stripes.addTo(this.$parent.mapObject)
|
||||
},
|
||||
beforeDestroy () {
|
||||
this.remove()
|
||||
@@ -55,8 +58,11 @@
|
||||
if (this.layerGroup) {
|
||||
this.layerGroup.removeFrom(this.$parent.mapObject)
|
||||
}
|
||||
var stripes = new L.StripePattern({color: 'yellow'})
|
||||
stripes.addTo(this.$parent.mapObject)
|
||||
|
||||
// Callback for add
|
||||
this.layerGroup = readThresholdXML(this.$store.state.Settings.settings.airportsDirectory, icao, this.read)
|
||||
this.layerGroup = readThresholdXML(this.$store.state.Settings.settings.airportsDirectory, icao, this.read, stripes)
|
||||
if (!this.layerGroup) {
|
||||
console.warn('Threshold for ICAO not loaded ' + icao)
|
||||
return
|
||||
|
||||
@@ -81,7 +81,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
airlineCodes.push({value: element, label: element})
|
||||
})
|
||||
}
|
||||
return airlineCodes
|
||||
return airlineCodes.filter((v, i, a) => a.indexOf(v) === i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
<span class="center">E-Mail : {{this.$store.state.Settings.settings.email}}</span><br/>
|
||||
<span class="center"><el-checkbox v-model="gplv2" class="center">I agree to release the groundnet under GPL v2</el-checkbox></span><br/>
|
||||
<span :class="textClass" v-if="message">{{message}}</span><br/>
|
||||
|
||||
|
||||
<el-button @click="handleOkClicked('twr')" :disabled="!tower_comittable" >Upload Tower</el-button>
|
||||
<el-button @click="handleOkClicked('groundnet')" :disabled="!groundnet_comittable" >Upload Groundnet</el-button>
|
||||
<el-button @click="handleOkClicked('threshold')" :disabled="!threshold_comittable" >Upload Threshold</el-button>
|
||||
@@ -47,8 +47,8 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
function (state) {
|
||||
return state.Loading.groundnetLoaded;
|
||||
},
|
||||
() => { if(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded &&
|
||||
() => { if(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded &&
|
||||
this.visible) this.check() }
|
||||
,
|
||||
{
|
||||
@@ -59,8 +59,8 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
function (state) {
|
||||
return state.Loading.pavementLoaded;
|
||||
},
|
||||
() => { if(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded &&
|
||||
() => { if(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded &&
|
||||
this.visible) this.check() }
|
||||
,
|
||||
{
|
||||
@@ -76,13 +76,17 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
},
|
||||
methods: {
|
||||
reqListener(e) {
|
||||
if(JSON.parse(e.srcElement.response).status==='OK') {
|
||||
this.message = null;
|
||||
this.azure = true;
|
||||
this.error = false;
|
||||
} else {
|
||||
this.message = 'Azure down';
|
||||
}
|
||||
try {
|
||||
if(JSON.parse(e.srcElement.response).status==='OK') {
|
||||
this.message = null;
|
||||
this.azure = true;
|
||||
this.error = false;
|
||||
} else {
|
||||
this.message = 'Azure down';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
},
|
||||
status () {
|
||||
@@ -96,15 +100,15 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
if (xhr.status !== 200){
|
||||
parent.$refs.upload.message = 'Azure down';
|
||||
parent.$refs.upload.error = true;
|
||||
console.error(xhr);
|
||||
console.error(xhr);
|
||||
}
|
||||
}
|
||||
xhr.addEventListener("load", this.reqListener);
|
||||
xhr.addEventListener("load", this.reqListener);
|
||||
try {
|
||||
xhr.send();
|
||||
xhr.send();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
this.error = true;
|
||||
this.error = true;
|
||||
}
|
||||
},
|
||||
closeClicked () {
|
||||
@@ -113,10 +117,10 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
},
|
||||
handleOkClicked (type) {
|
||||
this.uploading = true;
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
this.icao + `.${type}.new.xml`);
|
||||
|
||||
if (f == null || !fs.existsSync(f)) {
|
||||
@@ -136,7 +140,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
formData.append("gpl", this.gplv2 )
|
||||
formData.append("user_email", this.$store.state.Settings.settings.email)
|
||||
formData.append('groundnet', blob, this.icao + `.${type}.xml`);
|
||||
|
||||
|
||||
var parent = this.$parent;
|
||||
var messageField = this.message;
|
||||
// action after uploading happens
|
||||
@@ -144,7 +148,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
if (xhr.status !== 200){
|
||||
parent.$refs.upload.message = 'Upload Error'
|
||||
parent.$refs.upload.error = true;
|
||||
console.error(xhr);
|
||||
console.error(xhr);
|
||||
}
|
||||
}
|
||||
xhr.onload = function(e) {
|
||||
@@ -157,7 +161,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
parent.$refs.upload.success = true
|
||||
parent.$refs.upload.message = `${type} Uploaded Successfully`
|
||||
parent.$store.commit('UPLOAD_WIP', parent.$store.state.Airports.currentAirport.icao)
|
||||
|
||||
|
||||
} else if(JSON.parse(e.srcElement.response).message === 'XML Errors') {
|
||||
var response = JSON.parse(e.srcElement.response);
|
||||
if (response.validationErrors) {
|
||||
@@ -169,7 +173,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
} else if(JSON.parse(e.srcElement.response) !== undefined) {
|
||||
var response = JSON.parse(e.srcElement.response);
|
||||
parent.$refs.upload.message = response.err;
|
||||
} else {
|
||||
} else {
|
||||
parent.$refs.upload.message = response.message;
|
||||
}
|
||||
};
|
||||
@@ -177,7 +181,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
|
||||
// do the uploading
|
||||
console.log("File uploading started!");
|
||||
xhr.send(formData);
|
||||
xhr.send(formData);
|
||||
},
|
||||
pollData () {
|
||||
var workery = this.worker
|
||||
@@ -193,7 +197,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
},
|
||||
check () {
|
||||
try {
|
||||
if(!(this.$store.state.Loading.groundnetLoaded &&
|
||||
if(!(this.$store.state.Loading.groundnetLoaded &&
|
||||
this.$store.state.Loading.pavementLoaded)) {
|
||||
return
|
||||
}
|
||||
@@ -236,7 +240,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
console.log(l)
|
||||
pavement.push(l)
|
||||
})
|
||||
var features2 = pavement.map(mapper.checkMapper).filter(n => n)
|
||||
var features2 = pavement.map(mapper.checkMapper).filter(n => n)
|
||||
|
||||
worker.postMessage(['check', features.concat(features2) ] )
|
||||
this.pollData()
|
||||
@@ -251,7 +255,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
worker.terminate()
|
||||
worker.view.max = 0
|
||||
worker.view.checkDialogVisible = false
|
||||
clearInterval(this.polling)
|
||||
clearInterval(this.polling)
|
||||
this.checking = false
|
||||
} else if (e.data.length > 0) {
|
||||
if (e.data[0] === 'max') {
|
||||
@@ -275,7 +279,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
return parent.$refs.editLayer;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
pavementLayer () {
|
||||
var parent = this.$parent;
|
||||
while (!parent.icao||parent.$refs.pavementLayer==undefined) {
|
||||
@@ -284,7 +288,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
return parent.$refs.pavementLayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
@@ -300,7 +304,7 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
textClass: function () {
|
||||
return !this.error?'centermessage':'error'
|
||||
},
|
||||
title: function () {
|
||||
title: function () {
|
||||
return `Upload ${this.icao} to groundweb.`
|
||||
},
|
||||
icao: {
|
||||
@@ -319,26 +323,26 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
}
|
||||
},
|
||||
tower_comittable: function () {
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
this.icao + '.twr.new.xml');
|
||||
return fs.existsSync(f) && this.gplv2 && this.max === 0 && this.azure && !this.uploading;
|
||||
},
|
||||
groundnet_comittable: function () {
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
this.icao + '.groundnet.new.xml');
|
||||
return fs.existsSync(f) && this.$store.state.Check.results.filter(a => a.id>=0).length === 0 && this.gplv2 && this.max === 0 && this.azure && !this.uploading
|
||||
},
|
||||
threshold_comittable: function () {
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
var f = path.join(this.$store.state.Settings.settings.airportsDirectory,
|
||||
this.icao[0],
|
||||
this.icao[1],
|
||||
this.icao[2],
|
||||
this.icao + '.threshold.new.xml');
|
||||
return fs.existsSync(f) && this.gplv2 && this.max === 0 && this.azure && !this.uploading
|
||||
},
|
||||
@@ -354,8 +358,8 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-dialog__body {padding: 10px;}
|
||||
.center { text-align: center; vertical-align: middle; padding: 5px; font-size: 12pt; font-weight: normal}
|
||||
.centermessage { text-align: left; vertical-align: middle; padding: 5px; font-size: 12pt; font-weight: normal; white-space: pre-line;}
|
||||
.center { text-align: center; vertical-align: middle; padding: 5px; font-size: 12pt; font-weight: normal}
|
||||
.centermessage { text-align: left; vertical-align: middle; padding: 5px; font-size: 12pt; font-weight: normal; white-space: pre-line;}
|
||||
.error { text-align: center; color: red; padding: 5px; font-size: 12pt; font-weight: normal;}
|
||||
.el-dialog--center .el-dialog__body { padding: 5px;}
|
||||
</style>
|
||||
|
||||
41
src/renderer/leaflet/TakeoffPad.js
Normal file
41
src/renderer/leaflet/TakeoffPad.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2021 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/.
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
const turf = require('@turf/turf')
|
||||
|
||||
L.TakeoffPolygon = L.Polygon.extend({
|
||||
turfyRunway: [],
|
||||
|
||||
setTurfy: function (padPoints) {
|
||||
var latLngs = padPoints.map(this.turfToLatLng);
|
||||
latLngs.push(latLngs[0]);
|
||||
this.turfyRunway = turf.polygon([latLngs]);
|
||||
},
|
||||
|
||||
turfToLatLng: function (turfPoint) {
|
||||
return [turfPoint.lng, turfPoint.lat];
|
||||
}
|
||||
});
|
||||
|
||||
var takeoffPadPoly = function (padPoints) {
|
||||
var takeoffPadPoly = new L.TakeoffPolygon(padPoints);
|
||||
takeoffPadPoly.setStyle({ color: 'black', fillColor: '', opacity: 1.0, fillOpacity: 0.0, interactive: false });
|
||||
takeoffPadPoly.setTurfy(padPoints);
|
||||
console.debug(padPoints);
|
||||
return takeoffPadPoly;
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = takeoffPadPoly;
|
||||
@@ -11,7 +11,7 @@ L.HoldNode = L.Marker.extend({
|
||||
if(this._icon!==null) {
|
||||
this._icon.childNodes[0].style['background-color'] = 'red';
|
||||
}
|
||||
},
|
||||
},
|
||||
deselect() {
|
||||
if(this._icon!==null) {
|
||||
this._icon.childNodes[0].style['background-color'] = '#4838cc';
|
||||
@@ -31,7 +31,7 @@ L.HoldNode = L.Marker.extend({
|
||||
this.featureLookup[this.glueindex].push(this);
|
||||
},
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
follow(dragIndex, event) {
|
||||
@@ -61,18 +61,18 @@ L.HoldNode = L.Marker.extend({
|
||||
element.updateEndVertex(event.latlng);
|
||||
element.updateMiddle();
|
||||
}
|
||||
} else if (element instanceof L.Editable.VertexMarker) {
|
||||
} else if (element instanceof L.Editable.VertexMarker) {
|
||||
console.log(element);
|
||||
element.setLatLng(event.latlng);
|
||||
element.latlngs.forEach((latlng, index) => {
|
||||
console.log(latlng);
|
||||
console.log(latlng);
|
||||
if(latlng.__vertex === element) {
|
||||
latlng.update(event.latlng);
|
||||
}
|
||||
});
|
||||
element.editor.feature.setLatLngs(element.latlngs);
|
||||
element.editor.feature.updateMiddle();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -80,7 +80,7 @@ L.HoldNode = L.Marker.extend({
|
||||
|
||||
var holdNode = function (n, layerGroup) {
|
||||
//console.log(n.attr('lat') + " " + n.attr('lon'));
|
||||
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
|
||||
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
|
||||
var fa_icon = null;
|
||||
if (n.attr('holdPointType') === 'PushBack') {
|
||||
fa_icon = "<div style='background-color:#4838cc;' class='marker-pin'></div><i class='fas fa-arrows-alt-h'></i>";
|
||||
@@ -93,8 +93,9 @@ var holdNode = function (n, layerGroup) {
|
||||
iconSize: [30, 42],
|
||||
iconAnchor: [15, 42]
|
||||
});
|
||||
const node = new L.HoldNode([latlon.decimalLatitude, latlon.decimalLongitude], { icon: icon });
|
||||
const node = new L.HoldNode([latlon.decimalLatitude, latlon.decimalLongitude], { icon: icon });
|
||||
node.glueindex = n.attr('index');
|
||||
node.feature = { properties: { searchTerm: n.attr('index')}};
|
||||
node.holdPointType = n.attr('holdPointType');
|
||||
node.addTo(layerGroup);
|
||||
node.addListeners();
|
||||
|
||||
@@ -96,6 +96,10 @@ L.ParkingSpot = L.Circle.extend({
|
||||
this.updateWheelPos();
|
||||
this.updateBox();
|
||||
},
|
||||
updateType(type) {
|
||||
this.options.attributes.type = type;
|
||||
this.deselect();
|
||||
},
|
||||
// Update the direction vertex from the direction
|
||||
updateVertexFromDirection() {
|
||||
if (this.editEnabled()) {
|
||||
@@ -233,7 +237,19 @@ L.ParkingSpot = L.Circle.extend({
|
||||
},
|
||||
deselect() {
|
||||
var style = {};
|
||||
style['color'] = '#3388ff';
|
||||
if(this.options.attributes.type == 'ga') {
|
||||
style['color'] = 'green';
|
||||
} else if(this.options.attributes.type == 'cargo') {
|
||||
style['color'] = 'yellow';
|
||||
} else if(this.options.attributes.type == 'gate') {
|
||||
style['color'] = '#3388ff';
|
||||
} else if(this.options.attributes.type == 'mil-fighter') {
|
||||
style['color'] = 'red';
|
||||
} else if(this.options.attributes.type == 'mil-cargo') {
|
||||
style['color'] = 'DarkRed';
|
||||
} else {
|
||||
style['color'] = '#3388ff';
|
||||
}
|
||||
this.setStyle(style);
|
||||
if(this.direction) {
|
||||
this.direction.setStyle(style);
|
||||
@@ -247,17 +263,17 @@ L.ParkingSpot = L.Circle.extend({
|
||||
},
|
||||
setInteractive(interactive) {
|
||||
if (interactive) {
|
||||
if(this.direction) {
|
||||
if(this.direction&&this.direction._path) {
|
||||
L.DomUtil.addClass(this.direction._path, 'leaflet-interactive');
|
||||
}
|
||||
if(this.box) {
|
||||
if(this.box&&this.box._path) {
|
||||
L.DomUtil.addClass(this.box._path, 'leaflet-interactive');
|
||||
}
|
||||
} else {
|
||||
if(this.direction) {
|
||||
if(this.direction&&this.direction._path) {
|
||||
L.DomUtil.removeClass(this.direction._path, 'leaflet-interactive');
|
||||
}
|
||||
if(this.box) {
|
||||
if(this.box&&this.box._path) {
|
||||
L.DomUtil.removeClass(this.box._path, 'leaflet-interactive');
|
||||
}
|
||||
}
|
||||
@@ -436,12 +452,14 @@ var parkingSpot = function (n, layerGroup) {
|
||||
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
|
||||
//console.log(latlon.decimalLatitude);
|
||||
//console.log(convert(n.attr('lat') + " " + n.attr('lon')).decimalLongitude);
|
||||
const circle = new L.ParkingSpot([latlon.decimalLatitude, latlon.decimalLongitude], { radius: n.attr('radius'), attributes: {} });
|
||||
circle.on('editable:enable', function (event) {
|
||||
const parking = new L.ParkingSpot([latlon.decimalLatitude, latlon.decimalLongitude], { radius: n.attr('radius'), attributes: {} });
|
||||
parking.on('editable:enable', function (event) {
|
||||
// event.target.createDirection();
|
||||
});
|
||||
circle.id = n.attr('index');
|
||||
circle.glueindex = n.attr('index');
|
||||
parking.id = n.attr('index');
|
||||
parking.glueindex = n.attr('index');
|
||||
parking.feature = { properties: { searchTerm: n.attr('index') + ' ' + n.attr('name')}};
|
||||
|
||||
/*
|
||||
<Parking index="2"
|
||||
type="gate"
|
||||
@@ -457,17 +475,18 @@ airlineCodes="VIR,KAL,DAL,KLM" />
|
||||
//circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) };
|
||||
|
||||
$.each( n.attrs, function( key, value ) {
|
||||
console.debug( '$', circle.id, key , value);
|
||||
console.debug( '$', parking.id, key , value);
|
||||
|
||||
if(isNaN(value))
|
||||
circle.options.attributes[ key ] = value;
|
||||
parking.options.attributes[ key ] = value;
|
||||
else
|
||||
circle.options.attributes[ key ] = Number( value);
|
||||
parking.options.attributes[ key ] = Number( value);
|
||||
});
|
||||
circle.addListeners();
|
||||
parking.addListeners();
|
||||
|
||||
circle.addTo(layerGroup);
|
||||
return circle;
|
||||
parking.addTo(layerGroup);
|
||||
parking.deselect();
|
||||
return parking;
|
||||
}
|
||||
|
||||
module.exports = parkingSpot;
|
||||
@@ -43,18 +43,18 @@ L.RunwayNode = L.Marker.extend({
|
||||
},
|
||||
select() {
|
||||
try {
|
||||
this._icon.style['color'] = 'red';
|
||||
this._icon.style['color'] = 'red';
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
deselect() {
|
||||
try {
|
||||
this._icon.style['color'] = 'black';
|
||||
this._icon.style['color'] = 'black';
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
extensions: function (editLayer) {
|
||||
this.options.attributes = {};
|
||||
if (typeof this.featureLookup[this.glueindex] === 'undefined') {
|
||||
@@ -63,7 +63,7 @@ L.RunwayNode = L.Marker.extend({
|
||||
this.featureLookup[this.glueindex].push(this);
|
||||
},
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
follow(dragIndex, event) {
|
||||
@@ -93,18 +93,18 @@ L.RunwayNode = L.Marker.extend({
|
||||
element.updateEndVertex(event.latlng);
|
||||
element.updateMiddle();
|
||||
}
|
||||
} else if (element instanceof L.Editable.VertexMarker) {
|
||||
} else if (element instanceof L.Editable.VertexMarker) {
|
||||
console.log(element);
|
||||
element.setLatLng(event.latlng);
|
||||
element.latlngs.forEach((latlng, index) => {
|
||||
console.log(latlng);
|
||||
console.log(latlng);
|
||||
if(latlng.__vertex === element) {
|
||||
latlng.update(event.latlng);
|
||||
}
|
||||
});
|
||||
element.editor.feature.setLatLngs(element.latlngs);
|
||||
element.editor.feature.updateMiddle();
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -120,7 +120,9 @@ var runwayNode = function (n, layerGroup) {
|
||||
});
|
||||
var node = new L.RunwayNode([latlon.decimalLatitude, latlon.decimalLongitude], { icon: icon, attributes: {} });
|
||||
node.glueindex = n.attr('index');
|
||||
$.each( n.attrs, function( key, value ) {
|
||||
node.feature = n.attr('index');
|
||||
|
||||
$.each( n.attrs, function( key, value ) {
|
||||
if(isNaN(value))
|
||||
node.options.attributes[ key ] = value;
|
||||
else
|
||||
|
||||
@@ -10,6 +10,7 @@ const extendTaxiSegment = function (taxiwaySegment) {
|
||||
taxiwaySegment.__proto__.begin;
|
||||
taxiwaySegment.__proto__.end;
|
||||
taxiwaySegment.__proto__.bidirectional;
|
||||
|
||||
taxiwaySegment.__proto__.updateBeginVertex = function (latlng) {
|
||||
if (this._latlngs[0].__vertex) {
|
||||
this._latlngs[0].__vertex.setLatLng(latlng);
|
||||
@@ -244,6 +245,8 @@ const extendTaxiSegment = function (taxiwaySegment) {
|
||||
polyline.editor.refresh();
|
||||
//polyline.editor.reset();
|
||||
polyline.featureLookup = this.featureLookup;
|
||||
polyline.feature = { properties: {searchTerm: 'Arc ' + nextIndex + '-' + taxiwaySegment.end}};
|
||||
|
||||
polyline.options.attributes.name = taxiwaySegment.options.attributes.name;
|
||||
polyline.options.attributes.direction = taxiwaySegment.options.attributes.direction;
|
||||
polyline.options.attributes.isPushBackRoute = taxiwaySegment.options.attributes.isPushBackRoute;
|
||||
|
||||
@@ -234,6 +234,8 @@ exports.readGroundnetXML = function (fDir, icao, f) {
|
||||
|
||||
polyline.begin = beginNode.attr('index');
|
||||
polyline.end = endNode.attr('index');
|
||||
polyline.feature = { properties: { searchTerm: 'Arc ' + beginNode.attr('index') + '-' + endNode.attr('index')}};
|
||||
|
||||
// polyline.enableEdit();
|
||||
|
||||
// polyline.on('dblclick', function (event) { L.DomEvent.stop; polyline.toggleEdit; });
|
||||
|
||||
@@ -14,13 +14,13 @@ const mathjs = require('mathjs');
|
||||
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var featureLookup = [];
|
||||
var featureLookup = [];
|
||||
var parkings = [];
|
||||
var pushBackNodeLookup = [];
|
||||
|
||||
/**
|
||||
* Walk nodes until the pushback node is found.
|
||||
* @param {*} index
|
||||
* Walk nodes until the pushback node is found.
|
||||
* @param {*} index
|
||||
*/
|
||||
|
||||
function findRouteToPushback (index) {
|
||||
@@ -58,10 +58,10 @@ function walkPushbackRoute (index, walkedNodes, pushBackNodes) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} fDir The directory
|
||||
* @param {*} icao
|
||||
* @param {*} featureList
|
||||
*
|
||||
* @param {*} fDir The directory
|
||||
* @param {*} icao
|
||||
* @param {*} featureList
|
||||
*/
|
||||
|
||||
exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
@@ -73,13 +73,13 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
|
||||
var fileNames = [];
|
||||
for (let index = 1; index <= store.default.state.Settings.settings.numberOfSaves; index++) {
|
||||
fileNames.push(path.join(fDir, icao[0], icao[1], icao[2], icao + `.groundnet.bak.${index}.xml`));
|
||||
fileNames.push(path.join(fDir, icao[0], icao[1], icao[2], icao + `.groundnet.bak.${index}.xml`));
|
||||
}
|
||||
var f = path.join(fDir, icao[0], icao[1], icao[2], icao + '.groundnet.new.xml');
|
||||
|
||||
if( fs.existsSync(f) ) {
|
||||
var previous = '';
|
||||
fileNames.reverse().forEach(fBak => {
|
||||
fileNames.reverse().forEach(fBak => {
|
||||
if (fs.existsSync(fBak) && previous !== '') {
|
||||
console.debug( `Copy ${fBak} to ${previous}`);
|
||||
fs.copyFileSync(fBak, previous);
|
||||
@@ -90,7 +90,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
}
|
||||
if (f == null)
|
||||
return;
|
||||
pushBackNodeLookup = [];
|
||||
pushBackNodeLookup = [];
|
||||
|
||||
console.debug(featureList);
|
||||
|
||||
@@ -98,19 +98,19 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
var runwayNodes = featureList.map(mapRunwayNodes).filter(n => n);
|
||||
var holdNodes = featureList.map(mapHoldPoint).filter(n => n);
|
||||
|
||||
|
||||
|
||||
holdNodes.forEach(n => {
|
||||
pushBackNodeLookup[n['@index']] = n;
|
||||
});
|
||||
|
||||
|
||||
var nodes = [];
|
||||
var arcList = [];
|
||||
var frequencies = [];
|
||||
|
||||
var version = new Date().toUTCString() + ' by FlightgearAirports ' + require('electron').remote.app.getVersion();
|
||||
var name = store.default.state.Settings.settings.name;
|
||||
var name = store.default.state.Settings.settings.name;
|
||||
|
||||
featureLookup = [];
|
||||
featureLookup = [];
|
||||
// Loaded segments
|
||||
featureList.filter(o => o instanceof L.TaxiwaySegment).filter(n => n).forEach(element => {
|
||||
var begin = mapBeginNode(element);
|
||||
@@ -122,9 +122,9 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
console.warn("End missing");
|
||||
nodes[end['@index']] = end;
|
||||
});
|
||||
// New segments
|
||||
// New segments
|
||||
featureList.filter(o => o instanceof L.Polyline).filter(n => n).forEach(arcElement => {
|
||||
// element._latlngs.forEach(latlng => { nodes[latlng.glueindex] = mapVertexNode(latlng) });
|
||||
// element._latlngs.forEach(latlng => { nodes[latlng.glueindex] = mapVertexNode(latlng) });
|
||||
var startIndex = -1;
|
||||
console.debug(arcElement.options.attributes);
|
||||
var currentArc = arcElement.options.attributes;
|
||||
@@ -142,7 +142,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
arc = { '@begin': startIndex, '@end': String(latlng.glueindex) };
|
||||
styleArc(currentArc, arc);
|
||||
arcList.push(arc);
|
||||
featureLookup[startIndex][latlng.glueindex] = arc;
|
||||
featureLookup[startIndex][latlng.glueindex] = arc;
|
||||
}
|
||||
if( currentArc.direction === 'bi-directional' || currentArc.direction === 'backward' ){
|
||||
arc = { '@begin': String(latlng.glueindex), '@end': startIndex };
|
||||
@@ -151,7 +151,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
featureLookup[latlng.glueindex][startIndex] = arc;
|
||||
}
|
||||
if (currentArc.direction === '' || !currentArc.direction) {
|
||||
console.error( "Arc without direction " + util.inspect(currentArc) );
|
||||
console.error( "Arc without direction " + util.inspect(currentArc) );
|
||||
}
|
||||
}
|
||||
startIndex = latlng.glueindex;
|
||||
@@ -162,12 +162,12 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
});
|
||||
runwayNodes.forEach(element => {
|
||||
if (nodes[element['@index']] != undefined) {
|
||||
nodes[element['@index']]['@isOnRunway'] = "1";
|
||||
nodes[element['@index']]['@isOnRunway'] = "1";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Find the index of the pushback node
|
||||
// Find the index of the pushback node
|
||||
parkings.forEach(n => {
|
||||
nodes[n['@index']] = null;
|
||||
var pushBackNode = findRouteToPushback(Number(n['@index']))[0];
|
||||
@@ -207,7 +207,7 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
var allIds = parkings.map(n => Number(n['@index']))
|
||||
.concat(uniqueNodes.map(n => Number(n['@index'])))
|
||||
.sort((a, b) => a - b);
|
||||
|
||||
|
||||
allIds.forEach((element, index, array) => {
|
||||
if (index > 0 && array[index-1] + 1 != element && gapStart == -1 ) {
|
||||
gapStart = array[index-1];
|
||||
@@ -215,34 +215,36 @@ exports.writeGroundnetXML = function (fDir, icao, featureList) {
|
||||
}
|
||||
});
|
||||
var gap = gapEnd - gapStart -1;
|
||||
|
||||
parkings = parkings.map(n => {
|
||||
if (n['@index']>gapStart) {
|
||||
n['@index'] = String(n['@index'] - gap);
|
||||
}
|
||||
if (n['@pushbackRoute']>gapStart) {
|
||||
n['@pushbackRoute'] = String(n['@pushbackRoute'] - gap);
|
||||
}
|
||||
return n;
|
||||
});
|
||||
uniqueNodes = uniqueNodes.map(n => {
|
||||
if (n['@index']>gapStart) {
|
||||
n['@index'] = String(n['@index'] - gap);
|
||||
}
|
||||
return n;
|
||||
});
|
||||
arcList = arcList.map(n => {
|
||||
if (n['@begin']>gapStart) {
|
||||
n['@begin'] = String(n['@begin'] - gap);
|
||||
}
|
||||
if (n['@end']>gapStart) {
|
||||
n['@end'] = String(n['@end'] - gap);
|
||||
}
|
||||
return n;
|
||||
});
|
||||
if ( gap >= 0 ) {
|
||||
parkings = parkings.map(n => {
|
||||
if (n['@index']>gapStart) {
|
||||
n['@index'] = String(n['@index'] - gap);
|
||||
}
|
||||
if (n['@pushbackRoute']>gapStart) {
|
||||
n['@pushbackRoute'] = String(n['@pushbackRoute'] - gap);
|
||||
}
|
||||
return n;
|
||||
});
|
||||
uniqueNodes = uniqueNodes.map(n => {
|
||||
if (n['@index']>gapStart) {
|
||||
n['@index'] = String(n['@index'] - gap);
|
||||
}
|
||||
return n;
|
||||
});
|
||||
arcList = arcList.map(n => {
|
||||
if (n['@begin']>gapStart) {
|
||||
n['@begin'] = String(n['@begin'] - gap);
|
||||
}
|
||||
if (n['@end']>gapStart) {
|
||||
n['@end'] = String(n['@end'] - gap);
|
||||
}
|
||||
return n;
|
||||
});
|
||||
}
|
||||
|
||||
} while( gapStart > 0 && gapEnd > 0);
|
||||
|
||||
var xmlObj = { groundnet: { version: 1, fgaversion: version, name: name,
|
||||
var xmlObj = { groundnet: { version: 1, fgaversion: version, name: name,
|
||||
'frequencies': { APPROACH: approachList, DEPARTURE: departureList, AWOS: awosList, CLEARANCE: clearanceList, GROUND: groundList, TOWER: towerList, UNICOM: unicomList },
|
||||
parkingList: { Parking: parkings }, TaxiNodes: { node: uniqueNodes }, TaxiWaySegments: { arc: arcList } } };
|
||||
|
||||
@@ -273,7 +275,7 @@ var mapParkings = function (o) {
|
||||
console.debug(o.options.attributes.airlineCodes);
|
||||
parking['@airlineCodes'] = o.options.attributes.airlineCodes;
|
||||
}
|
||||
if(o.options.attributes.number !== undefined &&
|
||||
if(o.options.attributes.number !== undefined &&
|
||||
typeof o.options.attributes.number === 'number' || (
|
||||
typeof o.options.attributes.number === 'string' &&
|
||||
o.options.attributes.number.trim() !== ''
|
||||
@@ -290,10 +292,10 @@ var mapParkings = function (o) {
|
||||
var mapRunwayNodes = function (o) {
|
||||
console.debug(o);
|
||||
if (o instanceof L.RunwayNode) {
|
||||
var runwayNode = { '@index': String(o['glueindex']),
|
||||
'@lat': convertLat(o._latlng),
|
||||
'@lon': convertLon(o._latlng),
|
||||
'@isOnRunway': '1',
|
||||
var runwayNode = { '@index': String(o['glueindex']),
|
||||
'@lat': convertLat(o._latlng),
|
||||
'@lon': convertLon(o._latlng),
|
||||
'@isOnRunway': '1',
|
||||
'@holdPointType': 'none' };
|
||||
return runwayNode;
|
||||
}
|
||||
@@ -363,7 +365,7 @@ var styleArc = function (attributes, arc) {
|
||||
arc['@isPushBackRoute'] = "0";
|
||||
}
|
||||
if ( attributes.name !== '' && attributes.name !== 'undefined') {
|
||||
arc['@name'] = attributes.name;
|
||||
arc['@name'] = attributes.name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,22 @@
|
||||
/* eslint-disable */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
var xamel = require('xamel');
|
||||
const xamel = require('xamel');
|
||||
const convert = require('geo-coordinates-parser');
|
||||
const LatLonEllipsoidal = require('geodesy/latlon-ellipsoidal-vincenty.js').default;
|
||||
|
||||
const store = require('../store');
|
||||
|
||||
const util = require('util');
|
||||
|
||||
const takeoffPadPoly = require('../leaflet/TakeoffPad.js');
|
||||
|
||||
const threshold = require('./Threshold.js');
|
||||
|
||||
|
||||
var $ = require('jquery');
|
||||
|
||||
exports.readThresholdXML = function (fDir, icao, force) {
|
||||
exports.readThresholdXML = function (fDir, icao, force, stripes) {
|
||||
try {
|
||||
var layerGroup = L.layerGroup();
|
||||
layerGroup.maxId = 0;
|
||||
@@ -48,12 +51,30 @@ exports.readThresholdXML = function (fDir, icao, force) {
|
||||
var index = 0;
|
||||
runwayNodes.map(r => {
|
||||
var thresholds = r.find('threshold');
|
||||
thresholds.map(t => {
|
||||
var icon = threshold(t);
|
||||
thresholds.map(n => {
|
||||
var icon = threshold(n);
|
||||
icon.index = index;
|
||||
icon.addTo(layerGroup);
|
||||
}
|
||||
// Width in m
|
||||
var runwayWidth = 20;
|
||||
var latlon = convert(n.find('lat/text()').text() + " " + n.find('lon/text()').text());
|
||||
var displ_m = Number(n.find('displ-m/text()').text());
|
||||
var pointMiddle = new LatLonEllipsoidal(latlon.decimalLatitude, latlon.decimalLongitude);
|
||||
var heading = Number(n.find('hdg-deg/text()').text());
|
||||
var point1 = pointMiddle.destinationPoint(displ_m, heading);
|
||||
var point2 = pointMiddle.destinationPoint(displ_m + 80, heading);
|
||||
|
||||
var runwayPoints = [];
|
||||
runwayPoints.push(point1.destinationPoint(runwayWidth / 2, (heading + 90)));
|
||||
runwayPoints.push(point2.destinationPoint(runwayWidth / 2, (heading + 90)));
|
||||
runwayPoints.push(point2.destinationPoint(runwayWidth / 2, (heading - 90)));
|
||||
runwayPoints.push(point1.destinationPoint(runwayWidth / 2, (heading - 90)));
|
||||
|
||||
var runwayPoly = takeoffPadPoly(runwayPoints);
|
||||
runwayPoly.addTo(layerGroup);
|
||||
}
|
||||
)
|
||||
|
||||
index+=1;
|
||||
}).sort();
|
||||
|
||||
@@ -65,4 +86,4 @@ exports.readThresholdXML = function (fDir, icao, force) {
|
||||
console.error(error);
|
||||
}
|
||||
return layerGroup;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -68,6 +68,7 @@ function flightMapper(params) {
|
||||
return {
|
||||
id: `${btoa(buildId(params))}`,
|
||||
callsign: params.find('callsign').text(),
|
||||
'required-aircraft': params.find('required-aircraft').text(),
|
||||
arrival: {
|
||||
port: params.find('arrival/port').text(),
|
||||
time: params.find('arrival/time').text()
|
||||
|
||||
@@ -14,6 +14,10 @@ Vue.config.productionTip = false
|
||||
|
||||
Vue.use(ElementUI)
|
||||
|
||||
Vue.config.errorHandler = (err, vm, info) => {
|
||||
console.error(err)
|
||||
}
|
||||
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
components: { App },
|
||||
|
||||
@@ -70,7 +70,7 @@ async function checkGroundnet(data) {
|
||||
var normalNodes = data.map(mapEdges).filter(n => n !== undefined)
|
||||
.flatMap(m => m.latLngs).filter(n => runwayNodeIDs.indexOf(Number(n.index)) < 0);
|
||||
|
||||
var runways = data.map(mapRunways).filter(n => n !== undefined);
|
||||
var takeoffPads = data.map(mapTakeoffPads).filter(n => n !== undefined);
|
||||
|
||||
this.max = 30;
|
||||
this.postMessage(['max', this.max]);
|
||||
@@ -104,7 +104,8 @@ async function checkGroundnet(data) {
|
||||
resolve([{ id: -1, message: check_msg.NO_EDGES }]);
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
if (runways.length === 0) {
|
||||
//debugger;
|
||||
if (takeoffPads.length === 0) {
|
||||
resolve([{ id: -1, message: check_msg.NO_RUNWAYS }]);
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
@@ -297,16 +298,16 @@ async function checkGroundnet(data) {
|
||||
var notOkNodesRunways = runwayNodeIDs.filter(
|
||||
(v, i) => okNodes.indexOf(v) < 0
|
||||
).map(
|
||||
id => { return { id: id, message: check_msg.NO_RUNWAY_ROUTE } }
|
||||
id => { return { id: id, message: check_msg.NO_PARKING_ROUTE } }
|
||||
);
|
||||
this.postMessage(['progress', 1]);
|
||||
|
||||
if (parkings.length === 0) {
|
||||
notOkNodes.push({ id: 0, message: check_msg.NO_PARKINGS });
|
||||
notOkNodes.push({ id: -2, message: check_msg.NO_PARKINGS });
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
if (runwayNodeIDs.length === 0) {
|
||||
notOkNodes.push({ id: 0, message: check_msg.NO_RUNWAY_NODES });
|
||||
notOkNodes.push({ id: -2, message: check_msg.NO_RUNWAY_NODES });
|
||||
}
|
||||
this.postMessage(['progress', 1]);
|
||||
var allEnds = Object.entries(bidirectionalGraph).filter(
|
||||
@@ -382,7 +383,8 @@ async function checkGroundnet(data) {
|
||||
this.postMessage(['progress', 1]);
|
||||
//Check if runwaynodes are on runway
|
||||
runwayNodes.forEach(runwayNode => {
|
||||
if (runways.filter(r => turf.booleanContains(r, latToTurf(runwayNode))).length === 0) {
|
||||
// debugger;
|
||||
if (takeoffPads.filter(r => turf.booleanContains(r, latToTurf(runwayNode))).length === 0) {
|
||||
notOkNodes.push({ id: runwayNode.index, message: check_msg.RUNWAY_NODE_NOT_ON_RUNWAY });
|
||||
}
|
||||
});
|
||||
@@ -391,12 +393,19 @@ async function checkGroundnet(data) {
|
||||
//Check if nodes no normal nodes are on runway
|
||||
normalNodes.forEach(normalNode => {
|
||||
//debugger;
|
||||
if (runways.filter(r => turf.booleanContains(r, latToTurf(normalNode))).length > 0) {
|
||||
if (takeoffPads.filter(r => turf.booleanContains(r, latToTurf(normalNode))).length > 0) {
|
||||
notOkNodes.push({ id: normalNode.index, message: check_msg.NON_RUNWAYNODE_ON_RUNWAY });
|
||||
}
|
||||
});
|
||||
this.postMessage(['progress', 1]);
|
||||
|
||||
var doubleEdges = edges.filter((v, i, a) => a.findIndex(t => (t.start === v.start && t.end === v.end) ) !== i);
|
||||
doubleEdges.forEach(e => {
|
||||
notOkNodes.push({ id: e.id, message: check_msg.DOUBLE_EDGE });
|
||||
});
|
||||
|
||||
// debugger;
|
||||
|
||||
notOkNodes = notOkNodes.concat(invalidParkings);
|
||||
if (invalidParkings.length === 0) {
|
||||
notOkNodes.push({ id: -1, message: check_msg.PARKINGS_VALID });
|
||||
@@ -507,8 +516,8 @@ var mapRunwayNode = function (o) {
|
||||
}
|
||||
}
|
||||
|
||||
var mapRunways = function (o) {
|
||||
if (o.type === 'runway_poly') {
|
||||
var mapTakeoffPads = function (o) {
|
||||
if (o.type === 'takeoffpad_poly') {
|
||||
var pts = o.pavement[0].map(latLngToArray);
|
||||
pts.push(pts[0]);
|
||||
return turf.polygon([pts]);
|
||||
@@ -517,12 +526,10 @@ var mapRunways = function (o) {
|
||||
|
||||
var mapEdges = function (o) {
|
||||
if (o.type === 'poly')
|
||||
// debugger;
|
||||
return {
|
||||
start: o.start, end: o.end, isPushBackRoute: o.isPushBackRoute !== undefined &&
|
||||
id: o._leaflet_id, start: o.start, end: o.end, isPushBackRoute: o.isPushBackRoute !== undefined &&
|
||||
o.isPushBackRoute !== 0, direction: o.direction, latLngs: o.latLngs
|
||||
};
|
||||
console.debug(o);
|
||||
}
|
||||
|
||||
var latToTurf = function (turfPoint) {
|
||||
|
||||
@@ -1,32 +1,33 @@
|
||||
{
|
||||
"LONG_ROUTE_START" : ["Start of long route", "Route segments of >2km are Taxidraw artefacts"],
|
||||
"LONG_ROUTE_END": ["End of long route", "Route segments of >2km are Taxidraw artefacts"],
|
||||
"EDGE_MISSING_DIRECTION": ["Edge missing direction", ""],
|
||||
"NO_RUNWAY_ROUTE": ["No way from parking to each runway", ""],
|
||||
"NO_PARKING_ROUTE": ["No way from runway to each parking", ""],
|
||||
"EDGE_MISSING_DIRECTION": ["Edge missing direction", "Each edge must have a direction (forward, backward, bi-directional)"],
|
||||
"NO_RUNWAY_ROUTE": ["No way from parking to each runway", "There must be a route from each parking to each runway."],
|
||||
"NO_PARKING_ROUTE": ["No way from runway to each parking", "There must be a route from each runway to each parking."],
|
||||
"NO_PARKINGS": ["No parkings", ""],
|
||||
"NO_RUNWAYNODES": ["No Runwaynodes", ""],
|
||||
"NO_RUNWAY_NODES": ["No Runwaynodes", "Fine for parking only"],
|
||||
"NOT_LEGIT_END": ["Node not a legimate end", "Taxiroutes must end either at a parking or on a runway"],
|
||||
"UNKNOWN_RADIUS" :["Unknown radius", "Radii must be one from the list"],
|
||||
"OVERLAPPING_PARKINGS" :["Overlapping parkings", ""],
|
||||
"NAME_EMPTY" :["Name empty", ""],
|
||||
"TYPE_EMPTY" :["Parking type empty", ""],
|
||||
"PARKING_TYPE_INVALID" :["Parking type not valid", ""],
|
||||
"OVERLAPPING_PARKINGS" :["Overlapping parkings", "Parkings must not overlap"],
|
||||
"NAME_EMPTY" :["Name empty", "Name of parking must not be empty"],
|
||||
"TYPE_EMPTY" :["Parking type empty", "The parking type must not be empty"],
|
||||
"PARKING_TYPE_INVALID" :["Parking type not valid", "The type of parking must be one of ()"],
|
||||
"DUAL_PUSHBACK": ["Dual runway/ pushback node", "A runway node can not be a hold node at the same time"],
|
||||
"RUNWAY_NODE_NOT_ON_RUNWAY" : ["Runwaynode not on runway", ""],
|
||||
"NON_RUNWAYNODE_ON_RUNWAY": ["Non Runwaynode on runway", ""],
|
||||
"PARKINGS_VALID": ["Parkings valid", ""],
|
||||
"NO_OVERLAPPING_PARKINGS": ["No parkings overlapping", ""],
|
||||
"RUNWAY_NODE_NOT_ON_RUNWAY" : ["Runwaynode not in takeoff pad", ""],
|
||||
"NON_RUNWAYNODE_ON_RUNWAY": ["Non Runwaynode in takeoff pad", ""],
|
||||
"PARKINGS_VALID": ["Parkings valid", "All Ok"],
|
||||
"NO_OVERLAPPING_PARKINGS": ["No parkings overlapping", "Parking positions may not overlap. Reduce the radius or move."],
|
||||
"NO_INVALID_ENDS": ["No invalid ends", ""],
|
||||
"ROUTES_FROM_PARKINGS_OK": ["Routes from parkings OK", ""],
|
||||
"ROUTES_FROM_RUNWAYS_OK": ["Routes from runways OK", ""],
|
||||
"PUSHBACK_ROUTES_OK": ["Pushback routes OK", ""],
|
||||
"UNCONNECTED_PUSHBACK": ["Unconnected Pushbacknode", ""],
|
||||
"NO_WAY_TO_HOLDPOINT":["No way to pushback holdpoint", ""],
|
||||
"MULTIPLE_PUSHBACK": ["Multiple connected pushback points", ""],
|
||||
"NO_WAY_TO_HOLDPOINT":["No way to pushback holdpoint", "There is no route from the parking to the pushback hold point-"],
|
||||
"MULTIPLE_PUSHBACK": ["Multiple connected pushback points", "There are more than one possible pushback holdpoint routes."],
|
||||
"PUSHBACK_NOT_CONNECTED": ["Pushback Holding Point not Connected to Pushback Route", ""],
|
||||
"TO_MANY_PUSHBACK_TAXI_ROUTES": ["Too many Taxi routes from Pushback Holding Point", ""],
|
||||
"TO_MANY_PUSHBACK_TAXI_ROUTES": ["Too many Taxi routes from Pushback Holding Point", "There must be only one pushback point reachable from the parking."],
|
||||
"PUSHBACK_EXIT_NOT_BIDRECTIONAL": ["Pushback Holding Point Exit route is not bidirectional", ""],
|
||||
"NO_EDGES": ["No Edges", "No checks are run if there are no edges present"],
|
||||
"NO_RUNWAYS": ["No Runways", "No checks are run if there are no runways present. APT layer visible?"]
|
||||
"NO_RUNWAYS": ["No Runways", "No checks are run if there are no runways present. APT layer visible?"],
|
||||
"DOUBLE_EDGE": ["No Double Edges", "This edge is doubled"]
|
||||
}
|
||||
@@ -1,29 +1,40 @@
|
||||
var util = require("util");
|
||||
/* eslint-disable no-unused-vars */
|
||||
var util = require('util');
|
||||
|
||||
const d = new Date();
|
||||
|
||||
const fName = 'scan_' + d.getFullYear()
|
||||
+ d.getMonth()
|
||||
+ d.getDay()
|
||||
+ d.getHours()
|
||||
+ d.getMinutes()
|
||||
+ d.getSeconds()
|
||||
+ d.getMilliseconds() + '.log';
|
||||
const fName = 'scan_' + d.getFullYear() +
|
||||
d.getMonth() +
|
||||
d.getDay() +
|
||||
d.getHours() +
|
||||
d.getMinutes() +
|
||||
d.getSeconds() +
|
||||
d.getMilliseconds() + '.log';
|
||||
|
||||
var logStream = null;
|
||||
|
||||
var loggerInit = function (logging) {
|
||||
if (logging) {
|
||||
logStream = require('fs').createWriteStream( fName, {autoClose: true});
|
||||
try {
|
||||
const homedir = require('os').homedir();
|
||||
const logFileName = require('path').join(homedir, fName);
|
||||
logStream = require('fs').createWriteStream( logFileName, {autoClose: true});
|
||||
} catch (error) {
|
||||
console.error('Logging not possible ' + error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var logger = function (level, msg, o) {
|
||||
var d = new Date();
|
||||
if(logStream!==null) {
|
||||
var d = new Date();
|
||||
try {
|
||||
if (logStream !== null) {
|
||||
logStream.write(d.toUTCString() + '|' + level + ' | ' + msg + '\r\n');
|
||||
}
|
||||
if (o != undefined && logStream!==null) {
|
||||
logStream.write( util.inspect(o,{depth: 2}) + '\r\n');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Logging not possible ' + error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user