QCAD
Open Source 2D CAD
RSnapRestriction.h
Go to the documentation of this file.
1 
20 #ifndef RSNAPRESTRICTION_H
21 #define RSNAPRESTRICTION_H
22 
23 #include "core_global.h"
24 
25 #include "RVector.h"
26 
27 class RDocumentInterface;
28 
38 public:
39  RSnapRestriction(RDocumentInterface* documentInterface = NULL) :
40  documentInterface(documentInterface),
41  lastSnap(RVector::invalid) {}
42  virtual ~RSnapRestriction() {}
43 
48  virtual RVector restrictSnap(const RVector& position, const RVector& relativeZero) = 0;
49 
50  virtual void showUiOptions() {}
51  virtual void hideUiOptions() {}
52 
53  RVector getLastSnap() const {
54  return lastSnap;
55  }
56 
57  void reset() {
58  lastSnap = RVector::invalid;
59  }
60 
61 protected:
64 };
65 
67 
68 #endif
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RDocumentInterface * documentInterface
Definition: RSnapRestriction.h:62
RSnapRestriction(RDocumentInterface *documentInterface=NULL)
Definition: RSnapRestriction.h:39
Abstract base class for all snap restriction implementations.
Definition: RSnapRestriction.h:37
#define QCADCORE_EXPORT
Definition: core_global.h:10
RVector lastSnap
Definition: RSnapRestriction.h:63
RVector getLastSnap() const
Definition: RSnapRestriction.h:53
virtual ~RSnapRestriction()
Definition: RSnapRestriction.h:42
Q_DECLARE_METATYPE(RMath *)
void reset()
Definition: RSnapRestriction.h:57
virtual void showUiOptions()
Definition: RSnapRestriction.h:50
Interface for interaction between a graphics document and a user.
Definition: RDocumentInterface.h:82
virtual void hideUiOptions()
Definition: RSnapRestriction.h:51
static const RVector invalid
invalid vector
Definition: RVector.h:279