A group of shapes. More...
#include <ShapeList.h>
Public Member Functions | |
| ShapeList (int depth=-1) | |
| ShapeList (const ShapeList &other) | |
| const std::string & | name () const |
| ShapeList & | clear () |
| Point | center () const |
| ShapeList & | rotate (double angle, const Point ¢er) |
| ShapeList | rotated (double angle, const Point ¢er) |
| ShapeList & | rotate (double angle) |
| ShapeList | rotated (double angle) |
| ShapeList & | translate (double dx, double dy) |
| ShapeList | translated (double dx, double dy) |
| ShapeList & | scale (double sx, double sy) |
| ShapeList & | 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) |
| ShapeList * | 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 |
A group of shapes.
The ShapeList structure.
| Rect LibBoard::ShapeList::boundingBox | ( | ) | const [virtual] |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
Reimplemented in LibBoard::Group.
References _shapes.
Referenced by LibBoard::Group::boundingBox(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), and LibBoard::Board::saveSVG().
| Point LibBoard::ShapeList::center | ( | ) | const [virtual] |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
References _shapes.
Referenced by LibBoard::Group::rotate(), rotate(), LibBoard::Board::rotate(), LibBoard::Group::scale(), scale(), and LibBoard::Board::scale().
| ShapeList * LibBoard::ShapeList::clone | ( | ) | const [virtual] |
| ShapeList & LibBoard::ShapeList::dup | ( | unsigned int | copies = 1 |
) |
Duplicates the last inserted shape.
| copies | The number of copies. |
References _shapes.
| 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.
| 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.
| 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.
| void LibBoard::ShapeList::free | ( | ) | [protected] |
Free the memory used by the shapes in the shape vector.
References _shapes.
Referenced by LibBoard::Board::operator=().
| 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. |
| 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.
Adds a shape to the list of shape, always preserving the shape's depth.
| shape |
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 |
Reimplemented in LibBoard::Board.
References _nextDepth, _shapes, and LibBoard::Shape::clone().
| ShapeList & LibBoard::ShapeList::rotate | ( | double | angle | ) | [virtual] |
Rotate the shape around its center.
| angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Board, and LibBoard::Group.
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::Board, and LibBoard::Group.
References _shapes.
Referenced by rotate().
| ShapeList & LibBoard::ShapeList::scale | ( | double | s | ) | [virtual] |
Scale the shape along both axis.
| s | The scale factor along both axis. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Board, and LibBoard::Group.
References scale().
| ShapeList & 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.
Reimplemented in LibBoard::Board, and LibBoard::Group.
References _shapes, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by 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.
| Shape & LibBoard::ShapeList::top | ( | ) |
Convenience function that simply calls last(0).
| position |
| ShapeList & 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.
Reimplemented in LibBoard::Board, and LibBoard::Group.
References _shapes.
Referenced by scale().
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<<().
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(), operator+=(), operator<<(), LibBoard::Board::operator=(), rotate(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), scale(), scaleAll(), and translate().
1.6.3