SFCGAL  1.3.0
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
virtual ~Geometry ()
 
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::auto_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 Member Functions inherited from SFCGAL::Geometry
 Geometry ()
 
 Geometry (const Geometry &)
 
const Geometryoperator= (const Geometry &)
 
- Protected Attributes inherited from SFCGAL::Geometry
bool validityFlag_
 

Detailed Description

A Polygon in SFA with holes.

Member Typedef Documentation

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

Constructor & Destructor Documentation

SFCGAL::Polygon::Polygon ( )

Empty Polygon constructor.

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

Constructor with an exterior ring.

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

Constructor with an exterior ring.

SFCGAL::Polygon::Polygon ( LineString exteriorRing)

Constructor with an exterior ring (takes ownership)

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

Constructor with a Triangle.

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

Copy constructor.

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

Constructor from CGAL::Polygon_with_holes_2<K>

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

Constructor from CGAL::Polygon_with_holes_2<K>

SFCGAL::Polygon::~Polygon ( )

destructor

Member Function Documentation

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

[visitor]dispatch visitor

 

Implements SFCGAL::Geometry.

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

[visitor]dispatch visitor

 

Implements SFCGAL::Geometry.

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

append a ring to the Polygon

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

append a ring to the Polygon (take ownership)

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

append a ring to the Polygon

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

append a ring to the Polygon (take ownership)

Deprecated:
addInteriorRing
iterator SFCGAL::Polygon::begin ( )
inline
const_iterator SFCGAL::Polygon::begin ( ) const
inline
Polygon * SFCGAL::Polygon::clone ( ) const
virtual

Get a deep copy of the geometry.

Implements SFCGAL::Geometry.

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.

iterator SFCGAL::Polygon::end ( )
inline
const_iterator SFCGAL::Polygon::end ( ) const
inline
const LineString& SFCGAL::Polygon::exteriorRing ( ) const
inline

[OGC/SFA]returns the exterior ring

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

[OGC/SFA]returns the exterior ring

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

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

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

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

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

Test if the polygon has interior rings.

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

[OGC/SFA]returns the exterior ring

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

[OGC/SFA]returns the exterior ring

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

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

bool SFCGAL::Polygon::isCounterClockWiseOriented ( ) const

Check whether the 2D polygon is pointing up.

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

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

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.

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

[OGC/SFA]returns the exterior ring

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

Returns the number of rings.

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

assign operator

void SFCGAL::Polygon::reverse ( )

reverse Polygon orientation

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
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
template<class Archive >
void SFCGAL::Polygon::serialize ( Archive &  ar,
const unsigned  int 
)
inline

Serializer.

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

Sets the exterior ring.

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

Sets the exterior ring (takes ownership)

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