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

#include <Board.h>

Inheritance diagram for LibBoard::Board:
Collaboration diagram for LibBoard::Board:

Data Structures

struct  State

Public Types

enum  CairoType {
  CairoPDF, CairoPNG, CairoPS, CairoEPS,
  CairoSVG
}
enum  PageSize { BoundingBox, A4, Letter }
enum  Unit { UPoint, UInche, UCentimeter, UMillimeter }

Public Member Functions

 Board (const DGtal::Color &backgroundColor=DGtal::Color::None)
 Board (const Board &other)
 ~Board ()
Boardoperator= (const Board &other)
Boardoperator<< (const Shape &shape)
Boardoperator<< (Unit unit)
void clear (const DGtal::Color &color=DGtal::Color::None)
void clear (unsigned char red, unsigned char green, unsigned char blue)
Shaperotate (double angle, const Point &center)
Shaperotate (double angle)
Shapetranslate (double dx, double dy)
Shapescale (double sx, double sy)
Shapescale (double s)
Board rotated (double angle, const Point &center)
Board rotated (double angle)
Board translated (double dx, double dy)
Board scaled (double sx, double sy)
Board scaled (double s)
void setUnit (Unit unit)
void setUnit (double factor, Unit unit)
void drawDot (double x, double y, int depthValue=-1)
void drawLine (double x1, double y1, double x2, double y2, int depthValue=-1)
void drawArrow (double x1, double y1, double x2, double y2, bool filled=true, int depthValue=-1)
void drawTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
void drawTriangle (const Point &p1, const Point &p2, const Point &p3, int depthValue=-1)
void drawArc (double x, double y, double radius, double angle1, double angle2, bool neg, int depthValue=-1)
void fillTriangle (double x1, double y1, double x2, double y2, double x3, double y3, int depthValue=-1)
void fillGouraudTriangle (const Point &p1, const DGtal::Color &color1, const Point &p2, const DGtal::Color &color2, const Point &p3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1)
void fillGouraudTriangle (const double x1, const double y1, const DGtal::Color &color1, const double x2, const double y2, const DGtal::Color &color2, const double x3, const double y3, const DGtal::Color &color3, unsigned char divisions=3, int depthValue=-1)
void fillGouraudTriangle (const Point &p1, const float brightness1, const Point &p2, const float brightness2, const Point &p3, const float brightness3, unsigned char divisions=3, int depthValue=-1)
void fillGouraudTriangle (const double x1, const double y1, const float brightness1, const double x2, const double y2, const float brightness2, const double x3, const double y3, const float brightness3, unsigned char divisions=3, int depthValue=-1)
void fillTriangle (const Point &p1, const Point &p2, const Point &p3, int depthValue=-1)
void drawRectangle (double x, double y, double width, double height, int depthValue=-1)
void drawImage (std::string filename, double x, double y, double width, double height, int depthValue=-1, double alpha=1.0)
void fillRectangle (double x, double y, double width, double height, int depthValue=-1)
void drawCircle (double x, double y, double radius, int depthValue=-1)
void fillCircle (double x, double y, double radius, int depthValue=-1)
void drawEllipse (double x, double y, double xRadius, double yRadius, int depthValue=-1)
void fillEllipse (double x, double y, double xRadius, double yRadius, int depthValue=-1)
void drawPolyline (const std::vector< Point > &points, int depthValue=-1)
void drawClosedPolyline (const std::vector< Point > &points, int depthValue=-1)
void fillPolyline (const std::vector< Point > &points, int depthValue=-1)
void drawText (double x, double y, const char *text, int depthValue=-1)
void drawText (double x, double y, const std::string &str, int depthValue=-1)
BoardsetFont (const Fonts::Font font, double fontSize)
BoardsetFontSize (double fontSize)
BoardsetPenColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
BoardsetPenColorRGBf (float red, float green, float blue, float alpha=1.0f)
BoardsetPenColor (const DGtal::Color &color)
BoardsetFillColorRGBi (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
BoardsetFillColorRGBf (float red, float green, float blue, float alpha=1.0f)
BoardsetFillColor (const DGtal::Color &color)
BoardsetLineWidth (double width)
BoardsetLineStyle (Shape::LineStyle style)
BoardsetLineCap (Shape::LineCap cap)
BoardsetLineJoin (Shape::LineJoin join)
void backgroundColor (const DGtal::Color &color)
void drawBoundingBox (int depthValue=-1)
void setClippingRectangle (double x, double y, double width, double height)
void setClippingPath (const std::vector< Point > &points)
void setClippingPath (const Path &path)
void addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scale=1.0)
void addDuplicates (const Shape &shape, unsigned int times, double dx, double dy, double scaleX, double scaleY, double angle=0.0)
void save (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void save (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void saveEPS (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveEPS (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveEPS (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void saveEPS (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0) const
void saveFIG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
void saveFIG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0, bool includeFIGHeader=true) const
void saveFIG (const char *filename, double pageWidth, double pageHeight, double margin=10.0, bool includeFIGHeader=true) const
void saveFIG (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0, bool includeFIGHeader=true) const
void saveSVG (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveSVG (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveSVG (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void saveSVG (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0, string filename="output.svg") const
void saveTikZ (const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveTikZ (std::ostream &out, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveTikZ (const char *filename, double pageWidth, double pageHeight, double margin=10.0) const
void saveTikZ (std::ostream &out, double pageWidth, double pageHeight, double margin=10.0) const
- Public Member Functions inherited from LibBoard::ShapeList
 ShapeList (int depth=-1)
 ShapeList (const ShapeList &other)
 ~ShapeList ()
const std::string & name () const
ShapeListclear ()
Point center () const
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)
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

Static Public Attributes

static const double Degree = 3.14159265358979323846 / 180.0

Protected Attributes

State _state
DGtal::Color _backgroundColor
Path _clippingPath
- Protected Attributes inherited from LibBoard::ShapeList
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

Additional Inherited Members

- Protected Member Functions inherited from LibBoard::ShapeList
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

Detailed Description

Class for EPS, FIG or SVG drawings.

The Board class.

Version:
0.5

Member Enumeration Documentation

Enumerator:
CairoPDF 
CairoPNG 
CairoPS 
CairoEPS 
CairoSVG 
Enumerator:
BoundingBox 
A4 
Letter 
Enumerator:
UPoint 
UInche 
UCentimeter 
UMillimeter 

Constructor & Destructor Documentation

LibBoard::Board::Board ( const DGtal::Color &  backgroundColor = DGtal::Color::None)

Constructs a new board and sets the background color, if any.

Parameters:
backgroundColorA color for the drawing's background.

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

LibBoard::Board::Board ( const Board other)

Copy constructor.

Parameters:
otherThe object to be copied.
LibBoard::Board::~Board ( )

Member Function Documentation

void LibBoard::Board::addDuplicates ( const Shape shape,
unsigned int  times,
double  dx,
double  dy,
double  scale = 1.0 
)

Insert duplicates of a shape, n times, starting at its current position and iterating given translations and scalings.

Parameters:
shapeThe shape to be duplicated.
timesThe number of duplicates.
dxThe x shift.
dyThe y shift.
scaleA scale factor between each copy.

References LibBoard::Shape::clone(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().

void LibBoard::Board::addDuplicates ( const Shape shape,
unsigned int  times,
double  dx,
double  dy,
double  scaleX,
double  scaleY,
double  angle = 0.0 
)

Insert duplicates of a shape, n times, starting at its current position and iterating a given translation.

Parameters:
shapeThe shape to be duplicated.
timesThe number of duplicates.
dxThe x shift.
dyThe y shift.
scaleXAn x scale factor between each copy.
scaleYA y scale factor between each copy.
scaleYA y scale factor between each copy.
angleAn angular increment.

References LibBoard::Shape::clone(), LibBoard::Shape::rotate(), LibBoard::Shape::scale(), and LibBoard::Shape::translate().

void LibBoard::Board::backgroundColor ( const DGtal::Color &  color)

Changes the background color of the whole drawing.

Parameters:
colorA color (may be Color::None).

References _backgroundColor.

void LibBoard::Board::clear ( const DGtal::Color &  color = DGtal::Color::None)

Clears the board with a given background color.

Parameters:
colorThe board background color (may be Color::None).

References _backgroundColor, and LibBoard::ShapeList::clear().

void LibBoard::Board::clear ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)

Clears the board and set the background color from an RGB triple.

Parameters:
red
green
blue
void LibBoard::Board::drawArc ( double  x,
double  y,
double  radius,
double  angle1,
double  angle2,
bool  neg,
int  depthValue = -1 
)

Draws an arc.

Parameters:
xFirst coordinate of the arc center.
ySecond coordinate of the arc center.
radiusarc radius.
angle1first angle.
angle2second angle.
neg
depthValueDepth of the arc.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawArrow ( double  x1,
double  y1,
double  x2,
double  y2,
bool  filled = true,
int  depthValue = -1 
)

Draws a line from (x1,y1) to (x2,y2) with an arrow at (x2,y2).

Parameters:
x1First coordinate of the first extremity.
y1Second coordinate of the first extremity.
x2First coordinate of the second extremity.
y2Second coordinate of the second extremity.
filledWhether or not the arrow is filled.
depthValueDepth of the line.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawCircle ( double  x,
double  y,
double  radius,
int  depthValue = -1 
)

Draws a circle.

Parameters:
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
depthValueDepth of the circle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawClosedPolyline ( const std::vector< Point > &  points,
int  depthValue = -1 
)
void LibBoard::Board::drawDot ( double  x,
double  y,
int  depthValue = -1 
)

Draws a dot at coordinates (x,y).

Parameters:
xFirst coordinate of the dot.
ySecond coordinate of the dot.
depthValueDepth of the line.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawEllipse ( double  x,
double  y,
double  xRadius,
double  yRadius,
int  depthValue = -1 
)

Draws an ellipse.

Parameters:
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
depthValueDepth of the circle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawImage ( std::string  filename,
double  x,
double  y,
double  width,
double  height,
int  depthValue = -1,
double  alpha = 1.0 
)

Draws an image.

Parameters:
xFirst coordinate of the upper left corner.
ySecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
depthValueDepth of the rectangle.
alphaTransparency used in the image display.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, and LibBoard::Board::State::unit().

void LibBoard::Board::drawLine ( double  x1,
double  y1,
double  x2,
double  y2,
int  depthValue = -1 
)

Draws a line from (x1,y1) to (x2,y2).

Parameters:
x1First coordinate of the first extremity.
y1Second coordinate of the first extremity.
x2First coordinate of the second extremity.
y2Second coordinate of the second extremity.
depthValueDepth of the line.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawPolyline ( const std::vector< Point > &  points,
int  depthValue = -1 
)
void LibBoard::Board::drawRectangle ( double  x,
double  y,
double  width,
double  height,
int  depthValue = -1 
)

Draws a rectangle.

Parameters:
xFirst coordinate of the upper left corner.
ySecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
depthValueDepth of the rectangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawText ( double  x,
double  y,
const char *  text,
int  depthValue = -1 
)

Draws a string of text.

Parameters:
xThe first coordinates of the lower left corner.
yThe second coordinates of the lower left corner.
textThe text.
depthValueThe depth of the text.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawText ( double  x,
double  y,
const std::string &  str,
int  depthValue = -1 
)

Draws a string of text.

Parameters:
xThe first coordinates of the lower left corner.
yThe second coordinates of the lower left corner.
textThe text.
depthValueThe depth of the text.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::font, LibBoard::Board::State::fontSize, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
int  depthValue = -1 
)

Draws a triangle.

Parameters:
x1First coordinate of the first vertex.
y1Second coordinate of the first vertex.
x2First coordinate of the second vertex.
y3Second coordinate of the second vertex.
x3First coordinate of the third vertex.
y3Second coordinate of the third vertex.
depthValueDepth of the triangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::fillColor, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::lineWidth, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::drawTriangle ( const Point p1,
const Point p2,
const Point p3,
int  depthValue = -1 
)
void LibBoard::Board::fillCircle ( double  x,
double  y,
double  radius,
int  depthValue = -1 
)

Draws a circle filled with the current pen color.

Parameters:
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
radiusRadius of the circle.
depthValueDepth of the circle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::fillEllipse ( double  x,
double  y,
double  xRadius,
double  yRadius,
int  depthValue = -1 
)

Draws an ellipse filled with the current pen color.

Parameters:
xFirst coordinate of the circle's center.
ySecond coordinate of the circle's center.
xRadiusX axis radius of the ellipse.
yRadiusY axis radius of the ellipse.
depthValueDepth of the circle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::fillGouraudTriangle ( const Point p1,
const DGtal::Color &  color1,
const Point p2,
const DGtal::Color &  color2,
const Point p3,
const DGtal::Color &  color3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with Gouraud-like shaded colors.

Parameters:
p1
color1
p2
color2
p3
color3
divisionsnumber of triangle subdivisions.
depthValueThe depth of the triangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.

Referenced by fillGouraudTriangle().

void LibBoard::Board::fillGouraudTriangle ( const double  x1,
const double  y1,
const DGtal::Color &  color1,
const double  x2,
const double  y2,
const DGtal::Color &  color2,
const double  x3,
const double  y3,
const DGtal::Color &  color3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with Gouraud-like shaded colors.

Parameters:
x1
y1
color1
x2
y2
color2
x3
y3
color3
divisions
depthValue
void LibBoard::Board::fillGouraudTriangle ( const Point p1,
const float  brightness1,
const Point p2,
const float  brightness2,
const Point p3,
const float  brightness3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.

Parameters:
p1
brightness1
p2
brightness2
p3
brightness3
divisionsnumber of triangle subdivisions.
depthValueThe depth of the triangle.

References _state, fillGouraudTriangle(), LibBoard::Board::State::penColor, LibBoard::Board::State::unit(), LibBoard::Point::x, and LibBoard::Point::y.

void LibBoard::Board::fillGouraudTriangle ( const double  x1,
const double  y1,
const float  brightness1,
const double  x2,
const double  y2,
const float  brightness2,
const double  x3,
const double  y3,
const float  brightness3,
unsigned char  divisions = 3,
int  depthValue = -1 
)

Draws a triangle with a Gouraud-like shaded color according to the current fill color and a brightness value given for each vertex.

Parameters:
x1
y1
brightness1
x2
y2
brightness2
x3
y3
brightness3
divisions
depthValue
void LibBoard::Board::fillPolyline ( const std::vector< Point > &  points,
int  depthValue = -1 
)
void LibBoard::Board::fillRectangle ( double  x,
double  y,
double  width,
double  height,
int  depthValue = -1 
)

Draws a rectangle filled with the current pen color.

Parameters:
xFirst coordinate of the upper left corner.
ySecond coordinate of the upper left corner.
widthWidth of the rectangle.
heightHeight of the rectangle.
depthValueDepth of the rectangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::fillTriangle ( double  x1,
double  y1,
double  x2,
double  y2,
double  x3,
double  y3,
int  depthValue = -1 
)

Draws a filled triangle.

Parameters:
x1First coordinate of the first vertex.
y1Second coordinate of the first vertex.
x2First coordinate of the second vertex.
y3Second coordinate of the second vertex.
x3First coordinate of the third vertex.
y3Second coordinate of the third vertex.
depthValueDepth of the triangle.

References LibBoard::ShapeList::_nextDepth, LibBoard::ShapeList::_shapes, _state, LibBoard::Board::State::lineCap, LibBoard::Board::State::lineJoin, LibBoard::Board::State::lineStyle, LibBoard::Board::State::penColor, and LibBoard::Board::State::unit().

void LibBoard::Board::fillTriangle ( const Point p1,
const Point p2,
const Point p3,
int  depthValue = -1 
)
Board & LibBoard::Board::operator<< ( const Shape shape)

Add a shape to the board, using the current unit factor.

Parameters:
shapeA shape. (Might be a list of shapes, actually!)
Returns:
The board itself, as a ShapeList.

Reimplemented from LibBoard::ShapeList.

References _state, LibBoard::ShapeList::addShape(), and LibBoard::Board::State::unitFactor.

Board & LibBoard::Board::operator<< ( Unit  unit)

Overloaded operator to set the current unit.

Parameters:
unitThe unit to be used in next drawing functions and shape insertions.
Returns:
The board itself, as a ShapeList.

References setUnit().

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

The operator =

Parameters:
otherThe object to be copied.
Returns:
A reference to the left operand.

References LibBoard::ShapeList::_shapes, and LibBoard::ShapeList::free().

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

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

Referenced by rotate().

Shape & LibBoard::Board::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 _clippingPath, LibBoard::ShapeList::center(), rotate(), and LibBoard::Path::rotate().

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

Reimplemented from LibBoard::ShapeList.

References Board().

Board LibBoard::Board::rotated ( double  angle)

Reimplemented from LibBoard::ShapeList.

References Board().

void LibBoard::Board::save ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an EPS, XFIG of SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenamePath of the file to be created.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
void LibBoard::Board::save ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing in an EPS, XFIG of SVG file depending on the filename extension. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenamePath of the file to be created.
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References saveEPS(), saveFIG(), saveSVG(), and saveTikZ().

void LibBoard::Board::saveEPS ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe EPS file name.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Referenced by save(), and saveEPS().

void LibBoard::Board::saveEPS ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Saves the drawing in EPS format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

References saveEPS().

void LibBoard::Board::saveEPS ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Saves the drawing in an EPS file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe EPS file name.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References saveEPS().

void LibBoard::Board::saveEPS ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Saves the drawing in an EPS format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Path::boundingBox(), LibBoard::Path::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), LibBoard::secured_ctime(), LibBoard::TransformEPS::setBoundingBox(), LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), LibBoard::Rect::top, and LibBoard::Rect::width.

void LibBoard::Board::saveFIG ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe name of the FIG file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the exported file. Useful to merge several XFIG figures (default true)

Referenced by save(), and saveFIG().

void LibBoard::Board::saveFIG ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in XFig format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the output stream. Useful to merge several XFIG figures (default true)

References saveFIG().

void LibBoard::Board::saveFIG ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in an XFig file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe XFig file name.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the output stream. Useful to merge several XFIG figures (default true)

References saveFIG().

void LibBoard::Board::saveFIG ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0,
bool  includeFIGHeader = true 
) const

Saves the drawing in an XFig format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outout The output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.
includeFIGHeaderIndicates if the header is included in the output stream. Useful to merge several XFIG figures (default true)

References _backgroundColor, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Shape::depth(), LibBoard::Rectangle::flushFIG(), secured_sprintf, LibBoard::TransformFIG::setBoundingBox(), LibBoard::TransformFIG::setDepthRange(), and LibBoard::shapeGreaterDepth().

void LibBoard::Board::saveSVG ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Referenced by save(), and saveSVG().

void LibBoard::Board::saveSVG ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an SVG format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

References saveSVG().

void LibBoard::Board::saveSVG ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Saves the drawing in an SVG file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe SVG file name.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References saveSVG().

void LibBoard::Board::saveSVG ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0,
string  filename = "output.svg" 
) const

Saves the drawing in an SVG format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Path::boundingBox(), LibBoard::Rectangle::flushSVG(), LibBoard::Path::flushSVGCommands(), LibBoard::Rect::height, LibBoard::TransformSVG::setBoundingBox(), LibBoard::shapeGreaterDepth(), LibBoard::Path::size(), and LibBoard::Rect::width.

void LibBoard::Board::saveTikZ ( const char *  filename,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

Referenced by save(), and saveTikZ().

void LibBoard::Board::saveTikZ ( std::ostream &  out,
PageSize  size = Board::BoundingBox,
double  margin = 10.0 
) const

Save the drawing in an TikZ file format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
marginMinimal margin around the figure in the page, in millimeters.

References saveTikZ().

void LibBoard::Board::saveTikZ ( const char *  filename,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing in an TikZ file. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
filenameThe name of the file.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References saveTikZ().

void LibBoard::Board::saveTikZ ( std::ostream &  out,
double  pageWidth,
double  pageHeight,
double  margin = 10.0 
) const

Save the drawing in an TikZ format through an output stream. When a size is given (not BoundingBox), the drawing is scaled (up or down) so that it fits within the dimension while keeping its aspect ratio.

Parameters:
outThe output stream.
sizePage size (Either BoundingBox (default), A4 or Letter).
pageWidthWidth of the page in millimeters.
pageHeightHeight of the page in millimeters.
marginMinimal margin around the figure in the page, in millimeters.

References _backgroundColor, _clippingPath, LibBoard::ShapeList::_shapes, LibBoard::ShapeList::boundingBox(), LibBoard::Path::boundingBox(), LibBoard::Path::flushSVGCommands(), LibBoard::Rectangle::flushTikZ(), LibBoard::TransformSVG::setBoundingBox(), LibBoard::shapeGreaterDepth(), and LibBoard::Path::size().

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

Reimplemented from LibBoard::ShapeList.

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

Referenced by scale().

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

Scale the shape along both axis.

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

Reimplemented from LibBoard::ShapeList.

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

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

Reimplemented from LibBoard::ShapeList.

References Board().

Board LibBoard::Board::scaled ( double  s)

Reimplemented from LibBoard::ShapeList.

References Board().

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

Define a clipping path for the whole drawing.

Parameters:
pointsA path.

References _clippingPath, _state, LibBoard::Path::clear(), and LibBoard::Board::State::unit().

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

Define a clipping path for the whole drawing.

Parameters:
pointsA path.

References _clippingPath, _state, LibBoard::Path::pop_back(), LibBoard::Path::setClosed(), LibBoard::Path::size(), and LibBoard::Board::State::unit().

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

Define a clipping rectangle for the whole drawing.

Parameters:
x
y
width
height

References _clippingPath, _state, LibBoard::Path::clear(), and LibBoard::Board::State::unit().

Board & LibBoard::Board::setFillColor ( const DGtal::Color &  color)

Changes the current fill color.

In order to use no fill color, one may set this color to Color::None.

Parameters:
colorThe fill color.
Returns:
The board itself.

References _state, and LibBoard::Board::State::fillColor.

Board & LibBoard::Board::setFillColorRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Changes the current fill color.

Parameters:
redRed component.
greenGreen component.
blueBlue component.
alphaThe opacity.
Returns:
The board itself.

References _state, and LibBoard::Board::State::fillColor.

Board & LibBoard::Board::setFillColorRGBi ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha = 255 
)

Changes the current fill color.

Parameters:
redRed component.
greenGreen component.
blueBlue component.
alphaThe opacity.
Returns:
The board itself.

References _state, and LibBoard::Board::State::fillColor.

Board & LibBoard::Board::setFont ( const Fonts::Font  font,
double  fontSize 
)

Changes the current font and font size.

Parameters:
fontThe name of the font.
fontSizeThe new font size. (The unit is 1pt = 1/72 in).
Returns:
The board itself.

References _state, LibBoard::Board::State::font, and LibBoard::Board::State::fontSize.

Board & LibBoard::Board::setFontSize ( double  fontSize)

Changes the font size.

Parameters:
fontSizeThe new font size. (The unit is 1pt = 1/72 in).
Returns:
The board itself.

References _state, and LibBoard::Board::State::fontSize.

Board& LibBoard::Board::setLineCap ( Shape::LineCap  cap)

Set the line cap style.

Parameters:
capThe cap-style which can be Shape::ButtCap, Shape::RoundCap or Shape::SquareCap.
Returns:
The board itself.
Board& LibBoard::Board::setLineJoin ( Shape::LineJoin  join)

Set the line joine style.

Parameters:
capThe join-style which can be Shape::MiterJoin, Shape::RoundJoin or Shape::BevelJoin.
Returns:
The board itself.
Board& LibBoard::Board::setLineStyle ( Shape::LineStyle  style)

Changes the current line style.

Parameters:
styleThe new line style.
Returns:
The board itself.
Board & LibBoard::Board::setLineWidth ( double  width)

Changes the current line thickness (1/72 inche unit).

Parameters:
widthThe new line thickness.
Returns:
The board itself.

References _state, and LibBoard::Board::State::lineWidth.

Board & LibBoard::Board::setPenColor ( const DGtal::Color &  color)

Changes the current pen color.

In order to use no pen, one may set the pen color to Color::None.

Parameters:
colorThe pen color.
Returns:
The board itself.

References _state, and LibBoard::Board::State::penColor.

Board & LibBoard::Board::setPenColorRGBf ( float  red,
float  green,
float  blue,
float  alpha = 1.0f 
)

Changes the current pen color.

Parameters:
redRed
green
blue
alpha
Returns:
The board itself.

References _state, and LibBoard::Board::State::penColor.

Board & LibBoard::Board::setPenColorRGBi ( unsigned char  red,
unsigned char  green,
unsigned char  blue,
unsigned char  alpha = 255 
)

Changes the current pen color.

Parameters:
redRed component.
greenGreen component.
blueBlue component.
Returns:
The board itself.

References _state, and LibBoard::Board::State::penColor.

void LibBoard::Board::setUnit ( Unit  unit)

Set the unit used by the drawSomething methods.

Parameters:
unitThe unit to be used in { PT, IN, CM, MM }.

References _state, UCentimeter, UInche, UMillimeter, LibBoard::Board::State::unitFactor, and UPoint.

Referenced by operator<<().

void LibBoard::Board::setUnit ( double  factor,
Unit  unit 
)

Set the unit used by the drawSomething methods.

Parameters:
factorThe factor of the unit.
unitThe unit to be used in { PT, IN, CM, MM }.

References _state, UCentimeter, UInche, UMillimeter, LibBoard::Board::State::unitFactor, and UPoint.

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

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

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

Reimplemented from LibBoard::ShapeList.

References Board().


Field Documentation

DGtal::Color LibBoard::Board::_backgroundColor
protected

The color of the background.

Referenced by backgroundColor(), clear(), saveEPS(), saveFIG(), saveSVG(), and saveTikZ().

Path LibBoard::Board::_clippingPath
protected
const double LibBoard::Board::Degree = 3.14159265358979323846 / 180.0
static

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