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 
86 
88  {
89  Inches = 0, // Inches
90  Millimeters = 1, // Millimeters
91  Pixels = 2 // Pixels
92  };
93 
95  {
96  Zero = 0, // No rotation (0)
97  CounterClockWise = 1, // 90 CCW (90)
98  Inverted = 2, // Inverted (180)
99  ClockWise = 3 // 90 CW (270)
100  };
101 
102  enum PlotType
103  {
104  Display = 0, // Display
105  Extents = 1, // Extents
106  Limits = 2, // Limits
107  View = 3, // View
108  Window = 4, // Window
109  Layout = 5 // Layout
110  };
111 
113  {
114  Scale_ScaleToFit = 0, // Scaled to Fit
115  Scale_1_128in_1ft = 1, // 1/128" = 1'
116  Scale_1_64in_1ft = 2, // 1/64" = 1'
117  Scale_1_32in_1ft = 3, // 1/32" = 1'
118  Scale_1_16in_1ft = 4, // 1/16" = 1'
119  Scale_3_32in_1ft = 5, // 3/32" = 1'
120  Scale_1_8in_1ft = 6, // 1/8" = 1'
121  Scale_3_16in_1ft = 7, // 3/16" = 1'
122  Scale_1_4in_1ft = 8, // 1/4" = 1'
123  Scale_3_8in_1ft = 9, // 3/8" = 1'
124  Scale_1_2in_1ft = 10, // 1/2" = 1'
125  Scale_3_4in_1ft = 11, // 3/4" = 1'
126  Scale_1in_1ft = 12, // 1" = 1'
127  Scale_3in_1ft = 13, // 3" = 1'
128  Scale_6in_1ft = 14, // 6" = 1'
129  Scale_1ft_1ft = 15, // 1' = 1'
130  Scale_1_1 = 16, // 1:1
131  Scale_1_2 = 17, // 1:2
132  Scale_1_4 = 18, // 1:4
133  Scale_1_5 = 19, // 1:5
134  Scale_1_8 = 20, // 1:8
135  Scale_1_10 = 21, // 1:10
136  Scale_1_16 = 22, // 1:16
137  Scale_1_20 = 23, // 1:20
138  Scale_1_30 = 24, // 1:30
139  Scale_1_40 = 25, // 1:40
140  Scale_1_50 = 26, // 1:50
141  Scale_1_100 = 27, // 1:100
142  Scale_2_1 = 28, // 2:1
143  Scale_4_1 = 29, // 4:1
144  Scale_8_1 = 30, // 8:1
145  Scale_10_1 = 31, // 10:1
146  Scale_100_1 = 32, // 100:1
147  Scale_1000_1 = 33, // 1000:1
148  Scale_1and1_2in_1ft = 34 // 1.5"= 1'
149  };
150 
151 public:
152  RLayout();
153 
154  RLayout(RDocument* document, const QString& name);
155 
156  virtual ~RLayout();
157 
158  static void init();
159 
160  virtual RS::EntityType getType() const {
161  return RS::ObjectLayout;
162  }
163 
164  virtual RLayout* clone() const;
165 
166  QString getName() const {
167  return name;
168  }
169 
170  void setName(const QString& n);
171 
172  int getTabOrder() const {
173  return tabOrder;
174  }
175 
176  void setTabOrder(int to) {
177  tabOrder = to;
178  }
179 
180  void setMinLimits(const RVector& minLimits) {
181  this->minLimits = minLimits;
182  }
183 
185  return minLimits;
186  }
187 
188  void setMaxLimits(const RVector& maxLimits) {
189  this->maxLimits = maxLimits;
190  }
191 
193  return maxLimits;
194  }
195 
196  void setInsertionBase(const RVector& insertionBase) {
197  this->insertionBase = insertionBase;
198  }
199 
201  return insertionBase;
202  }
203 
204  void setMinExtents(const RVector& minExtents) {
205  this->minExtents = minExtents;
206  }
207 
209  return minExtents;
210  }
211 
212  void setMaxExtents(const RVector& maxExtents) {
213  this->maxExtents = maxExtents;
214  }
215 
217  return maxExtents;
218  }
219 
220  void setPlotPaperMarginLeftMM(double v) {
221  plotPaperMarginLeftMM = v;
222  }
223 
224  void setPlotPaperMarginBottomMM(double v) {
225  plotPaperMarginBottomMM = v;
226  }
227 
228  void setPlotPaperMarginRightMM(double v) {
229  plotPaperMarginRightMM = v;
230  }
231 
232  void setPlotPaperMarginTopMM(double v) {
233  plotPaperMarginTopMM = v;
234  }
235 
236  void setPlotPaperSize(const RVector& v) {
237  plotPaperSize = v;
238  }
239 
240  void setPlotOrigin(const RVector& v) {
241  plotOrigin = v;
242  }
243 
244  void setPlotWindowAreaMin(const RVector& v) {
245  plotWindowAreaMin = v;
246  }
247 
248  void setPlotWindowAreaMax(const RVector& v) {
249  plotWindowAreaMax = v;
250  }
251 
252  void setNumeratorCustomScale(double v) {
253  numeratorCustomScale = v;
254  }
255 
256  void setDenominatorCustomScale(double v) {
257  denominatorCustomScale = v;
258  }
259 
261  plotPaperUnits = v;
262  }
263 
265  plotRotation = v;
266  }
267 
269  plotType = v;
270  }
271 
272  void setUseStandardScale(bool v) {
273  useStandardScale = v;
274  }
275 
276  void setStandardScale(double v) {
277  standardScale = v;
278  }
279 
281  standardScaleType = v;
282  }
283 
284  void setCanonicalMediaName(const QString& v) {
285  canonicalMediaName = v;
286  }
287 
288 
289 
290  double getPlotPaperMarginLeftMM() const {
291  return plotPaperMarginLeftMM;
292  }
293 
294  double getPlotPaperMarginBottomMM() const {
295  return plotPaperMarginBottomMM;
296  }
297 
298  double getPlotPaperMarginRightMM() const {
299  return plotPaperMarginRightMM;
300  }
301 
302  double getPlotPaperMarginTopMM() const {
303  return plotPaperMarginTopMM;
304  }
305 
307  return plotPaperSize;
308  }
309 
311  return plotOrigin;
312  }
313 
315  return plotWindowAreaMin;
316  }
317 
319  return plotWindowAreaMax;
320  }
321 
322  double getNumeratorCustomScale() const {
323  return numeratorCustomScale;
324  }
325 
326  double getDenominatorCustomScale() const {
327  return denominatorCustomScale;
328  }
329 
331  return plotPaperUnits;
332  }
333 
335  return plotRotation;
336  }
337 
339  return plotType;
340  }
341 
342  bool getUseStandardScale() const {
343  return useStandardScale;
344  }
345 
346  double getStandardScale() const {
347  return standardScale;
348  }
349 
351  return standardScaleType;
352  }
353 
354  QString getCanonicalMediaName() const {
355  return canonicalMediaName;
356  }
357 
358 
359 
360  virtual QPair<QVariant, RPropertyAttributes> getProperty(RPropertyTypeId& propertyTypeId,
361  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
362  virtual bool setProperty(RPropertyTypeId propertyTypeId,
363  const QVariant& value, RTransaction* transaction=NULL);
364 
365  virtual bool isSelectedForPropertyEditing();
366 
367 protected:
371  virtual void print(QDebug dbg) const;
372 
373 private:
374  QString name;
375  int tabOrder;
376 
382 
383  // TODO: split into base class 'RPlotSettings':
401 };
402 
403 
404 Q_DECLARE_METATYPE(QSharedPointer<RLayout>)
405 Q_DECLARE_METATYPE(QSharedPointer<RLayout>*)
408 Q_DECLARE_METATYPE(RLayout::PlotPaperUnits)
409 Q_DECLARE_METATYPE(RLayout::PlotPaperUnits*)
410 Q_DECLARE_METATYPE(RLayout::PlotRotation)
411 Q_DECLARE_METATYPE(RLayout::PlotRotation*)
412 Q_DECLARE_METATYPE(RLayout::PlotType)
413 Q_DECLARE_METATYPE(RLayout::PlotType*)
414 Q_DECLARE_METATYPE(RLayout::StandardScaleType)
415 Q_DECLARE_METATYPE(RLayout::StandardScaleType*)
416 
417 #endif
static RPropertyTypeId PropertyPlotWindowAreaMaxY
Definition: RLayout.h:76
double standardScale
Definition: RLayout.h:398
void setPlotPaperMarginRightMM(double v)
Definition: RLayout.h:228
RVector minExtents
Definition: RLayout.h:380
RVector maxLimits
Definition: RLayout.h:378
static RPropertyTypeId PropertyMaxLimitsY
Definition: RLayout.h:53
RLayout::PlotPaperUnits getPlotPaperUnits() const
Definition: RLayout.h:330
void setPlotType(RLayout::PlotType v)
Definition: RLayout.h:268
RVector getPlotOrigin() const
Definition: RLayout.h:310
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
void setPlotWindowAreaMin(const RVector &v)
Definition: RLayout.h:244
RVector getMaxExtents() const
Definition: RLayout.h:216
static RPropertyTypeId PropertyPlotOriginY
Definition: RLayout.h:72
void setPlotWindowAreaMax(const RVector &v)
Definition: RLayout.h:248
Base class for all window tools.
Definition: Window.js:27
static RPropertyTypeId PropertyPlotPaperMarginTopMM
Definition: RLayout.h:68
void setPlotPaperSize(const RVector &v)
Definition: RLayout.h:236
RLayout::StandardScaleType getStandardScaleType() const
Definition: RLayout.h:350
StandardScaleType
Definition: RLayout.h:112
RVector minLimits
Definition: RLayout.h:377
PlotRotation
Definition: RLayout.h:94
StandardScaleType standardScaleType
Definition: RLayout.h:399
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RObject.cpp:136
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:125
RVector getInsertionBase() const
Definition: RLayout.h:200
static RPropertyTypeId PropertyMaxExtentsX
Definition: RLayout.h:61
RLayout::PlotRotation getPlotRotation() const
Definition: RLayout.h:334
Abstract base class for all objects.
Definition: RObject.h:61
QString canonicalMediaName
Definition: RLayout.h:400
double denominatorCustomScale
Definition: RLayout.h:393
QString getCanonicalMediaName() const
Definition: RLayout.h:354
static RPropertyTypeId PropertyStandardScaleType
Definition: RLayout.h:84
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:59
RVector maxExtents
Definition: RLayout.h:381
static RPropertyTypeId PropertyPlotPaperMarginLeftMM
Definition: RLayout.h:65
#define QCADCORE_EXPORT
Definition: core_global.h:10
static RPropertyTypeId PropertyPlotWindowAreaMaxX
Definition: RLayout.h:75
RVector getPlotWindowAreaMax() const
Definition: RLayout.h:318
double plotPaperMarginRightMM
Definition: RLayout.h:386
double getNumeratorCustomScale() const
Definition: RLayout.h:322
static RPropertyTypeId PropertyMaxLimitsX
Definition: RLayout.h:52
RVector plotWindowAreaMin
Definition: RLayout.h:390
int tabOrder
Definition: RLayout.h:375
static RPropertyTypeId PropertyNumeratorCustomScale
Definition: RLayout.h:77
int getTabOrder() const
Definition: RLayout.h:172
RVector plotWindowAreaMax
Definition: RLayout.h:391
static RPropertyTypeId PropertyPlotPaperUnits
Definition: RLayout.h:79
Definition: RS.h:133
void setMaxExtents(const RVector &maxExtents)
Definition: RLayout.h:212
Transaction implementation.
Definition: RTransaction.h:74
void setStandardScaleType(RLayout::StandardScaleType v)
Definition: RLayout.h:280
static RPropertyTypeId PropertyInsertionBaseY
Definition: RLayout.h:56
double plotPaperMarginBottomMM
Definition: RLayout.h:385
static RPropertyTypeId PropertyPlotWindowAreaMinY
Definition: RLayout.h:74
static RPropertyTypeId PropertyMaxExtentsZ
Definition: RLayout.h:63
static RPropertyTypeId PropertyInsertionBaseZ
Definition: RLayout.h:57
void setNumeratorCustomScale(double v)
Definition: RLayout.h:252
static RPropertyTypeId PropertyMaxLimitsZ
Definition: RLayout.h:54
double getPlotPaperMarginBottomMM() const
Definition: RLayout.h:294
bool useStandardScale
Definition: RLayout.h:397
PlotPaperUnits plotPaperUnits
Definition: RLayout.h:394
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: RObject.cpp:100
RVector getMaxLimits() const
Definition: RLayout.h:192
RVector getMinLimits() const
Definition: RLayout.h:184
static RPropertyTypeId PropertyMinLimitsZ
Definition: RLayout.h:51
void setMinExtents(const RVector &minExtents)
Definition: RLayout.h:204
static RPropertyTypeId PropertyPlotRotation
Definition: RLayout.h:80
static RPropertyTypeId PropertyMinExtentsZ
Definition: RLayout.h:60
static RPropertyTypeId PropertyMinLimitsX
Definition: RLayout.h:49
void setPlotPaperMarginBottomMM(double v)
Definition: RLayout.h:224
static RPropertyTypeId PropertyDenominatorCustomScale
Definition: RLayout.h:78
RLayout::PlotType getPlotType() const
Definition: RLayout.h:338
void setMinLimits(const RVector &minLimits)
Definition: RLayout.h:180
void setPlotOrigin(const RVector &v)
Definition: RLayout.h:240
RVector plotOrigin
Definition: RLayout.h:389
void setPlotPaperUnits(RLayout::PlotPaperUnits v)
Definition: RLayout.h:260
static RPropertyTypeId PropertyCanonicalMediaName
Definition: RLayout.h:85
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:166
Q_DECLARE_METATYPE(RMath *)
PlotRotation plotRotation
Definition: RLayout.h:395
RVector getPlotWindowAreaMin() const
Definition: RLayout.h:314
static RPropertyTypeId PropertyName
Definition: RLayout.h:46
void setCanonicalMediaName(const QString &v)
Definition: RLayout.h:284
static RPropertyTypeId PropertyPlotPaperMarginBottomMM
Definition: RLayout.h:66
void setPlotRotation(RLayout::PlotRotation v)
Definition: RLayout.h:264
double getPlotPaperMarginLeftMM() const
Definition: RLayout.h:290
static RPropertyTypeId PropertyPlotPaperSizeHeight
Definition: RLayout.h:70
void setStandardScale(double v)
Definition: RLayout.h:276
static RPropertyTypeId PropertyMinExtentsY
Definition: RLayout.h:59
Represents a layout definition in a drawing.
Definition: RLayout.h:43
QString name
Definition: RLayout.h:374
PlotType
Definition: RLayout.h:102
static RPropertyTypeId PropertyInsertionBaseX
Definition: RLayout.h:55
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RLayout.h:45
void setMaxLimits(const RVector &maxLimits)
Definition: RLayout.h:188
static RPropertyTypeId PropertyUseStandardScale
Definition: RLayout.h:82
static RPropertyTypeId PropertyMaxExtentsY
Definition: RLayout.h:62
void setDenominatorCustomScale(double v)
Definition: RLayout.h:256
bool getUseStandardScale() const
Definition: RLayout.h:342
static RPropertyTypeId PropertyPlotType
Definition: RLayout.h:81
double getPlotPaperMarginTopMM() const
Definition: RLayout.h:302
static RPropertyTypeId PropertyMinLimitsY
Definition: RLayout.h:50
RVector getMinExtents() const
Definition: RLayout.h:208
PlotType plotType
Definition: RLayout.h:396
double getPlotPaperMarginRightMM() const
Definition: RLayout.h:298
static RPropertyTypeId PropertyPlotWindowAreaMinX
Definition: RLayout.h:73
RVector plotPaperSize
Definition: RLayout.h:388
Base class for all view tools.
Definition: View.js:18
double plotPaperMarginLeftMM
Definition: RLayout.h:384
static RPropertyTypeId PropertyMinExtentsX
Definition: RLayout.h:58
void setUseStandardScale(bool v)
Definition: RLayout.h:272
void setPlotPaperMarginTopMM(double v)
Definition: RLayout.h:232
void setTabOrder(int to)
Definition: RLayout.h:176
static void init()
Definition: RObject.cpp:64
double getDenominatorCustomScale() const
Definition: RLayout.h:326
static RPropertyTypeId PropertyStandardScale
Definition: RLayout.h:83
virtual RS::EntityType getType() const
Definition: RLayout.h:160
double numeratorCustomScale
Definition: RLayout.h:392
virtual bool isSelectedForPropertyEditing()=0
void setPlotPaperMarginLeftMM(double v)
Definition: RLayout.h:220
static RPropertyTypeId PropertyPlotPaperSizeWidth
Definition: RLayout.h:69
static RPropertyTypeId PropertyPlotPaperMarginRightMM
Definition: RLayout.h:67
double getStandardScale() const
Definition: RLayout.h:346
PlotPaperUnits
Definition: RLayout.h:87
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: RObject.cpp:634
double plotPaperMarginTopMM
Definition: RLayout.h:387
RVector getPlotPaperSize() const
Definition: RLayout.h:306
virtual RObject * clone() const =0
static RPropertyTypeId PropertyPlotOriginX
Definition: RLayout.h:71
RVector insertionBase
Definition: RLayout.h:379
void setInsertionBase(const RVector &insertionBase)
Definition: RLayout.h:196