From 3ecace714e242d21aaca196a8d5a09bf12ebcecf Mon Sep 17 00:00:00 2001 From: portree_kid Date: Wed, 22 Jul 2020 21:28:31 +0200 Subject: [PATCH] https://github.com/Portree-Kid/flightgear-airports/issues/59 --- src/renderer/check/mapper.js | 64 +++++ src/renderer/components/EditBar.vue | 59 ++-- src/renderer/components/EditLayer.vue | 6 +- src/renderer/components/Upload.vue | 30 +- src/renderer/leaflet/Runway.js | 25 ++ src/renderer/loaders/pavement_loader.js | 31 +- src/renderer/utils/check.js | 205 +++++++++----- test/mocha/specs/check.spec.js | 361 +++++++++++++----------- 8 files changed, 458 insertions(+), 323 deletions(-) create mode 100644 src/renderer/check/mapper.js create mode 100644 src/renderer/leaflet/Runway.js diff --git a/src/renderer/check/mapper.js b/src/renderer/check/mapper.js new file mode 100644 index 0000000..a6fe025 --- /dev/null +++ b/src/renderer/check/mapper.js @@ -0,0 +1,64 @@ +/* +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/. +*/ + +/* eslint-disable */ +var L = require('leaflet'); + +export function checkMapper(o) { + if (o instanceof L.ParkingSpot) { + /* + if( o.box === undefined ) { + debugger; + } */ + return { + 'index': Number(o['id']), + '_leaflet_id': o._leaflet_id, + 'type': 'parking', + 'parkingType': o.options.attributes.type, + 'name': o.options.attributes.name, + 'radius': String(o.options.attributes.radius), + 'lat': o._latlng.lat, + 'lng': o._latlng.lng, + 'box': o.box !== undefined ? o.box.getLatLngs() : null + }; + } else if (o instanceof L.RunwayNode) { + 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) + return { 'index': Number(o['glueindex']), '_leaflet_id': o._leaflet_id, 'type': o.holdPointType }; + } else if (o instanceof L.RunwayPolygon) { + return { + 'type': 'runway_poly', + 'pavement': o.getLatLngs() + } + } else if (o instanceof L.Polyline) { + console.log(o) + //_latlngs[""0""].__vertex.glueindex + var latLngs = o.getLatLngs().map(l => ({ lat: l.lat, lng: l.lng, index: l.glueindex })); + if (o.options.attributes===undefined) { + return null; + } + return { 'start': Number(o['begin']), 'end': Number(o['end']), '_leaflet_id': o._leaflet_id, 'type': 'poly', 'direction': o.options.attributes.direction, 'isPushBackRoute': o.options.attributes.isPushBackRoute, latLngs: latLngs }; + } + else { + console.log('Unknown Type ') + console.log(typeof o) + } +} + +export function groMapper(o) { + if (o instanceof L.Polygon) { + + } +} diff --git a/src/renderer/components/EditBar.vue b/src/renderer/components/EditBar.vue index 8ae8f04..cfbe2fe 100644 --- a/src/renderer/components/EditBar.vue +++ b/src/renderer/components/EditBar.vue @@ -74,14 +74,16 @@ You should have received a copy of the GNU General Public License along with FG