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

A Solid modeled with an exteriorShell and interiorShells materialized by PolyhedralSurface. More...

#include <Solid.h>

Inherits SFCGAL::GeometryImpl< Derived, Base >.

Public Types

using iterator = DereferenceIterator< std::vector< std::unique_ptr< PolyhedralSurface >>::iterator >
 Iterator type for solid shells. More...
 
using const_iterator = DereferenceIterator< std::vector< std::unique_ptr< PolyhedralSurface >>::const_iterator >
 Const iterator type for solid shells. More...
 

Public Member Functions

 Solid ()
 Empty Solid constructor. More...
 
 Solid (const PolyhedralSurface &exteriorShell)
 Constructor with an exterior shell. More...
 
 Solid (PolyhedralSurface *exteriorShell)
 Constructor with an exterior shell (takes ownership) More...
 
 Solid (std::unique_ptr< PolyhedralSurface > exteriorShell)
 Constructor with an exterior shell (takes ownership) More...
 
 Solid (const std::vector< PolyhedralSurface > &shells)
 Constructor with a vector of shells (PolyhedralSurface) More...
 
 Solid (const Solid &other)
 Copy constructor. More...
 
auto operator= (Solid other) -> Solid &
 assign operator More...
 
 ~Solid () 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 solid. More...
 
auto coordinateDimension () const -> int override
 Get the coordinate dimension. More...
 
auto isEmpty () const -> bool override
 Check if the solid is empty. More...
 
auto is3D () const -> bool override
 Check if the solid has 3D coordinates. More...
 
auto isMeasured () const -> bool override
 Check if the solid has measured coordinates. More...
 
auto dropZ () -> bool override
 Drop Z coordinate from all surfaces. More...
 
auto dropM () -> bool override
 Drop M coordinate from all surfaces. More...
 
auto swapXY () -> void override
 Swap X and Y coordinates of all surfaces. More...
 
auto exteriorShell () const -> const PolyhedralSurface &
 Returns the exterior shell. More...
 
auto exteriorShell () -> PolyhedralSurface &
 Returns the exterior shell. More...
 
auto numInteriorShells () const -> size_t
 Returns the number of interior shells. More...
 
auto interiorShellN (size_t const &index) const -> const PolyhedralSurface &
 Returns the n-th interior shell. More...
 
auto interiorShellN (size_t const &index) -> PolyhedralSurface &
 Returns the n-th interior shell. More...
 
void addInteriorShell (const PolyhedralSurface &shell)
 adds an interior shell to the Solid More...
 
void addInteriorShell (PolyhedralSurface *shell)
 adds an interior shell to the Solid More...
 
void addInteriorShell (std::unique_ptr< PolyhedralSurface > shell)
 Adds an interior shell to the Solid. More...
 
void setExteriorShell (std::unique_ptr< PolyhedralSurface > shell)
 Sets the Solid exterior shell. More...
 
void setExteriorShell (const PolyhedralSurface &shell)
 Sets the Solid exterior shell. More...
 
void setExteriorShell (PolyhedralSurface *shell)
 Sets the Solid exterior shell. More...
 
auto numShells () const -> size_t
 Returns the number of shells. More...
 
auto shellN (const size_t &index) const -> const PolyhedralSurface &
 Returns the n-th shell, 0 is exteriorShell. More...
 
auto shellN (const size_t &index) -> PolyhedralSurface &
 Returns the n-th shell, 0 is exteriorShell. More...
 
auto begin () -> iterator
 Get iterator to beginning of shells. More...
 
auto begin () const -> const_iterator
 Get const iterator to beginning of shells. More...
 
auto end () -> iterator
 Get iterator to end of shells. More...
 
auto end () const -> const_iterator
 Get const iterator to end of shells. More...
 
void accept (GeometryVisitor &visitor) override
 Accept a geometry visitor. More...
 
void accept (ConstGeometryVisitor &visitor) const override
 Accept a const geometry visitor. More...
 
auto toSurfaceMesh () const -> Surface_mesh_3
 Convert Solid to CGAL::Surface_mesh (only exterior shell) More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer. More...
 

Detailed Description

A Solid modeled with an exteriorShell and interiorShells materialized by PolyhedralSurface.

Note
A shell is supposed to be closed.
Warning
GM_Solid, from ISO 19107 is defined in CityGML, but not in SFA. Without Solid concept,
Note
Volume concept is missing.

Member Typedef Documentation

Const iterator type for solid shells.

using SFCGAL::Solid::iterator = DereferenceIterator< std::vector<std::unique_ptr<PolyhedralSurface>>::iterator>

Iterator type for solid shells.

Constructor & Destructor Documentation

SFCGAL::Solid::Solid ( )

Empty Solid constructor.

SFCGAL::Solid::Solid ( const PolyhedralSurface &  exteriorShell)

Constructor with an exterior shell.

Parameters
exteriorShellThe exterior shell of the solid
SFCGAL::Solid::Solid ( PolyhedralSurface *  exteriorShell)

Constructor with an exterior shell (takes ownership)

Parameters
exteriorShellThe exterior shell of the solid
Deprecated:
The unique_ptr version should be used instead
SFCGAL::Solid::Solid ( std::unique_ptr< PolyhedralSurface >  exteriorShell)

Constructor with an exterior shell (takes ownership)

Parameters
exteriorShellA unique_ptr to the exterior shell of the solid
SFCGAL::Solid::Solid ( const std::vector< PolyhedralSurface > &  shells)

Constructor with a vector of shells (PolyhedralSurface)

Parameters
shellsVector of polyhedral surfaces forming the solid
SFCGAL::Solid::Solid ( const Solid &  other)

Copy constructor.

Parameters
otherThe solid to copy from
SFCGAL::Solid::~Solid ( )
overridedefault

destructor

Member Function Documentation

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

Accept a geometry visitor.

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

Accept a const geometry visitor.

Parameters
visitorConst visitor to accept
void SFCGAL::Solid::addInteriorShell ( const PolyhedralSurface &  shell)
inline

adds an interior shell to the Solid

Parameters
shellThe polyhedral surface to add as interior shell
void SFCGAL::Solid::addInteriorShell ( PolyhedralSurface *  shell)
inline

adds an interior shell to the Solid

Parameters
shellThe polyhedral surface to add as interior shell
Deprecated:
The unique_ptr version should be used instead
void SFCGAL::Solid::addInteriorShell ( std::unique_ptr< PolyhedralSurface >  shell)
inline

Adds an interior shell to the Solid.

Parameters
shellA unique pointer to the PolyhedralSurface object representing the new shell to add. Ownership of this shell is moved into the Solid.
auto SFCGAL::Solid::begin ( ) -> iterator
inline

Get iterator to beginning of shells.

Returns
Iterator to first shell
auto SFCGAL::Solid::begin ( ) const -> const_iterator
inline

Get const iterator to beginning of shells.

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

Get the coordinate dimension.

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

Get the dimension of the solid.

Returns
3 (solids are 3-dimensional)
auto SFCGAL::Solid::dropM ( ) -> bool
override

Drop M coordinate from all surfaces.

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

Drop Z coordinate from all surfaces.

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

Get iterator to end of shells.

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

Get const iterator to end of shells.

Returns
Const iterator to past-the-end
auto SFCGAL::Solid::exteriorShell ( ) const -> const PolyhedralSurface &
inline

Returns the exterior shell.

Returns
Const reference to the exterior shell
auto SFCGAL::Solid::exteriorShell ( ) -> PolyhedralSurface &
inline

Returns the exterior shell.

Returns
Reference to the exterior shell
auto SFCGAL::Solid::geometryType ( ) const -> std::string
override

Get the geometry type as string.

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

Get the geometry type identifier.

Returns
TYPE_SOLID
auto SFCGAL::Solid::interiorShellN ( size_t const &  index) const -> const PolyhedralSurface &
inline

Returns the n-th interior shell.

Parameters
indexThe index of the interior shell to get
Returns
Const reference to the nth interior shell
auto SFCGAL::Solid::interiorShellN ( size_t const &  index) -> PolyhedralSurface &
inline

Returns the n-th interior shell.

Parameters
indexThe index of the interior shell to get
Returns
Reference to the nth interior shell
auto SFCGAL::Solid::is3D ( ) const -> bool
override

Check if the solid has 3D coordinates.

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

Check if the solid is empty.

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

Check if the solid has measured coordinates.

Returns
true if measured, false otherwise
auto SFCGAL::Solid::numInteriorShells ( ) const -> size_t
inline

Returns the number of interior shells.

Returns
Number of interior shells
auto SFCGAL::Solid::numShells ( ) const -> size_t
inline

Returns the number of shells.

Returns
Number of shells in the solid
auto SFCGAL::Solid::operator= ( Solid  other) -> Solid &

assign operator

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

Serializer.

Parameters
arArchive for serialization
void SFCGAL::Solid::setExteriorShell ( std::unique_ptr< PolyhedralSurface >  shell)
inline

Sets the Solid exterior shell.

Parameters
shellA unique pointer to the new shell. Ownership is transferred to this class.
void SFCGAL::Solid::setExteriorShell ( const PolyhedralSurface &  shell)
inline

Sets the Solid exterior shell.

Parameters
shellPolyhedralSurface to set as exterior shell
void SFCGAL::Solid::setExteriorShell ( PolyhedralSurface *  shell)
inline

Sets the Solid exterior shell.

Parameters
shellPointer to PolyhedralSurface to set as exterior shell
Note
The ownership of the shell is taken. The caller is not responsible anymore of its deallocation.
Deprecated:
The unique_ptr version should be used instead
auto SFCGAL::Solid::shellN ( const size_t &  index) const -> const PolyhedralSurface &
inline

Returns the n-th shell, 0 is exteriorShell.

Parameters
indexIndex of the shell to get
Returns
Const reference to the nth shell
Warning
not standard, avoid conditionnal to access rings
auto SFCGAL::Solid::shellN ( const size_t &  index) -> PolyhedralSurface &
inline

Returns the n-th shell, 0 is exteriorShell.

Parameters
indexIndex of the shell to get
Returns
Reference to the nth shell
Warning
not standard, avoid conditionnal to access rings
auto SFCGAL::Solid::swapXY ( ) -> void
override

Swap X and Y coordinates of all surfaces.

auto SFCGAL::Solid::toSurfaceMesh ( ) const -> Surface_mesh_3

Convert Solid to CGAL::Surface_mesh (only exterior shell)

Returns
CGAL Surface_mesh representation of the solid's exterior shell