QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
ROrthoGrid.h
Go to the documentation of this file.
1
20#ifndef RORTHOGRID_H
21#define RORTHOGRID_H
22
23#include "grid_global.h"
24
25#include "RBox.h"
26#include "RGrid.h"
27
28class RGraphicsView;
29class RRuler;
30
31
32
42public:
44 virtual ~ROrthoGrid();
45
46 virtual void clearCache();
47
48 RVector snapToGrid(const RVector& positionUcs);
49 virtual void update(bool force=false);
50 virtual void paint();
51 virtual void paintMetaGrid();
52
53 virtual void paintGridLines(const RVector& space, const RBox& box, bool meta);
54 virtual void paintGridPoints(const RVector& space, const RBox& box);
55
56 virtual void paintCursor(const RVector& pos);
57
58 virtual void paintRuler(RRuler& ruler, qreal devicePixelRatio = 1.0);
59
60 virtual QString getInfoText();
61
62 QList<RVector> getIdealSpacing(int minPixelSpacing, const RVector& minSpacing, const RVector& minMetaSpacing);
63
64 // This is just an idea. This might update the grid for
65 // an entity that is viewed as elevation view. This might be at
66 // any angle.
67 //void updateGrid(REntity& entity);
68
69 virtual bool isIsometric() const;
70 void setIsometric(bool on);
71
73 void setProjection(RS::IsoProjectionType p);
74
75 static QList<RVector> getIdealGridSpacing(RGraphicsView& view, int minPixelSpacing, const RVector& minSpacing, const RVector& minMetaSpacing);
76 static bool isFractionalFormat(RS::LinearFormat linearFormat);
77
78private:
79 static double inchAutoscale(double value, double idealSpacing, RS::Unit unit);
80
81private:
85
86 // current grid spacing:
88 // automatically calculated grid spacing based on minimum
89 // grid spacing and minimum pixel spacing:
91 // minimum spacing:
93
97
99 QString infoText;
100
101 // cached:
102 mutable int isometric;
103 mutable int projection;
104};
105
107
108#endif
Q_DECLARE_METATYPE(RMath *)
Represents a box e.g.
Definition RBox.h:46
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...
virtual void clearCache()
Definition RGrid.cpp:31
virtual RVector snapToGrid(const RVector &positionUcs)=0
Snaps the given UCS position to the grid.
virtual QString getInfoText()=0
virtual void paint()=0
This is called by the graphics view this grid is attached to whenever the grid should be painted.
virtual RS::IsoProjectionType getProjection() const
Definition RGrid.h:81
virtual void paintRuler(RRuler &ruler, qreal devicePixelRatio=1.0)=0
Grid representation.
Definition ROrthoGrid.h:41
RVector autoSpacing
Definition ROrthoGrid.h:90
RVector minSpacing
Definition ROrthoGrid.h:92
int minPixelSpacing
Definition ROrthoGrid.h:98
RVector metaSpacing
Definition ROrthoGrid.h:94
RBox gridBox
Definition ROrthoGrid.h:83
int projection
Definition ROrthoGrid.h:103
RBox viewBox
Definition ROrthoGrid.h:82
RVector spacing
Definition ROrthoGrid.h:87
int isometric
Definition ROrthoGrid.h:102
RVector minMetaSpacing
Definition ROrthoGrid.h:96
RVector autoMetaSpacing
Definition ROrthoGrid.h:95
QString infoText
Definition ROrthoGrid.h:99
RBox metaGridBox
Definition ROrthoGrid.h:84
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
LinearFormat
Format for length values.
Definition RS.h:470
Unit
Enum of supported units (values correspond to DXF spec).
Definition RS.h:425
Represents a 3d vector (x/y/z).
Definition RVector.h:47
#define QCADGRID_EXPORT
Definition grid_global.h:10
void update()
Keeps the user interface up to date during long operations.
Definition simple.js:51