#include <OSDLPolygon.h>
Polygon sets are especially useful to model shapes that are complex or split in multiple non-overlapping parts, not connex.
Definition at line 627 of file OSDLPolygon.h.
Public Member Functions | |
PolygonSet (bool listOwner=false) throw () | |
Creates an empty set of polygons. | |
PolygonSet (std::list< listPoint2D * > &polygonList, bool listOwner=false) throw () | |
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) throw () |
Adds a new polygon to the polygon set, thanks to the points of the specified polygon. | |
virtual void | addPointList (listPoint2D &listToAdd) throw () |
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 throw () |
Draws the polygon set on specified surface, with specified color, at specified place. | |
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 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) throw () |
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) throw () | |
Copy constructor made private to ensure that it will never be called. | |
PolygonSet & | operator= (const PolygonSet &source) throw () |
Assignment operator made private to ensure that it will never be called. |
PolygonSet::PolygonSet | ( | bool | listOwner = false |
) | throw () [explicit] |
Creates an empty set of polygons.
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 746 of file OSDLPolygon.cc.
PolygonSet::PolygonSet | ( | std::list< listPoint2D * > & | polygonList, | |
bool | listOwner = false | |||
) | throw () [explicit] |
Creates an encapsulated set of polygons from a list of suites of summit vertices.
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). |
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 756 of file OSDLPolygon.cc.
PolygonSet::~PolygonSet | ( | ) | throw () [virtual] |
Basic virtual destructor.
Definition at line 767 of file OSDLPolygon.cc.
References _listOwner, _polygonList, and OSDL::Video::TwoDimensional::Polygon::Delete().
OSDL::Video::TwoDimensional::PolygonSet::PolygonSet | ( | const PolygonSet & | source | ) | throw () [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.
void PolygonSet::addPointsOf | ( | Polygon & | newPolygon | ) | throw () [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.
newPolygon | the point-providing polygon. |
Only the points of the specified polygon are taken into account, its referential, existing or not, is ignored.
Definition at line 795 of file OSDLPolygon.cc.
void PolygonSet::addPointList | ( | listPoint2D & | listToAdd | ) | throw () [virtual] |
Adds a new list of points to the polygon set.
listToAdd | the list of points to be added. |
Definition at line 808 of file OSDLPolygon.cc.
bool PolygonSet::draw | ( | Surface & | targetSurface, | |
Coordinate | x, | |||
Coordinate | y, | |||
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true | |||
) | const throw () [virtual] |
Draws the polygon set on specified surface, with specified color, at specified place.
Definition at line 820 of file OSDLPolygon.cc.
References OSDL::Video::TwoDimensional::drawPolygon().
const string PolygonSet::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Definition at line 850 of file OSDLPolygon.cc.
References OSDL::Video::Pixels::toString().
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 | |||
) | throw () [static] |
Creates a polygon whose shape is a snow flake.
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. |
PolygonSet& OSDL::Video::TwoDimensional::PolygonSet::operator= | ( | const PolygonSet & | source | ) | throw () [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.
std::list<listPoint2D *>* OSDL::Video::TwoDimensional::PolygonSet::_polygonList [protected] |
List of the summits of the polygon.
Definition at line 799 of file OSDLPolygon.h.
Referenced by ~PolygonSet().
bool OSDL::Video::TwoDimensional::PolygonSet::_listOwner [protected] |
Tells whether the polygon owns the embedded list, including its whole content.
Definition at line 809 of file OSDLPolygon.h.
Referenced by ~PolygonSet().