QCAD
Open Source 2D CAD
RUcs.h
Go to the documentation of this file.
1 
20 #ifndef RUCS_H
21 #define RUCS_H
22 
23 #include "core_global.h"
24 
25 #include "RObject.h"
26 #include "RVector.h"
27 #include "RPropertyTypeId.h"
28 
29 class RDocument;
30 
31 
41 class QCADCORE_EXPORT RUcs : public RObject {
42 public:
53 
54 public:
55  RUcs() : RObject(), origin(0,0,0), xAxisDirection(1,0,0), yAxisDirection(0,1,0) {
56  }
57 
59  RDocument* document,
60  const QString& name,
61  const RVector& origin,
62  const RVector& xAxisDirection,
63  const RVector& yAxisDirection
64  ) : RObject(document),
65  name(name),
66  origin(origin),
67  xAxisDirection(xAxisDirection),
68  yAxisDirection(yAxisDirection) {
69  }
70 
71  virtual ~RUcs() {
72  }
73 
74  static void init();
75 
76  virtual RUcs* clone() const {
77  return new RUcs(*this);
78  }
79 
81  return false;
82  }
83 
84  virtual QPair<QVariant, RPropertyAttributes> getProperty(
85  RPropertyTypeId& propertyTypeId,
86  bool humanReadable = false, bool noAttributes = false);
87  virtual bool setProperty(RPropertyTypeId propertyTypeId,
88  const QVariant& value, RTransaction* transaction=NULL);
89 
90  void setOrigin(const RVector& o) {
91  origin = o;
92  }
93 
94  void setXAxisDirection(const RVector& x) {
95  xAxisDirection = x;
96  }
97 
98  void setYAxisDirection(const RVector& y) {
99  yAxisDirection = y;
100  }
101 
102  RVector getZAxisDirection();
103 
104  RVector mapFromUcs(const RVector& positionUcs);
105  RVector mapToUcs(const RVector& positionWcs);
106 
107 public:
108  QString name;
112 };
113 
114 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RUcs& u);
115 
118 Q_DECLARE_METATYPE(QSharedPointer<RUcs>)
119 Q_DECLARE_METATYPE(QSharedPointer<RUcs>*)
120 
121 #endif
static RPropertyTypeId PropertyYAxisDirectionY
Definition: RUcs.h:51
void setOrigin(const RVector &o)
Definition: RUcs.h:90
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
static RPropertyTypeId PropertyYAxisDirectionZ
Definition: RUcs.h:52
static RPropertyTypeId PropertyXAxisDirectionX
Definition: RUcs.h:47
Represents a user coordinate system (UCS) in a drawing.
Definition: RUcs.h:41
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: RObject.cpp:101
RVector xAxisDirection
Definition: RUcs.h:110
Abstract base class for all objects.
Definition: RObject.h:48
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPropertyTypeId.h:57
RVector yAxisDirection
Definition: RUcs.h:111
#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
static RPropertyTypeId PropertyName
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RUcs.h:43
static RPropertyTypeId PropertyOriginZ
Definition: RUcs.h:46
QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RUcs &u)
Stream operator for QDebug.
Definition: RUcs.cpp:195
Transaction implementation.
Definition: RTransaction.h:70
static RPropertyTypeId PropertyOriginY
Definition: RUcs.h:45
static RPropertyTypeId PropertyYAxisDirectionX
Definition: RUcs.h:50
RUcs(RDocument *document, const QString &name, const RVector &origin, const RVector &xAxisDirection, const RVector &yAxisDirection)
Definition: RUcs.h:58
static RPropertyTypeId PropertyXAxisDirectionY
Definition: RUcs.h:48
static RPropertyTypeId PropertyXAxisDirectionZ
Definition: RUcs.h:49
virtual bool isSelectedForPropertyEditing()
Definition: RUcs.h:80
virtual ~RUcs()
Definition: RUcs.h:71
RVector origin
Definition: RUcs.h:109
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyOriginX
Definition: RUcs.h:44
virtual RUcs * clone() const
Definition: RUcs.h:76
QString name
Definition: RUcs.h:108
RUcs()
Definition: RUcs.h:55
static void init()
Definition: RObject.cpp:35
void setYAxisDirection(const RVector &y)
Definition: RUcs.h:98
void setXAxisDirection(const RVector &x)
Definition: RUcs.h:94