QCAD
Open Source 2D CAD
RLayout.h
Go to the documentation of this file.
1 
20 #ifndef RLAYOUT_H
21 #define RLAYOUT_H
22 
23 #include "core_global.h"
24 
25 #include <QString>
26 #include <QDebug>
27 
28 #include "RGlobal.h"
29 #include "RObject.h"
30 #include "RVector.h"
31 #include "RPropertyTypeId.h"
32 
33 class RDocument;
34 class RTransaction;
35 
44 public:
48 
64 
65 // static RPropertyTypeId PropertyPlotPaperMarginLeftMM;
66 // static RPropertyTypeId PropertyPlotPaperMarginBottomMM;
67 // static RPropertyTypeId PropertyPlotPaperMarginRightMM;
68 // static RPropertyTypeId PropertyPlotPaperMarginTopMM;
69 // static RPropertyTypeId PropertyPlotPaperSizeWidth;
70 // static RPropertyTypeId PropertyPlotPaperSizeHeight;
71 // static RPropertyTypeId PropertyPlotOriginX;
72 // static RPropertyTypeId PropertyPlotOriginY;
73 // static RPropertyTypeId PropertyPlotWindowAreaMinX;
74 // static RPropertyTypeId PropertyPlotWindowAreaMinY;
75 // static RPropertyTypeId PropertyPlotWindowAreaMaxX;
76 // static RPropertyTypeId PropertyPlotWindowAreaMaxY;
77 // static RPropertyTypeId PropertyNumeratorCustomScale;
78 // static RPropertyTypeId PropertyDenominatorCustomScale;
79 // static RPropertyTypeId PropertyPlotPaperUnits;
80 // static RPropertyTypeId PropertyPlotRotation;
81 
83  {
84  Inches = 0, // Inches
85  Millimeters = 1, // Millimeters
86  Pixels = 2 // Pixels
87  };
88 
90  {
91  Zero = 0, // No rotation (0)
92  CounterClockWise = 1, // 90 CCW (90)
93  Inverted = 2, // Inverted (180)
94  ClockWise = 3 // 90 CW (270)
95  };
96 
97 public:
98  RLayout();
99 
100  RLayout(RDocument* document, const QString& name);
101 
102  virtual ~RLayout();
103 
104  static void init();
105 
106  virtual RS::EntityType getType() const {
107  return RS::ObjectLayout;
108  }
109 
110  virtual RLayout* clone() const;
111 
112  QString getName() const {
113  return name;
114  }
115 
116  void setName(const QString& n);
117 
118  int getTabOrder() const {
119  return tabOrder;
120  }
121 
122  void setTabOrder(int to) {
123  tabOrder = to;
124  }
125 
126  void setMinLimits(const RVector& minLimits) {
127  this->minLimits = minLimits;
128  }
129 
131  return minLimits;
132  }
133 
134  void setMaxLimits(const RVector& maxLimits) {
135  this->maxLimits = maxLimits;
136  }
137 
139  return maxLimits;
140  }
141 
142  void setInsertionBase(const RVector& insertionBase) {
143  this->insertionBase = insertionBase;
144  }
145 
147  return insertionBase;
148  }
149 
150  void setMinExtents(const RVector& minExtents) {
151  this->minExtents = minExtents;
152  }
153 
155  return minExtents;
156  }
157 
158  void setMaxExtents(const RVector& maxExtents) {
159  this->maxExtents = maxExtents;
160  }
161 
163  return maxExtents;
164  }
165 
166 // void setPlotPaperMarginLeftMM(double v) {
167 // plotPaperMarginLeftMM = v;
168 // }
169 
170 // void setPlotPaperMarginBottomMM(double v) {
171 // plotPaperMarginBottomMM = v;
172 // }
173 
174 // void setPlotPaperMarginRightMM(double v) {
175 // plotPaperMarginRightMM = v;
176 // }
177 
178 // void setPlotPaperMarginTopMM(double v) {
179 // plotPaperMarginTopMM = v;
180 // }
181 
182 // void setPlotPaperSize(const RVector& v) {
183 // plotPaperSize = v;
184 // }
185 
186 // void setPlotOrigin(const RVector& v) {
187 // plotOrigin = v;
188 // }
189 
190 // void setPlotWindowAreaMin(const RVector& v) {
191 // plotWindowAreaMin = v;
192 // }
193 
194 // void setPlotWindowAreaMax(const RVector& v) {
195 // plotWindowAreaMax = v;
196 // }
197 
198 // void setNumeratorCustomScale(double v) {
199 // numeratorCustomScale = v;
200 // }
201 
202 // void setDenominatorCustomScale(double v) {
203 // denominatorCustomScale = v;
204 // }
205 
206 // void setPlotPaperUnits(RLayout::PlotPaperUnits v) {
207 // plotPaperUnits = v;
208 // }
209 
210 // void setPlotRotation(RLayout::PlotRotation v) {
211 // plotRotation = v;
212 // }
213 
214 // double getPlotPaperMarginLeftMM() const {
215 // return plotPaperMarginLeftMM;
216 // }
217 
218 // double getPlotPaperMarginBottomMM() const {
219 // return plotPaperMarginBottomMM;
220 // }
221 
222 // double getPlotPaperMarginRightMM() const {
223 // return plotPaperMarginRightMM;
224 // }
225 
226 // double getPlotPaperMarginTopMM() const {
227 // return plotPaperMarginTopMM;
228 // }
229 
230 // RVector getPlotPaperSize() const {
231 // return plotPaperSize;
232 // }
233 
234 // RVector getPlotOrigin() const {
235 // return plotOrigin;
236 // }
237 
238 // RVector getPlotWindowAreaMin() const {
239 // return plotWindowAreaMin;
240 // }
241 
242 // RVector getPlotWindowAreaMax() const {
243 // return plotWindowAreaMax;
244 // }
245 
246 // double getNumeratorCustomScale() const {
247 // return numeratorCustomScale;
248 // }
249 
250 // double getDenominatorCustomScale() const {
251 // return denominatorCustomScale;
252 // }
253 
254 // RLayout::PlotPaperUnits getPlotPaperUnits() const {
255 // return plotPaperUnits;
256 // }
257 
258 // RLayout::PlotRotation getPlotRotation() const {
259 // return plotRotation;
260 // }
261 
262  virtual QPair<QVariant, RPropertyAttributes> getProperty(RPropertyTypeId& propertyTypeId,
263  bool humanReadable = false, bool noAttributes = false);
264  virtual bool setProperty(RPropertyTypeId propertyTypeId,
265  const QVariant& value, RTransaction* transaction=NULL);
266 
267  virtual bool isSelectedForPropertyEditing();
268 
269 protected:
273  virtual void print(QDebug dbg) const;
274 
275 private:
276  QString name;
277  int tabOrder;
278 
284 
285  // TODO: split into base class 'RPlotSettings':
286 // double plotPaperMarginLeftMM;
287 // double plotPaperMarginBottomMM;
288 // double plotPaperMarginRightMM;
289 // double plotPaperMarginTopMM;
290 // RVector plotPaperSize;
291 // RVector plotOrigin;
292 // RVector plotWindowAreaMin;
293 // RVector plotWindowAreaMax;
294 // double numeratorCustomScale;
295 // double denominatorCustomScale;
296 // PlotPaperUnits plotPaperUnits;
297 // PlotRotation plotRotation;
298 };
299 
300 
301 Q_DECLARE_METATYPE(QSharedPointer<RLayout>)
302 Q_DECLARE_METATYPE(QSharedPointer<RLayout>*)
305 Q_DECLARE_METATYPE(RLayout::PlotPaperUnits)
306 Q_DECLARE_METATYPE(RLayout::PlotPaperUnits*)
307 Q_DECLARE_METATYPE(RLayout::PlotRotation)
308 Q_DECLARE_METATYPE(RLayout::PlotRotation*)
309 
310 #endif
RVector minExtents
Definition: RLayout.h:282
RVector maxLimits
Definition: RLayout.h:280
static RPropertyTypeId PropertyMaxLimitsY
Definition: RLayout.h:53
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RVector getMaxExtents() const
Definition: RLayout.h:162
RVector minLimits
Definition: RLayout.h:279
PlotRotation
Definition: RLayout.h:89
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RObject.cpp:129
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
RVector getInsertionBase() const
Definition: RLayout.h:146
static RPropertyTypeId PropertyMaxExtentsX
Definition: RLayout.h:61
Abstract base class for all objects.
Definition: RObject.h:52
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
RVector maxExtents
Definition: RLayout.h:283
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: RObject.cpp:94
static RPropertyTypeId PropertyMaxLimitsX
Definition: RLayout.h:52
int tabOrder
Definition: RLayout.h:277
int getTabOrder() const
Definition: RLayout.h:118
Definition: RS.h:84
void setMaxExtents(const RVector &maxExtents)
Definition: RLayout.h:158
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyInsertionBaseY
Definition: RLayout.h:56
static RPropertyTypeId PropertyMaxExtentsZ
Definition: RLayout.h:63
static RPropertyTypeId PropertyInsertionBaseZ
Definition: RLayout.h:57
static RPropertyTypeId PropertyMaxLimitsZ
Definition: RLayout.h:54
RVector getMaxLimits() const
Definition: RLayout.h:138
RVector getMinLimits() const
Definition: RLayout.h:130
static RPropertyTypeId PropertyMinLimitsZ
Definition: RLayout.h:51
void setMinExtents(const RVector &minExtents)
Definition: RLayout.h:150
static RPropertyTypeId PropertyMinExtentsZ
Definition: RLayout.h:60
static RPropertyTypeId PropertyMinLimitsX
Definition: RLayout.h:49
void setMinLimits(const RVector &minLimits)
Definition: RLayout.h:126
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
static RPropertyTypeId PropertyTabOrder
Definition: RLayout.h:47
QString getName() const
Definition: RLayout.h:112
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyName
Definition: RLayout.h:46
static RPropertyTypeId PropertyMinExtentsY
Definition: RLayout.h:59
Represents a layout definition in a drawing.
Definition: RLayout.h:43
QString name
Definition: RLayout.h:276
static RPropertyTypeId PropertyInsertionBaseX
Definition: RLayout.h:55
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RLayout.h:45
void setMaxLimits(const RVector &maxLimits)
Definition: RLayout.h:134
static RPropertyTypeId PropertyMaxExtentsY
Definition: RLayout.h:62
static RPropertyTypeId PropertyMinLimitsY
Definition: RLayout.h:50
RVector getMinExtents() const
Definition: RLayout.h:154
static RPropertyTypeId PropertyMinExtentsX
Definition: RLayout.h:58
void setTabOrder(int to)
Definition: RLayout.h:122
static void init()
Definition: RObject.cpp:61
virtual RS::EntityType getType() const
Definition: RLayout.h:106
virtual bool isSelectedForPropertyEditing()=0
PlotPaperUnits
Definition: RLayout.h:82
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: RObject.cpp:566
virtual RObject * clone() const =0
RVector insertionBase
Definition: RLayout.h:281
void setInsertionBase(const RVector &insertionBase)
Definition: RLayout.h:142