OSDL::Video::TwoDimensional::Point2D Class Reference

Represents a point whose coordinates are integers, in a two-dimensional space. More...

#include <OSDLPoint2D.h>

Inheritance diagram for OSDL::Video::TwoDimensional::Point2D:
Inheritance graph
[legend]
Collaboration diagram for OSDL::Video::TwoDimensional::Point2D:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Point2D (Coordinate x=0, Coordinate y=0)
 Constructor of a two dimensional point, from two coordinates.
 Point2D (const Point2D &source)
 Copy constructor.
 Point2D (const Ceylan::Maths::Linear::Bipoint &source)
 Creates a two dimensional point from a bipoint (conversion operator).
 Point2D (const Ceylan::Maths::Linear::Vector2 &source)
 Creates a two dimensional point from a 2D vector (conversion operator).
virtual ~Point2D () throw ()
 Virtual destructor of a two dimensional point.
virtual void setTo (Coordinate x, Coordinate y)
 Sets the coordinates of this point to specified coordinates.
virtual void setTo (FloatingPointCoordinate x, FloatingPointCoordinate y)
 Sets the coordinates of this point from specified floating-point coordinates.
virtual void setFrom (const Point2D &source)
 Sets this point coordinates from specified point, whose coordinates are copied.
virtual void setFrom (const Ceylan::Maths::Linear::Vector2 &source)
 Sets this point coordinates from specified 2D vector, whose coordinates are copied.
Coordinate getX () const
 Returns the first coordinate (abscissa) of the point.
void setX (Coordinate newX)
 Sets the first coordinate (abscissa) of the point.
Coordinate getY () const
 Returns the second coordinate (ordinate) of the point.
void setY (Coordinate newY)
 Sets the second coordinate (ordinate) of the point.
void translate (Offset x, Offset y)
 Translates this point of vector [x,y]: adds x to this point's abscissa, and adds y to its ordinate.
virtual void flip ()
 Flips the coordinates of the point.
virtual void flipX ()
 Flips the abscissa of this point.
virtual void flipY ()
 Flips the oridinate of this point.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static Point2DCreateFrom (FloatingPointCoordinate x=0, FloatingPointCoordinate y=0)
 Factory to create a two dimensional point from two floating-point coordinates.
static void Translate (std::list< Point2D * > &pointList, Offset x, Offset y)
 Translates all the points in the list of vector [x,y]: adds x to each point's abscissa, and adds y to each point'sordinate.

Static Public Attributes

static const Point2D Origin
 The origin of a 2D referential.
static const
Ceylan::Maths::Linear::MatrixIndex 
Dimensions = 2
 Tells what is the dimension of the space this point is defined in.

Protected Attributes

Coordinate _coord [Dimensions]
 Coordinates of the 2D point in space (abscissa, ordinate).

Detailed Description

Represents a point whose coordinates are integers, in a two-dimensional space.

Note:
These integer points are especially useful to handle graphical user interface elements, such as widgets.

Definition at line 67 of file OSDLPoint2D.h.


Constructor & Destructor Documentation

Point2D::Point2D ( Coordinate  x = 0,
Coordinate  y = 0 
) [explicit]

Constructor of a two dimensional point, from two coordinates.

Definition at line 45 of file OSDLPoint2D.cc.

References _coord.

Referenced by CreateFrom().

Point2D::Point2D ( const Point2D source  ) 

Copy constructor.

Note:
Cannot use the 'explicit' qualifier since it would prohibit expressions such as: 'return Point2D( _x, _y ) ;'

Definition at line 55 of file OSDLPoint2D.cc.

References _coord.

Point2D::Point2D ( const Ceylan::Maths::Linear::Bipoint &  source  )  [explicit]

Creates a two dimensional point from a bipoint (conversion operator).

Note:
Floating-point coordinates are rounded to nearest integers.

Definition at line 66 of file OSDLPoint2D.cc.

References _coord.

Point2D::Point2D ( const Ceylan::Maths::Linear::Vector2 &  source  )  [explicit]

Creates a two dimensional point from a 2D vector (conversion operator).

Note:
Floating-point coordinates are rounded to nearest integers.

Definition at line 76 of file OSDLPoint2D.cc.

References _coord.

Point2D::~Point2D (  )  throw () [virtual]

Virtual destructor of a two dimensional point.

Definition at line 96 of file OSDLPoint2D.cc.


Member Function Documentation

Point2D & Point2D::CreateFrom ( FloatingPointCoordinate  x = 0,
FloatingPointCoordinate  y = 0 
) [static]

Factory to create a two dimensional point from two floating-point coordinates.

Floating-point coordinates are rounded to nearest integer coordinates.

Parameters:
x the point abscissa.
y the point ordinate.

This is not a constructor, since otherwise it would collide with basic Coordinate-based constructor and force the user to cast integer values to Coordinates.

Returns:
a newly allocated Point2D instance that the caller will have to deallocate eventually.

Definition at line 86 of file OSDLPoint2D.cc.

References Point2D().

void Point2D::flip (  )  [virtual]

Flips the coordinates of the point.

Implements OSDL::Video::TwoDimensional::Point.

Definition at line 166 of file OSDLPoint2D.cc.

References _coord.

void Point2D::flipX (  )  [virtual]

Flips the abscissa of this point.

Definition at line 176 of file OSDLPoint2D.cc.

References _coord.

void Point2D::flipY (  )  [virtual]

Flips the oridinate of this point.

Definition at line 185 of file OSDLPoint2D.cc.

References _coord.

Coordinate OSDL::Video::TwoDimensional::Point2D::getX (  )  const [inline]
Coordinate OSDL::Video::TwoDimensional::Point2D::getY (  )  const [inline]
void Point2D::setFrom ( const Ceylan::Maths::Linear::Vector2 &  source  )  [virtual]

Sets this point coordinates from specified 2D vector, whose coordinates are copied.

Note:
Floating-point coordinates are rounded to nearest integers.

Definition at line 133 of file OSDLPoint2D.cc.

References _coord.

void Point2D::setFrom ( const Point2D source  )  [virtual]

Sets this point coordinates from specified point, whose coordinates are copied.

Definition at line 123 of file OSDLPoint2D.cc.

References _coord.

void Point2D::setTo ( FloatingPointCoordinate  x,
FloatingPointCoordinate  y 
) [virtual]

Sets the coordinates of this point from specified floating-point coordinates.

Note:
Floating-point coordinates are rounded to nearest integer coordinates.

Definition at line 113 of file OSDLPoint2D.cc.

References _coord.

void Point2D::setTo ( Coordinate  x,
Coordinate  y 
) [virtual]

Sets the coordinates of this point to specified coordinates.

Definition at line 103 of file OSDLPoint2D.cc.

References _coord.

void OSDL::Video::TwoDimensional::Point2D::setX ( Coordinate  newX  )  [inline]

Sets the first coordinate (abscissa) of the point.

Definition at line 318 of file OSDLPoint2D.h.

References _coord.

Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().

void OSDL::Video::TwoDimensional::Point2D::setY ( Coordinate  newY  )  [inline]

Sets the second coordinate (ordinate) of the point.

Definition at line 336 of file OSDLPoint2D.h.

References _coord.

Referenced by OSDL::Video::TwoDimensional::UprightRectangle::drawWithRoundedCorners().

const string Point2D::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Reimplemented from OSDL::Video::TwoDimensional::Point.

Definition at line 143 of file OSDLPoint2D.cc.

References _coord.

Referenced by OSDL::Video::Surface::blitTo(), operator<<(), OSDL::Video::TwoDimensional::UprightRectangle::setLowerRightCorner(), OSDL::Video::OpenGL::OpenGLContext::setViewPort(), and OSDL::Video::TwoDimensional::Widget::toString().

void Point2D::Translate ( std::list< Point2D * > &  pointList,
Offset  x,
Offset  y 
) [static]

Translates all the points in the list of vector [x,y]: adds x to each point's abscissa, and adds y to each point'sordinate.

Definition at line 194 of file OSDLPoint2D.cc.

void Point2D::translate ( Offset  x,
Offset  y 
)

Translates this point of vector [x,y]: adds x to this point's abscissa, and adds y to its ordinate.

Definition at line 156 of file OSDLPoint2D.cc.

References _coord.


Member Data Documentation

Coordinates of the 2D point in space (abscissa, ordinate).

Definition at line 295 of file OSDLPoint2D.h.

Referenced by flip(), flipX(), flipY(), getX(), getY(), Point2D(), setFrom(), setTo(), setX(), setY(), toString(), and translate().

const Ceylan::Maths::Linear::MatrixIndex OSDL::Video::TwoDimensional::Point2D::Dimensions = 2 [static]

Tells what is the dimension of the space this point is defined in.

Reimplemented from OSDL::Video::TwoDimensional::Point.

Definition at line 282 of file OSDLPoint2D.h.

const Point2D Point2D::Origin [static]

The origin of a 2D referential.

Definition at line 261 of file OSDLPoint2D.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:06:18 2010 for OSDL by  doxygen 1.6.3