QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
RHatchEntity.h
Go to the documentation of this file.
1
20#ifndef RHATCHENTITY_H
21#define RHATCHENTITY_H
22
23#include "entity_global.h"
24
25#include "REntity.h"
26#include "RHatchData.h"
27
28class RDocument;
29class RExporter;
30class RViewportData;
31
32#ifndef RDEFAULT_MIN1
33#define RDEFAULT_MIN1 -1
34#endif
35
44
45public:
59
63
68
71
75
80
81public:
82 RHatchEntity(RDocument* document, const RHatchData& data);
83 virtual ~RHatchEntity();
84
85 static void init();
86
88 return RS::EntityHatch;
89 }
90
91 static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
93 }
94
95 virtual QSharedPointer<RObject> clone() const {
96 return QSharedPointer<RObject>(new RHatchEntity(*this));
97 }
98
99 QSharedPointer<RHatchEntity> cloneToHatchEntity() const {
100 return QSharedPointer<RHatchEntity>(new RHatchEntity(*this));
101 }
102
104 data = d;
105 }
106
107 bool hasCustomPattern() const {
108 return data.hasCustomPattern();
109 }
110
112 return data.getCustomPattern();
113 }
114
115 void setCustomPattern(const RPattern& p) {
116 data.setCustomPattern(p);
117 }
118
119 virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
120 RTransaction* transaction=NULL);
121 bool setBoundaryVector(RObject::XYZ xyz, const QVariant& value, bool condition);
122 RVector setComponent(const RVector& p, double v, RObject::XYZ xyz);
123
124 virtual QPair<QVariant, RPropertyAttributes> getProperty(
125 RPropertyTypeId& propertyTypeId,
126 bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
127
128 virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
129
130 virtual RHatchData& getData() {
131 return data;
132 }
133
134 virtual const RHatchData& getData() const {
135 return data;
136 }
137
138 QList<RPainterPath> getPainterPaths(bool draft = false, double pixelSizeHint = 0.0) const {
139 return data.getPainterPaths(draft, pixelSizeHint);
140 }
141
142 virtual int getComplexity() const {
143 return data.getComplexity();
144 }
145
146 void newLoop() {
147 data.newLoop();
148 }
149
150 void addBoundary(QSharedPointer<RShape> shape) {
151 data.addBoundary(shape);
152 }
153
154 int getLoopCount() const {
155 return data.getLoopCount();
156 }
157
158 bool isSolid() const {
159 return data.isSolid();
160 }
161
162 void setSolid(bool on) {
163 data.setSolid(on);
164 }
165
166 bool isWinding() const {
167 return data.isWinding();
168 }
169
170 void setWinding(bool on) {
171 data.setWinding(on);
172 }
173
174 bool getAutoRegen() const {
175 return data.getAutoRegen();
176 }
177
178 void setAutoRegen(bool on) {
179 data.setAutoRegen(on);
180 }
181
182 double getScale() const {
183 return data.getScale();
184 }
185
186 void setScale(double s) {
187 data.setScale(s);
188 }
189
190 double getAngle() const {
191 return data.getAngle();
192 }
193
194 void setAngle(double a) {
195 data.setAngle(a);
196 }
197
199 return data.getOriginPoint();
200 }
201
202 void setOriginPoint(const RVector& op) {
203 data.setOriginPoint(op);
204 }
205
206 QString getPatternName() const {
207 return data.getPatternName();
208 }
209
210 void setPatternName(const QString& n) {
211 data.setPatternName(n);
212 }
213
214 int getTransparency() const {
215 return data.getTransparency();
216 }
217
218 void setTransparency(int t) {
219 data.setTransparency(t);
220 }
221
223 data.clearCustomPattern();
224 }
225
226 QList<QSharedPointer<RShape> > getLoopBoundary(int index) const {
227 return data.getLoopBoundary(index);
228 }
229
230 QList<RPolyline> getBoundaryAsPolylines(double segmentLength = RDEFAULT_MIN1) const {
231 return data.getBoundaryAsPolylines(segmentLength);
232 }
233
234 virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false, QList<RObject::Id>* entityIds = NULL) const {
235 return data.getShapes(queryBox, ignoreComplex, segment);
236 }
237
238 virtual QList<QSharedPointer<RShape> > getExploded() const {
239 return data.getExploded();
240 }
241
242 virtual void setViewportContext(const RViewportData& origin);
243
244protected:
245 virtual void print(QDebug dbg) const;
246
247protected:
249};
250
252Q_DECLARE_METATYPE(QSharedPointer<RHatchEntity>)
253Q_DECLARE_METATYPE(QSharedPointer<RHatchEntity>*)
254
255#endif
#define RDEFAULT_RBOX
Definition RBox.h:35
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RExplodable.h:30
Q_DECLARE_METATYPE(RMath *)
Represents a box e.g.
Definition RBox.h:46
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
virtual void setViewportContext(const RViewportData &)
Definition REntity.h:592
Abstract base class for exporters.
Definition RExporter.h:78
Stores and manages all data that defines the geometry and appearance of a hatch or solid fill entity.
Definition RHatchData.h:51
Point entity.
Definition RHatchEntity.h:43
static RPropertyTypeId PropertyLinetype
Definition RHatchEntity.h:53
bool hasCustomPattern() const
Definition RHatchEntity.h:107
void setData(RHatchData &d)
Definition RHatchEntity.h:103
static RPropertyTypeId PropertyOriginX
Definition RHatchEntity.h:69
void setAngle(double a)
Definition RHatchEntity.h:194
void setWinding(bool on)
Definition RHatchEntity.h:170
static RPropertyTypeId PropertyEntityPattern
Definition RHatchEntity.h:65
static RPropertyTypeId PropertyWorkingSet
Definition RHatchEntity.h:49
QList< RPainterPath > getPainterPaths(bool draft=false, double pixelSizeHint=0.0) const
Definition RHatchEntity.h:138
QString getPatternName() const
Definition RHatchEntity.h:206
static RPropertyTypeId PropertyLineweight
Definition RHatchEntity.h:55
static RPropertyTypeId PropertyPatternName
Definition RHatchEntity.h:64
RPattern getCustomPattern() const
Definition RHatchEntity.h:111
bool getAutoRegen() const
Definition RHatchEntity.h:174
static RPropertyTypeId PropertyScaleFactor
Definition RHatchEntity.h:66
virtual RHatchData & getData()
Definition RHatchEntity.h:130
static RPropertyTypeId PropertyLength
Definition RHatchEntity.h:76
void setTransparency(int t)
Definition RHatchEntity.h:218
bool isSolid() const
Definition RHatchEntity.h:158
static RPropertyTypeId PropertyBlock
Definition RHatchEntity.h:51
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition RHatchEntity.h:91
static RPropertyTypeId PropertyWinding
Definition RHatchEntity.h:61
static RPropertyTypeId PropertyType
Definition RHatchEntity.h:50
static RPropertyTypeId PropertyTotalLength
Definition RHatchEntity.h:77
QList< QSharedPointer< RShape > > getLoopBoundary(int index) const
Definition RHatchEntity.h:226
static RPropertyTypeId PropertySolid
Definition RHatchEntity.h:60
static RPropertyTypeId PropertyDisplayedColor
Definition RHatchEntity.h:57
int getTransparency() const
Definition RHatchEntity.h:214
static RPropertyTypeId PropertyAngle
Definition RHatchEntity.h:67
double getAngle() const
Definition RHatchEntity.h:190
static RPropertyTypeId PropertyProtected
Definition RHatchEntity.h:48
RVector getOriginPoint() const
Definition RHatchEntity.h:198
static RS::EntityType getRtti()
Definition RHatchEntity.h:87
void setAutoRegen(bool on)
Definition RHatchEntity.h:178
void setCustomPattern(const RPattern &p)
Definition RHatchEntity.h:115
int getLoopCount() const
Definition RHatchEntity.h:154
void clearCustomPattern()
Definition RHatchEntity.h:222
bool isWinding() const
Definition RHatchEntity.h:166
RHatchData data
Definition RHatchEntity.h:248
virtual QSharedPointer< RObject > clone() const
Definition RHatchEntity.h:95
static RPropertyTypeId PropertyTransparency
Definition RHatchEntity.h:62
QSharedPointer< RHatchEntity > cloneToHatchEntity() const
Definition RHatchEntity.h:99
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RHatchEntity.h:46
virtual QList< QSharedPointer< RShape > > getExploded() const
Definition RHatchEntity.h:238
static RPropertyTypeId PropertyLayer
Definition RHatchEntity.h:52
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false, QList< RObject::Id > *entityIds=NULL) const
Definition RHatchEntity.h:234
void setOriginPoint(const RVector &op)
Definition RHatchEntity.h:202
virtual int getComplexity() const
Definition RHatchEntity.h:142
void newLoop()
Definition RHatchEntity.h:146
static RPropertyTypeId PropertyLinetypeScale
Definition RHatchEntity.h:54
static RPropertyTypeId PropertyDrawOrder
Definition RHatchEntity.h:58
QList< RPolyline > getBoundaryAsPolylines(double segmentLength=RDEFAULT_MIN1) const
Definition RHatchEntity.h:230
double getScale() const
Definition RHatchEntity.h:182
static RPropertyTypeId PropertyTotalArea
Definition RHatchEntity.h:79
static RPropertyTypeId PropertyVertexNY
Definition RHatchEntity.h:73
static RPropertyTypeId PropertyVertexNX
Definition RHatchEntity.h:72
static RPropertyTypeId PropertyOriginY
Definition RHatchEntity.h:70
void addBoundary(QSharedPointer< RShape > shape)
Definition RHatchEntity.h:150
static RPropertyTypeId PropertyColor
Definition RHatchEntity.h:56
void setScale(double s)
Definition RHatchEntity.h:186
static RPropertyTypeId PropertyArea
Definition RHatchEntity.h:78
void setPatternName(const QString &n)
Definition RHatchEntity.h:210
static RPropertyTypeId PropertyVertexNZ
Definition RHatchEntity.h:74
void setSolid(bool on)
Definition RHatchEntity.h:162
virtual const RHatchData & getData() const
Definition RHatchEntity.h:134
static RPropertyTypeId PropertyHandle
Definition RHatchEntity.h:47
XYZ
Definition RObject.h:82
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPattern.h:38
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
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ EntityHatch
Hatch.
Definition RS.h:273
Transaction implementation.
Definition RTransaction.h:73
Represents a 3d vector (x/y/z).
Definition RVector.h:47
Stores and manages all data that defines the geometry and appearance of a viewport entity.
Definition RViewportData.h:53
#define QCADENTITY_EXPORT
Definition entity_global.h:10
char s
Definition opennurbs_string.cpp:32
#define NULL
Definition opennurbs_system.h:256