Board
0.6.devel
|
#include <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 | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const |
Rect | boundingBox () const |
Line * | clone () const |
![]() | |
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 |
![]() | |
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 | |
![]() | |
enum | LineCap { ButtCap = 0, RoundCap, SquareCap } |
enum | LineJoin { MiterJoin = 0, RoundJoin, BevelJoin } |
enum | LineStyle { SolidStyle = 0, DashStyle, DotStyle, DashDotStyle, DashDotDotStyle, DashDotDotDotStyle } |
![]() | |
std::string | svgProperties (const TransformSVG &transform) const |
std::string | postscriptProperties () const |
std::string | tikzProperties (const TransformTikZ &transform) const |
A line between two points.
The line structure.
|
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. |
depth | The depth of the line. |
Referenced by clone().
|
virtual |
Returns the bounding box of the figure.
Implements LibBoard::Shape.
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.
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.
References Line().
|
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. |
Implements LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::Shape::_depth, LibBoard::Shape::_lineCap, LibBoard::Shape::_lineJoin, LibBoard::Shape::_lineStyle, LibBoard::Shape::_lineWidth, LibBoard::Shape::_penColor, _x1, _x2, _y1, _y2, LibBoard::TransformFIG::mapDepth(), LibBoard::TransformFIG::mapWidth(), LibBoard::Transform::mapX(), and LibBoard::TransformFIG::mapY().
|
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.
References LibBoard::Shape::_penColor, _x1, _x2, _y1, _y2, LibBoard::Transform::mapX(), LibBoard::TransformEPS::mapY(), 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.
References _x1, _x2, _y1, _y2, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), 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.
References _x1, _x2, _y1, _y2, LibBoard::Transform::mapX(), LibBoard::TransformSVG::mapY(), 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.
References _name.
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
References _x1, _x2, _y1, _y2, LibBoard::Point::get(), and LibBoard::Point::rotate().
Referenced by rotate().
|
virtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
Returns a copy of the line, rotated around a given rotation center.
angle | The rotation angle. |
center | The center of rotation. |
Reimplemented in LibBoard::Arrow.
References _x1, _x2, _y1, _y2, LibBoard::Point::get(), and LibBoard::Point::rotate().
Line LibBoard::Line::rotated | ( | double | angle | ) | const |
Returns a copy of the line, rotated around its center.
angle | The angle of rotation. |
Reimplemented in LibBoard::Arrow.
References _x1, _x2, _y1, _y2, center(), LibBoard::Point::get(), and LibBoard::Point::rotate().
|
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.
References _x1, _x2, _y1, _y2, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale().
|
virtual |
Scale the shape along both axis.
s | The scale factor along both axis. |
Implements LibBoard::Shape.
References scale().
|
virtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
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. |
Reimplemented in LibBoard::Arrow.
References _x1, _x2, _y1, _y2, center(), translate(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scaled().
Line LibBoard::Line::scaled | ( | double | s | ) | const |
Reimplemented in LibBoard::Arrow.
References scaled().
|
virtual |
Translate the shape by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
References _x1, _x2, _y1, and _y2.
Referenced by scale(), scaled(), and LibBoard::Arrow::scaled().
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. |
Reimplemented in LibBoard::Arrow.
|
staticprivate |
The generic name of the shape.
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
Referenced by name().
|
protected |
First coordinate of the start point.
Referenced by boundingBox(), center(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), LibBoard::Arrow::flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), scaled(), LibBoard::Arrow::scaled(), translate(), translated(), and LibBoard::Arrow::translated().
|
protected |
First coordinate of the end point.
Referenced by boundingBox(), center(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), scaled(), LibBoard::Arrow::scaled(), translate(), translated(), and LibBoard::Arrow::translated().
|
protected |
Second coordinate of the start point.
Referenced by boundingBox(), center(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), LibBoard::Arrow::flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), scaled(), LibBoard::Arrow::scaled(), translate(), translated(), and LibBoard::Arrow::translated().
|
protected |
Second coordinate of the end point.
Referenced by boundingBox(), center(), flushFIG(), LibBoard::Arrow::flushFIG(), flushPostscript(), LibBoard::Arrow::flushPostscript(), flushSVG(), LibBoard::Arrow::flushSVG(), flushTikZ(), rotate(), rotated(), LibBoard::Arrow::rotated(), scale(), scaleAll(), scaled(), LibBoard::Arrow::scaled(), translate(), translated(), and LibBoard::Arrow::translated().