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

◆ Envelope() [1/4]

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().

◆ Envelope() [2/4]

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.

◆ Envelope() [3/4]

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 365 of file Envelope.h.

◆ Envelope() [4/4]

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

Copy constructor.

Parameters
rhsThe source object to copy from.

Definition at line 380 of file Envelope.h.

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

Member Function Documentation

◆ contains()

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 539 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

◆ disjoint()

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 486 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

◆ distance()

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".

◆ equals()

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 481 of file Envelope.h.

◆ getArea()

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 457 of file Envelope.h.

References getHeight(), and getWidth().

Referenced by te::sam::rtree::Index< te::edit::VertexIndex, 8 >::classify(), te::sam::rtree::Index< te::edit::VertexIndex, 8 >::pickBranch(), and te::sam::rtree::Index< te::edit::VertexIndex, 8 >::pigeonhole().

◆ getCenter()

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

It returns the rectangle's center coordinate.

Returns
The rectangle's center coordinate.

◆ getHeight()

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

It returns the envelope height.

Returns
The envelope height.

Definition at line 452 of file Envelope.h.

References m_lly, and m_ury.

Referenced by getArea().

◆ getLowerLeft()

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

It returns the lower left coordinate of the envelope.

Returns
The lower left coordinate of the envelope.

◆ getLowerLeftX() [1/2]

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 394 of file Envelope.h.

References m_llx.

◆ getLowerLeftX() [2/2]

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 399 of file Envelope.h.

References m_llx.

◆ getLowerLeftY() [1/2]

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 404 of file Envelope.h.

References m_lly.

◆ getLowerLeftY() [2/2]

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 409 of file Envelope.h.

References m_lly.

◆ getUpperRight()

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

It returns the upper right coordinate of the envelope.

Returns
The upper right coordinate of the envelope.

◆ getUpperRightX() [1/2]

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 414 of file Envelope.h.

References m_urx.

◆ getUpperRightX() [2/2]

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 419 of file Envelope.h.

References m_urx.

◆ getUpperRightY() [1/2]

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 424 of file Envelope.h.

References m_ury.

◆ getUpperRightY() [2/2]

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 429 of file Envelope.h.

References m_ury.

◆ getWidth()

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

It returns the envelope width.

Returns
The envelope width.

Definition at line 447 of file Envelope.h.

References m_llx, and m_urx.

Referenced by getArea().

◆ init()

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 385 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

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

◆ intersection()

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 547 of file Envelope.h.

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

◆ intersects()

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 497 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Referenced by intersection(), te::sam::rtree::Index< te::edit::VertexIndex, 8 >::remove2(), and te::sam::rtree::Index< te::edit::VertexIndex, 8 >::search().

◆ isValid()

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 442 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

◆ makeInvalid()

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

It will invalidated the envelope.

Definition at line 434 of file Envelope.h.

References init().

Referenced by Envelope().

◆ operator=()

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 462 of file Envelope.h.

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

◆ operator==()

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 470 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

◆ touches()

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 508 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

◆ transform()

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.

◆ Union()

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 559 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Referenced by te::sam::rtree::Index< te::edit::VertexIndex, 8 >::combineRect().

◆ within()

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 531 of file Envelope.h.

References m_llx, m_lly, m_urx, and m_ury.

Member Data Documentation

◆ m_llx

◆ m_lly

◆ m_urx

◆ m_ury


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