| | |
| | | window.$message?.warning('禁行区域必须完全处于运营区域内') |
| | | return false |
| | | } |
| | | return true |
| | | const overlapStation = stationData.value.find( |
| | | (station) => Array.isArray(station.polygonPath) && station.polygonPath.length >= 3 && doesPolygonOverlap(points, station.polygonPath) |
| | | ); |
| | | if (overlapStation) { |
| | | window.$message?.warning(`禁行区域不能与场站(${overlapStation.name || "未命名场站"})相交`); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | function startRestrictedAreaDraw(areaId: string) { |
| | |
| | | fenceMouseTool.value = null |
| | | const points = event.obj |
| | | .getPath() |
| | | .map((point: any) => [point.lng, point.lat] as LngLatTuple) |
| | | map.value.remove(event.obj) |
| | | if (points.length < 3) { |
| | | window.$message?.warning('请绘制至少3个点的禁行区') |
| | | setTimeout(() => startRestrictedAreaDraw(areaId), 0) |
| | | return |
| | | } |
| | | if (points.length > 16) { |
| | | window.$message?.warning('禁行区最多支持设置 16 个点位') |
| | | setTimeout(() => startRestrictedAreaDraw(areaId), 0) |
| | | return |
| | | } |
| | | if (isFencePolygonSelfIntersect(points)) { |
| | | window.$message?.warning('禁行区不允许自相交') |
| | | setTimeout(() => startRestrictedAreaDraw(areaId), 0) |
| | | return |
| | | } |
| | | if (calcFenceArea(points) > 81) { |
| | | window.$message?.warning('当前禁行区范围过大,请缩小区域') |
| | | setTimeout(() => startRestrictedAreaDraw(areaId), 0) |
| | | return |
| | | } |
| | | if (!isRingInRing(points, fenceDraftPoints.value)) { |
| | | window.$message?.warning('禁行区域必须完全处于运营区域内') |
| | | setTimeout(() => startRestrictedAreaDraw(areaId), 0) |
| | | return |
| | | .map((point: any) => [point.lng, point.lat] as LngLatTuple); |
| | | map.value.remove(event.obj); |
| | | if (!validateRestrictedAreaGeometry(points)) { |
| | | setTimeout(() => startRestrictedAreaDraw(areaId), 0); |
| | | return; |
| | | } |
| | | const current = fenceRestrictedAreas.value.find( |
| | | item => item.id === areaId, |