QCAD
Open Source 2D CAD
RDimLinearData.h
Go to the documentation of this file.
1 
20 #ifndef RDIMLINEARDATA_H
21 #define RDIMLINEARDATA_H
22 
23 #include "entity_global.h"
24 
25 #include "RDocument.h"
26 #include "RDimensionData.h"
27 #include "RVector.h"
28 
37  friend class RDimLinearEntity;
38 
39 protected:
41 
42 public:
44  RDimLinearData(const RDimensionData& dimData,
45  const RVector& extensionPoint1,
46  const RVector& extensionPoint2);
47 
48  virtual RS::EntityType getType() const {
49  return RS::EntityDimLinear;
50  }
51  virtual bool isValid() const;
52  virtual bool isSane() const;
53 
54  virtual void setDefinitionPoint(const RVector& p) {
55  definitionPoint = p;
56  recomputeDefinitionPoint(extensionPoint1, extensionPoint2, extensionPoint1, extensionPoint2);
57  update();
58  }
59 
60  void setExtensionPoint1(const RVector& p) {
61  extensionPoint1 = p;
62  }
63 
65  return extensionPoint1;
66  }
67 
68  void setExtensionPoint2(const RVector& p) {
69  extensionPoint2 = p;
70  }
71 
73  return extensionPoint2;
74  }
75 
77  const RVector& oldExtPoint1, const RVector& oldExtPoint2,
78  const RVector& newExtPoint1, const RVector& newExtPoint2) {
79  Q_UNUSED(oldExtPoint1)
80  Q_UNUSED(oldExtPoint2)
81  Q_UNUSED(newExtPoint1)
82  Q_UNUSED(newExtPoint2)
83  }
84 
85 // virtual void recomputeDefinitionPoint(const RVector& oldDimLineGrip, const RVector& newDimLineGrip) {
86 // Q_UNUSED(oldDimLineGrip)
87 // Q_UNUSED(newDimLineGrip)
88 // }
89 
90  virtual bool moveReferencePoint(const RVector& referencePoint,
91  const RVector& targetPoint);
92 
93  virtual bool move(const RVector& offset);
94  virtual bool rotate(double rotation, const RVector& center);
95  virtual bool scale(const RVector& scaleFactors, const RVector& center);
96  virtual bool mirror(const RLine& axis);
97  virtual bool stretch(const RPolyline& area, const RVector& offset);
98 
99  virtual void updateTextData() const;
100 
101 protected:
106 };
107 
110 Q_DECLARE_METATYPE(QSharedPointer<RDimLinearData>)
111 
112 #endif
virtual bool isValid() const
Definition: RDimensionData.cpp:111
virtual bool scale(const RVector &scaleFactors, const RVector &center)
Definition: RDimensionData.cpp:247
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
virtual RS::EntityType getType() const
Definition: RDimLinearData.h:48
RVector extensionPoint1
Definition point.
Definition: RDimLinearData.h:103
RVector getExtensionPoint1() const
Definition: RDimLinearData.h:64
EntityType
Entity types used for property handling / filtering.
Definition: RS.h:125
#define QCADENTITY_EXPORT
Definition: entity_global.h:10
virtual bool move(const RVector &offset)
Moves this entity by the given offset.
Definition: RDimensionData.cpp:226
virtual bool moveReferencePoint(const RVector &referencePoint, const RVector &targetPoint)
Moves the given reference point to the given target point or does nothing if this entity has no refer...
Definition: RDimensionData.cpp:198
virtual void setDefinitionPoint(const RVector &p)
Definition: RDimLinearData.h:54
RVector getExtensionPoint2() const
Definition: RDimLinearData.h:72
virtual bool rotate(double rotation, const RVector &center)
Definition: RDimensionData.cpp:236
virtual void update() const
Entities can reimplement this function to invalidate any internal cache (mark the entity as dirty)...
Definition: RDimensionData.cpp:565
virtual bool isSane() const
Definition: RDimensionData.cpp:115
Linear dimension entity base class.
Definition: RDimLinearEntity.h:38
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
Q_DECLARE_METATYPE(RMath *)
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RDimensionData.h:38
virtual void updateTextData() const
Definition: RDimensionData.cpp:656
virtual void recomputeDefinitionPoint(const RVector &oldExtPoint1, const RVector &oldExtPoint2, const RVector &newExtPoint1, const RVector &newExtPoint2)
Definition: RDimLinearData.h:76
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:607
void setExtensionPoint1(const RVector &p)
Definition: RDimLinearData.h:60
virtual bool mirror(const RLine &axis)
Definition: RDimensionData.cpp:270
Low-level mathematical representation of a line.
Definition: RLine.h:41
Copyright (c) 2011-2018 by Andrew Mustun.
Definition: RDimLinearData.h:36
Any linear dimension.
Definition: RS.h:158
void setExtensionPoint2(const RVector &p)
Definition: RDimLinearData.h:68
RVector extensionPoint2
Definition point.
Definition: RDimLinearData.h:105
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
RDocument * document
Definition: RObject.h:306