高德地图WEB开发POI搜索结果的点击事件

```

//点击地图上的点标记

AMap.event.addListener(placeSearch,"markerClick",function(e) {

    isOutOfPath(e);

    console.log(e.data.location);//当前marker的经纬度信息

    console.log(e.data.location.lng +',' + e.data.location.lat);

    console.log(e.data.address);//获取当前marker的具体地址信息

    console.log(e.data);//则是包含所有的marker数据

});

//点击panel列表的点标记

AMap.event.addListener(placeSearch,"listElementClick",function(e) {

    isOutOfPath(e);

    console.log(e.data.location);//当前marker的经纬度信息

    console.log(e.data.location.lng +',' + e.data.location.lat);

    console.log(e.data.address);//获取当前marker的具体地址信息

    console.log(e.data);//则是包含所有的marker数据

});

//判断选中的点是否在面内部,polygons为这个变形集合

function isOutOfPath(e){

var point = e.marker.getPosition();

var isPointInRing=false;

for(var j=0;j

if(AMap.GeometryUtil.isPointInRing(point,polygons[j].getPath())){

isPointInRing=true;

}

}

e.marker.setLabel({

content:isPointInRing?'派送范围内部':'超出配送范围',

offset:new AMap.Pixel(20,0)

});

}

/*

* 获取某一类覆盖物

* */

function getAllOverlays(type) {

return map.getAllOverlays(type);

}

```

你可能感兴趣的:(高德地图WEB开发POI搜索结果的点击事件)