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 
51  virtual RS::EntityType getType() const {
52  return RS::EntityLine;
53  }
54 
56  return *this;
57  }
58 
59  virtual RPolyline getHull(double offset) const;
60 
62  return RLine::getStartPoint();
63  }
64  RVector getEndPoint() const {
65  return RLine::getEndPoint();
66  }
67  double getAngle() const {
68  return RLine::getAngle();
69  }
70  double getDirection1() const {
71  return RLine::getDirection1();
72  }
73  double getDirection2() const {
74  return RLine::getDirection2();
75  }
76  bool reverse() {
77  return RLine::reverse();
78  }
79 
80  RS::Ending getTrimEnd(const RVector& trimPoint, const RVector& clickPoint) {
81  return RLine::getTrimEnd(trimPoint, clickPoint);
82  }
83  bool trimStartPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
84  return RLine::trimStartPoint(trimPoint, clickPoint, extend);
85  }
86  bool trimEndPoint(const RVector& trimPoint, const RVector& clickPoint = RVector::invalid, bool extend = false) {
87  return RLine::trimEndPoint(trimPoint, clickPoint, extend);
88  }
89 
90  RS::Side getSideOfPoint(const RVector& point) const {
91  return RLine::getSideOfPoint(point);
92  }
93 
94  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
95 
96  virtual bool moveReferencePoint(const RVector& referencePoint,
97  const RVector& targetPoint);
98 
99  virtual RShape* castToShape() {
100  return this;
101  }
102 
103  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
104  Q_UNUSED(queryBox)
105  Q_UNUSED(ignoreComplex)
106  Q_UNUSED(segment)
107 
108  return QList<QSharedPointer<RShape> >() <<
109  QSharedPointer<RShape>(new RLine(*this));
110  }
111 };
112 
116 Q_DECLARE_METATYPE(QSharedPointer<RLineData>)
117 
118 #endif
RLineData data
Definition: RLineEntity.h:161
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:86
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
RLine getLine()
Definition: RLineData.h:55
virtual RS::Side getSideOfPoint(const RVector &point) const
Definition: RLine.cpp:205
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
virtual RPolyline getHull(double offset) const
Definition: REntityData.cpp:299
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:103
virtual RS::EntityType getType() const
Definition: RLineData.h:51
RVector getEndPoint() const
Definition: RLineData.h:64
virtual RShape * castToShape()
Definition: RLineData.h:99
RVector getStartPoint() const
Definition: RLineData.h:61
virtual bool reverse()
Definition: RLine.cpp:328
virtual RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RLine.cpp:359
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:83
double getAngle() const
Definition: RLine.cpp:76
Line.
Definition: RS.h:95
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-2017 by Andrew Mustun.
Definition: RLineData.h:39
double getAngle() const
Definition: RLineData.h:67
double getDirection1() const
Definition: RLineData.h:70
RS::Side getSideOfPoint(const RVector &point) const
Definition: RLineData.h:90
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:76
RLine()
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RLine.cpp:28
RS::Ending getTrimEnd(const RVector &trimPoint, const RVector &clickPoint)
Definition: RLineData.h:80
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:317
double getDirection2() const
Definition: RLineData.h:73
virtual bool trimStartPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RLine.cpp:378
virtual bool trimEndPoint(const RVector &trimPoint, const RVector &clickPoint=RVector::invalid, bool extend=false)
Definition: RLine.cpp:389
RDocument * document
Definition: RObject.h:271