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:
54 
67 
70 
71 public:
72  RSolidEntity(RDocument* document, const RSolidData& data);
73  virtual ~RSolidEntity();
74 
75  static void init();
76 
77  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
79  }
80 
81  virtual RSolidEntity* clone() const {
82  return new RSolidEntity(*this);
83  }
84 
85  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
86  RTransaction* transaction=NULL);
87  virtual QPair<QVariant, RPropertyAttributes> getProperty(
88  RPropertyTypeId& propertyTypeId,
89  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
90 
91  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
92 
93  virtual RSolidData& getData() {
94  return data;
95  }
96 
97  virtual const RSolidData& getData() const {
98  return data;
99  }
100 
101  RVector getVertexAt(int i) const {
102  return data.getVertexAt(i);
103  }
104 
105  int countVertices() const {
106  return data.countVertices();
107  }
108 
110  return data.getStartPoint();
111  }
112 
114  return data.getEndPoint();
115  }
116 
117  double getDirection1() const {
118  return data.getDirection1();
119  }
120 
121  double getDirection2() const {
122  return data.getDirection2();
123  }
124 
125  bool reverse() {
126  return data.reverse();
127  }
128 
129  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
130  return data.getTrimEnd(trimPoint, clickPoint);
131  }
132 
133  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
134  return data.trimStartPoint(trimPoint, clickPoint, extend);
135  }
136  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
137  return data.trimEndPoint(trimPoint, clickPoint, extend);
138  }
139 
140  double getLength() const {
141  return data.getLength();
142  }
143 
144  QList<QSharedPointer<RShape> > getExploded() const {
145  return data.getExploded();
146  }
147 
148 protected:
149  virtual void print(QDebug dbg) const;
150 
151 protected:
153 };
154 
156 Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>)
157 Q_DECLARE_METATYPE(QSharedPointer<RSolidEntity>*)
158 
159 #endif
REntity.h
RSolidEntity::getEndPoint
RVector getEndPoint() const
Definition: RSolidEntity.h:113
RSolidEntity::PropertyPoint1Z
static RPropertyTypeId PropertyPoint1Z
Definition: RSolidEntity.h:57
RSolidEntity::getVertexAt
RVector getVertexAt(int i) const
Definition: RSolidEntity.h:101
RSolidEntity::getDirection1
double getDirection1() const
Definition: RSolidEntity.h:117
RSolidEntity::data
RSolidData data
Definition: RSolidEntity.h:152
RSolidEntity::PropertyLinetypeScale
static RPropertyTypeId PropertyLinetypeScale
Definition: RSolidEntity.h:49
RSolidEntity::PropertyPoint3Z
static RPropertyTypeId PropertyPoint3Z
Definition: RSolidEntity.h:63
RSolidEntity::PropertyLength
static RPropertyTypeId PropertyLength
Definition: RSolidEntity.h:68
RSolidEntity::countVertices
int countVertices() const
Definition: RSolidEntity.h:105
RSolidEntity::getStaticPropertyTypeIds
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RSolidEntity.h:77
RSolidEntity::PropertyColor
static RPropertyTypeId PropertyColor
Definition: RSolidEntity.h:51
RSolidEntity::PropertyCustom
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RSolidEntity.h:41
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RS::Ending
Ending
Entity ending.
Definition: RS.h:215
RSolidEntity::PropertyPoint3X
static RPropertyTypeId PropertyPoint3X
Definition: RSolidEntity.h:61
i
int i
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: autostart.js:49
RSolidEntity::PropertyDisplayedColor
static RPropertyTypeId PropertyDisplayedColor
Definition: RSolidEntity.h:52
RSolidEntity::PropertyWorkingSet
static RPropertyTypeId PropertyWorkingSet
Definition: RSolidEntity.h:44
RSolidEntity::trimEndPoint
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RSolidEntity.h:136
RSolidEntity::getData
virtual const RSolidData & getData() const
Definition: RSolidEntity.h:97
RSolidEntity::clone
virtual RSolidEntity * clone() const
Definition: RSolidEntity.h:81
QCADENTITY_EXPORT
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
RSolidEntity::PropertyType
static RPropertyTypeId PropertyType
Definition: RSolidEntity.h:45
REntity::exportEntity
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RSolidEntity::trimStartPoint
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RSolidEntity.h:133
RSolidEntity::PropertyPoint2Y
static RPropertyTypeId PropertyPoint2Y
Definition: RSolidEntity.h:59
RSolidEntity::getTrimEnd
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RSolidEntity.h:129
RSolidEntity::PropertyProtected
static RPropertyTypeId PropertyProtected
Definition: RSolidEntity.h:43
RSolidEntity::PropertyTotalLength
static RPropertyTypeId PropertyTotalLength
Definition: RSolidEntity.h:69
RSolidEntity::PropertyLayer
static RPropertyTypeId PropertyLayer
Definition: RSolidEntity.h:47
REntity
Base class for all entity classes.
Definition: REntity.h:65
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
REntity::init
static void init()
Definition: REntity.cpp:88
REntity::print
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:455
RPropertyTypeId
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:59
RExporter
Abstract base class for exporters.
Definition: RExporter.h:72
REntity::setProperty
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:323
RSolidEntity::PropertyPoint1X
static RPropertyTypeId PropertyPoint1X
Definition: RSolidEntity.h:55
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RSolidEntity::PropertyDrawOrder
static RPropertyTypeId PropertyDrawOrder
Definition: RSolidEntity.h:53
RSolidEntity::PropertyBlock
static RPropertyTypeId PropertyBlock
Definition: RSolidEntity.h:46
RSolidEntity::PropertyLinetype
static RPropertyTypeId PropertyLinetype
Definition: RSolidEntity.h:48
RSolidEntity::PropertyPoint4Z
static RPropertyTypeId PropertyPoint4Z
Definition: RSolidEntity.h:66
RSolidEntity::getStartPoint
RVector getStartPoint() const
Definition: RSolidEntity.h:109
RSolidEntity::getLength
double getLength() const
Definition: RSolidEntity.h:140
RSolidEntity::PropertyPoint2Z
static RPropertyTypeId PropertyPoint2Z
Definition: RSolidEntity.h:60
RSolidEntity::getData
virtual RSolidData & getData()
Definition: RSolidEntity.h:93
RSolidEntity::PropertyHandle
static RPropertyTypeId PropertyHandle
Definition: RSolidEntity.h:42
REntity::getProperty
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:230
RTransaction
Transaction implementation.
Definition: RTransaction.h:74
RPropertyTypeId::getPropertyTypeIds
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo, RPropertyAttributes::Option=RPropertyAttributes::NoOptions)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:273
RSolidData
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RSolidData.h:39
RSolidEntity::PropertyPoint2X
static RPropertyTypeId PropertyPoint2X
Definition: RSolidEntity.h:58
RSolidEntity::PropertyLineweight
static RPropertyTypeId PropertyLineweight
Definition: RSolidEntity.h:50
RVector::invalid
static const RVector invalid
invalid vector
Definition: RVector.h:322
entity_global.h
RSolidEntity::reverse
bool reverse()
Definition: RSolidEntity.h:125
RSolidData.h
RSolidEntity::PropertyPoint3Y
static RPropertyTypeId PropertyPoint3Y
Definition: RSolidEntity.h:62
RSolidEntity::getDirection2
double getDirection2() const
Definition: RSolidEntity.h:121
RSolidEntity::PropertyPoint1Y
static RPropertyTypeId PropertyPoint1Y
Definition: RSolidEntity.h:56
RSolidEntity
Solid entity.
Definition: RSolidEntity.h:38
RSolidEntity::PropertyPoint4Y
static RPropertyTypeId PropertyPoint4Y
Definition: RSolidEntity.h:65
RSolidEntity::getExploded
QList< QSharedPointer< RShape > > getExploded() const
Definition: RSolidEntity.h:144
RSolidEntity::PropertyPoint4X
static RPropertyTypeId PropertyPoint4X
Definition: RSolidEntity.h:64