1 #ifndef bwm_tableau_cam_h_ 2 #define bwm_tableau_cam_h_ 3 //: 4 // \file 5 6 #include <iostream> 7 #include <string> 8 #include "bwm_observable.h" 9 #include "bwm_observer_cam.h" 10 #include "bwm_tableau_img.h" 11 12 #include <vgui/vgui_menu.h> 13 #include <vgui/vgui_event.h> 14 #include <vgui/vgui_command.h> 15 16 #include <bgui/bgui_picker_tableau.h> 17 18 #include <vsol/vsol_point_3d_sptr.h> 19 20 #ifdef _MSC_VER 21 # include <vcl_msvc_warnings.h> 22 #endif 23 24 25 class bwm_tableau_cam : public bwm_tableau_img 26 { 27 public: 28 typedef enum {RATIONAL=0, PROJECTIVE=1} BWM_CAMERA_TYPES; 29 30 //: destructor 31 // Tableaux are responsible for deleting their observers ~bwm_tableau_cam()32 virtual ~bwm_tableau_cam() { delete my_observer_; } 33 type_name()34 virtual std::string type_name() const { return "bwm_tableau_cam"; } 35 36 bool handle(const vgui_event& e); 37 set_observer(bwm_observer_cam * obs)38 void set_observer(bwm_observer_cam* obs) { my_observer_ = obs;} 39 observer()40 bwm_observer_cam* observer() const { return this->my_observer_; } 41 42 void get_popup(vgui_popup_params const ¶ms, vgui_menu &menu); 43 44 virtual void create_polygon_mesh(); 45 46 virtual void triangulate_mesh(); 47 48 // sets this tableau as the master for camera direction 49 void set_master(); 50 51 //: set the observer as per the image type 52 void set_eo(); 53 void set_other_mode(); 54 55 //: moves the object, by moving the selected vertex to the specified point on the tableau 56 void move_obj_by_vertex(); 57 58 //: extrudes the selected face, 59 void extrude_face(); 60 61 //: draws a line onto a given face, dividing into two faces 62 void divide_face(); 63 64 //: Draws the histogram on a graph (if the image is greyscale) 65 void hist_plot(); 66 67 void set_corr(double X, double Y); 68 69 void move_corr(); 70 71 void set_corr_to_vertex(); 72 73 void world_pt_corr(); 74 75 void load_mesh(); 76 77 void load_mesh_multiple(); 78 79 void scan_regions(); 80 81 void show_geo_position(); 82 83 void geo_position_vertex(); 84 85 void local_position_vertex(); 86 87 void scroll_to_point(double lx, double ly, double lz); 88 89 void create_terrain(); 90 91 void create_circular_polygon(); 92 93 void project_shadow(); 94 //------------ save methods 95 96 //: saves the observables with their save method specific to the object 97 void save(); 98 void save_all(); 99 void save(std::string path); 100 void save_all(std::string path); 101 102 //: deletes the selected object 103 void delete_object(); 104 105 //: deletes all 3D objects 106 void delete_all(); 107 108 //------------ Projection Plane related methods 109 110 //: selects an existing polygon as the projection plane 111 void select_proj_plane(); 112 113 //: defines a vertical projection plane passing through a specified line 114 void define_proj_plane(); 115 116 //: specify a x-y plane as the projection plane with a given z 117 void define_xy_proj_plane(); 118 119 //: specify a y-z plane as the projection plane with a given x 120 void define_yz_proj_plane(); 121 122 //: specify a x-z plane as the projection plane with a given x 123 void define_xz_proj_plane(); 124 125 //: add inner face to an existing face 126 void create_inner_face(); 127 128 void create_interior(); 129 void label_roof(); 130 void label_wall(); 131 void help_pop(); 132 set_draw_mode(int mode)133 void set_draw_mode(int mode) { my_observer_->set_draw_mode((bwm_observer::BWM_DRAW_MODE)mode); } set_mesh_mode()134 void set_mesh_mode() { my_observer_->set_mesh_mode(); } set_face_mode()135 void set_face_mode() { my_observer_->set_face_mode(); } set_edge_mode()136 void set_edge_mode() { my_observer_->set_edge_mode(); } set_vertex_mode()137 void set_vertex_mode() { my_observer_->set_vertex_mode(); } 138 #if 0 139 void create_boxm_scene() { my_observer_->create_boxm_scene(); } 140 void load_boxm_scene() { my_observer_->load_boxm_scene(); } 141 #endif 142 bool show_vertices_; 143 //================== camera calibration methods =============== set_horizon()144 void set_horizon() {my_observer_->set_horizon();} 145 void set_focal_length(); 146 void set_cam_height(); calibrate_cam_from_horizon()147 void calibrate_cam_from_horizon() 148 {my_observer_->calibrate_cam_from_horizon();} toggle_cam_horizon()149 void toggle_cam_horizon(){my_observer_->toggle_cam_horizon();} 150 std::vector<std::string> set_land_types(); 151 std::vector<std::string> set_orient_types(); 152 #if 0 153 void set_ground_plane(){ my_observer_->set_ground_plane();} 154 void set_sky(){ my_observer_->set_sky();} 155 void add_vertical_depth_region(); 156 #endif 157 void add_ground_plane(); 158 void add_sky(); 159 void add_region(); 160 void edit_region_props(); 161 void edit_region_weights(); 162 void save_depth_map_scene(); 163 protected: 164 bwm_observer_cam* my_observer_; bwm_tableau_cam(bwm_observer_cam * obs)165 bwm_tableau_cam(bwm_observer_cam* obs) 166 : bwm_tableau_img(obs), my_observer_(obs) {} 167 }; 168 169 #endif 170