#include <ShapeList.h>
Public Member Functions | |
ShapeList (int depth=-1) | |
ShapeList (const ShapeList &other) | |
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< Color, int > &colormap) const |
void | flushSVG (std::ostream &stream, const TransformSVG &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 () |
Protected Member Functions | |
void | addShape (const Shape &shape, double scaleFactor) |
void | free () |
Protected Attributes | |
std::vector< Shape * > | _shapes |
int | _nextDepth |
The ShapeList structure.
const std::string & LibBoard::ShapeList::name | ( | ) | const [virtual] |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Group.
Point LibBoard::ShapeList::center | ( | ) | const [virtual] |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
References _shapes.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. | |
center | The center of rotation. |
Implements LibBoard::Shape.
References _shapes.
Referenced by rotate().
Shape & LibBoard::ShapeList::rotate | ( | double | angle | ) | [virtual] |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Shape & LibBoard::ShapeList::translate | ( | double | dx, | |
double | dy | |||
) | [virtual] |
Translate the shape by a given offset.
dx | The x offset. | |
dy | The y offset. |
Implements LibBoard::Shape.
References _shapes.
Referenced by scale().
Shape & LibBoard::ShapeList::scale | ( | double | sx, | |
double | sy | |||
) | [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.
References _shapes, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale().
Shape & LibBoard::ShapeList::scale | ( | double | s | ) | [virtual] |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
References scale().
void LibBoard::ShapeList::scaleAll | ( | double | s | ) | [virtual] |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
References _shapes.
void LibBoard::ShapeList::flushPostscript | ( | std::ostream & | stream, | |
const TransformEPS & | transform | |||
) | const [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.
References _shapes.
Referenced by LibBoard::Group::flushPostscript().
void LibBoard::ShapeList::flushFIG | ( | std::ostream & | stream, | |
const TransformFIG & | transform, | |||
std::map< Color, int > & | colormap | |||
) | const [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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
References _shapes.
Referenced by LibBoard::Group::flushFIG().
void LibBoard::ShapeList::flushSVG | ( | std::ostream & | stream, | |
const TransformSVG & | transform | |||
) | const [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.
References _shapes.
Referenced by LibBoard::Group::flushSVG().
Rect LibBoard::ShapeList::boundingBox | ( | ) | const [virtual] |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
References _shapes.
Referenced by LibBoard::Board::drawBoundingBox(), LibBoard::Group::flushFIG(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), and LibBoard::Board::saveSVG().
Shape * LibBoard::ShapeList::clone | ( | ) | const [virtual] |
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 |
Reimplemented in LibBoard::Board.
References _nextDepth, _shapes, LibBoard::Shape::clone(), and LibBoard::Shape::depth().
Adds a shape to the list of shape, always preserving the shape's depth.
shape |
References _shapes, and LibBoard::Shape::clone().
ShapeList & LibBoard::ShapeList::dup | ( | unsigned int | copies = 1 |
) |
Duplicates the last inserted shape.
copies | The number of copies. |
References _shapes.
Shape & LibBoard::ShapeList::last | ( | const unsigned int | position = 0 |
) | [inline] |
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. |
References _shapes.
Shape & LibBoard::ShapeList::top | ( | ) |
Convenience function that simply calls last(0).
position |
void LibBoard::ShapeList::free | ( | ) | [protected] |
Free the memory used by the shapes in the shape vector.
References _shapes.
Referenced by LibBoard::Board::operator=().
std::vector<Shape*> LibBoard::ShapeList::_shapes [protected] |
The vector of shapes.
Referenced by boundingBox(), center(), LibBoard::Board::drawArrow(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawCircle(), LibBoard::Board::drawClosedPolyline(), LibBoard::Board::drawDot(), LibBoard::Board::drawEllipse(), LibBoard::Board::drawLine(), LibBoard::Board::drawPolyline(), 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(), flushFIG(), flushPostscript(), flushSVG(), free(), last(), operator+=(), operator<<(), LibBoard::Board::operator=(), rotate(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), scale(), scaleAll(), and translate().
int LibBoard::ShapeList::_nextDepth [protected] |
The depth of the next figure to be added.
Referenced by LibBoard::Board::drawArrow(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawCircle(), LibBoard::Board::drawClosedPolyline(), LibBoard::Board::drawDot(), LibBoard::Board::drawEllipse(), LibBoard::Board::drawLine(), LibBoard::Board::drawPolyline(), 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<<().