SFCGAL  2.3.0
Public Member Functions | Protected Attributes | List of all members
SFCGAL::PreparedGeometry Class Reference

A PreparedGeometry is a shell around a SFCGAL::Geometry. More...

#include <PreparedGeometry.h>

Inheritance diagram for SFCGAL::PreparedGeometry:

Public Member Functions

 PreparedGeometry ()
 Default constructor. More...
 
 PreparedGeometry (std::unique_ptr< Geometry > &&geometry, srid_t srid=0)
 Constructor. More...
 
 PreparedGeometry (Geometry *geometry, srid_t srid=0)
 Constructor. More...
 
 ~PreparedGeometry ()
 
auto geometry () const -> const Geometry &
 Geometry accessors. More...
 
auto geometry () -> Geometry &
 Geometry accessor. More...
 
void resetGeometry (Geometry *geom)
 Geometry setter. More...
 
auto SRID () const -> const srid_t &
 SRID read only accessor. More...
 
auto SRID () -> srid_t &
 SRID accessor. More...
 
auto envelope () const -> const Envelope &
 Envelope accessor (using cache) More...
 
void invalidateCache ()
 Resets the cache. More...
 
auto asEWKT (const int &numDecimals=-1) const -> std::string
 Convert to an extended WKT (with SRID) More...
 
auto asEWKB (boost::endian::order wkbOrder=boost::endian::order::native, bool asHex=false) const -> std::string
 Convert to Extended Well-Known Binary. More...
 
template<class Archive >
void save (Archive &ar, const unsigned int) const
 Save prepared geometry to archive. More...
 
template<class Archive >
void load (Archive &ar, const unsigned int)
 Load prepared geometry from archive. More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 Serialize prepared geometry to/from archive. More...
 

Protected Attributes

std::unique_ptr< Geometry > _geometry
 Pointer to underlying Geometry. More...
 
srid_t _srid
 SRID of the geometry. More...
 
boost::optional< Envelope > _envelope
 Cached bounding box of the geometry. More...
 

Detailed Description

A PreparedGeometry is a shell around a SFCGAL::Geometry.

It is used to store annex data, like SRID or cached computations

It is noncopyable since it stores a std::unique_ptr<SFCGAL::Geometry>

Constructor & Destructor Documentation

SFCGAL::PreparedGeometry::PreparedGeometry ( )

Default constructor.

SFCGAL::PreparedGeometry::PreparedGeometry ( std::unique_ptr< Geometry > &&  geometry,
srid_t  srid = 0 
)

Constructor.

Parameters
geometrypointer to the underlying SFCGAL::Geometry. Takes ownership
sridThe spatial reference system identifier
SFCGAL::PreparedGeometry::PreparedGeometry ( Geometry *  geometry,
srid_t  srid = 0 
)

Constructor.

Parameters
geometrypointer to the underlying SFCGAL::Geometry. Takes ownership
sridThe spatial reference system identifier
SFCGAL::PreparedGeometry::~PreparedGeometry ( )
default

Member Function Documentation

auto SFCGAL::PreparedGeometry::asEWKB ( boost::endian::order  wkbOrder = boost::endian::order::native,
bool  asHex = false 
) const -> std::string

Convert to Extended Well-Known Binary.

Parameters
wkbOrderByte order for WKB output
asHexReturn as hexadecimal string if true
Returns
Extended WKB representation
auto SFCGAL::PreparedGeometry::asEWKT ( const int &  numDecimals = -1) const -> std::string

Convert to an extended WKT (with SRID)

Parameters
numDecimalsnumber of decimals, -1 for keeping the exact rational representation, if possible
Returns
Extended WKT representation with SRID
auto SFCGAL::PreparedGeometry::envelope ( ) const -> const Envelope &

Envelope accessor (using cache)

Returns
The envelope of the geometry
auto SFCGAL::PreparedGeometry::geometry ( ) const -> const Geometry &

Geometry accessors.

Returns
Const reference to the geometry
auto SFCGAL::PreparedGeometry::geometry ( ) -> Geometry &

Geometry accessor.

Returns
Reference to the geometry
void SFCGAL::PreparedGeometry::invalidateCache ( )

Resets the cache.

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

Load prepared geometry from archive.

Parameters
arArchive to load from
void SFCGAL::PreparedGeometry::resetGeometry ( Geometry *  geom)

Geometry setter.

Parameters
geomThe new geometry to set
template<class Archive >
void SFCGAL::PreparedGeometry::save ( Archive &  ar,
const unsigned  int 
) const
inline

Save prepared geometry to archive.

Parameters
arArchive to save to
template<class Archive >
void SFCGAL::PreparedGeometry::serialize ( Archive &  ar,
const unsigned int  version 
)
inline

Serialize prepared geometry to/from archive.

Parameters
arArchive for serialization
versionSerialization version
auto SFCGAL::PreparedGeometry::SRID ( ) const -> const srid_t &
inline

SRID read only accessor.

Returns
The spatial reference system identifier
auto SFCGAL::PreparedGeometry::SRID ( ) -> srid_t &
inline

SRID accessor.

Returns
Reference to the spatial reference system identifier

Member Data Documentation

boost::optional<Envelope> SFCGAL::PreparedGeometry::_envelope
mutableprotected

Cached bounding box of the geometry.

std::unique_ptr<Geometry> SFCGAL::PreparedGeometry::_geometry
protected

Pointer to underlying Geometry.

srid_t SFCGAL::PreparedGeometry::_srid
protected

SRID of the geometry.