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

#include <OSDLPoint2D.h>

Inheritance diagram for OSDL::Video::TwoDimensional::Point2D:

[legend]
Collaboration diagram for OSDL::Video::TwoDimensional::Point2D:
[legend]
List of all members.

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 38 of file OSDLPoint2D.h.

Public Member Functions

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

Static Public Member Functions

static Point2DCreateFrom (FloatingPointCoordinate x=0, FloatingPointCoordinate y=0) throw ()
 Factory to create a two dimensional point from two floating-point coordinates.
static void Translate (std::list< Point2D * > &pointList, Offset x, Offset y) throw ()
 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).


Constructor & Destructor Documentation

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

Constructor of a two dimensional point, from two coordinates.

Definition at line 15 of file OSDLPoint2D.cc.

Point2D::Point2D ( const Point2D source  )  throw ()

Copy constructor.

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

Definition at line 24 of file OSDLPoint2D.cc.

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

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

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

Definition at line 34 of file OSDLPoint2D.cc.

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

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

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

Definition at line 43 of file OSDLPoint2D.cc.

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

Virtual destructor of a two dimensional point.

Definition at line 62 of file OSDLPoint2D.cc.


Member Function Documentation

Point2D & Point2D::CreateFrom ( FloatingPointCoordinate  x = 0,
FloatingPointCoordinate  y = 0 
) throw () [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 53 of file OSDLPoint2D.cc.

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

Sets the coordinates of this point to specified coordinates.

Definition at line 68 of file OSDLPoint2D.cc.

void Point2D::setTo ( FloatingPointCoordinate  x,
FloatingPointCoordinate  y 
) throw () [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 77 of file OSDLPoint2D.cc.

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

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

Definition at line 88 of file OSDLPoint2D.cc.

void Point2D::setFrom ( const Ceylan::Maths::Linear::Vector2 &  source  )  throw () [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 97 of file OSDLPoint2D.cc.

Coordinate OSDL::Video::TwoDimensional::Point2D::getX (  )  const throw () [inline]

Returns the first coordinate (abscissa) of the point.

Definition at line 260 of file OSDLPoint2D.h.

References _coord.

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

Sets the first coordinate (abscissa) of the point.

Definition at line 268 of file OSDLPoint2D.h.

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

Coordinate OSDL::Video::TwoDimensional::Point2D::getY (  )  const throw () [inline]

Returns the second coordinate (ordinate) of the point.

Definition at line 276 of file OSDLPoint2D.h.

References _coord.

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

Sets the second coordinate (ordinate) of the point.

Definition at line 284 of file OSDLPoint2D.h.

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

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

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

Definition at line 118 of file OSDLPoint2D.cc.

void Point2D::flip (  )  throw () [virtual]

Flips the coordinates of the point.

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

Definition at line 127 of file OSDLPoint2D.cc.

References _coord.

void Point2D::flipX (  )  throw () [virtual]

Flips the abscissa of this point.

Definition at line 136 of file OSDLPoint2D.cc.

References _coord.

void Point2D::flipY (  )  throw () [virtual]

Flips the oridinate of this point.

Definition at line 144 of file OSDLPoint2D.cc.

References _coord.

const string Point2D::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const throw () [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 106 of file OSDLPoint2D.cc.

Referenced by operator<<().

static void OSDL::Video::TwoDimensional::Point2D::Translate ( std::list< Point2D * > &  pointList,
Offset  x,
Offset  y 
) throw () [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.


Member Data Documentation

const Point2D Point2D::Origin [static]

The origin of a 2D referential.

Definition at line 217 of file OSDLPoint2D.h.

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 237 of file OSDLPoint2D.h.

Coordinate OSDL::Video::TwoDimensional::Point2D::_coord[Dimensions] [protected]

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

Definition at line 249 of file OSDLPoint2D.h.

Referenced by flip(), flipX(), flipY(), getX(), and getY().


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 14:47:34 2007 for OSDL by  doxygen 1.5.1