te::gm::Envelope Class Reference

An Envelope defines a 2D rectangular region. More...

#include <Envelope.h>

Public Member Functions

Basic Envelope Methods

Basic Envelope methods.

 Envelope ()
 It constructs an envelope with invalid coordinates. More...
 
 Envelope (const double &llx, const double &lly, const double &urx, const double &ury)
 Constructor. More...
 
 Envelope (const std::vector< double > &vectd)
 Constructor. More...
 
 Envelope (const Envelope &rhs)
 Copy constructor. More...
 
void init (const double &llx, const double &lly, const double &urx, const double &ury)
 It initializes (sets) the envelope bounds. More...
 
const double & getLowerLeftX () const
 It returns a constant reference to the x coordinate of the lower left corner. More...
 
double & getLowerLeftX ()
 It returns a constant reference to the x coordinate of the lower left corner. More...
 
const double & getLowerLeftY () const
 It returns a constant refernce to the y coordinate of the lower left corner. More...
 
double & getLowerLeftY ()
 It returns a constant refernce to the y coordinate of the lower left corner. More...
 
const double & getUpperRightX () const
 It returns a constant refernce to the x coordinate of the upper right corner. More...
 
double & getUpperRightX ()
 It returns a constant refernce to the y coordinate of the upper right corner. More...
 
const double & getUpperRightY () const
 It returns a constant refernce to the x coordinate of the upper right corner. More...
 
double & getUpperRightY ()
 It returns a constant refernce to the y coordinate of the upper right corner. More...
 
Coord2D getLowerLeft () const
 It returns the lower left coordinate of the envelope. More...
 
Coord2D getUpperRight () const
 It returns the upper right coordinate of the envelope. More...
 
Coord2D getCenter () const
 It returns the rectangle's center coordinate. More...
 
void makeInvalid ()
 It will invalidated the envelope. More...
 
bool isValid () const
 It tells if the rectangle is valid or not. More...
 
double getWidth () const
 It returns the envelope width. More...
 
double getHeight () const
 It returns the envelope height. More...
 
double getArea () const
 It returns the area of this envelope as measured in the spatial reference system of it. More...
 
Envelope Operators

Overloaded operators for an envelope.

Envelopeoperator= (const Envelope &rhs)
 Assignment operator. More...
 
bool operator== (const Envelope &rhs) const
 Equal operator. More...
 
Spatial Operations

Methods for testing spatial relations between Envelope objects and to perform some operations over envelope type.

bool equals (const Envelope &rhs) const
 It returns true if the envelopes are "spatially equal". More...
 
bool disjoint (const Envelope &rhs) const
 It returns true if this envelope is "spatially disjoint" from rhs envelope. More...
 
bool intersects (const Envelope &rhs) const
 It returns true if the envelopes "spatially intersects". More...
 
bool touches (const Envelope &rhs) const
 It returns true if the envelopes "spatially touches". More...
 
bool within (const Envelope &rhs) const
 It returns true if this envelope is "spatially within" the rhs envelope. More...
 
bool contains (const Envelope &rhs) const
 It returns true if this envelope "spatially contains" the rhs envelope. More...
 
double distance (const Envelope &rhs) const
 It returns the shortest distance between any two points in the two envelopes. More...
 
Envelope intersection (const Envelope &rhs) const
 It returns an envelope that represents the point set intersection with another envelope. More...
 
void Union (const Envelope &rhs)
 It updates the envelop with coordinates of another envelope. More...
 
void transform (int oldsrid, int newsrid)
 It will transform the coordinates of the Envelope from the old SRS to the new one. More...
 

Public Attributes

double m_llx
 Lower left corner x-coordinate. More...
 
double m_lly
 Lower left corner y-coordinate. More...
 
double m_urx
 Upper right corner x-coordinate. More...
 
double m_ury
 Upper right corner y-coordinate. More...
 

Detailed Description

An Envelope defines a 2D rectangular region.

Definition at line 51 of file Envelope.h.

Constructor & Destructor Documentation

te::gm::Envelope::Envelope ( )
inline

It constructs an envelope with invalid coordinates.

Definition at line 350 of file Envelope.h.

References makeInvalid().

Referenced by intersection().

te::gm::Envelope::Envelope ( const double &  llx,
const double &  lly,
const double &  urx,
const double &  ury 
)
inline

Constructor.

Parameters
llxLower left corner x-coordinate.
llyLower left corner y-coordinate.
urxUpper right corner x-coordinate.
uryUpper right corner y-coordinate.

Definition at line 355 of file Envelope.h.

References init().

te::gm::Envelope::Envelope ( const std::vector< double > &  vectd)
inline

Constructor.

Parameters
vectdVector of doubles representing the envelope lower left and upper right corners.

Definition at line 361 of file Envelope.h.

te::gm::Envelope::Envelope ( const Envelope rhs)
inline

Copy constructor.

Parameters
rhsThe source object to copy from.

Definition at line 376 of file Envelope.h.

References init(), m_llx, m_lly, m_urx, and m_ury.

Member Function Documentation

bool te::gm::Envelope::contains ( const Envelope rhs) const
inline

It returns true if this envelope "spatially contains" the rhs envelope.

Parameters
rhsThe other envelope to be compared.
Returns
True if this envelope "spatially contains" the rhs envelope.

Definition at line 535 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

bool te::gm::Envelope::disjoint ( const Envelope rhs) const
inline

It returns true if this envelope is "spatially disjoint" from rhs envelope.

Parameters
rhsThe other envelope to be compared.
Returns
True if this envelope is "spatially disjoint" from the other envelope.

Definition at line 482 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

double te::gm::Envelope::distance ( const Envelope rhs) const

It returns the shortest distance between any two points in the two envelopes.

Parameters
rhsThe other envelope.
Returns
The shortest distance between any two points in the two envelopes.
Note
It calculates the shortest distance in the spatial reference system of the envelopes.
If the two envelopes intersects it will return "0.0".
bool te::gm::Envelope::equals ( const Envelope rhs) const
inline

It returns true if the envelopes are "spatially equal".

Parameters
rhsThe another envelope to be compared.
Returns
True if the enevlopes are "spatially equal".

Definition at line 477 of file Envelope.h.

double te::gm::Envelope::getArea ( ) const
inline

It returns the area of this envelope as measured in the spatial reference system of it.

Returns
The area of this envelope.

Definition at line 453 of file Envelope.h.

References getHeight(), and getWidth().

Referenced by te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::classify(), te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::pickBranch(), and te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::pigeonhole().

Coord2D te::gm::Envelope::getCenter ( ) const

It returns the rectangle's center coordinate.

Returns
The rectangle's center coordinate.
double te::gm::Envelope::getHeight ( ) const
inline

It returns the envelope height.

Returns
The envelope height.

Definition at line 448 of file Envelope.h.

References m_lly, and m_ury.

Referenced by getArea().

Coord2D te::gm::Envelope::getLowerLeft ( ) const

It returns the lower left coordinate of the envelope.

Returns
The lower left coordinate of the envelope.

Referenced by te::rst::PolygonIterator< T >::PolygonIterator().

const double & te::gm::Envelope::getLowerLeftX ( ) const
inline

It returns a constant reference to the x coordinate of the lower left corner.

Returns
A constant reference to the x coordinate of the lower left corner.

Definition at line 390 of file Envelope.h.

References m_llx.

double & te::gm::Envelope::getLowerLeftX ( )
inline

It returns a constant reference to the x coordinate of the lower left corner.

Returns
A constant reference to the x coordinate of the lower left corner.

Definition at line 395 of file Envelope.h.

References m_llx.

const double & te::gm::Envelope::getLowerLeftY ( ) const
inline

It returns a constant refernce to the y coordinate of the lower left corner.

Returns
A constant refernce to the y coordinate of the lower left corner.

Definition at line 400 of file Envelope.h.

References m_lly.

double & te::gm::Envelope::getLowerLeftY ( )
inline

It returns a constant refernce to the y coordinate of the lower left corner.

Returns
A constant refernce to the y coordinate of the lower left corner.

Definition at line 405 of file Envelope.h.

References m_lly.

Coord2D te::gm::Envelope::getUpperRight ( ) const

It returns the upper right coordinate of the envelope.

Returns
The upper right coordinate of the envelope.

Referenced by te::rst::PolygonIterator< T >::PolygonIterator().

const double & te::gm::Envelope::getUpperRightX ( ) const
inline

It returns a constant refernce to the x coordinate of the upper right corner.

Returns
A constant refernce to the x coordinate of the upper right corner.

Definition at line 410 of file Envelope.h.

References m_urx.

double & te::gm::Envelope::getUpperRightX ( )
inline

It returns a constant refernce to the y coordinate of the upper right corner.

Returns
A constant refernce to the y coordinate of the upper right corner.

Definition at line 415 of file Envelope.h.

References m_urx.

const double & te::gm::Envelope::getUpperRightY ( ) const
inline

It returns a constant refernce to the x coordinate of the upper right corner.

Returns
A constant refernce to the x coordinate of the upper right corner.

Definition at line 420 of file Envelope.h.

References m_ury.

double & te::gm::Envelope::getUpperRightY ( )
inline

It returns a constant refernce to the y coordinate of the upper right corner.

Returns
A constant refernce to the y coordinate of the upper right corner.

Definition at line 425 of file Envelope.h.

References m_ury.

double te::gm::Envelope::getWidth ( ) const
inline

It returns the envelope width.

Returns
The envelope width.

Definition at line 443 of file Envelope.h.

References m_llx, and m_urx.

Referenced by getArea().

void te::gm::Envelope::init ( const double &  llx,
const double &  lly,
const double &  urx,
const double &  ury 
)
inline

It initializes (sets) the envelope bounds.

Parameters
llxLower left corner x-coordinate.
llyLower left corner y-coordinate.
urxUpper right corner x-coordinate.
uryUpper right corner y-coordinate.

Definition at line 381 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Referenced by Envelope(), makeInvalid(), and operator=().

Envelope te::gm::Envelope::intersection ( const Envelope rhs) const
inline

It returns an envelope that represents the point set intersection with another envelope.

Parameters
rhsThe other envelope whose intersection with this envelope will be calculated.
Returns
An envelope representing the intersection with this envelope. It can be a degenerated envelope if they only "spatially touch" each other".
Precondition
The rhs envelope must intersects this envelope.
Note
The caller of this method will take the ownership of the returned envelope.
Warning
Calling this method with two envelopes that doesn't intersect may return an invalid envelope.

Definition at line 543 of file Envelope.h.

References Envelope(), intersects(), m_llx, m_lly, m_urx, and m_ury.

bool te::gm::Envelope::intersects ( const Envelope rhs) const
inline

It returns true if the envelopes "spatially intersects".

Parameters
rhsThe other envelope to be compared.
Returns
True if the envelopes "spatially intersects".

Definition at line 493 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Referenced by intersection(), te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::remove2(), and te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::search().

bool te::gm::Envelope::isValid ( ) const
inline

It tells if the rectangle is valid or not.

Returns
False if the rectangle coordinates are not valid and true otherwise.

Definition at line 438 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Referenced by te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::Index().

void te::gm::Envelope::makeInvalid ( )
inline

It will invalidated the envelope.

Definition at line 430 of file Envelope.h.

References init().

Referenced by Envelope().

Envelope & te::gm::Envelope::operator= ( const Envelope rhs)
inline

Assignment operator.

Parameters
rhsThe source object to copy from.
Returns
A reference to this instance.

Definition at line 458 of file Envelope.h.

References init(), m_llx, m_lly, m_urx, and m_ury.

bool te::gm::Envelope::operator== ( const Envelope rhs) const
inline

Equal operator.

Parameters
rhsThe source object to be compared.
Returns
True if the rectangles have the same exact coordinates.

Definition at line 466 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

bool te::gm::Envelope::touches ( const Envelope rhs) const
inline

It returns true if the envelopes "spatially touches".

Parameters
rhsThe other envelope to be compared.
Returns
True if the envelopes "spatially touches".

Definition at line 504 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

void te::gm::Envelope::transform ( int  oldsrid,
int  newsrid 
)

It will transform the coordinates of the Envelope from the old SRS to the new one.

After calling this method the Envelope will be associated to the new SRID.

Parameters
oldsridThe old Spatial Reference System.
newsridThe new Spatial Reference System used to transform the coordinates of the Envelope.
Exceptions
ExceptionIt may throw an exception if it can not do the transformation.
void te::gm::Envelope::Union ( const Envelope rhs)
inline

It updates the envelop with coordinates of another envelope.

Parameters
rhsThe other envelope whose coordinates will be used to update this one.

Definition at line 555 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Referenced by te::sam::rtree::Index< DATATYPE, MAXNODES, MINNODES >::combineRect().

bool te::gm::Envelope::within ( const Envelope rhs) const
inline

It returns true if this envelope is "spatially within" the rhs envelope.

Parameters
rhsThe other envelope to be compared.
Returns
True if this envelope is "spatially within" the rhs envelope.

Definition at line 527 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Member Data Documentation


The documentation for this class was generated from the following file: