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

A LineString in SFA. More...

#include <LineString.h>

Inheritance diagram for SFCGAL::LineString:
SFCGAL::Geometry

Classes

class  Point_2_const_iterator
 Const iterator to 2D points TODO: replace by boost::tranform_iterator ? More...
 
class  Point_3_const_iterator
 Const iterator to 3D points TODO: replace by boost::tranform_iterator ? More...
 

Public Types

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

Public Member Functions

 LineString ()
 Empty LineString constructor. More...
 
 LineString (const std::vector< Point > &points)
 Constructor with a point vector. More...
 
 LineString (const Point &startPoint, const Point &endPoint)
 LineString constructor. More...
 
 LineString (LineString const &other)
 Copy constructor. More...
 
LineStringoperator= (LineString other)
 assign operator More...
 
 ~LineString ()
 destructor More...
 
virtual LineStringclone () 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 dimension () const
 [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...) 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...
 
void clear ()
 remove all points from the LineString More...
 
void reverse ()
 reverse LineString orientation More...
 
size_t numPoints () const
 [SFA/OGC]Returns the number of points More...
 
size_t numSegments () const
 Returns the number of segments. More...
 
const PointpointN (size_t const &n) const
 [SFA/OGC]Returns the n-th point More...
 
PointpointN (size_t const &n)
 [SFA/OGC]Returns the n-th point More...
 
const PointstartPoint () const
 [SFA/OGC]Returns the first point More...
 
PointstartPoint ()
 [SFA/OGC]Returns the first point More...
 
const PointendPoint () const
 [SFA/OGC]Returns the first point More...
 
PointendPoint ()
 [SFA/OGC]Returns the first point More...
 
void addPoint (const Point &p)
 append a Point to the LineString More...
 
void addPoint (Point *p)
 append a Point to the LineString and takes ownership More...
 
bool isClosed () const
 test if the LineString is closed More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void reserve (const size_t &n)
 
Point_2_const_iterator points_2_begin () const
 
Point_2_const_iterator points_2_end () const
 
std::pair< Point_2_const_iterator, Point_2_const_iteratorpoints_2 () const
 
Point_3_const_iterator points_3_begin () const
 
Point_3_const_iterator points_3_end () const
 
std::pair< Point_3_const_iterator, Point_3_const_iteratorpoints_3 () const
 
CGAL::Polygon_2< KerneltoPolygon_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::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 Attributes inherited from SFCGAL::Geometry
bool validityFlag_
 

Detailed Description

A LineString in SFA.

Member Typedef Documentation

◆ const_iterator

◆ iterator

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

Constructor & Destructor Documentation

◆ LineString() [1/4]

SFCGAL::LineString::LineString ( )

Empty LineString constructor.

◆ LineString() [2/4]

SFCGAL::LineString::LineString ( const std::vector< Point > &  points)

Constructor with a point vector.

◆ LineString() [3/4]

SFCGAL::LineString::LineString ( const Point startPoint,
const Point endPoint 
)

LineString constructor.

◆ LineString() [4/4]

SFCGAL::LineString::LineString ( LineString const &  other)

Copy constructor.

◆ ~LineString()

SFCGAL::LineString::~LineString ( )

destructor

Member Function Documentation

◆ accept() [1/2]

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

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

◆ accept() [2/2]

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

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

◆ addPoint() [1/2]

void SFCGAL::LineString::addPoint ( const Point p)
inline

append a Point to the LineString

◆ addPoint() [2/2]

void SFCGAL::LineString::addPoint ( Point p)
inline

append a Point to the LineString and takes ownership

◆ begin() [1/2]

iterator SFCGAL::LineString::begin ( )
inline

◆ begin() [2/2]

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

◆ clear()

void SFCGAL::LineString::clear ( )

remove all points from the LineString

◆ clone()

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

Get a deep copy of the geometry.

Implements SFCGAL::Geometry.

◆ coordinateDimension()

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

[OGC/SFA]returns the dimension of the coordinates

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ dimension()

int SFCGAL::LineString::dimension ( ) const
virtual

[OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...)

Warning
empty geometries provide the dimension corresponding to the object

Implements SFCGAL::Geometry.

◆ end() [1/2]

iterator SFCGAL::LineString::end ( )
inline

◆ end() [2/2]

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

◆ endPoint() [1/2]

Point& SFCGAL::LineString::endPoint ( )
inline

[SFA/OGC]Returns the first point

◆ endPoint() [2/2]

const Point& SFCGAL::LineString::endPoint ( ) const
inline

[SFA/OGC]Returns the first point

◆ geometryType()

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

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

◆ geometryTypeId()

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

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

◆ is3D()

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

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ isClosed()

bool SFCGAL::LineString::isClosed ( ) const

test if the LineString is closed

◆ isEmpty()

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

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

◆ isMeasured()

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

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

Precondition
suppose no mix of M/!M points

Implements SFCGAL::Geometry.

◆ numPoints()

size_t SFCGAL::LineString::numPoints ( ) const
inline

[SFA/OGC]Returns the number of points

◆ numSegments()

size_t SFCGAL::LineString::numSegments ( ) const

Returns the number of segments.

Warning
not standard, returns zero if LineString contains only one point

◆ operator=()

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

assign operator

◆ pointN() [1/2]

Point& SFCGAL::LineString::pointN ( size_t const &  n)
inline

[SFA/OGC]Returns the n-th point

◆ pointN() [2/2]

const Point& SFCGAL::LineString::pointN ( size_t const &  n) const
inline

[SFA/OGC]Returns the n-th point

◆ points_2()

std::pair< Point_2_const_iterator, Point_2_const_iterator > SFCGAL::LineString::points_2 ( ) const
inline

◆ points_2_begin()

Point_2_const_iterator SFCGAL::LineString::points_2_begin ( ) const
inline

◆ points_2_end()

Point_2_const_iterator SFCGAL::LineString::points_2_end ( ) const
inline

◆ points_3()

std::pair< Point_3_const_iterator, Point_3_const_iterator > SFCGAL::LineString::points_3 ( ) const
inline

◆ points_3_begin()

Point_3_const_iterator SFCGAL::LineString::points_3_begin ( ) const
inline

◆ points_3_end()

Point_3_const_iterator SFCGAL::LineString::points_3_end ( ) const
inline

◆ reserve()

void SFCGAL::LineString::reserve ( const size_t &  n)

◆ reverse()

void SFCGAL::LineString::reverse ( )

reverse LineString orientation

◆ serialize()

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

Serializer.

◆ startPoint() [1/2]

Point& SFCGAL::LineString::startPoint ( )
inline

[SFA/OGC]Returns the first point

◆ startPoint() [2/2]

const Point& SFCGAL::LineString::startPoint ( ) const
inline

[SFA/OGC]Returns the first point

◆ toPolygon_2()

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