Board  0.9.4
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 <ShapeList.h>

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

Public Member Functions

 Group (int depth=-1)
 
 Group (const Group &other)
 
const std::string & name () const
 
Grouprotate (double angle, const Point &center)
 
Grouprotate (double angle)
 
Group rotated (double angle, const Point &center)
 
Group rotated (double angle)
 
Grouptranslate (double dx, double dy)
 
Group translated (double dx, double dy)
 
Groupscale (double sx, double sy)
 
Groupscale (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
 
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
 
Groupoperator= (const Group &other)
 
Groupclone () const
 
Rect boundingBox (LineWidthFlag) const
 
- Public Member Functions inherited from LibBoard::ShapeList
 ShapeList (int depth=-1)
 
 ShapeList (const ShapeList &other)
 
ShapeListoperator= (const 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)
 
ShapeListclear ()
 
ShapeList rotated (double angle, const Point &center)
 
ShapeList rotated (double angle)
 
ShapeList translated (double dx, double dy)
 
ShapeList scaled (double sx, double sy)
 
ShapeList scaled (double s)
 
void scaleAll (double s)
 
virtual int minDepth () const
 
virtual int maxDepth () const
 
void shiftDepth (int shift)
 
ShapeListoperator<< (const Shape &shape)
 
ShapeListoperator+= (const Shape &shape)
 
ShapeListappend (const Shape &shape, Direction direction, Alignment alignment, 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)
 
ShapeListinsert (const Shape &shape, int depth)
 
ShapeListdup (std::size_t copies=1)
 
template<typename T >
T & last (const std::size_t position=0)
 
Shapelast (const std::size_t position=0)
 
Shapetop ()
 
virtual void accept (ShapeVisitor &visitor)
 Accepts a visitor object. More...
 
virtual void accept (const ShapeVisitor &visitor)
 Accepts a visitor object. More...
 
- Public Member Functions inherited from LibBoard::Shape
 Shape (Color penColor, Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
 
virtual ~Shape ()
 
bool filled () const
 
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)
 
ShapescaleToWidth (double w, LineWidthFlag lineWidthFlag)
 
ShapescaleToHeight (double h, LineWidthFlag lineWidthFlag)
 
Rect bbox (LineWidthFlag) const
 
Shapeoperator-- ()
 
Shapeoperator++ ()
 
int depth () const
 
virtual void depth (int)
 
const ColorpenColor () const
 
const ColorfillColor () const
 

Additional Inherited Members

- Public Types inherited from LibBoard::ShapeList
enum  Direction { Top, Right, Bottom, Left }
 
enum  Alignment {
  AlignTop, AlignBottom, AlignCenter, AlignLeft,
  AlignRight
}
 
- Public Types inherited from LibBoard::Shape
enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
 
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }
 
enum  LineStyle {
  SolidStyle = 0, DashStyle, DotStyle, DashDotStyle,
  DashDotDotStyle, DashDotDotDotStyle
}
 
enum  LineWidthFlag { IgnoreLineWidth, UseLineWidth }
 
- Static Public Member Functions inherited from LibBoard::Shape
static void enableLineWidthScaling ()
 
static void disableLineWidthScaling ()
 
static void setLineWidthScaling (bool)
 
static void setDefaultLineWidth (double)
 
static void setDefaultPenColor (Color)
 
static void setDefaultFillColor (Color)
 
static void setDefaultLineStyle (Shape::LineStyle)
 
static void setDefaultLineCap (Shape::LineCap)
 
static void setDefaultLineJoin (Shape::LineJoin)
 
static double defaultLineWidth ()
 defaultLineWidth More...
 
static Color defaultPenColor ()
 defaultPenColor More...
 
static Color defaultFillColor ()
 defaultFillColor More...
 
static Shape::LineStyle defaultLineStyle ()
 defaultLineStyle More...
 
static Shape::LineCap defaultLineCap ()
 defaultLineCap More...
 
static Shape::LineJoin defaultLineJoin ()
 defaultLineJoin More...
 
- Protected Member Functions inherited from LibBoard::ShapeList
void addShape (const Shape &shape, double scaleFactor)
 
void free ()
 
- Protected Member Functions inherited from LibBoard::Shape
void updateLineWidth (double s)
 
std::string svgProperties (const TransformSVG &transform) const
 
std::string postscriptProperties (const TransformEPS &transform) const
 
std::string tikzProperties (const TransformTikZ &transform) const
 
- Protected Attributes inherited from LibBoard::ShapeList
std::vector< Shape * > _shapes
 
int _nextDepth
 
- Protected Attributes inherited from LibBoard::Shape
int _depth
 
Color _penColor
 
Color _fillColor
 
double _lineWidth
 
LineStyle _lineStyle
 
LineCap _lineCap
 
LineJoin _lineJoin
 
- Static Protected Attributes inherited from LibBoard::Shape
static bool _lineWidthScaling = true
 
static double _defaultLineWidth = 1.0
 
static Color _defaultPenColor = Color::Black
 
static Color _defaultFillColor = Color::Null
 
static Shape::LineStyle _defaultLineStyle = Shape::SolidStyle
 
static Shape::LineCap _defaultLineCap = Shape::ButtCap
 
static Shape::LineJoin _defaultLineJoin = Shape::MiterJoin
 

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/scale_ellipse.cpp, and examples/tilings.cpp.

Member Function Documentation

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

Compute the bounding box of the figure.

Returns
The rectangle of the bounding box.

Reimplemented from LibBoard::ShapeList.

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

Referenced by flushFIG().

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

Return a copy of the shape.

Returns
A copy of the shape.

Reimplemented from LibBoard::ShapeList.

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

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

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

Reimplemented from LibBoard::ShapeList.

References LibBoard::Shape::bbox(), boundingBox(), LibBoard::ShapeList::flushFIG(), 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

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

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

Reimplemented from LibBoard::ShapeList.

References LibBoard::ShapeList::flushPostscript().

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

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

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

Reimplemented from LibBoard::ShapeList.

References LibBoard::ShapeList::flushSVG().

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

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

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

Reimplemented from LibBoard::ShapeList.

References LibBoard::ShapeList::flushTikZ().

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,
const Point center 
)
virtual

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.

Reimplemented from LibBoard::ShapeList.

Examples:
examples/ellipse.cpp.

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

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

Rotate the shape around its center.

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

Reimplemented from LibBoard::ShapeList.

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

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

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.

Reimplemented from LibBoard::ShapeList.

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.

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

Scale the shape along both axis.

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

Reimplemented from LibBoard::ShapeList.

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

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

Define a clipping path for the group.

Parameters
pointsA path.
Examples:
examples/clipping.cpp.
void LibBoard::Group::setClippingPath ( const Path path)

Define a clipping path for the group.

Parameters
pointsA path.

References LibBoard::Path::pop_back().

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
dxThe x offset.
dyThe y offset.
Returns
A reference to the shape itself.

Reimplemented from LibBoard::ShapeList.

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: