Board
0.6.devel
|
#include <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 | 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 |
Abstract structure for a 2D shape.
Shape structure.
|
inline |
Shape constructor.
penColor | The pen color of the shape. |
fillColor | The fill color of the shape. |
lineWidth | The line thickness. |
depth | The depth of the shape. |
|
inlinevirtual |
Shape destructor.
|
inline |
Returns the bounding box of the figure. (Convenience method to call "boundingBox" with a short name.)
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 |
References _depth.
Referenced by LibBoard::ShapeList::addShape(), LibBoard::ShapeList::operator<<(), LibBoard::Board::saveFIG(), and LibBoard::shapeGreaterDepth().
|
virtual |
References _depth.
|
inline |
References _fillColor.
|
inline |
Checks whether a shape is filled with a color or not.
References _fillColor.
Referenced by 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 FIG 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::Ellipse, LibBoard::GouraudTriangle, 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::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::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::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::Triangle, LibBoard::Image, LibBoard::Rectangle, LibBoard::Polyline, LibBoard::Arrow, LibBoard::Line, LibBoard::Dot, LibBoard::Group, and LibBoard::ShapeList.
References _name.
|
inline |
Increment the depth of the shape. (Push the shape toward the background.)
References _depth.
|
inline |
Decrement the depth of the shape. (Pull the shape toward the foreground.)
References _depth.
|
inline |
References _penColor.
|
protected |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as 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().
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::Board, and LibBoard::ShapeList.
Referenced by LibBoard::Board::addDuplicates(), and rotateDeg().
|
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::Board, and LibBoard::ShapeList.
|
inline |
|
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::Board, and LibBoard::ShapeList.
Referenced by LibBoard::Board::addDuplicates().
|
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::Board, and LibBoard::ShapeList.
|
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::ShapeList::addShape(), and LibBoard::Board::State::unit().
|
virtual |
Reimplemented in LibBoard::ShapeList.
References _depth.
|
protected |
Return a string of the svg properties lineWidth, opacity, penColor, fillColor, lineCap, and lineJoin.
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().
|
protected |
Return a string of the properties lineWidth, penColor, lineCap, and lineJoin as TikZ commands.
References _fillColor, _lineCap, _lineJoin, _lineStyle, _lineWidth, _penColor, and LibBoard::TransformSVG::mapWidth().
Referenced by LibBoard::Line::flushTikZ(), LibBoard::Arrow::flushTikZ(), LibBoard::Polyline::flushTikZ(), LibBoard::Rectangle::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::Board, and LibBoard::ShapeList.
Referenced by LibBoard::Board::addDuplicates().
|
protected |
The depth of the shape.
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.
Referenced by fillColor(), filled(), LibBoard::Polyline::flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Ellipse::flushFIG(), LibBoard::Polyline::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.)
Referenced by 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.)
Referenced by 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.).
Referenced by 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.
Referenced by 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 |
The generic name of the shape.
Reimplemented in LibBoard::Text, LibBoard::Arc, 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 name().
|
protected |
The color of the shape.
Referenced by 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::Ellipse::flushPostscript(), LibBoard::Arc::flushPostscript(), LibBoard::Text::flushPostscript(), LibBoard::Arrow::flushSVG(), LibBoard::Text::flushSVG(), penColor(), svgProperties(), and tikzProperties().