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

A point in SFA. More...

#include <Point.h>

Inheritance diagram for SFCGAL::Point:
SFCGAL::Geometry

Public Member Functions

 Point ()
 Empty point constructor. More...
 
 Point (const Coordinate &coordinate)
 Constructor with Coordinate. More...
 
 Point (const Kernel::FT &x, const Kernel::FT &y)
 XY Constructor with exact coordinates. More...
 
 Point (const Kernel::FT &x, const Kernel::FT &y, const Kernel::FT &z, const double &m=NaN())
 XY Constructor with exact coordinates. More...
 
 Point (const double &x, const double &y)
 XY constructor. More...
 
 Point (const double &x, const double &y, const double &z)
 XYZ constructor. More...
 
 Point (const double &x, const double &y, const double &z, const double &m)
 XYZM constructor. More...
 
 Point (const Kernel::Point_2 &other)
 Constructor from CGAL::Point_2<K> More...
 
 Point (const Kernel::Point_3 &other)
 Constructor from CGAL::Point_3<K> More...
 
 Point (const Point &other)
 copy constructor More...
 
Pointoperator= (const Point &other)
 assign operator More...
 
 ~Point ()
 destructor More...
 
virtual Pointclone () 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...
 
Kernel::RT x () const
 Returns the x value as a double throw for empty Point. More...
 
Kernel::RT y () const
 Returns the y value as a double throw for empty Point. More...
 
Kernel::RT z () const
 Returns the z value (zero for 2D) throw for empty Point. More...
 
double m () const
 Returns the m value (NaN is not defined) More...
 
void setM (const double &m)
 Sets the m value. More...
 
bool operator< (const Point &other) const
 compare two points More...
 
bool operator== (const Point &other) const
 compare with an other point More...
 
bool operator!= (const Point &other) const
 compare with an other point More...
 
virtual void accept (GeometryVisitor &visitor)
 [visitor]dispatch visitor More...
 
virtual void accept (ConstGeometryVisitor &visitor) const
 [visitor]dispatch visitor More...
 
Kernel::Vector_2 toVector_2 () const
 
Kernel::Vector_3 toVector_3 () const
 
Kernel::Point_2 toPoint_2 () const
 
Kernel::Point_3 toPoint_3 () const
 
template<int D>
detail::TypeForDimension< D >::Point toPoint_d () const
 Converts to CGAL::Point_2 or CGAL::Point_3. More...
 
Coordinatecoordinate ()
 
const Coordinatecoordinate () const
 
template<class Archive >
void serialize (Archive &ar, const unsigned int)
 Serializer. More...
 
template<int Dim>
TypeForDimension< Dim >::Point toPoint_d () const
 
- 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 point in SFA.

The x(),y(),z() interface is based on CGAL kernel requirements, taken from examples/Kernel_23/MyPointC2.h

Todo:
strong typing on coordinate dimension?

Constructor & Destructor Documentation

◆ Point() [1/10]

SFCGAL::Point::Point ( )

Empty point constructor.

◆ Point() [2/10]

SFCGAL::Point::Point ( const Coordinate coordinate)

Constructor with Coordinate.

◆ Point() [3/10]

SFCGAL::Point::Point ( const Kernel::FT &  x,
const Kernel::FT &  y 
)

XY Constructor with exact coordinates.

◆ Point() [4/10]

SFCGAL::Point::Point ( const Kernel::FT &  x,
const Kernel::FT &  y,
const Kernel::FT &  z,
const double &  m = NaN() 
)

XY Constructor with exact coordinates.

◆ Point() [5/10]

SFCGAL::Point::Point ( const double &  x,
const double &  y 
)

XY constructor.

◆ Point() [6/10]

SFCGAL::Point::Point ( const double &  x,
const double &  y,
const double &  z 
)

XYZ constructor.

◆ Point() [7/10]

SFCGAL::Point::Point ( const double &  x,
const double &  y,
const double &  z,
const double &  m 
)

XYZM constructor.

◆ Point() [8/10]

SFCGAL::Point::Point ( const Kernel::Point_2 &  other)

Constructor from CGAL::Point_2<K>

◆ Point() [9/10]

SFCGAL::Point::Point ( const Kernel::Point_3 &  other)

Constructor from CGAL::Point_3<K>

◆ Point() [10/10]

SFCGAL::Point::Point ( const Point other)

copy constructor

◆ ~Point()

SFCGAL::Point::~Point ( )

destructor

Member Function Documentation

◆ accept() [1/2]

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

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

◆ accept() [2/2]

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

[visitor]dispatch visitor

Implements SFCGAL::Geometry.

◆ clone()

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

Get a deep copy of the geometry.

Implements SFCGAL::Geometry.

◆ coordinate() [1/2]

Coordinate& SFCGAL::Point::coordinate ( )
inline

◆ coordinate() [2/2]

const Coordinate& SFCGAL::Point::coordinate ( ) const
inline

◆ coordinateDimension()

int SFCGAL::Point::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::Point::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.

◆ geometryType()

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

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

◆ geometryTypeId()

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

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

◆ is3D()

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

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ isEmpty()

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

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

◆ isMeasured()

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

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

Precondition
suppose no mix of M/!M points

Implements SFCGAL::Geometry.

◆ m()

double SFCGAL::Point::m ( ) const
inline

Returns the m value (NaN is not defined)

◆ operator!=()

bool SFCGAL::Point::operator!= ( const Point other) const

compare with an other point

◆ operator<()

bool SFCGAL::Point::operator< ( const Point other) const

compare two points

◆ operator=()

Point & SFCGAL::Point::operator= ( const Point other)

assign operator

◆ operator==()

bool SFCGAL::Point::operator== ( const Point other) const

compare with an other point

◆ serialize()

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

Serializer.

◆ setM()

void SFCGAL::Point::setM ( const double &  m)
inline

Sets the m value.

◆ toPoint_2()

Kernel::Point_2 SFCGAL::Point::toPoint_2 ( ) const
inline

◆ toPoint_3()

Kernel::Point_3 SFCGAL::Point::toPoint_3 ( ) const
inline

◆ toPoint_d() [1/2]

template<int D>
detail::TypeForDimension<D>::Point SFCGAL::Point::toPoint_d ( ) const

Converts to CGAL::Point_2 or CGAL::Point_3.

◆ toPoint_d() [2/2]

template<int Dim>
template CGAL::Point_3< Kernel > SFCGAL::Point::toPoint_d< 3 > ( ) const

◆ toVector_2()

Kernel::Vector_2 SFCGAL::Point::toVector_2 ( ) const
inline

◆ toVector_3()

Kernel::Vector_3 SFCGAL::Point::toVector_3 ( ) const
inline

◆ x()

Kernel::RT SFCGAL::Point::x ( ) const
inline

Returns the x value as a double throw for empty Point.

◆ y()

Kernel::RT SFCGAL::Point::y ( ) const
inline

Returns the y value as a double throw for empty Point.

◆ z()

Kernel::RT SFCGAL::Point::z ( ) const
inline

Returns the z value (zero for 2D) throw for empty Point.