SFCGAL  2.3.0
Public Member Functions | Static Public Member Functions | List of all members
SFCGAL::Envelope Class Reference

Represents a bounding box. More...

#include <Envelope.h>

Public Member Functions

 Envelope ()
 default constructor (empty bounding box) More...
 
 Envelope (const double &xmin, const double &xmax, const double &ymin, const double &ymax)
 2D box constructor with min,max values More...
 
 Envelope (const double &xmin, const double &xmax, const double &ymin, const double &ymax, const double &zmin, const double &zmax)
 3D box constructor with min,max values More...
 
 Envelope (const Coordinate &coordinate)
 Constructor from single coordinate. More...
 
 Envelope (const Coordinate &coordinate1, const Coordinate &coordinate2)
 Constructor from two coordinates. More...
 
 Envelope (const Envelope &other)
 copy constructor More...
 
auto operator= (const Envelope &other) -> Envelope &
 assign operator More...
 
auto isEmpty () const -> bool
 indicates if the bounding box is empty More...
 
auto is3D () const -> bool
 indicates if the bounding box has a 3D component More...
 
void expandToInclude (const Coordinate &coordinate)
 expand the box to include coordinate More...
 
auto xMin () const -> const double &
 Get minimum X value. More...
 
const double & yMin () const
 Get minimum Y value. More...
 
const double & zMin () const
 Get minimum Z value. More...
 
const double & xMax () const
 Get maximum X value. More...
 
const double & yMax () const
 Get maximum Y value. More...
 
const double & zMax () const
 Get maximum Z value. More...
 
detail::Interval & boundsN (const size_t &n)
 returns the n-th bound More...
 
const detail::Interval & boundsN (const size_t &n) const
 returns the n-th bound More...
 
CGAL::Bbox_2 toBbox_2 () const
 Convenience function. More...
 
CGAL::Bbox_3 toBbox_3 () const
 Convenience function. More...
 
std::unique_ptr< LineString > toRing () const
 convenience method to convert to 2D Polygon ring More...
 
std::unique_ptr< Polygon > toPolygon () const
 convenience method to convert to 2D Polygon More...
 
std::unique_ptr< PolyhedralSurface > toShell () const
 convenience method to convert to 3D Shell More...
 
std::unique_ptr< Solid > toSolid () const
 convenience method to convert to 3D Solid More...
 
std::ostream & print (std::ostream &ostr) const
 Display method. More...
 

Static Public Member Functions

static bool contains (const Envelope &envelopeA, const Envelope &envelopeB)
 Global binary operator on Envelopes. More...
 
static bool overlaps (const Envelope &envelopeA, const Envelope &envelopeB)
 Global binary operator on Envelopes. More...
 

Detailed Description

Represents a bounding box.

Todo:

add asText instead of "print"?

add basic operations (especialy intersects/intersects3D)

Constructor & Destructor Documentation

SFCGAL::Envelope::Envelope ( )

default constructor (empty bounding box)

SFCGAL::Envelope::Envelope ( const double &  xmin,
const double &  xmax,
const double &  ymin,
const double &  ymax 
)

2D box constructor with min,max values

Parameters
xminMinimum X value
xmaxMaximum X value
yminMinimum Y value
ymaxMaximum Y value
SFCGAL::Envelope::Envelope ( const double &  xmin,
const double &  xmax,
const double &  ymin,
const double &  ymax,
const double &  zmin,
const double &  zmax 
)

3D box constructor with min,max values

Parameters
xminMinimum X value
xmaxMaximum X value
yminMinimum Y value
ymaxMaximum Y value
zminMinimum Z value
zmaxMaximum Z value
SFCGAL::Envelope::Envelope ( const Coordinate &  coordinate)

Constructor from single coordinate.

Parameters
coordinateThe coordinate to create envelope from
SFCGAL::Envelope::Envelope ( const Coordinate &  coordinate1,
const Coordinate &  coordinate2 
)

Constructor from two coordinates.

Parameters
coordinate1First coordinate
coordinate2Second coordinate
SFCGAL::Envelope::Envelope ( const Envelope &  other)

copy constructor

Parameters
otherThe envelope to copy from

Member Function Documentation

detail::Interval& SFCGAL::Envelope::boundsN ( const size_t &  n)
inline

returns the n-th bound

Parameters
nThe index of the bound (0=X, 1=Y, 2=Z)
Returns
Reference to the nth interval bound
const detail::Interval& SFCGAL::Envelope::boundsN ( const size_t &  n) const
inline

returns the n-th bound

Parameters
nThe index of the bound (0=X, 1=Y, 2=Z)
Returns
Const reference to the nth interval bound
auto SFCGAL::Envelope::contains ( const Envelope &  envelopeA,
const Envelope &  envelopeB 
)
static

Global binary operator on Envelopes.

Test if A's bounding box contains B's

Parameters
envelopeAFirst envelope
envelopeBSecond envelope
Returns
true if envelope envelopeA contains envelope envelopeB FIXME: consider moving that outside of the class
void SFCGAL::Envelope::expandToInclude ( const Coordinate &  coordinate)

expand the box to include coordinate

Parameters
coordinateThe coordinate to include in the envelope
auto SFCGAL::Envelope::is3D ( ) const -> bool

indicates if the bounding box has a 3D component

Returns
true if 3D, false otherwise
auto SFCGAL::Envelope::isEmpty ( ) const -> bool

indicates if the bounding box is empty

Returns
true if empty, false otherwise
auto SFCGAL::Envelope::operator= ( const Envelope &  other) -> Envelope &

assign operator

Parameters
otherThe envelope to assign from
Returns
Reference to this envelope
auto SFCGAL::Envelope::overlaps ( const Envelope &  envelopeA,
const Envelope &  envelopeB 
)
static

Global binary operator on Envelopes.

Test if A's bounding box overlaps B's

Parameters
envelopeAFirst envelope
envelopeBSecond envelope
Returns
true if envelope envelopeA overlaps envelope envelopeB
auto SFCGAL::Envelope::print ( std::ostream &  ostr) const

Display method.

Parameters
ostrOutput stream to print to
Returns
Reference to the output stream
CGAL::Bbox_2 SFCGAL::Envelope::toBbox_2 ( ) const
inline

Convenience function.

Convert to CGAL::BBox_2

Returns
CGAL 2D bounding box
CGAL::Bbox_3 SFCGAL::Envelope::toBbox_3 ( ) const
inline

Convenience function.

Convert to CGAL::BBox_3

Returns
CGAL 3D bounding box
auto SFCGAL::Envelope::toPolygon ( ) const

convenience method to convert to 2D Polygon

Returns
A Polygon representing the envelope
Warning
empty Polygon for empty Envelope, may be X or Y collapsed
auto SFCGAL::Envelope::toRing ( ) const

convenience method to convert to 2D Polygon ring

Returns
A LineString representing the envelope boundary
Warning
empty LineString for empty Envelope, may be X or Y collapsed
auto SFCGAL::Envelope::toShell ( ) const

convenience method to convert to 3D Shell

Returns
A PolyhedralSurface representing the envelope shell
Warning
empty Solid for empty or non 3D Envelope, may be X, Y or Z collapsed
auto SFCGAL::Envelope::toSolid ( ) const

convenience method to convert to 3D Solid

Returns
A Solid representing the envelope
Warning
empty Solid for empty or non 3D Envelope, may be X, Y or Z collapsed
const double& SFCGAL::Envelope::xMax ( ) const
inline

Get maximum X value.

Returns
The maximum X coordinate
auto SFCGAL::Envelope::xMin ( ) const -> const double &
inline

Get minimum X value.

Returns
The minimum X coordinate
const double& SFCGAL::Envelope::yMax ( ) const
inline

Get maximum Y value.

Returns
The maximum Y coordinate
const double& SFCGAL::Envelope::yMin ( ) const
inline

Get minimum Y value.

Returns
The minimum Y coordinate
const double& SFCGAL::Envelope::zMax ( ) const
inline

Get maximum Z value.

Returns
The maximum Z coordinate
const double& SFCGAL::Envelope::zMin ( ) const
inline

Get minimum Z value.

Returns
The minimum Z coordinate