Commit 34cb439d authored by youjie's avatar youjie

no message

parent dbbb12cb
...@@ -300,16 +300,6 @@ export default { ...@@ -300,16 +300,6 @@ export default {
this.SearchCity(x.MId); this.SearchCity(x.MId);
} }
}); });
this.countriesData.forEach((x, i) => {
if(this.map && this.map.getLayer("world-layer-" + x.MId)) {
this.map.removeLayer("world-layer-" + x.MId);
this.map.removeSource("word-source" + x.MId);
}
if (this.map && this.map.getLayer("world-layer-" + x.MId)) {
this.map.removeLayer("world-layer-" + x.MId);
}
});
let poilines = this.pois.split(",");
if ( if (
this.TripMapList && this.TripMapList &&
...@@ -383,6 +373,17 @@ export default { ...@@ -383,6 +373,17 @@ export default {
if (type) { if (type) {
this.TripMapList.push(JSON.parse(JSON.stringify(obj))); this.TripMapList.push(JSON.parse(JSON.stringify(obj)));
} else { } else {
let MId = this.countriesData[index].MId
if(this.map.getLayer("curve-layer-" + MId)) {
this.map.removeLayer("curve-layer-" + MId);
this.map.removeSource("curve-source-" + MId);
}
if(this.map&&this.map.getLayer("world-layer-" + MId)) {
this.map.removeLayer("world-layer-" + MId);
this.map.removeSource("word-source");
// this.map.removePaintProperty("world-layer-" + x.MId);
// this.map.removeSource("word-source-" + x.MId);
}
this.TripMapList.splice(index, 1); this.TripMapList.splice(index, 1);
this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList)); this.dataAll.TripMapList = JSON.parse(JSON.stringify(this.TripMapList));
} }
...@@ -463,19 +464,19 @@ export default { ...@@ -463,19 +464,19 @@ export default {
}, },
clearCountryFillRange(){ clearCountryFillRange(){
//删除图层 //删除图层
if (this.layerIds.length) { // if (this.layerIds.length) {
this.layerIds.forEach(id => { // this.layerIds.forEach(id => {
this.map.removeLayer(id) // this.map.removeLayer(id)
}) // })
this.layerIds = []; // this.layerIds = [];
} // }
//删除数据源 //删除数据源
if (this.sourceIds.length) { // if (this.sourceIds.length) {
this.sourceIds.forEach(id =>{ // this.sourceIds.forEach(id =>{
this.map.removeSource(id) // this.map.removeSource(id)
}) // })
this.sourceIds = []; // this.sourceIds = [];
} // }
}, },
addCountryFillRange() { addCountryFillRange() {
this.countriesData.forEach((x, i) => { this.countriesData.forEach((x, i) => {
...@@ -485,7 +486,7 @@ export default { ...@@ -485,7 +486,7 @@ export default {
this.map.addLayer({ this.map.addLayer({
id: "world-layer-" + x.MId, id: "world-layer-" + x.MId,
type: "fill", type: "fill",
source: "word-source" + x.MId, source: "word-source",
filter: ["==", "NAME_ZH", x.MName] filter: ["==", "NAME_ZH", x.MName]
}); });
this.map.setPaintProperty("world-layer-" + x.MId, "fill-color", [ this.map.setPaintProperty("world-layer-" + x.MId, "fill-color", [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment