This commit is contained in:
portree_kid 2020-03-04 10:54:39 +01:00
parent 8b3b8635c4
commit 37b14de1fd
5 changed files with 59 additions and 9 deletions

View File

@ -8,8 +8,9 @@
</h1>
<div id="panel" width="100%">
<el-row v-for="(result,idx) in results" :key="idx">
<el-col :span="7">{{ result.id }}</el-col>
<el-col :span="15">{{ result.message }}</el-col>
<el-col :span="7"><el-button v-on:click="show(result.id)">Show</el-button></el-col>
</el-row>
</div>
</div>
@ -27,6 +28,9 @@
}
},
methods: {
show (idx) {
this.$parent.$parent.$parent.$refs.editLayer.show(idx)
}
},
computed: {
results: function () {
@ -38,7 +42,7 @@
<style>
.el-row {
margin-bottom: 1px;
margin: 1px;
}
.el-col {
border-radius: 1px;

View File

@ -181,6 +181,41 @@
}
});
},
show (index) {
if(this.featureLookup[index]===undefined) {
console.error("Lookup " + index + " failed ");
return;
}
this.featureLookup[index].forEach((element, i) => {
if (element instanceof L.Polyline) {
element._latlngs.forEach((e1, index1) => {
console.log(e1);
if (e1.attributes.index===index) {
var latlng = {};
latlng.lat = e1.lat;
latlng.lng = e1.lng;
this.$store.dispatch('setCenter', latlng);
if(e1.__vertex._icon.style!=null) {
e1.__vertex._icon.style['background-color'] = 'red';
}
}
});
} else if (element instanceof L.RunwayNode) {
var latlng = {};
latlng.lat = element._latlng.lat;
latlng.lng = element._latlng.lng;
element.highlight();
this.$store.dispatch('setCenter', latlng);
} else if (element instanceof L.ParkingSpot) {
console.log(element);
var latlng = {};
latlng.lat = element._latlng.lat;
latlng.lng = element._latlng.lng;
element.highlight();
this.$store.dispatch('setCenter', latlng);
}
});
},
removeNode (index) {
if(this.featureLookup[index]===undefined) {
console.error("Lookup " + index + " failed ");

View File

@ -89,6 +89,11 @@ L.ParkingSpot = L.Circle.extend({
this.direction.setLatLngs([start, end]);
}
},
highlight() {
var style = {};
style['color'] = 'red';
this.setStyle(style);
},
addListeners: function () {
this.on('editable:drawing:move', function (event) {
console.log("Move : ", event);
@ -112,7 +117,7 @@ L.ParkingSpot = L.Circle.extend({
this.on('click', function (event) {
console.log("Click : " + event.target);
store.default.dispatch('setParking', event.target.options.attributes);
this.setStyle({color : 'red'});
this.highlight();
this.unwatch = store.default.watch(
function (state) {
return state.Editable.data.parking;
@ -128,7 +133,7 @@ L.ParkingSpot = L.Circle.extend({
deep: true //add this if u need to watch object properties change etc.
}
);
});
});
this.on('editable:vertex:clicked', function (event) {
console.log(this.featureLookup[event.vertex.glueindex]);
if(event.target.editor._resizeLatLng.__vertex._icon !== event.sourceTarget._element){

View File

@ -42,6 +42,11 @@ L.RunwayNode = L.Marker.extend({
});
},
highlight() {
var style = {};
style['color'] = 'red';
this.setStyle(style);
},
extensions: function (editLayer) {
this.options.attributes = {};
if (typeof this.featureLookup[this.glueindex] === 'undefined') {

View File

@ -37,12 +37,13 @@ onmessage = function (event) {
async function checkGroundnet(data) {
var promise = new Promise(function (resolve, reject) {
try {
this.max = 4;
debugger;
// debugger;
var parkings = data.map(mapParkings).filter(n => n !== undefined);
var runwayNodes = data.map(mapRunwayNodes).filter(n => n !== undefined);
var edges = data.map(mapEdges).filter(n => n !== undefined);
this.max = parkings.length * runwayNodes.length;
this.postMessage(['max', this.max]);
var graph = {};
parkings.forEach(element => {
graph[element] = {};
@ -69,7 +70,7 @@ async function checkGroundnet(data) {
okNodes.push(parkingNode);
okNodes.push(runwayNode);
}
this.progress += 1;
this.postMessage(['progress', 1]);
});
});
okNodes = okNodes.filter((v,i) => okNodes.indexOf(v) === i);
@ -96,7 +97,7 @@ async function checkGroundnet(data) {
// check1(graph);
// check2();
// this.progress += 1;
// this.postMessage(['progress', 1]);
resolve(notOkNodes);
} catch (error) {