Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
grid.h
Go to the documentation of this file.
1 // This file is part of MARTY.
2 //
3 // MARTY is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // MARTY is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with MARTY. If not, see <https://www.gnu.org/licenses/>.
15 
23 #ifndef GRID_H
24 #define GRID_H
25 
26 #include <QGraphicsScene>
27 #include <QGraphicsItem>
28 #include <QList>
29 
30 class Grid
31 {
32 public:
33 
34  inline constexpr static qint32 defaultGridSize = 25;
35 
36  Grid(QGraphicsScene *t_scene = nullptr);
37 
38  ~Grid() { clear(); }
39 
40  qint32 getSize() const { return size; }
41 
42  void clear();
43 
44  void draw(
45  qint32 xmin,
46  qint32 ymin,
47  qint32 xmax,
48  qint32 ymax,
49  qint32 factor = 0);
50 
51  void show();
52  void hide();
53 
54  void setScene(QGraphicsScene *t_scene);
55 
56 private:
57 
58  bool isShown;
59  QGraphicsScene *scene;
60  QList<QGraphicsLineItem*> lines;
61 
62 public:
63 
64  qint32 size;
65  qint32 dl0;
66  QColor color;
67  qint32 width;
68 };
69 
70 #endif // GRID_H
Definition: grid.h:30
void draw(qint32 xmin, qint32 ymin, qint32 xmax, qint32 ymax, qint32 factor=0)
Definition: grid.cpp:43
Definition: amplitudeSimplification.h:38