Package repast.simphony.gis.util
Class GeometryUtil
java.lang.Object
repast.simphony.gis.util.GeometryUtil
Utilities methods for geometries
- Author:
- Nick Collier, Eric Tatara
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic GeometryUtil.GeometryType
findGeometryType
(Class geomClass) Finds the geometry type of the specified org.locationtech.jts.geom class.static GeometryUtil.GeometryType
findGeometryType
(org.geotools.styling.Style style) Finds the geometry type associated with a style.static GeometryUtil.GeometryType
findGeometryType
(org.locationtech.jts.geom.Geometry geom) Finds the geometry type of the specified geometry.static GeometryUtil.GeometryType
findGeometryType
(org.opengis.feature.simple.SimpleFeature feature) Finds the geometry type of the specified feature.static org.locationtech.jts.geom.Geometry
generateBuffer
(Geography geography, org.locationtech.jts.geom.Geometry geom, double distance) Generates a Geometry that represents a buffer zone around the Geometry geom argument.static List<org.locationtech.jts.geom.Coordinate>
generateRandomPointsInPolygon
(org.locationtech.jts.geom.Geometry mask, int numPoints) Generate a collection of random coordinates that fall within the provided mask geometry.static List<org.locationtech.jts.geom.Coordinate>
generateRandomPointsInPolygon
(org.locationtech.jts.geom.Geometry mask, int numPoints, cern.jet.random.engine.RandomEngine generator) Generate a collection of random coordinates that fall within the provided mask geometry.
-
Constructor Details
-
GeometryUtil
public GeometryUtil()
-
-
Method Details
-
findGeometryType
Finds the geometry type of the specified org.locationtech.jts.geom class.- Parameters:
geom
- the org.locationtech.jts.geom class whose type we want.- Returns:
- the geometry type of the specified org.locationtech.jts.geom class.
-
findGeometryType
Finds the geometry type of the specified geometry.- Parameters:
geom
- the geometry whose type we want.- Returns:
- the geometry type of the specified geometry.
-
findGeometryType
Finds the geometry type associated with a style.- Parameters:
style
- the style to check- Returns:
- the geometry type associated with a style.
-
findGeometryType
public static GeometryUtil.GeometryType findGeometryType(org.opengis.feature.simple.SimpleFeature feature) Finds the geometry type of the specified feature.- Parameters:
feature
- the feature whose type we want.- Returns:
- the geometry type of the specified feature.
-
generateBuffer
public static org.locationtech.jts.geom.Geometry generateBuffer(Geography geography, org.locationtech.jts.geom.Geometry geom, double distance) Generates a Geometry that represents a buffer zone around the Geometry geom argument. An automatic conversion of the geometry CRS is done to UTM if neccessary. The distance argument is in SI meters and represent the distance from the edge of the geometry to the border.- Parameters:
geography
- the geographygeom
- the geometry for which to create a bufferdistance
- the distance in meters between the geometry and the boundary- Returns:
- the buffer geometry
-
generateRandomPointsInPolygon
public static List<org.locationtech.jts.geom.Coordinate> generateRandomPointsInPolygon(org.locationtech.jts.geom.Geometry mask, int numPoints) Generate a collection of random coordinates that fall within the provided mask geometry. The default Repast uniform distribution instance is use for random number generation and can be controlled with the model seed.- Parameters:
mask
- the mask Geometry (border) to enclose random pointsnumPoints
- the number of random points to generate- Returns:
- a collection of random coordinates
-
generateRandomPointsInPolygon
public static List<org.locationtech.jts.geom.Coordinate> generateRandomPointsInPolygon(org.locationtech.jts.geom.Geometry mask, int numPoints, cern.jet.random.engine.RandomEngine generator) Generate a collection of random coordinates that fall within the provided mask geometry. The RandomEngine instance is use for random number generation.- Parameters:
mask
- the mask Geometry (border) to enclose random pointsnumPoints
- the number of random points to generategenerator
- the random generator engine- Returns:
- a collection of random coordinates
-