Commit 15d32ee4 authored by youjie's avatar youjie

no message

parent 7bdda247
...@@ -299,33 +299,6 @@ export default { ...@@ -299,33 +299,6 @@ export default {
this.drawMap(2); this.drawMap(2);
} }
}, },
// 清除已有源
ClearSource(Id,type){
if(type){
if(this.map.getLayer(Id)) {
this.map.removeLayer(Id);
if(type==2) this.map.removeSource(Id);
}
}else{
this.listCity.forEach((p, i) => {
if (this.map.getLayer("curve-layer-" + p.MId)) {
this.map.removeLayer("curve-layer-" + p.MId);
this.map.removeSource("curve-source-" + p.MId);
}
});
this.countriesData.forEach((x, i) => {
if (this.map && this.map.getLayer("world-layer-" + x.MId)) {
this.map.removeLayer("world-layer-" + x.MId);
}
if (this.map && this.map.getLayer("mapLayer-" + x.MId)) {
this.map.removeLayer("mapLayer-" + x.MId);
}
if (this.map && this.map.getLayer("mapLayerId-" + x.MId)) {
this.map.removeLayer("mapLayerId-" + x.MId);
}
});
}
},
// 组装数据 // 组装数据
UpdateDatas(){ UpdateDatas(){
let listCity = []; let listCity = [];
...@@ -395,6 +368,33 @@ export default { ...@@ -395,6 +368,33 @@ export default {
}); });
console.log(this.countriesData,'------=====') console.log(this.countriesData,'------=====')
}, },
// 清除已有源
ClearSource(Id,type){
if(type){
if(this.map.getLayer(Id)) {
this.map.removeLayer(Id);
if(type==2) this.map.removeSource(Id);
}
}else{
this.listCity.forEach((p, i) => {
if (this.map.getLayer("curve-layer-" + p.MId)) {
this.map.removeLayer("curve-layer-" + p.MId);
this.map.removeSource("curve-source-" + p.MId);
}
});
this.countriesData.forEach((x, i) => {
if (this.map && this.map.getLayer("world-layer-" + x.MId)) {
this.map.removeLayer("world-layer-" + x.MId);
}
if (this.map && this.map.getLayer("mapLayer-" + x.MId)) {
this.map.removeLayer("mapLayer-" + x.MId);
}
if (this.map && this.map.getLayer("mapLayerId-" + x.MId)) {
this.map.removeLayer("mapLayerId-" + x.MId);
}
});
}
},
// 绘制地图 // 绘制地图
async drawMap(type) { async drawMap(type) {
...@@ -711,11 +711,6 @@ export default { ...@@ -711,11 +711,6 @@ export default {
let that = this; let that = this;
let el = document.createElement("div"); let el = document.createElement("div");
el.style.cursor = "pointer"; el.style.cursor = "pointer";
// let html = `<div class='arror-box-map hide' id='marker_${i}' data-x-drift='${item
// .name.length *
// 10}'><span class='top'></span><span class='right'></span><span class='bottom'></span><span class='left'></span><div>`;
// html = `<div style='position:relative'><div>${item.name}</div>${html}</div>`;
// .setLngLat([item.PositionStr.Left?item.PositionStr.Left:item.longitude, item.PositionStr.Right?item.PositionStr.Right:item.latitude])
el.innerHTML = item.name; el.innerHTML = item.name;
var marker = new mapboxgl.Marker(el, { var marker = new mapboxgl.Marker(el, {
offset: [0, -25], offset: [0, -25],
...@@ -726,7 +721,6 @@ export default { ...@@ -726,7 +721,6 @@ export default {
} else { } else {
marker.setLngLat([item.longitude, item.latitude]); marker.setLngLat([item.longitude, item.latitude]);
} }
// marker.setLngLat([item.PositionStr.Left?item.PositionStr.Left:item.longitude, item.PositionStr.Right?item.PositionStr.Right:item.latitude])
marker.addTo(this.map); marker.addTo(this.map);
marker.on("dragend", function() { marker.on("dragend", function() {
let currentMarkerLngLat = marker.getLngLat(); let currentMarkerLngLat = marker.getLngLat();
...@@ -924,7 +918,9 @@ export default { ...@@ -924,7 +918,9 @@ export default {
let currentMarkerLngLat = marker.getLngLat(); let currentMarkerLngLat = marker.getLngLat();
x.Lng = currentMarkerLngLat.lng; x.Lng = currentMarkerLngLat.lng;
x.Lat = currentMarkerLngLat.lat; x.Lat = currentMarkerLngLat.lat;
console.log(that.countriesData,'--------') console.log(x.MName,'=====')
let TripMapList = that.TripMapList.filter(y=>y.MName==x.MName)
console.log(TripMapList,'--------')
}); });
this.countriesMarkers.push(marker); this.countriesMarkers.push(marker);
} }
......
...@@ -1787,5 +1787,13 @@ export default { ...@@ -1787,5 +1787,13 @@ export default {
} }
return uuid.join(""); return uuid.join("");
} }
Vue.prototype.getRandomColor = function () {
var letters = '0123456789ABCDEF';
var color = '#';
for (var i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return 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