QCAD
Open Source 2D CAD
RRayData.h
Go to the documentation of this file.
1 
20 #ifndef RRAYDATA_H
21 #define RRAYDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "REntityData.h"
26 #include "RRay.h"
27 
36 class QCADENTITY_EXPORT RRayData: public REntityData, protected RRay {
37 
38  friend class RRayEntity;
39 
40 protected:
42 
43 public:
44  RRayData();
45  RRayData(const RRay& ray);
46  RRayData(const RVector& basePoint, const RVector& dir);
47 
48  virtual RS::EntityType getType() const {
49  return RS::EntityRay;
50  }
52  return *this;
53  }
54 
56  return RRay::getBasePoint();
57  }
59  return RRay::getDirectionVector();
60  }
61  double getAngle() const {
62  return RRay::getAngle();
63  }
64 
65  bool hasFixedAngle() const {
66  return fixedAngle;
67  }
68 
69  void setFixedAngle(bool on) {
70  fixedAngle = on;
71  }
72 
73  bool reverse() {
74  return RRay::reverse();
75  }
76 
77  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
78  return RRay::getTrimEnd(trimPoint, clickPoint);
79  }
80  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
81  return RRay::trimStartPoint(trimPoint, clickPoint, extend);
82  }
83  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
84  return RRay::trimEndPoint(trimPoint, clickPoint, extend);
85  }
86 
87  RS::Side getSideOfPoint(const RVector& point) const {
88  return RRay::getSideOfPoint(point);
89  }
90 
91  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
92 
93  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
94 
95  virtual RShape* castToShape() {
96  return this;
97  }
98 
99  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
100  Q_UNUSED(queryBox)
101  Q_UNUSED(ignoreComplex)
102  Q_UNUSED(segment)
103 
104  return QList<QSharedPointer<RShape> >() <<
105  QSharedPointer<RShape>(new RRay(*this));
106  }
107 
108 private:
110 };
111 
115 Q_DECLARE_METATYPE(QSharedPointer<RRayData>)
116 
117 #endif
Represents a box e.g.
Definition: RBox.h:43
Ending
Entity ending.
Definition: RS.h:204
Base class for all entity data classes.
Definition: REntityData.h:65
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RRayData.h:36
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
virtual RS::Side getSideOfPoint(const RVector &point) const
Definition: RXLine.cpp:93
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:125
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RRayData.h:77
RRay getRay()
Definition: RRayData.h:51
virtual RS::EntityType getType() const
Definition: RRayData.h:48
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RXLine.cpp:105
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:183
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:194
RS::Side getSideOfPoint(const RVector &point) const
Definition: RRayData.h:87
RRay()
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RRay.cpp:26
Infinite ray entity.
Definition: RRayEntity.h:38
bool fixedAngle
Definition: RRayData.h:109
bool hasFixedAngle() const
Definition: RRayData.h:65
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...
double getAngle() const
Definition: RRayData.h:61
RVector getBasePoint() const
Definition: RRayData.h:55
Q_DECLARE_METATYPE(RMath *)
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RRay.cpp:83
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RXLine.cpp:128
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
double getAngle() const
Definition: RXLine.cpp:72
Ray.
Definition: RS.h:146
Definition: RS.h:184
RRayData data
Definition: RRayEntity.h:171
RVector getDirectionVector() const
Definition: RRayData.h:58
virtual RShape * castToShape()
Definition: RRayData.h:95
bool reverse()
Definition: RRayData.h:73
RVector getBasePoint() const
Definition: RXLine.cpp:145
Interface for geometrical shape classes.
Definition: RShape.h:52
void setFixedAngle(bool on)
Definition: RRayData.h:69
static const RVector invalid
invalid vector
Definition: RVector.h:322
Low-level mathematical representation of a ray.
Definition: RRay.h:42
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RRayData.h:83
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RRayData.h:80
virtual bool reverse()
Definition: RRay.cpp:65
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RRayData.h:99
RVector getDirectionVector() const
Definition: RXLine.cpp:161
RDocument * document
Definition: RObject.h:306