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<RVector> getReferencePoints(
88 
89  virtual bool moveReferencePoint(const RVector& referencePoint,
90  const RVector& targetPoint);
91 
92  virtual bool scale(const RVector& scaleFactors, const RVector& center);
93  virtual bool stretch(const RPolyline& area, const RVector& offset);
94 
95  QList<QSharedPointer<RShape> > getExploded() const {
96  return RPolyline::getExploded();
97  }
98 
99  virtual QList<QSharedPointer<RShape> > getShapes(const RBox& queryBox = RDEFAULT_RBOX, bool ignoreComplex = false) const {
100  Q_UNUSED(queryBox)
101 
102  QList<QSharedPointer<RShape> > ret;
103  ret << QSharedPointer<RShape>(new RPolyline(*this));
104  if (arrowHead) {
105  ret << QSharedPointer<RShape>(new RTriangle(getArrowShape()));
106  }
107  return ret;
108  }
109 
110  RTriangle getArrowShape() const;
111 
112 private:
114  bool arrowHead;
115 };
116 
120 Q_DECLARE_METATYPE(QSharedPointer<RLeaderData>)
121 
122 #endif
Represents a box e.g.
Definition: RBox.h:43
Base class for all entity data classes.
Definition: REntityData.h:64
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:312
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
QList< QSharedPointer< RShape > > getExploded() const
Definition: RLeaderData.h:95
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:504
ProjectionRenderingHint
Sets the current rendering hint for exports.
Definition: RS.h:118
bool arrowHead
Arrow head on / off.
Definition: RLeaderData.h:114
virtual bool scale(const RVector &scaleFactors, const RVector &center=RDEFAULT_RVECTOR)
Definition: REntityData.cpp:463
virtual RVector getStartPoint() const
Definition: RPolyline.cpp:634
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RLeaderData.h:37
virtual QList< RVector > getReferencePoints(RS::ProjectionRenderingHint hint=RS::RenderTop) const =0
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:63
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:642
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:502
Definition: RS.h:119
virtual RShape * castToShape()
Definition: RLeaderData.h:47
void appendVertex(const RVector &vertex, double bulge=0.0)
Definition: RPolyline.cpp:231
RVector getStartPoint() const
Definition: RLeaderData.h:70
virtual QList< QSharedPointer< RShape > > getExploded(int segments=RDEFAULT_MIN1) const
Definition: RPolyline.cpp:474
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
virtual QList< QSharedPointer< RShape > > getShapes(const RBox &queryBox=RDEFAULT_RBOX, bool ignoreComplex=false) const
Definition: RLeaderData.h:99
Interface for geometrical shape classes.
Definition: RShape.h:52
RPolyline()
Copyright (c) 2011-2015 by Andrew Mustun.
Definition: RPolyline.cpp:32
int countVertices() const
Definition: RLeaderData.h:74
RDocument * document
Definition: RObject.h:251