QCAD
Open Source 2D CAD
RLeaderData.h
Go to the documentation of this file.
1 
20 #ifndef RLEADERDATA_H
21 #define RLEADERDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RDocument.h"
26 #include "RDimLinearData.h"
27 #include "RVector.h"
28 #include "RPolyline.h"
29 
38  friend class RLeaderEntity;
39 
40 protected:
42 
43 public:
44  RLeaderData();
45  RLeaderData(const RPolyline& polyline, bool arrowHead);
46 
47  virtual RShape* castToShape() {
48  return this;
49  }
50 
51  double getDimasz() const;
52  double getDimscale() const;
53 
54  void setArrowHead(bool on);
55  bool hasArrowHead() const {
56  return arrowHead;
57  }
58 
59  bool canHaveArrowHead() const;
60  bool updateArrowHead();
61 
62 // void setPolyline(const RPolyline& polyline) {
63 // *((RPolyline*)this) = polyline;
64 // }
65 
66  RVector getEndPoint() const {
67  return RPolyline::getEndPoint();
68  }
69 
71  return RPolyline::getStartPoint();
72  }
73 
74  int countVertices() const {
75  return RPolyline::countVertices();
76  }
77 
78  int countSegments() const {
79  return RPolyline::countSegments();
80  }
81 
82  void appendVertex(const RVector& vertex) {
84  }
85 
86  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
87 
88  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
89 
90  QList<QSharedPointer<RShape> > getExploded(int segments = RDEFAULT_MIN1) const {
91  return RPolyline::getExploded(segments);
92  }
93 
94  virtual bool scale(const RVector& scaleFactors, const RVector& center);
95  virtual bool stretch(const RPolyline& area, const RVector& offset);
96 
97  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const {
98  Q_UNUSED(queryBox)
99  Q_UNUSED(ignoreComplex)
100 
101  QList<QSharedPointer<RShape> > ret;
102  ret << QSharedPointer<RShape>(new RPolyline(*this));
103  if (arrowHead) {
104  ret << QSharedPointer<RShape>(new RTriangle(getArrowShape()));
105  }
106  return ret;
107  }
108 
109  RTriangle getArrowShape() const;
110 
111 private:
113  bool arrowHead;
114 };
115 
119 Q_DECLARE_METATYPE(QSharedPointer<RLeaderData>)
120 
121 #endif
Represents a box e.g.
Definition: RBox.h:43
Base class for all entity data classes.
Definition: REntityData.h:65
RLeaderData data
Definition: RLeaderEntity.h:197
void appendVertex(const RVector &vertex)
Definition: RLeaderData.h:82
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
int countVertices() const
Definition: RPolyline.cpp:379
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
Low-level mathematical representation of a triangle.
Definition: RTriangle.h:46
Leader entity class.
Definition: RLeaderEntity.h:38
void setArrowHead(bool on)
Definition: RLeaderEntity.h:97
bool hasArrowHead() const
Definition: RLeaderData.h:55
int countSegments() const
Definition: RPolyline.cpp:760
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:128
bool arrowHead
Arrow head on / off.
Definition: RLeaderData.h:113
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
Definition: REntityData.cpp:499
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:913
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RLeaderData.h:37
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 *)
int countSegments() const
Definition: RLeaderData.h:78
virtual RVector getEndPoint() const
Definition: RPolyline.cpp:921
QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RLeaderData.h:90
RVector getEndPoint() const
Definition: RLeaderData.h:66
virtual bool stretch(const RPolyline &area, const RVector &offset)
Stretches the end points of this entity that are inside area by offset.
Definition: REntityData.cpp:544
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
Definition: RS.h:129
#define RDEFAULT_MIN1
Copyright (c) 2011-2016 by Andrew Mustun.
Definition: RExplodable.h:30
virtual RShape * castToShape()
Definition: RLeaderData.h:47
RVector getStartPoint() const
Definition: RLeaderData.h:70
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolyline.cpp:721
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:50
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false) const
Definition: RLeaderData.h:97
Interface for geometrical shape classes.
Definition: RShape.h:52
RPolyline()
Creates a polyline object without points.
Definition: RPolyline.cpp:34
void appendVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolyline.cpp:211
int countVertices() const
Definition: RLeaderData.h:74
RDocument * document
Definition: RObject.h:267