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 
73  //static RPropertyTypeId PropertyHeight;
74  //static RPropertyTypeId PropertyAngle;
75  //static RPropertyTypeId PropertyLineSpacingFactor;
76  //static RPropertyTypeId PropertyHAlign;
77  //static RPropertyTypeId PropertyVAlign;
78 
81 
82 public:
83  RDimensionEntity(RDocument* document);
84  virtual ~RDimensionEntity();
85 
86  static void init();
87 
88  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
90  }
91 
92  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
93  RTransaction* transaction=NULL);
94  virtual QPair<QVariant, RPropertyAttributes> getProperty(
95  RPropertyTypeId& propertyTypeId,
96  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = 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  void setDefinitionPoint(const RVector& p) {
105  getData().setDefinitionPoint(p);
106  }
107 
109  return getData().getDefinitionPoint();
110  }
111 
112  void setText(const QString& t) {
113  getData().setText(t);
114  }
115 
116  QString getText() const {
117  return getData().getText();
118  }
119 
120  QString getMeasurement(bool resolveAutoMeasurement = true) const {
121  return getData().getMeasurement(resolveAutoMeasurement);
122  }
123 
125  return getData().getTextData();
126  }
127 
128  void setTextPosition(const RVector& p) {
129  getData().setTextPosition(p);
130  }
131 
133  return getData().getTextPosition();
134  }
135 
136  void setFontName(const QString& fn) {
137  getData().setFontName(fn);
138  }
139 
140  QString getFontName() const {
141  return getData().getFontName();
142  }
143 
144  bool hasCustomTextPosition() const {
145  return getData().hasCustomTextPosition();
146  }
147 
148  void setCustomTextPosition(bool on) {
149  getData().setCustomTextPosition(on);
150  }
151 
153  return getData().getLineSpacingStyle();
154  }
155 
156  double getLineSpacingFactor() const {
157  return getData().getLineSpacingFactor();
158  }
159 
160  double getTextAngle() const {
161  return getData().getTextAngle();
162  }
163 
164  double getLinearFactor() const {
165  return getData().getLinearFactor();
166  }
167 
168  void setLinearFactor(double f) {
169  getData().setLinearFactor(f);
170  }
171 
172  double getDimScale(bool fromDocument=true) const {
173  return getData().getDimScale(fromDocument);
174  }
175 
176  void setDimScale(double f) {
177  getData().setDimScale(f);
178  }
179 
180  QString getDimBlockName() const {
181  return getData().getDimBlockName();
182  }
183 
185  return getData().hasDimensionBlockReference();
186  }
187 
188  bool isArrow1Flipped() const {
189  return getData().isArrow1Flipped();
190  }
191  void setArrow1Flipped(bool on) {
192  getData().setArrow1Flipped(on);
193  }
194  bool isArrow2Flipped() const {
195  return getData().isArrow2Flipped();
196  }
197  void setArrow2Flipped(bool on) {
198  getData().setArrow2Flipped(on);
199  }
200 
201  static QSet<QString> getDimensionBlockNames(RDocument* doc);
202 
203 protected:
204  virtual void print(QDebug dbg) const;
205 };
206 
208 Q_DECLARE_METATYPE(QSharedPointer<RDimensionEntity>)
209 Q_DECLARE_METATYPE(QSharedPointer<RDimensionEntity>*)
210 
211 #endif
void setDefinitionPoint(const RVector &p)
Definition: RDimensionEntity.h:104
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:140
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:195
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
static RPropertyTypeId PropertyLinetype
Definition: RDimensionEntity.h:49
void setArrow2Flipped(bool on)
Definition: RDimensionEntity.h:197
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RDimensionEntity.h:88
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
void setArrow1Flipped(bool on)
Definition: RDimensionEntity.h:191
void setFontName(const QString &fn)
Definition: RDimensionEntity.h:136
RVector getDefinitionPoint() const
Definition: RDimensionEntity.h:108
static RPropertyTypeId PropertyUpperTolerance
Definition: RDimensionEntity.h:63
static RPropertyTypeId PropertyLineweight
Definition: RDimensionEntity.h:51
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RDimensionEntity.h:43
QString getDimBlockName() const
Definition: RDimensionEntity.h:180
Transaction implementation.
Definition: RTransaction.h:74
double getDimScale(bool fromDocument=true) const
Definition: RDimensionEntity.h:172
void setDimScale(double f)
Definition: RDimensionEntity.h:176
static RPropertyTypeId PropertyLinearFactor
Definition: RDimensionEntity.h:66
QString getMeasurement(bool resolveAutoMeasurement=true) const
Definition: RDimensionEntity.h:120
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RTextData.h:37
void setText(const QString &t)
Definition: RDimensionEntity.h:112
static RPropertyTypeId PropertyMeasuredValue
Definition: RDimensionEntity.h:80
static RPropertyTypeId PropertyText
Definition: RDimensionEntity.h:62
RVector getTextPosition() const
Definition: RDimensionEntity.h:132
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
bool isArrow2Flipped() const
Definition: RDimensionEntity.h:194
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-2018 by Andrew Mustun.
Definition: RDimensionData.h:38
bool hasCustomTextPosition() const
Definition: RDimensionEntity.h:144
RS::TextLineSpacingStyle getLineSpacingStyle() const
Definition: RDimensionEntity.h:152
static RPropertyTypeId PropertyDefinitionPointY
Definition: RDimensionEntity.h:57
static RPropertyTypeId PropertyArrow2Flipped
Definition: RDimensionEntity.h:72
QString getText() const
Definition: RDimensionEntity.h:116
static RPropertyTypeId PropertyMiddleOfTextZ
Definition: RDimensionEntity.h:61
static RPropertyTypeId PropertyAutoLabel
Definition: RDimensionEntity.h:79
static RPropertyTypeId PropertyArrow1Flipped
Definition: RDimensionEntity.h:71
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:233
static RPropertyTypeId PropertyLinetypeScale
Definition: RDimensionEntity.h:50
static RPropertyTypeId PropertyLowerTolerance
Definition: RDimensionEntity.h:64
static void init()
Definition: REntity.cpp:83
double getTextAngle() const
Definition: RDimensionEntity.h:160
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:326
static RPropertyTypeId PropertyBlock
Definition: RDimensionEntity.h:47
double getLinearFactor() const
Definition: RDimensionEntity.h:164
Abstract base class for exporters.
Definition: RExporter.h:71
bool isArrow1Flipped() const
Definition: RDimensionEntity.h:188
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:128
static RPropertyTypeId PropertyColor
Definition: RDimensionEntity.h:52
double getLineSpacingFactor() const
Definition: RDimensionEntity.h:156
static RPropertyTypeId PropertyDefinitionPointZ
Definition: RDimensionEntity.h:58
void setLinearFactor(double f)
Definition: RDimensionEntity.h:168
bool hasDimensionBlockReference() const
Definition: RDimensionEntity.h:184
void setCustomTextPosition(bool on)
Definition: RDimensionEntity.h:148
static RPropertyTypeId PropertyDefinitionPointX
Definition: RDimensionEntity.h:56
static RPropertyTypeId PropertyMiddleOfTextY
Definition: RDimensionEntity.h:60
RTextData getTextData() const
Definition: RDimensionEntity.h:124
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:473