Virtual Testbed
Ship dynamics simulator for extreme conditions
TestbedDB.hh
1 #ifndef VTESTBED_GUI_TESTBEDDB_HH
2 #define VTESTBED_GUI_TESTBEDDB_HH
3 
4 #include <vtestbed/db/compartments.hh>
5 #include <vtestbed/db/hull.hh>
6 #include <vtestbed/db/marine_object_database.hh>
7 #include <vtestbed/db/ship.hh>
8 #include <vtestbed/graphics/ShipHullObject.hh>
9 #include <vtestbed/gui/ApplicationBase.hh>
10 #include <vtestbed/gui/DatabaseWindow.hh>
11 #include <vtestbed/gui/InputNumber.hh>
12 #include <vtestbed/gui/types.hh>
13 
14 namespace vtb {
15 
16  namespace gui {
17 
18  template <class T>
19  class TestbedDB: public ApplicationBase {
20 
21  private:
26  using Transformations = vtb::db::Transformations;
28  using database_t = sqlite::connection;
29  using vec3 = vtb::core::Vector3<T>;
31  using action_type = typename dbwindow_type::Action;
32  using int3 = typename compartments_type::int3;
33 
34  private:
36  ship_type _ship;
37  DrawableGroup3D _drawables;
38  modatabase_t _modatabase;
39  database_t _db;
40  int _dimension = 0;
41  int _transformationIndex = 0;
42  T _scale{1};
43  bool show_window_saved = false;
44  float _time_saved;
45  dbwindow_type _dbwindow;
46  InputNumber<T> _inputDraught;
47  int3 _nrooms{6,3,3};
48  T _hullMass{};
49 
50  public:
51 
52  explicit
53  TestbedDB(const Arguments& args, const Configuration& conf);
54 
55  void drawEvent() override;
56 
57  void openShipHull();
58  void openCompartments();
59  void openShip();
60  void updateShipHull();
61  void clearShipHull();
62  void transformHull(Transformations trans);
63  void undoHull();
64  void redoHull();
65 
66  inline database_t* db() { return &this->_db; }
67  inline ship_type& ship() { return this->_ship; }
68  inline compartments_type& compartments() { return this->_ship.compartments(); }
69  inline hull_type& hull() { return this->_ship.hull(); }
70 
71  };
72 
73  }
74 
75 }
76 
77 #endif // vim:filetype=cpp
Main namespace.
Definition: convert.hh:9