]> git.tdb.fi Git - r2c2.git/blob - source/designer/designer.h
Strip Id tags and copyright notices from files
[r2c2.git] / source / designer / designer.h
1 #ifndef DESIGNER_H_
2 #define DESIGNER_H_
3
4 #include <string>
5 #include <msp/core/application.h>
6 #include <msp/gbase/simplewindow.h>
7 #include <msp/gl/camera.h>
8 #include <msp/gl/font.h>
9 #include <msp/gl/light.h>
10 #include <msp/gl/lighting.h>
11 #include <msp/gl/object.h>
12 #include <msp/gl/pipeline.h>
13 #include <msp/gltk/label.h>
14 #include <msp/gltk/resources.h>
15 #include <msp/gltk/root.h>
16 #include <msp/time/timestamp.h>
17 #include "libr2c2/catalogue.h"
18 #include "libr2c2/layout.h"
19 #include "3d/layout.h"
20 #include "3d/overlay.h"
21 #include "3d/track.h"
22 #include "3d/view.h"
23 #include "cameracontroller.h"
24 #include "manipulator.h"
25 #include "measure.h"
26 #include "selection.h"
27 #include "trackwrap.h"
28
29 class Toolbar;
30
31 class Designer: public Msp::Application
32 {
33 private:
34         enum Mode
35         {
36                 SELECT,
37                 CATALOGUE,
38                 MANIPULATE,
39                 MANIPULATE_DONE,
40                 MEASURE
41         };
42
43         Msp::Graphics::SimpleGLWindow window;
44         Msp::GLtk::Resources ui_res;
45         Msp::GLtk::Root root;
46
47         std::vector<Toolbar *> toolbars;
48         Msp::GLtk::Label *lbl_status;
49
50         R2C2::Catalogue catalogue;
51         R2C2::Layout3D *cat_layout_3d;
52         R2C2::View3D *cat_view;
53
54         std::string filename;
55         R2C2::Layout *layout;
56         R2C2::Layout3D *layout_3d;
57         R2C2::View3D *main_view;
58         R2C2::Overlay3D *overlay;
59         Msp::GL::Object *base_object;
60         R2C2::Route *cur_route;
61         R2C2::Zone *cur_zone;
62         std::list<R2C2::Track *> new_tracks;
63
64         Mode mode;
65         Selection selection;
66         Manipulator manipulator;
67         Measure measure;
68         CameraController *camera_ctl;
69         TrackWrap *track_wrap;
70
71         Msp::Time::TimeStamp last_tick;
72
73         static Msp::Application::RegApp<Designer> reg;
74
75 public:
76         Designer(int, char **);
77         ~Designer();
78
79         int main();
80         void save();
81         void quit();
82
83         const R2C2::Catalogue &get_catalogue() const { return catalogue; }
84         R2C2::Layout &get_layout() { return *layout; }
85         R2C2::Layout3D &get_layout_3d() { return *layout_3d; }
86         const CameraController &get_camera_controller() const { return *camera_ctl; }
87         const Msp::GLtk::Resources &get_ui_resources() const { return ui_res; }
88         Msp::GLtk::Root &get_root() { return root; }
89
90         void new_track();
91         void erase_tracks();
92         void track_properties();
93         void extend_track();
94         void connect_tracks();
95         void flatten_tracks();
96         void svg_export();
97
98         void edit_route(R2C2::Route *);
99         void rename_route();
100         R2C2::Route *get_current_route() const { return cur_route; }
101         void add_selection_to_route();
102
103         void edit_zone(R2C2::Zone *);
104         void zone_properties();
105         R2C2::Zone *get_current_zone() const { return cur_zone; }
106         void add_selection_to_zone();
107
108         R2C2::Vector map_pointer_to_ground(int, int);
109 private:
110         void tick();
111         void key_press(unsigned, unsigned, wchar_t);
112         void button_press(int, int, unsigned, unsigned);
113         void pointer_motion(int, int);
114         void apply_camera();
115         void render();
116         void track_added(R2C2::Track &);
117         void track_removed(R2C2::Track &);
118         R2C2::Track *pick_track(int, int);
119         void update_track_icon(R2C2::Track3D &);
120         void selection_changed();
121         void manipulation_status(const std::string &);
122         void manipulation_done(bool);
123         void measure_changed();
124         void measure_done();
125         void arrange_toolbars();
126         void track_properties_response(int);
127         void route_name_accept(const std::string &);
128         void svg_export_accept(const std::string &);
129         std::string tooltip(int, int);
130         void clear_paths();
131         void show_route(const R2C2::Route &);
132         void show_zone(const R2C2::Zone &);
133 };
134
135 #endif