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

A Polygon in SFA with holes. More...

#include <Polygon.h>

Inheritance diagram for SFCGAL::Polygon:
SFCGAL::Surface SFCGAL::Geometry

Public Types

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

Public Member Functions

 Polygon ()
 Empty Polygon constructor. More...
 
 Polygon (const std::vector< LineString > &rings)
 Constructor with an exterior ring. More...
 
 Polygon (const LineString &exteriorRing)
 Constructor with an exterior ring. More...
 
 Polygon (LineString *exteriorRing)
 Constructor with an exterior ring (takes ownership) More...
 
 Polygon (const Triangle &triangle)
 Constructor with a Triangle. More...
 
 Polygon (const Polygon &other)
 Copy constructor. More...
 
 Polygon (const CGAL::Polygon_2< Kernel > &other)
 Constructor from CGAL::Polygon_with_holes_2<K> More...
 
 Polygon (const CGAL::Polygon_with_holes_2< Kernel > &other)
 Constructor from CGAL::Polygon_with_holes_2<K> More...
 
Polygonoperator= (Polygon other)
 assign operator More...
 
 ~Polygon ()
 destructor More...
 
virtual Polygonclone () const
 Get a deep copy of the geometry. More...
 
virtual std::string geometryType () const
 [OGC/SFA]returns the geometry type More...
 
virtual GeometryType geometryTypeId () const
 Returns a code corresponding to the type. More...
 
virtual int coordinateDimension () const
 [OGC/SFA]returns the dimension of the coordinates More...
 
virtual bool isEmpty () const
 [OGC/SFA]test if geometry is empty More...
 
virtual bool is3D () const
 [OGC/SFA]test if geometry is 3d More...
 
virtual bool isMeasured () const
 [OGC/SFA]test if geometry is measured (has an m) More...
 
bool isCounterClockWiseOriented () const
 Check whether the 2D polygon is pointing up. More...
 
void reverse ()
 reverse Polygon orientation More...
 
const LineStringexteriorRing () const
 [OGC/SFA]returns the exterior ring More...
 
LineStringexteriorRing ()
 [OGC/SFA]returns the exterior ring More...
 
void setExteriorRing (const LineString &ring)
 Sets the exterior ring. More...
 
void setExteriorRing (LineString *ring)
 Sets the exterior ring (takes ownership) More...
 
bool hasInteriorRings () const
 Test if the polygon has interior rings. More...
 
size_t numInteriorRings () const
 [OGC/SFA]returns the exterior ring More...
 
const LineStringinteriorRingN (const size_t &n) const
 [OGC/SFA]returns the exterior ring More...
 
LineStringinteriorRingN (const size_t &n)
 [OGC/SFA]returns the exterior ring More...
 
size_t numRings () const
 Returns the number of rings. More...
 
const LineStringringN (const size_t &n) const
 Returns the n-th ring, 0 is exteriorRing. More...
 
LineStringringN (const size_t &n)
 Returns the n-th ring, 0 is exteriorRing. More...
 
void addInteriorRing (const LineString &ls)
 append a ring to the Polygon More...
 
void addInteriorRing (LineString *ls)
 append a ring to the Polygon (take ownership) More...
 
void addRing (const LineString &ls)
 append a ring to the Polygon More...
 
void addRing (LineString *ls)
 append a ring to the Polygon (take ownership) More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
CGAL::Polygon_2< KerneltoPolygon_2 (bool fixOrientation=true) const
 
CGAL::Polygon_with_holes_2< KerneltoPolygon_with_holes_2 (bool fixOrientation=true) const
 
virtual void accept (GeometryVisitor &visitor)
 [visitor]dispatch visitor More...
 
virtual void accept (ConstGeometryVisitor &visitor) const
 [visitor]dispatch visitor More...
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer. More...
 
- Public Member Functions inherited from SFCGAL::Surface
virtual ~Surface ()
 destructor More...
 
virtual int dimension () const
 [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...) More...
 
- Public Member Functions inherited from SFCGAL::Geometry
 Geometry ()
 Default constructor. More...
 
 Geometry (const Geometry &)=default
 Copy constructor. More...
 
Geometryoperator= (const Geometry &other)=default
 Copy assignemnt operator. More...
 
virtual ~Geometry ()=default
 Destructor. More...
 
void forceValidityFlag (bool validity)
 Force the state of the validity flag. More...
 
bool hasValidityFlag () const
 Returns the validity flag. More...
 
std::string asText (const int &numDecimals=-1) const
 [OGC/SFA]returns the WKT string More...
 
Envelope envelope () const
 [OGC/SFA]Returns a polygon representing the BBOX of the geometry More...
 
virtual std::unique_ptr< Geometryboundary () const
 [OGC/SFA]Returns the boundary of the geometry More...
 
double distance (const Geometry &other) const
 Computes the distance to an other geometry. More...
 
double distance3D (const Geometry &other) const
 Computes the 3D distance to an other geometry. More...
 
void round (const long &scale=1)
 round the geometry with a corresponding scale factor More...
 
virtual size_t numGeometries () const
 [OGC/SFA]Gets the number of geometries in a collection of geometries More...
 
virtual const GeometrygeometryN (size_t const &n) const
 [OGC/SFA]Returns the n-th geometry More...
 
virtual GeometrygeometryN (size_t const &n)
 [OGC/SFA]Returns the n-th geometry More...
 
template<typename Derived >
bool is () const
 Tests if geometry is of "Derived" type given as template parameter. More...
 
template<typename Derived >
const Derived & as () const
 Downcast to a "Derived" class. More...
 
template<typename Derived >
Derived & as ()
 Downcast to a "Derived" class. More...
 
template<class Archive >
void serialize (Archive &, const unsigned int)
 Serializer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SFCGAL::Surface
 Surface ()
 [OGC/SFS]"The area of this Surface, as measured in the spatial reference system of this Surface" More...
 
 Surface (Surface const &other)
 no copy constructor More...
 
- Protected Attributes inherited from SFCGAL::Geometry
bool validityFlag_
 

Detailed Description

A Polygon in SFA with holes.

Member Typedef Documentation

◆ const_iterator

◆ iterator

typedef boost::ptr_vector< LineString >::iterator SFCGAL::Polygon::iterator

Constructor & Destructor Documentation

◆ Polygon() [1/8]

SFCGAL::Polygon::Polygon ( )

Empty Polygon constructor.

◆ Polygon() [2/8]

SFCGAL::Polygon::Polygon ( const std::vector< LineString > &  rings)

Constructor with an exterior ring.

◆ Polygon() [3/8]

SFCGAL::Polygon::Polygon ( const LineString exteriorRing)

Constructor with an exterior ring.

◆ Polygon() [4/8]

SFCGAL::Polygon::Polygon ( LineString exteriorRing)

Constructor with an exterior ring (takes ownership)

◆ Polygon() [5/8]

SFCGAL::Polygon::Polygon ( const Triangle triangle)

Constructor with a Triangle.

◆ Polygon() [6/8]

SFCGAL::Polygon::Polygon ( const Polygon other)

Copy constructor.

◆ Polygon() [7/8]

SFCGAL::Polygon::Polygon ( const CGAL::Polygon_2< Kernel > &  other)

Constructor from CGAL::Polygon_with_holes_2<K>

◆ Polygon() [8/8]

SFCGAL::Polygon::Polygon ( const CGAL::Polygon_with_holes_2< Kernel > &  other)

Constructor from CGAL::Polygon_with_holes_2<K>

◆ ~Polygon()

SFCGAL::Polygon::~Polygon ( )

destructor

Member Function Documentation

◆ accept() [1/2]

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

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

◆ accept() [2/2]

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

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

◆ addInteriorRing() [1/2]

void SFCGAL::Polygon::addInteriorRing ( const LineString ls)
inline

append a ring to the Polygon

◆ addInteriorRing() [2/2]

void SFCGAL::Polygon::addInteriorRing ( LineString ls)
inline

append a ring to the Polygon (take ownership)

◆ addRing() [1/2]

void SFCGAL::Polygon::addRing ( const LineString ls)
inline

append a ring to the Polygon

Deprecated:
addInteriorRing

◆ addRing() [2/2]

void SFCGAL::Polygon::addRing ( LineString ls)
inline

append a ring to the Polygon (take ownership)

Deprecated:
addInteriorRing

◆ begin() [1/2]

iterator SFCGAL::Polygon::begin ( )
inline

◆ begin() [2/2]

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

◆ clone()

Polygon * SFCGAL::Polygon::clone ( ) const
virtual

Get a deep copy of the geometry.

Implements SFCGAL::Geometry.

◆ coordinateDimension()

int SFCGAL::Polygon::coordinateDimension ( ) const
virtual

[OGC/SFA]returns the dimension of the coordinates

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ end() [1/2]

iterator SFCGAL::Polygon::end ( )
inline

◆ end() [2/2]

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

◆ exteriorRing() [1/2]

LineString& SFCGAL::Polygon::exteriorRing ( )
inline

[OGC/SFA]returns the exterior ring

◆ exteriorRing() [2/2]

const LineString& SFCGAL::Polygon::exteriorRing ( ) const
inline

[OGC/SFA]returns the exterior ring

◆ geometryType()

std::string SFCGAL::Polygon::geometryType ( ) const
virtual

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

◆ geometryTypeId()

GeometryType SFCGAL::Polygon::geometryTypeId ( ) const
virtual

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

◆ hasInteriorRings()

bool SFCGAL::Polygon::hasInteriorRings ( ) const
inline

Test if the polygon has interior rings.

◆ interiorRingN() [1/2]

LineString& SFCGAL::Polygon::interiorRingN ( const size_t &  n)
inline

[OGC/SFA]returns the exterior ring

◆ interiorRingN() [2/2]

const LineString& SFCGAL::Polygon::interiorRingN ( const size_t &  n) const
inline

[OGC/SFA]returns the exterior ring

◆ is3D()

bool SFCGAL::Polygon::is3D ( ) const
virtual

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ isCounterClockWiseOriented()

bool SFCGAL::Polygon::isCounterClockWiseOriented ( ) const

Check whether the 2D polygon is pointing up.

◆ isEmpty()

bool SFCGAL::Polygon::isEmpty ( ) const
virtual

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

◆ isMeasured()

bool SFCGAL::Polygon::isMeasured ( ) const
virtual

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

Precondition
suppose no mix of M/!M points

Implements SFCGAL::Geometry.

◆ numInteriorRings()

size_t SFCGAL::Polygon::numInteriorRings ( ) const
inline

[OGC/SFA]returns the exterior ring

◆ numRings()

size_t SFCGAL::Polygon::numRings ( ) const
inline

Returns the number of rings.

◆ operator=()

Polygon & SFCGAL::Polygon::operator= ( Polygon  other)

assign operator

◆ reverse()

void SFCGAL::Polygon::reverse ( )

reverse Polygon orientation

◆ ringN() [1/2]

LineString& SFCGAL::Polygon::ringN ( const size_t &  n)
inline

Returns the n-th ring, 0 is exteriorRing.

Warning
not standard, avoid conditionnal to access rings

◆ ringN() [2/2]

const LineString& SFCGAL::Polygon::ringN ( const size_t &  n) const
inline

Returns the n-th ring, 0 is exteriorRing.

Warning
not standard, avoid conditionnal to access rings

◆ serialize()

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

Serializer.

◆ setExteriorRing() [1/2]

void SFCGAL::Polygon::setExteriorRing ( const LineString ring)
inline

Sets the exterior ring.

◆ setExteriorRing() [2/2]

void SFCGAL::Polygon::setExteriorRing ( LineString ring)
inline

Sets the exterior ring (takes ownership)

◆ toPolygon_2()

CGAL::Polygon_2< Kernel > SFCGAL::Polygon::toPolygon_2 ( bool  fixOrientation = true) const

◆ toPolygon_with_holes_2()

CGAL::Polygon_with_holes_2< Kernel > SFCGAL::Polygon::toPolygon_with_holes_2 ( bool  fixOrientation = true) const