]> git.tdb.fi Git - r2c2.git/blob - source/engineer/engineer.h
Remove the now-unused async picking code from Engineer
[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/train.h"
14 #include "3d/layout.h"
15 #include "3d/overlay.h"
16 #include "3d/path.h"
17 #include "3d/view.h"
18 #include "network/server.h"
19 #include "options.h"
20
21 class MainWindow;
22 class TrainView;
23
24 class Engineer: public Msp::RegisteredApplication<Engineer>
25 {
26 private:
27         Options options;
28
29         Msp::Graphics::SimpleGLWindow window;
30         Msp::Input::Keyboard keyboard;
31         Msp::Input::Mouse mouse;
32         Msp::GLtk::Resources ui_res;
33         Msp::GLtk::Root *root;
34
35         R2C2::Catalogue catalogue;
36         R2C2::Layout layout;
37         R2C2::Layout3D layout_3d;
38         R2C2::Server *server;
39         Msp::IO::EventDispatcher event_disp;
40         R2C2::Overlay3D *overlay;
41         std::map<R2C2::Train *, Msp::GL::Color> train_colors;
42
43         R2C2::View3D main_view;
44
45         MainWindow *main_wnd;
46         std::list<R2C2::Train *> new_trains;
47         std::list<TrainView *> train_views;
48         Msp::Time::TimeStamp status_timeout;
49         R2C2::Vector pointer;
50
51 public:
52         Engineer(int argc, char **argv);
53         ~Engineer();
54
55         const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
56         Msp::GLtk::Root &get_root() const { return *root; }
57         const R2C2::Catalogue &get_catalogue() const { return catalogue; }
58         R2C2::Layout &get_layout() { return layout; }
59         R2C2::Layout3D &get_layout_3d() { return layout_3d; }
60         R2C2::View3D &get_main_view() { return main_view; }
61         void set_status(const std::string &);
62         void add_train_view(TrainView &);
63         void remove_train_view(TrainView &);
64         int main();
65         void quit() { exit(0); }
66 private:
67         void tick();
68         void button_press(unsigned);
69         void axis_motion(unsigned, float, float);
70         void view_all();
71         void sensor_event(unsigned, bool);
72         void block_reserved(const R2C2::Block &, const R2C2::Train *);
73         R2C2::Object *pick_object(const R2C2::Vector &);
74         void train_added(R2C2::Train &);
75         void process_new_train(R2C2::Train &);
76         virtual void sighandler(int);
77 };
78
79 #endif