QCAD
Open Source 2D CAD
RTraceEntity.h
Go to the documentation of this file.
1 
20 #ifndef RTRACEENTITY_H
21 #define RTRACEENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RTraceData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
53 
66 
69 
70 public:
71  RTraceEntity(RDocument* document, const RTraceData& data);
72  virtual ~RTraceEntity();
73 
74  static void init();
75 
76  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
78  }
79 
80  virtual RTraceEntity* clone() const {
81  return new RTraceEntity(*this);
82  }
83 
84  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
85  RTransaction* transaction=NULL);
86  virtual QPair<QVariant, RPropertyAttributes> getProperty(
87  RPropertyTypeId& propertyTypeId,
88  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
89 
90  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
91 
92  virtual RTraceData& getData() {
93  return data;
94  }
95 
96  virtual const RTraceData& getData() const {
97  return data;
98  }
99 
100  RVector getVertexAt(int i) const {
101  return data.getVertexAt(i);
102  }
103 
104  int countVertices() const {
105  return data.countVertices();
106  }
107 
109  return data.getStartPoint();
110  }
111 
113  return data.getEndPoint();
114  }
115 
116  double getDirection1() const {
117  return data.getDirection1();
118  }
119 
120  double getDirection2() const {
121  return data.getDirection2();
122  }
123 
124  bool reverse() {
125  return data.reverse();
126  }
127 
128  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
129  return data.getTrimEnd(trimPoint, clickPoint);
130  }
131 
132  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
133  return data.trimStartPoint(trimPoint, clickPoint, extend);
134  }
135  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
136  return data.trimEndPoint(trimPoint, clickPoint, extend);
137  }
138 
139  double getLength() const {
140  return data.getLength();
141  }
142 
143 protected:
144  virtual void print(QDebug dbg) const;
145 
146 protected:
148 };
149 
151 Q_DECLARE_METATYPE(QSharedPointer<RTraceEntity>)
152 Q_DECLARE_METATYPE(QSharedPointer<RTraceEntity>*)
153 
154 #endif
static RPropertyTypeId PropertyPoint2Z
Definition: RTraceEntity.h:59
Ending
Entity ending.
Definition: RS.h:155
static RPropertyTypeId PropertyLength
Definition: RTraceEntity.h:67
static RPropertyTypeId PropertyPoint3X
Definition: RTraceEntity.h:60
RVector getStartPoint() const
Definition: RTraceEntity.h:108
bool reverse()
Definition: RTraceEntity.h:124
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RTraceEntity.h:128
double getDirection1() const
Definition: RTraceEntity.h:116
static RPropertyTypeId PropertyLinetypeScale
Definition: RTraceEntity.h:48
static RPropertyTypeId PropertyPoint1Z
Definition: RTraceEntity.h:56
RVector getEndPoint() const
Definition: RTraceEntity.h:112
int countVertices() const
Definition: RTraceEntity.h:104
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
RVector getVertexAt(int i) const
Definition: RTraceEntity.h:100
static RPropertyTypeId PropertyDrawOrder
Definition: RTraceEntity.h:52
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
static RPropertyTypeId PropertyLayer
Definition: RTraceEntity.h:46
static RPropertyTypeId PropertyDisplayedColor
Definition: RTraceEntity.h:51
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RTraceEntity.h:132
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyLinetype
Definition: RTraceEntity.h:47
static RPropertyTypeId PropertyPoint1Y
Definition: RTraceEntity.h:55
static RPropertyTypeId PropertyPoint4X
Definition: RTraceEntity.h:63
virtual RTraceData & getData()
Definition: RTraceEntity.h:92
static RPropertyTypeId PropertyPoint3Y
Definition: RTraceEntity.h:61
static RPropertyTypeId PropertyPoint4Z
Definition: RTraceEntity.h:65
static RPropertyTypeId PropertyPoint3Z
Definition: RTraceEntity.h:62
double getLength() const
Definition: RTraceEntity.h:139
static RPropertyTypeId PropertyPoint2Y
Definition: RTraceEntity.h:58
Trace entity.
Definition: RTraceEntity.h:38
static QSet< RPropertyTypeId > getPropertyTypeIds(const std::type_info &classInfo)
Gets all property type IDs that where registered for the given class.
Definition: RPropertyTypeId.cpp:229
Base class for all entity classes.
Definition: REntity.h:64
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
static RPropertyTypeId PropertyPoint2X
Definition: RTraceEntity.h:57
static RPropertyTypeId PropertyTotalLength
Definition: RTraceEntity.h:68
Q_DECLARE_METATYPE(RMath *)
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RTraceData.h:35
static RPropertyTypeId PropertyProtected
Definition: RTraceEntity.h:43
static RPropertyTypeId PropertyPoint4Y
Definition: RTraceEntity.h:64
static RPropertyTypeId PropertyColor
Definition: RTraceEntity.h:50
static RPropertyTypeId PropertyBlock
Definition: RTraceEntity.h:45
static RPropertyTypeId PropertyHandle
Definition: RTraceEntity.h:42
RTraceData data
Definition: RTraceEntity.h:147
virtual const RTraceData & getData() const
Definition: RTraceEntity.h:96
static RPropertyTypeId PropertyLineweight
Definition: RTraceEntity.h:49
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RTraceEntity.h:135
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:233
virtual RTraceEntity * clone() const
Definition: RTraceEntity.h:80
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RTraceEntity.h:76
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RTraceEntity.h:41
static void init()
Definition: REntity.cpp:83
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:326
Abstract base class for exporters.
Definition: RExporter.h:71
static RPropertyTypeId PropertyType
Definition: RTraceEntity.h:44
static RPropertyTypeId PropertyPoint1X
Definition: RTraceEntity.h:54
double getDirection2() const
Definition: RTraceEntity.h:120
static const RVector invalid
invalid vector
Definition: RVector.h:322
virtual void exportEntity(RExporter &e, bool preview=false, bool forceSelected=false) const =0
Exports the entity to the given exporter.
virtual void print(QDebug dbg) const
Stream operator for QDebug.
Definition: REntity.cpp:473