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  virtual RS::EntityType getType() const {
81  return RS::EntityHatch;
82  }
83 
84  void setData(RHatchData& d) {
85  data = d;
86  }
87 
88  bool hasCustomPattern() const {
89  return data.hasCustomPattern();
90  }
91 
93  return data.getCustomPattern();
94  }
95 
96  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
97  RTransaction* transaction=NULL);
98  bool setBoundaryVector(RObject::XYZ xyz, const QVariant& value, bool condition);
99  RVector setComponent(const RVector& p, double v, RObject::XYZ xyz);
100 
101  QPair<QVariant, RPropertyAttributes> getProperty(
102  RPropertyTypeId& propertyTypeId,
103  bool humanReadable = false, bool noAttributes = false);
104 
105  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
106 
107  virtual RHatchData& getData() {
108  return data;
109  }
110 
111  virtual const RHatchData& getData() const {
112  return data;
113  }
114 
115  QList<RPainterPath> getPainterPaths(bool draft = false, double pixelSizeHint = 0.0) const {
116  return data.getPainterPaths(draft, pixelSizeHint);
117  }
118 
119  virtual int getComplexity() const {
120  return data.getComplexity();
121  }
122 
123  void newLoop() {
124  data.newLoop();
125  }
126 
127  void addBoundary(QSharedPointer<RShape> shape) {
128  data.addBoundary(shape);
129  }
130 
131  int getLoopCount() const {
132  return data.getLoopCount();
133  }
134 
135  bool isSolid() const {
136  return data.isSolid();
137  }
138 
139  void setSolid(bool on) {
140  data.setSolid(on);
141  }
142 
143  double getScale() const {
144  return data.getScale();
145  }
146 
147  void setScale(double s) {
148  data.setScale(s);
149  }
150 
151  double getAngle() const {
152  return data.getAngle();
153  }
154 
155  void setAngle(double a) {
156  data.setAngle(a);
157  }
158 
160  return data.getOriginPoint();
161  }
162 
163  void setOriginPoint(const RVector& op) {
164  data.setOriginPoint(op);
165  }
166 
167  QString getPatternName() const {
168  return data.getPatternName();
169  }
170 
171  void setPatternName(const QString& n) {
172  data.setPatternName(n);
173  }
174 
176  data.clearCustomPattern();
177  }
178 
179  QList<QSharedPointer<RShape> > getLoopBoundary(int index) const {
180  return data.getLoopBoundary(index);
181  }
182 
183  QList<RPolyline> getBoundaryAsPolylines(double segmentLength) const {
184  return data.getBoundaryAsPolylines(segmentLength);
185  }
186 
187  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const {
188  Q_UNUSED(ignoreComplex)
189  return data.getShapes(queryBox);
190  }
191 
192  virtual QList<QSharedPointer<RShape> > getExploded() const {
193  return data.getExploded();
194  }
195 
196 protected:
197  virtual void print(QDebug dbg) const;
198 
199 protected:
201 };
202 
204 Q_DECLARE_METATYPE(QSharedPointer<RHatchEntity>)
205 Q_DECLARE_METATYPE(QSharedPointer<RHatchEntity>*)
206 
207 #endif
Represents a box e.g.
Definition: RBox.h:43
static RPropertyTypeId PropertyPatternName
Definition: RHatchEntity.h:56
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false) const
Definition: RHatchEntity.h:187
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:200
bool hasCustomPattern() const
Definition: RHatchEntity.h:88
virtual QList< QSharedPointer< RShape > > getExploded() const
Definition: RHatchEntity.h:192
static RPropertyTypeId PropertyLinetypeScale
Definition: RHatchEntity.h:48
int getLoopCount() const
Definition: RHatchEntity.h:131
virtual int getComplexity() const
Definition: RHatchEntity.h:119
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
void setOriginPoint(const RVector &op)
Definition: RHatchEntity.h:163
QList< RPainterPath > getPainterPaths(bool draft=false, double pixelSizeHint=0.0) const
Definition: RHatchEntity.h:115
void newLoop()
Definition: RHatchEntity.h:123
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPattern.h:43
Transaction implementation.
Definition: RTransaction.h:70
static RPropertyTypeId PropertySolid
Definition: RHatchEntity.h:54
void setSolid(bool on)
Definition: RHatchEntity.h:139
static RPropertyTypeId PropertyHandle
Definition: RHatchEntity.h:42
void setPatternName(const QString &n)
Definition: RHatchEntity.h:171
RPattern getCustomPattern() const
Definition: RHatchEntity.h:92
RVector getOriginPoint() const
Definition: RHatchEntity.h:159
void addBoundary(QSharedPointer< RShape > shape)
Definition: RHatchEntity.h:127
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RHatchEntity.h:74
static RPropertyTypeId PropertyOriginX
Definition: RHatchEntity.h:61
QList< RPolyline > getBoundaryAsPolylines(double segmentLength) const
Definition: RHatchEntity.h:183
Hatch.
Definition: RS.h:113
static RPropertyTypeId PropertyScaleFactor
Definition: RHatchEntity.h:58
static RPropertyTypeId PropertyLineweight
Definition: RHatchEntity.h:49
virtual RS::EntityType getType() const
Definition: RHatchEntity.h:80
static RPropertyTypeId PropertyAngle
Definition: RHatchEntity.h:59
QString getPatternName() const
Definition: RHatchEntity.h:167
virtual REntity * clone() const =0
bool isSolid() const
Definition: RHatchEntity.h:135
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-2016 by Andrew Mustun.
Definition: RHatchData.h:44
static RPropertyTypeId PropertyVertexNX
Definition: RHatchEntity.h:64
virtual const RHatchData & getData() const
Definition: RHatchEntity.h:111
void setAngle(double a)
Definition: RHatchEntity.h:155
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RHatchEntity.h:41
double getScale() const
Definition: RHatchEntity.h:143
static RPropertyTypeId PropertyLinetype
Definition: RHatchEntity.h:47
static RPropertyTypeId PropertyBlock
Definition: RHatchEntity.h:45
void setData(RHatchData &d)
Definition: RHatchEntity.h:84
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:228
void clearCustomPattern()
Definition: RHatchEntity.h:175
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:151
virtual RHatchData & getData()
Definition: RHatchEntity.h:107
QList< QSharedPointer< RShape > > getLoopBoundary(int index) const
Definition: RHatchEntity.h:179
void setScale(double s)
Definition: RHatchEntity.h:147
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:63
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:428