Browse Source

feat: 드론원스탑 API에서 제한구역 산출

pull/19/head
지대한 2 months ago
parent
commit
faa830cd02
  1. 37
      pav-server/src/main/java/com/palnet/biz/api/external/service/DronOneStopService.java

37
pav-server/src/main/java/com/palnet/biz/api/external/service/DronOneStopService.java vendored

@ -1,5 +1,6 @@
package com.palnet.biz.api.external.service; package com.palnet.biz.api.external.service;
import com.palnet.biz.api.bas.dos.model.LimitZoneType;
import com.palnet.biz.api.external.model.ApprovalCd; import com.palnet.biz.api.external.model.ApprovalCd;
import com.palnet.biz.api.external.model.DosApprovalResult; import com.palnet.biz.api.external.model.DosApprovalResult;
import com.palnet.biz.api.external.model.DosPlanRq; import com.palnet.biz.api.external.model.DosPlanRq;
@ -222,7 +223,35 @@ public class DronOneStopService {
result.setApprovalCd(ApprovalCd.APPROVAL); result.setApprovalCd(ApprovalCd.APPROVAL);
} }
Double allowRadiusDouble = calculateAllowRadius(duplicatedAirspaces, centerPoint);
GeometryFactory geometryFactory = new GeometryFactory();
Point centerGeometry = geometryFactory.createPoint(centerPoint);
// 제한 구역 체크
duplicatedAirspaces.forEach(airspace -> {
});
// 제한 구역
for (AirspaceUtils.FeatureInfo checkAirspace : duplicatedAirspaces) {
Geometry airspaceGeometry = checkAirspace.getGeometry();
if (!airspaceGeometry.contains(centerGeometry)) {
continue;
}
if ("0003".equals(checkAirspace.getType())) {
// 0003: 원추
result.setLimitZone(LimitZoneType.HORIZONTAL_SURFACE.getCode());
break;
} else if ("0006".equals(checkAirspace.getType())) {
// 0006: 수평
result.setLimitZone(LimitZoneType.CONICAL_SURFACE.getCode());
break;
}
}
Double allowRadiusDouble = calculateAllowRadius(duplicatedAirspaces, centerGeometry);
Long allowRadius = allowRadiusDouble != null ? (long) Math.floor(allowRadiusDouble) : null; Long allowRadius = allowRadiusDouble != null ? (long) Math.floor(allowRadiusDouble) : null;
Long reqRadius = allowRadius != null ? (long) Math.floor(allowRadius / 10.0) * 10 : null; Long reqRadius = allowRadius != null ? (long) Math.floor(allowRadius / 10.0) * 10 : null;
result.setAllowRadius(allowRadius); result.setAllowRadius(allowRadius);
@ -231,7 +260,7 @@ public class DronOneStopService {
} }
private Double calculateAllowRadius(List<AirspaceUtils.FeatureInfo> duplicatedAirspaces, Coordinate centerPoint) { private Double calculateAllowRadius(List<AirspaceUtils.FeatureInfo> duplicatedAirspaces, Point centerGeometry) {
if (duplicatedAirspaces == null || duplicatedAirspaces.isEmpty()) { if (duplicatedAirspaces == null || duplicatedAirspaces.isEmpty()) {
return null; return null;
} }
@ -240,10 +269,6 @@ public class DronOneStopService {
return null; return null;
} }
Double minDistance = null; Double minDistance = null;
// 중심 Geometry
GeometryFactory geometryFactory = new GeometryFactory();
Point centerGeometry = geometryFactory.createPoint(centerPoint);
for (AirspaceUtils.FeatureInfo airspace : duplicatedAirspaces) { for (AirspaceUtils.FeatureInfo airspace : duplicatedAirspaces) {
// 수평 타입의 airspace만 해당 // 수평 타입의 airspace만 해당

Loading…
Cancel
Save