高德地图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<polygons.length;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);

}

```

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容