|
|
|
@ -10,6 +10,7 @@ import com.palnet.comn.exception.CustomException;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
import org.locationtech.jts.geom.Coordinate; |
|
|
|
|
import org.locationtech.jts.geom.GeometryFactory; |
|
|
|
|
import org.locationtech.jts.geom.Point; |
|
|
|
|
import org.locationtech.jts.geom.Polygon; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
@ -143,11 +144,13 @@ public class BasFlightService {
|
|
|
|
|
if("CIRCLE".equals(area.getAreaType())) { |
|
|
|
|
effectiveCoordBufferList = areaUtils.createCircle(effectiveCoordList.get(0), area.getBufferZone()); |
|
|
|
|
} |
|
|
|
|
effectiveCoordBufferList.add(effectiveCoordBufferList.get(0)); |
|
|
|
|
|
|
|
|
|
// 유효한 비행구역 검증하기.
|
|
|
|
|
for(BasFlightPlanAreaModel rqArea : rq.getAreaList()) { |
|
|
|
|
boolean checking = false; |
|
|
|
|
boolean overlapCheck = false; |
|
|
|
|
boolean overlapCheck2 = false; |
|
|
|
|
boolean containCheck = false; |
|
|
|
|
boolean containCheck2 = false; |
|
|
|
|
List<Coordinate> rqCoord = new ArrayList<>(); |
|
|
|
|
List<Coordinate> rqCoordBufferList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
@ -167,13 +170,25 @@ public class BasFlightService {
|
|
|
|
|
if("CIRCLE".equals(rqArea.getAreaType())) { |
|
|
|
|
rqCoordBufferList = areaUtils.createCircle(rqCoord.get(0), rqArea.getBufferZone()); |
|
|
|
|
} |
|
|
|
|
rqCoordBufferList.add(rqCoordBufferList.get(0)); |
|
|
|
|
|
|
|
|
|
//검증
|
|
|
|
|
checking = areaUtils.overlaps(rqCoordBufferList, effectiveCoordBufferList); |
|
|
|
|
if(checking) { |
|
|
|
|
|
|
|
|
|
overlapCheck = areaUtils.overlaps(rqCoordBufferList, effectiveCoordBufferList); |
|
|
|
|
overlapCheck2 = areaUtils.overlaps(effectiveCoordBufferList, rqCoordBufferList); |
|
|
|
|
if(overlapCheck || overlapCheck2) { |
|
|
|
|
throw new CustomException(ErrorCode.PLAN_DATA_DUPLICATE); |
|
|
|
|
} |
|
|
|
|
for(Coordinate coord : effectiveCoordBufferList) { |
|
|
|
|
containCheck = areaUtils.contains(rqCoordBufferList, coord); |
|
|
|
|
if(containCheck) { |
|
|
|
|
throw new CustomException(ErrorCode.PLAN_DATA_DUPLICATE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(Coordinate coord : rqCoordBufferList) { |
|
|
|
|
containCheck2 = areaUtils.contains(effectiveCoordBufferList , coord); |
|
|
|
|
if(containCheck2) { |
|
|
|
|
throw new CustomException(ErrorCode.PLAN_DATA_DUPLICATE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|