QCAD
Open Source 2D CAD
RSolidEntity.h
Go to the documentation of this file.
1 
20 #ifndef RSOLIDENTITY_H
21 #define RSOLIDENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RSolidData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
52 
65 
67 
68 public:
69  RSolidEntity(RDocument* document, const RSolidData& data,
70  RObject::Id objectId = RObject::INVALID_ID);
71  virtual ~RSolidEntity();
72 
73  static void init();
74 
75  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
77  }
78 
79  virtual RSolidEntity* clone() const {
80  return new RSolidEntity(*this);
81  }
82 
83  virtual RS::EntityType getType() const {
84  return RS::EntitySolid;
85  }
86 
87  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
88  RTransaction* transaction=NULL);
89  QPair<QVariant, RPropertyAttributes> getProperty(
90  RPropertyTypeId& propertyTypeId,
91  bool humanReadable = false, bool noAttributes = false);
92 
93  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
94 
95  virtual RSolidData& getData() {
96  return data;
97  }
98 
99  virtual const RSolidData& getData() const {
100  return data;
101  }
102 
103  RVector getVertexAt(int i) const {
104  return data.getVertexAt(i);
105  }
106 
107  int countVertices() const {
108  return data.countVertices();
109  }
110 
112  return data.getStartPoint();
113  }
114 
116  return data.getEndPoint();
117  }
118 
119  double getDirection1() const {
120  return data.getDirection1();
121  }
122 
123  double getDirection2() const {
124  return data.getDirection2();
125  }
126 
127  bool reverse() {
128  return data.reverse();
129  }
130 
132  const RVector& trimPoint) {
133  return data.getTrimEnd(coord, trimPoint);
134  }
135 
136  void trimStartPoint(const RVector& p) {
137  return data.trimStartPoint(p);
138  }
139  void trimEndPoint(const RVector& p) {
140  return data.trimEndPoint(p);
141  }
142 
143  double getLength() const {
144  return data.getLength();
145  }
146 
147 protected:
148  virtual void print(QDebug dbg) const;
149 
150 protected:
152 };
153 
155 Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>)
156 Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>*)
157 
158 #endif
Ending
Entity ending.
Definition: RS.h:136
virtual RSolidData & getData()
Definition: RSolidEntity.h:95
static RPropertyTypeId PropertyHandle
Definition: RSolidEntity.h:42
static RPropertyTypeId PropertyColor
Definition: RSolidEntity.h:50
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
int countVertices() const
Definition: RSolidEntity.h:107
Solid entity.
Definition: RSolidEntity.h:38
static RPropertyTypeId PropertyPoint4Y
Definition: RSolidEntity.h:63
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:75
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
void trimEndPoint(const RVector &p)
Definition: RSolidEntity.h:139
static RPropertyTypeId PropertyPoint1Y
Definition: RSolidEntity.h:54
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
RSolidData data
Definition: RSolidEntity.h:151
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RSolidEntity.h:75
void trimStartPoint(const RVector &p)
Definition: RSolidEntity.h:136
int Id
Definition: RObject.h:53
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RSolidEntity.h:41
static RPropertyTypeId PropertyPoint3Z
Definition: RSolidEntity.h:61
Transaction implementation.
Definition: RTransaction.h:70
static RPropertyTypeId PropertyPoint1X
Definition: RSolidEntity.h:53
static RPropertyTypeId PropertyProtected
Definition: RSolidEntity.h:43
virtual RSolidEntity * clone() const
Definition: RSolidEntity.h:79
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RSolidData.h:39
static const Id INVALID_ID
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RObject.h:54
static RPropertyTypeId PropertyLength
Definition: RSolidEntity.h:66
static RPropertyTypeId PropertyLinetype
Definition: RSolidEntity.h:47
Solid.
Definition: RS.h:90
static RPropertyTypeId PropertyLayer
Definition: RSolidEntity.h:46
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
static RPropertyTypeId PropertyDrawOrder
Definition: RSolidEntity.h:51
static RPropertyTypeId PropertyBlock
Definition: RSolidEntity.h:45
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyPoint2X
Definition: RSolidEntity.h:56
virtual RS::EntityType getType() const
Definition: RSolidEntity.h:83
static RPropertyTypeId PropertyPoint2Z
Definition: RSolidEntity.h:58
RS::Ending getTrimEnd(const RVector &coord, const RVector &trimPoint)
Definition: RSolidEntity.h:131
static RPropertyTypeId PropertyPoint4Z
Definition: RSolidEntity.h:64
virtual const RSolidData & getData() const
Definition: RSolidEntity.h:99
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:193
RVector getEndPoint() const
Definition: RSolidEntity.h:115
static RPropertyTypeId PropertyType
Definition: RSolidEntity.h:44
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 PropertyPoint3X
Definition: RSolidEntity.h:59
Abstract base class for exporters.
Definition: RExporter.h:63
double getDirection2() const
Definition: RSolidEntity.h:123
RVector getVertexAt(int i) const
Definition: RSolidEntity.h:103
bool reverse()
Definition: RSolidEntity.h:127
static RPropertyTypeId PropertyPoint3Y
Definition: RSolidEntity.h:60
double getDirection1() const
Definition: RSolidEntity.h:119
static RPropertyTypeId PropertyPoint2Y
Definition: RSolidEntity.h:57
static RPropertyTypeId PropertyPoint1Z
Definition: RSolidEntity.h:55
static RPropertyTypeId PropertyPoint4X
Definition: RSolidEntity.h:62
double getLength() const
Definition: RSolidEntity.h:143
RVector getStartPoint() const
Definition: RSolidEntity.h:111
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
static RPropertyTypeId PropertyLineweight
Definition: RSolidEntity.h:49
static RPropertyTypeId PropertyLinetypeScale
Definition: RSolidEntity.h:48
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:385