SFCGAL
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.
 
 LineString (const std::vector< Point > &points)
 Constructor with a point vector.
 
 LineString (const Point &startPoint, const Point &endPoint)
 LineString constructor.
 
 LineString (LineString const &other)
 Copy constructor.
 
LineStringoperator= (LineString other)
 assign operator
 
 ~LineString ()
 destructor
 
virtual LineStringclone () const
 Get a deep copy of the geometry.
 
virtual std::string geometryType () const
 [OGC/SFA]returns the geometry type
 
virtual GeometryType geometryTypeId () const
 Returns a code corresponding to the type.
 
virtual int dimension () const
 [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...)
 
virtual int coordinateDimension () const
 [OGC/SFA]returns the dimension of the coordinates
 
virtual bool isEmpty () const
 [OGC/SFA]test if geometry is empty
 
virtual bool is3D () const
 [OGC/SFA]test if geometry is 3d
 
virtual bool isMeasured () const
 [OGC/SFA]test if geometry is measured (has an m)
 
void clear ()
 remove all points from the LineString
 
void reverse ()
 reverse LineString orientation
 
size_t numPoints () const
 [SFA/OGC]Returns the number of points
 
size_t numSegments () const
 Returns the number of segments.
 
const PointpointN (size_t const &n) const
 [SFA/OGC]Returns the n-th point
 
PointpointN (size_t const &n)
 [SFA/OGC]Returns the n-th point
 
const PointstartPoint () const
 [SFA/OGC]Returns the first point
 
PointstartPoint ()
 [SFA/OGC]Returns the first point
 
const PointendPoint () const
 [SFA/OGC]Returns the first point
 
PointendPoint ()
 [SFA/OGC]Returns the first point
 
void addPoint (const Point &p)
 append a Point to the LineString
 
void addPoint (Point *p)
 append a Point to the LineString and takes ownership
 
bool isClosed () const
 test if the LineString is closed
 
void closes ()
 closes the LineString
 
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
 
virtual void accept (ConstGeometryVisitor &visitor) const
 [visitor]dispatch visitor
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer.
 
- Public Member Functions inherited from SFCGAL::Geometry
 Geometry ()
 Default constructor.
 
 Geometry (const Geometry &)=default
 Copy constructor.
 
Geometryoperator= (const Geometry &other)=default
 Copy assignemnt operator.
 
virtual ~Geometry ()=default
 Destructor.
 
void forceValidityFlag (bool validity)
 Force the state of the validity flag.
 
bool hasValidityFlag () const
 Returns the validity flag.
 
std::string asText (const int &numDecimals=-1) const
 [OGC/SFA]returns the WKT string
 
std::string asWkb (boost::endian::order wkbOrder=boost::endian::order::native, bool asHex=false) const
 [OGC/SFA]returns the WKB string
 
Envelope envelope () const
 [OGC/SFA]Returns a polygon representing the BBOX of the geometry
 
virtual std::unique_ptr< Geometryboundary () const
 [OGC/SFA]Returns the boundary of the geometry
 
double distance (const Geometry &other) const
 Computes the distance to an other geometry.
 
double distance3D (const Geometry &other) const
 Computes the 3D distance to an other geometry.
 
void round (const long &scale=1)
 round the geometry with a corresponding scale factor
 
auto almostEqual (const Geometry &, const double tolerance) const -> bool
 Equality operator.
 
virtual size_t numGeometries () const
 [OGC/SFA]Gets the number of geometries in a collection of geometries
 
virtual const GeometrygeometryN (size_t const &n) const
 [OGC/SFA]Returns the n-th geometry
 
virtual GeometrygeometryN (size_t const &n)
 [OGC/SFA]Returns the n-th geometry
 
template<typename Derived >
bool is () const
 Tests if geometry is of "Derived" type given as template parameter.
 
template<typename Derived >
const Derived & as () const
 Downcast to a "Derived" class.
 
template<typename Derived >
Derived & as ()
 Downcast to a "Derived" class.
 
template<class Archive >
void serialize (Archive &, const unsigned int)
 Serializer.
 

Additional Inherited Members

- Protected Attributes inherited from SFCGAL::Geometry
bool validityFlag_
 

Detailed Description

A LineString in SFA.

Member Typedef Documentation

◆ const_iterator

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

◆ iterator

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

Constructor & Destructor Documentation

◆ LineString() [1/4]

SFCGAL::LineString::LineString ( )
default

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 ( )
default

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()

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

Get a deep copy of the geometry.

Implements SFCGAL::Geometry.

◆ closes()

void SFCGAL::LineString::closes ( )
inline

closes the LineString

◆ coordinateDimension()

auto 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()

auto 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()

auto SFCGAL::LineString::geometryType ( ) const
virtual

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

◆ geometryTypeId()

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

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

◆ is3D()

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

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ isClosed()

auto SFCGAL::LineString::isClosed ( ) const

test if the LineString is closed

◆ isEmpty()

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

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

◆ isMeasured()

auto 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()

auto SFCGAL::LineString::numSegments ( ) const

Returns the number of segments.

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

◆ operator=()

auto 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()

auto SFCGAL::LineString::toPolygon_2 ( bool fixOrientation = true) const