3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
11 #include <msp/core/application.h>
12 #include <msp/gbase/simplewindow.h>
13 #include <msp/gl/camera.h>
14 #include <msp/gl/light.h>
15 #include <msp/gl/lighting.h>
16 #include <msp/gl/pipeline.h>
17 #include <msp/gltk/resources.h>
18 #include <msp/gltk/root.h>
19 #include "libmarklin/catalogue.h"
20 #include "libmarklin/train.h"
21 #include "3d/layout.h"
22 #include "3d/overlay.h"
23 #include "network/server.h"
28 class TrainProperties;
30 class Engineer: public Msp::Application
35 Msp::Graphics::SimpleGLWindow window;
36 Msp::GLtk::Resources ui_res;
37 Msp::GLtk::Root *root;
39 Marklin::Catalogue catalogue;
40 Marklin::Layout layout;
41 Marklin::Layout3D layout_3d;
42 Marklin::Server *server;
43 Msp::IO::EventDispatcher event_disp;
44 Marklin::Overlay3D *overlay;
45 std::map<Marklin::Train *, Msp::GL::Color> train_colors;
47 Msp::GL::Camera camera;
48 Msp::GL::Lighting lighting;
50 Msp::GL::Pipeline pipeline;
51 Msp::GL::Mesh arrow_mesh;
53 MainPanel *main_panel;
54 std::list<TrainPanel *> train_panels;
55 Marklin::Train *placing_train;
56 Marklin::Block *placing_block;
57 unsigned placing_entry;
60 Engineer(int argc, char **argv);
63 const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
64 Msp::GLtk::Root &get_root() const { return *root; }
65 const Marklin::Catalogue &get_catalogue() const { return catalogue; }
66 Marklin::Layout &get_layout() { return layout; }
67 void place_train(Marklin::Train &);
69 void quit() { exit(0); }
72 void button_press(int, int, unsigned, unsigned);
73 void pointer_motion(int, int);
75 void set_block_color(const Marklin::Block &, const Msp::GL::Color &);
76 void reset_block_color(const Marklin::Block &);
77 void sensor_event(unsigned, bool);
78 void block_reserved(const Marklin::Block &, const Marklin::Train *);
79 Marklin::Track3D *pick_track(int, int);
80 void train_added(Marklin::Train &);
81 virtual void sighandler(int);
83 static Msp::Application::RegApp<Engineer> reg;