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