QCAD
Open Source 2D CAD
RLineData.h
Go to the documentation of this file.
1 
20 #ifndef RLINEDATA_H
21 #define RLINEDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RBox.h"
26 #include "RDocument.h"
27 #include "REntity.h"
28 #include "RLine.h"
29 #include "RVector.h"
30 
39 class QCADENTITY_EXPORT RLineData: public REntityData, protected RLine {
40 
41  friend class RLineEntity;
42 
43 protected:
45 
46 public:
47  RLineData();
48  RLineData(const RLine& line);
49  RLineData(const RVector& startPoint, const RVector& endPoint);
50 
52  return *this;
53  }
54 
55  virtual RPolyline getHull(double offset) const;
56 
58  return RLine::getStartPoint();
59  }
60  RVector getEndPoint() const {
61  return RLine::getEndPoint();
62  }
63  double getAngle() const {
64  return RLine::getAngle();
65  }
66  double getDirection1() const {
67  return RLine::getDirection1();
68  }
69  double getDirection2() const {
70  return RLine::getDirection2();
71  }
72  bool reverse() {
73  return RLine::reverse();
74  }
75 
76  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
77  return RLine::getTrimEnd(trimPoint, clickPoint);
78  }
79  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
80  return RLine::trimStartPoint(trimPoint, clickPoint, extend);
81  }
82  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
83  return RLine::trimEndPoint(trimPoint, clickPoint, extend);
84  }
85 
86  RS::Side getSideOfPoint(const RVector& point) const {
87  return RLine::getSideOfPoint(point);
88  }
89 
90  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
91 
92  virtual bool moveReferencePoint(const RVector& referencePoint,
93  const RVector& targetPoint);
94 
95  virtual RShape* castToShape() {
96  return this;
97  }
98 
99  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
100  Q_UNUSED(queryBox)
101  Q_UNUSED(ignoreComplex)
102  Q_UNUSED(segment)
103 
104  return QList<QSharedPointer<RShape> >() <<
105  QSharedPointer<RShape>(new RLine(*this));
106  }
107 };
108 
112 Q_DECLARE_METATYPE(QSharedPointer<RLineData>)
113 
114 #endif
RLineData data
Definition: RLineEntity.h:165
Represents a box e.g.
Definition: RBox.h:43
Ending
Entity ending.
Definition: RS.h:152
Base class for all entity data classes.
Definition: REntityData.h:65
bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RLineData.h:82
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
RLine getLine()
Definition: RLineData.h:51
virtual RS::Side getSideOfPoint(const RVector &point) const
Definition: RLine.cpp:205
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
virtual RPolyline getHull(double offset) const
Definition: REntityData.cpp:286
virtual RVector getStartPoint() const
Definition: RLine.cpp:108
virtual double getDirection2() const
Definition: RLine.cpp:104
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RLineData.h:99
RVector getEndPoint() const
Definition: RLineData.h:60
virtual RShape * castToShape()
Definition: RLineData.h:95
RVector getStartPoint() const
Definition: RLineData.h:57
virtual bool reverse()
Definition: RLine.cpp:328
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RLine.cpp:354
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:131
Side
Side used for side of a point relativ to an entity (right hand or left hand side) ...
Definition: RS.h:142
bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RLineData.h:79
double getAngle() const
Definition: RLine.cpp:76
Line entity.
Definition: RLineEntity.h:38
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
virtual bool moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint)=0
Moves the given reference point to the given target point or does nothing if this entity has no refer...
Q_DECLARE_METATYPE(RMath *)
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLineData.h:39
double getAngle() const
Definition: RLineData.h:63
double getDirection1() const
Definition: RLineData.h:66
RS::Side getSideOfPoint(const RVector &point) const
Definition: RLineData.h:86
virtual RVector getEndPoint() const
Definition: RLine.cpp:116
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
Low-level mathematical representation of a line.
Definition: RLine.h:41
Definition: RS.h:132
bool reverse()
Definition: RLineData.h:72
RLine()
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLine.cpp:28
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RLineData.h:76
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
virtual double getDirection1() const
Definition: RLine.cpp:100
Interface for geometrical shape classes.
Definition: RShape.h:52
static const RVector invalid
invalid vector
Definition: RVector.h:314
double getDirection2() const
Definition: RLineData.h:69
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RLine.cpp:373
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RLine.cpp:384
RDocument * document
Definition: RObject.h:271