DGtal
1.5.beta
|
A group of shapes. More...
#include <Board/ShapeList.h>
Public Member Functions | |
ShapeList (int depth=-1) | |
ShapeList (const ShapeList &other) | |
~ShapeList () | |
const std::string & | name () const |
ShapeList & | clear () |
Point | center () const |
Shape & | rotate (double angle, const Point ¢er) |
ShapeList | rotated (double angle, const Point ¢er) |
Shape & | rotate (double angle) |
ShapeList | rotated (double angle) |
Shape & | translate (double dx, double dy) |
ShapeList | translated (double dx, double dy) |
Shape & | scale (double sx, double sy) |
Shape & | scale (double s) |
ShapeList | scaled (double sx, double sy) |
ShapeList | scaled (double s) |
void | scaleAll (double s) |
void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const |
void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const |
void | flushSVG (std::ostream &stream, const TransformSVG &transform) const |
void | flushCairo (cairo_t *cr, const TransformCairo &transform) const |
void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const |
Rect | boundingBox () const |
virtual int | minDepth () const |
virtual int | maxDepth () const |
void | shiftDepth (int shift) |
Shape * | clone () const |
ShapeList & | operator= (const ShapeList &other) |
ShapeList & | operator<< (const Shape &shape) |
ShapeList & | operator+= (const Shape &shape) |
ShapeList & | insert (const Shape &shape, int depth) |
ShapeList & | dup (unsigned int copies=1) |
template<typename T > | |
T & | last (const unsigned int position=0) |
Shape & | last (const unsigned int position=0) |
Shape & | top () |
Public Member Functions inherited from LibBoard::Shape | |
Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth) | |
virtual | ~Shape () |
bool | filled () const |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
Rect | bbox () |
Shape & | operator-- () |
Shape & | operator++ () |
int | depth () const |
virtual void | depth (int) |
const DGtal::Color & | penColor () const |
const DGtal::Color & | fillColor () const |
Protected Member Functions | |
void | addShape (const Shape &shape, double scaleFactor) |
void | free () |
Protected Member Functions inherited from LibBoard::Shape | |
std::string | svgProperties (const TransformSVG &transform) const |
std::string | postscriptProperties () const |
void | setCairoDashStyle (cairo_t *cr, LineStyle type) const |
std::string | tikzProperties (const TransformTikZ &transform) const |
Protected Attributes | |
std::vector< Shape * > | _shapes |
int | _nextDepth |
Protected Attributes inherited from LibBoard::Shape | |
int | _depth |
DGtal::Color | _penColor |
DGtal::Color | _fillColor |
double | _lineWidth |
LineStyle | _lineStyle |
LineCap | _lineCap |
LineJoin | _lineJoin |
Static Private Attributes | |
static const std::string | _name |
Additional Inherited Members | |
Public Types inherited from LibBoard::Shape | |
enum | LineCap { ButtCap = 0 , RoundCap , SquareCap } |
enum | LineJoin { MiterJoin = 0 , RoundJoin , BevelJoin } |
enum | LineStyle { SolidStyle = 0 , DashStyle , DotStyle , DashDotStyle , DashDotDotStyle , DashDotDotDotStyle } |
|
inline |
Referenced by clone(), rotated(), scaled(), and translated().
LibBoard::ShapeList::ShapeList | ( | const ShapeList & | other | ) |
Definition at line 62 of file ShapeList.cpp.
References _shapes.
LibBoard::ShapeList::~ShapeList | ( | ) |
Definition at line 37 of file ShapeList.cpp.
References free().
|
protected |
Definition at line 122 of file ShapeList.cpp.
References _nextDepth, _shapes, LibBoard::Shape::clone(), LibBoard::Shape::depth(), minDepth(), and LibBoard::shapeGreaterDepth().
Referenced by LibBoard::Board::operator<<().
|
virtual |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 379 of file ShapeList.cpp.
References _shapes.
Referenced by LibBoard::Group::boundingBox(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::saveCairo(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), and LibBoard::Board::saveTikZ().
|
virtual |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
Definition at line 192 of file ShapeList.cpp.
References _shapes.
Referenced by LibBoard::Board::rotate(), rotate(), LibBoard::Group::rotate(), rotated(), LibBoard::Board::scale(), scale(), and LibBoard::Group::scale().
ShapeList & LibBoard::ShapeList::clear | ( | ) |
Definition at line 43 of file ShapeList.cpp.
References _nextDepth, _shapes, free(), and max().
Referenced by LibBoard::Board::clear().
|
virtual |
Return a copy of the shape.
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 456 of file ShapeList.cpp.
References ShapeList().
ShapeList & LibBoard::ShapeList::dup | ( | unsigned int | copies = 1 | ) |
Duplicates the last inserted shape.
copies | The number of copies. |
Definition at line 153 of file ShapeList.cpp.
References _shapes, and LibBoard::warning.
|
virtual |
Writes the cairo code of the shape in a cairo drawing context according to a transform.
cr | The cairo drawing context. |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 347 of file ShapeList.cpp.
References _shapes, and LibBoard::shapeGreaterDepth().
|
virtual |
Writes the FIG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
colormap | A colormap. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 315 of file ShapeList.cpp.
References _shapes, and LibBoard::shapeGreaterDepth().
Referenced by LibBoard::Group::flushFIG().
|
virtual |
Writes the EPS code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 300 of file ShapeList.cpp.
References _shapes, and LibBoard::shapeGreaterDepth().
Referenced by LibBoard::Group::flushPostscript().
|
virtual |
Writes the SVG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 330 of file ShapeList.cpp.
References _shapes, and LibBoard::shapeGreaterDepth().
Referenced by LibBoard::Group::flushSVG().
|
virtual |
Writes the TikZ code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 363 of file ShapeList.cpp.
References _shapes, and LibBoard::shapeGreaterDepth().
Referenced by LibBoard::Group::flushTikZ().
|
protected |
Free the memory used by the shapes in the shape vector.
Definition at line 52 of file ShapeList.cpp.
References _shapes.
Referenced by clear(), LibBoard::Board::operator=(), operator=(), and ~ShapeList().
Insert the shape at a given depth. If the shape is ShapeList or a Board, then all shapes above it will be shifted.
shape | shape |
depth | depth |
Definition at line 184 of file ShapeList.cpp.
References LibBoard::warning.
Referenced by main().
T& LibBoard::ShapeList::last | ( | const unsigned int | position = 0 | ) |
Return the last inserted shape with its actual type, if specified (otherwise, a Shape &).
position | The position. 0 is the last inserted shape, 1 is the one before, etc. |
Shape & LibBoard::ShapeList::last | ( | const unsigned int | position = 0 | ) |
Definition at line 462 of file ShapeList.cpp.
|
virtual |
Definition at line 421 of file ShapeList.cpp.
References _shapes, and maxDepth().
Referenced by maxDepth(), and LibBoard::TransformFIG::setDepthRange().
|
virtual |
Definition at line 395 of file ShapeList.cpp.
References _shapes, max(), and minDepth().
Referenced by addShape(), minDepth(), operator<<(), and LibBoard::TransformFIG::setDepthRange().
|
virtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 32 of file ShapeList.cpp.
References _name.
Adds a shape to the list of shape, always preserving the shape's depth.
shape | shape to add. |
Definition at line 166 of file ShapeList.cpp.
References _shapes, and LibBoard::Shape::clone().
Adds a shape to the shape list. If the shape has no given depth or is a compound shape (ShapeList) then it is placed on top of the shapes stack. Otherwise, the shape depth is left unchanged.
shape | the shape to add. |
Definition at line 93 of file ShapeList.cpp.
References _nextDepth, _shapes, LibBoard::Shape::clone(), LibBoard::Shape::depth(), minDepth(), and LibBoard::shapeGreaterDepth().
Definition at line 77 of file ShapeList.cpp.
References _shapes, and free().
Referenced by LibBoard::Group::operator=().
|
virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 224 of file ShapeList.cpp.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 205 of file ShapeList.cpp.
References _shapes.
Referenced by rotate(), LibBoard::Board::rotate(), and LibBoard::Group::rotate().
ShapeList LibBoard::ShapeList::rotated | ( | double | angle | ) |
Definition at line 230 of file ShapeList.cpp.
References center(), and ShapeList().
Definition at line 217 of file ShapeList.cpp.
|
virtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 272 of file ShapeList.cpp.
References scale().
|
virtual |
Scale the shape along the x an y axis.
sx | The scale factor along the x axis. |
sy | The scale factor along the y axis. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 254 of file ShapeList.cpp.
References _shapes, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale(), LibBoard::Board::scale(), and LibBoard::Group::scale().
|
virtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
Definition at line 290 of file ShapeList.cpp.
References _shapes.
ShapeList LibBoard::ShapeList::scaled | ( | double | s | ) |
Definition at line 284 of file ShapeList.cpp.
References ShapeList().
ShapeList LibBoard::ShapeList::scaled | ( | double | sx, |
double | sy | ||
) |
Definition at line 278 of file ShapeList.cpp.
References ShapeList().
|
virtual |
Reimplemented from LibBoard::Shape.
Definition at line 446 of file ShapeList.cpp.
References _shapes.
Shape & LibBoard::ShapeList::top | ( | ) |
Convenience function that simply calls last(0).
Definition at line 468 of file ShapeList.cpp.
|
virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
Definition at line 236 of file ShapeList.cpp.
References _shapes.
Referenced by scale(), LibBoard::Board::translate(), and LibBoard::Group::translate().
ShapeList LibBoard::ShapeList::translated | ( | double | dx, |
double | dy | ||
) |
Definition at line 248 of file ShapeList.cpp.
References ShapeList().
|
staticprivate |
|
protected |
The depth of the next figure to be added.
Definition at line 170 of file ShapeList.h.
Referenced by addShape(), clear(), LibBoard::Board::drawArc(), LibBoard::Board::drawArrow(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawCircle(), LibBoard::Board::drawClosedPolyline(), LibBoard::Board::drawDot(), LibBoard::Board::drawEllipse(), LibBoard::Board::drawImage(), LibBoard::Board::drawLine(), LibBoard::Board::drawPolyline(), LibBoard::Board::drawQuadraticBezierCurve(), LibBoard::Board::drawRectangle(), LibBoard::Board::drawText(), LibBoard::Board::drawTriangle(), LibBoard::Board::fillCircle(), LibBoard::Board::fillEllipse(), LibBoard::Board::fillGouraudTriangle(), LibBoard::Board::fillPolyline(), LibBoard::Board::fillRectangle(), LibBoard::Board::fillTriangle(), and operator<<().
|
protected |
The vector of shapes.
Definition at line 169 of file ShapeList.h.
Referenced by addShape(), boundingBox(), center(), clear(), LibBoard::Board::drawArc(), LibBoard::Board::drawArrow(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawCircle(), LibBoard::Board::drawClosedPolyline(), LibBoard::Board::drawDot(), LibBoard::Board::drawEllipse(), LibBoard::Board::drawImage(), LibBoard::Board::drawLine(), LibBoard::Board::drawPolyline(), LibBoard::Board::drawQuadraticBezierCurve(), LibBoard::Board::drawRectangle(), LibBoard::Board::drawText(), LibBoard::Board::drawTriangle(), dup(), LibBoard::Board::fillCircle(), LibBoard::Board::fillEllipse(), LibBoard::Board::fillGouraudTriangle(), LibBoard::Board::fillPolyline(), LibBoard::Board::fillRectangle(), LibBoard::Board::fillTriangle(), flushCairo(), flushFIG(), flushPostscript(), flushSVG(), flushTikZ(), free(), maxDepth(), minDepth(), operator+=(), operator<<(), LibBoard::Board::operator=(), operator=(), rotate(), LibBoard::Board::saveCairo(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Board::saveTikZ(), scale(), scaleAll(), ShapeList(), shiftDepth(), and translate().