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...
 
bool almostEqual (const Point &other, const double tolerance) const
 absolute comparison 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>
auto toPoint_d () const -> typename TypeForDimension< Dim >::Point
 
- 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...
 
virtual Geometryclone () const =0
 Get a deep copy of the geometry. More...
 
virtual std::string geometryType () const =0
 [OGC/SFA]returns the geometry type More...
 
virtual GeometryType geometryTypeId () const =0
 Returns a code corresponding to the type. More...
 
virtual int dimension () const =0
 [OGC/SFA]Dimension of the Geometry ( 0 : punctual, 1 : curve, ...) More...
 
virtual int coordinateDimension () const =0
 [OGC/SFA]returns the dimension of the coordinates More...
 
virtual bool isEmpty () const =0
 [OGC/SFA]test if geometry is empty More...
 
virtual bool is3D () const =0
 [OGC/SFA]test if geometry is 3d More...
 
virtual bool isMeasured () const =0
 [OGC/SFA]test if geometry is measured (has an m) 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...
 
auto almostEqual (const Geometry &, const double tolerance) const -> bool
 Equality operator. 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...
 
virtual void accept (GeometryVisitor &visitor)=0
 [visitor]dispatch visitor More...
 
virtual void accept (ConstGeometryVisitor &visitor) const =0
 [visitor]dispatch visitor 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)
default

copy constructor

◆ ~Point()

SFCGAL::Point::~Point ( )
default

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.

◆ almostEqual()

auto SFCGAL::Point::almostEqual ( const Point other,
const double  tolerance 
) const

absolute comparison with an other point

◆ clone()

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

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

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

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

[OGC/SFA]returns the geometry type

Warning
use CamelCase (LineString, not LINESTRING)

Implements SFCGAL::Geometry.

◆ geometryTypeId()

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

Returns a code corresponding to the type.

Warning
not standard

Implements SFCGAL::Geometry.

◆ is3D()

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

[OGC/SFA]test if geometry is 3d

Precondition
suppose no mix of 2D/3D coordinates

Implements SFCGAL::Geometry.

◆ isEmpty()

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

[OGC/SFA]test if geometry is empty

Implements SFCGAL::Geometry.

◆ isMeasured()

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

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

compare with an other point

◆ operator<()

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

compare two points

◆ operator=()

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

assign operator

◆ operator==()

auto 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>
template CGAL::Point_3< Kernel > SFCGAL::Point::toPoint_d< 3 > ( ) const

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

◆ toPoint_d() [2/2]

template<int Dim>
auto SFCGAL::Point::toPoint_d ( ) const -> typename TypeForDimension<Dim>::Point

◆ 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.