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 RS::EntityType getType() const {
60  return RS::ObjectView;
61  }
62 
63  virtual RView* clone() const;
64 
65  QString getName() const {
66  return name;
67  }
68 
69  void setName(const QString& n) {
70  name = n;
71  }
72 
74  return centerPoint;
75  }
76 
77  void setCenterPoint(const RVector& cPoint) {
78  centerPoint = cPoint;
79  }
80 
81  double getWidth() const {
82  return width;
83  }
84 
85  void setWidth(double w) {
86  width = w;
87  }
88 
89  double getHeight() const {
90  return height;
91  }
92 
93  void setHeight(double h) {
94  height = h;
95  }
96 
98  return RBox(centerPoint - RVector(width, height) / 2, centerPoint
99  + RVector(width, height) / 2);
100  }
101 
102  virtual QPair<QVariant, RPropertyAttributes> getProperty(
103  RPropertyTypeId& propertyTypeId,
104  bool humanReadable = false, bool noAttributes = false);
105  virtual bool setProperty(RPropertyTypeId propertyTypeId,
106  const QVariant& value, RTransaction* transaction=NULL);
107 
108  virtual bool isSelectedForPropertyEditing();
109 
110 private:
111  QString name;
113  double width;
114  double height;
115 };
116 
117 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RView& v);
118 
119 Q_DECLARE_METATYPE(QSharedPointer<RView>)
120 Q_DECLARE_METATYPE(QSharedPointer<RView>*)
123 
124 #endif
Definition: RS.h:83
Represents a box e.g.
Definition: RBox.h:43
RBox getBox()
Definition: RView.h:97
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:92
virtual RS::EntityType getType() const
Definition: RView.h:59
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
Abstract base class for all objects.
Definition: RObject.h:52
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
void setWidth(double w)
Definition: RView.h:85
#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
void setName(const QString &n)
Definition: RView.h:69
Transaction implementation.
Definition: RTransaction.h:74
double getWidth() const
Definition: RView.h:81
double width
Definition: RView.h:113
void setHeight(double h)
Definition: RView.h:93
RVector centerPoint
Definition: RView.h:112
QString getName() const
Definition: RView.h:65
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:67
QString name
Definition: RView.h:111
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyWidth
Definition: RView.h:46
RVector getCenterPoint() const
Definition: RView.h:73
double height
Definition: RView.h:114
void setCenterPoint(const RVector &cPoint)
Definition: RView.h:77
static void init()
Definition: RObject.cpp:61
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-2017 by Andrew Mustun.
Definition: RView.h:44
double getHeight() const
Definition: RView.h:89
virtual RObject * clone() const =0