Class RandomPointsInGridBuilder
java.lang.Object
org.locationtech.jts.shape.GeometricShapeBuilder
org.locationtech.jts.shape.random.RandomPointsInGridBuilder
Creates random point sets
where the points are constrained to lie in the cells of a grid.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private boolean
Fields inherited from class org.locationtech.jts.shape.GeometricShapeBuilder
extent, geomFactory, numPts
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a builder which will create shapes using the defaultGeometryFactory
.RandomPointsInGridBuilder
(GeometryFactory geomFact) Create a builder which will create shapes using the givenGeometryFactory
. -
Method Summary
Modifier and TypeMethodDescriptionGets theMultiPoint
containing the generated pointprivate Coordinate
randomPointInCell
(double orgX, double orgY, double xLen, double yLen) private static Coordinate
randomPointInCircle
(double orgX, double orgY, double width, double height) private Coordinate
randomPointInGridCell
(double orgX, double orgY, double xLen, double yLen) void
setConstrainedToCircle
(boolean isConstrainedToCircle) Sets whether generated points are constrained to lie within a circle contained within each grid cell.void
setGutterFraction
(double gutterFraction) Sets the fraction of the grid cell side which will be treated as a gutter, in which no points will be created.Methods inherited from class org.locationtech.jts.shape.GeometricShapeBuilder
createCoord, getCentre, getDiameter, getExtent, getRadius, getSquareBaseLine, getSquareExtent, setExtent, setNumPoints
-
Field Details
-
isConstrainedToCircle
private boolean isConstrainedToCircle -
gutterFraction
private double gutterFraction
-
-
Constructor Details
-
RandomPointsInGridBuilder
public RandomPointsInGridBuilder()Create a builder which will create shapes using the defaultGeometryFactory
. -
RandomPointsInGridBuilder
Create a builder which will create shapes using the givenGeometryFactory
.- Parameters:
geomFact
- the factory to use
-
-
Method Details
-
setConstrainedToCircle
public void setConstrainedToCircle(boolean isConstrainedToCircle) Sets whether generated points are constrained to lie within a circle contained within each grid cell. This provides greater separation between points in adjacent cells.The default is to not be constrained to a circle.
- Parameters:
isConstrainedToCircle
-
-
setGutterFraction
public void setGutterFraction(double gutterFraction) Sets the fraction of the grid cell side which will be treated as a gutter, in which no points will be created. The provided value is clamped to the range [0.0, 1.0].- Parameters:
gutterFraction
-
-
getGeometry
Gets theMultiPoint
containing the generated point- Specified by:
getGeometry
in classGeometricShapeBuilder
- Returns:
- a MultiPoint
-
randomPointInCell
-
randomPointInGridCell
-
randomPointInCircle
private static Coordinate randomPointInCircle(double orgX, double orgY, double width, double height)
-