QCAD
Open Source 2D CAD
RRayEntity.h
Go to the documentation of this file.
1 
20 #ifndef RRAYENTITY_H
21 #define RRAYENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RRayData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
53 
60 
64 
67 
68 public:
69  RRayEntity(RDocument* document, const RRayData& data);
70  virtual ~RRayEntity();
71 
72  static void init();
73 
74  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
76  }
77 
78  virtual RRayEntity* clone() const {
79  return new RRayEntity(*this);
80  }
81 
82  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
83  RTransaction* transaction=NULL);
84  virtual QPair<QVariant, RPropertyAttributes> getProperty(
85  RPropertyTypeId& propertyTypeId,
86  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
87 
88  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
89 
90  virtual RRayData& getData() {
91  return data;
92  }
93 
94  virtual const RRayData& getData() const {
95  return data;
96  }
97 
98  void setShape(const RRay& r);
99 
100  void setBasePoint(const RVector& p) {
101  data.setBasePoint(p);
102  }
103 
105  return data.getBasePoint();
106  }
107 
108  void setSecondPoint(const RVector& p) {
109  data.setSecondPoint(p);
110  }
111 
113  return data.getSecondPoint();
114  }
115 
117  data.setDirectionVector(v);
118  }
119 
121  return data.getDirectionVector();
122  }
123 
124  double getAngle() const {
125  return data.getAngle();
126  }
127 
128  bool hasFixedAngle() const {
129  return data.hasFixedAngle();
130  }
131 
132  void setFixedAngle(bool on) {
133  data.setFixedAngle(on);
134  }
135 
136  double getDirection1() const {
137  return data.getDirection1();
138  }
139 
140  double getDirection2() const {
141  return data.getDirection2();
142  }
143 
144  bool reverse() {
145  return data.reverse();
146  }
147 
148  RS::Side getSideOfPoint(const RVector& point) const {
149  return data.getSideOfPoint(point);
150  }
151 
152  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
153  return data.getTrimEnd(trimPoint, clickPoint);
154  }
155 
156  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
157  return data.trimStartPoint(trimPoint, clickPoint, extend);
158  }
159  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
160  return data.trimEndPoint(trimPoint, clickPoint, extend);
161  }
162 
163  double getLength() const {
164  return data.getLength();
165  }
166 
167 protected:
168  virtual void print(QDebug dbg) const;
169 
170 protected:
172 };
173 
175 Q_DECLARE_METATYPE(QSharedPointer<RRayEntity>)
176 Q_DECLARE_METATYPE(QSharedPointer<RRayEntity>*)
177 
178 #endif
Ending
Entity ending.
Definition: RS.h:155
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RRayEntity.h:159
RVector getSecondPoint() const
Definition: RRayEntity.h:112
bool reverse()
Definition: RRayEntity.h:144
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RRayData.h:36
void setSecondPoint(const RVector &p)
Definition: RRayEntity.h:108
static RPropertyTypeId PropertyColor
Definition: RRayEntity.h:50
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
void setFixedAngle(bool on)
Definition: RRayEntity.h:132
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RRayEntity.h:41
static RPropertyTypeId PropertyBlock
Definition: RRayEntity.h:45
RVector getBasePoint() const
Definition: RRayEntity.h:104
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
bool hasFixedAngle() const
Definition: RRayEntity.h:128
static RPropertyTypeId PropertySecondPointZ
Definition: RRayEntity.h:59
static RPropertyTypeId PropertyAngle
Definition: RRayEntity.h:65
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
static RPropertyTypeId PropertyProtected
Definition: RRayEntity.h:43
double getDirection2() const
Definition: RRayEntity.h:140
Transaction implementation.
Definition: RTransaction.h:74
double getLength() const
Definition: RRayEntity.h:163
static RPropertyTypeId PropertyDrawOrder
Definition: RRayEntity.h:52
static RPropertyTypeId PropertySecondPointY
Definition: RRayEntity.h:58
static RPropertyTypeId PropertyLinetypeScale
Definition: RRayEntity.h:48
static RPropertyTypeId PropertyHandle
Definition: RRayEntity.h:42
double getDirection1() const
Definition: RRayEntity.h:136
static RPropertyTypeId PropertyDirectionZ
Definition: RRayEntity.h:63
static RPropertyTypeId PropertyType
Definition: RRayEntity.h:44
static RPropertyTypeId PropertyLineweight
Definition: RRayEntity.h:49
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:145
static RPropertyTypeId PropertyDisplayedColor
Definition: RRayEntity.h:51
virtual const RRayData & getData() const
Definition: RRayEntity.h:94
void setDirectionVectorPoint(const RVector &v)
Definition: RRayEntity.h:116
Infinite ray entity.
Definition: RRayEntity.h:38
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:229
Base class for all entity classes.
Definition: REntity.h:64
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
virtual RRayData & getData()
Definition: RRayEntity.h:90
static RPropertyTypeId PropertyFixedAngle
Definition: RRayEntity.h:66
Q_DECLARE_METATYPE(RMath *)
RS::Side getSideOfPoint(const RVector &point) const
Definition: RRayEntity.h:148
RVector getDirectionVector() const
Definition: RRayEntity.h:120
static RPropertyTypeId PropertySecondPointX
Definition: RRayEntity.h:57
static RPropertyTypeId PropertyBasePointX
Definition: RRayEntity.h:54
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:233
RRayData data
Definition: RRayEntity.h:171
static void init()
Definition: REntity.cpp:83
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RRayEntity.h:74
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:326
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RRayEntity.h:156
Abstract base class for exporters.
Definition: RExporter.h:71
virtual RRayEntity * clone() const
Definition: RRayEntity.h:78
static RPropertyTypeId PropertyBasePointZ
Definition: RRayEntity.h:56
static RPropertyTypeId PropertyLayer
Definition: RRayEntity.h:46
static RPropertyTypeId PropertyDirectionY
Definition: RRayEntity.h:62
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RRayEntity.h:152
void setBasePoint(const RVector &p)
Definition: RRayEntity.h:100
double getAngle() const
Definition: RRayEntity.h:124
static RPropertyTypeId PropertyBasePointY
Definition: RRayEntity.h:55
static const RVector invalid
invalid vector
Definition: RVector.h:322
static RPropertyTypeId PropertyDirectionX
Definition: RRayEntity.h:61
Low-level mathematical representation of a ray.
Definition: RRay.h:42
static RPropertyTypeId PropertyLinetype
Definition: RRayEntity.h:47
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:473