Package com.esri.core.geometry
Class Envelope
- java.lang.Object
-
- com.esri.core.geometry.Geometry
-
- com.esri.core.geometry.Envelope
-
- All Implemented Interfaces:
java.io.Serializable
public class Envelope extends Geometry implements java.io.Serializable
An envelope is an axis-aligned rectangle.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.esri.core.geometry.Geometry
Geometry.GeometryAccelerationDegree, Geometry.GeometryType, Geometry.Type
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]m_attributes(package private) Envelope2Dm_envelope-
Fields inherited from class com.esri.core.geometry.Geometry
m_description, m_touchFlag
-
-
Constructor Summary
Constructors Constructor Description Envelope()Constructs an empty envelope.Envelope(double xmin, double ymin, double xmax, double ymax)Constructs an envelope with the specified X and Y extents.Envelope(Envelope2D env2D)Envelope(Point point)Constructs an envelope that covers the given point.Envelope(Point center, double width, double height)Creates an envelope by defining its center, width, and height.Envelope(VertexDescription vd)Envelope(VertexDescription vd, Envelope2D env2D)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_assignVertexDescriptionImpl(VertexDescription newDescription)(package private) void_ensureAttributes()(package private) double_getAttributeAsDbl(int endPoint, int semantics, int ordinate)(package private) int_getAttributeAsInt(int endPoint, int semantics, int ordinate)(package private) static int_getEndPointOffset(VertexDescription vd, int endPoint)(package private) void_setAttributeAsDbl(int endPoint, int semantics, int ordinate, double value)(package private) void_setFromPoint(Point centerPoint)(package private) void_setFromPoint(Point centerPoint, double width, double height)voidapplyTransformation(Transformation2D transform)Applies 2D affine transformation in XY plane.(package private) voidapplyTransformation(Transformation3D transform)Applies 3D affine transformation.doublecalculateArea2D()Calculates the area of the geometry.doublecalculateLength2D()Calculates the length of the geometry.voidcenterAt(Point c)Centers the envelope around the specified point preserving the envelope's width and height.voidcenterAt(Point c, double w, double h)Sets the envelope's corners to be centered around the specified point, using its center, width, and height.booleancontains(Envelope env)Checks if this envelope contains (covers) other envelope.booleancontains(Point p)Checks if this envelope contains (covers) the specified point.voidcopyTo(Geometry dst)Copies this geometry to another geometry of the same type.GeometrycreateInstance()Creates an instance of an empty geometry of the same type.booleanequals(java.lang.Object _other)Returns TRUE when this geometry has exactly same type, properties, and coordinates as the other geometry.longestimateMemorySize()Returns an estimate of this object size in bytes.(package private) doublegetAttributeAsDblImpl_(int end_point, int semantics, int ordinate)GeometrygetBoundary()Returns boundary of this geometry.PointgetCenter()Returns the center point of the envelope.voidgetCenter(Point point_out)Point2DgetCenter2D()Gets the center point of the envelope.doublegetCenterX()The x-coordinate of the center of the envelope.Point2DgetCenterXY()The x and y-coordinates of the center of the envelope.doublegetCenterY()The y-coordinate of center of the envelope.intgetDimension()Returns the topological dimension of the geometry object based on the geometry's type.(package private) intgetEndPointOffset(VertexDescription descr, int end_point)doublegetHeight()The height of the envelope.PointgetLowerLeft()Returns the envelope's lower left corner point.PointgetLowerRight()Returns the envelope's lower right corner point.Geometry.TypegetType()Returns the geometry type.PointgetUpperLeft()Returns the envelope's upper left corner point.PointgetUpperRight()Returns the envelope's upper right corner point.doublegetWidth()The width of the envelope.doublegetXMax()Returns the X coordinate of the right corners of the envelope.doublegetXMin()Returns the X coordinate of the left corners of the envelope.doublegetYMax()Returns the Y coordinate of the top corners of the envelope.doublegetYMin()Returns the Y coordinate of the bottom corners of the envelope.inthashCode()Returns a hash code value for this envelope.voidinflate(double dx, double dy)Changes the dimensions of the envelope while preserving the center.booleanintersect(Envelope other)Changes this envelope to be the intersection of itself with the other envelope.booleanisEmpty()Indicates whether this envelope contains any points.booleanisIntersecting(Envelope other)Returns true if the envelope and the other given envelope intersect.booleanisIntersecting(Envelope2D other)voidmerge(Envelope other)Merges this envelope with the extent of the given envelope.voidmerge(Envelope2D other)voidmerge(Point point)Merges this envelope with the point.voidmerge(Point2D pt)voidnormalize()Normalizes envelopes if the minimum dimension is larger than the maximum dimension.voidoffset(double dx, double dy)Offsets the envelope by the specified distances along x and y-coordinates.voidqueryCoordinates(Point2D[] dst)voidqueryCorner(int index, Point2D ptDst)voidqueryCornerByVal(int index, Point ptDst)Sets the point's coordinates to the coordinates of the envelope at the given corner.voidqueryEnvelope(Envelope env)Returns the axis aligned bounding box of the geometry.voidqueryEnvelope2D(Envelope2D env)Returns tight bbox of the Geometry in X, Y plane.(package private) voidqueryEnvelope3D(Envelope3D env)Returns tight bbox of the Geometry in 3D.Envelope1DqueryInterval(int semantics, int ordinate)Returns the min and max attribute values at the ordinate of the Geometry.voidreaspect(double arWidth, double arHeight)Re-aspects this envelope to fit within the specified width and height.voidreplaceNaNs(int semantics, double value)Replaces NaNs in the attribute with the given value.(package private) voidsetAttributeAsDblImpl_(int end_point, int semantics, int ordinate, double value)voidsetCoords(double xmin, double ymin, double xmax, double ymax)Sets the 2-dimensional extents of the envelope.(package private) voidsetCoords(Point[] points)Sets the envelope from the array of points.voidsetEmpty()Removes all points from this geometry.(package private) voidsetEnvelope2D(Envelope2D e2d)voidsetInterval(int semantics, int ordinate, double vmin, double vmax)voidsetInterval(int semantics, int ordinate, Envelope1D env)voidsetXMax(double x)Sets the right X coordinate.voidsetXMin(double x)Sets the left X coordinate.voidsetYMax(double y)Sets the top Y coordinate.voidsetYMin(double y)Sets the bottom Y coordinate.java.lang.StringtoString()The output of this method can be only used for debugging.-
Methods inherited from class com.esri.core.geometry.Geometry
_clone, _getImpl, _touch, addAttribute, addID, addM, addZ, assignVertexDescription, copy, dropAllAttributes, dropAttribute, estimateMemorySize, getDescription, getDimensionFromType, getStateFlag, hasAttribute, hasID, hasM, hasZ, isArea, isLinear, isMultiPath, isMultiVertex, isPoint, isSegment, mergeVertexDescription, queryLooseEnvelope2D, queryLooseEnvelope3D, vertex_count, writeReplace
-
-
-
-
Field Detail
-
m_envelope
Envelope2D m_envelope
-
m_attributes
double[] m_attributes
-
-
Constructor Detail
-
Envelope
public Envelope(Point center, double width, double height)
Creates an envelope by defining its center, width, and height.- Parameters:
center- The center point of the envelope.width- The width of the envelope.height- The height of the envelope.
-
Envelope
public Envelope(Envelope2D env2D)
-
Envelope
public Envelope(VertexDescription vd)
-
Envelope
public Envelope(VertexDescription vd, Envelope2D env2D)
-
Envelope
public Envelope()
Constructs an empty envelope.
-
Envelope
public Envelope(Point point)
Constructs an envelope that covers the given point. The coordinates of the point are used to set the extent of the envelope.- Parameters:
point- The point that the envelope covers.
-
Envelope
public Envelope(double xmin, double ymin, double xmax, double ymax)Constructs an envelope with the specified X and Y extents.- Parameters:
xmin- The minimum x-coordinate of the envelope.ymin- The minimum y-coordinate of the envelope.xmax- The maximum x-coordinate of the envelope.ymax- The maximum y-coordinate of the envelope.
-
-
Method Detail
-
setCoords
public void setCoords(double xmin, double ymin, double xmax, double ymax)Sets the 2-dimensional extents of the envelope.- Parameters:
xmin- The minimum x-coordinate of the envelope.ymin- The minimum y-coordinate of the envelope.xmax- The maximum x-coordinate of the envelope.ymax- The maximum y-coordinate of the envelope.
-
setCoords
void setCoords(Point[] points)
Sets the envelope from the array of points. The result envelope is a bounding box of all the points in the array. If the array has zero length, the envelope will be empty.- Parameters:
points- The point array.
-
setEnvelope2D
void setEnvelope2D(Envelope2D e2d)
-
setEmpty
public void setEmpty()
Removes all points from this geometry.
-
isEmpty
public boolean isEmpty()
Indicates whether this envelope contains any points.
-
getWidth
public double getWidth()
The width of the envelope.- Returns:
- The width of the envelope.
-
getHeight
public double getHeight()
The height of the envelope.- Returns:
- The height of the envelope.
-
getCenterX
public double getCenterX()
The x-coordinate of the center of the envelope.- Returns:
- The x-coordinate of the center of the envelope.
-
getCenterY
public double getCenterY()
The y-coordinate of center of the envelope.- Returns:
- The y-coordinate of center of the envelope.
-
getCenterXY
public Point2D getCenterXY()
The x and y-coordinates of the center of the envelope.- Returns:
- A point whose x and y-coordinates are that of the center of the envelope.
-
getCenter
public void getCenter(Point point_out)
-
merge
public void merge(Point2D pt)
-
merge
public void merge(Envelope other)
Merges this envelope with the extent of the given envelope. If this envelope is empty, the coordinates of the given envelope are assigned. If the given envelope is empty, this envelope is unchanged.- Parameters:
other- The envelope to merge.
-
merge
public void merge(Point point)
Merges this envelope with the point. The boundary of the envelope is increased to include the point. If the envelope is empty, the coordinates of the point to merge are assigned. If the point is empty, the original envelope is unchanged.- Parameters:
point- The point to be merged.
-
_setFromPoint
void _setFromPoint(Point centerPoint, double width, double height)
-
_setFromPoint
void _setFromPoint(Point centerPoint)
-
merge
public void merge(Envelope2D other)
-
setInterval
public void setInterval(int semantics, int ordinate, double vmin, double vmax)
-
reaspect
public void reaspect(double arWidth, double arHeight)Re-aspects this envelope to fit within the specified width and height.- Parameters:
arWidth- The width within which to fit the envelope.arHeight- The height within which to fit the envelope.
-
inflate
public void inflate(double dx, double dy)Changes the dimensions of the envelope while preserving the center. New width is Width + 2 * dx, new height is Height + 2 * dy. If the result envelope width or height becomes negative, the envelope is set to be empty.- Parameters:
dx- The inflation along the x-axis.dy- The inflation along the y-axis.
-
applyTransformation
public void applyTransformation(Transformation2D transform)
Description copied from class:GeometryApplies 2D affine transformation in XY plane.- Specified by:
applyTransformationin classGeometry- Parameters:
transform- The affine transformation to be applied to this geometry.
-
applyTransformation
void applyTransformation(Transformation3D transform)
Description copied from class:GeometryApplies 3D affine transformation. Adds Z attribute if it is missing.- Specified by:
applyTransformationin classGeometry- Parameters:
transform- The affine transformation to be applied to this geometry.
-
copyTo
public void copyTo(Geometry dst)
Description copied from class:GeometryCopies this geometry to another geometry of the same type. The result geometry is an exact copy.
-
createInstance
public Geometry createInstance()
Description copied from class:GeometryCreates an instance of an empty geometry of the same type.- Specified by:
createInstancein classGeometry- Returns:
- The new instance.
-
calculateArea2D
public double calculateArea2D()
Description copied from class:GeometryCalculates the area of the geometry. If the spatial reference is a Geographic Coordinate System (WGS84) then the 2D area calculation is defined in angular units.- Overrides:
calculateArea2Din classGeometry- Returns:
- A double value representing the 2D area of the geometry.
-
calculateLength2D
public double calculateLength2D()
Description copied from class:GeometryCalculates the length of the geometry. If the spatial reference is a Geographic Coordinate System (a system where coordinates are defined using angular units such as longitude and latitude) then the 2D distance calculation is returned in angular units. In cases where length must be calculated on a Geographic Coordinate System consider the using the geodeticLength method on theGeometryEngine- Overrides:
calculateLength2Din classGeometry- Returns:
- A double value representing the 2D length of the geometry.
-
getType
public Geometry.Type getType()
Description copied from class:GeometryReturns the geometry type.
-
getDimension
public int getDimension()
Description copied from class:GeometryReturns the topological dimension of the geometry object based on the geometry's type.Returns 0 for point and multipoint.
Returns 1 for lines and polylines.
Returns 2 for polygons and envelopes
Returns 3 for objects with volume
- Specified by:
getDimensionin classGeometry- Returns:
- Returns the integer value of the dimension of geometry.
-
estimateMemorySize
public long estimateMemorySize()
Description copied from class:GeometryReturns an estimate of this object size in bytes.This estimate doesn't include the size of the
VertexDescriptionobject because instances ofVertexDescriptionare shared among geometry objects.- Specified by:
estimateMemorySizein classGeometry- Returns:
- Returns an estimate of this object size in bytes.
-
queryEnvelope
public void queryEnvelope(Envelope env)
Description copied from class:GeometryReturns the axis aligned bounding box of the geometry.- Specified by:
queryEnvelopein classGeometry- Parameters:
env- The envelope to return the result in.
-
queryEnvelope2D
public void queryEnvelope2D(Envelope2D env)
Description copied from class:GeometryReturns tight bbox of the Geometry in X, Y plane.- Specified by:
queryEnvelope2Din classGeometry- Parameters:
env- The envelope to return the result in.
-
queryEnvelope3D
void queryEnvelope3D(Envelope3D env)
Description copied from class:GeometryReturns tight bbox of the Geometry in 3D.- Specified by:
queryEnvelope3Din classGeometry- Parameters:
env- The envelope to return the result in.
-
queryInterval
public Envelope1D queryInterval(int semantics, int ordinate)
Description copied from class:GeometryReturns the min and max attribute values at the ordinate of the Geometry.- Specified by:
queryIntervalin classGeometry- Parameters:
semantics- The semantics of the interval.ordinate- The ordinate of the interval.- Returns:
- The interval.
-
setInterval
public void setInterval(int semantics, int ordinate, Envelope1D env)
-
queryCoordinates
public void queryCoordinates(Point2D[] dst)
-
queryCornerByVal
public void queryCornerByVal(int index, Point ptDst)Sets the point's coordinates to the coordinates of the envelope at the given corner.- Parameters:
index- The index of the envelope's corners from 0 to 3.0 = lower left corner
1 = top-left corner
2 = top right corner
3 = bottom right corner
ptDst- The point whose coordinates are used to set the envelope's coordinate at a specified corner.
-
queryCorner
public void queryCorner(int index, Point2D ptDst)
-
getEndPointOffset
int getEndPointOffset(VertexDescription descr, int end_point)
-
getAttributeAsDblImpl_
double getAttributeAsDblImpl_(int end_point, int semantics, int ordinate)
-
setAttributeAsDblImpl_
void setAttributeAsDblImpl_(int end_point, int semantics, int ordinate, double value)
-
_ensureAttributes
void _ensureAttributes()
-
_assignVertexDescriptionImpl
protected void _assignVertexDescriptionImpl(VertexDescription newDescription)
- Specified by:
_assignVertexDescriptionImplin classGeometry
-
_getAttributeAsDbl
double _getAttributeAsDbl(int endPoint, int semantics, int ordinate)
-
_setAttributeAsDbl
void _setAttributeAsDbl(int endPoint, int semantics, int ordinate, double value)
-
_getAttributeAsInt
int _getAttributeAsInt(int endPoint, int semantics, int ordinate)
-
_getEndPointOffset
static int _getEndPointOffset(VertexDescription vd, int endPoint)
-
isIntersecting
public boolean isIntersecting(Envelope2D other)
-
intersect
public boolean intersect(Envelope other)
Changes this envelope to be the intersection of itself with the other envelope.- Parameters:
other- The envelope to intersect.- Returns:
- Returns true if the result is not empty.
-
isIntersecting
public boolean isIntersecting(Envelope other)
Returns true if the envelope and the other given envelope intersect.- Parameters:
other- The envelope to with which to test intersection.- Returns:
- Returns true if the two envelopes intersect.
-
centerAt
public void centerAt(Point c, double w, double h)
Sets the envelope's corners to be centered around the specified point, using its center, width, and height.- Parameters:
c- The point around which to center the envelope.w- The width to be set for the envelope.h- The height to be set for this envelope.
-
offset
public void offset(double dx, double dy)Offsets the envelope by the specified distances along x and y-coordinates.- Parameters:
dx- The X offset to be applied.dy- The Y offset to be applied.
-
normalize
public void normalize()
Normalizes envelopes if the minimum dimension is larger than the maximum dimension.
-
getCenter2D
public Point2D getCenter2D()
Gets the center point of the envelope. The center point occurs at: ((XMin + XMax) / 2, (YMin + YMax) / 2).- Returns:
- The center point of the envelope.
-
getCenter
public Point getCenter()
Returns the center point of the envelope.- Returns:
- The center point of the envelope.
-
centerAt
public void centerAt(Point c)
Centers the envelope around the specified point preserving the envelope's width and height.- Parameters:
c- The new center point.
-
getLowerLeft
public Point getLowerLeft()
Returns the envelope's lower left corner point.- Returns:
- Returns the lower left corner point.
-
getUpperRight
public Point getUpperRight()
Returns the envelope's upper right corner point.- Returns:
- Returns the upper right corner point.
-
getLowerRight
public Point getLowerRight()
Returns the envelope's lower right corner point.- Returns:
- Returns the lower right corner point.
-
getUpperLeft
public Point getUpperLeft()
Returns the envelope's upper left corner point.- Returns:
- Returns the upper left corner point.
-
contains
public boolean contains(Point p)
Checks if this envelope contains (covers) the specified point.- Parameters:
p- The Point to be tested for coverage.- Returns:
- TRUE if this envelope contains (covers) the specified point.
-
contains
public boolean contains(Envelope env)
Checks if this envelope contains (covers) other envelope.- Parameters:
env- The envelope to be tested for coverage.- Returns:
- TRUE if this envelope contains (covers) the specified envelope.
-
equals
public boolean equals(java.lang.Object _other)
Returns TRUE when this geometry has exactly same type, properties, and coordinates as the other geometry.- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hash code value for this envelope.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code value for this envelope.
-
getXMin
public final double getXMin()
Returns the X coordinate of the left corners of the envelope.- Returns:
- The X coordinate of the left corners.
-
getYMin
public final double getYMin()
Returns the Y coordinate of the bottom corners of the envelope.- Returns:
- The Y coordinate of the bottom corners.
-
getXMax
public final double getXMax()
Returns the X coordinate of the right corners of the envelope.- Returns:
- The X coordinate of the right corners.
-
getYMax
public final double getYMax()
Returns the Y coordinate of the top corners of the envelope.- Returns:
- The Y coordinate of the top corners.
-
setXMin
public void setXMin(double x)
Sets the left X coordinate.- Parameters:
x- The X coordinate of the left corner
-
setXMax
public void setXMax(double x)
Sets the right X coordinate.- Parameters:
x- The X coordinate of the right corner.
-
setYMin
public void setYMin(double y)
Sets the bottom Y coordinate.- Parameters:
y- the Y coordinate of the bottom corner.
-
setYMax
public void setYMax(double y)
Sets the top Y coordinate.- Parameters:
y- The Y coordinate of the top corner.
-
getBoundary
public Geometry getBoundary()
Description copied from class:GeometryReturns boundary of this geometry. Polygon and Envelope boundary is a Polyline. For Polyline and Line, the boundary is a Multi_point consisting of path end points. For Multi_point and Point null is returned.- Specified by:
getBoundaryin classGeometry- Returns:
- The boundary geometry.
-
replaceNaNs
public void replaceNaNs(int semantics, double value)Description copied from class:GeometryReplaces NaNs in the attribute with the given value. If the geometry is not empty, it adds the attribute if geometry does not have it yet, and replaces the values. If the geometry is empty, it adds the attribute and does not set any values.- Specified by:
replaceNaNsin classGeometry- Parameters:
semantics- The semantics for which to replace the NaNs.value- The value to replace NaNs with.
-
-