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