Layer visibility
This commit is contained in:
parent
4c01775ccf
commit
bed38277ce
@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
<Upload :visible.sync="uploadVisible" ref="upload"></Upload>
|
<Upload :visible.sync="uploadVisible" ref="upload"></Upload>
|
||||||
<ZoomButton icon="fas fa-th" v-on:click="zoomin" :show="true" tooltip="Zoomin"></ZoomButton>
|
<ZoomButton icon="fas fa-th" v-on:click="zoomin" :show="true" tooltip="Zoomin"></ZoomButton>
|
||||||
<ZoomButton icon="fas fa-th-large" v-on:click="zoomout" :show="!editing" tooltip="Zoomout"></ZoomButton>
|
<ZoomButton icon="fas fa-th-large" v-on:click="zoomout" :show="!editing" tooltip="Zoomout"></ZoomButton>
|
||||||
<ZoomButton icon="far fa-eye-slash" v-on:click="hideAPT" :show='true' tooltip="Hide APT"></ZoomButton>
|
<!--<ZoomButton icon="far fa-eye-slash" v-on:click="hideAPT" :show='true' tooltip="Hide APT"></ZoomButton>-->
|
||||||
|
|
||||||
<EditButton icon="fas fa-upload" v-on:click="upload" :show="!editing" tooltip="Upload"></EditButton>
|
<EditButton icon="fas fa-upload" v-on:click="upload" :show="!editing" tooltip="Upload"></EditButton>
|
||||||
<EditButton icon="fas fa-plane" v-on:click="test" :show="!editing" tooltip="Export"></EditButton>
|
<EditButton icon="fas fa-plane" v-on:click="test" :show="!editing" tooltip="Export"></EditButton>
|
||||||
|
@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
:zoom="zoom"
|
:zoom="zoom"
|
||||||
:center="center"
|
:center="center"
|
||||||
:options="options"
|
:options="options"
|
||||||
|
@ready="ready"
|
||||||
@update:zoom="zoomUpdated"
|
@update:zoom="zoomUpdated"
|
||||||
@update:center="centerUpdated"
|
@update:center="centerUpdated"
|
||||||
@update:bounds="boundsUpdated"
|
@update:bounds="boundsUpdated"
|
||||||
@ -76,8 +77,6 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
components: { LMap, LTileLayer, LMarker, LCircle, LeafletSidebar, AiLayer, EditBar, ToolBar, EditLayer, PavementLayer, LLayerGroup, LControl, ThresholdLayer, ToolLayer },
|
components: { LMap, LTileLayer, LMarker, LCircle, LeafletSidebar, AiLayer, EditBar, ToolBar, EditLayer, PavementLayer, LLayerGroup, LControl, ThresholdLayer, ToolLayer },
|
||||||
props: [],
|
props: [],
|
||||||
mounted () {
|
mounted () {
|
||||||
this.$refs.map.mapObject.on('layeradd', this.onLayerAdd)
|
|
||||||
|
|
||||||
this.$store.dispatch('getAirports')
|
this.$store.dispatch('getAirports')
|
||||||
this.$store.subscribe((mutation, state) => {
|
this.$store.subscribe((mutation, state) => {
|
||||||
if (mutation.type === 'CENTER' || mutation.type === 'SET_AIRPORTS' || mutation.type === 'ZOOM') {
|
if (mutation.type === 'CENTER' || mutation.type === 'SET_AIRPORTS' || mutation.type === 'ZOOM') {
|
||||||
@ -87,11 +86,9 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
.filter(feature => this.visible(feature))
|
.filter(feature => this.visible(feature))
|
||||||
.map(feature => feature.properties.icao)
|
.map(feature => feature.properties.icao)
|
||||||
if (airportsToLoad.length > 0 && airportsToLoad[0] !== this.editingAirport && this.zoom > 12) {
|
if (airportsToLoad.length > 0 && airportsToLoad[0] !== this.editingAirport && this.zoom > 12) {
|
||||||
this.$refs.editLayer.load(airportsToLoad[0])
|
|
||||||
this.$refs.pavementLayer.load(airportsToLoad[0])
|
this.$refs.pavementLayer.load(airportsToLoad[0])
|
||||||
/*
|
this.$refs.editLayer.load(airportsToLoad[0])
|
||||||
this.$refs.thresholdLayer.load(airportsToLoad[0])
|
this.$refs.thresholdLayer.load(airportsToLoad[0])
|
||||||
*/
|
|
||||||
this.editingAirport = airportsToLoad[0]
|
this.editingAirport = airportsToLoad[0]
|
||||||
}
|
}
|
||||||
if (this.$refs.editLayer) {
|
if (this.$refs.editLayer) {
|
||||||
@ -119,11 +116,14 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
ready (e) {
|
||||||
|
console.log(e)
|
||||||
|
e.on('layeradd', this.onLayerAdd)
|
||||||
|
},
|
||||||
onLayerAdd (e) {
|
onLayerAdd (e) {
|
||||||
if (this.layersControl === null) {
|
if (this.layersControl === null) {
|
||||||
this.layersControl = L.control.layers({}, {}, {position: 'topleft'})
|
this.layersControl = L.control.layers({}, {}, {position: 'topleft'})
|
||||||
this.layersControl.addTo(this.$refs.map.mapObject)
|
this.layersControl.addTo(this.$refs.map.mapObject)
|
||||||
debugger
|
|
||||||
var icon = this.layersControl._container.ownerDocument.createElement('I')
|
var icon = this.layersControl._container.ownerDocument.createElement('I')
|
||||||
icon.className = 'fas fa-layer-group'
|
icon.className = 'fas fa-layer-group'
|
||||||
icon.style = 'padding-top: 9px; height: 30px; width: 30px; text-align: center; vertical-align: sub;'
|
icon.style = 'padding-top: 9px; height: 30px; width: 30px; text-align: center; vertical-align: sub;'
|
||||||
@ -131,11 +131,18 @@ You should have received a copy of the GNU General Public License along with FG
|
|||||||
// this.layersControl.addOverlay(this.$refs.thresholdLayer, 'Threshold Layer')
|
// this.layersControl.addOverlay(this.$refs.thresholdLayer, 'Threshold Layer')
|
||||||
}
|
}
|
||||||
if (this.$refs.pavementLayer.getLayer() === e.layer) {
|
if (this.$refs.pavementLayer.getLayer() === e.layer) {
|
||||||
|
// debugger
|
||||||
var l = this.layersControl._layers.filter(l => l.name === 'APT Layer')
|
var l = this.layersControl._layers.filter(l => l.name === 'APT Layer')
|
||||||
if (l.length === 0) {
|
if (l.length === 0) {
|
||||||
this.layersControl.addOverlay(this.$refs.pavementLayer.getLayer(), 'APT Layer')
|
this.layersControl.addOverlay(this.$refs.pavementLayer.getLayer(), 'APT Layer')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.$refs.thresholdLayer.getLayer() === e.layer) {
|
||||||
|
l = this.layersControl._layers.filter(l => l.name === 'Threshold Layer')
|
||||||
|
if (l.length === 0) {
|
||||||
|
this.layersControl.addOverlay(this.$refs.thresholdLayer.getLayer(), 'Threshold Layer')
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onSelectedPolygon (ring) {
|
onSelectedPolygon (ring) {
|
||||||
var parkings = this.$refs.editLayer.getParkings(ring)
|
var parkings = this.$refs.editLayer.getParkings(ring)
|
||||||
|
@ -25,10 +25,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getLayer () {
|
||||||
|
return this.layerGroup
|
||||||
|
},
|
||||||
load (icao) {
|
load (icao) {
|
||||||
// Callback for add
|
// 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)
|
||||||
this.layerGroup.addTo(this.$parent.mapObject)
|
this.layerGroup.addTo(this.$parent.mapObject)
|
||||||
|
this.visible = true
|
||||||
this.icao = icao
|
this.icao = icao
|
||||||
},
|
},
|
||||||
deferredMountedTo (parent) {
|
deferredMountedTo (parent) {
|
||||||
@ -45,11 +49,14 @@
|
|||||||
},
|
},
|
||||||
setVisible (visible) {
|
setVisible (visible) {
|
||||||
if (this.layerGroup !== undefined) {
|
if (this.layerGroup !== undefined) {
|
||||||
|
if (visible !== this.visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
this.layerGroup.addTo(this.$parent.mapObject)
|
this.layerGroup.addTo(this.$parent.mapObject)
|
||||||
} else {
|
} else {
|
||||||
this.layerGroup.removeFrom(this.$parent.mapObject)
|
this.layerGroup.removeFrom(this.$parent.mapObject)
|
||||||
}
|
}
|
||||||
|
this.visible = visible
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -34,7 +34,7 @@ exports.addFeature = function (feature) {
|
|||||||
|
|
||||||
exports.readGroundnetXML = function (fDir, icao, force) {
|
exports.readGroundnetXML = function (fDir, icao, force) {
|
||||||
try {
|
try {
|
||||||
layerGroup = L.layerGroup();
|
var layerGroup = L.layerGroup();
|
||||||
layerGroup.maxId = 0;
|
layerGroup.maxId = 0;
|
||||||
var f = path.join(fDir, icao[0], icao[1], icao[2], icao + '.groundnet.xml');
|
var f = path.join(fDir, icao[0], icao[1], icao[2], icao + '.groundnet.xml');
|
||||||
var fNew = path.join(fDir, icao[0], icao[1], icao[2], icao + '.groundnet.new.xml');
|
var fNew = path.join(fDir, icao[0], icao[1], icao[2], icao + '.groundnet.new.xml');
|
||||||
|
@ -209,7 +209,7 @@ function deCasteljau(pointArray) {
|
|||||||
return intermediates;
|
return intermediates;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPoly(currentFeature) {
|
function createPoly(currentFeature, layerGroup) {
|
||||||
switch (module.exports.type) {
|
switch (module.exports.type) {
|
||||||
case 110:
|
case 110:
|
||||||
var taxiwayPoly = new L.Polygon(currentFeature);
|
var taxiwayPoly = new L.Polygon(currentFeature);
|
||||||
@ -231,7 +231,7 @@ function createPoly(currentFeature) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLineString(currentFeature) {
|
function createLineString(currentFeature, layerGroup) {
|
||||||
switch (module.exports.type) {
|
switch (module.exports.type) {
|
||||||
case 110:
|
case 110:
|
||||||
var taxiwayPoly = new L.Polyline(currentFeature);
|
var taxiwayPoly = new L.Polyline(currentFeature);
|
||||||
@ -255,7 +255,7 @@ function createLineString(currentFeature) {
|
|||||||
|
|
||||||
module.exports.readPavement = function (f, icao, cb) {
|
module.exports.readPavement = function (f, icao, cb) {
|
||||||
console.log(f);
|
console.log(f);
|
||||||
layerGroup = L.layerGroup();
|
var pavementLayerGroup = L.layerGroup();
|
||||||
var currentFeature;
|
var currentFeature;
|
||||||
|
|
||||||
lineReader.createInterface({
|
lineReader.createInterface({
|
||||||
@ -267,7 +267,7 @@ module.exports.readPavement = function (f, icao, cb) {
|
|||||||
return;
|
return;
|
||||||
var scanMethod = scanMethods[fields[0]];
|
var scanMethod = scanMethods[fields[0]];
|
||||||
if (scanMethod != null) {
|
if (scanMethod != null) {
|
||||||
currentFeature = scanMethod(fields, icao, layerGroup, currentFeature);
|
currentFeature = scanMethod(fields, icao, pavementLayerGroup, currentFeature);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (fields[0] == '99') {
|
if (fields[0] == '99') {
|
||||||
@ -280,7 +280,7 @@ module.exports.readPavement = function (f, icao, cb) {
|
|||||||
lr.close();
|
lr.close();
|
||||||
}).on('close', function () {
|
}).on('close', function () {
|
||||||
console.log("End");
|
console.log("End");
|
||||||
cb(layerGroup);
|
cb(pavementLayerGroup);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ var scanMethods = {
|
|||||||
if (!module.exports.isScanning)
|
if (!module.exports.isScanning)
|
||||||
return undefined;
|
return undefined;
|
||||||
if (typeof currentFeature !== 'undefined') {
|
if (typeof currentFeature !== 'undefined') {
|
||||||
createPoly(currentFeature);
|
createPoly(currentFeature, layerGroup);
|
||||||
}
|
}
|
||||||
module.exports.colour = 'grey';
|
module.exports.colour = 'grey';
|
||||||
module.exports.type = 110;
|
module.exports.type = 110;
|
||||||
@ -391,7 +391,7 @@ var scanMethods = {
|
|||||||
if (!module.exports.isScanning)
|
if (!module.exports.isScanning)
|
||||||
return undefined;
|
return undefined;
|
||||||
if (typeof currentFeature !== 'undefined') {
|
if (typeof currentFeature !== 'undefined') {
|
||||||
createPoly(currentFeature);
|
createPoly(currentFeature, layerGroup);
|
||||||
}
|
}
|
||||||
module.exports.colour = 'yellow';
|
module.exports.colour = 'yellow';
|
||||||
module.exports.type = 120;
|
module.exports.type = 120;
|
||||||
@ -401,7 +401,7 @@ var scanMethods = {
|
|||||||
if (!module.exports.isScanning)
|
if (!module.exports.isScanning)
|
||||||
return undefined;
|
return undefined;
|
||||||
if (typeof currentFeature !== 'undefined') {
|
if (typeof currentFeature !== 'undefined') {
|
||||||
createPoly(currentFeature);
|
createPoly(currentFeatur, layerGroup);
|
||||||
}
|
}
|
||||||
module.exports.colour = 'black';
|
module.exports.colour = 'black';
|
||||||
module.exports.type = 130;
|
module.exports.type = 130;
|
||||||
@ -463,7 +463,7 @@ var scanMethods = {
|
|||||||
else {
|
else {
|
||||||
currentFeature.slice(-1)[0].push([line[1], line[2]]);
|
currentFeature.slice(-1)[0].push([line[1], line[2]]);
|
||||||
}
|
}
|
||||||
createLineString(currentFeature);
|
createLineString(currentFeature, layerGroup);
|
||||||
exports.bezierPoint = null;
|
exports.bezierPoint = null;
|
||||||
},
|
},
|
||||||
// End with Bezier
|
// End with Bezier
|
||||||
@ -472,7 +472,7 @@ var scanMethods = {
|
|||||||
return;
|
return;
|
||||||
console.debug(line);
|
console.debug(line);
|
||||||
currentFeature = bezier(line, icao, layerGroup, currentFeature);
|
currentFeature = bezier(line, icao, layerGroup, currentFeature);
|
||||||
createLineString(currentFeature);
|
createLineString(currentFeature, layerGroup);
|
||||||
exports.bezierPoint = null;
|
exports.bezierPoint = null;
|
||||||
// taxiwayLine.addTo(layerGroup);
|
// taxiwayLine.addTo(layerGroup);
|
||||||
},
|
},
|
||||||
|
@ -15,7 +15,7 @@ var $ = require('jquery');
|
|||||||
|
|
||||||
exports.readThresholdXML = function (fDir, icao, force) {
|
exports.readThresholdXML = function (fDir, icao, force) {
|
||||||
try {
|
try {
|
||||||
layerGroup = L.layerGroup();
|
var layerGroup = L.layerGroup();
|
||||||
layerGroup.maxId = 0;
|
layerGroup.maxId = 0;
|
||||||
var f = path.join(fDir, icao[0], icao[1], icao[2], icao + '.threshold.xml');
|
var f = path.join(fDir, icao[0], icao[1], icao[2], icao + '.threshold.xml');
|
||||||
var fNew = path.join(fDir, icao[0], icao[1], icao[2], icao + '.threshold.new.xml');
|
var fNew = path.join(fDir, icao[0], icao[1], icao[2], icao + '.threshold.new.xml');
|
||||||
|
Loading…
Reference in New Issue
Block a user