QCAD
Open Source 2D CAD
RXLineEntity.h
Go to the documentation of this file.
1 
20 #ifndef RXLINEENTITY_H
21 #define RXLINEENTITY_H
22 
23 #include "entity_global.h"
24 
25 #include "REntity.h"
26 #include "RXLineData.h"
27 
28 class RDocument;
29 class RExporter;
30 
39 
40 public:
53 
60 
64 
67 
68 public:
69  RXLineEntity(RDocument* document, const RXLineData& data);
70  virtual ~RXLineEntity();
71 
72  static void init();
73 
74  static QSet<RPropertyTypeId> getStaticPropertyTypeIds() {
76  }
77 
78  virtual RXLineEntity* clone() const {
79  return new RXLineEntity(*this);
80  }
81 
82  virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant& value,
83  RTransaction* transaction=NULL);
84  virtual QPair<QVariant, RPropertyAttributes> getProperty(
85  RPropertyTypeId& propertyTypeId,
86  bool humanReadable = false, bool noAttributes = false, bool showOnRequest = false);
87 
88  virtual void exportEntity(RExporter& e, bool preview=false, bool forceSelected=false) const;
89 
90  virtual RXLineData& getData() {
91  return data;
92  }
93 
94  virtual const RXLineData& getData() const {
95  return data;
96  }
97 
98  void setShape(const RXLine& l);
99 
100  void setBasePoint(const RVector& p) {
101  data.setBasePoint(p);
102  }
103 
105  return data.getBasePoint();
106  }
107 
108  void setSecondPoint(const RVector& p) {
109  data.setSecondPoint(p);
110  }
111 
113  return data.getSecondPoint();
114  }
115 
117  data.setDirectionVector(v);
118  }
119 
121  return data.getDirectionVector();
122  }
123 
124  double getAngle() const {
125  return data.getAngle();
126  }
127 
128  bool hasFixedAngle() const {
129  return data.hasFixedAngle();
130  }
131 
132  void setFixedAngle(bool on) {
133  data.setFixedAngle(on);
134  }
135 
136  double getDirection1() const {
137  return data.getDirection1();
138  }
139 
140  double getDirection2() const {
141  return data.getDirection2();
142  }
143 
144  bool reverse() {
145  return data.reverse();
146  }
147 
148  RS::Side getSideOfPoint(const RVector& point) const {
149  return data.getSideOfPoint(point);
150  }
151 
152  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
153  return data.getTrimEnd(trimPoint, clickPoint);
154  }
155 
156  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
157  return data.trimStartPoint(trimPoint, clickPoint, extend);
158  }
159  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
160  return data.trimEndPoint(trimPoint, clickPoint, extend);
161  }
162 
163  double getLength() const {
164  return data.getLength();
165  }
166 
167 protected:
168  virtual void print(QDebug dbg) const;
169 
170 protected:
172 };
173 
175 Q_DECLARE_METATYPE(QSharedPointer<RXLineEntity>)
176 Q_DECLARE_METATYPE(QSharedPointer<RXLineEntity>*)
177 
178 #endif
static QSet< RPropertyTypeId > getStaticPropertyTypeIds()
Definition: RXLineEntity.h:74
Ending
Entity ending.
Definition: RS.h:155
static RPropertyTypeId PropertyDrawOrder
Definition: RXLineEntity.h:52
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RXLineEntity.h:156
static RPropertyTypeId PropertyDisplayedColor
Definition: RXLineEntity.h:51
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
bool hasFixedAngle() const
Definition: RXLineEntity.h:128
virtual RXLineData & getData()
Definition: RXLineEntity.h:90
static RPropertyTypeId PropertyBasePointX
Definition: RXLineEntity.h:54
double getDirection2() const
Definition: RXLineEntity.h:140
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RPropertyTypeId.h:58
static RPropertyTypeId PropertyDirectionY
Definition: RXLineEntity.h:62
static RPropertyTypeId PropertySecondPointY
Definition: RXLineEntity.h:58
static RPropertyTypeId PropertyLinetype
Definition: RXLineEntity.h:47
RVector getBasePoint() const
Definition: RXLineEntity.h:104
virtual RXLineEntity * clone() const
Definition: RXLineEntity.h:78
void setFixedAngle(bool on)
Definition: RXLineEntity.h:132
Transaction implementation.
Definition: RTransaction.h:74
static RPropertyTypeId PropertyLinetypeScale
Definition: RXLineEntity.h:48
double getLength() const
Definition: RXLineEntity.h:163
void setSecondPoint(const RVector &p)
Definition: RXLineEntity.h:108
static RPropertyTypeId PropertyLineweight
Definition: RXLineEntity.h:49
static RPropertyTypeId PropertyDirectionX
Definition: RXLineEntity.h:61
RVector getSecondPoint() const
Definition: RXLineEntity.h:112
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:145
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RXLineEntity.h:159
static RPropertyTypeId PropertyFixedAngle
Definition: RXLineEntity.h:66
RVector getDirectionVector() const
Definition: RXLineEntity.h:120
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
double getAngle() const
Definition: RXLineEntity.h:124
Base class for all entity classes.
Definition: REntity.h:64
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RXLineData.h:39
virtual const RXLineData & getData() const
Definition: RXLineEntity.h:94
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
static RPropertyTypeId PropertyType
Definition: RXLineEntity.h:44
Q_DECLARE_METATYPE(RMath *)
static RPropertyTypeId PropertyBlock
Definition: RXLineEntity.h:45
double getDirection1() const
Definition: RXLineEntity.h:136
static RPropertyTypeId PropertySecondPointX
Definition: RXLineEntity.h:57
static RPropertyTypeId PropertyHandle
Definition: RXLineEntity.h:42
RXLineData data
Definition: RXLineEntity.h:171
static RPropertyTypeId PropertyBasePointY
Definition: RXLineEntity.h:55
Low-level mathematical representation of an infinite line.
Definition: RXLine.h:42
virtual QPair< QVariant, RPropertyAttributes > getProperty(RPropertyTypeId &propertyTypeId, bool humanReadable=false, bool noAttributes=false, bool showOnRequest=false)
Definition: REntity.cpp:233
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RXLineEntity.h:152
RS::Side getSideOfPoint(const RVector &point) const
Definition: RXLineEntity.h:148
static RPropertyTypeId PropertyCustom
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RXLineEntity.h:41
static void init()
Definition: REntity.cpp:83
static RPropertyTypeId PropertyBasePointZ
Definition: RXLineEntity.h:56
virtual bool setProperty(RPropertyTypeId propertyTypeId, const QVariant &value, RTransaction *transaction=NULL)
Sets the given property to the given value.
Definition: REntity.cpp:326
void setBasePoint(const RVector &p)
Definition: RXLineEntity.h:100
Abstract base class for exporters.
Definition: RExporter.h:71
void setDirectionVectorPoint(const RVector &v)
Definition: RXLineEntity.h:116
static RPropertyTypeId PropertyProtected
Definition: RXLineEntity.h:43
static RPropertyTypeId PropertyColor
Definition: RXLineEntity.h:50
static RPropertyTypeId PropertyAngle
Definition: RXLineEntity.h:65
Infinite line entity.
Definition: RXLineEntity.h:38
static RPropertyTypeId PropertySecondPointZ
Definition: RXLineEntity.h:59
static const RVector invalid
invalid vector
Definition: RVector.h:322
static RPropertyTypeId PropertyDirectionZ
Definition: RXLineEntity.h:63
static RPropertyTypeId PropertyLayer
Definition: RXLineEntity.h:46
bool reverse()
Definition: RXLineEntity.h:144
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