This commit is contained in:
@@ -74,14 +74,16 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
|
||||
<script lang="js">
|
||||
/* eslint-disable */
|
||||
const path = require('path')
|
||||
const fs = require('fs');
|
||||
const mapper = require('../check/mapper');
|
||||
|
||||
import EditButton from './EditButton'
|
||||
import ZoomButton from './ZoomButton';
|
||||
import Upload from './Upload'
|
||||
import Vue from 'vue'
|
||||
|
||||
import fileUrl from 'file-url'
|
||||
const path = require('path')
|
||||
const fs = require('fs');
|
||||
|
||||
export default {
|
||||
components: { EditButton, Upload, ZoomButton },
|
||||
@@ -211,15 +213,20 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
worker.progress = 0
|
||||
// var worker = new Worker(fileUrl('src/renderer/utils/worker.js'))
|
||||
this.worker = worker
|
||||
var xml = []
|
||||
var groundnet = []
|
||||
this.$parent.$parent.$refs.editLayer.groundnetLayerGroup.eachLayer(l => {
|
||||
console.log(l)
|
||||
xml.push(l)
|
||||
groundnet.push(l)
|
||||
})
|
||||
var features = groundnet.map(mapper.checkMapper).filter(n => n)
|
||||
var pavement = []
|
||||
this.$parent.$parent.$refs.pavementLayer.pavement.eachLayer(l => {
|
||||
console.log(l)
|
||||
pavement.push(l)
|
||||
})
|
||||
var features2 = pavement.map(mapper.checkMapper).filter(n => n)
|
||||
|
||||
var features = xml.map(this.featuresMapper).filter(n => n)
|
||||
|
||||
worker.postMessage(['check', features ] )
|
||||
worker.postMessage(['check', features.concat(features2) ] )
|
||||
this.pollData()
|
||||
// the reply
|
||||
var store = this.$store
|
||||
@@ -245,6 +252,12 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
}
|
||||
// console.log(e.data)
|
||||
}
|
||||
worker.onError = function(e) {
|
||||
worker.terminate()
|
||||
worker.view.max = 0
|
||||
worker.view.checkDialogVisible = false
|
||||
e.preventDefault(); // <-- "Hey browser, I handled it!"
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
@@ -273,38 +286,6 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
this.$parent.$parent.$refs.editLayer.stopDrawing()
|
||||
Vue.set(this, 'checkDialogVisible', true)
|
||||
this.check()
|
||||
},
|
||||
featuresMapper(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, '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.Polyline) {
|
||||
console.log(o)
|
||||
//_latlngs[""0""].__vertex.glueindex
|
||||
var latLngs = o.getLatLngs().map(l => ({lat: l.lat, lng: l.lng, index: l.glueindex}));
|
||||
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)
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -810,6 +810,8 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
if (distance > 0 && distance < snap) {
|
||||
layers.push({d: distance, l: layer, latlng: latlng.__vertex.latlng, glueindex: latlng.glueindex})
|
||||
}
|
||||
} else {
|
||||
console.log(latlng);
|
||||
}
|
||||
})
|
||||
} else if (layer instanceof L.RunwayNode) {
|
||||
@@ -913,9 +915,11 @@ You should have received a copy of the GNU General Public License along with FG
|
||||
console.warn('No glueindex : ' + latlng.__vertex);
|
||||
}
|
||||
let distance = latlng.distanceTo(centerLatLng)
|
||||
if (latlng.glueindex !== newIndex && distance < 10) {
|
||||
if (Number(latlng.glueindex) !== Number(newIndex) && distance < 10) {
|
||||
nearest.push({d: distance, l: layer, latlng: latlng.__vertex.latlng, glueindex: latlng.glueindex })
|
||||
}
|
||||
} else {
|
||||
console.error("No __Vertex");
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import axios from 'axios'
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const mapper = require('../check/mapper');
|
||||
|
||||
export default {
|
||||
name: 'upload',
|
||||
@@ -118,33 +119,6 @@
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
featuresMapper(o) {
|
||||
if (o instanceof L.ParkingSpot) {
|
||||
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, '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.Polyline) {
|
||||
console.log(o)
|
||||
var latLngs = o.getLatLngs().map(l => ({lat: l.lat, lng: l.lng, index: l.attributes.index}));
|
||||
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)
|
||||
}
|
||||
},
|
||||
check () {
|
||||
try {
|
||||
this.scanning = true
|
||||
@@ -169,7 +143,7 @@
|
||||
xml.push(l)
|
||||
})
|
||||
|
||||
var features = xml.map(this.featuresMapper).filter(n => n)
|
||||
var features = xml.map(mapper.checkMapper).filter(n => n)
|
||||
|
||||
worker.postMessage(['check', features ] )
|
||||
this.pollData()
|
||||
|
||||
Reference in New Issue
Block a user