DGtal 1.4.2
|
A polygonal line described by a series of 2D points. More...
#include <Board/Shapes.h>
Public Member Functions | |
Polyline (const std::vector< Point > &points, bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1) | |
Polyline (const Path &path, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1) | |
Polyline (bool closed, DGtal::Color penColor, DGtal::Color fillColor, double lineWidth, const LineStyle lineStyle=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1) | |
const std::string & | name () const |
Point | center () const |
Polyline & | operator<< (const Point &p) |
Point & | operator[] (const unsigned int n) |
Polyline & | rotate (double angle, const Point ¢er) |
Polyline | rotated (double angle, const Point ¢er) const |
Polyline & | rotate (double angle) |
Polyline | rotated (double angle) const |
Polyline & | translate (double dx, double dy) |
Polyline | translated (double dx, double dy) const |
Shape & | scale (double sx, double sy) |
Shape & | scale (double s) |
Polyline | scaled (double sx, double sy) const |
Polyline | scaled (double s) 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 | flushCairo (cairo_t *cr, const TransformCairo &transform) const |
void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const |
Rect | boundingBox () const |
Polyline * | clone () const |
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 |
Shape & | rotateDeg (double angle, const Point ¢er) |
Shape & | rotateDeg (double angle) |
Rect | bbox () |
Shape & | operator-- () |
Shape & | operator++ () |
int | depth () const |
virtual void | depth (int) |
virtual void | shiftDepth (int shift) |
const DGtal::Color & | penColor () const |
const DGtal::Color & | fillColor () const |
Protected Attributes | |
Path | _path |
Protected Attributes inherited from LibBoard::Shape | |
int | _depth |
DGtal::Color | _penColor |
DGtal::Color | _fillColor |
double | _lineWidth |
LineStyle | _lineStyle |
LineCap | _lineCap |
LineJoin | _lineJoin |
Static Private Attributes | |
static const std::string | _name |
Additional Inherited Members | |
Public Types inherited from LibBoard::Shape | |
enum | LineCap { ButtCap = 0 , RoundCap , SquareCap } |
enum | LineJoin { MiterJoin = 0 , RoundJoin , BevelJoin } |
enum | LineStyle { SolidStyle = 0 , DashStyle , DotStyle , DashDotStyle , DashDotDotStyle , DashDotDotDotStyle } |
Protected Member Functions inherited from LibBoard::Shape | |
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 |
A polygonal line described by a series of 2D points.
The polyline structure.
Definition at line 765 of file Board/Shapes.h.
|
inline |
Referenced by clone(), LibBoard::GouraudTriangle::flushFIG(), rotated(), rotated(), scaled(), scaled(), and translated().
|
inline |
|
inline |
|
virtual |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
Definition at line 1867 of file Shapes.cpp.
References _path, and LibBoard::Path::boundingBox().
|
virtual |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
Definition at line 1655 of file Shapes.cpp.
References _path, and LibBoard::Path::center().
Referenced by rotate(), rotated(), and LibBoard::Rectangle::rotated().
|
virtual |
Return a copy of the shape.
Implements LibBoard::Shape.
Reimplemented in LibBoard::Rectangle, and LibBoard::Triangle.
Definition at line 1731 of file Shapes.cpp.
References Polyline().
|
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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::QuadraticBezierCurve, and LibBoard::Rectangle.
Definition at line 1809 of file Shapes.cpp.
References LibBoard::Shape::_fillColor, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, _path, LibBoard::Shape::_penColor, DGtal::Color::blue(), LibBoard::Path::closed(), LibBoard::Path::empty(), LibBoard::Shape::filled(), LibBoard::Path::flushCairoPoints(), DGtal::Color::green(), DGtal::Color::None, DGtal::Color::red(), and LibBoard::Shape::setCairoDashStyle().
Referenced by LibBoard::Rectangle::flushCairo().
|
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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::QuadraticBezierCurve, and LibBoard::Rectangle.
Definition at line 1760 of file Shapes.cpp.
References LibBoard::Shape::_depth, LibBoard::Shape::_fillColor, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, _path, LibBoard::Shape::_penColor, LibBoard::Path::closed(), LibBoard::Path::empty(), LibBoard::Shape::filled(), LibBoard::Path::flushFIG(), LibBoard::Path::size(), and DGtal::Color::valid().
Referenced by LibBoard::Rectangle::flushFIG().
|
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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::QuadraticBezierCurve.
Definition at line 1736 of file Shapes.cpp.
References LibBoard::Shape::_fillColor, _path, LibBoard::Shape::_penColor, LibBoard::Path::empty(), LibBoard::Shape::filled(), DGtal::Color::flushPostscript(), LibBoard::Path::flushPostscript(), DGtal::Color::None, and LibBoard::Shape::postscriptProperties().
Referenced by LibBoard::GouraudTriangle::flushPostscript().
|
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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::QuadraticBezierCurve, and LibBoard::Rectangle.
Definition at line 1792 of file Shapes.cpp.
References _path, LibBoard::Path::closed(), LibBoard::Path::empty(), LibBoard::Path::flushSVGPoints(), and LibBoard::Shape::svgProperties().
Referenced by LibBoard::GouraudTriangle::flushSVG(), and LibBoard::Rectangle::flushSVG().
|
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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::QuadraticBezierCurve, and LibBoard::Rectangle.
Definition at line 1850 of file Shapes.cpp.
References _path, LibBoard::Path::closed(), LibBoard::Path::empty(), LibBoard::Path::flushTikZPoints(), and LibBoard::Shape::tikzProperties().
Referenced by LibBoard::Rectangle::flushTikZ().
|
virtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::QuadraticBezierCurve, LibBoard::Rectangle, and LibBoard::Triangle.
Definition at line 1642 of file Shapes.cpp.
References _name.
Add a point to the polyline.
p | point to add |
Definition at line 1647 of file Shapes.cpp.
References _path.
|
inline |
Returns the n-th point of the polyline.
n | index |
Definition at line 815 of file Board/Shapes.h.
References _path.
|
virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Definition at line 1673 of file Shapes.cpp.
References _path, center(), and LibBoard::Path::rotate().
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
Definition at line 1660 of file Shapes.cpp.
References _path, and LibBoard::Path::rotate().
Polyline LibBoard::Polyline::rotated | ( | double | angle | ) | const |
angle | angle |
Definition at line 1680 of file Shapes.cpp.
References center(), Polyline(), and rotate().
angle | angle |
center | center |
Definition at line 1667 of file Shapes.cpp.
References Polyline(), and rotate().
|
virtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
Definition at line 1706 of file Shapes.cpp.
References scale().
|
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. |
Implements LibBoard::Shape.
Definition at line 1699 of file Shapes.cpp.
References _path, and LibBoard::Path::scale().
Referenced by scale().
|
virtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Rectangle.
Definition at line 1725 of file Shapes.cpp.
References _path, and LibBoard::Path::scaleAll().
Polyline LibBoard::Polyline::scaled | ( | double | s | ) | const |
Definition at line 1719 of file Shapes.cpp.
References Polyline().
Polyline LibBoard::Polyline::scaled | ( | double | sx, |
double | sy ) const |
sx | sx |
sy | sy |
Definition at line 1713 of file Shapes.cpp.
References Polyline().
|
virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
Definition at line 1686 of file Shapes.cpp.
References _path, and LibBoard::Path::translate().
Referenced by translated().
Polyline LibBoard::Polyline::translated | ( | double | dx, |
double | dy ) const |
dx | dx |
dy | dy |
Definition at line 1693 of file Shapes.cpp.
References Polyline(), and translate().
|
staticprivate |
|
protected |
Definition at line 905 of file Board/Shapes.h.
Referenced by LibBoard::Rectangle::bottomLeft(), LibBoard::Rectangle::bottomRight(), boundingBox(), LibBoard::GouraudTriangle::center(), center(), LibBoard::Image::flushCairo(), flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::GouraudTriangle::flushFIG(), LibBoard::Image::flushFIG(), flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::GouraudTriangle::flushPostscript(), flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), LibBoard::GouraudTriangle::flushSVG(), LibBoard::Image::flushSVG(), flushSVG(), LibBoard::QuadraticBezierCurve::flushSVG(), LibBoard::Rectangle::flushSVG(), LibBoard::Image::flushTikZ(), flushTikZ(), LibBoard::QuadraticBezierCurve::flushTikZ(), LibBoard::Rectangle::flushTikZ(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::Rectangle::height(), operator<<(), operator[](), LibBoard::GouraudTriangle::rotate(), rotate(), rotate(), scale(), LibBoard::GouraudTriangle::scaleAll(), scaleAll(), LibBoard::Rectangle::scaleAll(), LibBoard::Rectangle::topLeft(), LibBoard::Rectangle::topRight(), translate(), LibBoard::Triangle::Triangle(), LibBoard::Triangle::Triangle(), LibBoard::Rectangle::width(), LibBoard::Rectangle::x(), and LibBoard::Rectangle::y().