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

#include <Shapes.h>

Inheritance diagram for LibBoard::Shape:

Public Types

enum  LineCap { ButtCap = 0, RoundCap, SquareCap }
enum  LineJoin { MiterJoin = 0, RoundJoin, BevelJoin }
enum  LineStyle {
  SolidStyle = 0, DashStyle, DotStyle, DashDotStyle,
  DashDotDotStyle, DashDotDotDotStyle
}

Public Member Functions

 Shape (DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join, int depth)
virtual ~Shape ()
virtual const std::string & name () const
virtual Shapeclone () const =0
bool filled () const
virtual Point center () const =0
virtual Shaperotate (double angle, const Point &center)=0
virtual Shaperotate (double angle)=0
ShaperotateDeg (double angle, const Point &center)
ShaperotateDeg (double angle)
virtual Shapetranslate (double dx, double dy)=0
virtual Shapescale (double sx, double sy)=0
virtual Shapescale (double s)=0
virtual Rect boundingBox () const =0
Rect bbox ()
Shapeoperator-- ()
Shapeoperator++ ()
virtual void scaleAll (double s)=0
virtual void flushPostscript (std::ostream &stream, const TransformEPS &transform) const =0
virtual void flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< DGtal::Color, int > &colormap) const =0
virtual void flushSVG (std::ostream &stream, const TransformSVG &transform) const =0
virtual void flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0
int depth () const
virtual void depth (int)
virtual void shiftDepth (int shift)
const DGtal::Color & penColor () const
const DGtal::Color & fillColor () const

Protected Member Functions

std::string svgProperties (const TransformSVG &transform) const
std::string postscriptProperties () const
std::string tikzProperties (const TransformTikZ &transform) const

Protected Attributes

int _depth
DGtal::Color _penColor
DGtal::Color _fillColor
double _lineWidth
LineStyle _lineStyle
LineCap _lineCap
LineJoin _lineJoin

Static Private Attributes

static const std::string _name

Detailed Description

Abstract structure for a 2D shape.

Shape structure.


Member Enumeration Documentation

Enumerator:
ButtCap 
RoundCap 
SquareCap 
Enumerator:
MiterJoin 
RoundJoin 
BevelJoin 
Enumerator:
SolidStyle 
DashStyle 
DotStyle 
DashDotStyle 
DashDotDotStyle 
DashDotDotDotStyle 

Constructor & Destructor Documentation

LibBoard::Shape::Shape ( DGtal::Color  penColor,
DGtal::Color  fillColor,
double  lineWidth,
LineStyle  style,
const LineCap  cap,
const LineJoin  join,
int  depth 
)
inline

Shape constructor.

Parameters:
penColorThe pen color of the shape.
fillColorThe fill color of the shape.
lineWidthThe line thickness.
depthThe depth of the shape.
virtual LibBoard::Shape::~Shape ( )
inlinevirtual

Shape destructor.


Member Function Documentation

Rect LibBoard::Shape::bbox ( )
inline

Returns the bounding box of the figure. (Convenience method to call "boundingBox" with a short name.)

References boundingBox().

virtual Rect LibBoard::Shape::boundingBox ( ) const
pure virtual

Returns the bounding box of the figure.

Returns:
The rectangle of the bounding box.

Implemented in LibBoard::Text, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.

Referenced by bbox().

virtual Point LibBoard::Shape::center ( ) const
pure virtual

Returns the gravity center of the shape.

Returns:
The center of the shape.

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, and LibBoard::ShapeList.

Referenced by rotateDeg().

int LibBoard::Shape::depth ( ) const
inline
void LibBoard::Shape::depth ( int  d)
virtual

References _depth.

const DGtal::Color & LibBoard::Shape::fillColor ( ) const
inline

References _fillColor.

bool LibBoard::Shape::filled ( ) const
inline
virtual void LibBoard::Shape::flushFIG ( std::ostream &  stream,
const TransformFIG transform,
std::map< DGtal::Color, int > &  colormap 
) const
pure 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.

Implemented in LibBoard::Text, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.

virtual void LibBoard::Shape::flushPostscript ( std::ostream &  stream,
const TransformEPS transform 
) const
pure 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.

Implemented in LibBoard::Text, LibBoard::Arc, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.

virtual void LibBoard::Shape::flushSVG ( std::ostream &  stream,
const TransformSVG transform 
) const
pure 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.

Implemented in LibBoard::Text, LibBoard::Arc, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.

virtual void LibBoard::Shape::flushTikZ ( std::ostream &  stream,
const TransformTikZ transform 
) const
pure 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.

Implemented in LibBoard::Text, LibBoard::Arc, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.

const std::string & LibBoard::Shape::name ( ) const
virtual
Shape & LibBoard::Shape::operator++ ( )
inline

Increment the depth of the shape. (Push the shape toward the background.)

Returns:

References _depth.

Shape & LibBoard::Shape::operator-- ( )
inline

Decrement the depth of the shape. (Pull the shape toward the foreground.)

Returns:

References _depth.

const DGtal::Color & LibBoard::Shape::penColor ( ) const
inline

References _penColor.

std::string LibBoard::Shape::postscriptProperties ( ) const
protected

Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.

Returns:
A string of the Postscript commands.

References _lineCap, _lineJoin, _lineStyle, and _lineWidth.

Referenced by LibBoard::Dot::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), and LibBoard::Ellipse::flushPostscript().

virtual Shape& LibBoard::Shape::rotate ( double  angle,
const Point center 
)
pure 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.

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, and LibBoard::ShapeList.

Referenced by LibBoard::Board::addDuplicates(), and rotateDeg().

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

Rotate the shape around its center.

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

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, and LibBoard::ShapeList.

Shape & LibBoard::Shape::rotateDeg ( double  angle,
const Point center 
)
inline

Rotate the shape around a given center of rotation.

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

References M_PI, and rotate().

Shape & LibBoard::Shape::rotateDeg ( double  angle)
inline

Rotate the shape around its center.

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

References center(), M_PI, and rotate().

virtual Shape& LibBoard::Shape::scale ( double  sx,
double  sy 
)
pure 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.

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, and LibBoard::ShapeList.

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

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

Scale the shape along both axis.

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

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, and LibBoard::ShapeList.

virtual void LibBoard::Shape::scaleAll ( double  s)
pure virtual

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

Parameters:
sThe scaling factor.

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, and LibBoard::ShapeList.

Referenced by LibBoard::ShapeList::addShape(), and LibBoard::Board::State::unit().

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

Reimplemented in LibBoard::ShapeList.

References _depth.

std::string LibBoard::Shape::svgProperties ( const TransformSVG transform) const
protected

Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.

Returns:
A string of the properties suitable for inclusion in an svg tag.

References _fillColor, _lineCap, _lineJoin, _lineStyle, _lineWidth, _penColor, LibBoard::TransformSVG::mapWidth(), and SolidStyle.

Referenced by LibBoard::Dot::flushSVG(), LibBoard::Line::flushSVG(), LibBoard::Polyline::flushSVG(), LibBoard::Rectangle::flushSVG(), LibBoard::Ellipse::flushSVG(), LibBoard::Circle::flushSVG(), and LibBoard::Arc::flushSVG().

std::string LibBoard::Shape::tikzProperties ( const TransformTikZ transform) const
protected
virtual Shape& LibBoard::Shape::translate ( double  dx,
double  dy 
)
pure virtual

Translate the shape by a given offset.

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

Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::Board, and LibBoard::ShapeList.

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


Field Documentation


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