# 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 <ShapeList.h>`

Inheritance diagram for LibBoard::Group:

List of all members.

## Public Member Functions

| Group (int depth=-1)
| Group (const Group &other)
const std::string & | name () const
Group & | rotate (double angle, const Point &center)
Group & | rotate (double angle)
Group | rotated (double angle, const Point &center)
Group | rotated (double angle)
Group & | translate (double dx, double dy)
Group | translated (double dx, double dy)
Group & | scale (double sx, double sy)
Group & | scale (double s)
Group | scaled (double sx, double sy)
Group | scaled (double s)
void | setClippingRectangle (float x, float y, float width, float height)
void | setClippingPath (const std::vector< Point > &points)
void | setClippingPath (const Path &path)
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
Group & | operator= (const Group &other)
Group * | clone () const
Rect | boundingBox () const

## 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/arrows.cpp, examples/clipping.cpp, examples/ellipse.cpp, examples/example4.cpp, and examples/koch.cpp.

## Member Function Documentation

Rect LibBoard::Group::boundingBox | ( |  | ) | const`[virtual]`

Returns the bounding box of the figure.

Returns:
  The rectangle of the bounding box.

Reimplemented from LibBoard::ShapeList.

References LibBoard::ShapeList::boundingBox().

Referenced by flushFIG().

Group * LibBoard::Group::clone | ( |  | ) | const`[virtual]`

Return a copy of the shape.

Returns:

Reimplemented from LibBoard::ShapeList.

void LibBoard::Group::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.

Parameters:

  | stream | The output stream.
  | transform | A 2D transform to be applied.

Reimplemented from LibBoard::ShapeList.

References LibBoard::Shape::bbox(), boundingBox(), LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Rect::top, and LibBoard::Rect::width.

void LibBoard::Group::flushPostscript | ( | std::ostream & | stream,
|  | const TransformEPS & | transform |
| ) |  |  | const`[virtual]`

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

Parameters:

  | stream | The output stream.
  | transform | A 2D transform to be applied.

Reimplemented from LibBoard::ShapeList.

void LibBoard::Group::flushSVG | ( | std::ostream & | stream,
|  | const TransformSVG & | transform |
| ) |  |  | const`[virtual]`

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

Parameters:

  | stream | The output stream.
  | transform | A 2D transform to be applied.

Reimplemented from LibBoard::ShapeList.

const std::string & LibBoard::Group::name | ( |  | ) | const`[virtual]`

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

Returns:

Reimplemented from LibBoard::ShapeList.

Group & LibBoard::Group::rotate | ( | double | angle | ) | `[virtual]`

Rotate the shape around its center.

Parameters:

  | angle | The rotation angle in radian.

Returns:
  A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

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

Group & LibBoard::Group::rotate | ( | double | angle,
|  | const Point & | center |
| ) |  |  | `[virtual]`

Rotate the shape around a given center of rotation.

Parameters:

  | angle | The rotation angle in radian.
  | center | The center of rotation.

Returns:
  A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

Examples:
  examples/ellipse.cpp.

References LibBoard::Path::rotate().

Referenced by rotate().

Group & LibBoard::Group::scale | ( | double | s | ) | `[virtual]`

Scale the shape along both axis.

Parameters:

  | s | The scale factor along both axis.

Returns:
  The shape itself.

Reimplemented from LibBoard::ShapeList.

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

Group & LibBoard::Group::scale | ( | double | sx,
|  | double | sy |
| ) |  |  | `[virtual]`

Scale the shape along the x an y axis.

Parameters:

  | sx | The scale factor along the x axis.
  | sy | The scale factor along the y axis.

Returns:
  The shape itself.

Reimplemented from LibBoard::ShapeList.

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

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

Referenced by scale().

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

Define a clipping path for the group.

Parameters:

  | points | A path.

References LibBoard::Path::pop_back().

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

Define a clipping path for the group.

Parameters:

  | points | A path.

Examples:
  examples/clipping.cpp.

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

Define a clipping rectangle for the group.

Parameters:

  | x |
  | y |
  | width |
  | height |

Group & LibBoard::Group::translate | ( | double | dx,
|  | double | dy |
| ) |  |  | `[virtual]`

Translate the shape by a given offset.

Parameters:

  | dx | The x offset.
  | dy | The y offset.

Returns:
  A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

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

References LibBoard::Path::translate().

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

- include/board/ShapeList.h
- src/ShapeList.cpp