QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
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
27#include "RS.h"
28#include "RObject.h"
29#include "RBox.h"
30
31class QDebug;
32class RDocument;
33
42public:
47
48public:
49 RView();
50
51 RView(RDocument* document, const QString& name, RVector centerPoint,
52 double width, double height);
53
54 virtual ~RView();
55
56 static void init();
57
59 return RS::ObjectView;
60 }
61
62 virtual RS::EntityType getType() const {
63 return RS::ObjectView;
64 }
65
66 virtual QSharedPointer<RObject> clone() const {
67 return QSharedPointer<RObject>(new RView(*this));
68 }
69
70 QSharedPointer<RView> cloneToView() const {
71 return QSharedPointer<RView>(new RView(*this));
72 }
73
74 QString getName() const {
75 return name;
76 }
77
78 void setName(const QString& n) {
79 name = n;
80 }
81
83 return centerPoint;
84 }
85
86 void setCenterPoint(const RVector& cPoint) {
87 centerPoint = cPoint;
88 }
89
90 double getWidth() const {
91 return width;
92 }
93
94 void setWidth(double w) {
95 width = w;
96 }
97
98 double getHeight() const {
99 return height;
100 }
101
102 void setHeight(double h) {
103 height = h;
104 }
105
107 return RBox(centerPoint - RVector(width, height) / 2, centerPoint
108 + RVector(width, height) / 2);
109 }
110
111 void scale(double factor) {
112 centerPoint.scale(factor);
113 width*=factor;
114 height*=factor;
115 }
116
117 virtual QPair<QVariant, RPropertyAttributes> getProperty(
118 RPropertyTypeId& propertyTypeId,
119 bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
120 virtual bool setProperty(RPropertyTypeId propertyTypeId,
121 const QVariant& value, RTransaction* transaction=NULL);
122
123private:
124 QString name;
126 double width;
127 double height;
128};
129
130QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RView& v);
131
132Q_DECLARE_METATYPE(QSharedPointer<RView>)
133Q_DECLARE_METATYPE(QSharedPointer<RView>*)
136
137#endif
Q_DECLARE_METATYPE(RMath *)
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RView &v)
Stream operator for QDebug.
Definition RView.cpp:79
Represents a box e.g.
Definition RBox.h:46
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition RDocument.h:78
Abstract base class for all objects.
Definition RObject.h:64
static void init()
Definition RObject.cpp:68
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition RObject.cpp:180
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition RObject.cpp:136
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RPropertyTypeId.h:54
EntityType
Entity types used for property handling / filtering.
Definition RS.h:227
@ ObjectView
Definition RS.h:236
Transaction implementation.
Definition RTransaction.h:73
Represents a 3d vector (x/y/z).
Definition RVector.h:47
Represents a view in a drawing.
Definition RView.h:41
static RPropertyTypeId PropertyCenterPoint
Definition RView.h:44
static RS::EntityType getRtti()
Definition RView.h:58
double height
Definition RView.h:127
RBox getBox()
Definition RView.h:106
void scale(double factor)
Definition RView.h:111
void setHeight(double h)
Definition RView.h:102
void setName(const QString &n)
Definition RView.h:78
QString getName() const
Definition RView.h:74
double width
Definition RView.h:126
void setCenterPoint(const RVector &cPoint)
Definition RView.h:86
virtual QSharedPointer< RObject > clone() const
Definition RView.h:66
QSharedPointer< RView > cloneToView() const
Definition RView.h:70
static RPropertyTypeId PropertyHeight
Definition RView.h:46
virtual RS::EntityType getType() const
Definition RView.h:62
double getWidth() const
Definition RView.h:90
QString name
Definition RView.h:124
void setWidth(double w)
Definition RView.h:94
static RPropertyTypeId PropertyWidth
Definition RView.h:45
double getHeight() const
Definition RView.h:98
RVector centerPoint
Definition RView.h:125
RVector getCenterPoint() const
Definition RView.h:82
static RPropertyTypeId PropertyName
Copyright (c) 2011-2018 by Andrew Mustun.
Definition RView.h:43
#define QCADCORE_EXPORT
Definition core_global.h:10
#define NULL
Definition opennurbs_system.h:256