QCAD
Open Source 2D CAD
RCircleEntity.h
Go to the documentation of this file.
1 
20 #ifndef RCIRCLENTITY_H
21 #define RCIRCLENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RCircleData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
56 
60 
61 public:
62  RCircleEntity(RDocument* document, const RCircleData& data,
63  RObject::Id objectId = RObject::INVALID_ID);
64  RCircleEntity(const RCircleEntity& other);
65  virtual ~RCircleEntity();
66 
67  static void init();
68 
69  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
71  }
72 
73  virtual RCircleEntity* clone() const {
74  return new RCircleEntity(*this);
75  }
76 
77  virtual RS::EntityType getType() const {
78  return RS::EntityCircle;
79  }
80 
81  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
82  RTransaction* transaction=NULL);
83  QPair<QVariant, RPropertyAttributes> getProperty(
84  RPropertyTypeId& propertyTypeId,
85  bool humanReadable = false, bool noAttributes = false);
86 
87  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
88 
89  virtual RCircleData& getData() {
90  return data;
91  }
92 
93  virtual const RCircleData& getData() const {
94  return data;
95  }
96 
97  RVector getCenter() const {
98  return data.getCenter();
99  }
100 
101  double getRadius() const {
102  return data.getRadius();
103  }
104 
105  void setRadius(double radius) {
106  data.setRadius(radius);
107  }
108 
109  double getLength() const {
110  return data.getLength();
111  }
112 
113 protected:
114  virtual void print(QDebug dbg) const;
115 
116 protected:
118 };
119 
121 Q_DECLARE_METATYPE(QSharedPointer<RCircleEntity>)
122 Q_DECLARE_METATYPE(QSharedPointer<RCircleEntity>*)
123 
124 #endif
static RPropertyTypeId PropertyBlock
Definition: RCircleEntity.h:45
Circle.
Definition: RS.h:88
static RPropertyTypeId PropertyCenterZ
Definition: RCircleEntity.h:54
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
void setRadius(double radius)
Definition: RCircleEntity.h:105
double getLength() const
Definition: RCircleEntity.h:109
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:75
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
static RPropertyTypeId PropertyType
Definition: RCircleEntity.h:44
static RPropertyTypeId PropertyDiameter
Definition: RCircleEntity.h:57
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RCircleData.h:40
virtual RCircleData & getData()
Definition: RCircleEntity.h:89
Circle entity.
Definition: RCircleEntity.h:38
int Id
Definition: RObject.h:53
static RPropertyTypeId PropertyLayer
Definition: RCircleEntity.h:46
Transaction implementation.
Definition: RTransaction.h:70
static RPropertyTypeId PropertyColor
Definition: RCircleEntity.h:50
static RPropertyTypeId PropertyArea
Definition: RCircleEntity.h:59
double getRadius() const
Definition: RCircleEntity.h:101
static RPropertyTypeId PropertyProtected
Definition: RCircleEntity.h:43
static RPropertyTypeId PropertyHandle
Definition: RCircleEntity.h:42
static const Id INVALID_ID
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RObject.h:54
static RPropertyTypeId PropertyRadius
Definition: RCircleEntity.h:55
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
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RCircleEntity.h:41
Q_DECLARE_METATYPE(RMath *)
virtual RCircleEntity * clone() const
Definition: RCircleEntity.h:73
virtual const RCircleData & getData() const
Definition: RCircleEntity.h:93
static RPropertyTypeId PropertyDrawOrder
Definition: RCircleEntity.h:51
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RCircleEntity.h:69
static RPropertyTypeId PropertyLinetypeScale
Definition: RCircleEntity.h:48
static RPropertyTypeId PropertyLineweight
Definition: RCircleEntity.h:49
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:193
virtual RS::EntityType getType() const
Definition: RCircleEntity.h:77
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
Abstract base class for exporters.
Definition: RExporter.h:63
static RPropertyTypeId PropertyLinetype
Definition: RCircleEntity.h:47
static RPropertyTypeId PropertyCenterX
Definition: RCircleEntity.h:52
RVector getCenter() const
Definition: RCircleEntity.h:97
static RPropertyTypeId PropertyCenterY
Definition: RCircleEntity.h:53
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
RCircleData data
Definition: RCircleEntity.h:117
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:385
static RPropertyTypeId PropertyCircumference
Definition: RCircleEntity.h:58