Package adams.data.geometry
Class GeometryUtils
- java.lang.Object
-
- adams.data.geometry.GeometryUtils
-
public class GeometryUtils extends Object
Utility functions for JTS related geometry operations.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description GeometryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Rectangle
polygonBounds(org.locationtech.jts.geom.Polygon polygon)
Returns the boundaries of the JTS polygon.static org.locationtech.jts.geom.Polygon
scale(org.locationtech.jts.geom.Polygon polygon, double scaleX, double scaleY)
Scales the polygon using the supplied scale factors.static org.locationtech.jts.geom.Polygon
toGeometry(double[] x, double[] y)
Converts the polygon into a JTS polygon (for proper intersects).static org.locationtech.jts.geom.Polygon
toGeometry(int[] x, int[] y)
Converts the polygon into a JTS polygon (for proper intersects).static org.locationtech.jts.geom.Polygon
toGeometry(Polygon polygon)
Converts the polygon into a JTS polygon (for proper intersects).static org.locationtech.jts.geom.Polygon
toGeometry(Rectangle rectangle)
Converts the rectangle into a JTS polygon (for proper intersects).static org.locationtech.jts.geom.Polygon
toGeometry(Number[] x, Number[] y)
Converts the polygon into a JTS polygon (for proper intersects).static Polygon
toPolygon(org.locationtech.jts.geom.Polygon polygon)
Turns the JTS polygon into a AWT one.
-
-
-
Method Detail
-
toGeometry
public static org.locationtech.jts.geom.Polygon toGeometry(Polygon polygon)
Converts the polygon into a JTS polygon (for proper intersects).- Parameters:
polygon
- the AWT polygon to convert- Returns:
- the JTS polygon
-
toGeometry
public static org.locationtech.jts.geom.Polygon toGeometry(Rectangle rectangle)
Converts the rectangle into a JTS polygon (for proper intersects).- Parameters:
rectangle
- the rectangle to convert- Returns:
- the JTS polygon
-
toGeometry
public static org.locationtech.jts.geom.Polygon toGeometry(int[] x, int[] y)
Converts the polygon into a JTS polygon (for proper intersects).- Parameters:
x
- the x coordinatesy
- the y coordinates- Returns:
- the JTS polygon
-
toGeometry
public static org.locationtech.jts.geom.Polygon toGeometry(double[] x, double[] y)
Converts the polygon into a JTS polygon (for proper intersects).- Parameters:
x
- the x coordinatesy
- the y coordinates- Returns:
- the JTS polygon
-
toGeometry
public static org.locationtech.jts.geom.Polygon toGeometry(Number[] x, Number[] y)
Converts the polygon into a JTS polygon (for proper intersects).- Parameters:
x
- the x coordinatesy
- the y coordinates- Returns:
- the JTS polygon
-
polygonBounds
public static Rectangle polygonBounds(org.locationtech.jts.geom.Polygon polygon)
Returns the boundaries of the JTS polygon.- Parameters:
polygon
- the polygon to get the bounds for- Returns:
- the bounds, empty rectangle if failed to compute
-
toPolygon
public static Polygon toPolygon(org.locationtech.jts.geom.Polygon polygon)
Turns the JTS polygon into a AWT one.- Parameters:
polygon
- the JTS polygon to convert- Returns:
- the AWT polygon
-
scale
public static org.locationtech.jts.geom.Polygon scale(org.locationtech.jts.geom.Polygon polygon, double scaleX, double scaleY)
Scales the polygon using the supplied scale factors.- Parameters:
polygon
- the polygon to scalescaleX
- the scale factor for the X axisscaleY
- the scale factor for the Y axis- Returns:
- the scaled polygon
-
-