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 
71  //static RPropertyTypeId PropertyHeight;
72  //static RPropertyTypeId PropertyAngle;
73  //static RPropertyTypeId PropertyLineSpacingFactor;
74  //static RPropertyTypeId PropertyHAlign;
75  //static RPropertyTypeId PropertyVAlign;
76 
79 
80 public:
81  RDimensionEntity(RDocument* document);
82  virtual ~RDimensionEntity();
83 
84  static void init();
85 
86  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
88  }
89 
90  virtual RS::EntityType getType() const {
91  return RS::EntityDimension;
92  }
93 
94  bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
95  RTransaction* transaction=NULL);
96  QPair<QVariant, RPropertyAttributes> getProperty(
97  RPropertyTypeId& propertyTypeId,
98  bool humanReadable = false, bool noAttributes = false);
99 
100  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
101 
102  virtual RDimensionData& getData() = 0;
103 
104  virtual const RDimensionData& getData() const = 0;
105 
106  virtual bool isValid() const {
107  return getData().isValid();
108  }
109 
110  void setDefinitionPoint(const RVector& p) {
111  getData().setDefinitionPoint(p);
112  }
113 
115  return getData().getDefinitionPoint();
116  }
117 
118  void setText(const QString& t) {
119  getData().setText(t);
120  }
121 
122  QString getText() const {
123  return getData().getText();
124  }
125 
126  QString getMeasurement(bool resolveAutoMeasurement = true) const {
127  return getData().getMeasurement(resolveAutoMeasurement);
128  }
129 
131  return getData().getTextData();
132  }
133 
134  void setTextPosition(const RVector& p) {
135  getData().setTextPosition(p);
136  }
137 
139  return getData().getTextPosition();
140  }
141 
142  void setFontName(const QString& fn) {
143  getData().setFontName(fn);
144  }
145 
146  QString getFontName() const {
147  return getData().getFontName();
148  }
149 
150  bool hasCustomTextPosition() const {
151  return getData().hasCustomTextPosition();
152  }
153 
154  void setCustomTextPosition(bool on) {
155  getData().setCustomTextPosition(on);
156  }
157 
159  return getData().getLineSpacingStyle();
160  }
161 
162  double getLineSpacingFactor() const {
163  return getData().getLineSpacingFactor();
164  }
165 
166  double getTextAngle() const {
167  return getData().getTextAngle();
168  }
169 
170  double getLinearFactor() const {
171  return getData().getLinearFactor();
172  }
173 
174  void setLinearFactor(double f) {
175  getData().setLinearFactor(f);
176  }
177 
178  double getDimScale() const {
179  return getData().getDimScale();
180  }
181 
182  void setDimScale(double f) {
183  getData().setDimScale(f);
184  }
185 
186  QString getDimBlockName() const {
187  return getData().getDimBlockName();
188  }
189 
191  return getData().hasDimensionBlockReference();
192  }
193 
194  static QSet<QString> getDimensionBlockNames(RDocument* doc);
195 
196 protected:
197  virtual void print(QDebug dbg) const;
198 };
199 
201 Q_DECLARE_METATYPE(QSharedPointer<RDimensionEntity>)
202 Q_DECLARE_METATYPE(QSharedPointer<RDimensionEntity>*)
203 
204 #endif
void setDefinitionPoint(const RVector &p)
Definition: RDimensionEntity.h:110
static RPropertyTypeId PropertyAutoTextPos
Definition: RDimensionEntity.h:69
static RPropertyTypeId PropertyDimBlockName
Definition: RDimensionEntity.h:68
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
QString getFontName() const
Definition: RDimensionEntity.h:146
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:192
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:86
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
Any Dimension.
Definition: RS.h:108
void setFontName(const QString &fn)
Definition: RDimensionEntity.h:142
RVector getDefinitionPoint() const
Definition: RDimensionEntity.h:114
static RPropertyTypeId PropertyUpperTolerance
Definition: RDimensionEntity.h:63
static RPropertyTypeId PropertyLineweight
Definition: RDimensionEntity.h:51
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RDimensionEntity.h:43
QString getDimBlockName() const
Definition: RDimensionEntity.h:186
Transaction implementation.
Definition: RTransaction.h:74
void setDimScale(double f)
Definition: RDimensionEntity.h:182
static RPropertyTypeId PropertyLinearFactor
Definition: RDimensionEntity.h:66
QString getMeasurement(bool resolveAutoMeasurement=true) const
Definition: RDimensionEntity.h:126
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RTextData.h:37
virtual bool isValid() const
Definition: RDimensionEntity.h:106
void setText(const QString &t)
Definition: RDimensionEntity.h:118
static RPropertyTypeId PropertyMeasuredValue
Definition: RDimensionEntity.h:78
static RPropertyTypeId PropertyText
Definition: RDimensionEntity.h:62
RVector getTextPosition() const
Definition: RDimensionEntity.h:138
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:150
RS::TextLineSpacingStyle getLineSpacingStyle() const
Definition: RDimensionEntity.h:158
static RPropertyTypeId PropertyDefinitionPointY
Definition: RDimensionEntity.h:57
QString getText() const
Definition: RDimensionEntity.h:122
static RPropertyTypeId PropertyMiddleOfTextZ
Definition: RDimensionEntity.h:61
static RPropertyTypeId PropertyAutoLabel
Definition: RDimensionEntity.h:77
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: REntity.cpp:228
static RPropertyTypeId PropertyLinetypeScale
Definition: RDimensionEntity.h:50
virtual RS::EntityType getType() const
Definition: RDimensionEntity.h:90
static RPropertyTypeId PropertyLowerTolerance
Definition: RDimensionEntity.h:64
static void init()
Definition: REntity.cpp:82
double getTextAngle() const
Definition: RDimensionEntity.h:166
double getDimScale() const
Definition: RDimensionEntity.h:178
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:321
static RPropertyTypeId PropertyBlock
Definition: RDimensionEntity.h:47
double getLinearFactor() const
Definition: RDimensionEntity.h:170
Abstract base class for exporters.
Definition: RExporter.h:71
static RPropertyTypeId PropertyDimScale
Definition: RDimensionEntity.h:67
static RPropertyTypeId PropertyFontName
Definition: RDimensionEntity.h:70
static RPropertyTypeId PropertyType
Definition: RDimensionEntity.h:46
virtual REntityData & getData()=0
void setTextPosition(const RVector &p)
Definition: RDimensionEntity.h:134
static RPropertyTypeId PropertyColor
Definition: RDimensionEntity.h:52
double getLineSpacingFactor() const
Definition: RDimensionEntity.h:162
static RPropertyTypeId PropertyDefinitionPointZ
Definition: RDimensionEntity.h:58
void setLinearFactor(double f)
Definition: RDimensionEntity.h:174
bool hasDimensionBlockReference() const
Definition: RDimensionEntity.h:190
void setCustomTextPosition(bool on)
Definition: RDimensionEntity.h:154
static RPropertyTypeId PropertyDefinitionPointX
Definition: RDimensionEntity.h:56
static RPropertyTypeId PropertyMiddleOfTextY
Definition: RDimensionEntity.h:60
RTextData getTextData() const
Definition: RDimensionEntity.h:130
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:428