DGtal
1.4.2
|
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::Text, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
Referenced by bbox().
|
pure virtual |
Returns the gravity 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().
|
pure virtual |
Return a copy of the shape.
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Triangle, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
Referenced by 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::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Ellipse::flushPostscript(), and LibBoard::Arc::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::Text, LibBoard::Arc, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::QuadraticBezierCurve, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
|
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::Text, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::QuadraticBezierCurve, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
|
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::Text, LibBoard::Arc, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::QuadraticBezierCurve, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
|
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::Text, LibBoard::Arc, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::QuadraticBezierCurve, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
|
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::Text, LibBoard::Arc, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::QuadraticBezierCurve, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
|
virtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented in LibBoard::Text, LibBoard::Arc, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::QuadraticBezierCurve, LibBoard::Triangle, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
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::Dot::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), and LibBoard::Ellipse::flushPostscript().
|
pure virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Board.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implemented in LibBoard::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::GouraudTriangle, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Board.
Referenced by LibBoard::Board::addDuplicates(), 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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Board.
|
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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Board.
Referenced by LibBoard::Board::addDuplicates().
|
pure virtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The 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::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::Dot::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), and LibBoard::Arc::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::Dot::flushSVG(), LibBoard::Line::flushSVG(), LibBoard::Polyline::flushSVG(), LibBoard::Rectangle::flushSVG(), LibBoard::QuadraticBezierCurve::flushSVG(), LibBoard::Ellipse::flushSVG(), LibBoard::Circle::flushSVG(), and LibBoard::Arc::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::Line::flushTikZ(), LibBoard::Arrow::flushTikZ(), LibBoard::Polyline::flushTikZ(), LibBoard::Rectangle::flushTikZ(), LibBoard::QuadraticBezierCurve::flushTikZ(), LibBoard::Ellipse::flushTikZ(), LibBoard::Circle::flushTikZ(), LibBoard::Arc::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::Text, LibBoard::Circle, LibBoard::Ellipse, LibBoard::Polyline, LibBoard::Line, LibBoard::Dot, LibBoard::Group, LibBoard::ShapeList, and LibBoard::Board.
Referenced by LibBoard::Board::addDuplicates().
|
protected |
The depth of the shape.
Definition at line 295 of file Board/Shapes.h.
Referenced by depth(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Ellipse::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::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Polyline::flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Arc::flushPostscript(), LibBoard::Arrow::flushSVG(), LibBoard::Text::flushSVG(), LibBoard::GouraudTriangle::GouraudTriangle(), svgProperties(), and tikzProperties().
|
protected |
The linecap attribute. (The way line terminates.)
Definition at line 300 of file Board/Shapes.h.
Referenced by LibBoard::Dot::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::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::Dot::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::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::Dot::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Arrow::flushSVG(), postscriptProperties(), svgProperties(), and tikzProperties().
|
protected |
The line thickness.
Definition at line 298 of file Board/Shapes.h.
Referenced by LibBoard::Dot::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Ellipse::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::Dot::flushCairo(), LibBoard::Line::flushCairo(), LibBoard::Arrow::flushCairo(), LibBoard::Polyline::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Ellipse::flushCairo(), LibBoard::Circle::flushCairo(), LibBoard::Arc::flushCairo(), LibBoard::Dot::flushFIG(), LibBoard::Line::flushFIG(), LibBoard::Arrow::flushFIG(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Text::flushFIG(), LibBoard::Dot::flushPostscript(), LibBoard::Line::flushPostscript(), LibBoard::Arrow::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), LibBoard::Ellipse::flushPostscript(), LibBoard::Arc::flushPostscript(), LibBoard::Text::flushPostscript(), LibBoard::Arrow::flushSVG(), LibBoard::Text::flushSVG(), penColor(), svgProperties(), and tikzProperties().