QCAD
Open Source 2D CAD
RSplineData.h
Go to the documentation of this file.
1 
20 #ifndef RSPLINEDATA_H
21 #define RSPLINEDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RBox.h"
26 #include "RDocument.h"
27 #include "REntity.h"
28 #include "RSpline.h"
29 #include "RVector.h"
30 
40 
41  friend class RSplineEntity;
42 
43 protected:
45 
46 public:
47  RSplineData();
48  RSplineData(const RSpline& spline);
49 
50  virtual RBox getBoundingBox(bool ignoreEmpty=false) const;
51 
52  virtual QList<RVector> getReferencePoints(
54 
55  virtual bool moveReferencePoint(const RVector& referencePoint,
56  const RVector& targetPoint);
57 
58  void setShape(const RSpline& s) {
59  copySpline(s);
60  }
61 
62  void appendControlPoint(const RVector& point) {
64  }
65 
66  void setPeriodic(bool on) {
68  }
69 
70  bool isValid() const {
71  return RSpline::isValid();
72  }
73 
74  int getDegree() const {
75  return RSpline::getDegree();
76  }
77 
78  double getDirection1() const {
79  return RSpline::getDirection1();
80  }
81 
82  double getDirection2() const {
83  return RSpline::getDirection2();
84  }
85 
87  return RSpline::getStartPoint();
88  }
89 
90  RVector getEndPoint() const {
91  return RSpline::getEndPoint();
92  }
93 
94  void setStartPoint(const RVector& sp) {
96  }
97 
98  void setEndPoint(const RVector& ep) {
100  }
101 
102  bool reverse() {
103  return RSpline::reverse();
104  }
105 
106  RS::Ending getTrimEnd(const RVector& coord, const RVector& trimPoint) {
107  return RSpline::getTrimEnd(coord, trimPoint);
108  }
109  void trimStartPoint(const RVector& p) {
110  return RSpline::trimStartPoint(p);
111  }
112  void trimEndPoint(const RVector& p) {
113  return RSpline::trimEndPoint(p);
114  }
115 
116  bool isClosed() const {
117  return RSpline::isClosed();
118  }
119 
120  bool isPeriodic() const {
121  return RSpline::isPeriodic();
122  }
123 
126  }
127 
129  return RSpline::getTangentAtEnd();
130  }
131 
132  //void updateTangentsPeriodic() {
133  // RSpline::updateTangentsPeriodic();
134  //}
135 
136  QList<RVector> getControlPoints() const {
137  return RSpline::getControlPoints();
138  }
139 
140  QList<RVector> getControlPointsWrapped() const {
142  }
143 
144  QList<RVector> getFitPoints() const {
145  return RSpline::getFitPoints();
146  }
147 
148  QList<double> getKnotVector() const {
149  return RSpline::getKnotVector();
150  }
151 
152  QList<double> getActualKnotVector() const {
154  }
155 
156  QList<double> getWeights() const {
157  return RSpline::getWeights();
158  }
159 
160  RPolyline toPolyline(int segments) const {
161  return RSpline::toPolyline(segments);
162  }
163 
164  //RSpline getSubSpline(double d1, double d2) const {
165  // return RSpline::getSubSpline(d1, d2);
166  //}
167 
168  virtual RShape* castToShape() {
169  return this;
170  }
171 
172  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const {
173  Q_UNUSED(queryBox)
174 
175  // make sure we copy only splines with updated cache:
176  //getExploded();
177 
178  return QList<QSharedPointer<RShape> >() <<
179  QSharedPointer<RShape>(new RSpline(*this));
180  }
181 
182  virtual void update() const {
183  //RSpline::update();
184  }
185 };
186 
190 Q_DECLARE_METATYPE(QSharedPointer<RSplineData>)
191 
192 #endif
Represents a box e.g.
Definition: RBox.h:43
Ending
Entity ending.
Definition: RS.h:136
int getDegree() const
Definition: RSplineData.h:74
Base class for all entity data classes.
Definition: REntityData.h:64
RVector getTangentAtStart() const
Definition: RSplineData.h:124
QList< RVector > getFitPoints() const
Definition: RSpline.cpp:302
virtual void trimEndPoint(const RVector &p)
Definition: RSpline.cpp:1426
virtual RS::Ending getTrimEnd(const RVector &coord, const RVector &trimPoint)
Definition: RSpline.cpp:1393
void setStartPoint(const RVector &sp)
Definition: RSplineData.h:94
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
Low-level mathematical representation of a spline.
Definition: RSpline.h:54
virtual void update() const
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty)...
Definition: RSplineData.h:182
bool isValid() const
Definition: RSplineData.h:70
bool isValid() const
Definition: RSpline.cpp:1038
void setEndPoint(const RVector &v)
Definition: RSpline.cpp:538
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
QList< RVector > getFitPoints() const
Definition: RSplineData.h:144
void copySpline(const RSpline &other)
Definition: RSpline.cpp:54
bool isClosed() const
Definition: RSpline.cpp:402
RSpline()
Creates a spline object without controlPoints.
Definition: RSpline.cpp:37
void setPeriodic(bool on)
Definition: RSpline.cpp:393
QList< RVector > getControlPoints() const
Definition: RSpline.cpp:245
bool isPeriodic() const
Definition: RSplineData.h:120
QList< double > getWeights() const
Definition: RSpline.cpp:357
QList< double > getWeights() const
Definition: RSplineData.h:156
RPolyline toPolyline(int segments) const
Definition: RSplineData.h:160
virtual void trimStartPoint(const RVector &p)
Definition: RSpline.cpp:1405
QList< RVector > getControlPoints() const
Definition: RSplineData.h:136
virtual RShape * castToShape()
Definition: RSplineData.h:168
virtual RVector getStartPoint() const
Definition: RSpline.cpp:525
RVector getEndPoint() const
Definition: RSplineData.h:90
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:118
RS::Ending getTrimEnd(const RVector &coord, const RVector &trimPoint)
Definition: RSplineData.h:106
void setEndPoint(const RVector &ep)
Definition: RSplineData.h:98
void setStartPoint(const RVector &v)
Definition: RSpline.cpp:529
RVector getTangentAtStart() const
Definition: RSpline.cpp:563
bool reverse()
Definition: RSplineData.h:102
void setShape(const RSpline &s)
Definition: RSplineData.h:58
virtual RBox getBoundingBox(bool ignoreEmpty=false) const
Definition: REntityData.cpp:230
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:63
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 *)
QList< double > getActualKnotVector() const
Definition: RSpline.cpp:328
virtual double getDirection1() const
Definition: RSpline.cpp:492
void appendControlPoint(const RVector &point)
Definition: RSplineData.h:62
void setPeriodic(bool on)
Definition: RSplineData.h:66
void appendControlPoint(const RVector &point)
Disabled for splines (bad performance).
Definition: RSpline.cpp:219
QList< double > getActualKnotVector() const
Definition: RSplineData.h:152
void trimStartPoint(const RVector &p)
Definition: RSplineData.h:109
Spline entity.
Definition: RSplineEntity.h:42
bool isClosed() const
Definition: RSplineData.h:116
QList< double > getKnotVector() const
Definition: RSpline.cpp:324
Definition: RS.h:119
QList< double > getKnotVector() const
Definition: RSplineData.h:148
RVector getTangentAtEnd() const
Definition: RSpline.cpp:578
virtual double getDirection2() const
Definition: RSpline.cpp:510
RVector getTangentAtEnd() const
Definition: RSplineData.h:128
double getDirection1() const
Definition: RSplineData.h:78
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RSplineData.h:39
double getDirection2() const
Definition: RSplineData.h:82
void trimEndPoint(const RVector &p)
Definition: RSplineData.h:112
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
virtual bool reverse()
Definition: RSpline.cpp:1001
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false) const
Definition: RSplineData.h:172
int getDegree() const
Definition: RSpline.cpp:382
Interface for geometrical shape classes.
Definition: RShape.h:52
virtual RVector getEndPoint() const
Definition: RSpline.cpp:534
bool isPeriodic() const
Definition: RSpline.cpp:440
RPolyline toPolyline(int segments) const
Definition: RSpline.cpp:626
RVector getStartPoint() const
Definition: RSplineData.h:86
QList< RVector > getControlPointsWrapped() const
Definition: RSplineData.h:140
RSplineData data
Definition: RSplineEntity.h:256
RDocument * document
Definition: RObject.h:251
QList< RVector > getControlPointsWrapped() const
Definition: RSpline.cpp:252