|
Board 0.9.6
|
A group of shapes. More...
#include <ShapeList.h>
Classes | |
| struct | BreadthFirstIterator |
| The BreadthFirstIterator struct allows to traverse the shape tree using a breadth-first strategy. More... | |
| struct | DepthFirstIterator |
| The DepthFirstIterator struct allows to traverse the shape tree using a depth-first strategy. More... | |
| struct | TopLevelConstIterator |
| The TopLevelConstIterator struct. More... | |
| struct | TopLevelIterator |
| The TopLevelIterator struct. More... | |
Public Types | |
| typedef std::vector< Shape * >::size_type | size_type |
Public Member Functions | |
| ShapeList () | |
| ShapeList (const ShapeList &other) | |
| ShapeList & | operator= (const ShapeList &other) |
| ShapeList (ShapeList &&other) | |
| ShapeList & | operator= (ShapeList &&other) |
| ShapeList (const Shape &shape, unsigned int times, double dx, double dy, double scale) | |
| ShapeList (const Shape &shape, unsigned int times, double dx, double dy, double scaleX, double scaleY, double angle) | |
| template<typename S > | |
| ShapeList (const std::vector< S > &shapes) | |
| ~ShapeList () override | |
| const std::string & | name () const override |
| ShapeList & | clear () |
| ShapeList & | rotate (double angle, const Point ¢er) override |
| ShapeList | rotated (double angle, const Point ¢er) |
| ShapeList & | rotate (double angle) override |
| ShapeList | rotated (double angle) |
| ShapeList & | translate (double dx, double dy) override |
| ShapeList | translated (double dx, double dy) |
| ShapeList & | scale (double sx, double sy) override |
| ShapeList & | scale (double s) override |
| ShapeList | scaled (double sx, double sy) const |
| ShapeList | scaled (double s) const |
| void | scaleAll (double s) override |
| void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const override |
| void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override |
| void | flushSVG (std::ostream &stream, const TransformSVG &transform) const override |
| void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const override |
| Rect | boundingBox (LineWidthFlag) const override |
| ShapeList * | clone () const override |
| ShapeList & | push_back (Shape *shape) |
| ShapeList & | operator<< (const Shape &shape) |
| template<typename S > | |
| ShapeList & | operator<< (const std::vector< S > &shapes) |
| ShapeList & | operator+= (const Shape &shape) |
| ShapeList & | append (const Shape &shape, Direction direction=Direction::Right, Alignment alignment=Alignment::Center, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth) |
| void | addRepeated (const Shape &shape, unsigned int times, double dx, double dy, double scaleX=1.0, double scaleY=1.0, double angle=0.0) |
| ShapeList & | duplicateLast (std::size_t copies=1) |
| template<typename T > | |
| T & | last (const std::size_t position=0) |
| Shape & | last (const std::size_t position=0) |
| template<typename T > | |
| T & | topLevelFindLast (std::size_t position=0) |
| Shape & | top () |
| void | accept (ShapeVisitor &visitor) override |
| Accepts a visitor object. | |
| void | accept (const ShapeVisitor &visitor) override |
| Accepts a visitor object. | |
| void | accept (ConstShapeVisitor &visitor) const override |
| Accepts a const-shape visitor object. | |
| void | accept (const ConstShapeVisitor &visitor) const override |
| Accepts a const-shape visitor object. | |
| Shape * | accept (CompositeShapeTransform &transform) const override |
| Accept a composite shape transform. | |
| Shape * | accept (const CompositeShapeTransform &transform) const override |
| Accept a constant composite shape transform. | |
| TopLevelIterator | begin () |
| begin | |
| TopLevelIterator | end () |
| end | |
| TopLevelConstIterator | begin () const |
| begin | |
| TopLevelConstIterator | cbegin () const |
| cbegin | |
| TopLevelConstIterator | end () const |
| end | |
| TopLevelConstIterator | cend () const |
| cend | |
| DepthFirstIterator | depthFirstBegin () |
| depthFirstBegin | |
| DepthFirstIterator | depthFirstEnd () |
| depthFirstEnd | |
| BreadthFirstIterator | breadthFirstBegin () |
| breadthFirstBegin | |
| BreadthFirstIterator | breadthFirstEnd () |
| breadthFirstEnd | |
| std::size_t | deepSize () const |
| Recursively counts the number of shapes in the list. | |
| std::size_t | size () const |
| The number of shapes in the list (at top level). | |
Public Member Functions inherited from LibBoard::Shape | |
| Shape () | |
| virtual | ~Shape () |
| virtual const std::string & | name () const |
| virtual Shape * | clone () const =0 |
| virtual Point | center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const |
| virtual Shape & | rotate (double angle, const Point ¢er)=0 |
| virtual Shape & | rotate (double angle)=0 |
| Shape & | rotateDeg (double angle, const Point ¢er) |
| Shape & | rotateDeg (double angle) |
| virtual Shape & | translate (double dx, double dy)=0 |
| Shape & | moveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
| Shape & | moveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
| virtual Shape & | scale (double sx, double sy)=0 |
| virtual Shape & | scale (double s)=0 |
| Shape & | resize (double width, double height, LineWidthFlag lineWidthFlag) |
| Shape & | scaleToWidth (double w, LineWidthFlag lineWidthFlag) |
| Shape & | scaleToHeight (double h, LineWidthFlag lineWidthFlag) |
| virtual Rect | boundingBox (LineWidthFlag) const =0 |
| Rect | bbox (LineWidthFlag) const |
| virtual void | scaleAll (double s)=0 |
| virtual void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0 |
| virtual void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const =0 |
| virtual void | flushSVG (std::ostream &stream, const TransformSVG &transform) const =0 |
| virtual void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0 |
| virtual void | accept (ShapeVisitor &visitor) |
| Accepts a visitor object. | |
| virtual void | accept (const ShapeVisitor &visitor) |
| Accepts a visitor object. | |
| virtual void | accept (ConstShapeVisitor &visitor) const |
| Accepts a const-shape visitor object. | |
| virtual void | accept (const ConstShapeVisitor &visitor) const |
| Accepts a const-shape visitor object. | |
| virtual Shape * | accept (CompositeShapeTransform &transform) const |
| Accept a composite shape transform. | |
| virtual Shape * | accept (const CompositeShapeTransform &transform) const |
| Accept a constant composite shape transform. | |
| Shape (const Shape &other) | |
Protected Member Functions | |
| void | addShape (const Shape &shape, double scaleFactor) |
| void | deleteShapes () |
Protected Attributes | |
| std::vector< Shape * > | _shapes |
A group of shapes.
The ShapeList structure.
| typedef std::vector<Shape*>::size_type LibBoard::ShapeList::size_type |
|
inline |
| LibBoard::ShapeList::ShapeList | ( | const Shape & | shape, |
| unsigned int | times, | ||
| double | dx, | ||
| double | dy, | ||
| double | scale | ||
| ) |
Create a ShapeList by repeating a shape (translation & scaling)
| shape | The shape to be repeated. |
| times | The number of repetitions. |
| dx | The x shift between two repetitions. |
| dy | The y shift between two repetitions. |
| scale | The scaling factor between two repetitions. |
References LibBoard::Shape::clone(), scale(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
| LibBoard::ShapeList::ShapeList | ( | const Shape & | shape, |
| unsigned int | times, | ||
| double | dx, | ||
| double | dy, | ||
| double | scaleX, | ||
| double | scaleY, | ||
| double | angle | ||
| ) |
Create a ShapeList by repeating a shape (translation, scaling & rotation)
| shape | The shape to be repeated. |
| times | The number of repetitions. |
| dx | The x shift between two repetitions. |
| dy | The y shift between two repetitions. |
| scaleX | The x scaling factor between two repetitions. |
| scaleY | The y scaling factor between two repetitions. |
| angle | The rotation angle between two repetitions. |
References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
| LibBoard::ShapeList::ShapeList | ( | const std::vector< S > & | shapes | ) |
Construct a ShapeList from a vector of shapes
| shapes | A vector of shapes |
|
override |
References deleteShapes().
|
overridevirtual |
Accept a composite shape transform.
| transform | A composite shape transform object. |
Reimplemented from LibBoard::Shape.
References _shapes, push_back(), and ShapeList().
|
overridevirtual |
Accept a constant composite shape transform.
| transform | A constant composite shape transform object.. |
Reimplemented from LibBoard::Shape.
References _shapes, push_back(), and ShapeList().
|
overridevirtual |
Accepts a const-shape visitor object.
| visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References _shapes, LibBoard::Shape::accept(), and end().
|
overridevirtual |
|
overridevirtual |
Accepts a const-shape visitor object.
| visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References _shapes, LibBoard::Shape::accept(), and end().
|
overridevirtual |
Accepts a visitor object.
| visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References _shapes, accept(), and end().
Referenced by accept(), accept(), deepSize(), and LibBoard::Board::saveFIG().
| void LibBoard::ShapeList::addRepeated | ( | const Shape & | shape, |
| unsigned int | times, | ||
| double | dx, | ||
| double | dy, | ||
| double | scaleX = 1.0, |
||
| double | scaleY = 1.0, |
||
| double | angle = 0.0 |
||
| ) |
Add a repeated shape (with translation, scaling & rotation)
| shape | The shape to be repeated. |
| times | The number of repetitions. |
| dx | The x shift between two repetitions. |
| dy | The y shift between two repetitions. |
| scaleX | The x scaling factor between two repetitions. |
| scaleY | The y scaling factor between two repetitions. |
| angle | The rotation angle between two repetitions. |
References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().
|
protected |
References _shapes, LibBoard::Shape::clone(), and LibBoard::Shape::scaleAll().
Referenced by LibBoard::Board::operator<<().
| ShapeList & LibBoard::ShapeList::append | ( | const Shape & | shape, |
| Direction | direction = Direction::Right, |
||
| Alignment | alignment = Alignment::Center, |
||
| double | margin = 0.0, |
||
| LineWidthFlag | lineWidthFlag = UseLineWidth |
||
| ) |
Append a shape beside the shapelist.
| shape | A shape. |
| direction | The direction where the shape should be appended. |
| alignment | The alignement with the current shapelist. |
| margin | A margin between the shapelist and the shape. |
| lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References _shapes, LibBoard::Bottom, LibBoard::Rect::bottom(), LibBoard::Shape::boundingBox(), boundingBox(), LibBoard::Center, LibBoard::Rect::center(), LibBoard::Shape::clone(), LibBoard::Tools::error, LibBoard::Rect::height, LibBoard::Left, LibBoard::Rect::left, LibBoard::Shape::moveCenter(), LibBoard::Right, LibBoard::Rect::right(), LibBoard::Top, LibBoard::Rect::top, LibBoard::Rect::width, LibBoard::Point::x, and LibBoard::Point::y.
Referenced by ell(), findAll(), generateGroup(), hachures(), LeaveBox(), main(), polygons(), rough(), and text().
|
inline |
begin
References _shapes.
Referenced by LibBoard::ShapeList::BreadthFirstIterator::BreadthFirstIterator(), and LibBoard::ShapeList::DepthFirstIterator::DepthFirstIterator().
|
inline |
|
overridevirtual |
Compute the bounding box of the figure.
Implements LibBoard::Shape.
References _shapes, and end().
Referenced by append(), LibBoard::boardFontText(), LibBoard::Group::boundingBox(), LibBoard::Board::drawBoundingBox(), main(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), and LibBoard::Board::saveTikZ().
|
inline |
breadthFirstBegin
Referenced by main().
|
inline |
breadthFirstEnd
Referenced by main().
|
inline |
|
inline |
| ShapeList & LibBoard::ShapeList::clear | ( | ) |
Remove all shapes from the list.
References _shapes, and deleteShapes().
Referenced by LibBoard::Board::clear(), LibBoard::Board::clear(), main(), and merge().
|
overridevirtual |
Return a copy of the shape.
Implements LibBoard::Shape.
References ShapeList().
Referenced by LibBoard::Board::fillRectangle().
| std::size_t LibBoard::ShapeList::deepSize | ( | ) | const |
Recursively counts the number of shapes in the list.
References accept(), and LibBoard::ShapeCounter::value().
Referenced by main().
|
protected |
Free the memory used by the shapes in the shape vector.
References _shapes.
Referenced by clear(), LibBoard::Board::operator=(), operator=(), operator=(), and ~ShapeList().
|
inline |
depthFirstBegin
Referenced by main().
|
inline |
depthFirstEnd
Referenced by main().
| ShapeList & LibBoard::ShapeList::duplicateLast | ( | std::size_t | copies = 1 | ) |
Duplicates the last inserted shape.
| copies | The number of copies. |
References _shapes, and LibBoard::Tools::warning.
|
inline |
end
References _shapes.
Referenced by LibBoard::Group::accept(), LibBoard::Group::accept(), accept(), accept(), accept(), accept(), boundingBox(), operator+=(), LibBoard::Board::operator=(), operator=(), rotate(), scale(), scaleAll(), LibBoard::Board::setClippingPath(), LibBoard::Group::setClippingPath(), ShapeList(), and translate().
|
inline |
|
overridevirtual |
Write 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 |
Implements LibBoard::Shape.
References _shapes.
Referenced by LibBoard::Group::flushFIG().
|
overridevirtual |
Write 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.
References _shapes.
Referenced by LibBoard::Group::flushPostscript().
|
overridevirtual |
Write 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.
References _shapes.
Referenced by LibBoard::Group::flushSVG().
|
overridevirtual |
Write 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.
References _shapes.
Referenced by LibBoard::Group::flushTikZ().
| T & LibBoard::ShapeList::last | ( | const std::size_t | position = 0 | ) |
Return the last inserted shape with its actual type.
| position | The position. 0 is the last inserted shape, 1 is the one before, etc. |
References _shapes, and LibBoard::Tools::error.
Referenced by main().
| Shape & LibBoard::ShapeList::last | ( | const std::size_t | position = 0 | ) |
Return a reference to the last inserted Shape.
| position | The position. 0 is the last inserted shape, 1 is the one before, etc. |
|
overridevirtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Referenced by main(), and topLevelFindLast().
Adds a shape to the list of shape, always preserving the shape's depth.
| shape |
References _shapes, LibBoard::Shape::clone(), and end().
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 |
References _shapes, and LibBoard::Shape::clone().
Referenced by LibBoard::Board::operator<<().
| ShapeList & LibBoard::ShapeList::operator<< | ( | const std::vector< S > & | shapes | ) |
Add of shapes from a vector to the shape list.
References _shapes, deleteShapes(), and end().
Referenced by LibBoard::Group::operator=().
References _shapes, and deleteShapes().
Add a shape to the list, taking ownership.
| shape | The shape to be inserted. |
References _shapes.
Referenced by LibBoard::Group::accept(), accept(), LibBoard::Group::accept(), accept(), julia(), main(), LibBoard::makeRough(), and text().
|
overridevirtual |
Rotate the shape list around its bounding box's center.
| angle | Rotation angle in radian |
Implements LibBoard::Shape.
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, and end().
Referenced by LibBoard::Group::accept(), LibBoard::Group::accept(), LibBoard::Board::rotate(), LibBoard::Group::rotate(), LibBoard::Board::rotate(), and LibBoard::Group::rotate().
| ShapeList LibBoard::ShapeList::rotated | ( | double | angle | ) |
Get a rotated copy of the shape list around its bounding box's center.
| angle | Rotation angle in radian |
References LibBoard::Shape::center(), and ShapeList().
Get a rotated copy of the shape list around a specified rotation center.
| angle | Rotation angle in radian |
| center | Center of rotation |
Referenced by main().
|
overridevirtual |
Scale the shape list.
| s | The scaling factor |
Implements LibBoard::Shape.
References scale().
|
overridevirtual |
Scale the shape list in X and Y directions.
| sx | x scaling factor |
| sy | y scaling factor |
Implements LibBoard::Shape.
References _shapes, LibBoard::Shape::center(), end(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by main(), LibBoard::Board::scale(), LibBoard::Group::scale(), scale(), LibBoard::Board::scale(), LibBoard::Group::scale(), and ShapeList().
|
overridevirtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
| s | The scaling factor. |
Implements LibBoard::Shape.
References _shapes, end(), and scaleAll().
Referenced by scaleAll().
| ShapeList LibBoard::ShapeList::scaled | ( | double | s | ) | const |
Get a scaled copy of the shape list.
| s | scaling factor |
References ShapeList().
| ShapeList LibBoard::ShapeList::scaled | ( | double | sx, |
| double | sy | ||
| ) | const |
Get a scaled copy of the shape list.
| sx | x scaling factor |
| sy | y scaling factor |
References ShapeList().
Referenced by LibBoard::boardFontText(), and main().
|
inline |
The number of shapes in the list (at top level).
References _shapes.
Referenced by main(), LibBoard::Board::pageRect(), LibBoard::Board::save(), LibBoard::Board::saveEPS(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Board::saveSVG(), LibBoard::Board::saveTikZ(), and LibBoard::Board::saveTikZ().
| Shape & LibBoard::ShapeList::top | ( | ) |
Convenience function that simply calls last(0).
Referenced by LibBoard::Board::drawRectangle(), and LibBoard::Board::fillRectangle().
| T & LibBoard::ShapeList::topLevelFindLast | ( | std::size_t | position = 0 | ) |
Find the n-th most recently inserted shape with type T.
References _shapes, and name().
Referenced by findAll().
|
overridevirtual |
Translate the shape list.
| dx | x shift value |
| dy | y shift value |
Implements LibBoard::Shape.
References _shapes, and end().
Referenced by LibBoard::boardFontText(), main(), scale(), LibBoard::Board::translate(), and LibBoard::Group::translate().
| ShapeList LibBoard::ShapeList::translated | ( | double | dx, |
| double | dy | ||
| ) |
Get a translated copy of the shape list.
| dx | x shift value |
| dy | y shift value |
Referenced by main().
|
protected |
The vector of shapes (back to front).
Referenced by LibBoard::Group::accept(), accept(), LibBoard::Group::accept(), accept(), accept(), accept(), accept(), accept(), addShape(), append(), begin(), begin(), boundingBox(), cbegin(), cend(), clear(), deleteShapes(), LibBoard::Board::drawArrow(), LibBoard::Board::drawArrow(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawCircle(), LibBoard::Board::drawClosedPolyline(), LibBoard::Board::drawDot(), LibBoard::Board::drawEllipse(), LibBoard::Board::drawLine(), LibBoard::Board::drawLine(), LibBoard::Board::drawPolyline(), LibBoard::Board::drawRectangle(), LibBoard::Board::drawRectangle(), LibBoard::Board::drawText(), LibBoard::Board::drawText(), LibBoard::Board::drawText(), LibBoard::Board::drawText(), LibBoard::Board::drawTriangle(), LibBoard::Board::drawTriangle(), duplicateLast(), end(), end(), LibBoard::Board::fillCircle(), LibBoard::Board::fillEllipse(), LibBoard::Board::fillGouraudTriangle(), LibBoard::Board::fillPolyline(), LibBoard::Board::fillRectangle(), LibBoard::Board::fillTriangle(), LibBoard::Board::fillTriangle(), flushFIG(), flushPostscript(), flushSVG(), flushTikZ(), last(), operator+=(), operator<<(), LibBoard::Board::operator=(), operator=(), operator=(), push_back(), rotate(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), LibBoard::Board::saveTikZ(), scale(), scaleAll(), ShapeList(), ShapeList(), size(), topLevelFindLast(), and translate().