]> git.tdb.fi Git - r2c2.git/blob - source/engineer/engineer.h
30a3825893827539c8328487e91b76e15c8037eb
[r2c2.git] / source / engineer / engineer.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef ENGINEER_H_
9 #define ENGINEER_H_
10
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"
24 #include "options.h"
25
26 class MainPanel;
27 class TrainPanel;
28 class TrainProperties;
29
30 class Engineer: public Msp::Application
31 {
32 public:
33         sigc::signal<void, Marklin::Track *, int> signal_pick_done;
34
35 private:
36         Options options;
37
38         Msp::Graphics::SimpleGLWindow window;
39         Msp::GLtk::Resources ui_res;
40         Msp::GLtk::Root *root;
41
42         Marklin::Catalogue catalogue;
43         Marklin::Layout layout;
44         Marklin::Layout3D layout_3d;
45         Marklin::Server *server;
46         Msp::IO::EventDispatcher event_disp;
47         Marklin::Overlay3D *overlay;
48         std::map<Marklin::Train *, Msp::GL::Color> train_colors;
49
50         Msp::GL::Camera camera;
51         Msp::GL::Lighting lighting;
52         Msp::GL::Light light;
53         Msp::GL::Pipeline pipeline;
54         Msp::GL::Mesh arrow_mesh;
55
56         MainPanel *main_panel;
57         std::list<TrainPanel *> train_panels;
58         Msp::Time::TimeStamp status_timeout;
59         bool picking;
60         Marklin::Track *picking_track;
61         int picking_entry;
62         Marklin::Path3D *picking_path;
63
64 public:
65         Engineer(int argc, char **argv);
66         ~Engineer();
67
68         const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
69         Msp::GLtk::Root &get_root() const { return *root; }
70         const Marklin::Catalogue &get_catalogue() const { return catalogue; }
71         Marklin::Layout &get_layout() { return layout; }
72         void set_status(const std::string &);
73         void pick(bool);
74         int main();
75         void quit() { exit(0); }
76 private:
77         void tick();
78         void button_press(int, int, unsigned, unsigned);
79         void pointer_motion(int, int);
80         void view_all();
81         void set_block_color(const Marklin::Block &, const Msp::GL::Color &);
82         void reset_block_color(const Marklin::Block &);
83         void sensor_event(unsigned, bool);
84         void block_reserved(const Marklin::Block &, const Marklin::Train *);
85         Marklin::Track3D *pick_track(int, int);
86         void train_added(Marklin::Train &);
87         virtual void sighandler(int);
88
89         static Msp::Application::RegApp<Engineer> reg;
90 };
91
92 #endif