Browse Source

overlaps util 추가

feature/auth
박재우 2 years ago
parent
commit
14848f08e2
  1. 19
      src/main/java/com/palnet/comn/utils/FlightUtils.java

19
src/main/java/com/palnet/comn/utils/FlightUtils.java

@ -6,6 +6,7 @@ import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.LineString;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.geom.impl.CoordinateArraySequence;
import org.locationtech.jts.operation.buffer.BufferOp;
import org.locationtech.jts.operation.buffer.BufferParameters;
@ -33,6 +34,7 @@ public class FlightUtils {
return bufferCoords;
}
public static boolean contains(Coordinate[] bufferCoords, Coordinate[] containsPoint) {
GeometryFactory geometryFactory = new GeometryFactory();
@ -47,4 +49,21 @@ public class FlightUtils {
return contains;
}
public static boolean overlaps(Coordinate[] bufferCoords, Coordinate[] overlapCoords) {
GeometryFactory geometryFactory = new GeometryFactory();
Polygon bufferPoly = geometryFactory.createPolygon(bufferCoords);
Polygon overPoly = geometryFactory.createPolygon(overlapCoords);
Geometry geoBuffer = geometryFactory.createGeometry(bufferPoly);
Geometry geoOver = geometryFactory.createGeometry(overPoly);
boolean overlaps = geoBuffer.overlaps(geoOver);
return overlaps;
}
}

Loading…
Cancel
Save