com.moximedia.aims
Class AimsEnvelope

java.lang.Object
  extended bycom.moximedia.aims.AimsEnvelope
All Implemented Interfaces:
AimsShapeObject, java.lang.Cloneable, java.io.Serializable

public class AimsEnvelope
extends java.lang.Object
implements AimsShapeObject, java.io.Serializable, java.lang.Cloneable

An AimsEnvelope represents an ArcIms rectangular shape. An AimsEnvelope is used to store map extents and similar settings. If you want to put a rectangle on an AimsAcetateLayer, use an AimsEnvelopeObject instead, because it contains settings for symbolization.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.moximedia.aims.AimsShapeObject
SHAPE_TYPE_ENVELOPE, SHAPE_TYPE_MULTIPOINT, SHAPE_TYPE_POINT, SHAPE_TYPE_POLYGON, SHAPE_TYPE_POLYLINE
 
Constructor Summary
AimsEnvelope()
          Creates a new AimsEnvelope object with no height or width.
AimsEnvelope(AimsEnvelope env)
          Creates a copy of the envelope passed.
AimsEnvelope(double x, double y, double offset)
          Creates an square AimsEnvelope object based on centre and offset.
AimsEnvelope(double xmin, double ymin, double xmax, double ymax)
          Creates an AimsEnvelope object using the minimum and maximum coordinates.
AimsEnvelope(java.lang.String str)
          Creates an AimsEnvelope object from a string containing the minimum and maximum coordinate values in the form "x,y,x,y".
 
Method Summary
 void alignBottom(double y)
          Sets the bottom side of the envelope to the value specified.
 void alignLeft(double x)
          Sets the left side of the envelope to the value specified.
 void alignRight(double x)
          Sets the right side of the envelope to the value specified.
 void alignTop(double y)
          Sets the top side of the envelope to the value specified.
 java.lang.Object clone()
          Creates a copy of this envelope.
 boolean contains(AimsEnvelope env)
          Compares two AimsEnvelopes, and returns true if this envelope completely contains the envelope in the argument.
 boolean contains(AimsPoint pt)
          Returns true if this envelope contains the point in the argument.
 boolean contains(AimsPolygon poly)
          Returns true if this envelope contains the polygon in the argument.
 void expandBy(double expandDist)
          Enlarges the rectangle by the specified distance on all sides.
 double getBottom()
          Get the minimum Y coordinate of the rectangle
 AimsPoint getCenter()
          Returns the center point of the envelope.
 double getHeight()
          Gets the envelope height
 double getLeft()
          Get the minimum X coordinate of the rectangle
 java.lang.String getName()
           
 double getRight()
          Get the maximum X coordinate of the rectangle
 int getShapeType()
           
 double getTop()
          Get the maximum Y coordinate of the rectangle
 double getWidth()
          Gets the envelope width
 double getXmax()
          Get the maximum X coordinate of the rectangle
 double getXmin()
          Get the minimum X coordinate of the rectangle
 double getYmax()
          Get the maximum Y coordinate of the rectangle
 double getYmin()
          Get the minimum Y coordinate of the rectangle
 AimsEnvelope intersect(AimsEnvelope env)
          Gets the intersection of two AimsEnvelopes.
 boolean intersects(AimsEnvelope env)
          Compares two AimsEnvelopes, and returns true if they intersect.
 boolean isEmpty()
          Returns a boolean value indicating that the envelope has not been initialized (minimum and maximum values are zero).
 boolean isValid()
          Returns a boolean indicator of whether this shape is valid.
 void offsetBy(AimsPoint offset)
          Offsets the rectangle by the x and y in a point.
 void setAxlAttribute(java.lang.String tag, java.lang.String name, java.lang.String value)
          Sets one of the attributes of this object using a string value.
 void setCenter(AimsPoint pt)
          Sets the center of the rectangle to the point specified.
 void setCenter(double x, double y)
          Sets the center of the rectangle to the point specified.
 void setEnvelope(double xmin, double ymin, double xmax, double ymax)
          Resets the parameters of the envelope using coordinates.
 void setName(java.lang.String name)
           
 java.lang.String toAxlString()
          Returns the AXL string to refresh this object.
 java.lang.String toAxlString(AimsEnvironment env)
          Returns the AXL string to refresh this object.
 java.lang.String toCommaSeparatedString()
           
 java.lang.String toGmlString()
           
 java.lang.String toString()
          Returns a text representation of of this object.
 AimsEnvelope union(AimsEnvelope env)
          Union with another envelope, used in getting the envelope for an AimsRecordset.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AimsEnvelope

public AimsEnvelope()
Creates a new AimsEnvelope object with no height or width.


AimsEnvelope

public AimsEnvelope(double xmin,
                    double ymin,
                    double xmax,
                    double ymax)
Creates an AimsEnvelope object using the minimum and maximum coordinates. Note that the minimum and maximums will be swapped if they are in the wrong positions, so you don't have to worry about this in your code.

Parameters:
xmin - The minimum X coordinate value
ymin - The minimum Y coordinate value
xmax - The maximum X coordinate value
ymax - The maximum Y coordinate value

AimsEnvelope

public AimsEnvelope(java.lang.String str)
Creates an AimsEnvelope object from a string containing the minimum and maximum coordinate values in the form "x,y,x,y".

Parameters:
str - The extent coordinates in a comma delimited string.

AimsEnvelope

public AimsEnvelope(double x,
                    double y,
                    double offset)
Creates an square AimsEnvelope object based on centre and offset.

Parameters:
x - The centre X coordinate value
y - The centre Y coordinate value
offset - The square half-width value. Each side of the square will be created this distance away from the centre.

AimsEnvelope

public AimsEnvelope(AimsEnvelope env)
Creates a copy of the envelope passed.

Parameters:
env - An envelope to copy
Method Detail

clone

public java.lang.Object clone()
Creates a copy of this envelope.

Specified by:
clone in interface AimsShapeObject
Returns:
An object that is a copy of this envelope. The object must be cast to an AimsEnvelope before use.

offsetBy

public void offsetBy(AimsPoint offset)
Offsets the rectangle by the x and y in a point.

Parameters:
offset - An AimsPoint object containing the offset.

setName

public void setName(java.lang.String name)

getName

public java.lang.String getName()

union

public AimsEnvelope union(AimsEnvelope env)
Union with another envelope, used in getting the envelope for an AimsRecordset.

Parameters:
env - The second envelope
Returns:
The smallest envelope that contains both

intersect

public AimsEnvelope intersect(AimsEnvelope env)
Gets the intersection of two AimsEnvelopes. May use in limit extent constraint.

Parameters:
env - The second envelope.
Returns:
The intersection, or null if there is no intersection.

contains

public boolean contains(AimsEnvelope env)
Compares two AimsEnvelopes, and returns true if this envelope completely contains the envelope in the argument.

Parameters:
env - second envelope
Returns:
True if the envelope is completely contained, otherwise false

contains

public boolean contains(AimsPoint pt)
Returns true if this envelope contains the point in the argument.

Parameters:
pt - A point
Returns:
True if the envelope contains the point, otherwise false.

contains

public boolean contains(AimsPolygon poly)
Returns true if this envelope contains the polygon in the argument.

Parameters:
poly - A polygon
Returns:
True if the envelope contains the polygon, otherwise false.

intersects

public boolean intersects(AimsEnvelope env)
Compares two AimsEnvelopes, and returns true if they intersect.

Parameters:
env - second envelope
Returns:
True if they intersect, otherwise false

setEnvelope

public void setEnvelope(double xmin,
                        double ymin,
                        double xmax,
                        double ymax)
Resets the parameters of the envelope using coordinates.

Parameters:
xmin - the X minimum coordinate.
ymin - the Y minimum coordinate.
xmax - the X maximum coordinate.
ymax - the Y maximum coordinate.

setAxlAttribute

public void setAxlAttribute(java.lang.String tag,
                            java.lang.String name,
                            java.lang.String value)
Sets one of the attributes of this object using a string value. This method should only be called from the SAX event handler.

Parameters:
tag - The AXL element tag containing this attribute.
name - The AXL attribute name.
value - The AXL attribute value.

getXmin

public double getXmin()
Get the minimum X coordinate of the rectangle

Returns:
The minimum X coordinate of the rectangle

getLeft

public double getLeft()
Get the minimum X coordinate of the rectangle

Returns:
The minimum X coordinate of the rectangle

getYmin

public double getYmin()
Get the minimum Y coordinate of the rectangle

Returns:
The minimum Y coordinate of the rectangle

getBottom

public double getBottom()
Get the minimum Y coordinate of the rectangle

Returns:
The minimum Y coordinate of the rectangle

getXmax

public double getXmax()
Get the maximum X coordinate of the rectangle

Returns:
The maximum X coordinate of the rectangle

getRight

public double getRight()
Get the maximum X coordinate of the rectangle

Returns:
The maximum X coordinate of the rectangle

getYmax

public double getYmax()
Get the maximum Y coordinate of the rectangle

Returns:
The maximum Y coordinate of the rectangle

getTop

public double getTop()
Get the maximum Y coordinate of the rectangle

Returns:
The maximum Y coordinate of the rectangle

getWidth

public double getWidth()
Gets the envelope width

Returns:
The width of the envelope

getHeight

public double getHeight()
Gets the envelope height

Returns:
The height of the envelope

getCenter

public AimsPoint getCenter()
Returns the center point of the envelope.

Returns:
The center point of the envelope.

setCenter

public void setCenter(AimsPoint pt)
Sets the center of the rectangle to the point specified.

Parameters:
pt - The new center point.

setCenter

public void setCenter(double x,
                      double y)
Sets the center of the rectangle to the point specified.

Parameters:
x - The new center point x coordinate.
y - The new center point y coordinate.

expandBy

public void expandBy(double expandDist)
Enlarges the rectangle by the specified distance on all sides.

Parameters:
expandDist - The expand distance.

alignBottom

public void alignBottom(double y)
Sets the bottom side of the envelope to the value specified. The opposite side of the envelope is adjusted so that the rectangle size is unchanged.

Parameters:
y - The value to align to.

alignLeft

public void alignLeft(double x)
Sets the left side of the envelope to the value specified. The opposite side of the envelope is adjusted so that the rectangle size is unchanged.

Parameters:
x - The value to align to.

alignRight

public void alignRight(double x)
Sets the right side of the envelope to the value specified. The opposite side of the envelope is adjusted so that the rectangle size is unchanged.

Parameters:
x - The value to align to.

alignTop

public void alignTop(double y)
Sets the top side of the envelope to the value specified. The opposite side of the envelope is adjusted so that the rectangle size is unchanged.

Parameters:
y - The value to align to.

isEmpty

public boolean isEmpty()
Returns a boolean value indicating that the envelope has not been initialized (minimum and maximum values are zero).

Returns:
True if the envelope is empty, otherwise false.

toString

public java.lang.String toString()
Returns a text representation of of this object.

Returns:
A string describing the object

toAxlString

public java.lang.String toAxlString()
Returns the AXL string to refresh this object. This method is not typically used by the application programmer.

Specified by:
toAxlString in interface AimsShapeObject
Returns:
The AXL string to refresh this object.

toAxlString

public java.lang.String toAxlString(AimsEnvironment env)
Returns the AXL string to refresh this object. This method is not typically used by the application programmer.

Specified by:
toAxlString in interface AimsShapeObject
Parameters:
env - The environment object containing coordinate separators and other information about the version of AXL to produce.
Returns:
The AXL string to refresh this object.

toGmlString

public java.lang.String toGmlString()
Specified by:
toGmlString in interface AimsShapeObject

toCommaSeparatedString

public java.lang.String toCommaSeparatedString()

getShapeType

public int getShapeType()
Specified by:
getShapeType in interface AimsShapeObject

isValid

public boolean isValid()
Returns a boolean indicator of whether this shape is valid.

Specified by:
isValid in interface AimsShapeObject
Returns:
True if the shape is valid, otherwise false.