Browse Source

0.0 修改地图3KM圈,调整接口访问

master
gisnewbie 4 years ago
parent
commit
42448de08b
  1. 106
      pages/look/look.js
  2. 3
      pages/look/look.wxml

106
pages/look/look.js

@ -12,6 +12,7 @@ Page({
latitude: 29.543812,
longitude: 106.434042,
markers: [],
circles:[],
polygons: [],
start: '2015',
end: '2020',
@ -128,62 +129,73 @@ Page({
}, id);
}
break;
case 4:
// MORE
break;
case 5:
// 配套
case 4:
//行政区
if (state) {
this.clearPoint(id);
this.deletPolygon(id);
} else {
this.getComplete({
this.getRegion({
latitude,
longitude
}, id);
}
break;
case 5:
// 大组团
if (state) {
this.deletPolygon(id);
} else {
this.getTypeRegion({
latitude,
longitude
}, id, 1);
}
break;
case 6:
// 环线
// 小组团
if (state) {
this.deletPolygon(id);
} else {
this.getLoop({
this.getTypeRegion({
latitude,
longitude
}, id);
}, id, 0);
}
break;
case 7:
//行政区
case 7:
// 配套
if (state) {
this.deletPolygon(id);
this.clearPoint(id);
} else {
this.getRegion({
this.getComplete({
latitude,
longitude
}, id);
}
break;
case 8:
// 大组团
// 环线
if (state) {
this.deletPolygon(id);
} else {
this.getTypeRegion({
this.getLoop({
latitude,
longitude
}, id, 1);
}, id);
}
break;
case 9:
// 小组团
// 3KM圈
if (state) {
this.deletPolygon(id);
this.clearCircles(id);
} else {
this.getTypeRegion({
let data = [{
latitude,
longitude
}, id, 0);
}];
console.log(data)
this.setCircles(data, id);
}
break;
}
@ -254,7 +266,59 @@ Page({
}
}
},
//设置圆环
setCircles(data, id) {
let {
circles
} = this.data
let makeArr = data.map(item => {
return {
id: item.gid,
aid: id,
latitude: item.latitude,
longitude: item.longitude,
color: '#2317da66',
fillColor: '#7cb5ec88',
radius: 3000,
strokeWidth: 2
}
})
if (circles.length > 0) {
circles = circles.concat(makeArr)
console.log(circles)
this.setData({
circles
})
}else{
circles = makeArr
console.log(circles)
this.setData({
circles
})
}
},
//清除圆环
clearCircles(id) {
let {
circles
} = this.data;
if (circles.length > 0) {
let hasPo = circles.some(item => item.aid === id);
if (hasPo) {
for (let index = 0; index < circles.length; index++) {
if (circles[index].aid === id) {
circles.splice(index, 1);
index--
}
}
console.log('circles', circles);
this.setData({
circles
})
}
}
},
mapTabItem(e) {
let satellite = e.currentTarget.dataset.id
if (satellite !== this.data.satellite) {

3
pages/look/look.wxml

@ -26,7 +26,8 @@
</view>
<map class="map" enable-satellite="{{satellite==1?true:false}}" scale="{{scale}}" markers="{{markers}}"
latitude="{{latitude}}" longitude="{{longitude}}" bindmarkertap="markertap" polygons="{{polygons}}">
latitude="{{latitude}}" longitude="{{longitude}}" bindmarkertap="markertap" polygons="{{polygons}}"
circles = "{{circles}}">
<cover-view class="map-tab">
<cover-view data-id="1" class="map-tab-item {{satellite==1?'active':''}}" bindtap="mapTabItem">卫星图</cover-view>
<cover-view data-id="2" class="map-tab-item {{satellite==2?'active':''}}" bindtap="mapTabItem">平面图</cover-view>

Loading…
Cancel
Save