Board 0.9.6
|
A line between two points. More...
#include <Line.h>
Public Member Functions | |
Line (double x1, double y1, double x2, double y2, Color color, double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle(), const LineCap cap=Style::defaultLineCap(), const LineJoin join=Style::defaultLineJoin()) | |
Line (double x1, double y1, double x2, double y2, const Style &style) | |
Line (Point a, Point b, Color color, double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle(), const LineCap cap=Style::defaultLineCap(), const LineJoin join=Style::defaultLineJoin()) | |
Line (Point a, Point b, const Style &style) | |
const std::string & | name () const override |
Line & | rotate (double angle, const Point ¢er) override |
Line | rotated (double angle, const Point ¢er) const |
Line & | rotate (double angle) override |
Line | rotated (double angle) const |
Line & | translate (double dx, double dy) override |
Line | translated (double dx, double dy) const |
Line & | scale (double sx, double sy) override |
Line & | scale (double s) override |
Line | scaled (double sx, double sy) const |
Line | scaled (double s) const |
void | scaleAll (double s) override |
Line | resized (double w, double h, LineWidthFlag lineWidthFlag) const |
Rect | boundingBox (LineWidthFlag) const override |
Line * | clone () const override |
void | flushPostscript (std::ostream &stream, const TransformEPS &transform) const override |
void | flushFIG (std::ostream &stream, const TransformFIG &transform, std::map< Color, int > &colormap) const override |
void | flushSVG (std::ostream &stream, const TransformSVG &transform) const override |
void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const override |
virtual void | accept (ShapeVisitor &visitor) override |
Accepts a visitor object. | |
virtual void | accept (const ShapeVisitor &visitor) override |
Accepts a visitor object. | |
virtual void | accept (ConstShapeVisitor &visitor) const override |
Accepts a const-shape visitor object. | |
virtual void | accept (const ConstShapeVisitor &visitor) const override |
Accepts a const-shape visitor object. | |
virtual Shape * | accept (CompositeShapeTransform &transform) const override |
Accept a composite shape transform. | |
virtual Shape * | accept (const CompositeShapeTransform &transform) const override |
Accept a constant composite shape transform. | |
const Point & | a () const |
const Point & | b () const |
Line (const Line &other) | |
Line (Line &&)=default | |
Line & | operator= (const Line &line) |
~Line () override=default | |
Public Member Functions inherited from LibBoard::ShapeWithStyle | |
ShapeWithStyle (Color penColor, Color fillColor, double lineWidth, LineStyle style, const LineCap cap, const LineJoin join) | |
ShapeWithStyle (const Style &style) | |
ShapeWithStyle (const ShapeWithStyle &other) | |
ShapeWithStyle & | operator= (const ShapeWithStyle &other) |
~ShapeWithStyle () | |
const std::string & | name () const |
Shape * | clone () const =0 |
const Color & | penColor () const |
ShapeWithStyle & | setPenColor (const Color &) |
const Color & | fillColor () const |
ShapeWithStyle & | setFillColor (const Color &) |
double | lineWidth () const |
ShapeWithStyle & | setLineWidth (double) |
LineStyle | lineStyle () const |
ShapeWithStyle & | setLineStyle (LineStyle) |
LineCap | lineCap () const |
ShapeWithStyle & | setLineCap (LineCap) |
LineJoin | lineJoin () const |
ShapeWithStyle & | setLineJoin (LineJoin) |
Style | style () const |
ShapeWithStyle & | setStyle (const Style &) |
bool | filled () const |
Public Member Functions inherited from LibBoard::Shape | |
Shape () | |
virtual | ~Shape () |
virtual const std::string & | name () const |
virtual Shape * | clone () const =0 |
virtual Point | center (LineWidthFlag lineWidthFlag=IgnoreLineWidth) const |
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 |
Shape & | moveCenter (double x, double y, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
Shape & | moveCenter (Point p, LineWidthFlag lineWidthFlag=IgnoreLineWidth) |
virtual Shape & | scale (double sx, double sy)=0 |
virtual Shape & | scale (double s)=0 |
Shape & | resize (double width, double height, LineWidthFlag lineWidthFlag) |
Shape & | scaleToWidth (double w, LineWidthFlag lineWidthFlag) |
Shape & | scaleToHeight (double h, LineWidthFlag lineWidthFlag) |
virtual Rect | boundingBox (LineWidthFlag) const =0 |
Rect | bbox (LineWidthFlag) const |
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< Color, int > &colormap) const =0 |
virtual void | flushSVG (std::ostream &stream, const TransformSVG &transform) const =0 |
virtual void | flushTikZ (std::ostream &stream, const TransformTikZ &transform) const =0 |
virtual void | accept (ShapeVisitor &visitor) |
Accepts a visitor object. | |
virtual void | accept (const ShapeVisitor &visitor) |
Accepts a visitor object. | |
virtual void | accept (ConstShapeVisitor &visitor) const |
Accepts a const-shape visitor object. | |
virtual void | accept (const ConstShapeVisitor &visitor) const |
Accepts a const-shape visitor object. | |
virtual Shape * | accept (CompositeShapeTransform &transform) const |
Accept a composite shape transform. | |
virtual Shape * | accept (const CompositeShapeTransform &transform) const |
Accept a constant composite shape transform. | |
Shape (const Shape &other) | |
Protected Attributes | |
Point | _a |
Point | _b |
Protected Attributes inherited from LibBoard::ShapeWithStyle | |
Style | _style |
Additional Inherited Members | |
Static Public Member Functions inherited from LibBoard::ShapeWithStyle | |
static void | setLineWidthScaling (bool) |
Protected Member Functions inherited from LibBoard::ShapeWithStyle | |
void | updateLineWidth (double s) |
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. |
lineStyle | The line style. |
cap | The line cap. |
join | The line join. |
|
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. |
style | The shape style. |
|
inline |
Constructs a line.
a | First extremity. |
b | Second extremity. |
color | The color of the line. |
lineWidth | The line thickness. |
lineStyle | The line style. |
cap | The line cap. |
join | The line join. |
Constructs a line.
a | First extremity. |
b | Second extremity. |
style | The shape style. |
LibBoard::Line::Line | ( | const Line & | other | ) |
|
default |
|
overridedefault |
|
inline |
The first extremity of the line.
References _a.
Referenced by LibBoard::Arrow::flushFIG(), flushFIG(), flushPostscript(), flushSVG(), LibBoard::Arrow::flushTikZ(), flushTikZ(), LibBoard::RoughVisitor::map(), and LibBoard::RoughVisitor::map().
|
overridevirtual |
Accept a composite shape transform.
transform | A composite shape transform object. |
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accept a constant composite shape transform.
transform | A constant composite shape transform object.. |
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
Reimplemented in LibBoard::Arrow.
References LibBoard::ShapeVisitor::visit().
Referenced by slide().
|
inline |
The second extremity of the line.
References _b.
Referenced by LibBoard::Arrow::flushFIG(), flushFIG(), flushPostscript(), flushSVG(), LibBoard::Arrow::flushTikZ(), flushTikZ(), LibBoard::RoughVisitor::map(), and LibBoard::RoughVisitor::map().
|
overridevirtual |
Returns the bounding box of the line.
Implements LibBoard::Shape.
References _a, _b, LibBoard::Path::boundingBox(), LibBoard::IgnoreLineWidth, LibBoard::ShapeWithStyle::lineCap(), LibBoard::ShapeWithStyle::lineJoin(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::Tools::pathBoundingBox(), and LibBoard::UseLineWidth.
Referenced by main().
|
overridevirtual |
Return a copy of the shape.
Implements LibBoard::ShapeWithStyle.
Referenced by LibBoard::RoughVisitor::map().
|
overridevirtual |
Write 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 |
Implements LibBoard::Shape.
References _a, _b, a(), b(), LibBoard::ShapeWithStyle::lineCap(), LibBoard::ShapeWithStyle::lineJoin(), LibBoard::ShapeWithStyle::lineStyle(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::Transform::map(), LibBoard::TransformFIG::mapWidth(), LibBoard::ShapeWithStyle::penColor(), LibBoard::TransformFIG::shapeDepth(), LibBoard::Color::valid(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
Write 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.
References _a, _b, LibBoard::ShapeWithStyle::_style, a(), b(), LibBoard::Transform::map(), LibBoard::ShapeWithStyle::penColor(), LibBoard::Color::postscript(), LibBoard::Style::postscriptProperties(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
Write 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.
References _a, _b, LibBoard::ShapeWithStyle::_style, a(), b(), LibBoard::Transform::map(), LibBoard::Style::svgProperties(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by LibBoard::Arrow::flushSVG().
|
overridevirtual |
Write 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.
References _a, _b, LibBoard::ShapeWithStyle::_style, a(), b(), LibBoard::Transform::map(), LibBoard::Style::tikzProperties(), LibBoard::Point::x, and LibBoard::Point::y.
|
overridevirtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
Line LibBoard::Line::resized | ( | double | w, |
double | h, | ||
LineWidthFlag | lineWidthFlag | ||
) | const |
Returns a resized copy of the line.
w | Width of the new line. |
h | Height of the new line. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References LibBoard::Shape::resize().
|
overridevirtual |
Rotate the shape around its center.
angle | The rotation angle in radian. |
Implements LibBoard::Shape.
References LibBoard::Shape::center(), and rotate().
Rotate the shape around a given center of rotation.
angle | The rotation angle in radian. |
center | The center of rotation. |
Implements LibBoard::Shape.
References _a, _b, LibBoard::Shape::center(), and LibBoard::Point::rotated().
Referenced by main(), rotate(), LibBoard::Arrow::rotated(), and LibBoard::Arrow::rotated().
Line LibBoard::Line::rotated | ( | double | angle | ) | const |
Returns a copy of the line, rotated around its center.
angle | The angle of rotation. |
References _a, _b, LibBoard::Shape::center(), and LibBoard::Point::rotated().
Returns a copy of the line, rotated around a given rotation center.
angle | The rotation angle. |
center | The center of rotation. |
References _a, _b, LibBoard::Shape::center(), and LibBoard::Point::rotated().
Referenced by main().
|
overridevirtual |
Scale the line, given a scaling factor.
s | Scaling factor. |
Implements LibBoard::Shape.
References scale().
|
overridevirtual |
Scale the line, given two scaling factors.
sx | Scaling factor along the x axis. |
sy | Scaling factor along the y axis. |
Implements LibBoard::Shape.
References _a, _b, LibBoard::Shape::center(), translate(), LibBoard::ShapeWithStyle::updateLineWidth(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale(), LibBoard::Arrow::scaled(), scaled(), and strikeOut().
|
overridevirtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
s | The scaling factor. |
Implements LibBoard::Shape.
References _a, _b, LibBoard::Point::x, and LibBoard::Point::y.
Line LibBoard::Line::scaled | ( | double | s | ) | const |
Returns a scaled copy of the line.
s | The scaling factor. |
References scaled().
Line LibBoard::Line::scaled | ( | double | sx, |
double | sy | ||
) | const |
|
overridevirtual |
Translate the line by a given offset.
dx | The x offset. |
dy | The y offset. |
Implements LibBoard::Shape.
References _a, _b, and LibBoard::Point::translate().
Referenced by LibBoard::grid(), main(), scale(), and LibBoard::Arrow::translated().
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. |
References _a, _b, and LibBoard::Point::translate().
|
protected |
Start point.
Referenced by a(), LibBoard::Arrow::boundingBox(), boundingBox(), LibBoard::Arrow::extremity(), LibBoard::Arrow::flushFIG(), flushFIG(), LibBoard::Arrow::flushPostscript(), flushPostscript(), LibBoard::Arrow::flushSVG(), flushSVG(), LibBoard::Arrow::flushTikZ(), flushTikZ(), operator=(), rotate(), rotated(), rotated(), scale(), scaleAll(), translate(), and translated().
|
protected |
End point.
Referenced by b(), boundingBox(), LibBoard::Arrow::extremity(), LibBoard::Arrow::flushFIG(), flushFIG(), LibBoard::Arrow::flushPostscript(), flushPostscript(), LibBoard::Arrow::flushSVG(), flushSVG(), LibBoard::Arrow::flushTikZ(), flushTikZ(), operator=(), rotate(), rotated(), rotated(), scale(), scaleAll(), translate(), and translated().