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