1 #ifndef bwm_tableau_mgr_h_ 2 #define bwm_tableau_mgr_h_ 3 //: 4 // \file 5 6 #ifdef _MSC_VER 7 #pragma once 8 #endif // _MSC_VER 9 10 #include <bwm/bwm_tableau_sptr.h> 11 #include <bwm/bwm_tableau_cam.h> 12 #include <bwm/bwm_command_sptr.h> 13 #include <bwm/bwm_corr_sptr.h> 14 #include <bwm/io/bwm_io_config_parser.h> 15 #include <bwm/process/bwm_site_process.h> 16 17 #include <vgui/vgui_grid_tableau.h> 18 #include <vgui/vgui.h> 19 #include <vgui/vgui_dialog.h> 20 #include <vgui/vgui_dialog_extensions.h> 21 22 class bwm_tableau_mgr 23 { 24 public: 25 26 ~bwm_tableau_mgr(); 27 28 static bwm_tableau_mgr* instance(); 29 30 void add_tableau(bwm_tableau_img* tab, std::string name); 31 grid()32 vgui_grid_tableau_sptr grid() { return grid_; } 33 34 static void register_tableau(bwm_command_sptr tab_comm); 35 36 static bool is_registered(std::string const& name); 37 38 bwm_command_sptr load_tableau_by_type(std::string tableau_type); 39 40 std::string save_camera(std::string tab_name); 41 42 void save_cameras(); 43 44 void remove_tableau(); 45 46 void exit(); 47 display_image_path(bool display)48 void display_image_path(bool display) {display_image_path_=display;} 49 50 void add_corresp(std::string tab_name, bwm_corr_sptr corr, double X, double Y); 51 52 static std::map<std::string, bwm_command_sptr> tab_types_; 53 redraw()54 void redraw() { grid_->post_redraw(); } 55 56 vgui_tableau_sptr active_tableau(); 57 58 void set_draw_mode_vertex(); 59 void set_draw_mode_edge(); 60 void set_draw_mode_face(); 61 void set_draw_mode_mesh(); 62 63 void zoom_to_fit(); 64 void scroll_to_point(); 65 66 private: 67 68 bwm_tableau_mgr(); 69 70 //: initialize the environment to load a new site 71 void init_env(); 72 73 static bwm_tableau_mgr* instance_; 74 75 //: Tableaux are mapped to their names 76 std::map<std::string, vgui_tableau_sptr> tableaus_; 77 78 vgui_grid_tableau_sptr grid_; 79 80 bool display_image_path_; 81 82 //: bool to keep the add rows and columns to the grid. 83 // It alternately adds rows and columns 84 bool row_added_; 85 86 void add_to_grid(vgui_tableau_sptr tab); 87 88 void add_to_grid(vgui_tableau_sptr tab, unsigned& col, unsigned& row); 89 90 vgui_tableau_sptr find_tableau(std::string name); 91 92 void set_observer_draw_mode(int mode); 93 }; 94 95 #endif 96