5 #include "rs_entitycontainer.h"
8 * Holds the data that defines a polyline.
10 class RS_PolylineData: public RS_Flags
15 startpoint = endpoint = Vector(false);
18 RS_PolylineData(const Vector & startpoint, const Vector & endpoint, bool closed)
20 this->startpoint = startpoint;
21 this->endpoint = endpoint;
24 setFlag(RS2::FlagClosed);
27 friend class RS_Polyline;
29 friend std::ostream & operator<<(std::ostream & os, const RS_PolylineData & pd)
31 os << "(" << pd.startpoint << "/" << pd.endpoint << ")";
41 * Class for a poly line entity (lots of connected lines and arcs).
43 * @author Andrew Mustun
45 class RS_Polyline: public RS_EntityContainer
48 RS_Polyline(RS_EntityContainer * parent = NULL);
49 RS_Polyline(RS_EntityContainer * parent, const RS_PolylineData & d);
50 virtual ~RS_Polyline();
52 virtual RS_Entity * clone();
53 virtual RS2::EntityType rtti() const;
54 RS_PolylineData getData() const;
55 void setStartpoint(Vector & v);
56 Vector getStartpoint();
57 void setEndpoint(Vector & v);
59 double getClosingBulge();
60 void updateEndpoints();
61 bool isClosed() const;
62 void setClosed(bool cl);
64 virtual VectorSolutions getRefPoints();
65 virtual Vector getNearestRef(const Vector & coord, double * dist = NULL);
66 virtual Vector getNearestSelectedRef(const Vector & coord, double * dist = NULL);
67 virtual RS_Entity * addVertex(const Vector & v, double bulge = 0.0, bool prepend = false);
68 virtual void setNextBulge(double bulge);
69 virtual void addEntity(RS_Entity * entity);
70 //virtual void addSegment(RS_Entity* entity);
71 virtual void removeLastVertex();
72 virtual void endPolyline();
73 //virtual void reorder();
74 virtual void move(Vector offset);
75 virtual void rotate(Vector center, double angle);
76 virtual void scale(Vector center, Vector factor);
77 virtual void mirror(Vector axisPoint1, Vector axisPoint2);
78 virtual void moveRef(const Vector& ref, const Vector& offset);
79 virtual void stretch(Vector firstCorner, Vector secondCorner, Vector offset);
80 virtual void draw(PaintInterface * painter, GraphicView * view, double patternOffset = 0.0);
82 friend std::ostream & operator<<(std::ostream & os, const RS_Polyline & l);
85 virtual RS_Entity * createVertex(const Vector & v, double bulge = 0.0, bool prepend = false);
89 RS_Entity * closingEntity;