```
//點(diǎn)擊地圖上的點(diǎn)標(biāo)記
AMap.event.addListener(placeSearch,"markerClick",function(e) {
? ??isOutOfPath(e);
????console.log(e.data.location);//當(dāng)前marker的經(jīng)緯度信息
? ? console.log(e.data.location.lng +',' + e.data.location.lat);
????console.log(e.data.address);//獲取當(dāng)前marker的具體地址信息
? ? console.log(e.data);//則是包含所有的marker數(shù)據(jù)
});
//點(diǎn)擊panel列表的點(diǎn)標(biāo)記
AMap.event.addListener(placeSearch,"listElementClick",function(e) {
????isOutOfPath(e);
????console.log(e.data.location);//當(dāng)前marker的經(jīng)緯度信息
? ? console.log(e.data.location.lng +',' + e.data.location.lat);
????console.log(e.data.address);//獲取當(dāng)前marker的具體地址信息
? ? console.log(e.data);//則是包含所有的marker數(shù)據(jù)
});
//判斷選中的點(diǎn)是否在面內(nèi)部,polygons為這個(gè)變形集合
function isOutOfPath(e){
var point = e.marker.getPosition();
var isPointInRing=false;
for(var j=0;j<polygons.length;j++){
if(AMap.GeometryUtil.isPointInRing(point,polygons[j].getPath())){
isPointInRing=true;
}
}
e.marker.setLabel({
content:isPointInRing?'派送范圍內(nèi)部':'超出配送范圍',
offset:new AMap.Pixel(20,0)
});
}
/*
* 獲取某一類覆蓋物
* */
function getAllOverlays(type) {
return map.getAllOverlays(type);
}
```