地图判断坐标点在区域内部

var checkPoint=dd;
var polygonPoints=kk;
var counter = 0;

var xinters;
var p1, p2;
var pointCount = polygonPoints.length;
p1 = polygonPoints[0];

for (let k = 1; k <= pointCount; k++) {
p2 = polygonPoints[k % pointCount];

if (
checkPoint[0] > Math.min(p1[0], p2[0]) &&checkPoint[0] <= Math.max(p1[0], p2[0])
) {
if (checkPoint[1] <= Math.max(p1[1],p2[1])) {
if (p1[0] != p2[0]) {
xinters =(checkPoint[0] – p1[0])*(p2[1] – p1[1]) /(p2[0] – p1[0]) +p1[1];
if (p1[1] == p2[1] || checkPoint[1] <= xinters) {
counter++;
}
}
}
}
p1 = p2;
}
console.log(counter);
if (counter % 2 == 0) {

} else {
alert(“预计扩散时间”+this.newtime[j]);

break;
}
if(j==this.urls.length-1){
alert(“该点在扩散范围外”);
break;
}

RIPRO主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
免费资源网 » 地图判断坐标点在区域内部

发表评论

提供最优质的资源集合

立即查看 了解详情