A line between two points. More...
#include <Shapes.h>
Public Member Functions | |
| Line (double x1, double y1, double x2, double y2, 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< Color, int > &colormap) const |
| void | flushSVG (std::ostream &stream, const TransformSVG &transform) const |
| Rect | boundingBox () const |
| Line * | clone () const |
Protected Attributes | |
| double | _x1 |
| double | _y1 |
| double | _x2 |
| double | _y2 |
A line between two points.
The line structure.
examples/ellipse.cpp, examples/example4.cpp, examples/koch.cpp, examples/logo.cpp, and examples/ruler.cpp.
| LibBoard::Line::Line | ( | double | x1, | |
| double | y1, | |||
| double | x2, | |||
| double | y2, | |||
| Color | color, | |||
| double | lineWidth, | |||
| const LineStyle | style = SolidStyle, |
|||
| const LineCap | cap = ButtCap, |
|||
| const LineJoin | join = MiterJoin, |
|||
| int | depth = -1 | |||
| ) | [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().
| Rect LibBoard::Line::boundingBox | ( | ) | const [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.
| Point LibBoard::Line::center | ( | ) | const [virtual] |
Returns the gravity center of the shape.
Implements LibBoard::Shape.
References _x1, _x2, _y1, and _y2.
Referenced by rotate(), LibBoard::Arrow::rotated(), rotated(), scale(), LibBoard::Arrow::scaled(), and scaled().
| Line * LibBoard::Line::clone | ( | ) | const [virtual] |
Return a copy of the shape.
Implements LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References Line().
| void LibBoard::Line::flushFIG | ( | std::ostream & | stream, | |
| const TransformFIG & | transform, | |||
| std::map< Color, int > & | colormap | |||
| ) | const [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, and _y2.
| void LibBoard::Line::flushPostscript | ( | std::ostream & | stream, | |
| const TransformEPS & | transform | |||
| ) | const [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, and LibBoard::Shape::postscriptProperties().
| void LibBoard::Line::flushSVG | ( | std::ostream & | stream, | |
| const TransformSVG & | transform | |||
| ) | const [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, and LibBoard::Shape::svgProperties().
| const std::string & LibBoard::Line::name | ( | ) | const [virtual] |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
| Line & LibBoard::Line::rotate | ( | double | angle | ) | [virtual] |
Rotate the shape around its center.
| angle | The rotation angle in radian. |
Implements LibBoard::Shape.
| Line LibBoard::Line::rotated | ( | double | angle | ) | const |
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.
| Shape & LibBoard::Line::scale | ( | double | s | ) | [virtual] |
Scale the shape along both axis.
| s | The scale factor along both axis. |
Implements LibBoard::Shape.
References scale().
| Shape & LibBoard::Line::scale | ( | double | sx, | |
| double | sy | |||
| ) | [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().
| void LibBoard::Line::scaleAll | ( | double | s | ) | [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.
| Line & LibBoard::Line::translate | ( | double | dx, | |
| double | dy | |||
| ) | [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(), LibBoard::Arrow::scaled(), and 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.
double LibBoard::Line::_x1 [protected] |
First coordinate of the start point.
Referenced by boundingBox(), center(), LibBoard::Arrow::flushFIG(), flushFIG(), LibBoard::Arrow::flushPostscript(), flushPostscript(), LibBoard::Arrow::flushSVG(), flushSVG(), rotate(), LibBoard::Arrow::rotated(), rotated(), scale(), scaleAll(), LibBoard::Arrow::scaled(), scaled(), translate(), LibBoard::Arrow::translated(), and translated().
double LibBoard::Line::_x2 [protected] |
First coordinate of the end point.
Referenced by boundingBox(), center(), LibBoard::Arrow::flushFIG(), flushFIG(), LibBoard::Arrow::flushPostscript(), flushPostscript(), LibBoard::Arrow::flushSVG(), flushSVG(), rotate(), LibBoard::Arrow::rotated(), rotated(), scale(), scaleAll(), LibBoard::Arrow::scaled(), scaled(), translate(), LibBoard::Arrow::translated(), and translated().
double LibBoard::Line::_y1 [protected] |
Second coordinate of the start point.
Referenced by boundingBox(), center(), LibBoard::Arrow::flushFIG(), flushFIG(), LibBoard::Arrow::flushPostscript(), flushPostscript(), LibBoard::Arrow::flushSVG(), flushSVG(), rotate(), LibBoard::Arrow::rotated(), rotated(), scale(), scaleAll(), LibBoard::Arrow::scaled(), scaled(), translate(), LibBoard::Arrow::translated(), and translated().
double LibBoard::Line::_y2 [protected] |
Second coordinate of the end point.
Referenced by boundingBox(), center(), LibBoard::Arrow::flushFIG(), flushFIG(), LibBoard::Arrow::flushPostscript(), flushPostscript(), LibBoard::Arrow::flushSVG(), flushSVG(), rotate(), LibBoard::Arrow::rotated(), rotated(), scale(), scaleAll(), LibBoard::Arrow::scaled(), scaled(), translate(), LibBoard::Arrow::translated(), and translated().
1.6.3