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