QCAD
Open Source 2D CAD
RPolylineData.h
Go to the documentation of this file.
1 
20 #ifndef RPOLYLINEDATA_H
21 #define RPOLYLINEDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RBox.h"
26 #include "RDocument.h"
27 #include "REntity.h"
28 #include "RPolyline.h"
29 #include "RVector.h"
30 
31 #ifndef RDEFAULT_MIN1
32 #define RDEFAULT_MIN1 -1
33 #endif
34 
44 
45  friend class RPolylineEntity;
46 
47 protected:
49 
50 public:
51  RPolylineData();
52  RPolylineData(const RPolyline& polyline);
53 
54  virtual QList<RBox> getBoundingBoxes(bool ignoreEmpty=false) const;
55 
56  virtual QList<RVector> getReferencePoints(
58 
59  virtual bool moveReferencePoint(const RVector& referencePoint,
60  const RVector& targetPoint);
61 
62  virtual RShape* castToShape() {
63  return this;
64  }
65 
66  virtual double getDistanceTo(const RVector& point, bool limited = true, double range = 0.0, bool draft = false, double strictRange = RMAXDOUBLE) const {
67  Q_UNUSED(draft)
68 
69  double ret = RPolyline::getDistanceTo(point, limited, strictRange);
70  if (ret>range) {
71  return RNANDOUBLE;
72  }
73  return ret;
74  }
75 
77  return *this;
78  }
79 
80  void clear() {
82  }
83 
84  void normalize(double tolerance = RS::PointTolerance) {
85  RPolyline::normalize(tolerance);
86  }
87 
88  QList<RVector> getVertices() const {
89  return RPolyline::getVertices();
90  }
91 
92  RVector getVertexAt(int i) const {
93  return RPolyline::getVertexAt(i);
94  }
95 
96  void appendVertex(const RVector& vertex, double bulge = 0.0, double w1 = 0.0, double w2 = 0.0) {
97  RPolyline::appendVertex(vertex, bulge, w1, w2);
98  }
99 
100  void prependVertex(const RVector& vertex, double bulge = 0.0, double w1 = 0.0, double w2 = 0.0) {
101  RPolyline::prependVertex(vertex, bulge, w1, w2);
102  }
103 
104  void insertVertex(int index, const RVector& vertex) {
105  RPolyline::insertVertex(index, vertex);
106  }
107 
110  }
111 
112  void removeVertex(int index) {
114  }
115 
116  int countSegments() const {
117  return RPolyline::countSegments();
118  }
119 
120  QSharedPointer<RShape> getSegmentAt(int i) const {
121  return RPolyline::getSegmentAt(i);
122  }
123 
124  double getBulgeAt(int i) const {
125  return RPolyline::getBulgeAt(i);
126  }
127 
128  void setBulgeAt(int i, double b) {
129  RPolyline::setBulgeAt(i, b);
130  }
131 
132  double getDirection1() const {
133  return RPolyline::getDirection1();
134  }
135 
136  double getDirection2() const {
137  return RPolyline::getDirection2();
138  }
139 
140  bool reverse() {
141  return RPolyline::reverse();
142  }
143 
145  return RPolyline::getEndPoint();
146  }
147 
149  return RPolyline::getStartPoint();
150  }
151 
152  void setClosed(bool on) {
154  }
155 
156  bool isClosed() const {
157  return RPolyline::isClosed();
158  }
159 
160  bool isGeometricallyClosed(double tolerance=RS::PointTolerance) const {
161  return RPolyline::isGeometricallyClosed(tolerance);
162  }
163 
164  void autoClose() {
166  }
167 
168  QList<QSharedPointer<RShape> > getExploded(int segments = RDEFAULT_MIN1) const {
169  return RPolyline::getExploded(segments);
170  }
171 
173  return RPolyline::toPainterPath();
174  }
175 
176  void simplify(double angleTolerance) {
177  RPolyline::simplify(angleTolerance);
178  }
179 
180  QList<RVector> verifyTangency(double toleranceMin = RS::AngleTolerance, double toleranceMax = M_PI_4) {
181  return RPolyline::verifyTangency(toleranceMin, toleranceMax);
182  }
183 
184  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const;
185 
186  virtual QList<RVector> getIntersectionPoints(
187  const REntityData& other, bool limited = true, bool same = false,
188  const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = true) const;
189 
190  void setPolylineGen(bool on) {
191  polylineGen = on;
192  }
193  bool getPolylineGen() const {
194  return polylineGen;
195  }
196 
197 protected:
199 };
200 
204 Q_DECLARE_METATYPE(QSharedPointer<RPolylineData>)
205 
206 #endif
RVector getVertexAt(int i) const
Definition: RPolyline.cpp:291
double getDirection1() const
Definition: RPolylineData.h:132
static const double AngleTolerance
Definition: RS.h:550
bool getPolylineGen() const
Definition: RPolylineData.h:193
Represents a box e.g.
Definition: RBox.h:43
Base class for all entity data classes.
Definition: REntityData.h:64
void normalize(double tolerance=RS::PointTolerance)
Definition: RPolylineData.h:84
Stores and manages all data that defines the geometry and appearance of a polyline entity...
Definition: RPolylineData.h:43
#define M_PI_4
Definition: RMath.h:43
void removeVertex(int index)
Definition: RPolyline.cpp:255
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
RPainterPath toPainterPath() const
Definition: RPolyline.cpp:539
void appendVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolylineData.h:96
void setBulgeAt(int i, double b)
Definition: RPolylineData.h:128
QList< RVector > getVertices() const
Definition: RPolyline.cpp:287
virtual double getDistanceTo(const RVector &point, bool limited=true, double strictRange=RMAXDOUBLE) const
Definition: RPolyline.cpp:1178
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
QList< RVector > getVertices() const
Definition: RPolylineData.h:88
QList< RVector > verifyTangency(double toleranceMin=RS::AngleTolerance, double toleranceMax=M_PI_4)
Verifies the tangency of this polyline.
Definition: RPolyline.cpp:1427
virtual QList< RVector > getIntersectionPoints(const REntityData &other, bool limited=true, bool same=false, const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=true) const
Override to disable intersection point.
Definition: REntityData.cpp:441
virtual QList< RBox > getBoundingBoxes(bool ignoreEmpty=false) const
Definition: REntityData.h:121
bool autoClose()
Definition: RPolyline.cpp:454
double getBulgeAt(int i) const
Definition: RPolyline.cpp:343
RVector getStartPoint() const
Definition: RPolylineData.h:148
void insertVertex(int index, const RVector &vertex)
Definition: RPolylineData.h:104
#define RNANDOUBLE
Definition: RMath.h:71
int countSegments() const
Definition: RPolyline.cpp:712
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:128
Polyline entity.
Definition: RPolylineEntity.h:44
QSharedPointer< RShape > getSegmentAt(int i) const
Definition: RPolylineData.h:120
RVector getEndPoint() const
Definition: RPolylineData.h:144
QList< RVector > verifyTangency(double toleranceMin=RS::AngleTolerance, double toleranceMax=M_PI_4)
Definition: RPolylineData.h:180
void clear()
Definition: RPolyline.cpp:80
void prependVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolyline.cpp:218
bool isGeometricallyClosed(double tolerance=RS::PointTolerance) const
Definition: RPolyline.cpp:450
bool simplify(double angleTolerance=RS::AngleTolerance)
Definition: RPolyline.cpp:1362
void setBulgeAt(int i, double b)
Definition: RPolyline.cpp:351
static const double PointTolerance
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RS.h:549
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:864
RVector getVertexAt(int i) const
Definition: RPolylineData.h:92
QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolylineData.h:168
QSharedPointer< RShape > getSegmentAt(int i) const
Definition: RPolyline.cpp:726
virtual QList< RVector > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
virtual bool moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint)=0
Moves the given reference point to the given target point or does nothing if this entity has no refer...
Q_DECLARE_METATYPE(RMath *)
virtual RVector getEndPoint() const
Definition: RPolyline.cpp:872
virtual bool reverse()
Definition: RPolyline.cpp:1288
Extended painter path with a z-level and a pen.
Definition: RPainterPath.h:46
RPolyline getPolylineShape() const
Definition: RPolylineData.h:76
#define RMAXDOUBLE
Definition: RMath.h:63
void clear()
Definition: RPolylineData.h:80
bool polylineGen
Definition: RPolylineData.h:198
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false) const
Definition: REntityData.h:88
void setClosed(bool on)
Definition: RPolyline.cpp:442
RPolylineData data
Definition: RPolylineEntity.h:261
virtual double getDirection1() const
Definition: RPolyline.cpp:884
Definition: RS.h:129
#define RDEFAULT_MIN1
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPolylineData.h:32
double getBulgeAt(int i) const
Definition: RPolylineData.h:124
bool isClosed() const
Definition: RPolyline.cpp:446
int countSegments() const
Definition: RPolylineData.h:116
bool isGeometricallyClosed(double tolerance=RS::PointTolerance) const
Definition: RPolylineData.h:160
void simplify(double angleTolerance)
Definition: RPolylineData.h:176
void insertVertex(int index, const RVector &vertex)
Definition: RPolyline.cpp:225
void removeLastVertex()
Definition: RPolyline.cpp:245
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolyline.cpp:673
double getDirection2() const
Definition: RPolylineData.h:136
RPainterPath toPainterPath() const
Definition: RPolylineData.h:172
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:50
void setPolylineGen(bool on)
Definition: RPolylineData.h:190
void autoClose()
Definition: RPolylineData.h:164
virtual double getDirection2() const
Definition: RPolyline.cpp:898
void removeVertex(int index)
Definition: RPolylineData.h:112
Interface for geometrical shape classes.
Definition: RShape.h:52
virtual double getDistanceTo(const RVector &point, bool limited=true, double range=0.0, bool draft=false, double strictRange=RMAXDOUBLE) const
Definition: RPolylineData.h:66
void normalize(double tolerance=RS::PointTolerance)
Removes duplicate vertices.
Definition: RPolyline.cpp:90
void setClosed(bool on)
Definition: RPolylineData.h:152
bool reverse()
Definition: RPolylineData.h:140
void prependVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolylineData.h:100
void appendVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolyline.cpp:211
void removeLastVertex()
Definition: RPolylineData.h:108
bool isClosed() const
Definition: RPolylineData.h:156
virtual RShape * castToShape()
Definition: RPolylineData.h:62
RDocument * document
Definition: RObject.h:263