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  void setDimaszOverride(double v);
53 
54  double getDimscale() const;
55  void setDimscaleOverride(double v);
56 
57  void setArrowHead(bool on);
58  bool hasArrowHead() const {
59  return arrowHead;
60  }
61 
62  bool canHaveArrowHead() const;
63  bool updateArrowHead();
64 
65 // void setPolyline(const RPolyline& polyline) {
66 // *((RPolyline*)this) = polyline;
67 // }
68 
69  RVector getEndPoint() const {
70  return RPolyline::getEndPoint();
71  }
72 
74  return RPolyline::getStartPoint();
75  }
76 
77  int countVertices() const {
78  return RPolyline::countVertices();
79  }
80 
81  int countSegments() const {
82  return RPolyline::countSegments();
83  }
84 
85  void appendVertex(const RVector& vertex) {
87  }
88 
89  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
90 
91  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
92 
93  QList<QSharedPointer<RShape> > getExploded(int segments = RDEFAULT_MIN1) const {
94  return RPolyline::getExploded(segments);
95  }
96 
97  virtual bool scale(const RVector& scaleFactors, const RVector& center);
98  virtual bool stretch(const RPolyline& area, const RVector& offset);
99 
100  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const {
101  Q_UNUSED(queryBox)
102  Q_UNUSED(ignoreComplex)
103 
104  QList<QSharedPointer<RShape> > ret;
105  ret << QSharedPointer<RShape>(new RPolyline(*this));
106  if (arrowHead) {
107  ret << QSharedPointer<RShape>(new RTriangle(getArrowShape()));
108  }
109  return ret;
110  }
111 
112  RTriangle getArrowShape() const;
113 
114  REntity::Id getDimLeaderBlockId() const;
115  void setDimLeaderBlockId(REntity::Id id);
116 
117 private:
119  bool arrowHead;
126 };
127 
131 Q_DECLARE_METATYPE(QSharedPointer<RLeaderData>)
132 
133 #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:198
void appendVertex(const RVector &vertex)
Definition: RLeaderData.h:85
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
int countVertices() const
Definition: RPolyline.cpp:409
#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
int Id
Definition: RObject.h:53
void setArrowHead(bool on)
Definition: RLeaderEntity.h:98
bool hasArrowHead() const
Definition: RLeaderData.h:58
int countSegments() const
Definition: RPolyline.cpp:845
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:129
bool arrowHead
Arrow head on / off.
Definition: RLeaderData.h:119
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
Definition: REntityData.cpp:499
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:1008
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:81
double dimaszOverride
Arrow size.
Definition: RLeaderData.h:121
virtual RVector getEndPoint() const
Definition: RPolyline.cpp:1016
QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RLeaderData.h:93
RVector getEndPoint() const
Definition: RLeaderData.h:69
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:130
#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:73
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolyline.cpp:806
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:100
Interface for geometrical shape classes.
Definition: RShape.h:52
double dimscaleOverride
Dimension scale.
Definition: RLeaderData.h:123
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:242
RBlock::Id dimLeaderBlockId
Block to use instead of arrow.
Definition: RLeaderData.h:125
int countVertices() const
Definition: RLeaderData.h:77
RDocument * document
Definition: RObject.h:267