Class RandomPointsBuilder
- java.lang.Object
-
- org.locationtech.jts.shape.GeometricShapeBuilder
-
- org.locationtech.jts.shape.random.RandomPointsBuilder
-
public class RandomPointsBuilder extends GeometricShapeBuilder
Creates random point sets contained in a region defined by either a rectangular or a polygonal extent.
-
-
Field Summary
Fields Modifier and Type Field Description private PointOnGeometryLocator
extentLocator
protected Geometry
maskPoly
-
Fields inherited from class org.locationtech.jts.shape.GeometricShapeBuilder
extent, geomFactory, numPts
-
-
Constructor Summary
Constructors Constructor Description RandomPointsBuilder()
Create a shape factory which will create shapes using the defaultGeometryFactory
.RandomPointsBuilder(GeometryFactory geomFact)
Create a shape factory which will create shapes using the givenGeometryFactory
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Coordinate
createCoord(double x, double y)
protected Coordinate
createRandomCoord(Envelope env)
Geometry
getGeometry()
protected boolean
isInExtent(Coordinate p)
void
setExtent(Geometry mask)
Sets a polygonal mask.-
Methods inherited from class org.locationtech.jts.shape.GeometricShapeBuilder
getCentre, getDiameter, getExtent, getRadius, getSquareBaseLine, getSquareExtent, setExtent, setNumPoints
-
-
-
-
Field Detail
-
maskPoly
protected Geometry maskPoly
-
extentLocator
private PointOnGeometryLocator extentLocator
-
-
Constructor Detail
-
RandomPointsBuilder
public RandomPointsBuilder()
Create a shape factory which will create shapes using the defaultGeometryFactory
.
-
RandomPointsBuilder
public RandomPointsBuilder(GeometryFactory geomFact)
Create a shape factory which will create shapes using the givenGeometryFactory
.- Parameters:
geomFact
- the factory to use
-
-
Method Detail
-
setExtent
public void setExtent(Geometry mask)
Sets a polygonal mask.- Parameters:
mask
-- Throws:
java.lang.IllegalArgumentException
- if the mask is not polygonal
-
getGeometry
public Geometry getGeometry()
- Specified by:
getGeometry
in classGeometricShapeBuilder
-
isInExtent
protected boolean isInExtent(Coordinate p)
-
createCoord
protected Coordinate createCoord(double x, double y)
- Overrides:
createCoord
in classGeometricShapeBuilder
-
createRandomCoord
protected Coordinate createRandomCoord(Envelope env)
-
-