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:
53 
66 
69 
70 public:
71  RSolidEntity(RDocument* document, const RSolidData& data);
72  virtual ~RSolidEntity();
73 
74  static void init();
75 
76  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
78  }
79 
80  virtual RSolidEntity* clone() const {
81  return new RSolidEntity(*this);
82  }
83 
84  virtual RS::EntityType getType() const {
85  return RS::EntitySolid;
86  }
87 
88  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
89  RTransaction* transaction=NULL);
90  QPair<QVariant, RPropertyAttributes> getProperty(
91  RPropertyTypeId& propertyTypeId,
92  bool humanReadable = false, bool noAttributes = false);
93 
94  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
95 
96  virtual RSolidData& getData() {
97  return data;
98  }
99 
100  virtual const RSolidData& getData() const {
101  return data;
102  }
103 
104  RVector getVertexAt(int i) const {
105  return data.getVertexAt(i);
106  }
107 
108  int countVertices() const {
109  return data.countVertices();
110  }
111 
113  return data.getStartPoint();
114  }
115 
117  return data.getEndPoint();
118  }
119 
120  double getDirection1() const {
121  return data.getDirection1();
122  }
123 
124  double getDirection2() const {
125  return data.getDirection2();
126  }
127 
128  bool reverse() {
129  return data.reverse();
130  }
131 
132  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
133  return data.getTrimEnd(trimPoint, clickPoint);
134  }
135 
136  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
137  return data.trimStartPoint(trimPoint, clickPoint, extend);
138  }
139  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
140  return data.trimEndPoint(trimPoint, clickPoint, extend);
141  }
142 
143  double getLength() const {
144  return data.getLength();
145  }
146 
147  QList<QSharedPointer<RShape> > getExploded() const {
148  return data.getExploded();
149  }
150 
151 protected:
152  virtual void print(QDebug dbg) const;
153 
154 protected:
156 };
157 
159 Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>)
160 Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>*)
161 
162 #endif
Ending
Entity ending.
Definition: RS.h:150
QList< QSharedPointer< RShape > > getExploded() const
Definition: RSolidEntity.h:147
virtual RSolidData & getData()
Definition: RSolidEntity.h:96
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:108
Solid entity.
Definition: RSolidEntity.h:38
static RPropertyTypeId PropertyPoint4Y
Definition: RSolidEntity.h:64
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
static RPropertyTypeId PropertyPoint1Y
Definition: RSolidEntity.h:55
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
RSolidData data
Definition: RSolidEntity.h:155
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RSolidEntity.h:132
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RSolidEntity.h:76
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RSolidEntity.h:41
static RPropertyTypeId PropertyPoint3Z
Definition: RSolidEntity.h:62
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyPoint1X
Definition: RSolidEntity.h:54
static RPropertyTypeId PropertyProtected
Definition: RSolidEntity.h:43
virtual RSolidEntity * clone() const
Definition: RSolidEntity.h:80
static RPropertyTypeId PropertyTotalLength
Definition: RSolidEntity.h:68
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RSolidData.h:39
static RPropertyTypeId PropertyDisplayedColor
Definition: RSolidEntity.h:51
static RPropertyTypeId PropertyLength
Definition: RSolidEntity.h:67
static RPropertyTypeId PropertyLinetype
Definition: RSolidEntity.h:47
Solid.
Definition: RS.h:100
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:52
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:67
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyPoint2X
Definition: RSolidEntity.h:57
virtual RS::EntityType getType() const
Definition: RSolidEntity.h:84
static RPropertyTypeId PropertyPoint2Z
Definition: RSolidEntity.h:59
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RSolidEntity.h:139
static RPropertyTypeId PropertyPoint4Z
Definition: RSolidEntity.h:65
virtual const RSolidData & getData() const
Definition: RSolidEntity.h:100
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:228
RVector getEndPoint() const
Definition: RSolidEntity.h:116
static RPropertyTypeId PropertyType
Definition: RSolidEntity.h:44
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 PropertyPoint3X
Definition: RSolidEntity.h:60
Abstract base class for exporters.
Definition: RExporter.h:71
double getDirection2() const
Definition: RSolidEntity.h:124
RVector getVertexAt(int i) const
Definition: RSolidEntity.h:104
bool reverse()
Definition: RSolidEntity.h:128
static RPropertyTypeId PropertyPoint3Y
Definition: RSolidEntity.h:61
double getDirection1() const
Definition: RSolidEntity.h:120
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RSolidEntity.h:136
static RPropertyTypeId PropertyPoint2Y
Definition: RSolidEntity.h:58
static const RVector invalid
invalid vector
Definition: RVector.h:309
static RPropertyTypeId PropertyPoint1Z
Definition: RSolidEntity.h:56
static RPropertyTypeId PropertyPoint4X
Definition: RSolidEntity.h:63
double getLength() const
Definition: RSolidEntity.h:143
RVector getStartPoint() const
Definition: RSolidEntity.h:112
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:428