Commit 15d32ee4 authored by youjie's avatar youjie

no message

parent 7bdda247
......@@ -299,33 +299,6 @@ export default {
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(){
let listCity = [];
......@@ -395,6 +368,33 @@ export default {
});
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) {
......@@ -711,11 +711,6 @@ export default {
let that = this;
let el = document.createElement("div");
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;
var marker = new mapboxgl.Marker(el, {
offset: [0, -25],
......@@ -726,7 +721,6 @@ export default {
} else {
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.on("dragend", function() {
let currentMarkerLngLat = marker.getLngLat();
......@@ -924,7 +918,9 @@ export default {
let currentMarkerLngLat = marker.getLngLat();
x.Lng = currentMarkerLngLat.lng;
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);
}
......
......@@ -1787,5 +1787,13 @@ export default {
}
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