public final class Envelope extends Object implements Serializable
Envelope is to identify the minimum and maximum x,y
coordinate values from all the DirectPositions in a geometry.
The extents of the Envelope are the difference in value between the minimum and maximum
x,y values.
An empty Envelope, e.g. one that has been instantiated
using Envelope.Envelope(SpatialInfo), does not enclose any DirectPositions and
thus has all empty x,y extents. An empty extent has no value, in particular
it is not 0 which is a valid extent value. The methods to get extents,
Envelope.getExtentX() and Envelope.getExtentY() throw a
InvalidGeometryOperationException when that extent is empty as there is no legitimate value to return.
If the methods Envelope.getLowerLeft() and Envelope.getUpperRight()
are called on an empty Envelope, they return DirectPositions with all x,y initialized to
Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY respectively.| Constructor and Description |
|---|
Envelope(com.mapinfo.midev.geometry.DirectPosition dp1,
com.mapinfo.midev.geometry.DirectPosition dp2,
SpatialInfo spatialInfo)
Create an
Envelope given two direct positions and a coordinate system. |
Envelope(double x1,
double y1,
double x2,
double y2,
SpatialInfo spatialInfo)
Create an
Envelope given two x,y values and a coordinate system. |
Envelope(Envelope e)
Create an Envelope as a copy of another
Envelope. |
Envelope(SpatialInfo spatialInfo)
Create an empty
Envelope. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(com.mapinfo.midev.geometry.DirectPosition dp)
Returns
true if this Envelope contains the location as represented in the specified
DirectPosition; false if not. |
boolean |
contains(Envelope env)
Returns
true if this Envelope contains the specified Envelope;
false if not. |
boolean |
equals(Object obj) |
void |
expand(double deltaX,
double deltaY)
Move the x,y sides of this
Envelope toward or away from each other. |
void |
extend(com.mapinfo.midev.geometry.DirectPosition dp)
Enlarge this
Envelope, if necessary, to include the specified position. |
void |
extend(double x,
double y)
Enlarge this
Envelope, if necessary, to include the specified x,y coordinates. |
void |
extend(Envelope e)
Enlarge this
Envelope, if necessary, to include the specified Envelope. |
void |
extend(IDirectPositionList dpl)
Enlarge this
Envelope, if necessary, to include the DirectPositions in the given list. |
com.mapinfo.midev.geometry.DirectPosition |
getCenter()
Returns the center of the
Envelope. |
Envelope |
getCopy()
Returns a copy of this
Envelope. |
Envelope |
getCopy(SpatialInfo spatialInfo)
Returns a copy of this
Envelope but with the coordinates transformed into the specified
SpatialInfo. |
double |
getExtentX()
Returns the span of this
Envelope in the x direction. |
double |
getExtentY()
Returns the span of this
Envelope in the y direction. |
Envelope |
getIntersection(Envelope e)
Returns an
Envelope that represents the intersection of the specified Envelope with this
Envelope. |
double |
getLLX()
Returns the x value of the lower left corner of this
Envelope. |
double |
getLLY()
Returns the y value of the lower left corner of this
Envelope. |
com.mapinfo.midev.geometry.DirectPosition |
getLowerLeft()
Returns the lower-left corner of the
Envelope. |
SpatialInfo |
getSpatialInfo()
Returns the
Envelope's spatial metadata. |
com.mapinfo.midev.geometry.DirectPosition |
getUpperRight()
Returns the upper-right corner of the
Envelope. |
double |
getURX()
Returns the x value of the upper right corner of this
Envelope. |
double |
getURY()
Returns the y value of the upper right corner of this
Envelope. |
int |
hashCode() |
boolean |
intersects(Envelope e)
Returns
true if the specified Envelope intersects this Envelope;
false otherwise. |
boolean |
isEmpty()
Returns
true if this Envelope is empty; false if not. |
void |
offset(double deltaX,
double deltaY)
Translate this
Envelope in the x and y directions by the given deltas. |
void |
scale(double scaleX,
double scaleY)
Expand or contract the extents of the
Envelope by the given scale factors. |
void |
set(com.mapinfo.midev.geometry.DirectPosition dp1,
com.mapinfo.midev.geometry.DirectPosition dp2)
Reinitialize this
Envelope with the two given DirectPositions. |
void |
set(double x1,
double y1,
double x2,
double y2)
Reinitialize this
Envelope with the two given x,y values. |
void |
setEmpty()
Re-initialize this
Envelope to be empty. |
void |
setEmpty(SpatialInfo spatialInfo)
Re-initialize this envelope to be empty and to have the given spatial metadata.
|
String |
toString() |
public Envelope(SpatialInfo spatialInfo)
Envelope.spatialInfo - spatial metadata of the extends represented by this envelope. Cannot be null.IllegalArgumentException - if the specified spatialInfo is null.public Envelope(Envelope e)
Envelope.e - the envelope to copy.IllegalArgumentException - if the specified Envelope is null.public Envelope(com.mapinfo.midev.geometry.DirectPosition dp1,
com.mapinfo.midev.geometry.DirectPosition dp2,
SpatialInfo spatialInfo)
Envelope given two direct positions and a coordinate system.
The individual x and y coordinates in dp1 and dp2 are analyzed to find the min and max
x and y values that are used to define the lower left and upper right corners
of the resulting envelope. This constructor has the same behavior as:
Envelope e = new Envelope(csys); e.extend(dp1); e.extend(dp2);
dp1 - first direct position.dp2 - second direct positions.spatialInfo - spatial metadata of the extends represented by this envelope. Cannot be null.IllegalArgumentException - if the specified SpatialInfo is null.public Envelope(double x1,
double y1,
double x2,
double y2,
SpatialInfo spatialInfo)
Envelope given two x,y values and a coordinate system.
The individual x,y coordinates are analyzed to find the min and max
x and y values that are used to define the lower left and upper right corners
of the resulting envelope. This constructor has the same behavior as:
Envelope e = new Envelope(csys); e.extend(x1, y1); e.extend(x2, y2);
x1 - first x valuey1 - first y valuex2 - second x valuey2 - second y valuespatialInfo - spatial metadata of the extends represented by this envelope. Cannot be null.IllegalArgumentException - if the specified SpatialInfo is null.public void set(com.mapinfo.midev.geometry.DirectPosition dp1,
com.mapinfo.midev.geometry.DirectPosition dp2)
Envelope with the two given DirectPositions.
The individual x and y ordinates in dp1 and dp2 are analyzed to find the min and max
x and y ordinate that are used to define the lower left and upper right corners
of the resulting envelope. This method has the same behavior as:
e.setEmpty(); e.extend(dp1); e.extend(dp2);
dp1 - first DirectPosition.dp2 - second DirectPosition.public void set(double x1,
double y1,
double x2,
double y2)
Envelope with the two given x,y values.
The individual x,y coordinates are analyzed to find the min and max
x and y values that are used to define the lower left and upper right corners
of the resulting envelope. This method has the same behavior as:
e.setEmpty(); e.extend(x1,y1); e.extend(x2,y2);
x1 - first x valuey1 - first y valuex2 - second x valuey2 - second y valuepublic void offset(double deltaX,
double deltaY)
Envelope in the x and y directions by the given deltas.deltaX - +/- offset in the x directiondeltaY - +/- offset in the y directionpublic void expand(double deltaX,
double deltaY)
throws InvalidGeometryOperationException
Envelope toward or away from each other.
The effect of this method is to subtract the deltas from the lower left (LL)
and add the deltas to the upper right (UR).
LLX = LLX - deltaX LLY = LLY - deltaY URX = URX + deltaX URY = URY + deltaYDepending on the sign of the deltas, the sides of the
Envelope will move
away from each other or toward each other. For example, if both deltas are positive the sides
move apart. If both deltas are negative the sides move together. The center of the Envelope
does not change.
Throws InvalidGeometryOperationException if either delta is negative and its absolute value is greater than
half the envelope extent for that delta direction. This condition would cause the opposite sides of the
envelope to move "behind" each other.deltaX - +/- expansion in the x directiondeltaY - +/- expansion in the y directionInvalidGeometryOperationException - if either delta is negative and its absolute value is greater than
half the envelope extend for that direction.Envelope.getExtentX(),
Envelope.getExtentY(),
Envelope.expand(double,double,double),
Envelope.scale(double,double)public void scale(double scaleX,
double scaleY)
throws InvalidGeometryOperationException
Envelope by the given scale factors.
The extents are changed as follows:
newExtentX = extentX + extentX * scaleX; newExtentY = extentY + extentY * scaleY;Scale factor > 0 causes that extent to expand equally in both directions.
InvalidGeometryOperationException if scaleX < -1.0 or scaleY < -1.0 as this condition
would cause the resulting Envelope to have a negative extent.
scaleX - the x scale factor, must be => -1.0scaleY - the y scale factor, must be => -1.0InvalidGeometryOperationException - if scaleX < -1.0 or scaleY < -1.0Envelope.getExtentX(),
Envelope.getExtentY(),
Envelope.expand(double,double)public Envelope getCopy()
Envelope. Changes to the copy are not reflected in this Envelope and vise-versa.Envelope.public Envelope getCopy(SpatialInfo spatialInfo)
Envelope but with the coordinates transformed into the specified
SpatialInfo. Changes to the copy are not reflected in this Envelope and vise-versa.Envelope but with the coordinates transformed into the specified
SpatialInfo.public void extend(Envelope e)
Envelope, if necessary, to include the specified Envelope. No change if e is
empty.e - the Envelope to enlarge by.public void extend(com.mapinfo.midev.geometry.DirectPosition dp)
Envelope, if necessary, to include the specified position.dp - the DirectPosition to include.public void extend(double x,
double y)
Envelope, if necessary, to include the specified x,y coordinates.x - x coordinatey - y coordinateEnvelope.extend(DirectPosition)public void extend(IDirectPositionList dpl)
Envelope, if necessary, to include the DirectPositions in the given list.dpl - IDirectPositionListpublic boolean intersects(Envelope e)
true if the specified Envelope intersects this Envelope;
false otherwise.e - envelope to test for overlap with.true if the specified Envelope intersects this Envelope;
false otherwise.public Envelope getIntersection(Envelope e)
Envelope that represents the intersection of the specified Envelope with this
Envelope. If the Envelopes do not intersect the result is an empty Envelope.
If either Envelope is empty the result is an empty Envelope.e - the input Envelope to intersect with this one.Envelope that represents the intersection of the specified Envelope with this
Envelope.public boolean contains(com.mapinfo.midev.geometry.DirectPosition dp)
true if this Envelope contains the location as represented in the specified
DirectPosition; false if not.dp - a DirectPositiontrue if this Envelope contains the location as represented in the specified
DirectPosition; false if not.public boolean contains(Envelope env)
true if this Envelope contains the specified Envelope;
false if not.env - the Envelope to check for containment.true if this Envelope contains the specified Envelope;
false if not.public com.mapinfo.midev.geometry.DirectPosition getCenter()
throws InvalidGeometryException
Envelope.Envelope.InvalidGeometryException - if this Envelope is emptypublic com.mapinfo.midev.geometry.DirectPosition getUpperRight()
Envelope.Envelope.public com.mapinfo.midev.geometry.DirectPosition getLowerLeft()
Envelope.Envelope.public double getExtentX()
throws InvalidGeometryException
Envelope in the x direction.Envelope in the x direction.InvalidGeometryException - if the Envelope is emptyEnvelope.isEmpty()public double getExtentY()
throws InvalidGeometryException
Envelope in the y direction.Envelope in the y direction.InvalidGeometryException - if the Envelope is emptyEnvelope.isEmpty()public boolean isEmpty()
true if this Envelope is empty; false if not.true if this Envelope is empty; false if not.public void setEmpty()
Envelope to be empty.public void setEmpty(SpatialInfo spatialInfo)
spatialInfo - the spatial metadata to have.public SpatialInfo getSpatialInfo()
Envelope's spatial metadata.Envelope's spatial metadata.public double getLLX()
Envelope.Envelope.public double getLLY()
Envelope.Envelope.public double getURX()
Envelope.Envelope.public double getURY()
Envelope.Envelope.