OSDL::Video::TwoDimensional::PolygonSet Class Reference

Polygon sets are collections of polygons defined in the same referential. More...

#include <OSDLPolygon.h>

Collaboration diagram for OSDL::Video::TwoDimensional::PolygonSet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PolygonSet (bool listOwner=false)
 Creates an empty set of polygons.
 PolygonSet (std::list< listPoint2D * > &polygonList, bool listOwner=false)
 Creates an encapsulated set of polygons from a list of suites of summit vertices.
virtual ~PolygonSet () throw ()
 Basic virtual destructor.
virtual void addPointsOf (Polygon &newPolygon)
 Adds a new polygon to the polygon set, thanks to the points of the specified polygon.
virtual void addPointList (listPoint2D &listToAdd)
 Adds a new list of points to the polygon set.
virtual bool draw (Surface &targetSurface, Coordinate x, Coordinate y, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) const
 Draws the polygon set on specified surface, with specified color, at specified place.
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 PolygonSetCreateFlake (Ceylan::Uint8 branchCount=5, Length length=200, Length thickness=20, Ceylan::Maths::AngleInDegrees childAngle=50, Ceylan::Maths::Ratio branchingHeightRatio=0.7, Ceylan::Maths::Ratio scale=0.3)
 Creates a polygon whose shape is a snow flake.

Protected Attributes

std::list< listPoint2D * > * _polygonList
 List of the summits of the polygon.
bool _listOwner
 Tells whether the polygon owns the embedded list, including its whole content.

Private Member Functions

 PolygonSet (const PolygonSet &source)
 Copy constructor made private to ensure that it will never be called.
PolygonSetoperator= (const PolygonSet &source)
 Assignment operator made private to ensure that it will never be called.

Detailed Description

Polygon sets are collections of polygons defined in the same referential.

Polygon sets are especially useful to model shapes that are complex or split in multiple non-overlapping parts, not connex.

See also:
Polygon

Definition at line 680 of file OSDLPolygon.h.


Constructor & Destructor Documentation

PolygonSet::PolygonSet ( bool  listOwner = false  )  [explicit]

Creates an empty set of polygons.

Parameters:
listOwner tells whether this polygon owns the lists and the points in its polygon list (and therefore will deallocate them) or not (in this case, neither the list nor the points will be deallocated).

Definition at line 864 of file OSDLPolygon.cc.

PolygonSet::PolygonSet ( std::list< listPoint2D * > &  polygonList,
bool  listOwner = false 
) [explicit]

Creates an encapsulated set of polygons from a list of suites of summit vertices.

Parameters:
polygonList a list of list of points as inputs.
listOwner tells whether this polygon owns the lists and the points in its polygon list (and therefore will deallocate them) or not (in this case, neither the list nor the points will be deallocated).
Note:
The polygon set is not made of a list of Polygons, since they would each have their own referential, while they should all be defined relatively to the same.
Never put twice the same point object in the list if the polygon is going to own its points, since the duplicated points would be deleted twice, which results in a core dump.

Definition at line 874 of file OSDLPolygon.cc.

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

Basic virtual destructor.

Definition at line 885 of file OSDLPolygon.cc.

References _listOwner, _polygonList, and OSDL::Video::TwoDimensional::Polygon::Delete().

OSDL::Video::TwoDimensional::PolygonSet::PolygonSet ( const PolygonSet source  )  [explicit, private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void PolygonSet::addPointList ( listPoint2D listToAdd  )  [virtual]

Adds a new list of points to the polygon set.

Parameters:
listToAdd the list of points to be added.
Note:
The ownership of the list is taken; for the one of its points, it depends on whether the polygon set has been constructed as a list owner (would then deallocate the points) or not.

Definition at line 926 of file OSDLPolygon.cc.

References _polygonList.

Referenced by addPointsOf().

void PolygonSet::addPointsOf ( TwoDimensional::Polygon newPolygon  )  [virtual]

Adds a new polygon to the polygon set, thanks to the points of the specified polygon.

The polygon set takes ownership of the list and the points in it.

Parameters:
newPolygon the point-providing polygon.
Note:
No added polygon must own its points.
Only the points of the specified polygon are taken into account, its referential, existing or not, is ignored.

Definition at line 913 of file OSDLPolygon.cc.

References addPointList(), OSDL::Video::TwoDimensional::Polygon::getPoints(), and OSDL::Video::TwoDimensional::Polygon::isListOwner().

static PolygonSet& OSDL::Video::TwoDimensional::PolygonSet::CreateFlake ( Ceylan::Uint8  branchCount = 5,
Length  length = 200,
Length  thickness = 20,
Ceylan::Maths::AngleInDegrees  childAngle = 50,
Ceylan::Maths::Ratio  branchingHeightRatio = 0.7,
Ceylan::Maths::Ratio  scale = 0.3 
) [static]

Creates a polygon whose shape is a snow flake.

Note:
The caller should deallocate this polygon when finished with it.
Parameters:
branchCount tells how many branches the flake should have (must not be null).
length defines the height of the main branch of this flake.
thickness defines the width of the main branch of this flake.
childAngle defines the angle, in degrees, between the main branch and the second branch.
branchingHeightRatio tells at which height of the main branch the second shall begin.
scale defines the ratio of the second branch relatively to the main one.
See also:
Polygon::CreateFlakeBranch
bool PolygonSet::draw ( Surface targetSurface,
Coordinate  x,
Coordinate  y,
Pixels::ColorDefinition  colorDef = Pixels::White,
bool  filled = true 
) const [virtual]

Draws the polygon set on specified surface, with specified color, at specified place.

Definition at line 938 of file OSDLPolygon.cc.

References _polygonList, and OSDL::Video::TwoDimensional::drawPolygon().

PolygonSet& OSDL::Video::TwoDimensional::PolygonSet::operator= ( const PolygonSet source  )  [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

const string PolygonSet::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

Definition at line 968 of file OSDLPolygon.cc.

References _polygonList, and OSDL::Video::Pixels::toString().


Member Data Documentation

Tells whether the polygon owns the embedded list, including its whole content.

Definition at line 865 of file OSDLPolygon.h.

Referenced by ~PolygonSet().

List of the summits of the polygon.

Definition at line 854 of file OSDLPolygon.h.

Referenced by addPointList(), draw(), toString(), and ~PolygonSet().


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