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