知道标记是否包含在离子的多边形中
know if a marker is contained within a polygon in ionic
除了寻找解决我问题的代码之外,我还有疑问。是否可以从本机 cordova-plugin-googlemaps
执行此类计算?还是应该从 google 地图导入 javascript 脚本? google 地图功能会在原生 google 地图插件上运行吗?非常感谢
使用poly.containsLocation()
https://github.com/ionic-team/ionic-native-google-maps/tree/master/documents/poly#containslocationlocation-path
marker.on("position_changed").subscribe((params: any[]) => {
let latLng: ILatLng = params[0]; // or marker.getPosition();
let contain: boolean = Poly.containsLocation(position, POLYGON_POINTS);
marker.setIcon(contain ? "blue" : "red");
});
除了寻找解决我问题的代码之外,我还有疑问。是否可以从本机 cordova-plugin-googlemaps
执行此类计算?还是应该从 google 地图导入 javascript 脚本? google 地图功能会在原生 google 地图插件上运行吗?非常感谢
使用poly.containsLocation()
https://github.com/ionic-team/ionic-native-google-maps/tree/master/documents/poly#containslocationlocation-path
marker.on("position_changed").subscribe((params: any[]) => {
let latLng: ILatLng = params[0]; // or marker.getPosition();
let contain: boolean = Poly.containsLocation(position, POLYGON_POINTS);
marker.setIcon(contain ? "blue" : "red");
});