SFCGAL
Public Types | Public Member Functions | Protected Member Functions | List of all members
SFCGAL::GeometryCollection Class Reference

A GeometryCollection in SFA. More...

#include <GeometryCollection.h>

Inheritance diagram for SFCGAL::GeometryCollection:
SFCGAL::Geometry SFCGAL::MultiLineString SFCGAL::MultiPoint SFCGAL::MultiPolygon SFCGAL::MultiSolid

Public Types

typedef boost::ptr_vector< Geometry >::iterator iterator
 
typedef boost::ptr_vector< Geometry >::const_iterator const_iterator
 

Public Member Functions

 GeometryCollection ()
 Empty GeometryCollection constructor.
 
 GeometryCollection (const GeometryCollection &other)
 Copy constructor.
 
GeometryCollectionoperator= (GeometryCollection other)
 assign operator
 
virtual ~GeometryCollection ()
 destructor
 
virtual GeometryCollectionclone () const
 Get a deep copy of the geometry.
 
virtual std::string geometryType () const
 [OGC/SFA]returns the geometry type
 
virtual GeometryType geometryTypeId () const
 Returns a code corresponding to the type.
 
virtual int dimension () const
 [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...)
 
virtual int coordinateDimension () const
 [OGC/SFA]returns the dimension of the coordinates
 
virtual bool isEmpty () const
 [OGC/SFA]test if geometry is empty
 
virtual bool is3D () const
 [OGC/SFA]test if geometry is 3d
 
virtual bool isMeasured () const
 [OGC/SFA]test if geometry is measured (has an m)
 
virtual size_t numGeometries () const
 [OGC/SFA]Gets the number of geometries in a collection of geometries
 
virtual const GeometrygeometryN (size_t const &n) const
 [OGC/SFA]Returns the n-th geometry
 
virtual GeometrygeometryN (size_t const &n)
 [OGC/SFA]Returns the n-th geometry
 
void addGeometry (Geometry *geometry)
 [SFA/OGC]add a geometry to the collection (takes ownership)
 
void addGeometry (Geometry const &geometry)
 [SFA/OGC]add a geometry to the collection (clone instance)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
virtual void accept (GeometryVisitor &visitor)
 [visitor]dispatch visitor
 
virtual void accept (ConstGeometryVisitor &visitor) const
 [visitor]dispatch visitor
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer.
 
- Public Member Functions inherited from SFCGAL::Geometry
 Geometry ()
 Default constructor.
 
 Geometry (const Geometry &)=default
 Copy constructor.
 
Geometryoperator= (const Geometry &other)=default
 Copy assignemnt operator.
 
virtual ~Geometry ()=default
 Destructor.
 
virtual Geometryclone () const =0
 Get a deep copy of the geometry.
 
virtual std::string geometryType () const =0
 [OGC/SFA]returns the geometry type
 
virtual GeometryType geometryTypeId () const =0
 Returns a code corresponding to the type.
 
virtual int dimension () const =0
 [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...)
 
virtual int coordinateDimension () const =0
 [OGC/SFA]returns the dimension of the coordinates
 
virtual bool isEmpty () const =0
 [OGC/SFA]test if geometry is empty
 
virtual bool is3D () const =0
 [OGC/SFA]test if geometry is 3d
 
virtual bool isMeasured () const =0
 [OGC/SFA]test if geometry is measured (has an m)
 
void forceValidityFlag (bool validity)
 Force the state of the validity flag.
 
bool hasValidityFlag () const
 Returns the validity flag.
 
std::string asText (const int &numDecimals=-1) const
 [OGC/SFA]returns the WKT string
 
std::string asWkb (boost::endian::order wkbOrder=boost::endian::order::native, bool asHex=false) const
 [OGC/SFA]returns the WKB string
 
Envelope envelope () const
 [OGC/SFA]Returns a polygon representing the BBOX of the geometry
 
virtual std::unique_ptr< Geometryboundary () const
 [OGC/SFA]Returns the boundary of the geometry
 
double distance (const Geometry &other) const
 Computes the distance to an other geometry.
 
double distance3D (const Geometry &other) const
 Computes the 3D distance to an other geometry.
 
void round (const long &scale=1)
 round the geometry with a corresponding scale factor
 
auto almostEqual (const Geometry &, const double tolerance) const -> bool
 Equality operator.
 
virtual size_t numGeometries () const
 [OGC/SFA]Gets the number of geometries in a collection of geometries
 
virtual const GeometrygeometryN (size_t const &n) const
 [OGC/SFA]Returns the n-th geometry
 
virtual GeometrygeometryN (size_t const &n)
 [OGC/SFA]Returns the n-th geometry
 
template<typename Derived >
bool is () const
 Tests if geometry is of "Derived" type given as template parameter.
 
template<typename Derived >
const Derived & as () const
 Downcast to a "Derived" class.
 
template<typename Derived >
Derived & as ()
 Downcast to a "Derived" class.
 
virtual void accept (GeometryVisitor &visitor)=0
 [visitor]dispatch visitor
 
virtual void accept (ConstGeometryVisitor &visitor) const =0
 [visitor]dispatch visitor
 
template<class Archive >
void serialize (Archive &, const unsigned int)
 Serializer.
 

Protected Member Functions

virtual bool isAllowed (Geometry const &g)
 Test if a geometry in the collection.
 
void swap (GeometryCollection &other)
 Swap.
 

Additional Inherited Members

- Protected Attributes inherited from SFCGAL::Geometry
bool validityFlag_
 

Detailed Description

A GeometryCollection in SFA.

Member Typedef Documentation

◆ const_iterator

typedef boost::ptr_vector<Geometry>::const_iterator SFCGAL::GeometryCollection::const_iterator

◆ iterator

typedef boost::ptr_vector<Geometry>::iterator SFCGAL::GeometryCollection::iterator

Constructor & Destructor Documentation

◆ GeometryCollection() [1/2]

SFCGAL::GeometryCollection::GeometryCollection ( )

Empty GeometryCollection constructor.

◆ GeometryCollection() [2/2]

SFCGAL::GeometryCollection::GeometryCollection ( const GeometryCollection other)

Copy constructor.

◆ ~GeometryCollection()

SFCGAL::GeometryCollection::~GeometryCollection ( )
virtualdefault

destructor

Member Function Documentation

◆ accept() [1/2]

void SFCGAL::GeometryCollection::accept ( ConstGeometryVisitor visitor) const
virtual

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

Reimplemented in SFCGAL::MultiLineString, SFCGAL::MultiPoint, SFCGAL::MultiPolygon, and SFCGAL::MultiSolid.

◆ accept() [2/2]

void SFCGAL::GeometryCollection::accept ( GeometryVisitor visitor)
virtual

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

Reimplemented in SFCGAL::MultiLineString, SFCGAL::MultiPoint, SFCGAL::MultiPolygon, and SFCGAL::MultiSolid.

◆ addGeometry() [1/2]

void SFCGAL::GeometryCollection::addGeometry ( Geometry geometry)

[SFA/OGC]add a geometry to the collection (takes ownership)

◆ addGeometry() [2/2]

void SFCGAL::GeometryCollection::addGeometry ( Geometry const &  geometry)

[SFA/OGC]add a geometry to the collection (clone instance)

◆ begin() [1/2]

iterator SFCGAL::GeometryCollection::begin ( )
inline

◆ begin() [2/2]

const_iterator SFCGAL::GeometryCollection::begin ( ) const
inline

◆ clone()

auto SFCGAL::GeometryCollection::clone ( ) const
virtual

Get a deep copy of the geometry.

Implements SFCGAL::Geometry.

Reimplemented in SFCGAL::MultiLineString, SFCGAL::MultiPoint, SFCGAL::MultiPolygon, and SFCGAL::MultiSolid.

◆ coordinateDimension()

auto SFCGAL::GeometryCollection::coordinateDimension ( ) const
virtual

[OGC/SFA]returns the dimension of the coordinates

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ dimension()

auto SFCGAL::GeometryCollection::dimension ( ) const
virtual

[OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...)

Warning
empty geometries provide the dimension corresponding to the object

Implements SFCGAL::Geometry.

◆ end() [1/2]

iterator SFCGAL::GeometryCollection::end ( )
inline

◆ end() [2/2]

const_iterator SFCGAL::GeometryCollection::end ( ) const
inline

◆ geometryN() [1/2]

auto SFCGAL::GeometryCollection::geometryN ( size_t const &  n)
virtual

[OGC/SFA]Returns the n-th geometry

Warning
*this for Point, LineString, Polygon, Triangle

Reimplemented from SFCGAL::Geometry.

◆ geometryN() [2/2]

auto SFCGAL::GeometryCollection::geometryN ( size_t const &  n) const
virtual

[OGC/SFA]Returns the n-th geometry

Warning
*this for Point, LineString, Polygon, Triangle

Reimplemented from SFCGAL::Geometry.

◆ geometryType()

auto SFCGAL::GeometryCollection::geometryType ( ) const
virtual

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

Reimplemented in SFCGAL::MultiLineString, SFCGAL::MultiPoint, SFCGAL::MultiPolygon, and SFCGAL::MultiSolid.

◆ geometryTypeId()

auto SFCGAL::GeometryCollection::geometryTypeId ( ) const
virtual

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

Reimplemented in SFCGAL::MultiLineString, SFCGAL::MultiPoint, SFCGAL::MultiPolygon, and SFCGAL::MultiSolid.

◆ is3D()

auto SFCGAL::GeometryCollection::is3D ( ) const
virtual

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ isAllowed()

auto SFCGAL::GeometryCollection::isAllowed ( Geometry const &  g)
protectedvirtual

Test if a geometry in the collection.

Reimplemented in SFCGAL::MultiLineString, SFCGAL::MultiPoint, SFCGAL::MultiPolygon, and SFCGAL::MultiSolid.

◆ isEmpty()

auto SFCGAL::GeometryCollection::isEmpty ( ) const
virtual

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

◆ isMeasured()

auto SFCGAL::GeometryCollection::isMeasured ( ) const
virtual

[OGC/SFA]test if geometry is measured (has an m)

Precondition
suppose no mix of M/!M points

Implements SFCGAL::Geometry.

◆ numGeometries()

auto SFCGAL::GeometryCollection::numGeometries ( ) const
virtual

[OGC/SFA]Gets the number of geometries in a collection of geometries

Warning
1 for Point, LineString, Polygon, Triangle

Reimplemented from SFCGAL::Geometry.

◆ operator=()

auto SFCGAL::GeometryCollection::operator= ( GeometryCollection  other)

assign operator

◆ serialize()

template<class Archive >
void SFCGAL::GeometryCollection::serialize ( Archive &  ar,
const unsigned int   
)
inline

Serializer.

◆ swap()

void SFCGAL::GeometryCollection::swap ( GeometryCollection other)
inlineprotected

Swap.