您好,可以使用geometry.intersects();方法实现,主要代码及效果如下:
function addData() {
//点对象
var point = new SuperMap.Geometry.Point(-125, 50);
var pointVector = new SuperMap.Feature.Vector(point);
pointVector.style = {
fillColor: "red",
strokeColor: "yellow",
pointRadius: 6
};
//六边形
var points2 = [
new SuperMap.Geometry.Point(-120, 54.142),
new SuperMap.Geometry.Point(-110, 40),
new SuperMap.Geometry.Point(-120, 25.857),
new SuperMap.Geometry.Point(-140, 25.857),
new SuperMap.Geometry.Point(-150, 40),
new SuperMap.Geometry.Point(-140, 54.142)
],
linearRings = new SuperMap.Geometry.LinearRing(points2),
region = new SuperMap.Geometry.Polygon([linearRings]);
var polygonVector = new SuperMap.Feature.Vector(region);
vector.addFeatures([pointVector, polygonVector]);
var a = region.intersects(point);
console.log(a);
}