|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.geometry.GeneralEnvelope
A minimum bounding box or rectangle. Regardless of dimension, an Envelope
can
be represented without ambiguity as two direct positions (coordinate points). To encode an
Envelope
, it is sufficient to encode these two points. This is consistent with
all of the data types in this specification, their state is represented by their publicly
accessible attributes.
This particular implementation of Envelope
is said "General" because it
uses coordinates of an arbitrary dimension.
Constructor Summary | |
GeneralEnvelope(double[] minCP,
double[] maxCP)
Constructs a envelope defined by two positions. |
|
GeneralEnvelope(double min,
double max)
Constructs one-dimensional envelope defined by a range of values. |
|
GeneralEnvelope(org.opengis.spatialschema.geometry.Envelope envelope)
Constructs a new envelope with the same data than the specified envelope. |
|
GeneralEnvelope(GeneralDirectPosition minCP,
GeneralDirectPosition maxCP)
Constructs a envelope defined by two positions. |
|
GeneralEnvelope(int dimension)
Constructs an empty envelope of the specified dimension. |
|
GeneralEnvelope(java.awt.geom.Rectangle2D rect)
Constructs two-dimensional envelope defined by a Rectangle2D . |
Method Summary | |
void |
add(GeneralDirectPosition position)
Adds a point to this envelope. |
void |
add(GeneralEnvelope envelope)
Adds an envelope object to this envelope. |
java.lang.Object |
clone()
Returns a deep copy of this envelope. |
boolean |
contains(GeneralDirectPosition position)
Tests if a specified coordinate is inside the boundary of this envelope. |
boolean |
equals(java.lang.Object object)
Compares the specified object with this envelope for equality. |
double |
getCenter(int dimension)
Returns the center ordinate along the specified dimension. |
org.opengis.referencing.crs.CoordinateReferenceSystem |
getCoordinateReferenceSystem()
Returns the coordinate reference system in which the coordinates are given. |
int |
getDimension()
Returns the number of dimensions. |
double |
getLength(int dimension)
Returns the envelope length along the specified dimension. |
org.opengis.spatialschema.geometry.DirectPosition |
getLowerCorner()
A coordinate position consisting of all the minimal ordinates for each dimension for all points within the Envelope . |
double |
getMaximum(int dimension)
Returns the maximal ordinate along the specified dimension. |
double |
getMinimum(int dimension)
Returns the minimal ordinate along the specified dimension. |
GeneralEnvelope |
getReducedEnvelope(int lower,
int upper)
Returns a new envelope with the same values than this envelope minus the specified range of dimensions. |
GeneralEnvelope |
getSubEnvelope(int lower,
int upper)
Returns a new envelope that encompass only some dimensions of this envelope. |
org.opengis.spatialschema.geometry.DirectPosition |
getUpperCorner()
A coordinate position consisting of all the maximal ordinates for each dimension for all points within the Envelope . |
int |
hashCode()
Returns a hash value for this envelope. |
void |
intersect(GeneralEnvelope envelope)
Set this envelope to the intersection if this envelope with the specified one. |
boolean |
isEmpty()
Determines whether or not this envelope is empty. |
void |
setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Set the coordinate reference system in which the coordinate are given. |
void |
setRange(int dimension,
double minimum,
double maximum)
Set the envelope's range along the specified dimension. |
java.awt.geom.Rectangle2D |
toRectangle2D()
Returns a Rectangle2D with the same bounds as this Envelope .
|
java.lang.String |
toString()
Returns a string representation of this envelope. |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public GeneralEnvelope(org.opengis.spatialschema.geometry.Envelope envelope)
public GeneralEnvelope(int dimension)
public GeneralEnvelope(double min, double max)
min
- The minimal value.max
- The maximal value.public GeneralEnvelope(double[] minCP, double[] maxCP) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
minCP
- Minimum ordinate values.maxCP
- Maximum ordinate values.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the two positions don't have the same dimension.
java.lang.IllegalArgumentException
- if an ordinate value in the minimum point is not
less than or equal to the corresponding ordinate value in the maximum point.public GeneralEnvelope(GeneralDirectPosition minCP, GeneralDirectPosition maxCP) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
minCP
- Point containing minimum ordinate values.maxCP
- Point containing maximum ordinate values.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the two positions don't have the same dimension.
java.lang.IllegalArgumentException
- if an ordinate value in the minimum point is not
less than or equal to the corresponding ordinate value in the maximum point.public GeneralEnvelope(java.awt.geom.Rectangle2D rect)
Rectangle2D
.
Method Detail |
public final org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
null
.public void setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
crs
- The new coordinate reference system, or null
.public final int getDimension()
getDimension
in interface org.opengis.spatialschema.geometry.Envelope
public org.opengis.spatialschema.geometry.DirectPosition getLowerCorner()
Envelope
.
getLowerCorner
in interface org.opengis.spatialschema.geometry.Envelope
public org.opengis.spatialschema.geometry.DirectPosition getUpperCorner()
Envelope
.
getUpperCorner
in interface org.opengis.spatialschema.geometry.Envelope
public final double getMinimum(int dimension)
getMinimum
in interface org.opengis.spatialschema.geometry.Envelope
public final double getMaximum(int dimension)
getMaximum
in interface org.opengis.spatialschema.geometry.Envelope
public final double getCenter(int dimension)
getCenter
in interface org.opengis.spatialschema.geometry.Envelope
public final double getLength(int dimension)
getLength
in interface org.opengis.spatialschema.geometry.Envelope
public void setRange(int dimension, double minimum, double maximum)
dimension
- The dimension to set.minimum
- The minimum value along the specified dimension.maximum
- The maximum value along the specified dimension.public void add(GeneralDirectPosition position) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
contains(org.geotools.geometry.GeneralDirectPosition)
with the
added point as an argument will return true
, except if one of
the point's ordinates was Double.NaN
(in which case the corresponding
ordinate have been ignored).
position
- The point to add.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the specified point doesn't have
the expected dimension.public void add(GeneralEnvelope envelope) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
Envelope
objects.
envelope
- the Envelope
to add to this envelope.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the specified envelope doesn't
have the expected dimension.public boolean contains(GeneralDirectPosition position) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
position
- The point to text.
true
if the specified coordinates are inside the boundary
of this envelope; false
otherwise.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the specified point doesn't have
the expected dimension.public void intersect(GeneralEnvelope envelope) throws org.opengis.spatialschema.geometry.MismatchedDimensionException
envelope
- the Envelope
to intersect to this envelope.
org.opengis.spatialschema.geometry.MismatchedDimensionException
- if the specified envelope doesn't
have the expected dimension.public boolean isEmpty()
public GeneralEnvelope getSubEnvelope(int lower, int upper) throws java.lang.IndexOutOfBoundsException
lower
and extending to dimension upper-1
.
Thus the dimension of the subenvelope is upper-lower
.
lower
- The first dimension to copy, inclusive.upper
- The last dimension to copy, exclusive.
java.lang.IndexOutOfBoundsException
- if an index is out of bounds.public GeneralEnvelope getReducedEnvelope(int lower, int upper) throws java.lang.IndexOutOfBoundsException
lower
- The first dimension to omit, inclusive.upper
- The last dimension to omit, exclusive.
java.lang.IndexOutOfBoundsException
- if an index is out of bounds.public java.awt.geom.Rectangle2D toRectangle2D() throws java.lang.IllegalStateException
Rectangle2D
with the same bounds as this Envelope
.
This is a convenience method for interoperability with Java2D.
java.lang.IllegalStateException
- if this envelope is not two-dimensional.public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object object)
public java.lang.Object clone()
clone
in interface org.opengis.util.Cloneable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |