|
Board 0.9.6
|
A polygonal line described by a series of 2D points. More...
#include <Polyline.h>
Public Member Functions | |
| Polyline (const std::vector< Point > &points, Path::OpenClosed openClosed, 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()) | |
| Polyline (const std::vector< Point > &points, Path::OpenClosed openClosed, const Style &style) | |
| Polyline (const Path &path, 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()) | |
| Polyline (const Path &path, const Style &style) | |
| Polyline (Path::OpenClosed openClosed, 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()) | |
| Polyline (Path::OpenClosed openClosed, const Style &style) | |
| const std::string & | name () const override |
| Polyline & | operator<< (const Point &p) |
| Point & | operator[] (const std::size_t n) |
| const Point & | operator[] (const std::size_t n) const |
| Polyline & | rotate (double angle, const Point ¢er) override |
| Polyline | rotated (double angle, const Point ¢er) const |
| Polyline & | rotate (double angle) override |
| Polyline | rotated (double angle) const |
| Polyline & | translate (double dx, double dy) override |
| Polyline | translated (double dx, double dy) const |
| Polyline & | scale (double sx, double sy) override |
| Polyline & | scale (double s) override |
| Polyline | scaled (double sx, double sy) const |
| Polyline | scaled (double s) const |
| void | scaleAll (double s) override |
| Polyline | resized (double w, double h, LineWidthFlag lineWidthFlag) const |
| void | addHole (const Path &path) |
| Add a hole to the path. Warning: Hole share the polyline line style. | |
| 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. | |
| Rect | boundingBox (LineWidthFlag) const override |
| Polyline * | clone () const override |
| std::size_t | vertexCount () const |
| const Path & | path () const |
| void | setRectangleFlag () |
| Polyline (const Polyline &)=default | |
| Polyline (Polyline &&)=default | |
| Polyline & | operator= (Polyline &&)=default |
| Polyline & | operator= (const Polyline &)=default |
| ~Polyline () 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 | |
| Path | _path |
| std::vector< Path > | _holes |
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 polygonal line described by a series of 2D points.
The polyline structure.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
default |
|
default |
|
overridedefault |
|
overridevirtual |
Accept a composite shape transform.
| transform | A composite shape transform object. |
Reimplemented from LibBoard::Shape.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accept a constant composite shape transform.
| transform | A constant composite shape transform object.. |
Reimplemented from LibBoard::Shape.
References LibBoard::CompositeShapeTransform::map().
|
overridevirtual |
Accepts a const-shape visitor object.
| visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
| visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ShapeVisitor::visit().
|
overridevirtual |
Accepts a const-shape visitor object.
| visitor | A const-shape visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ConstShapeVisitor::visit().
|
overridevirtual |
Accepts a visitor object.
| visitor | A visitor object. |
Reimplemented from LibBoard::Shape.
References LibBoard::ShapeVisitor::visit().
| void LibBoard::Polyline::addHole | ( | const Path & | path | ) |
Add a hole to the path. Warning: Hole share the polyline line style.
| path | Vertices of the polyline |
References _holes, and path().
Referenced by main().
|
overridevirtual |
Compute the bounding box of the figure.
Implements LibBoard::Shape.
References _path, LibBoard::Path::boundingBox(), LibBoard::IgnoreLineWidth, LibBoard::ShapeWithStyle::lineCap(), LibBoard::ShapeWithStyle::lineJoin(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::Tools::pathBoundingBox(), and LibBoard::UseLineWidth.
Referenced by LibBoard::Image::boundingBox(), LibBoard::Image::flushFIG(), and main().
|
overridevirtual |
Return a copy of the shape.
Implements LibBoard::ShapeWithStyle.
Referenced by LibBoard::Board::drawBoundingBox(), LibBoard::Board::drawRectangle(), and LibBoard::Board::drawRectangle().
|
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 _path, LibBoard::Tools::almostEqual(), LibBoard::Path::empty(), LibBoard::ShapeWithStyle::fillColor(), LibBoard::ShapeWithStyle::filled(), LibBoard::Path::flushFIG(), LibBoard::Path::isClosed(), LibBoard::ShapeWithStyle::lineCap(), LibBoard::ShapeWithStyle::lineJoin(), LibBoard::ShapeWithStyle::lineStyle(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::TransformFIG::mapWidth(), LibBoard::ShapeWithStyle::penColor(), LibBoard::TransformFIG::shapeDepth(), LibBoard::Path::size(), LibBoard::Color::valid(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by LibBoard::Image::flushFIG(), LibBoard::GouraudTriangle::flushFIG(), and LibBoard::Board::saveFIG().
|
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 _holes, _path, LibBoard::ShapeWithStyle::_style, LibBoard::Path::empty(), LibBoard::ShapeWithStyle::fillColor(), LibBoard::ShapeWithStyle::filled(), LibBoard::Color::flushPostscript(), LibBoard::Path::flushPostscript(), LibBoard::Path::getClockwise(), LibBoard::ShapeWithStyle::lineWidth(), LibBoard::Color::Null, LibBoard::ShapeWithStyle::penColor(), and LibBoard::Style::postscriptProperties().
Referenced by LibBoard::Arrow::flushPostscript(), LibBoard::GouraudTriangle::flushPostscript(), and LibBoard::Board::saveEPS().
|
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 _holes, _path, LibBoard::ShapeWithStyle::_style, LibBoard::Path::close(), LibBoard::Path::empty(), LibBoard::Path::flushSVGCommands(), LibBoard::Path::flushSVGPoints(), LibBoard::Path::getClockwise(), LibBoard::Path::isClosed(), LibBoard::orthogonal(), LibBoard::Path::setCounterclockwise(), LibBoard::Path::size(), and LibBoard::Style::svgProperties().
Referenced by LibBoard::Arrow::flushSVG(), LibBoard::GouraudTriangle::flushSVG(), and LibBoard::Board::saveSVG().
|
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 _path, LibBoard::ShapeWithStyle::_style, LibBoard::Path::empty(), LibBoard::Path::flushTikZPoints(), LibBoard::Path::isClosed(), and LibBoard::Style::tikzProperties().
Referenced by LibBoard::Image::flushTikZ(), and LibBoard::Board::saveTikZ().
|
overridevirtual |
Returns the generic name of the shape (e.g., Circle, Rectangle, etc.)
Reimplemented from LibBoard::Shape.
|
inline |
Returns the n-th point of the polyline.
| n |
References _path.
|
inline |
Returns the n-th point of the polyline.
| n |
References _path.
|
inline |
References _path.
Referenced by addHole(), divided(), hachures(), main(), LibBoard::RoughVisitor::map(), LibBoard::mix(), and polygons().
| Polyline LibBoard::Polyline::resized | ( | double | w, |
| double | h, | ||
| LineWidthFlag | lineWidthFlag | ||
| ) | const |
Returns a resized copy of the polyline.
| w | Width of the new polyline. |
| h | Height of the new polyline. |
| 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 _holes, _path, LibBoard::Shape::center(), and LibBoard::Path::rotate().
Referenced by hachures(), polygons(), LibBoard::Image::rotate(), rotate(), LibBoard::Image::rotate(), rotated(), and rotated().
| Polyline LibBoard::Polyline::rotated | ( | double | angle | ) | const |
| angle | |
| center |
References LibBoard::Shape::center(), and rotate().
Referenced by main().
|
overridevirtual |
Scale the polyline, given a scaling factor.
| s | Scaling factor. |
Implements LibBoard::Shape.
References scale().
|
overridevirtual |
Scale the polyline, given two scaling factors.
| sx | Scaling factor along the x axis. |
| sy | Scaling factor along the y axis. |
Implements LibBoard::Shape.
References _holes, _path, LibBoard::Path::center(), LibBoard::Path::moveCenter(), LibBoard::Path::scale(), LibBoard::ShapeWithStyle::updateLineWidth(), LibBoard::Point::x, and LibBoard::Point::y.
Referenced by scale(), LibBoard::Image::scale(), scaled(), LibBoard::GouraudTriangle::scaled(), scaled(), and LibBoard::GouraudTriangle::scaled().
|
overridevirtual |
Scales all the values (positions, dimensions, etc.) associated with the shape.
| s | The scaling factor. |
Implements LibBoard::Shape.
References _holes, _path, and LibBoard::Path::scaleAll().
Referenced by LibBoard::Image::scaleAll().
| Polyline LibBoard::Polyline::scaled | ( | double | s | ) | const |
Returns a scaled copy of the line.
| s | The scaling factor. |
References scale().
| Polyline LibBoard::Polyline::scaled | ( | double | sx, |
| double | sy | ||
| ) | const |
Returns a scaled copy of the line.
| sx | The scaling factor along the x axis. |
| sy | The scaling factor along the y axis. |
References scale().
| void LibBoard::Polyline::setRectangleFlag | ( | ) |
Referenced by LibBoard::rectangle().
|
overridevirtual |
Translate the polyline by a given offset.
| dx | The x offset. |
| dy | The y offset. |
Implements LibBoard::Shape.
References _holes, _path, and LibBoard::Path::translate().
Referenced by LibBoard::Image::translate(), translated(), and LibBoard::GouraudTriangle::translated().
| Polyline LibBoard::Polyline::translated | ( | double | dx, |
| double | dy | ||
| ) | const |
Returns a translated copy of the polyline.
| dx | Shift of the first coordinate. |
| dy | Shift of the second coordinate. |
References translate().
Referenced by main().
|
inline |
References _path, and LibBoard::Path::size().
Referenced by divided(), LibBoard::Image::flushFIG(), and main().
|
protected |
Referenced by addHole(), flushPostscript(), flushSVG(), rotate(), scale(), scaleAll(), and translate().
|
protected |
Referenced by boundingBox(), flushFIG(), LibBoard::GouraudTriangle::flushFIG(), flushPostscript(), LibBoard::GouraudTriangle::flushPostscript(), flushSVG(), LibBoard::GouraudTriangle::flushSVG(), flushTikZ(), LibBoard::GouraudTriangle::GouraudTriangle(), LibBoard::GouraudTriangle::GouraudTriangle(), operator<<(), operator[](), operator[](), path(), rotate(), LibBoard::GouraudTriangle::rotate(), scale(), scaleAll(), LibBoard::GouraudTriangle::scaleAll(), translate(), and vertexCount().