QCAD
Open Source 2D CAD
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 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
54 
57 
62 
65 
69 
70 public:
71  RHatchEntity(RDocument* document, const RHatchData& data);
72  virtual ~RHatchEntity();
73 
74  static void init();
75 
76  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
78  }
79 
80  virtual RHatchEntity* clone() const;
81 
82  void setData(RHatchData& d) {
83  data = d;
84  }
85 
86  bool hasCustomPattern() const {
87  return data.hasCustomPattern();
88  }
89 
91  return data.getCustomPattern();
92  }
93 
94  void setCustomPattern(const RPattern& p) {
95  data.setCustomPattern(p);
96  }
97 
98  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
99  RTransaction* transaction=NULL);
100  bool setBoundaryVector(RObject::XYZ xyz, const QVariant& value, bool condition);
101  RVector setComponent(const RVector& p, double v, RObject::XYZ xyz);
102 
103  virtual QPair<QVariant, RPropertyAttributes> getProperty(
104  RPropertyTypeId& propertyTypeId,
105  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
106 
107  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
108 
109  virtual RHatchData& getData() {
110  return data;
111  }
112 
113  virtual const RHatchData& getData() const {
114  return data;
115  }
116 
117  QList<RPainterPath> getPainterPaths(bool draft = false, double pixelSizeHint = 0.0) const {
118  return data.getPainterPaths(draft, pixelSizeHint);
119  }
120 
121  virtual int getComplexity() const {
122  return data.getComplexity();
123  }
124 
125  void newLoop() {
126  data.newLoop();
127  }
128 
129  void addBoundary(QSharedPointer<RShape> shape) {
130  data.addBoundary(shape);
131  }
132 
133  int getLoopCount() const {
134  return data.getLoopCount();
135  }
136 
137  bool isSolid() const {
138  return data.isSolid();
139  }
140 
141  void setSolid(bool on) {
142  data.setSolid(on);
143  }
144 
145  double getScale() const {
146  return data.getScale();
147  }
148 
149  void setScale(double s) {
150  data.setScale(s);
151  }
152 
153  double getAngle() const {
154  return data.getAngle();
155  }
156 
157  void setAngle(double a) {
158  data.setAngle(a);
159  }
160 
162  return data.getOriginPoint();
163  }
164 
165  void setOriginPoint(const RVector& op) {
166  data.setOriginPoint(op);
167  }
168 
169  QString getPatternName() const {
170  return data.getPatternName();
171  }
172 
173  void setPatternName(const QString& n) {
174  data.setPatternName(n);
175  }
176 
177  int getTransparency() const {
178  return data.getTransparency();
179  }
180 
181  void setTransparency(int t) {
182  data.setTransparency(t);
183  }
184 
186  data.clearCustomPattern();
187  }
188 
189  QList<QSharedPointer<RShape> > getLoopBoundary(int index) const {
190  return data.getLoopBoundary(index);
191  }
192 
193  QList<RPolyline> getBoundaryAsPolylines(double segmentLength) const {
194  return data.getBoundaryAsPolylines(segmentLength);
195  }
196 
197  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
198  return data.getShapes(queryBox, ignoreComplex, segment);
199  }
200 
201  virtual QList<QSharedPointer<RShape> > getExploded() const {
202  return data.getExploded();
203  }
204 
205  virtual void setViewportContext(const RViewportData& origin);
206 
207 protected:
208  virtual void print(QDebug dbg) const;
209 
210 protected:
212 };
213 
215 Q_DECLARE_METATYPE(QSharedPointer<RHatchEntity>)
216 Q_DECLARE_METATYPE(QSharedPointer<RHatchEntity>*)
217 
218 #endif
RHatchEntity::clearCustomPattern
void clearCustomPattern()
Definition: RHatchEntity.h:185
RHatchEntity::PropertyPatternName
static RPropertyTypeId PropertyPatternName
Definition: RHatchEntity.h:58
RObject::XYZ
XYZ
Definition: RObject.h:79
REntity.h
RHatchEntity::PropertyLinetype
static RPropertyTypeId PropertyLinetype
Definition: RHatchEntity.h:48
RHatchEntity::PropertyDrawOrder
static RPropertyTypeId PropertyDrawOrder
Definition: RHatchEntity.h:53
RHatchEntity::addBoundary
void addBoundary(QSharedPointer< RShape > shape)
Definition: RHatchEntity.h:129
RHatchData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RHatchData.h:44
RHatchEntity::PropertyLineweight
static RPropertyTypeId PropertyLineweight
Definition: RHatchEntity.h:50
RHatchEntity::getTransparency
int getTransparency() const
Definition: RHatchEntity.h:177
RHatchEntity::PropertySolid
static RPropertyTypeId PropertySolid
Definition: RHatchEntity.h:55
RHatchEntity::getPatternName
QString getPatternName() const
Definition: RHatchEntity.h:169
RHatchEntity::getOriginPoint
RVector getOriginPoint() const
Definition: RHatchEntity.h:161
RHatchEntity::setData
void setData(RHatchData &d)
Definition: RHatchEntity.h:82
RHatchEntity::getComplexity
virtual int getComplexity() const
Definition: RHatchEntity.h:121
RHatchEntity::getShapes
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RHatchEntity.h:197
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RHatchEntity::hasCustomPattern
bool hasCustomPattern() const
Definition: RHatchEntity.h:86
RHatchEntity::getData
virtual const RHatchData & getData() const
Definition: RHatchEntity.h:113
RHatchEntity::PropertyTransparency
static RPropertyTypeId PropertyTransparency
Definition: RHatchEntity.h:56
RHatchEntity::setTransparency
void setTransparency(int t)
Definition: RHatchEntity.h:181
RHatchEntity::PropertyScaleFactor
static RPropertyTypeId PropertyScaleFactor
Definition: RHatchEntity.h:60
RHatchEntity::PropertyOriginY
static RPropertyTypeId PropertyOriginY
Definition: RHatchEntity.h:64
RHatchEntity::data
RHatchData data
Definition: RHatchEntity.h:211
RHatchEntity::getPainterPaths
QList< RPainterPath > getPainterPaths(bool draft=false, double pixelSizeHint=0.0) const
Definition: RHatchEntity.h:117
RViewportData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RViewportData.h:40
RHatchEntity::getBoundaryAsPolylines
QList< RPolyline > getBoundaryAsPolylines(double segmentLength) const
Definition: RHatchEntity.h:193
QCADENTITY_EXPORT
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
REntity::exportEntity
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RHatchEntity::PropertyOriginX
static RPropertyTypeId PropertyOriginX
Definition: RHatchEntity.h:63
RHatchEntity::PropertyWorkingSet
static RPropertyTypeId PropertyWorkingSet
Definition: RHatchEntity.h:44
RHatchEntity::setCustomPattern
void setCustomPattern(const RPattern &p)
Definition: RHatchEntity.h:94
RHatchEntity::getCustomPattern
RPattern getCustomPattern() const
Definition: RHatchEntity.h:90
RHatchEntity::setOriginPoint
void setOriginPoint(const RVector &op)
Definition: RHatchEntity.h:165
REntity
Base class for all entity classes.
Definition: REntity.h:65
RHatchData.h
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RPattern
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPattern.h:44
REntity::setViewportContext
virtual void setViewportContext(const RViewportData &)
Definition: REntity.h:576
RHatchEntity::PropertyLayer
static RPropertyTypeId PropertyLayer
Definition: RHatchEntity.h:47
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
RHatchEntity::PropertyCustom
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RHatchEntity.h:41
RHatchEntity
Point entity.
Definition: RHatchEntity.h:38
RHatchEntity::setAngle
void setAngle(double a)
Definition: RHatchEntity.h:157
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
RHatchEntity::getScale
double getScale() const
Definition: RHatchEntity.h:145
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RHatchEntity::PropertyBlock
static RPropertyTypeId PropertyBlock
Definition: RHatchEntity.h:46
RHatchEntity::PropertyVertexNZ
static RPropertyTypeId PropertyVertexNZ
Definition: RHatchEntity.h:68
RHatchEntity::getLoopBoundary
QList< QSharedPointer< RShape > > getLoopBoundary(int index) const
Definition: RHatchEntity.h:189
RHatchEntity::PropertyVertexNX
static RPropertyTypeId PropertyVertexNX
Definition: RHatchEntity.h:66
RHatchEntity::PropertyVertexNY
static RPropertyTypeId PropertyVertexNY
Definition: RHatchEntity.h:67
RHatchEntity::PropertyLinetypeScale
static RPropertyTypeId PropertyLinetypeScale
Definition: RHatchEntity.h:49
RHatchEntity::PropertyProtected
static RPropertyTypeId PropertyProtected
Definition: RHatchEntity.h:43
REntity::clone
virtual REntity * clone() const =0
RHatchEntity::PropertyDisplayedColor
static RPropertyTypeId PropertyDisplayedColor
Definition: RHatchEntity.h:52
RHatchEntity::PropertyEntityPattern
static RPropertyTypeId PropertyEntityPattern
Definition: RHatchEntity.h:59
REntity::getProperty
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:230
RDEFAULT_RBOX
#define RDEFAULT_RBOX
Definition: RBox.h:32
RHatchEntity::setScale
void setScale(double s)
Definition: RHatchEntity.h:149
RHatchEntity::getLoopCount
int getLoopCount() const
Definition: RHatchEntity.h:133
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
RHatchEntity::setPatternName
void setPatternName(const QString &n)
Definition: RHatchEntity.h:173
RHatchEntity::getData
virtual RHatchData & getData()
Definition: RHatchEntity.h:109
RHatchEntity::setSolid
void setSolid(bool on)
Definition: RHatchEntity.h:141
RHatchEntity::getExploded
virtual QList< QSharedPointer< RShape > > getExploded() const
Definition: RHatchEntity.h:201
RBox
Represents a box e.g.
Definition: RBox.h:43
entity_global.h
RHatchEntity::isSolid
bool isSolid() const
Definition: RHatchEntity.h:137
RHatchEntity::PropertyHandle
static RPropertyTypeId PropertyHandle
Definition: RHatchEntity.h:42
RHatchEntity::getStaticPropertyTypeIds
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RHatchEntity.h:76
RHatchEntity::newLoop
void newLoop()
Definition: RHatchEntity.h:125
RHatchEntity::PropertyAngle
static RPropertyTypeId PropertyAngle
Definition: RHatchEntity.h:61
RHatchEntity::PropertyColor
static RPropertyTypeId PropertyColor
Definition: RHatchEntity.h:51
RHatchEntity::PropertyType
static RPropertyTypeId PropertyType
Definition: RHatchEntity.h:45
RHatchEntity::getAngle
double getAngle() const
Definition: RHatchEntity.h:153