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 RS::EntityType getType() const {
77  return RS::ObjectUcs;
78  }
79 
80  virtual RUcs* clone() const {
81  return new RUcs(*this);
82  }
83 
85  return false;
86  }
87 
88  virtual QPair<QVariant, RPropertyAttributes> getProperty(
89  RPropertyTypeId& propertyTypeId,
90  bool humanReadable = false, bool noAttributes = false);
91  virtual bool setProperty(RPropertyTypeId propertyTypeId,
92  const QVariant& value, RTransaction* transaction=NULL);
93 
94  void setOrigin(const RVector& o) {
95  origin = o;
96  }
97 
98  void setXAxisDirection(const RVector& x) {
99  xAxisDirection = x;
100  }
101 
102  void setYAxisDirection(const RVector& y) {
103  yAxisDirection = y;
104  }
105 
106  RVector getZAxisDirection();
107 
108  RVector mapFromUcs(const RVector& positionUcs);
109  RVector mapToUcs(const RVector& positionWcs);
110 
111 public:
112  QString name;
116 };
117 
118 QCADCORE_EXPORT QDebug operator<<(QDebug dbg, const RUcs& u);
119 
122 Q_DECLARE_METATYPE(QSharedPointer<RUcs>)
123 Q_DECLARE_METATYPE(QSharedPointer<RUcs>*)
124 
125 #endif
static RPropertyTypeId PropertyYAxisDirectionY
Definition: RUcs.h:51
void setOrigin(const RVector &o)
Definition: RUcs.h:94
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:129
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
RVector xAxisDirection
Definition: RUcs.h:114
Abstract base class for all objects.
Definition: RObject.h:52
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
RVector yAxisDirection
Definition: RUcs.h:115
#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
static RPropertyTypeId PropertyName
Copyright (c) 2011-2016 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:74
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:84
virtual ~RUcs()
Definition: RUcs.h:71
RVector origin
Definition: RUcs.h:113
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
Definition: RS.h:85
static RPropertyTypeId PropertyOriginX
Definition: RUcs.h:44
virtual RUcs * clone() const
Definition: RUcs.h:80
QString name
Definition: RUcs.h:112
RUcs()
Definition: RUcs.h:55
static void init()
Definition: RObject.cpp:61
void setYAxisDirection(const RVector &y)
Definition: RUcs.h:102
virtual RS::EntityType getType() const
Definition: RUcs.h:76
void setXAxisDirection(const RVector &x)
Definition: RUcs.h:98