Board  0.9.5
Public Member Functions | List of all members
LibBoard::Group Struct Reference

A group of shapes. A group is basically a ShapeList except that when rendered in either an SVG of a FIG file, it is a true compound element. More...

#include <Group.h>

Inheritance diagram for LibBoard::Group:
LibBoard::ShapeList LibBoard::Shape

Public Member Functions

 Group (const Group &other)
 
const std::string & name () const override
 
Grouprotate (double angle, const Point &center) override
 
Grouprotate (double angle) override
 
Group rotated (double angle, const Point &center)
 
Group rotated (double angle)
 
Grouptranslate (double dx, double dy) override
 
Group translated (double dx, double dy)
 
Groupscale (double sx, double sy) override
 
Groupscale (double s) override
 
Group scaled (double sx, double sy)
 
Group scaled (double s)
 
void setClippingRectangle (double x, double y, double width, double height)
 
void setClippingPath (const std::vector< Point > &points)
 
void setClippingPath (const Path &path)
 
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
 
Groupoperator= (const Group &other)
 
Groupclone () const override
 
Rect boundingBox (LineWidthFlag) const override
 
Groupaccept (CompositeShapeTransform &transform) const override
 Accept a composite shape transform. More...
 
Groupaccept (const CompositeShapeTransform &transform) const override
 Accept a constant composite shape transform. More...
 
void accept (ShapeVisitor &visitor) override
 Accepts a visitor object. More...
 
void accept (const ShapeVisitor &visitor) override
 Accepts a visitor object. More...
 
void accept (ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object. More...
 
void accept (const ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object. More...
 
Shapeaccept (CompositeShapeTransform &transform) const override
 Accept a composite shape transform. More...
 
Shapeaccept (const CompositeShapeTransform &transform) const override
 Accept a constant composite shape transform. More...
 
- Public Member Functions inherited from LibBoard::ShapeList
 ShapeList (const ShapeList &other)
 
ShapeListoperator= (const ShapeList &other)
 
 ShapeList (ShapeList &&other)
 
ShapeListoperator= (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)
 
const std::string & name () const override
 
ShapeListclear ()
 
ShapeListrotate (double angle, const Point &center) override
 
ShapeList rotated (double angle, const Point &center)
 
ShapeListrotate (double angle) override
 
ShapeList rotated (double angle)
 
ShapeListtranslate (double dx, double dy) override
 
ShapeList translated (double dx, double dy)
 
ShapeListscale (double sx, double sy) override
 
ShapeListscale (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
 
ShapeListclone () const override
 
ShapeListpush_back (Shape *shape)
 
ShapeListoperator<< (const Shape &shape)
 
ShapeListoperator+= (const Shape &shape)
 
ShapeListappend (const Shape &shape, Direction direction=ShapeList::Right, Alignment alignment=ShapeList::AlignCenter, double margin=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
 
GroupaddTiling (const Shape &shape, Point topLeftCorner, std::size_t columns, std::size_t rows, double spacing=0.0, LineWidthFlag lineWidthFlag=UseLineWidth)
 
void repeat (const Shape &shape, unsigned int times, double dx, double dy, double scaleX=1.0, double scaleY=1.0, double angle=0.0)
 
ShapeListdup (std::size_t copies=1)
 
template<typename T >
T & last (const std::size_t position=0)
 
Shapelast (const std::size_t position=0)
 
template<typename T >
T & topLevelFindLast (std::size_t position=0)
 
Shapetop ()
 
void accept (ShapeVisitor &visitor) override
 Accepts a visitor object. More...
 
void accept (const ShapeVisitor &visitor) override
 Accepts a visitor object. More...
 
void accept (ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object. More...
 
void accept (const ConstShapeVisitor &visitor) const override
 Accepts a const-shape visitor object. More...
 
Shapeaccept (CompositeShapeTransform &transform) const override
 Accept a composite shape transform. More...
 
Shapeaccept (const CompositeShapeTransform &transform) const override
 Accept a constant composite shape transform. More...
 
TopLevelIterator begin ()
 begin More...
 
TopLevelIterator end ()
 end More...
 
TopLevelConstIterator begin () const
 begin More...
 
TopLevelConstIterator cbegin () const
 cbegin More...
 
TopLevelConstIterator end () const
 end More...
 
TopLevelConstIterator cend () const
 cend More...
 
DepthFirstIterator depthFirstBegin ()
 depthFirstBegin More...
 
DepthFirstIterator depthFirstEnd ()
 depthFirstEnd More...
 
BreadthFirstIterator breadthFirstBegin ()
 breadthFirstBegin More...
 
BreadthFirstIterator breadthFirstEnd ()
 breadthFirstEnd More...
 
std::size_t deepSize () const
 Recursively counts the number of shapes in the list. More...
 
std::size_t size () const
 The number of shapes in the list (at top level). More...
 
- Public Member Functions inherited from LibBoard::Shape
 Shape ()
 
virtual ~Shape ()
 
virtual Point center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const
 
ShaperotateDeg (double angle, const Point &center)
 
ShaperotateDeg (double angle)
 
ShapemoveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
 
ShapemoveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth)
 
Shaperesize (double width, double height, LineWidthFlag lineWidthFlag)
 
ShapescaleToWidth (double w, LineWidthFlag lineWidthFlag)
 
ShapescaleToHeight (double h, LineWidthFlag lineWidthFlag)
 
Rect bbox (LineWidthFlag) const
 
 Shape (const Shape &other)
 

Additional Inherited Members

- Public Types inherited from LibBoard::ShapeList
enum  Direction { Top, Right, Bottom, Left }
 
enum  Alignment {
  AlignTop, AlignBottom, AlignCenter, AlignLeft,
  AlignRight
}
 
typedef std::vector< Shape * >::size_type size_type
 
- Protected Member Functions inherited from LibBoard::ShapeList
void addShape (const Shape &shape, double scaleFactor)
 
void deleteShapes ()
 
- Protected Attributes inherited from LibBoard::ShapeList
std::vector< Shape * > _shapes
 

Detailed Description

A group of shapes. A group is basically a ShapeList except that when rendered in either an SVG of a FIG file, it is a true compound element.

The Group structure.

Examples
examples/clipping.cpp, examples/ellipse.cpp, examples/example4.cpp, examples/images.cpp, examples/scale_ellipse.cpp, examples/tilings.cpp, and examples/traversal.cpp.

Member Function Documentation

◆ accept() [1/8]

Shape * LibBoard::ShapeList::accept
override

Accept a composite shape transform.

Parameters
transformA composite shape transform object.

◆ accept() [2/8]

Group * LibBoard::Group::accept ( CompositeShapeTransform transform) const
overridevirtual

Accept a composite shape transform.

Parameters
transformA composite shape transform object.

Reimplemented from LibBoard::Shape.

References LibBoard::ShapeList::_shapes, LibBoard::Shape::accept(), LibBoard::ShapeList::end(), and LibBoard::ShapeList::push_back().

◆ accept() [3/8]

Shape * LibBoard::ShapeList::accept
override

Accept a constant composite shape transform.

Parameters
transformA constant composite shape transform object..

◆ accept() [4/8]

Group * LibBoard::Group::accept ( const CompositeShapeTransform transform) const
overridevirtual

Accept a constant composite shape transform.

Parameters
transformA constant composite shape transform object..

Reimplemented from LibBoard::Shape.

References LibBoard::ShapeList::_shapes, LibBoard::Shape::accept(), LibBoard::ShapeList::end(), and LibBoard::ShapeList::push_back().

◆ accept() [5/8]

void LibBoard::ShapeList::accept
override

Accepts a const-shape visitor object.

Parameters
visitorA const-shape visitor object.

◆ accept() [6/8]

void LibBoard::ShapeList::accept
override

Accepts a visitor object.

Parameters
visitorA visitor object.

◆ accept() [7/8]

void LibBoard::ShapeList::accept
override

Accepts a const-shape visitor object.

Parameters
visitorA const-shape visitor object.

◆ accept() [8/8]

void LibBoard::ShapeList::accept
override

Accepts a visitor object.

Parameters
visitorA visitor object.

◆ boundingBox()

Rect LibBoard::Group::boundingBox ( LineWidthFlag  ) const
overridevirtual

Compute the bounding box of the figure.

Returns
The rectangle of the bounding box.

Implements LibBoard::Shape.

Examples
examples/images.cpp.

References LibBoard::ShapeList::boundingBox(), and LibBoard::Path::boundingBox().

Referenced by flushFIG().

◆ clone()

Group * LibBoard::Group::clone ( ) const
overridevirtual

Return a copy of the shape.

Returns
A copy of the shape.

Implements LibBoard::Shape.

◆ flushFIG()

void LibBoard::Group::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< Color, int > &  colormap 
) const
overridevirtual

Write the FIG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.
colormap

Implements LibBoard::Shape.

References LibBoard::Shape::bbox(), and boundingBox().

◆ flushPostscript()

void LibBoard::Group::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const
overridevirtual

Write the EPS code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::ShapeList::flushPostscript().

◆ flushSVG()

void LibBoard::Group::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const
overridevirtual

Write the SVG code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::ShapeList::flushSVG().

◆ flushTikZ()

void LibBoard::Group::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
overridevirtual

Write the TikZ code of the shape in a stream according to a transform.

Parameters
streamThe output stream.
transformA 2D transform to be applied.

Implements LibBoard::Shape.

References LibBoard::ShapeList::flushTikZ().

◆ name()

const std::string & LibBoard::Group::name ( ) const
overridevirtual

Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)

Returns

Reimplemented from LibBoard::Shape.

◆ rotate() [1/2]

Group & LibBoard::Group::rotate ( double  angle)
overridevirtual

Rotate the shape around its center.

Parameters
angleThe rotation angle in radian.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

References LibBoard::Shape::center(), LibBoard::ShapeList::rotate(), and LibBoard::Path::rotate().

◆ rotate() [2/2]

Group & LibBoard::Group::rotate ( double  angle,
const Point center 
)
overridevirtual

Rotate the shape around a given center of rotation.

Parameters
angleThe rotation angle in radian.
centerThe center of rotation.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Examples
examples/ellipse.cpp.

References LibBoard::Shape::center(), LibBoard::ShapeList::rotate(), and LibBoard::Path::rotate().

◆ scale() [1/2]

Group & LibBoard::Group::scale ( double  s)
overridevirtual

Scale the shape along both axis.

Parameters
sThe scaling factor along both axis.
Returns
The shape itself.

Implements LibBoard::Shape.

References LibBoard::Path::center(), LibBoard::Shape::center(), LibBoard::ShapeList::scale(), LibBoard::Path::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.

◆ scale() [2/2]

Group & LibBoard::Group::scale ( double  sx,
double  sy 
)
overridevirtual

Scale the shape along the x an y axis.

Parameters
sxThe scaling factor along the x axis.
syThe scaling factor along the y axis.
Returns
The shape itself.

Implements LibBoard::Shape.

Examples
examples/ellipse.cpp.

References LibBoard::Path::center(), LibBoard::Shape::center(), LibBoard::ShapeList::scale(), LibBoard::Path::scale(), LibBoard::Path::translate(), LibBoard::Point::x, and LibBoard::Point::y.

◆ setClippingPath() [1/2]

void LibBoard::Group::setClippingPath ( const Path path)

Define a clipping path for the group.

Parameters
pathA path.

References LibBoard::Path::pop_back().

◆ setClippingPath() [2/2]

void LibBoard::Group::setClippingPath ( const std::vector< Point > &  points)

Define a clipping path for the group.

Parameters
pointsA path.
Examples
examples/clipping.cpp.

References LibBoard::ShapeList::end().

◆ setClippingRectangle()

void LibBoard::Group::setClippingRectangle ( double  x,
double  y,
double  width,
double  height 
)

Define a clipping rectangle for the group.

Parameters
x
y
width
height

◆ translate()

Group & LibBoard::Group::translate ( double  dx,
double  dy 
)
overridevirtual

Translate the shape by a given offset.

Parameters
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Implements LibBoard::Shape.

Examples
examples/ellipse.cpp, and examples/example4.cpp.

References LibBoard::ShapeList::translate(), and LibBoard::Path::translate().


The documentation for this struct was generated from the following files: