QCAD
Open Source 2D CAD
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, qreal devicePixelRatio = 1.0) = 0;
73 
74  virtual QString getInfoText() = 0;
75 
76  virtual bool isIsometric() const {
77  return false;
78  }
80  return RS::NoProjection;
81  }
82 
83  int getViewportNumber() const;
84 
85  RDocument* getDocument() const;
86 
87  void setVisible(bool on);
88  bool isVisible() const;
89 
90 protected:
92 
93  // cached:
94  mutable int visible;
95 };
96 
98 
99 #endif
RGrid::snapToGrid
virtual RVector snapToGrid(const RVector &positionUcs)=0
Snaps the given UCS position to the grid.
RGrid::paintCursor
virtual void paintCursor(const RVector &pos)=0
getDocument
void getDocument()
Returns the current RDocument or undefined.
Definition: simple.js:59
RBox.h
RGrid::paint
virtual void paint()=0
This is called by the graphics view this grid is attached to whenever the grid should be painted.
RVector
Represents a 3d vector (x/y/z).
Definition: RVector.h:46
RGrid::getProjection
virtual RS::IsoProjectionType getProjection() const
Definition: RGrid.h:79
RGrid::update
virtual void update(bool force=false)=0
This is called by the graphics view this grid is attached to whenever the view port changes and the g...
RGrid::isIsometric
virtual bool isIsometric() const
Definition: RGrid.h:76
RGrid::view
RGraphicsView & view
Definition: RGrid.h:91
RGraphicsView
Graphics view.
Definition: RGraphicsView.h:58
RVector.h
RGrid::~RGrid
virtual ~RGrid()
Definition: RGrid.h:42
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(RMath *)
RRuler
Abstract base class for widgets that display a ruler, usually shown at the top and left of a graphics...
Definition: RRuler.h:37
RGrid::RGrid
RGrid(RGraphicsView &view)
Definition: RGrid.h:41
RGrid::paintMetaGrid
virtual void paintMetaGrid()=0
This is called by the graphics view this grid is attached to whenever the meta grid should be painted...
core_global.h
RGrid::paintRuler
virtual void paintRuler(RRuler &ruler, qreal devicePixelRatio=1.0)=0
RDocument
A graphics document contains and owns entities, layers, user coordinate systems, variables,...
Definition: RDocument.h:72
RGrid
Abstract base class for grid implementations.
Definition: RGrid.h:39
RGrid::getInfoText
virtual QString getInfoText()=0
RS::NoProjection
@ NoProjection
No projection (2d x/y)
Definition: RS.h:274
RS::IsoProjectionType
IsoProjectionType
Projection type for isometric projections.
Definition: RS.h:273
RGrid::visible
int visible
Definition: RGrid.h:94
RRuler.h
QCADCORE_EXPORT
#define QCADCORE_EXPORT
Definition: core_global.h:10