DGtal 1.3.0
|
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 () |
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 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 |
|
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.
Reimplemented in LibBoard::GouraudTriangle.
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, LibBoard::Image, LibBoard::Triangle, and LibBoard::GouraudTriangle.
Definition at line 1731 of file Shapes.cpp.
|
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::Rectangle, LibBoard::Image, LibBoard::QuadraticBezierCurve, and LibBoard::GouraudTriangle.
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::Rectangle, LibBoard::Image, LibBoard::QuadraticBezierCurve, and LibBoard::GouraudTriangle.
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(), and LibBoard::GouraudTriangle::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, and LibBoard::GouraudTriangle.
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::Rectangle, LibBoard::Image, LibBoard::QuadraticBezierCurve, and LibBoard::GouraudTriangle.
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::Rectangle::flushSVG(), and LibBoard::GouraudTriangle::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::Rectangle, LibBoard::Image, LibBoard::QuadraticBezierCurve, and LibBoard::GouraudTriangle.
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::Rectangle, LibBoard::Image, LibBoard::Triangle, LibBoard::QuadraticBezierCurve, and LibBoard::GouraudTriangle.
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.
Reimplemented in LibBoard::GouraudTriangle.
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.
Reimplemented in LibBoard::GouraudTriangle.
Definition at line 1660 of file Shapes.cpp.
References _path, and LibBoard::Path::rotate().
Referenced by LibBoard::Triangle::rotated(), rotated(), and LibBoard::Rectangle::rotated().
Polyline LibBoard::Polyline::rotated | ( | double | angle | ) | const |
angle | angle |
center | center |
Definition at line 1667 of file Shapes.cpp.
References 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(), scaled(), LibBoard::Rectangle::scaled(), LibBoard::Triangle::scaled(), and LibBoard::GouraudTriangle::scaled().
|
virtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Rectangle, and LibBoard::GouraudTriangle.
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 scale().
Polyline LibBoard::Polyline::scaled | ( | double | sx, |
double | sy | ||
) | const |
sx | sx |
sy | sy |
Definition at line 1713 of file Shapes.cpp.
References scale().
|
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(), LibBoard::Rectangle::translated(), LibBoard::Triangle::translated(), and LibBoard::GouraudTriangle::translated().
Polyline LibBoard::Polyline::translated | ( | double | dx, |
double | dy | ||
) | const |
dx | dx |
dy | dy |
Definition at line 1693 of file Shapes.cpp.
References translate().
|
staticprivate |
|
protected |
Definition at line 905 of file Board/Shapes.h.
Referenced by LibBoard::Rectangle::bottomLeft(), LibBoard::Rectangle::bottomRight(), boundingBox(), center(), LibBoard::GouraudTriangle::center(), flushCairo(), LibBoard::Rectangle::flushCairo(), LibBoard::Image::flushCairo(), LibBoard::QuadraticBezierCurve::flushCairo(), flushFIG(), LibBoard::Rectangle::flushFIG(), LibBoard::Image::flushFIG(), LibBoard::GouraudTriangle::flushFIG(), flushPostscript(), LibBoard::QuadraticBezierCurve::flushPostscript(), LibBoard::GouraudTriangle::flushPostscript(), flushSVG(), LibBoard::Rectangle::flushSVG(), LibBoard::Image::flushSVG(), LibBoard::QuadraticBezierCurve::flushSVG(), LibBoard::GouraudTriangle::flushSVG(), flushTikZ(), LibBoard::Rectangle::flushTikZ(), LibBoard::Image::flushTikZ(), LibBoard::QuadraticBezierCurve::flushTikZ(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::Rectangle::height(), operator<<(), operator[](), rotate(), LibBoard::GouraudTriangle::rotate(), scale(), scaleAll(), LibBoard::Rectangle::scaleAll(), LibBoard::GouraudTriangle::scaleAll(), LibBoard::Rectangle::topLeft(), LibBoard::Rectangle::topRight(), translate(), LibBoard::Triangle::Triangle(), LibBoard::Rectangle::width(), LibBoard::Rectangle::x(), and LibBoard::Rectangle::y().