QCAD
Open Source 2D CAD
RView.h
Go to the documentation of this file.
1 
20 #ifndef RVIEW_H
21 #define RVIEW_H
22 
23 #include "core_global.h"
24 
25 #include <QString>
26 #include <QColor>
27 #include <QDebug>
28 
29 #include "RGlobal.h"
30 #include "RObject.h"
31 #include "RBox.h"
32 
33 class RDocument;
34 
42 class QCADCORE_EXPORT RView: public RObject {
43 public:
48 
49 public:
50  RView();
51 
52  RView(RDocument* document, const QString& name, RVector centerPoint,
53  double width, double height);
54 
55  virtual ~RView();
56 
57  static void init();
58 
59  virtual RView* clone() const;
60 
61  QString getName() const {
62  return name;
63  }
64 
65  void setName(const QString& n) {
66  name = n;
67  }
68 
70  return centerPoint;
71  }
72 
73  void setCenterPoint(const RVector& cPoint) {
74  centerPoint = cPoint;
75  }
76 
77  double getWidth() const {
78  return width;
79  }
80 
81  void setWidth(double w) {
82  width = w;
83  }
84 
85  double getHeight() const {
86  return height;
87  }
88 
89  void setHeight(double h) {
90  height = h;
91  }
92 
94  return RBox(centerPoint - RVector(width, height) / 2, centerPoint
95  + RVector(width, height) / 2);
96  }
97 
98  virtual QPair<QVariant, RPropertyAttributes> getProperty(
99  RPropertyTypeId& propertyTypeId,
100  bool humanReadable = false, bool noAttributes = false);
101  virtual bool setProperty(RPropertyTypeId propertyTypeId,
102  const QVariant& value, RTransaction* transaction=NULL);
103 
104  virtual bool isSelectedForPropertyEditing();
105 
106 private:
107  QString name;
109  double width;
110  double height;
111 };
112 
113 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RView& v);
114 
115 Q_DECLARE_METATYPE(QSharedPointer<RView>)
116 Q_DECLARE_METATYPE(QSharedPointer<RView>*)
119 
120 #endif
Represents a box e.g.
Definition: RBox.h:43
RBox getBox()
Definition: RView.h:93
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RView &v)
Stream operator for QDebug.
Definition: RView.cpp:89
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RObject.cpp:101
Abstract base class for all objects.
Definition: RObject.h:48
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
void setWidth(double w)
Definition: RView.h:81
#define QCADCORE_EXPORT
Definition: core_global.h:10
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false)
Definition: RObject.cpp:67
void setName(const QString &n)
Definition: RView.h:65
Transaction implementation.
Definition: RTransaction.h:70
double getWidth() const
Definition: RView.h:77
double width
Definition: RView.h:109
void setHeight(double h)
Definition: RView.h:89
RVector centerPoint
Definition: RView.h:108
QString getName() const
Definition: RView.h:61
static RPropertyTypeId PropertyHeight
Definition: RView.h:47
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
QString name
Definition: RView.h:107
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyWidth
Definition: RView.h:46
RVector getCenterPoint() const
Definition: RView.h:69
double height
Definition: RView.h:110
void setCenterPoint(const RVector &cPoint)
Definition: RView.h:73
static void init()
Definition: RObject.cpp:35
static RPropertyTypeId PropertyCenterPoint
Definition: RView.h:45
virtual bool isSelectedForPropertyEditing()=0
Represents a view in a drawing.
Definition: RView.h:42
static RPropertyTypeId PropertyName
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RView.h:44
double getHeight() const
Definition: RView.h:85
virtual RObject * clone() const =0