org.n52.oxf.valueDomains.spatial
Class BoundingBox

java.lang.Object
  extended by org.n52.oxf.valueDomains.spatial.BoundingBox
All Implemented Interfaces:
IBoundingBox, IRangeValueDomain<IBoundingBox>, IValueDomain<IBoundingBox>
Direct Known Subclasses:
BoundingBox2D, BoundingBox3D

public class BoundingBox
extends Object
implements IBoundingBox, IRangeValueDomain<IBoundingBox>

This represents a standard BoundingBox. Does not any operations like zoom etc..

Author:
Theodor Foerster, Arne Broering
See Also:
BoundingBox2D, BoundingBox3D

Field Summary
protected  String crs
           
protected  int dimensions
           
static String ERROR_INPUT_COORDINATES
           
static String ERROR_NUM_OF_COORINDATE_DIFFER
           
protected  double[] lowerCorner
          stores the coordinates of the lowerCorner.
protected  double[] upperCorner
          stores the coordinates of the upperCorner.
 
Constructor Summary
BoundingBox(double[] lowerLeft, double[] upperRight)
          this constructor has all required attributes as its parameters.
BoundingBox(String crs, double[] lowerLeft, double[] upperRight)
          this constructor has all attributes as its parameters.
 
Method Summary
 boolean containsValue(IBoundingBox bBox)
          checks if the parameter bBox is contained in (or equal to) this BoundingBox.
 boolean equals(BoundingBox bbox)
           
 String getCRS()
           
 double getDepth()
          difference in z direction, i.e.
 int getDimensions()
           
 String getDomainDescription()
           
 double getHeight()
          difference in y direction, i.e.
 double[] getLowerCorner()
           
 double[] getMaxValue()
           
 double[] getMinValue()
           
 double[] getUpperCorner()
           
 double getWidth()
          difference in x direction, i.e.
 BoundingBox produceValue(String... stringArray)
           
protected  void setCRS(String crs)
           
protected  void setDimensions(int dimensions)
           
protected  void setLowerCorner(double[] lowerCornerArray)
           
protected  void setUpperCorner(double[] upperCornerArray)
           
 String toKVPString()
           
 String toString()
           
 String toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERROR_INPUT_COORDINATES

public static final String ERROR_INPUT_COORDINATES
See Also:
Constant Field Values

ERROR_NUM_OF_COORINDATE_DIFFER

public static final String ERROR_NUM_OF_COORINDATE_DIFFER
See Also:
Constant Field Values

lowerCorner

protected double[] lowerCorner
stores the coordinates of the lowerCorner. Order: { min_x, min_y (min_z) } (respectively: {Easting, Northing, (Height)} )


upperCorner

protected double[] upperCorner
stores the coordinates of the upperCorner. Order: { max_x, max_y (max_z) } (respectively: {Easting, Northing, (Height)} )


crs

protected String crs

dimensions

protected int dimensions
Constructor Detail

BoundingBox

public BoundingBox(double[] lowerLeft,
                   double[] upperRight)
this constructor has all required attributes as its parameters.

Parameters:
lowerLeft - the lowerCorner
upperRight - the upperCorner
Throws:
NullPointerException - if one of the arguments are null
IllegalStateException - if passed argument arrays have different length/dimension.

BoundingBox

public BoundingBox(String crs,
                   double[] lowerLeft,
                   double[] upperRight)
this constructor has all attributes as its parameters.

Parameters:
crs - a EPSG String for instance
lowerLeft - the lowerCorner
upperRight - the upperCorner
Throws:
NullPointerException - if one of the arguments are null
IllegalStateException - if passed argument arrays have different length/dimension.
Method Detail

getCRS

public String getCRS()
Specified by:
getCRS in interface IBoundingBox
Returns:
Returns the cRS.

setCRS

protected void setCRS(String crs)
Parameters:
crs - The cRS to set.

getMaxValue

public double[] getMaxValue()
Specified by:
getMaxValue in interface IRangeValueDomain<IBoundingBox>
Returns:
the maximum value of this RangeValueDomain. Of course the return type Object can be replaced by a specialized type. (e.g. BoundingBox: public double[] getMaxValue() )

getMinValue

public double[] getMinValue()
Specified by:
getMinValue in interface IRangeValueDomain<IBoundingBox>
Returns:
the minimum value of this RangeValueDomain. Of course the return type Object can be replaced by a specialized type. (e.g. BoundingBox: public double[] getMinValue() )

getLowerCorner

public double[] getLowerCorner()
Specified by:
getLowerCorner in interface IBoundingBox
Returns:
Returns the lowerCorner.

setLowerCorner

protected void setLowerCorner(double[] lowerCornerArray)
Parameters:
lowerCorner - The lowerCorner to set.
Throws:
OXFException - if the length of the coordinate tupel is not equal to the dimension count. This only happens, if the dimension number is set!

getUpperCorner

public double[] getUpperCorner()
Specified by:
getUpperCorner in interface IBoundingBox
Returns:
Returns the upperCorner.

setUpperCorner

protected void setUpperCorner(double[] upperCornerArray)
Parameters:
upperCorner - The upperCorner to set.
Throws:
OXFException - if the length of the coordinate tupel is not equal to the dimension count. This only happens, if the dimension number is set!

getDimensions

public int getDimensions()
Specified by:
getDimensions in interface IBoundingBox
Returns:
Returns the dimensions.

setDimensions

protected void setDimensions(int dimensions)
Parameters:
dimensions - The dimensions to set.

containsValue

public boolean containsValue(IBoundingBox bBox)
checks if the parameter bBox is contained in (or equal to) this BoundingBox.

Specified by:
containsValue in interface IValueDomain<IBoundingBox>
Returns:
if the value t is part of this value domain.

toXML

public String toXML()
Specified by:
toXML in interface IValueDomain<IBoundingBox>
Returns:
a XML representation of this Dataset-section.

toKVPString

public String toKVPString()
Returns:
a KeyValuePair-representation of this BBOX in the standard OGC form:
if it's a 2D BBOX: "minx,miny,maxx,maxy"
if it's a 3D BBOX: "minx,miny,maxx,maxy,minz,maxz"

toString

public String toString()
Overrides:
toString in class Object

getDomainDescription

public String getDomainDescription()
Specified by:
getDomainDescription in interface IValueDomain<IBoundingBox>
Returns:
plain text description of this valueDomain.

produceValue

public BoundingBox produceValue(String... stringArray)
Specified by:
produceValue in interface IValueDomain<IBoundingBox>

equals

public boolean equals(BoundingBox bbox)
Parameters:
bbox -
Returns:
true if the crs, dimensions and upper- and lowerCorner values of both BoundingBoxes are completely equal. false otherwise.

getWidth

public double getWidth()
difference in x direction, i.e. {lower,upper}Corner[0]

Returns:

getHeight

public double getHeight()
difference in y direction, i.e. {lower,upper}Corner[1]

Returns:

getDepth

public double getDepth()
difference in z direction, i.e. {lower,upper}Corner[2]

Returns:


Copyright © 2012-2013 52north.org. All Rights Reserved.