Board  0.6.devel
 All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Macros
LibBoard::ShapeList Struct Reference

#include <ShapeList.h>

Inheritance diagram for LibBoard::ShapeList:
Collaboration diagram for LibBoard::ShapeList:

Public Member Functions

 ShapeList (int depth=-1)
 ShapeList (const ShapeList &other)
 ~ShapeList ()
const std::string & name () const
ShapeListclear ()
Point center () const
Shaperotate (double angle, const Point &center)
ShapeList rotated (double angle, const Point &center)
Shaperotate (double angle)
ShapeList rotated (double angle)
Shapetranslate (double dx, double dy)
ShapeList translated (double dx, double dy)
Shapescale (double sx, double sy)
Shapescale (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< DGtal::Color, int > &colormap) const
void flushSVG (std::ostream &stream, const TransformSVG &transform) const
void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const
Rect boundingBox () const
virtual int minDepth () const
virtual int maxDepth () const
void shiftDepth (int shift)
Shapeclone () const
ShapeListoperator= (const ShapeList &other)
ShapeListoperator<< (const Shape &shape)
ShapeListoperator+= (const Shape &shape)
ShapeListinsert (const Shape &shape, int depth)
ShapeListdup (unsigned int copies=1)
template<typename T >
T & last (const unsigned int position=0)
Shapelast (const unsigned int position=0)
Shapetop ()
- Public Member Functions inherited from LibBoard::Shape
 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
virtual ~Shape ()
bool filled () const
ShaperotateDeg (double angle, const Point &center)
ShaperotateDeg (double angle)
Rect bbox ()
Shapeoperator-- ()
Shapeoperator++ ()
int depth () const
virtual void depth (int)
const DGtal::Color & penColor () const
const DGtal::Color & fillColor () const

Protected Member Functions

void addShape (const Shape &shape, double scaleFactor)
void free ()
- Protected Member Functions inherited from LibBoard::Shape
std::string svgProperties (const TransformSVG &transform) const
std::string postscriptProperties () const
std::string tikzProperties (const TransformTikZ &transform) const

Protected Attributes

std::vector< Shape * > _shapes
int _nextDepth
- Protected Attributes inherited from LibBoard::Shape
int _depth
DGtal::Color _penColor
DGtal::Color _fillColor
double _lineWidth
LineStyle _lineStyle
LineCap _lineCap
LineJoin _lineJoin

Static Private Attributes

static const std::string _name

Additional Inherited Members

- 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
}

Detailed Description

A group of shapes.

The ShapeList structure.


Constructor & Destructor Documentation

LibBoard::ShapeList::ShapeList ( int  depth = -1)
inline

Referenced by clone(), rotated(), scaled(), and translated().

LibBoard::ShapeList::ShapeList ( const ShapeList other)

References _shapes.

LibBoard::ShapeList::~ShapeList ( )

References free().


Member Function Documentation

void LibBoard::ShapeList::addShape ( const Shape shape,
double  scaleFactor 
)
protected
Rect LibBoard::ShapeList::boundingBox ( ) const
virtual

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group.

References _shapes.

Referenced by LibBoard::Group::boundingBox(), LibBoard::Board::drawBoundingBox(), LibBoard::Board::saveEPS(), LibBoard::Board::saveFIG(), LibBoard::Board::saveSVG(), and LibBoard::Board::saveTikZ().

Point LibBoard::ShapeList::center ( ) const
virtual

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implements LibBoard::Shape.

References _shapes.

Referenced by rotate(), LibBoard::Board::rotate(), LibBoard::Group::rotate(), rotated(), scale(), LibBoard::Board::scale(), and LibBoard::Group::scale().

ShapeList & LibBoard::ShapeList::clear ( )

References _nextDepth, _shapes, and free().

Referenced by LibBoard::Board::clear().

Shape * LibBoard::ShapeList::clone ( ) const
virtual

Return a copy of the shape.

Returns:

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group.

References ShapeList().

ShapeList & LibBoard::ShapeList::dup ( unsigned int  copies = 1)

Duplicates the last inserted shape.

Parameters:
copiesThe number of copies.

References _shapes, and LibBoard::warning.

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

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

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

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group.

References _shapes, and LibBoard::shapeGreaterDepth().

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.

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

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group.

References _shapes, and LibBoard::shapeGreaterDepth().

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.

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

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group.

References _shapes, and LibBoard::shapeGreaterDepth().

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

Writes 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.

Reimplemented in LibBoard::Group.

References _shapes, and LibBoard::shapeGreaterDepth().

void LibBoard::ShapeList::free ( )
protected

Free the memory used by the shapes in the shape vector.

References _shapes.

Referenced by clear(), LibBoard::Board::operator=(), operator=(), and ~ShapeList().

ShapeList & LibBoard::ShapeList::insert ( const Shape shape,
int  depth 
)

Insert the shape at a given depth. If the shape is ShapeList or a Board, then all shapes above it will be shifted.

Parameters:
shape
depth
Returns:

References LibBoard::warning.

template<typename T >
T & LibBoard::ShapeList::last ( const unsigned int  position = 0)

Return the last inserted shape with its actual type, if specified (otherwise, a Shape &).

Parameters:
positionThe position. 0 is the last inserted shape, 1 is the one before, etc.
Returns:
A reference to the addressed shape.
Shape& LibBoard::ShapeList::last ( const unsigned int  position = 0)
int LibBoard::ShapeList::maxDepth ( ) const
virtual
int LibBoard::ShapeList::minDepth ( ) const
virtual
const std::string & LibBoard::ShapeList::name ( ) const
virtual

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

Returns:

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::Group.

References _name.

ShapeList & LibBoard::ShapeList::operator+= ( const Shape shape)

Adds a shape to the list of shape, always preserving the shape's depth.

Parameters:
shape
Returns:

References _shapes, and LibBoard::Shape::clone().

ShapeList & LibBoard::ShapeList::operator<< ( const Shape shape)

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.

Parameters:
shape
Returns:

Reimplemented in LibBoard::Board.

References _nextDepth, _shapes, LibBoard::Shape::clone(), LibBoard::Shape::depth(), minDepth(), and LibBoard::shapeGreaterDepth().

ShapeList & LibBoard::ShapeList::operator= ( const ShapeList other)

References _shapes, and free().

Shape & LibBoard::ShapeList::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.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group, and LibBoard::Board.

References _shapes.

Referenced by rotate(), and rotated().

Shape & LibBoard::ShapeList::rotate ( double  angle)
virtual

Rotate the shape around its center.

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

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group, and LibBoard::Board.

References center(), and rotate().

ShapeList LibBoard::ShapeList::rotated ( double  angle,
const Point center 
)

Reimplemented in LibBoard::Group, and LibBoard::Board.

References rotate().

ShapeList LibBoard::ShapeList::rotated ( double  angle)

Reimplemented in LibBoard::Group, and LibBoard::Board.

References center(), and ShapeList().

Shape & LibBoard::ShapeList::scale ( double  sx,
double  sy 
)
virtual

Scale the shape along the x an y axis.

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

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group, and LibBoard::Board.

References _shapes, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by scale().

Shape & LibBoard::ShapeList::scale ( double  s)
virtual

Scale the shape along both axis.

Parameters:
sThe scale factor along both axis.
Returns:
The shape itself.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group, and LibBoard::Board.

References scale().

void LibBoard::ShapeList::scaleAll ( double  s)
virtual

Scales all the values (positions, dimensions, etc.) associated with the shape.

Parameters:
sThe scaling factor.

Implements LibBoard::Shape.

References _shapes.

ShapeList LibBoard::ShapeList::scaled ( double  sx,
double  sy 
)

Reimplemented in LibBoard::Group, and LibBoard::Board.

References ShapeList().

ShapeList LibBoard::ShapeList::scaled ( double  s)

Reimplemented in LibBoard::Group, and LibBoard::Board.

References ShapeList().

void LibBoard::ShapeList::shiftDepth ( int  shift)
virtual

Reimplemented from LibBoard::Shape.

References _shapes.

Shape & LibBoard::ShapeList::top ( )

Convenience function that simply calls last(0).

Parameters:
position
Returns:
Shape & LibBoard::ShapeList::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.

Implements LibBoard::Shape.

Reimplemented in LibBoard::Group, and LibBoard::Board.

References _shapes.

Referenced by scale().

ShapeList LibBoard::ShapeList::translated ( double  dx,
double  dy 
)

Reimplemented in LibBoard::Group, and LibBoard::Board.

References ShapeList().


Field Documentation

const std::string LibBoard::ShapeList::_name
staticprivate

The generic name of the shape.

Reimplemented from LibBoard::Shape.

Reimplemented in LibBoard::Group.

Referenced by name().


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