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 RS::EntityType getType() const {
48  return RS::EntityLeader;
49  }
50  virtual RShape* castToShape() {
51  return this;
52  }
53 
54  double getDimasz() const;
55  void setDimaszOverride(double v);
56 
57  double getDimScale(bool fromDocument=true) const;
58  void setDimScaleOverride(double v);
59 
60  virtual void scaleVisualProperties(double scaleFactor);
61 
62  void setArrowHead(bool on);
63  bool hasArrowHead() const {
64  return arrowHead;
65  }
66 
67  bool canHaveArrowHead() const;
68  bool updateArrowHead();
69 
70 // void setPolyline(const RPolyline& polyline) {
71 // *((RPolyline*)this) = polyline;
72 // }
73 
74  RVector getEndPoint() const {
75  return RPolyline::getEndPoint();
76  }
77 
79  return RPolyline::getStartPoint();
80  }
81 
82  int countVertices() const {
83  return RPolyline::countVertices();
84  }
85 
86  int countSegments() const {
87  return RPolyline::countSegments();
88  }
89 
90  void appendVertex(const RVector& vertex) {
92  }
93 
94  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
95 
96  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
97 
98  QList<QSharedPointer<RShape> > getExploded(int segments = RDEFAULT_MIN1) const {
99  return RPolyline::getExploded(segments);
100  }
101 
102  virtual bool scale(const RVector& scaleFactors, const RVector& center);
103  virtual bool stretch(const RPolyline& area, const RVector& offset);
104 
105  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false, bool segment = false) const {
106  Q_UNUSED(queryBox)
107  Q_UNUSED(ignoreComplex)
108  Q_UNUSED(segment)
109 
110  QList<QSharedPointer<RShape> > ret;
111  ret << QSharedPointer<RShape>(new RPolyline(*this));
112  if (arrowHead) {
113  ret << QSharedPointer<RShape>(new RTriangle(getArrowShape()));
114  }
115  return ret;
116  }
117 
118  RTriangle getArrowShape() const;
119 
120  REntity::Id getDimLeaderBlockId() const;
121  void setDimLeaderBlockId(REntity::Id id);
122 
123 private:
125  bool arrowHead;
132 };
133 
137 Q_DECLARE_METATYPE(QSharedPointer<RLeaderData>)
138 
139 #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:200
void appendVertex(const RVector &vertex)
Definition: RLeaderData.h:90
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
int countVertices() const
Definition: RPolyline.cpp:521
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:76
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
Low-level mathematical representation of a triangle.
Definition: RTriangle.h:46
double dimScaleOverride
Dimension scale.
Definition: RLeaderData.h:129
virtual RS::EntityType getType() const
Definition: RLeaderData.h:47
Leader entity class.
Definition: RLeaderEntity.h:38
int Id
Definition: RObject.h:66
void setArrowHead(bool on)
Definition: RLeaderEntity.h:96
bool hasArrowHead() const
Definition: RLeaderData.h:63
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RLeaderData.h:105
int countSegments() const
Definition: RPolyline.cpp:1047
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:134
bool arrowHead
Arrow head on / off.
Definition: RLeaderData.h:125
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
Definition: REntityData.cpp:560
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:1225
Copyright (c) 2011-2018 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:86
double dimaszOverride
Arrow size.
Definition: RLeaderData.h:127
virtual RVector getEndPoint() const
Definition: RPolyline.cpp:1233
QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RLeaderData.h:98
RVector getEndPoint() const
Definition: RLeaderData.h:74
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:605
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
Definition: RS.h:135
#define RDEFAULT_MIN1
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RExplodable.h:30
virtual RShape * castToShape()
Definition: RLeaderData.h:50
RVector getStartPoint() const
Definition: RLeaderData.h:78
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolyline.cpp:1008
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
Interface for geometrical shape classes.
Definition: RShape.h:52
RPolyline()
Creates a polyline object without points.
Definition: RPolyline.cpp:36
virtual void scaleVisualProperties(double scaleFactor)
Definition: REntityData.cpp:574
void appendVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolyline.cpp:297
double getDimScale(bool fromDocument=true) const
Definition: RLeaderEntity.h:186
RBlock::Id dimLeaderBlockId
Block to use instead of arrow.
Definition: RLeaderData.h:131
Leader.
Definition: RS.h:121
int countVertices() const
Definition: RLeaderData.h:82
RDocument * document
Definition: RObject.h:308