|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectGrids
public class Grids
A utility class to create polygonal vector grids with basic attributes. For simple
grids this is the only class you need. For finer control of grid attributes, such
as working with a user-supplied SimpleFeatureType, see the Oblongs
and
Hexagons
utility classes.
Constructor Summary | |
---|---|
Grids()
|
Method Summary | |
---|---|
static SimpleFeatureSource |
createHexagonalGrid(ReferencedEnvelope bounds,
double sideLen)
Creates a vector grid of hexagonal elements. |
static SimpleFeatureSource |
createHexagonalGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing)
Creates a vector grid of hexagonal elements represented by 'densified' polygons. |
static SimpleFeatureSource |
createHexagonalGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing,
GridFeatureBuilder builder)
Creates a vector grid of hexagonal elements represented by 'densified' polygons. |
static SimpleFeatureSource |
createSquareGrid(ReferencedEnvelope bounds,
double sideLen)
Creates a vector grid of square elements. |
static SimpleFeatureSource |
createSquareGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing)
Creates a vector grid of square elements represented by 'densified' polygons. |
static SimpleFeatureSource |
createSquareGrid(ReferencedEnvelope bounds,
double sideLen,
double vertexSpacing,
GridFeatureBuilder builder)
Creates a vector grid of square elements represented by 'densified' polygons. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Grids()
Method Detail |
---|
public static SimpleFeatureSource createSquareGrid(ReferencedEnvelope bounds, double sideLen)
null
coordinate reference system is
permitted.
The grid's origin is the minimum X and Y point of the envelope. If the width and/or height of the bounding envelope is not a simple multiple of the requested side length, there will be some unfilled space.
Each square in the returned grid is represented by a SimpleFeature
.
The feature type has two properties:
bounds
- bounds of the gridsideLen
- the side length of grid elements
IllegalArgumentException
- if bounds is null or empty; or
if sideLen is <=
0public static SimpleFeatureSource createSquareGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing)
vertexSpacing
which specifies the maximum distance
between adjacent vertices. Vertices are added more or less uniformly.
The coordinate reference system is taken from the input bounds.
A null
coordinate reference system is permitted.
The grid's origin is the minimum X and Y point of the envelope. If the width and/or height of the bounding envelope is not a simple multiple of the requested side length, there will be some unfilled space.
Each square in the returned grid is represented by a SimpleFeature
.
The feature type has two properties:
bounds
- bounds of the gridsideLen
- the side length of grid elementsvertexSpacing
- maximum distance between adjacent vertices in a grid
element; if <= 0
or >= sideLen / 2.0
it is ignored
and the polygons will not be densified
IllegalArgumentException
- if bounds is null or empty; or
if sideLen is <=
0public static SimpleFeatureSource createSquareGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing, GridFeatureBuilder builder)
vertexSpacing
which specifies the maximum distance
between adjacent vertices. Vertices are added more or less uniformly.
The coordinate reference system is taken from the GridFeatureBuilder
.
A null
coordinate reference system is permitted but if both the
builder and bounding envelope have non-null
reference systems set
they must be the same.
The grid's origin is the minimum X and Y point of the envelope. If the width and/or height of the bounding envelope is not a simple multiple of the requested side length, there will be some unfilled space.
bounds
- bounds of the gridsideLen
- the side length of grid elementsvertexSpacing
- maximum distance between adjacent vertices in a grid
element; if <= 0
or >= sideLen / 2.0
the polygons
will not be densifiedbuilder
- the GridFeatureBuilder
used to control feature
creation and the setting of feature attribute values
IllegalArgumentException
- if bounds is null or empty; or
if sideLen is <=
0; or
if builder is null; or
if the CoordinateReferenceSystems
set for the bounds and the GridFeatureBuilder
are both
non-null but differentpublic static SimpleFeatureSource createHexagonalGrid(ReferencedEnvelope bounds, double sideLen)
The hexagons created by this method are orientated with a pair of edges
parallel to the top and bottom of the bounding envelope
(org.geotools.grid.hexagon.Hexagon.Orientation#FLAT). The
bounding rectangle of each hexagon has width sideLen * 2.0
and
height sideLen * sqrt(3.0)
.
The grid's origin is the minimum X and Y point of the envelope.
The feature type of grid features has two properties:
bounds
- bounds of the gridsideLen
- the length
IllegalArgumentException
- if bounds is null or empty; or
if sideLen is <=
0public static SimpleFeatureSource createHexagonalGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing)
vertexSpacing
which specifies the maximum distance
between adjacent vertices. Vertices are added more or less uniformly.
Hexagon size is expressed as side length. To create hexagons of specified area you can use the static Hexagons.areaToSideLength(double) method to calculate the equivalent side length.
The hexagons created by this method are orientated with a pair of edges
parallel to the top and bottom of the bounding envelope
(org.geotools.grid.hexagon.Hexagon.Orientation#FLAT). The
bounding rectangle of each hexagon has width sideLen * 2.0
and
height sideLen * sqrt(3.0)
.
The grid's origin is the minimum X and Y point of the envelope.
The feature type of grid features has two properties:
bounds
- bounds of the gridsideLen
- the lengthvertexSpacing
- maximum distance between adjacent vertices in a grid
element; if <= 0
or >= sideLen / 2.0
the polygons
will not be densified
IllegalArgumentException
- if bounds is null or empty; or
if sideLen is <=
0public static SimpleFeatureSource createHexagonalGrid(ReferencedEnvelope bounds, double sideLen, double vertexSpacing, GridFeatureBuilder builder)
vertexSpacing
which specifies the maximum distance
between adjacent vertices. Vertices are added more or less uniformly.
Hexagon size is expressed as side length. To create hexagons of specified area you can use the static Hexagons.areaToSideLength(double) method to calculate the equivalent side length.
The hexagons created by this method are orientated with a pair of edges
parallel to the top and bottom of the bounding envelope
(org.geotools.grid.hexagon.Hexagon.Orientation#FLAT). The
bounding rectangle of each hexagon has width sideLen * 2.0
and
height sideLen * sqrt(3.0)
.
The grid's origin is the minimum X and Y point of the envelope.
The feature type of grid features has two properties:
bounds
- bounds of the gridsideLen
- the lengthvertexSpacing
- maximum distance between adjacent vertices in a grid
element; if <= 0
or >= sideLen / 2.0
the polygons
will not be densifiedbuilder
- the GridFeatureBuilder
used to control feature
creation and the setting of feature attribute values
IllegalArgumentException
- if bounds is null or empty; or
if sideLen is <=
0; or
if builder is null; or
if the CoordinateReferenceSystems
set for the bounds and the GridFeatureBuilder
are both
non-null but different
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |