QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 "RGrid.h"
26 
27 class RGraphicsView;
28 class RRuler;
29 
30 
31 
41 public:
43  virtual ~ROrthoGrid();
44 
45  virtual void clearCache();
46 
47  RVector snapToGrid(const RVector& positionUcs);
48  virtual void update(bool force=false);
49  virtual void paint();
50  virtual void paintMetaGrid();
51 
52  virtual void paintGridLines(const RVector& space, const RBox& box, bool meta);
53  virtual void paintGridPoints(const RVector& space, const RBox& box);
54 
55  virtual void paintCursor(const RVector& pos);
56 
57  virtual void paintRuler(RRuler& ruler);
58 
59  virtual QString getInfoText();
60 
61  QList<RVector> getIdealSpacing(int minPixelSpacing, const RVector& minSpacing, const RVector& minMetaSpacing);
62 
63  // This is just an idea. This might update the grid for
64  // an entity that is viewed as elevation view. This might be at
65  // any angle.
66  //void updateGrid(REntity& entity);
67 
68  bool isIsometric() const;
69  void setIsometric(bool on);
70 
71  RS::IsoProjectionType getProjection() const;
72  void setProjection(RS::IsoProjectionType p);
73 
74  static QList<RVector> getIdealGridSpacing(RGraphicsView& view, int minPixelSpacing, const RVector& minSpacing, const RVector& minMetaSpacing);
75  static bool isFractionalFormat(RS::LinearFormat linearFormat);
76 
77 private:
78  static double inchAutoscale(double value, double idealSpacing, RS::Unit unit);
79 
80 private:
84 
85  // current grid spacing:
87  // automatically calculated grid spacing based on minimum
88  // grid spacing and minimum pixel spacing:
90  // minimum spacing:
92 
96 
97  bool scaleGrid;
99  QString infoText;
100 
101  // cached:
102  mutable int isometric;
103  mutable int projection;
104 };
105 
107 
108 #endif