当前位置: 首页> 财经> 产业 > 中央农村工作会议12月28日至29日在北京举行会议讨论了_怎么在百度推广自己的网站_在线识图_郑州网站优化公司

中央农村工作会议12月28日至29日在北京举行会议讨论了_怎么在百度推广自己的网站_在线识图_郑州网站优化公司

时间:2025/8/23 19:57:15来源:https://blog.csdn.net/m0_74149462/article/details/142923918 浏览次数:0次
中央农村工作会议12月28日至29日在北京举行会议讨论了_怎么在百度推广自己的网站_在线识图_郑州网站优化公司

利用BMapGLLib中isPointInRect

因为没有找到官方文档因此直接下载了该工具的源码,复制以下部分到自己的项目中,避免再次引用完整的BMapGLLib脚本

 关键方法

    isPointInRect(point, bounds) {if (!(point.toString() === "Point" || point.toString() === "LatLng") ||!(bounds instanceof BMapGL.Bounds)) {return false;}var sw = bounds.getSouthWest(); // 西南脚点var ne = bounds.getNorthEast(); // 东北脚点return (point.lng >= sw.lng &&point.lng <= ne.lng &&point.lat >= sw.lat &&point.lat <= ne.lat);},

使用

   isPointInViewport(params = {}) {const {sw, ne, point} = params;const swGL = new BMapGL.Point(sw.lng, sw.lat);const neGL = new BMapGL.Point(ne.lng, ne.lat);const pointGL = new BMapGL.Point(point.lng, point.lat);if (this.isPointInRect(pointGL, new BMapGL.Bounds(swGL, neGL))) {console.log("在区域内");return true} else {console.log("不再区域内");return false}},searchRadarInViewport(config) {// 参考:// this.bdMap = new BMapGL.Map("map-container"); // 创建Map实例// let bounds = this.bdMap.getBounds(); //获取地图可视区域console.log(config, "config"); // config 是从其他组件接收到的地图boundsthis.isPointInViewport({sw: config.WS,ne: config.EN,point: {lng: 111.75963626067835, lat: 41.57808734176302}})},

关键字:中央农村工作会议12月28日至29日在北京举行会议讨论了_怎么在百度推广自己的网站_在线识图_郑州网站优化公司

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: