com.esri.core.geometry
Class Envelope

java.lang.Object
  extended by com.esri.core.geometry.Geometry
      extended by com.esri.core.geometry.Envelope
All Implemented Interfaces:
Serializable

public final class Envelope
extends Geometry
implements Serializable

A class that represents an Envelope or Extent

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.esri.core.geometry.Geometry
Geometry.Type
 
Field Summary
 
Fields inherited from class com.esri.core.geometry.Geometry
m_description
 
Constructor Summary
Envelope()
          Constructs an empty 2D Envelope
Envelope(double xmin, double ymin, double xmax, double ymax)
          Constructs a 2D Envelope with the specified x and y extents.
Envelope(com.esri.core.geometry.Envelope2D env2D)
           
Envelope(Point point)
          Constructs an Envelope that covers the given point.
Envelope(Point center, double w, double h)
           
 
Method Summary
 double calculateArea2D()
          Returns the area of this 2D envelope
 double calculateLength2D()
          Returns the perimeter of this 2D envelope
 void centerAt(Point c)
          Centers this 2D Envelope around the specified 2D point
 void centerAt(Point c, double w, double h)
          Sets this 2D envelope's corners to be centered around the specified center Point, and it's width and height to be the ones specified
 boolean contains(Point p)
          Returns if this 2D envelope contains (covers) the specified 2D point
 Envelope copy()
          Returns a copy of this envelope
 void copyTo(Geometry dst)
          Copies this geometry to another Geometry of the same type.
 Geometry createInstance()
          Creates instance of empty Geometry with the same VertexDescription.
 boolean equals(Object _other)
           
 Point getCenter()
          Gets the center point of this 2D envelope.
 double getCenterX()
          Returns the envelope center's X coordinate
 double getCenterY()
          Returns the envelope center's Y coordinate
 int getDimension()
          Returns the Geometry Dimension.
 double getHeight()
          Returns the envelope's height
 Point getLowerLeft()
          Returns this 2D envelope's lower left corner point
 Point getLowerRight()
          Returns this 2D envelope's lower right corner point
 Geometry.Type getType()
          Returns the Geometry type.
 Point getUpperLeft()
          Returns this 2D envelope's upper left corner point
 Point getUpperRight()
          Returns this 2D envelope's lower left corner point
 double getWidth()
          Returns the envelope's width
 double getXMax()
          Returns the right corner's x coordinate
 double getXMin()
          Returns the left corner's x coordinate
 double getYMax()
          Returns the top corner's y coordinate
 double getYMin()
          Returns the bottom corner's y coordinate
 int hashCode()
           
 boolean intersect(Envelope other)
          Returns true if the specified 2D envelope intersects with this 2D envelope
 boolean isEmpty()
          Returns if this Envelope is empty
 void merge(Envelope other)
           
 void normalize()
          Fixes "broken" 2D envelope, that has min dimension larger than the max one.
 void offset(double dx, double dy)
          Offsets 2D envelope by the specified distances along x and y coordinates.
 void queryCoornerByVal(int index, Point ptDst)
          Sets the specified points coordinates to those of this envelope's corners
 void queryEnvelope(Envelope env)
          Sets the specified envelope's 2D (x and y) coordinates to the same values as those of this envelope
 void reaspect(double arWidth, double arHeight)
          Reaspects a 2D envelope to fit within the specified width and height
 void setCoords(double xmin, double ymin, double xmax, double ymax)
          Sets the 2 dimensional extents of this envelope
 void setEmpty()
          Sets this envelope to be an empty envelope
 void setXMax(double x)
          Sets the right x coordinate
 void setXMin(double x)
          Sets the left x coordinate
 void setYMax(double y)
          Sets the top y coordinate
 void setYMin(double y)
          Sets the bottom y coordinate
 
Methods inherited from class com.esri.core.geometry.Geometry
_getImpl, addID, addM, addZ, hasID, hasM, hasZ, isSegment
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Envelope

public Envelope(Point center,
                double w,
                double h)

Envelope

public Envelope(com.esri.core.geometry.Envelope2D env2D)

Envelope

public Envelope()
Constructs an empty 2D Envelope


Envelope

public Envelope(Point point)
Constructs an Envelope that covers the given point. The point coordinates are used to set the envelope's extent

Parameters:
point - - the Point that the envelope covers

Envelope

public Envelope(double xmin,
                double ymin,
                double xmax,
                double ymax)
Constructs a 2D 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 this 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

setEmpty

public void setEmpty()
Sets this envelope to be an empty envelope

Specified by:
setEmpty in class Geometry

isEmpty

public boolean isEmpty()
Returns if this Envelope is empty

Specified by:
isEmpty in class Geometry
Returns:
true if the Envelope is empty

getWidth

public double getWidth()
Returns the envelope's width

Returns:
the envelope's width

getHeight

public double getHeight()
Returns the envelope's height

Returns:
the envelope's height

getCenterX

public double getCenterX()
Returns the envelope center's X coordinate

Returns:
the envelope center's X coordinate

getCenterY

public double getCenterY()
Returns the envelope center's Y coordinate

Returns:
the envelope center's Y coordinate

merge

public void merge(Envelope other)

reaspect

public void reaspect(double arWidth,
                     double arHeight)
Reaspects a 2D 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

copyTo

public void copyTo(Geometry dst)
Description copied from class: Geometry
Copies this geometry to another Geometry of the same type. The result Geometry is exact copy.

Specified by:
copyTo in class Geometry

createInstance

public Geometry createInstance()
Description copied from class: Geometry
Creates instance of empty Geometry with the same VertexDescription.

Specified by:
createInstance in class Geometry

calculateArea2D

public double calculateArea2D()
Returns the area of this 2D envelope

Overrides:
calculateArea2D in class Geometry
Returns:
the area of this 2D envelope

calculateLength2D

public double calculateLength2D()
Returns the perimeter of this 2D envelope

Overrides:
calculateLength2D in class Geometry
Returns:
the perimeter of this 2D envelope

getType

public Geometry.Type getType()
Description copied from class: Geometry
Returns the Geometry type.

Specified by:
getType in class Geometry

getDimension

public int getDimension()
Description copied from class: Geometry
Returns the Geometry Dimension. (0 for Point and MultiPoint, 1 for curves, 2 for objects that have area, 3 for objects with volume)

Specified by:
getDimension in class Geometry

queryEnvelope

public void queryEnvelope(Envelope env)
Sets the specified envelope's 2D (x and y) coordinates to the same values as those of this envelope

Overrides:
queryEnvelope in class Geometry
Parameters:
env - - the envelope whose X and Y coordinates are to be set

queryCoornerByVal

public void queryCoornerByVal(int index,
                              Point ptDst)
Sets the specified points coordinates to those of this envelope's corners

Parameters:
index - - 0 for lower left, 1 for top-left, 2 for top right, 3 for bottom right
ptDst - - the Point whose coordinates are to be set to those of this Envelope's specified corner

copy

public Envelope copy()
Returns a copy of this envelope

Returns:
a copy of this envelope

intersect

public boolean intersect(Envelope other)
Returns true if the specified 2D envelope intersects with this 2D envelope

Parameters:
other - - the 2D envelope to test intersection with
Returns:
true if both this and the other 2D envelope intersect

centerAt

public void centerAt(Point c,
                     double w,
                     double h)
Sets this 2D envelope's corners to be centered around the specified center Point, and it's width and height to be the ones specified

Parameters:
c - - the 2D Point around which to center this Envelope
w - - the width to be set for this Envelope
h - - the height to be set for this Envelope

offset

public void offset(double dx,
                   double dy)
Offsets 2D 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()
Fixes "broken" 2D envelope, that has min dimension larger than the max one.


getCenter

public Point getCenter()
Gets the center point of this 2D envelope. The Center Point occurs at: ((XMin + XMax) / 2, (YMin + YMax) / 2).

Returns:
the center point

centerAt

public void centerAt(Point c)
Centers this 2D Envelope around the specified 2D point

Parameters:
c - - the new center Point

getLowerLeft

public Point getLowerLeft()
Returns this 2D envelope's lower left corner point

Returns:
lower left corner point

getUpperRight

public Point getUpperRight()
Returns this 2D envelope's lower left corner point

Returns:
lower left corner point

getLowerRight

public Point getLowerRight()
Returns this 2D envelope's lower right corner point

Returns:
lower right corner point

getUpperLeft

public Point getUpperLeft()
Returns this 2D envelope's upper left corner point

Returns:
upper left corner point

contains

public boolean contains(Point p)
Returns if this 2D envelope contains (covers) the specified 2D point

Parameters:
p - - the 2D Point to be tested for coverage
Returns:
true if this 2D envelope contains (covers) the specified 2D point

equals

public boolean equals(Object _other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getXMin

public double getXMin()
Returns the left corner's x coordinate

Returns:
the left corner's x coordinate

getYMin

public double getYMin()
Returns the bottom corner's y coordinate

Returns:
the bottom corner's y coordinate

getXMax

public double getXMax()
Returns the right corner's x coordinate

Returns:
the right corner's x coordinate

getYMax

public double getYMax()
Returns the top corner's y coordinate

Returns:
the top corner's y coordinate

setXMin

public void setXMin(double x)
Sets the left x coordinate

Parameters:
x -

setXMax

public void setXMax(double x)
Sets the right x coordinate

Parameters:
x -

setYMin

public void setYMin(double y)
Sets the bottom y coordinate

Parameters:
y -

setYMax

public void setYMax(double y)
Sets the top y coordinate

Parameters:
y -


Copyright © 2010. All Rights Reserved.