bpp-core3  3.0.0
bpp::Point2D< T > Class Template Reference

The Point2D class. More...

#include <Bpp/Graphics/Point2D.h>

+ Inheritance diagram for bpp::Point2D< T >:
+ Collaboration diagram for bpp::Point2D< T >:

Public Member Functions

 Point2D (const T x=0, const T y=0)
 Build a new Point2D from two values. More...
 
virtual ~Point2D ()
 Destroy the Point2D object. More...
 
Point2D< T > * clone () const
 Implement the Clonable interface. More...
 
void setCoord (const T x, const T y)
 Set the two values. More...
 
void setX (const T x)
 Set only the longitude. More...
 
void setY (const T y)
 Set only the latitude. More...
 
const T & getX () const
 Get the longitude. More...
 
const T & getY () const
 Get the latitude. More...
 
bool hasSameCoordsAs (const Point2D< T > &coord) const
 Compares two Point2D objets. More...
 
virtual bool operator== (const Point2D< T > &coord) const
 The == operator. More...
 
virtual bool operator!= (const Point2D< T > &coord) const
 The != operator. More...
 

Private Attributes

x_
 
y_
 

Detailed Description

template<class T>
class bpp::Point2D< T >

The Point2D class.

This is a simple class designed to store the coordinates of a point. The type of the two coordinates is defined as a template.

Author
Sylvain Gaillard, Julien Dutheil

Definition at line 57 of file Point2D.h.

Constructor & Destructor Documentation

◆ Point2D()

template<class T >
bpp::Point2D< T >::Point2D ( const T  x = 0,
const T  y = 0 
)
inline

Build a new Point2D from two values.

The two values are set to 0 if no parametre is given to the constructor.

Parameters
xThe longitude or abscissa.
yThe latitude or ordinate.

Definition at line 62 of file Point2D.h.

Referenced by bpp::Point2D< T >::clone().

◆ ~Point2D()

template<class T >
virtual bpp::Point2D< T >::~Point2D ( )
inlinevirtual

Destroy the Point2D object.

Definition at line 80 of file Point2D.h.

Member Function Documentation

◆ clone()

template<class T >
Point2D<T>* bpp::Point2D< T >::clone ( ) const
inlinevirtual

Implement the Clonable interface.

Implements bpp::Clonable.

Definition at line 88 of file Point2D.h.

References bpp::Point2D< T >::Point2D().

◆ getX()

template<class T >
const T& bpp::Point2D< T >::getX ( ) const
inline

Get the longitude.

Definition at line 108 of file Point2D.h.

References bpp::Point2D< T >::x_.

Referenced by bpp::CoordsTools::getDistanceBetween().

◆ getY()

template<class T >
const T& bpp::Point2D< T >::getY ( ) const
inline

Get the latitude.

Definition at line 113 of file Point2D.h.

References bpp::Point2D< T >::y_.

Referenced by bpp::CoordsTools::getDistanceBetween().

◆ hasSameCoordsAs()

template<class T >
bool bpp::Point2D< T >::hasSameCoordsAs ( const Point2D< T > &  coord) const
inline

Compares two Point2D objets.

Return true if the coordinates of the 2 Point2D are equals.

Definition at line 120 of file Point2D.h.

References bpp::Point2D< T >::x_, and bpp::Point2D< T >::y_.

Referenced by bpp::Point2D< T >::operator!=(), and bpp::Point2D< T >::operator==().

◆ operator!=()

template<class T >
virtual bool bpp::Point2D< T >::operator!= ( const Point2D< T > &  coord) const
inlinevirtual

The != operator.

Definition at line 139 of file Point2D.h.

References bpp::Point2D< T >::hasSameCoordsAs().

◆ operator==()

template<class T >
virtual bool bpp::Point2D< T >::operator== ( const Point2D< T > &  coord) const
inlinevirtual

The == operator.

Return true if the coordinates of the 2 Point2Ds are equals. Does the same as the asSameCoords() methode.

Definition at line 131 of file Point2D.h.

References bpp::Point2D< T >::hasSameCoordsAs().

◆ setCoord()

template<class T >
void bpp::Point2D< T >::setCoord ( const T  x,
const T  y 
)

Set the two values.

◆ setX()

template<class T >
void bpp::Point2D< T >::setX ( const T  x)
inline

Set only the longitude.

Definition at line 98 of file Point2D.h.

References bpp::Point2D< T >::x_.

◆ setY()

template<class T >
void bpp::Point2D< T >::setY ( const T  y)
inline

Set only the latitude.

Definition at line 103 of file Point2D.h.

References bpp::Point2D< T >::y_.

Member Data Documentation

◆ x_

template<class T >
T bpp::Point2D< T >::x_
private

◆ y_

template<class T >
T bpp::Point2D< T >::y_
private

The documentation for this class was generated from the following file: