DGtal
1.5.beta
|
A line between two points. More...
#include <Board/Shapes.h>
Public Member Functions | |
Line (double x1, double y1, double x2, double y2, DGtal::Color color, double lineWidth, const LineStyle style=SolidStyle, const LineCap cap=ButtCap, const LineJoin join=MiterJoin, int depth=-1) | |
const std::string & | name () const |
Point | center () const |
Line & | rotate (double angle, const Point ¢er) |
Line | rotated (double angle, const Point ¢er) const |
Line & | rotate (double angle) |
Line | rotated (double angle) const |
Line & | translate (double dx, double dy) |
Line | translated (double dx, double dy) const |
Shape & | scale (double sx, double sy) |
Shape & | scale (double s) |
Line | scaled (double sx, double sy) const |
Line | 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 |
Line * | 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 | |
double | _x1 |
double | _y1 |
double | _x2 |
double | _y2 |
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 |
|
inline |
Constructs a line.
x1 | First coordinate of the start point. |
y1 | Second coordinate of the start point. |
x2 | First coordinate of the end point. |
y2 | Second coordinate of the end point. |
color | The color of the line. |
lineWidth | The line thickness. |
style | The line style. |
cap | The line cap. |
join | The line join. |
depth | The depth of the line. |
Referenced by clone().
|
virtual |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
Definition at line 604 of file Shapes.cpp.
References _x1, _x2, _y1, _y2, LibBoard::Rect::height, LibBoard::Rect::left, LibBoard::Rect::top, and LibBoard::Rect::width.
|
virtual |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
Definition at line 402 of file Shapes.cpp.
References _x1, _x2, _y1, and _y2.
Referenced by rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaled(), and LibBoard::Arrow::scaled().
|
virtual |
Return a copy of the shape.
Implements LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
Definition at line 509 of file Shapes.cpp.
References Line().
|
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::Arrow.
Definition at line 571 of file Shapes.cpp.
References LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _x1, _x2, _y1, _y2, DGtal::Color::blue(), DGtal::Color::green(), DGtal::Color::red(), and LibBoard::Shape::setCairoDashStyle().
|
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::Arrow.
Definition at line 529 of file Shapes.cpp.
References LibBoard::Shape::_depth, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _x1, _x2, _y1, _y2, and DGtal::Color::valid().
|
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::Arrow.
Definition at line 514 of file Shapes.cpp.
References LibBoard::Shape::_penColor, _x1, _x2, _y1, _y2, DGtal::Color::postscript(), and LibBoard::Shape::postscriptProperties().
|
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::Arrow.
Definition at line 558 of file Shapes.cpp.
References _x1, _x2, _y1, _y2, and LibBoard::Shape::svgProperties().
|
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::Arrow.
Definition at line 593 of file Shapes.cpp.
References _x1, _x2, _y1, _y2, and LibBoard::Shape::tikzProperties().
|
virtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
Definition at line 396 of file Shapes.cpp.
References _name.
|
virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Definition at line 415 of file Shapes.cpp.
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 407 of file Shapes.cpp.
References _x1, _x2, _y1, and _y2.
Referenced by rotate().
Line LibBoard::Line::rotated | ( | double | angle | ) | const |
Returns a copy of the line, rotated around its center.
angle | The angle of rotation. |
Definition at line 430 of file Shapes.cpp.
Returns a copy of the line, rotated around a given rotation center.
angle | The rotation angle. |
center | The center of rotation. |
Definition at line 421 of file Shapes.cpp.
|
virtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
Definition at line 474 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 461 of file Shapes.cpp.
References _x1, _x2, _y1, _y2, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale().
|
virtual |
Line LibBoard::Line::scaled | ( | double | s | ) | const |
Line LibBoard::Line::scaled | ( | double | sx, |
double | sy | ||
) | const |
Returns a scaled copy of the line.
sx | Scale factor along the x axis. |
sy | Scale factor along the y axis. |
Definition at line 481 of file Shapes.cpp.
References center(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scaled().
|
virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
Definition at line 440 of file Shapes.cpp.
References _x1, _x2, _y1, and _y2.
Referenced by scale().
Line LibBoard::Line::translated | ( | double | dx, |
double | dy | ||
) | const |
Returns a translated copy of the line.
dx | The shift along the x axis. |
dy | The shift along the y axis. |
Definition at line 450 of file Shapes.cpp.
|
staticprivate |
|
protected |
First coordinate of the start point.
Definition at line 652 of file Board/Shapes.h.
Referenced by boundingBox(), center(), flushCairo(), LibBoard::Arrow::flushCairo(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), LibBoard::Arrow::flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), and translate().
|
protected |
First coordinate of the end point.
Definition at line 654 of file Board/Shapes.h.
Referenced by boundingBox(), center(), flushCairo(), LibBoard::Arrow::flushCairo(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), LibBoard::Arrow::flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), and translate().
|
protected |
Second coordinate of the start point.
Definition at line 653 of file Board/Shapes.h.
Referenced by boundingBox(), center(), flushCairo(), LibBoard::Arrow::flushCairo(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), LibBoard::Arrow::flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), and translate().
|
protected |
Second coordinate of the end point.
Definition at line 655 of file Board/Shapes.h.
Referenced by boundingBox(), center(), flushCairo(), LibBoard::Arrow::flushCairo(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), LibBoard::Arrow::flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), and translate().