|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.geom.Rectangle2D.Double
org.geotools.geometry.Envelope2D
public class Envelope2D
A two-dimensional envelope on top of Rectangle2D
. This implementation is provided for
interoperability between Java2D and GeoAPI.
Note: This class inherits x and y fields. But despite their names, they don't need to be oriented toward East and North respectively. The (x,y) axis can have any orientation and should be understood as "ordinate 0" and "ordinate 1" values instead. This is not specific to this implementation; in Java2D too, the visual axis orientation depend on the affine transform in the graphics context.
GeneralEnvelope
,
ReferencedEnvelope
,
GeographicBoundingBox
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D |
---|
java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float |
Field Summary |
---|
Fields inherited from class java.awt.geom.Rectangle2D.Double |
---|
height, width, x, y |
Fields inherited from class java.awt.geom.Rectangle2D |
---|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP |
Constructor Summary | |
---|---|
Envelope2D()
Constructs an initially empty envelope with no CRS. |
|
Envelope2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
double x,
double y,
double width,
double height)
Constructs two-dimensional envelope defined by the specified coordinates. |
|
Envelope2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs,
java.awt.geom.Rectangle2D rect)
Constructs two-dimensional envelope defined by an other Rectangle2D . |
|
Envelope2D(DirectPosition2D minDP,
DirectPosition2D maxDP)
Constructs two-dimensional envelope defined by the specified coordinates. |
|
Envelope2D(org.opengis.geometry.Envelope envelope)
Constructs two-dimensional envelope defined by an other Envelope . |
Method Summary | |
---|---|
boolean |
boundsEquals(org.opengis.geometry.Envelope that,
int xDim,
int yDim,
double eps)
Returns true if this envelope bounds is equals to that envelope
bounds in two specified dimensions. |
boolean |
equals(java.lang.Object object)
Compares the specified object with this envelope for equality. |
double |
getCenter(int dimension)
Deprecated. Renamed as getMedian(int) . |
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)
Deprecated. Renamed as getSpan(int) . |
org.opengis.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 |
getMedian(int dimension)
Returns the median ordinate along the specified dimension. |
double |
getMinimum(int dimension)
Returns the minimal ordinate along the specified dimension. |
double |
getSpan(int dimension)
Returns the envelope span (typically width or height) along the specified dimension. |
org.opengis.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 |
setCoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Set the coordinate reference system in which the coordinate are given. |
java.lang.String |
toString()
Returns a string representation of this envelope. |
Methods inherited from class java.awt.geom.Rectangle2D.Double |
---|
createIntersection, createUnion, getBounds2D, getHeight, getWidth, getX, getY, isEmpty, outcode, setRect, setRect |
Methods inherited from class java.awt.geom.Rectangle2D |
---|
add, add, add, contains, contains, getPathIterator, getPathIterator, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, union |
Methods inherited from class java.awt.geom.RectangularShape |
---|
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.opengis.util.Cloneable |
---|
clone |
Constructor Detail |
---|
public Envelope2D()
public Envelope2D(org.opengis.geometry.Envelope envelope)
Envelope
.
envelope
- The envelope to copy.public Envelope2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs, java.awt.geom.Rectangle2D rect)
Rectangle2D
.
crs
- The coordinate reference system, or null
.rect
- The rectangle to copy.public Envelope2D(org.opengis.referencing.crs.CoordinateReferenceSystem crs, double x, double y, double width, double height)
crs
- The coordinate reference system, or null
.x
- The x minimal value.y
- The y minimal value.width
- The envelope width.height
- The envelope height.public Envelope2D(DirectPosition2D minDP, DirectPosition2D maxDP) throws org.opengis.geometry.MismatchedReferenceSystemException
The minDP
and maxDP
arguments usually contains the minimal and maximal
ordinate values respectively, but this is not mandatory. The ordinates will be rearanged
as needed.
minDP
- The fist position.maxDP
- The second position.
org.opengis.geometry.MismatchedReferenceSystemException
- if the two positions don't use the same CRS.Method Detail |
---|
public final org.opengis.referencing.crs.CoordinateReferenceSystem getCoordinateReferenceSystem()
getCoordinateReferenceSystem
in interface org.opengis.geometry.Envelope
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.geometry.Envelope
public org.opengis.geometry.DirectPosition getLowerCorner()
Envelope
.
getLowerCorner
in interface org.opengis.geometry.Envelope
public org.opengis.geometry.DirectPosition getUpperCorner()
Envelope
.
getUpperCorner
in interface org.opengis.geometry.Envelope
public final double getMinimum(int dimension) throws java.lang.IndexOutOfBoundsException
getMinimum
in interface org.opengis.geometry.Envelope
dimension
- The dimension to query.
java.lang.IndexOutOfBoundsException
- If the given index is out of bounds.public final double getMaximum(int dimension) throws java.lang.IndexOutOfBoundsException
getMaximum
in interface org.opengis.geometry.Envelope
dimension
- The dimension to query.
java.lang.IndexOutOfBoundsException
- If the given index is out of bounds.@Deprecated public final double getCenter(int dimension)
getMedian(int)
.
getCenter
in interface org.opengis.geometry.Envelope
dimension
- The dimension to query.
public final double getMedian(int dimension) throws java.lang.IndexOutOfBoundsException
(getMaximum(dimension) -
getMinimum(dimension)) / 2
.
getMedian
in interface org.opengis.geometry.Envelope
dimension
- The dimension to query.
java.lang.IndexOutOfBoundsException
- If the given index is out of bounds.@Deprecated public final double getLength(int dimension)
getSpan(int)
.
getLength
in interface org.opengis.geometry.Envelope
dimension
- The dimension to query.
public final double getSpan(int dimension) throws java.lang.IndexOutOfBoundsException
getMaximum(dimension) - getMinimum(dimension)
.
getSpan
in interface org.opengis.geometry.Envelope
dimension
- The dimension to query.
java.lang.IndexOutOfBoundsException
- If the given index is out of bounds.public int hashCode()
hashCode
in class java.awt.geom.Rectangle2D
public boolean equals(java.lang.Object object)
equals
in class java.awt.geom.Rectangle2D
object
- The object to compare with this envelope.
true
if the given object is equals to this envelope.public boolean boundsEquals(org.opengis.geometry.Envelope that, int xDim, int yDim, double eps)
true
if this
envelope bounds is equals to that
envelope
bounds in two specified dimensions. The coordinate reference system is not compared, since
it doesn't need to have the same number of dimensions.
that
- The envelope to compare to.xDim
- The dimension of that
envelope to compare to the x dimension
of this
envelope.yDim
- The dimension of that
envelope to compare to the y dimension
of this
envelope.eps
- A small tolerance number for floating point number comparaisons. This value will
be scaled according this envelope width and
height.
true
if the envelope bounds are the same (up to the specified tolerance
level) in the specified dimensions, or false
otherwise.public java.lang.String toString()
CoordinateFormat
.
toString
in class java.awt.geom.Rectangle2D.Double
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |