QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPolylineEntity.h
Go to the documentation of this file.
1 #ifndef RPOLYLINEENTITY_H
2 #define RPOLYLINEENTITY_H
3 
4 #include "REntity.h"
5 #include "RPolylineData.h"
6 
7 class RDocument;
8 class RExporter;
9 class RArc;
10 class RLine;
11 
19 class RPolylineEntity: public REntity {
20 
21 public:
31 
37 
38 public:
41  virtual ~RPolylineEntity();
42 
43  static void init();
44 
45  virtual RPolylineEntity* clone() const {
46  return new RPolylineEntity(*this);
47  }
48 
49  virtual RS::EntityType getType() const {
50  return RS::EntityPolyline;
51  }
52 
53  void setShape(const RPolyline& l);
54 
55  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value);
56  QPair<QVariant, RPropertyAttributes> getProperty(
57  RPropertyTypeId propertyTypeId,
58  bool humanReadable = false, bool noAttributes = false);
59 
60  virtual void exportEntity(RExporter& e, bool preview=false) const;
61 
62  virtual RPolylineData& getData() {
63  return data;
64  }
65 
66  virtual const RPolylineData& getData() const {
67  return data;
68  }
69 
70  void clear() {
71  data.clear();
72  }
73 
74  void normalize() {
75  data.normalize();
76  }
77 
78  int countVertices() const {
79  return data.countVertices();
80  }
81 
82  void appendVertex(const RVector& vertex, double bulge = 0.0) {
83  data.appendVertex(vertex, bulge);
84  }
85 
86  void prependVertex(const RVector& vertex, double bulge = 0.0) {
87  data.prependVertex(vertex, bulge);
88  }
89 
90  void insertVertex(int index, const RVector& vertex) {
91  data.insertVertex(index, vertex);
92  }
93 
94  RVector getVertexAt(int i) const {
95  return data.getVertexAt(i);
96  }
97 
100  }
101 
102  void removeVertex(int index) {
103  data.removeVertex(index);
104  }
105 
106  int countSegments() const {
107  return data.countSegments();
108  }
109 
110  QSharedPointer<RShape> getSegmentAt(int i) const {
111  return data.getSegmentAt(i);
112  }
113 
114  double getBulgeAt(int i) const {
115  return data.getBulgeAt(i);
116  }
117 
118  void setBulgeAt(int i, double b) {
119  data.setBulgeAt(i, b);
120  }
121 
122  double getDirection1() const {
123  return data.getDirection1();
124  }
125 
126  double getDirection2() const {
127  return data.getDirection2();
128  }
129 
130  bool reverse() {
131  return data.reverse();
132  }
133 
135  return data.getEndPoint();
136  }
137 
139  return data.getStartPoint();
140  }
141 
142  void setClosed(bool on) {
143  data.setClosed(on);
144  }
145 
146  bool isClosed() const {
147  return data.isClosed();
148  }
149 
150  bool isLogicallyClosed() const {
151  return data.isLogicallyClosed();
152  }
153 
154  QList<QSharedPointer<RShape> > getExploded() const {
155  return data.getExploded();
156  }
157 
158  virtual int getComplexity() const {
159  return countSegments();
160  }
161 
162 protected:
163  virtual void print(QDebug dbg) const;
164 
165 protected:
167 };
168 
170 Q_DECLARE_METATYPE(QSharedPointer<RPolylineEntity>)
171 Q_DECLARE_METATYPE(QSharedPointer<RPolylineEntity>*)
172 
173 #endif