Board 0.9.6
|
A line between two points with an arrow at one extremity. More...
#include <Arrow.h>
Public Types | |
enum class | ExtremityType { Stick , Closed , Plain } |
The ExtremityType enum. More... | |
Public Member Functions | |
Arrow (double x1, double y1, double x2, double y2, ExtremityType type=ExtremityType::Plain, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle(), const LineCap cap=Style::defaultLineCap(), const LineJoin join=Style::defaultLineJoin()) | |
Arrow (double x1, double y1, double x2, double y2, ExtremityType type, const Style &style) | |
Arrow (Point p1, Point p2, ExtremityType type=ExtremityType::Plain, Color penColor=Style::defaultPenColor(), Color fillColor=Style::defaultFillColor(), double lineWidth=Style::defaultLineWidth(), const LineStyle lineStyle=Style::defaultLineStyle(), const LineCap cap=Style::defaultLineCap(), const LineJoin join=Style::defaultLineJoin()) | |
Arrow (Point p1, Point p2, ExtremityType type, const Style &style) | |
const std::string & | name () const override |
Arrow | rotated (double angle, const Point ¢er) const |
Arrow | rotated (double angle) const |
Arrow | translated (double dx, double dy) const |
Arrow | scaled (double sx, double sy) const |
Arrow | scaled (double s) const |
Arrow | resized (double w, double h, LineWidthFlag lineWidthFlag) const |
Rect | boundingBox (LineWidthFlag) 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. | |
Arrow * | clone () const override |
Path | extremity () const |
Arrow (const Arrow &)=default | |
Arrow (Arrow &&)=default | |
Arrow & | operator= (Arrow &&)=default |
Arrow & | operator= (const Arrow &)=default |
~Arrow () override=default | |
ExtremityType | type () const |
The extremity type of the arrow. | |
Public Member Functions inherited from LibBoard::Line | |
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) | |
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) |
Protected Attributes inherited from LibBoard::Line | |
Point | _a |
Point | _b |
Protected Attributes inherited from LibBoard::ShapeWithStyle | |
Style | _style |
A line between two points with an arrow at one extremity.
The arrow structure.
|
strong |
|
inline |
Constructs an arrow.
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. |
type | Arrow type. |
penColor | The color of the line. |
fillColor | The fill color of the sharp end. |
lineWidth | The line thickness. |
lineStyle | The line style. |
cap | The line cap. |
join | The line join. |
References LibBoard::ShapeWithStyle::_style, LibBoard::ShapeWithStyle::fillColor(), LibBoard::Style::fillColor, LibBoard::Color::Null, and LibBoard::ShapeWithStyle::penColor().
|
inline |
Constructs an arrow.
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. |
type | Arrow type. |
style | The shape style. |
References LibBoard::ShapeWithStyle::_style, LibBoard::Style::fillColor, LibBoard::Color::Null, LibBoard::Style::penColor, and LibBoard::ShapeWithStyle::style().
|
inline |
Constructs an arrow.
p1 | Start point. |
p2 | End point. |
type | Arrow type. |
penColor | The color of the line. |
fillColor | The fill color of the sharp end. |
lineWidth | The line thickness. |
lineStyle | The line style. |
cap | The line cap. |
join | The line join. |
References LibBoard::ShapeWithStyle::_style, LibBoard::ShapeWithStyle::fillColor(), LibBoard::Style::fillColor, LibBoard::Color::Null, and LibBoard::ShapeWithStyle::penColor().
|
inline |
Constructs an arrow.
p1 | Start point. |
p2 | End point. |
type | Arrow type. |
style | The shape style. |
References LibBoard::ShapeWithStyle::_style, LibBoard::Style::fillColor, LibBoard::Color::Null, LibBoard::Style::penColor, and LibBoard::ShapeWithStyle::style().
|
default |
|
default |
|
overridedefault |
|
overridevirtual |
Accept a composite shape transform.
transform | A composite shape transform object. |
Reimplemented from LibBoard::Line.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accept a constant composite shape transform.
transform | A constant composite shape transform object.. |
Reimplemented from LibBoard::Line.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Line.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Line.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Accepts a const-shape visitor object.
visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Line.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
visitor | A visitor object. |
Reimplemented from LibBoard::Line.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Computes the bounding box of the arrow.
Implements LibBoard::Shape.
References LibBoard::Line::_a, extremity(), LibBoard::ShapeWithStyle::lineCap(), LibBoard::ShapeWithStyle::lineJoin(), LibBoard::ShapeWithStyle::lineWidth(), and LibBoard::Tools::pathBoundingBox().
|
overridevirtual |
Path LibBoard::Arrow::extremity | ( | ) | const |
References LibBoard::Line::_a, LibBoard::Line::_b, LibBoard::Path::Closed, LibBoard::ShapeWithStyle::lineWidth(), and LibBoard::Point::rotated().
Referenced by boundingBox(), flushPostscript(), flushSVG(), and 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 LibBoard::Line::_a, LibBoard::Line::_b, LibBoard::Line::a(), LibBoard::Line::b(), Closed, LibBoard::ShapeWithStyle::fillColor(), LibBoard::ShapeWithStyle::lineCap(), LibBoard::ShapeWithStyle::lineJoin(), LibBoard::ShapeWithStyle::lineStyle(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::Transform::map(), LibBoard::TransformFIG::mapWidth(), LibBoard::ShapeWithStyle::penColor(), Plain, LibBoard::TransformFIG::shapeDepth(), Stick, 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 LibBoard::Line::_a, LibBoard::Line::_b, LibBoard::ShapeWithStyle::_style, Closed, extremity(), LibBoard::Path::flushPostscript(), LibBoard::Polyline::flushPostscript(), LibBoard::Style::lineStyle, LibBoard::Transform::map(), LibBoard::Path::open(), LibBoard::ShapeWithStyle::penColor(), Plain, LibBoard::Color::postscript(), LibBoard::Style::postscriptProperties(), LibBoard::SolidStyle, Stick, LibBoard::ShapeWithStyle::style(), LibBoard::triangle(), LibBoard::Color::White, 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 LibBoard::Line::_a, LibBoard::Line::_b, LibBoard::ShapeWithStyle::_style, Closed, extremity(), LibBoard::Style::fillColor, LibBoard::Line::flushSVG(), LibBoard::Polyline::flushSVG(), LibBoard::Style::lineStyle, LibBoard::Color::Null, LibBoard::Style::penColor, Plain, LibBoard::SolidStyle, Stick, LibBoard::ShapeWithStyle::style(), LibBoard::triangle(), and LibBoard::Color::White.
|
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 LibBoard::Line::_a, LibBoard::Line::_b, LibBoard::ShapeWithStyle::_style, LibBoard::Line::a(), LibBoard::Line::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.
Arrow LibBoard::Arrow::resized | ( | double | w, |
double | h, | ||
LineWidthFlag | lineWidthFlag | ||
) | const |
Returns a resized copy of the arrow.
w | Width of the new arrow. |
h | Height of the new arrow. |
lineWidthFlag | Should the line width be considered when computing bounding boxes. |
References LibBoard::Shape::resize().
Arrow LibBoard::Arrow::rotated | ( | double | angle | ) | const |
Returns a copy of the arrow, rotated around its center.
angle | The angle of rotation. |
References LibBoard::Line::rotate().
Returns a copy of the arrow, rotated around a given rotation center.
angle | The rotation angle. |
center | The center of rotation. |
References LibBoard::Shape::center(), and LibBoard::Line::rotate().
Arrow LibBoard::Arrow::scaled | ( | double | s | ) | const |
Returns a scaled copy of the arrow.
s | The scaling factor. |
References scaled().
Arrow LibBoard::Arrow::scaled | ( | double | sx, |
double | sy | ||
) | const |
Returns a scaled copy of the arrow.
sx | Scaling factor along the x axis. |
sy | scaling factor along the y axis. |
References LibBoard::Line::scale().
Referenced by scaled().
Arrow LibBoard::Arrow::translated | ( | double | dx, |
double | dy | ||
) | const |
Returns a translated copy of the arrow.
dx | The shift along the x axis. |
dy | The shift along the y axis. |
References LibBoard::Line::translate().
Referenced by main().
|
inline |
The extremity type of the arrow.
Referenced by LibBoard::RoughVisitor::map().