]> git.tdb.fi Git - r2c2.git/blob - source/engineer/engineer.h
Make use of View3D in 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 public:
27         sigc::signal<void, R2C2::Track *, int> signal_pick_done;
28
29 private:
30         Options options;
31
32         Msp::Graphics::SimpleGLWindow window;
33         Msp::Input::Keyboard keyboard;
34         Msp::Input::Mouse mouse;
35         Msp::GLtk::Resources ui_res;
36         Msp::GLtk::Root *root;
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         Msp::GL::Mesh arrow_mesh;
48
49         MainWindow *main_wnd;
50         std::list<R2C2::Train *> new_trains;
51         std::list<TrainView *> train_views;
52         Msp::Time::TimeStamp status_timeout;
53         bool picking;
54         R2C2::Track *picking_track;
55         int picking_entry;
56         R2C2::Path3D *picking_path;
57         R2C2::Vector pointer;
58         bool pointer_moved;
59
60 public:
61         Engineer(int argc, char **argv);
62         ~Engineer();
63
64         const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
65         Msp::GLtk::Root &get_root() const { return *root; }
66         const R2C2::Catalogue &get_catalogue() const { return catalogue; }
67         R2C2::Layout &get_layout() { return layout; }
68         R2C2::Layout3D &get_layout_3d() { return layout_3d; }
69         R2C2::View3D &get_main_view() { return main_view; }
70         void set_status(const std::string &);
71         void add_train_view(TrainView &);
72         void remove_train_view(TrainView &);
73         void pick(bool);
74         int main();
75         void quit() { exit(0); }
76 private:
77         void tick();
78         void button_press(unsigned);
79         void axis_motion(unsigned, float, float);
80         void view_all();
81         void sensor_event(unsigned, bool);
82         void block_reserved(const R2C2::Block &, const R2C2::Train *);
83         R2C2::Object *pick_object(const R2C2::Vector &);
84         void train_added(R2C2::Train &);
85         void process_new_train(R2C2::Train &);
86         virtual void sighandler(int);
87 };
88
89 #endif