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