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