org.geotools.geometry
Class AbstractEnvelope

java.lang.Object
  extended by org.geotools.geometry.AbstractEnvelope
All Implemented Interfaces:
org.opengis.geometry.Envelope
Direct Known Subclasses:
GeneralEnvelope

public abstract class AbstractEnvelope
extends java.lang.Object
implements org.opengis.geometry.Envelope

Base class for envelope implementations. This base class provides default implementations for toString(), equals(java.lang.Object) and hashCode() methods.

This class do not holds any state. The decision to implement Serializable or org.geotools.util.Cloneable interfaces is left to implementors.

Since:
2.4
Version:
$Id: AbstractEnvelope.java 30892 2008-07-04 15:17:36Z desruisseaux $
Author:
Martin Desruisseaux (IRD)

Constructor Summary
protected AbstractEnvelope()
          Constructs an envelope.
 
Method Summary
 boolean equals(java.lang.Object object)
          Returns true if the specified object is also an envelope with equals coordinates and CRS.
 org.opengis.geometry.DirectPosition getLowerCorner()
          A coordinate position consisting of all the minimal ordinates.
 org.opengis.geometry.DirectPosition getUpperCorner()
          A coordinate position consisting of all the maximal ordinates.
 int hashCode()
          Returns a hash value for this envelope.
 java.lang.String toString()
          Returns a string representation of this envelope.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengis.geometry.Envelope
getCenter, getCoordinateReferenceSystem, getDimension, getLength, getMaximum, getMedian, getMinimum, getSpan
 

Constructor Detail

AbstractEnvelope

protected AbstractEnvelope()
Constructs an envelope.

Method Detail

getLowerCorner

public org.opengis.geometry.DirectPosition getLowerCorner()
A coordinate position consisting of all the minimal ordinates. The default implementation returns a direct position backed by this envelope, so changes in this envelope will be immediately reflected in the direct position.

Specified by:
getLowerCorner in interface org.opengis.geometry.Envelope
Returns:
The lower corner.

getUpperCorner

public org.opengis.geometry.DirectPosition getUpperCorner()
A coordinate position consisting of all the maximal ordinates. The default implementation returns a direct position backed by this envelope, so changes in this envelope will be immediately reflected in the direct position.

Specified by:
getUpperCorner in interface org.opengis.geometry.Envelope
Returns:
The upper corner.

toString

public java.lang.String toString()
Returns a string representation of this envelope. The default implementation returns a string containing lower corner coordinates first, followed by upper corner coordinates. Other informations like the CRS or class name may or may not be presents at implementor choice.

This string is okay for occasional formatting (for example for debugging purpose). But if there is a lot of envelopes to format, users will get more control by using their own instance of CoordinateFormat.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Returns a hash value for this envelope.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object object)
Returns true if the specified object is also an envelope with equals coordinates and CRS.

Overrides:
equals in class java.lang.Object
Parameters:
object - The object to compare with this envelope.
Returns:
true if the given object is equals to this envelope.


Copyright © 1996-2010 Geotools. All Rights Reserved.