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"
17 #include "network/server.h"
24 class Engineer: public Msp::Application
27 sigc::signal<void, R2C2::Track *, int> signal_pick_done;
32 Msp::Graphics::SimpleGLWindow window;
33 Msp::GLtk::Resources ui_res;
34 Msp::GLtk::Root *root;
36 R2C2::Catalogue catalogue;
38 R2C2::Layout3D layout_3d;
40 Msp::IO::EventDispatcher event_disp;
41 R2C2::Overlay3D *overlay;
42 std::map<R2C2::Train *, Msp::GL::Color> train_colors;
44 Msp::GL::Camera camera;
45 Msp::GL::Lighting lighting;
47 Msp::GL::Pipeline pipeline;
48 Msp::GL::Mesh arrow_mesh;
50 MainPanel *main_panel;
51 std::list<TrainPanel *> train_panels;
52 std::list<TrainView *> train_views;
53 Msp::Time::TimeStamp status_timeout;
55 R2C2::Track *picking_track;
57 R2C2::Path3D *picking_path;
63 Engineer(int argc, char **argv);
66 const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
67 Msp::GLtk::Root &get_root() const { return *root; }
68 const R2C2::Catalogue &get_catalogue() const { return catalogue; }
69 R2C2::Layout &get_layout() { return layout; }
70 R2C2::Layout3D &get_layout_3d() { return layout_3d; }
71 const Msp::GL::Lighting &get_lighting() const { return lighting; }
72 void set_status(const std::string &);
73 void rearrange_panels();
74 void add_train_view(TrainView &);
75 void remove_train_view(TrainView &);
78 void quit() { exit(0); }
81 void button_press(int, int, unsigned, unsigned);
82 void pointer_motion(int, int);
84 void set_block_color(const R2C2::Block &, const Msp::GL::Color &);
85 void reset_block_color(const R2C2::Block &);
86 void sensor_event(unsigned, bool);
87 void block_reserved(const R2C2::Block &, const R2C2::Train *);
88 R2C2::Track *pick_track(int, int);
89 void train_added(R2C2::Train &);
90 virtual void sighandler(int);
92 static Msp::Application::RegApp<Engineer> reg;