QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RGrid.h
Go to the documentation of this file.
1 
20 #ifndef RGRID_H
21 #define RGRID_H
22 
23 #include "core_global.h"
24 
25 #include "RVector.h"
26 #include "RBox.h"
27 #include "RRuler.h"
28 
29 class RDocument;
30 class RGraphicsView;
31 
40 public:
41  RGrid(RGraphicsView& view) : view(view), visible(-1) {}
42  virtual ~RGrid() {}
43 
44  virtual void clearCache();
45 
49  virtual RVector snapToGrid(const RVector& positionUcs) = 0;
50 
56  virtual void update(bool force=false) = 0;
57 
62  virtual void paint() = 0;
63 
68  virtual void paintMetaGrid() = 0;
69 
70  virtual void paintCursor(const RVector& pos) = 0;
71 
72  virtual void paintRuler(RRuler& ruler) = 0;
73 
74  virtual QString getInfoText() = 0;
75 
76  int getViewportNumber() const;
77 
78  RDocument* getDocument() const;
79 
80  void setVisible(bool on);
81  bool isVisible() const;
82 
83 protected:
85 
86  // cached:
87  mutable int visible;
88 };
89 
91 
92 #endif