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

A GeometryCollection in SFA. More...

#include <GeometryCollection.h>

Inherits SFCGAL::GeometryImpl< Derived, Base >.

Inherited by SFCGAL::GeometryImpl< MultiLineString, GeometryCollection >, SFCGAL::GeometryImpl< MultiPoint, GeometryCollection >, SFCGAL::GeometryImpl< MultiPolygon, GeometryCollection >, and SFCGAL::GeometryImpl< MultiSolid, GeometryCollection >.

Public Types

using iterator = DereferenceIterator< std::vector< std::unique_ptr< Geometry >>::iterator >
 Iterator type for geometry collection. More...
 
using const_iterator = DereferenceIterator< std::vector< std::unique_ptr< Geometry >>::const_iterator >
 Const iterator type for geometry collection. More...
 

Public Member Functions

 GeometryCollection ()
 Empty GeometryCollection constructor. More...
 
 GeometryCollection (const GeometryCollection &other)
 Copy constructor. More...
 
auto operator= (GeometryCollection other) -> GeometryCollection &
 assign operator More...
 
 ~GeometryCollection () override
 destructor More...
 
auto geometryType () const -> std::string override
 Get the geometry type as string. More...
 
auto geometryTypeId () const -> GeometryType override
 Get the geometry type identifier. More...
 
auto dimension () const -> int override
 Get the dimension of the collection. More...
 
auto coordinateDimension () const -> int override
 Get the coordinate dimension. More...
 
auto isEmpty () const -> bool override
 Check if the collection is empty. More...
 
auto is3D () const -> bool override
 Check if the collection has 3D coordinates. More...
 
auto isMeasured () const -> bool override
 Check if the collection has measured coordinates. More...
 
auto dropZ () -> bool override
 Drop Z coordinate from all geometries. More...
 
auto dropM () -> bool override
 Drop M coordinate from all geometries. More...
 
auto swapXY () -> void override
 Swap X and Y coordinates of all geometries in collection. More...
 
auto numGeometries () const -> size_t override
 Get the number of geometries in the collection. More...
 
auto geometryN (size_t const &n) const -> const Geometry &override
 Get the n-th geometry in the collection (const version) More...
 
auto geometryN (size_t const &n) -> Geometry &override
 Get the n-th geometry in the collection (non-const version) More...
 
void setGeometryN (const Geometry &geometry, size_t const &idx) override
 Set the geometry at the given index (copy version) More...
 
void setGeometryN (Geometry *geometry, size_t const &idx) override
 Set the geometry at the given index (pointer version) More...
 
void setGeometryN (std::unique_ptr< Geometry > geometry, size_t const &idx) override
 [SFA/OGC] Sets the n-th geometry using unique_ptr More...
 
void addGeometry (std::unique_ptr< Geometry > geometry)
 [SFA/OGC] Add a geometry to the collection. More...
 
void addGeometry (Geometry *geometry)
 [SFA/OGC]add a geometry to the collection (takes ownership) More...
 
void addGeometry (Geometry const &geometry)
 [SFA/OGC]add a geometry to the collection (clone instance) More...
 
auto begin () -> iterator
 Get iterator to beginning of geometries. More...
 
auto begin () const -> const_iterator
 Get const iterator to beginning of geometries. More...
 
auto end () -> iterator
 Get iterator to end of geometries. More...
 
auto end () const -> const_iterator
 Get const iterator to end of geometries. More...
 
void accept (GeometryVisitor &visitor) override
 Accept a geometry visitor. More...
 
void accept (ConstGeometryVisitor &visitor) const override
 Accept a const geometry visitor. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer. More...
 

Protected Member Functions

virtual auto isAllowed (Geometry const &geometry) -> bool
 Test if a geometry is allowed in the collection. More...
 
void swap (GeometryCollection &other)
 Swap the contents of two geometry collections. More...
 

Detailed Description

A GeometryCollection in SFA.

Member Typedef Documentation

using SFCGAL::GeometryCollection::const_iterator = DereferenceIterator< std::vector<std::unique_ptr<Geometry>>::const_iterator>

Const iterator type for geometry collection.

using SFCGAL::GeometryCollection::iterator = DereferenceIterator<std::vector<std::unique_ptr<Geometry>>::iterator>

Iterator type for geometry collection.

Constructor & Destructor Documentation

SFCGAL::GeometryCollection::GeometryCollection ( )
default

Empty GeometryCollection constructor.

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

Copy constructor.

Parameters
otherThe geometry collection to copy from
SFCGAL::GeometryCollection::~GeometryCollection ( )
overridedefault

destructor

Member Function Documentation

void SFCGAL::GeometryCollection::accept ( GeometryVisitor &  visitor)
override

Accept a geometry visitor.

Parameters
visitorVisitor to accept
void SFCGAL::GeometryCollection::accept ( ConstGeometryVisitor &  visitor) const
override

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept
void SFCGAL::GeometryCollection::addGeometry ( std::unique_ptr< Geometry >  geometry)

[SFA/OGC] Add a geometry to the collection.

Parameters
geometryA unique pointer to the Geometry object to add. Ownership of this geometry is moved into the GeometryCollection.
void SFCGAL::GeometryCollection::addGeometry ( Geometry *  geometry)

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

Parameters
geometryPointer to geometry to add
Deprecated:
The unique_ptr version should be used instead
void SFCGAL::GeometryCollection::addGeometry ( Geometry const &  geometry)

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

Parameters
geometryConst reference to geometry to clone and add
auto SFCGAL::GeometryCollection::begin ( ) -> iterator
inline

Get iterator to beginning of geometries.

Returns
Iterator to first geometry
auto SFCGAL::GeometryCollection::begin ( ) const -> const_iterator
inline

Get const iterator to beginning of geometries.

Returns
Const iterator to first geometry
auto SFCGAL::GeometryCollection::coordinateDimension ( ) const -> int
override

Get the coordinate dimension.

Returns
Number of coordinates per point
auto SFCGAL::GeometryCollection::dimension ( ) const -> int
override

Get the dimension of the collection.

Returns
Maximum dimension of contained geometries
auto SFCGAL::GeometryCollection::dropM ( ) -> bool
override

Drop M coordinate from all geometries.

Returns
true if M was dropped, false otherwise
auto SFCGAL::GeometryCollection::dropZ ( ) -> bool
override

Drop Z coordinate from all geometries.

Returns
true if Z was dropped, false otherwise
auto SFCGAL::GeometryCollection::end ( ) -> iterator
inline

Get iterator to end of geometries.

Returns
Iterator to past-the-end
auto SFCGAL::GeometryCollection::end ( ) const -> const_iterator
inline

Get const iterator to end of geometries.

Returns
Const iterator to past-the-end
auto SFCGAL::GeometryCollection::geometryN ( size_t const &  n) const -> const Geometry &
override

Get the n-th geometry in the collection (const version)

Parameters
nIndex of the geometry to retrieve
Returns
Const reference to the geometry
auto SFCGAL::GeometryCollection::geometryN ( size_t const &  n) -> Geometry &
override

Get the n-th geometry in the collection (non-const version)

Parameters
nIndex of the geometry to retrieve
Returns
Reference to the geometry
auto SFCGAL::GeometryCollection::geometryType ( ) const -> std::string
override

Get the geometry type as string.

Returns
"GeometryCollection"
auto SFCGAL::GeometryCollection::geometryTypeId ( ) const -> GeometryType
override

Get the geometry type identifier.

Returns
TYPE_GEOMETRYCOLLECTION
auto SFCGAL::GeometryCollection::is3D ( ) const -> bool
override

Check if the collection has 3D coordinates.

Returns
true if any geometry is 3D, false otherwise
auto SFCGAL::GeometryCollection::isAllowed ( Geometry const &  geometry) -> bool
protectedvirtual

Test if a geometry is allowed in the collection.

Parameters
geometryGeometry to test
Returns
true if geometry is allowed in this collection
auto SFCGAL::GeometryCollection::isEmpty ( ) const -> bool
override

Check if the collection is empty.

Returns
true if empty, false otherwise
auto SFCGAL::GeometryCollection::isMeasured ( ) const -> bool
override

Check if the collection has measured coordinates.

Returns
true if any geometry is measured, false otherwise
auto SFCGAL::GeometryCollection::numGeometries ( ) const -> size_t
override

Get the number of geometries in the collection.

Returns
Number of geometries
auto SFCGAL::GeometryCollection::operator= ( GeometryCollection  other) -> GeometryCollection &

assign operator

Parameters
otherThe geometry collection to assign from
Returns
Reference to this geometry collection
template<class Archive >
void SFCGAL::GeometryCollection::serialize ( Archive &  ar,
const unsigned  int 
)
inline

Serializer.

Parameters
arArchive for serialization
void SFCGAL::GeometryCollection::setGeometryN ( const Geometry &  geometry,
size_t const &  idx 
)
override

Set the geometry at the given index (copy version)

Parameters
geometryGeometry to copy and set
idxIndex where to set the geometry
void SFCGAL::GeometryCollection::setGeometryN ( Geometry *  geometry,
size_t const &  idx 
)
override

Set the geometry at the given index (pointer version)

Parameters
geometryPointer to geometry to set
idxIndex where to set the geometry
Deprecated:
The unique_ptr version should be used instead
void SFCGAL::GeometryCollection::setGeometryN ( std::unique_ptr< Geometry >  geometry,
size_t const &  idx 
)
override

[SFA/OGC] Sets the n-th geometry using unique_ptr

Parameters
geometryUnique pointer to geometry to set
idxIndex where to set the geometry
void SFCGAL::GeometryCollection::swap ( GeometryCollection &  other)
inlineprotected

Swap the contents of two geometry collections.

Parameters
otherGeometryCollection to swap with
auto SFCGAL::GeometryCollection::swapXY ( ) -> void
override

Swap X and Y coordinates of all geometries in collection.