org.geotools.data.ows
Class CRSEnvelope

Object
  extended by CRSEnvelope
All Implemented Interfaces:
Envelope

public class CRSEnvelope
extends Object
implements Envelope

A pair of coordinates and a reference system that represents a section of the Earth.

Represents one of the following:

The interpretation of the srsName is based on the version of WMS specification used:

Author:
Richard Gould

Field Summary
protected  double maxX
          Max of axis 0 as specified by CRS
protected  double maxY
          Max of axis 1 as specified by CRS
protected  double minX
          Min of axis 0 as specified by CRS
protected  double minY
          Min of axis 1 as specified by CRS
protected  double resX
          optional spatial resolution in the units of crs
protected  double resY
          optional spatial resolution in the units of crs
 
Constructor Summary
CRSEnvelope()
          Construct an empty BoundingBox
CRSEnvelope(Envelope envelope)
           
CRSEnvelope(String epsgCode, double minX, double minY, double maxX, double maxY)
          Create a bounding box with the specified properties
 
Method Summary
 double getCenter(int dimension)
           
 CoordinateReferenceSystem getCoordinateReferenceSystem()
          Returns the coordinate reference system for this envelope (if known).
 int getDimension()
          The length of coordinate sequence (the number of entries) in this envelope.
 String getEPSGCode()
           
 double getLength(int dimension)
           
 DirectPosition getLowerCorner()
          A coordinate position consisting of all the minimal ordinates for each dimension for all points within the Envelope.
 double getMaximum(int dimension)
          Returns the maximal ordinate along the specified dimension.
 double getMaxX()
          The maxX value is the higher X coordinate value
 double getMaxY()
          The maxY value is the higher Y coordinate value
 double getMedian(int dimension)
          Returns the median ordinate along the specified dimension.
 double getMinimum(int dimension)
          Returns the minimal ordinate along the specified dimension.
 double getMinX()
          The minX value is the lower X coordinate value
 double getMinY()
          The minY value is the lower Y coordinate value
 double getResX()
          Optional spatial resolution in the units of crs.
 double getResY()
          Optional spatial resolution in the units of crs.
 double getSpan(int dimension)
          Returns the envelope span (typically width or height) along the specified dimension.
 String getSRSName()
          The CRS is bounding box's Coordinate Reference System.
 DirectPosition getUpperCorner()
          A coordinate position consisting of all the maximal ordinates for each dimension for all points within the Envelope.
 void setEPSGCode(String epsgCode)
          Helper method to set srsName.
 void setMaxX(double maxX)
          The maxX value is the higher X coordinate value
 void setMaxY(double maxY)
          The maxY value is the higher Y coordinate value
 void setMinX(double minX)
          The minX value is the lower X coordinate value
 void setMinY(double minY)
          The minY value is the lower Y coordinate value
 void setResX(double resX)
          Optional spatial resolution in the units of crs.
 void setResY(double resY)
          Optional spatial resolution in the units of crs.
 void setSRSName(String srsName)
          Deprecated. Please use setSRSName(String,boolean) to explicitly indicate axis handling
 void setSRSName(String srsName, boolean forceXY)
          The CRS is bounding box's Coordinate Reference System.
 String toString()
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

minX

protected double minX
Min of axis 0 as specified by CRS


minY

protected double minY
Min of axis 1 as specified by CRS


maxX

protected double maxX
Max of axis 0 as specified by CRS


maxY

protected double maxY
Max of axis 1 as specified by CRS


resX

protected double resX
optional spatial resolution in the units of crs


resY

protected double resY
optional spatial resolution in the units of crs

Constructor Detail

CRSEnvelope

public CRSEnvelope()
Construct an empty BoundingBox


CRSEnvelope

public CRSEnvelope(String epsgCode,
                   double minX,
                   double minY,
                   double maxX,
                   double maxY)
Create a bounding box with the specified properties

Parameters:
epsgCode - The Coordinate Reference System this bounding box is in
minX -
minY -
maxX -
maxY -

CRSEnvelope

public CRSEnvelope(Envelope envelope)
Method Detail

getCoordinateReferenceSystem

public CoordinateReferenceSystem getCoordinateReferenceSystem()
Returns the coordinate reference system for this envelope (if known). return CoordinateReferenceSystem if known, or null

Specified by:
getCoordinateReferenceSystem in interface Envelope
Returns:
The envelope CRS, or null if unknown.

getSRSName

public String getSRSName()
The CRS is bounding box's Coordinate Reference System.

Returns:
the CRS/SRS value, or null for implicit CRS:84

setEPSGCode

public void setEPSGCode(String epsgCode)
Helper method to set srsName.

See Also:
setSRSName

getEPSGCode

public String getEPSGCode()
See Also:
getSRSName

setSRSName

public void setSRSName(String srsName)
Deprecated. Please use setSRSName(String,boolean) to explicitly indicate axis handling

The CRS is bounding box's Coordinate Reference System.

Examples from WMS specification:

Parameters:
srsName - The SRSName for this envelope; usually an EPSG code

setSRSName

public void setSRSName(String srsName,
                       boolean forceXY)
The CRS is bounding box's Coordinate Reference System.

Examples from WMS specification:

Parameters:
srsName - The SRSName for this envelope; usually an EPSG code
forceXY - True to forceXY axis order (used prior to WMS 1.3.0), False to use provided axis order (WMS 1.3.0 and later )

getDimension

public int getDimension()
Description copied from interface: Envelope
The length of coordinate sequence (the number of entries) in this envelope. Mandatory even when the coordinate reference system is unknown.

Specified by:
getDimension in interface Envelope
Returns:
The dimensionality of this envelope.

getMinimum

public double getMinimum(int dimension)
Description copied from interface: Envelope
Returns the minimal ordinate along the specified dimension. This is a shortcut for the following without the cost of creating a temporary DirectPosition object:
Envelope.getLowerCorner().getOrdinate(dimension)

Specified by:
getMinimum in interface Envelope
Parameters:
dimension - The dimension for which to obtain the ordinate value.
Returns:
The minimal ordinate at the given dimension.
See Also:
RectangularShape.getMinX(), RectangularShape.getMinY()

getMaximum

public double getMaximum(int dimension)
Description copied from interface: Envelope
Returns the maximal ordinate along the specified dimension. This is a shortcut for the following without the cost of creating a temporary DirectPosition object:
Envelope.getUpperCorner().getOrdinate(dimension)

Specified by:
getMaximum in interface Envelope
Parameters:
dimension - The dimension for which to obtain the ordinate value.
Returns:
The maximal ordinate at the given dimension.
See Also:
RectangularShape.getMaxX(), RectangularShape.getMaxY()

getCenter

public double getCenter(int dimension)

getMedian

public double getMedian(int dimension)
Description copied from interface: Envelope
Returns the median ordinate along the specified dimension. The result should be equals (minus rounding error) to:
(getMinimum(dimension) + getMaximum(dimension)) / 2

Specified by:
getMedian in interface Envelope
Parameters:
dimension - The dimension for which to obtain the ordinate value.
Returns:
The median ordinate at the given dimension.
See Also:
RectangularShape.getCenterX(), RectangularShape.getCenterY()

getLength

public double getLength(int dimension)

getSpan

public double getSpan(int dimension)
Description copied from interface: Envelope
Returns the envelope span (typically width or height) along the specified dimension. The result should be equals (minus rounding error) to:
getMaximum(dimension) - getMinimum(dimension)

Specified by:
getSpan in interface Envelope
Parameters:
dimension - The dimension for which to obtain the ordinate value.
Returns:
The span (typically width or height) at the given dimension.
See Also:
RectangularShape.getWidth(), RectangularShape.getHeight()

getUpperCorner

public DirectPosition getUpperCorner()
Description copied from interface: Envelope
A coordinate position consisting of all the maximal ordinates for each dimension for all points within the Envelope.

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

getLowerCorner

public DirectPosition getLowerCorner()
Description copied from interface: Envelope
A coordinate position consisting of all the minimal ordinates for each dimension for all points within the Envelope.

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

getMaxX

public double getMaxX()
The maxX value is the higher X coordinate value

Returns:
the bounding box's maxX value

setMaxX

public void setMaxX(double maxX)
The maxX value is the higher X coordinate value

Parameters:
maxX - the new value for maxX. Should be greater than minX.

getMaxY

public double getMaxY()
The maxY value is the higher Y coordinate value

Returns:
the bounding box's maxY value

setMaxY

public void setMaxY(double maxY)
The maxY value is the higher Y coordinate value

Parameters:
maxY - the new value for maxY. Should be greater than minY.

getMinX

public double getMinX()
The minX value is the lower X coordinate value

Returns:
the bounding box's minX value

setMinX

public void setMinX(double minX)
The minX value is the lower X coordinate value

Parameters:
minX - the new value for minX. Should be less than maxX.

getMinY

public double getMinY()
The minY value is the lower Y coordinate value

Returns:
the bounding box's minY value

setMinY

public void setMinY(double minY)
The minY value is the lower Y coordinate value

Parameters:
minY - the new value for minY. Should be less than maxY.

getResX

public double getResX()
Optional spatial resolution in the units of crs.

Returns:
spatial resolutionm, or Double.NaN if not provided

setResX

public void setResX(double resX)
Optional spatial resolution in the units of crs.

Parameters:
resX - spatial resolutionm, or Double.NaN if not provided

getResY

public double getResY()
Optional spatial resolution in the units of crs.

Returns:
spatial resolutionm, or Double.NaN if not provided

setResY

public void setResY(double resY)
Optional spatial resolution in the units of crs.

Parameters:
resY - spatial resolutionm, or Double.NaN if not provided

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1996-2014 Geotools. All Rights Reserved.