|
|
@ -6,6 +6,7 @@ import org.locationtech.jts.geom.Geometry; |
|
|
|
import org.locationtech.jts.geom.GeometryFactory; |
|
|
|
import org.locationtech.jts.geom.GeometryFactory; |
|
|
|
import org.locationtech.jts.geom.LineString; |
|
|
|
import org.locationtech.jts.geom.LineString; |
|
|
|
import org.locationtech.jts.geom.Point; |
|
|
|
import org.locationtech.jts.geom.Point; |
|
|
|
|
|
|
|
import org.locationtech.jts.geom.Polygon; |
|
|
|
import org.locationtech.jts.geom.impl.CoordinateArraySequence; |
|
|
|
import org.locationtech.jts.geom.impl.CoordinateArraySequence; |
|
|
|
import org.locationtech.jts.operation.buffer.BufferOp; |
|
|
|
import org.locationtech.jts.operation.buffer.BufferOp; |
|
|
|
import org.locationtech.jts.operation.buffer.BufferParameters; |
|
|
|
import org.locationtech.jts.operation.buffer.BufferParameters; |
|
|
@ -33,6 +34,7 @@ public class FlightUtils { |
|
|
|
|
|
|
|
|
|
|
|
return bufferCoords; |
|
|
|
return bufferCoords; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean contains(Coordinate[] bufferCoords, Coordinate[] containsPoint) { |
|
|
|
public static boolean contains(Coordinate[] bufferCoords, Coordinate[] containsPoint) { |
|
|
|
|
|
|
|
|
|
|
|
GeometryFactory geometryFactory = new GeometryFactory(); |
|
|
|
GeometryFactory geometryFactory = new GeometryFactory(); |
|
|
@ -47,4 +49,21 @@ public class FlightUtils { |
|
|
|
|
|
|
|
|
|
|
|
return contains; |
|
|
|
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; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|