QCAD
Open Source 2D CAD
RDimensionEntity.h
Go to the documentation of this file.
1 
20 #ifndef RDIMENSIONENTITY_H
21 #define RDIMENSIONENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RDimensionData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40  Q_DECLARE_TR_FUNCTIONS(RDimensionEntity)
41 
42 public:
55 
65 
70  //static RPropertyTypeId PropertyHeight;
71  //static RPropertyTypeId PropertyAngle;
72  //static RPropertyTypeId PropertyLineSpacingFactor;
73  //static RPropertyTypeId PropertyHAlign;
74  //static RPropertyTypeId PropertyVAlign;
75 
78 
79 public:
81  virtual ~RDimensionEntity();
82 
83  static void init();
84 
85  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
87  }
88 
89  virtual RS::EntityType getType() const {
90  return RS::EntityDimension;
91  }
92 
93  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
94  RTransaction* transaction=NULL);
95  QPair<QVariant, RPropertyAttributes> getProperty(
96  RPropertyTypeId& propertyTypeId,
97  bool humanReadable = false, bool noAttributes = false);
98 
99  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
100 
101  virtual RDimensionData& getData() = 0;
102 
103  virtual const RDimensionData& getData() const = 0;
104 
105  virtual bool isValid() const {
106  return getData().isValid();
107  }
108 
109  void setDefinitionPoint(const RVector& p) {
110  getData().setDefinitionPoint(p);
111  }
112 
114  return getData().getDefinitionPoint();
115  }
116 
117  void setText(const QString& t) {
118  getData().setText(t);
119  }
120 
121  QString getText() const {
122  return getData().getText();
123  }
124 
125  QString getMeasurement(bool resolveAutoMeasurement = true) const {
126  return getData().getMeasurement(resolveAutoMeasurement);
127  }
128 
130  return getData().getTextData();
131  }
132 
133  void setTextPosition(const RVector& p) {
134  getData().setTextPosition(p);
135  }
136 
138  return getData().getTextPosition();
139  }
140 
141  void setFontName(const QString& fn) {
142  getData().setFontName(fn);
143  }
144 
145  QString getFontName() const {
146  return getData().getFontName();
147  }
148 
149  bool hasCustomTextPosition() const {
150  return getData().hasCustomTextPosition();
151  }
152 
153  void setCustomTextPosition(bool on) {
154  getData().setCustomTextPosition(on);
155  }
156 
158  return getData().getLineSpacingStyle();
159  }
160 
161  double getLineSpacingFactor() const {
162  return getData().getLineSpacingFactor();
163  }
164 
165  double getTextAngle() const {
166  return getData().getTextAngle();
167  }
168 
169  double getLinearFactor() const {
170  return getData().getLinearFactor();
171  }
172 
173  void setLinearFactor(double f) {
174  getData().setLinearFactor(f);
175  }
176 
177  double getDimScale() const {
178  return getData().getDimScale();
179  }
180 
181  void setDimScale(double f) {
182  getData().setDimScale(f);
183  }
184 
185 protected:
186  virtual void print(QDebug dbg) const;
187 };
188 
190 Q_DECLARE_METATYPE(QSharedPointer<RDimensionEntity>)
191 Q_DECLARE_METATYPE(QSharedPointer<RDimensionEntity>*)
192 
193 #endif
void setDefinitionPoint(const RVector &p)
Definition: RDimensionEntity.h:109
static RPropertyTypeId PropertyAutoTextPos
Definition: RDimensionEntity.h:68
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
QString getFontName() const
Definition: RDimensionEntity.h:145
Base class for dimension entity classes.
Definition: RDimensionEntity.h:38
static RPropertyTypeId PropertyProtected
Definition: RDimensionEntity.h:45
TextLineSpacingStyle
Line spacing style for texts.
Definition: RS.h:189
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
static RPropertyTypeId PropertyLinetype
Definition: RDimensionEntity.h:49
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RDimensionEntity.h:85
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
Any Dimension.
Definition: RS.h:105
void setFontName(const QString &fn)
Definition: RDimensionEntity.h:141
RVector getDefinitionPoint() const
Definition: RDimensionEntity.h:113
static RPropertyTypeId PropertyUpperTolerance
Definition: RDimensionEntity.h:63
int Id
Definition: RObject.h:53
static RPropertyTypeId PropertyLineweight
Definition: RDimensionEntity.h:51
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RDimensionEntity.h:43
Transaction implementation.
Definition: RTransaction.h:70
void setDimScale(double f)
Definition: RDimensionEntity.h:181
static RPropertyTypeId PropertyLinearFactor
Definition: RDimensionEntity.h:66
QString getMeasurement(bool resolveAutoMeasurement=true) const
Definition: RDimensionEntity.h:125
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RTextData.h:37
virtual bool isValid() const
Definition: RDimensionEntity.h:105
static const Id INVALID_ID
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RObject.h:54
void setText(const QString &t)
Definition: RDimensionEntity.h:117
static RPropertyTypeId PropertyMeasuredValue
Definition: RDimensionEntity.h:77
static RPropertyTypeId PropertyText
Definition: RDimensionEntity.h:62
RVector getTextPosition() const
Definition: RDimensionEntity.h:137
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
static RPropertyTypeId PropertyLayer
Definition: RDimensionEntity.h:48
static RPropertyTypeId PropertyMiddleOfTextX
Definition: RDimensionEntity.h:59
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:67
static RPropertyTypeId PropertyDrawOrder
Definition: RDimensionEntity.h:54
Q_DECLARE_METATYPE(RMath *)
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RDimensionData.h:38
bool hasCustomTextPosition() const
Definition: RDimensionEntity.h:149
RS::TextLineSpacingStyle getLineSpacingStyle() const
Definition: RDimensionEntity.h:157
static RPropertyTypeId PropertyDefinitionPointY
Definition: RDimensionEntity.h:57
QString getText() const
Definition: RDimensionEntity.h:121
static RPropertyTypeId PropertyMiddleOfTextZ
Definition: RDimensionEntity.h:61
static RPropertyTypeId PropertyAutoLabel
Definition: RDimensionEntity.h:76
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:210
static RPropertyTypeId PropertyLinetypeScale
Definition: RDimensionEntity.h:50
virtual RS::EntityType getType() const
Definition: RDimensionEntity.h:89
static RPropertyTypeId PropertyLowerTolerance
Definition: RDimensionEntity.h:64
static void init()
Definition: REntity.cpp:82
double getTextAngle() const
Definition: RDimensionEntity.h:165
double getDimScale() const
Definition: RDimensionEntity.h:177
static RPropertyTypeId PropertyHandle
Definition: RDimensionEntity.h:44
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:303
static RPropertyTypeId PropertyBlock
Definition: RDimensionEntity.h:47
double getLinearFactor() const
Definition: RDimensionEntity.h:169
Abstract base class for exporters.
Definition: RExporter.h:71
static RPropertyTypeId PropertyDimScale
Definition: RDimensionEntity.h:67
static RPropertyTypeId PropertyFontName
Definition: RDimensionEntity.h:69
static RPropertyTypeId PropertyType
Definition: RDimensionEntity.h:46
virtual REntityData & getData()=0
void setTextPosition(const RVector &p)
Definition: RDimensionEntity.h:133
static RPropertyTypeId PropertyColor
Definition: RDimensionEntity.h:52
double getLineSpacingFactor() const
Definition: RDimensionEntity.h:161
static RPropertyTypeId PropertyDefinitionPointZ
Definition: RDimensionEntity.h:58
void setLinearFactor(double f)
Definition: RDimensionEntity.h:173
void setCustomTextPosition(bool on)
Definition: RDimensionEntity.h:153
static RPropertyTypeId PropertyDefinitionPointX
Definition: RDimensionEntity.h:56
static RPropertyTypeId PropertyMiddleOfTextY
Definition: RDimensionEntity.h:60
RTextData getTextData() const
Definition: RDimensionEntity.h:129
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
static RPropertyTypeId PropertyDisplayedColor
Definition: RDimensionEntity.h:53
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:410