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() const;
58  void setDimscaleOverride(double v);
59 
60  void setArrowHead(bool on);
61  bool hasArrowHead() const {
62  return arrowHead;
63  }
64 
65  bool canHaveArrowHead() const;
66  bool updateArrowHead();
67 
68 // void setPolyline(const RPolyline& polyline) {
69 // *((RPolyline*)this) = polyline;
70 // }
71 
72  RVector getEndPoint() const {
73  return RPolyline::getEndPoint();
74  }
75 
77  return RPolyline::getStartPoint();
78  }
79 
80  int countVertices() const {
81  return RPolyline::countVertices();
82  }
83 
84  int countSegments() const {
85  return RPolyline::countSegments();
86  }
87 
88  void appendVertex(const RVector& vertex) {
90  }
91 
92  virtual QList<RRefPoint> getReferencePoints(RS::ProjectionRenderingHint hint = RS::RenderTop) const;
93 
94  virtual bool moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint);
95 
96  QList<QSharedPointer<RShape> > getExploded(int segments = RDEFAULT_MIN1) const {
97  return RPolyline::getExploded(segments);
98  }
99 
100  virtual bool scale(const RVector& scaleFactors, const RVector& center);
101  virtual bool stretch(const RPolyline& area, const RVector& offset);
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  QList<QSharedPointer<RShape> > ret;
109  ret << QSharedPointer<RShape>(new RPolyline(*this));
110  if (arrowHead) {
111  ret << QSharedPointer<RShape>(new RTriangle(getArrowShape()));
112  }
113  return ret;
114  }
115 
116  RTriangle getArrowShape() const;
117 
118  REntity::Id getDimLeaderBlockId() const;
119  void setDimLeaderBlockId(REntity::Id id);
120 
121 private:
123  bool arrowHead;
130 };
131 
135 Q_DECLARE_METATYPE(QSharedPointer<RLeaderData>)
136 
137 #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:194
void appendVertex(const RVector &vertex)
Definition: RLeaderData.h:88
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
#define RDEFAULT_RBOX
Definition: RBox.h:32
int countVertices() const
Definition: RPolyline.cpp:410
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
virtual RS::EntityType getType() const
Definition: RLeaderData.h:47
Leader entity class.
Definition: RLeaderEntity.h:38
int Id
Definition: RObject.h:57
void setArrowHead(bool on)
Definition: RLeaderEntity.h:94
bool hasArrowHead() const
Definition: RLeaderData.h:61
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false, bool segment=false) const
Definition: RLeaderData.h:103
int countSegments() const
Definition: RPolyline.cpp:858
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:131
bool arrowHead
Arrow head on / off.
Definition: RLeaderData.h:123
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
Definition: REntityData.cpp:527
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:1020
Copyright (c) 2011-2017 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:84
double dimaszOverride
Arrow size.
Definition: RLeaderData.h:125
virtual RVector getEndPoint() const
Definition: RPolyline.cpp:1028
QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RLeaderData.h:96
RVector getEndPoint() const
Definition: RLeaderData.h:72
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:572
virtual QList< RRefPoint > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
Definition: RS.h:132
#define RDEFAULT_MIN1
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RExplodable.h:30
virtual RShape * castToShape()
Definition: RLeaderData.h:50
RVector getStartPoint() const
Definition: RLeaderData.h:76
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolyline.cpp:819
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
double dimscaleOverride
Dimension scale.
Definition: RLeaderData.h:127
RPolyline()
Creates a polyline object without points.
Definition: RPolyline.cpp:33
void appendVertex(const RVector &vertex, double bulge=0.0, double w1=0.0, double w2=0.0)
Definition: RPolyline.cpp:246
RBlock::Id dimLeaderBlockId
Block to use instead of arrow.
Definition: RLeaderData.h:129
Leader.
Definition: RS.h:118
int countVertices() const
Definition: RLeaderData.h:80
RDocument * document
Definition: RObject.h:271