DGtal 1.4.0
|
Abstract structure for a 2D shape. More...
#include <Board/Shapes.h>
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 Shape * | clone () const =0 |
bool | filled () const |
virtual Point | center () const =0 |
virtual Shape & | rotate (double angle, const Point ¢er)=0 |
virtual Shape & | rotate (double angle)=0 |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
virtual Shape & | translate (double dx, double dy)=0 |
virtual Shape & | scale (double sx, double sy)=0 |
virtual Shape & | scale (double s)=0 |
virtual Rect | boundingBox () const =0 |
Rect | bbox () |
Shape & | operator-- () |
Shape & | operator++ () |
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 | flushCairo (cairo_t *cr, const TransformCairo &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 |
void | setCairoDashStyle (cairo_t *cr, LineStyle type) 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 |
enum LibBoard::Shape::LineCap |
enum LibBoard::Shape::LineJoin |
enum LibBoard::Shape::LineStyle |
Enumerator | |
---|---|
SolidStyle | |
DashStyle | |
DotStyle | |
DashDotStyle | |
DashDotDotStyle | |
DashDotDotDotStyle |
Definition at line 62 of file Board/Shapes.h.
|
inline |
Shape constructor.
penColor | The pen color of the shape. |
fillColor | The fill color of the shape. |
lineWidth | The line thickness. |
style | The line style. |
cap | The line cap. |
join | The line join. |
depth | The depth of the shape. |
|
inlinevirtual |
|
inline |
Returns the bounding box of the figure. (Convenience method to call "boundingBox" with a short name.)
Definition at line 339 of file Board/Shapes.h.
References boundingBox().
|
pure virtual |
Returns the bounding box of the figure.
Implemented in LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by bbox().
|
pure virtual |
Returns the gravity center of the shape.
Implemented in LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by rotateDeg().
|
pure virtual |
Return a copy of the shape.
Implemented in LibBoard::Arrow, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::ShapeList, LibBoard::Text, and LibBoard::Triangle.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::Board::addDuplicates(), LibBoard::ShapeList::addShape(), LibBoard::ShapeList::operator+=(), and LibBoard::ShapeList::operator<<().
|
inline |
Definition at line 361 of file Board/Shapes.h.
References _depth.
Referenced by LibBoard::ShapeList::addShape(), LibBoard::ShapeList::operator<<(), and LibBoard::shapeGreaterDepth().
|
virtual |
|
inline |
|
inline |
Checks whether a shape is filled with a color or not.
Definition at line 111 of file Board/Shapes.h.
References _fillColor, and DGtal::Color::None.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Arc::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Ellipse::flushPostscript(), and LibBoard::Polyline::flushPostscript().
|
pure virtual |
Writes the cairo code of the shape in a cairo drawing context according to a transform.
cr | The cairo drawing context. |
transform | A 2D transform to be applied. |
Implemented in LibBoard::Arc, LibBoard::Arrow, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::QuadraticBezierCurve, LibBoard::Rectangle, LibBoard::ShapeList, and LibBoard::Text.
|
pure virtual |
Writes the FIG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
colormap | A colormap. |
Implemented in LibBoard::Arrow, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::QuadraticBezierCurve, LibBoard::Rectangle, LibBoard::ShapeList, and LibBoard::Text.
|
pure virtual |
Writes the EPS code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implemented in LibBoard::Arc, LibBoard::Arrow, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::QuadraticBezierCurve, LibBoard::ShapeList, and LibBoard::Text.
|
pure virtual |
Writes the SVG code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implemented in LibBoard::Arc, LibBoard::Arrow, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::QuadraticBezierCurve, LibBoard::Rectangle, LibBoard::ShapeList, and LibBoard::Text.
|
pure virtual |
Writes the TikZ code of the shape in a stream according to a transform.
stream | The output stream. |
transform | A 2D transform to be applied. |
Implemented in LibBoard::Arc, LibBoard::Arrow, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::QuadraticBezierCurve, LibBoard::Rectangle, LibBoard::ShapeList, and LibBoard::Text.
|
virtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented in LibBoard::Arc, LibBoard::Arrow, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Image, LibBoard::Line, LibBoard::Polyline, LibBoard::QuadraticBezierCurve, LibBoard::Rectangle, LibBoard::ShapeList, LibBoard::Text, and LibBoard::Triangle.
Definition at line 103 of file Shapes.cpp.
References _name.
|
inline |
Increment the depth of the shape. (Push the shape toward the background.)
Definition at line 346 of file Board/Shapes.h.
References _depth.
|
inline |
Decrement the depth of the shape. (Pull the shape toward the foreground.)
Definition at line 353 of file Board/Shapes.h.
References _depth.
|
inline |
|
protected |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as Postscript commands.
Definition at line 140 of file Shapes.cpp.
References _lineCap, _lineJoin, _lineStyle, and _lineWidth.
Referenced by LibBoard::Arrow::flushPostscript(), LibBoard::Dot::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Polyline::flushPostscript(), and LibBoard::QuadraticBezierCurve::flushPostscript().
|
pure virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implemented in LibBoard::Board, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implemented in LibBoard::Board, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::ShapeList::rotate(), rotateDeg(), and rotateDeg().
|
inline |
Rotate the shape around its center.
angle | The rotation angle in degree. |
Definition at line 385 of file Board/Shapes.h.
Rotate the shape around a given center of rotation.
angle | The rotation angle in degree. |
center | The center of rotation. |
Definition at line 379 of file Board/Shapes.h.
References rotate().
|
pure virtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implemented in LibBoard::Board, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
|
pure virtual |
Scale the shape along the x an y axis.
sx | The scale factor along the x axis. |
sy | The scale factor along the y axis. |
Implemented in LibBoard::Board, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), and LibBoard::Board::addDuplicates().
|
pure virtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implemented in LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Line, LibBoard::Polyline, LibBoard::Rectangle, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::State::unit().
|
protected |
Set a cairo dash style.
cr | The cairo drawing context. |
type | LineStyle: SolidStyle, DashStyle, DotStyle, DashDotStyle, DashDotDotStyle, DashDotDotDotStyle. |
Definition at line 153 of file Shapes.cpp.
References DashDotDotDotStyle, DashDotDotStyle, DashDotStyle, DashStyle, DotStyle, and SolidStyle.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Dot::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), and LibBoard::Rectangle::flushCairo().
|
virtual |
|
protected |
Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.
Definition at line 109 of file Shapes.cpp.
References _fillColor, _lineCap, _lineJoin, _lineStyle, _lineWidth, _penColor, DGtal::Color::None, SolidStyle, DGtal::Color::svg(), and DGtal::Color::svgAlpha().
Referenced by LibBoard::Arc::flushSVG(), LibBoard::Circle::flushSVG(), LibBoard::Dot::flushSVG(), LibBoard::Ellipse::flushSVG(), LibBoard::Line::flushSVG(), LibBoard::Polyline::flushSVG(), LibBoard::QuadraticBezierCurve::flushSVG(), and LibBoard::Rectangle::flushSVG().
|
protected |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as TikZ commands.
Definition at line 177 of file Shapes.cpp.
References _fillColor, _lineCap, _lineJoin, _lineStyle, _lineWidth, _penColor, and DGtal::Color::tikz().
Referenced by LibBoard::Arc::flushTikZ(), LibBoard::Arrow::flushTikZ(), LibBoard::Circle::flushTikZ(), LibBoard::Ellipse::flushTikZ(), LibBoard::Line::flushTikZ(), LibBoard::Polyline::flushTikZ(), LibBoard::QuadraticBezierCurve::flushTikZ(), LibBoard::Rectangle::flushTikZ(), and LibBoard::Text::flushTikZ().
|
pure virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implemented in LibBoard::Board, LibBoard::Circle, LibBoard::Dot, LibBoard::Ellipse, LibBoard::Group, LibBoard::Line, LibBoard::Polyline, LibBoard::ShapeList, and LibBoard::Text.
Referenced by LibBoard::Board::addDuplicates(), LibBoard::Board::addDuplicates(), and LibBoard::ShapeList::translate().
|
protected |
The depth of the shape.
Definition at line 295 of file Board/Shapes.h.
Referenced by depth(), depth(), LibBoard::Arrow::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Text::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), LibBoard::GouraudTriangle::flushSVG(), operator++(), operator--(), and shiftDepth().
|
protected |
The color of the shape.
Definition at line 297 of file Board/Shapes.h.
Referenced by fillColor(), filled(), LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Ellipse::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Arc::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), LibBoard::Arrow::flushSVG(), LibBoard::Text::flushSVG(), svgProperties(), and tikzProperties().
|
protected |
The linecap attribute. (The way line terminates.)
Definition at line 300 of file Board/Shapes.h.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Dot::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The linejoin attribute. (The shape of line junctions.)
Definition at line 301 of file Board/Shapes.h.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Dot::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The line style (solid, dashed, etc.).
Definition at line 299 of file Board/Shapes.h.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Dot::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Arrow::flushSVG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The line thickness.
Definition at line 298 of file Board/Shapes.h.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Dot::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Arrow::flushPostscript(), LibBoard::Arrow::flushSVG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
staticprivate |
|
protected |
The color of the shape.
Definition at line 296 of file Board/Shapes.h.
Referenced by LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Dot::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Dot::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Text::flushFIG(), LibBoard::Arc::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Dot::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), LibBoard::Text::flushPostscript(), LibBoard::Arrow::flushSVG(), LibBoard::Text::flushSVG(), penColor(), svgProperties(), and tikzProperties().