Compare commits
No commits in common. "8ae56fc5e90edca37ef64eae73e7ce4840b8710e" and "6cab60a239ce6d21b8176f55d2ab667fc8bba82f" have entirely different histories.
8ae56fc5e9
...
6cab60a239
@ -24,9 +24,8 @@ const mapMixinLand = {
|
|||||||
{
|
{
|
||||||
id: '03',
|
id: '03',
|
||||||
landPath:
|
landPath:
|
||||||
[
|
["99.853174,24.424073|99.850256,24.426105|99.855749,24.426731|99.880812,24.421885",
|
||||||
"99.853174,24.424073|99.850256,24.426105|99.855749,24.426731|99.880812,24.421885",
|
|
||||||
"99.8587581,24.4150345|99.8603841,24.4127477|99.8581922,24.4129616"
|
|
||||||
],
|
],
|
||||||
fillColor: '#ba8ae3', fillOpacity: 0.8, strokeColor: "#ba8ae3", strokeWeight: 1, strokeOpacity: 0.8,
|
fillColor: '#ba8ae3', fillOpacity: 0.8, strokeColor: "#ba8ae3", strokeWeight: 1, strokeOpacity: 0.8,
|
||||||
},
|
},
|
||||||
@ -113,16 +112,25 @@ const mapMixinLand = {
|
|||||||
if(areaList.length>0){
|
if(areaList.length>0){
|
||||||
areaList.forEach((item) => {
|
areaList.forEach((item) => {
|
||||||
if (item.landPath) {
|
if (item.landPath) {
|
||||||
if (item.landPath && item.landPath.length && item.landPath.length > 0) {
|
|
||||||
|
|
||||||
item.landPath.forEach((k) => {
|
|
||||||
const path = [];
|
const path = [];
|
||||||
const pointList = [];
|
const pointList = [];
|
||||||
|
if( item.landPath && item.landPath.length && item.landPath.length>0){
|
||||||
|
item.landPath.forEach((k)=>{
|
||||||
k.split('|').forEach((point) => {
|
k.split('|').forEach((point) => {
|
||||||
path.push(new this.AMap.LngLat(point.split(',')[0], point.split(',')[1]));
|
path.push(new this.AMap.LngLat(point.split(',')[0], point.split(',')[1]));
|
||||||
pointList.push([Number(point.split(',')[0]), Number(point.split(',')[1])]);
|
pointList.push([Number(point.split(',')[0]), Number(point.split(',')[1])]);
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
let colorVal='';
|
||||||
|
if(options && options.length>0){
|
||||||
|
let indexF=options.findIndex((m)=>{
|
||||||
|
return m.id==item.id
|
||||||
|
})
|
||||||
|
colorVal=indexF>-1 ? options[indexF].color : ''
|
||||||
|
}
|
||||||
const polygon = new this.AMap.Polygon({
|
const polygon = new this.AMap.Polygon({
|
||||||
path: path,
|
path: path,
|
||||||
fillColor:colorVal|| item.fillColor,
|
fillColor:colorVal|| item.fillColor,
|
||||||
@ -134,7 +142,6 @@ const mapMixinLand = {
|
|||||||
...item,
|
...item,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
polygon.on('click', (e) => {
|
polygon.on('click', (e) => {
|
||||||
this.createInfoWindow(e);
|
this.createInfoWindow(e);
|
||||||
});
|
});
|
||||||
@ -143,41 +150,24 @@ const mapMixinLand = {
|
|||||||
if(type==false){
|
if(type==false){
|
||||||
overlayGroupNew.push(polygon)
|
overlayGroupNew.push(polygon)
|
||||||
}
|
}
|
||||||
|
// 添加地块名称
|
||||||
|
label.push(
|
||||||
|
new this.AMap.Text({
|
||||||
|
text: item.landName ? item.landName : '名称',
|
||||||
|
anchor: 'center',
|
||||||
|
position: this.getAreaCenter(pointList),
|
||||||
|
style: {
|
||||||
|
background: 'transparent',
|
||||||
|
color: '#fff',
|
||||||
|
border: 'none',
|
||||||
|
fontSize: '16px',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
let colorVal = '';
|
|
||||||
if (options && options.length > 0) {
|
|
||||||
let indexF = options.findIndex((m) => {
|
|
||||||
return m.id == item.id
|
|
||||||
})
|
|
||||||
colorVal = indexF > -1 ? options[indexF].color : ''
|
|
||||||
}
|
|
||||||
// const polygon = new this.AMap.Polygon({
|
|
||||||
// path: path,
|
|
||||||
// fillColor:colorVal|| item.fillColor,
|
|
||||||
// fillOpacity: item.fillOpacity,
|
|
||||||
// strokeColor:colorVal || '',
|
|
||||||
// strokeWeight: colorVal|| item.fillColor,
|
|
||||||
// strokeOpacity: item.strokeOpacity,
|
|
||||||
// extData: {
|
|
||||||
// ...item,
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// polygon.on('click', (e) => {
|
|
||||||
// this.createInfoWindow(e);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// this.overlayGroup.push(polygon);
|
|
||||||
// if(type==false){
|
|
||||||
// overlayGroupNew.push(polygon)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// this.map.add(new this.AMap.OverlayGroup(label));
|
||||||
if (type) {
|
if (type) {
|
||||||
if(this.overlayGroup.length>0){
|
if(this.overlayGroup.length>0){
|
||||||
this.map.add(new this.AMap.OverlayGroup(this.overlayGroup));
|
this.map.add(new this.AMap.OverlayGroup(this.overlayGroup));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user