]> git.tdb.fi Git - r2c2.git/blob - source/engineer/engineer.h
Include block in the emergency signal
[r2c2.git] / source / engineer / engineer.h
1 #ifndef ENGINEER_H_
2 #define ENGINEER_H_
3
4 #include <msp/core/application.h>
5 #include <msp/graphics/simplewindow.h>
6 #include <msp/gl/camera.h>
7 #include <msp/gl/light.h>
8 #include <msp/gl/lighting.h>
9 #include <msp/gl/pipeline.h>
10 #include <msp/gltk/resources.h>
11 #include <msp/gltk/root.h>
12 #include "libr2c2/catalogue.h"
13 #include "libr2c2/driver.h"
14 #include "libr2c2/train.h"
15 #include "3d/layout.h"
16 #include "3d/overlay.h"
17 #include "3d/path.h"
18 #include "3d/view.h"
19 #include "network/server.h"
20 #include "options.h"
21
22 class MainWindow;
23 class TrainView;
24
25 class Engineer: public Msp::RegisteredApplication<Engineer>
26 {
27 private:
28         Options options;
29
30         Msp::Graphics::SimpleGLWindow window;
31         Msp::Input::Keyboard keyboard;
32         Msp::Input::Mouse mouse;
33         Msp::GLtk::Resources ui_res;
34         Msp::GLtk::Root *root;
35         Msp::GLtk::Arrangement *root_arrangement;
36         bool import_active;
37
38         R2C2::Catalogue catalogue;
39         R2C2::Layout layout;
40         R2C2::Layout3D layout_3d;
41         R2C2::Server *server;
42         Msp::IO::EventDispatcher event_disp;
43         R2C2::Overlay3D *overlay;
44         std::map<R2C2::Train *, Msp::GL::Color> train_colors;
45
46         R2C2::View3D main_view;
47
48         MainWindow *main_wnd;
49         std::list<R2C2::Train *> new_trains;
50         std::list<TrainView *> train_views;
51         Msp::Time::TimeStamp status_timeout;
52         R2C2::Vector pointer;
53
54 public:
55         Engineer(int argc, char **argv);
56         ~Engineer();
57
58         const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
59         Msp::GLtk::Root &get_root() const { return *root; }
60         const R2C2::Catalogue &get_catalogue() const { return catalogue; }
61         R2C2::Layout &get_layout() { return layout; }
62         R2C2::Layout3D &get_layout_3d() { return layout_3d; }
63         R2C2::View3D &get_main_view() { return main_view; }
64         void set_status(const std::string &);
65         void add_train_view(TrainView &);
66         void remove_train_view(TrainView &);
67         int main();
68         void quit() { exit(0); }
69 private:
70         void tick();
71         void button_press(unsigned);
72         void axis_motion(unsigned, float, float);
73         void view_all();
74         R2C2::Object *pick_object(const R2C2::Vector &);
75         void emergency(R2C2::Block *, const std::string &);
76         void locomotive_detected(const R2C2::Driver::DetectedLocomotive &);
77         void import_finished(int);
78         void train_added(R2C2::Train &);
79         void process_new_train(R2C2::Train &);
80         virtual void sighandler(int);
81 };
82
83 #endif