openPSTD  2.0
Open source simulation for sound propagation in urban environments
Model.h
1 // This file is part of openPSTD. //
3 // //
4 // openPSTD is free software: you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation, either version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // openPSTD is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with openPSTD. If not, see <http://www.gnu.org/licenses/>. //
16 // //
18 
20 //
21 // Date: 18-07-2015
22 //
23 //
24 // Authors: M. R. Fortuin
25 //
26 //
27 // Purpose:
28 //
29 //
31 
32 
33 #ifndef OPENPSTD_MODEL_H
34 #define OPENPSTD_MODEL_H
35 
36 namespace OpenPSTD
37 {
38  namespace GUI
39  {
40  class Model;
41 
42  enum SelectionType
43  {
44  SELECTION_NONE,
45  SELECTION_DOMAIN,
46  SELECTION_RECEIVER,
47  SELECTION_SPEAKER
48  };
49 
50  enum PstdObjectType
51  {
52  OBJECT_NONE,
53  OBJECT_DOMAIN,
54  OBJECT_RECEIVER,
55  OBJECT_SPEAKER
56  };
57  }
58 }
59 #include <memory>
60 #include <vector>
61 #include <QtGui/qmatrix4x4.h>
62 #include <kernel/KernelInterface.h>
63 #include <shared/PSTDFile.h>
64 #include "MouseHandlers.h"
65 #include <QVector2D>
66 #include <shared/Colors.h>
67 #include <shared/InvalidationData.h>
68 
69 namespace OpenPSTD
70 {
71  namespace GUI
72  {
73  class InteractiveModel : public Shared::InvalidationData
74  {
75  public:
76  struct
77  {
78  public:
79  bool visible;
80  QVector2D start;
81  QVector2D currentEnd;
82  } CreateDomain;
83 
84  struct
85  {
86  int SelectedIndex;
87  SelectionType Type;
88  } Selection;
89  };
90 
92  {
93  public:
94  bool SnapToGrid = true;
95  bool SnapToDomainEdges = true;
96  float SnapToDomainEdgesDistance = 0.4f;
97  };
98 
100  {
101  public:
102  float EdgeSize = 5.0f;
103  std::unique_ptr<Shared::BaseColorScheme> colorScheme;
104  };
105 
106  class Settings : public Shared::InvalidationData
107  {
108  public:
109  SnappingSettings snapping;
110  VisualSettings visual;
111  };
112 
113  class View : public Shared::InvalidationData
114  {
115  public:
116  QMatrix4x4 viewMatrix;
117  QMatrix4x4 worldMatrix;
118  QMatrix4x4 aspectMatrix;
119  };
120 
121  class Model : public Shared::InvalidationData
122  {
123  public:
124  Model();
125 
126  std::shared_ptr<Shared::PSTDFile> d;
127  std::shared_ptr<View> view;
128  std::unique_ptr<MouseStrategy> mouseHandler;
129  std::shared_ptr<InteractiveModel> interactive;
130  std::shared_ptr<Settings> settings;
131  };
132 
133  }
134 }
135 
136 #endif //OPENPSTD_MODEL_H
This is the general namespace of the OpenPSTD application.
Definition: Boundary.cpp:33
Definition: Model.h:91
Definition: Model.h:99
Definition: Model.h:106
Definition: Model.h:113
Definition: Model.h:73
Definition: Model.h:121