1 #ifndef bwm_site_mgr_h_
2 #define bwm_site_mgr_h_
3 //:
4 // \file
5 #include <iostream>
6 #include <map>
7 #include <string>
8 #include <vector>
9 #include <bwm/bwm_tableau_factory.h>
10 #include <bwm/io/bwm_io_config_parser.h>
11 #include <bwm/process/bwm_site_process.h>
12 
13 #include <vgui/vgui_dialog.h>
14 #include <vgui/vgui_dialog_extensions.h>
15 
16 #include <vul/vul_timer.h>
17 #ifdef _MSC_VER
18 #  include <vcl_msvc_warnings.h>
19 #endif
20 
21 class bwm_site_mgr
22 {
23  public:
24   typedef enum {MESH_FEATURE, MESH_IMAGE_PROCESSING, MESH_TERRAIN, VSOL, OBJ_UNDEF} BWM_OBJECT_TYPES;
25 
26   static bwm_site_mgr* instance();
27 
28   virtual ~bwm_site_mgr();
29   //: a site consists of multiple tableaux
30   // also defines specific paths to data such as images and cameras
31   void init_site();
32   void create_site();
33   void edit_site();
34   void load_site();
35   void save_site();
36   void load_video_site();
37   void save_video_site();
38   //: load various types of tablaux and their data
39   void load_img_tableau();
40   void load_cam_tableau();
41   void load_video_tableau();
42   void load_fiducial_tableau();
43   void save_video_world_points_vrml();
44   void save_video_cameras_vrml();
45   void save_video_cams_and_world_pts_vrml();
46   //: compute 3-d parameters, site bounding box and GSD
47   void compute_3d_world_params();
48   //:site info
site_name()49   std::string site_name() { return site_name_;}
site_dir()50   std::string site_dir() { return site_dir_;}
51   //: depth map scene io
52   void load_depth_map_scene();
53   void save_depth_map_scene();
54 
55   //: config parser parses an XML file for the site/tableau configurations
56   // if path is null then a dialog asks for the path
57   bwm_io_config_parser* site_parser(std::string const& path = "");//user has to delete
58 
59  private:
60   bwm_site_mgr();
61   static bwm_site_mgr* instance_;
62   std::string tk_name_;
63   std::vector<bwm_io_tab_config*> inactive_tableaus_;
64   std::vector<bwm_io_tab_config*> active_tableaus_;
65 
66   bwm_tableau_factory tableau_factory_;
67 
68   //: object files are mapped to the file paths
69   std::map<std::string, std::vector<std::string> > site_objs_;
70   std::vector<std::string> object_types_;
71 #ifdef HAS_MFC
72 #if HAS_MFC
73   bwm_site_process* site_create_process_;
74 #endif
75 #endif
76   std::string site_name_, site_dir_, pyr_exe_ ;
77   std::string camera_path_, video_path_;
78   vul_timer timer_;
79 
80   double xmin_;   double ymin_;   double zmin_;  double res_;
81   double xmax_;   double ymax_;   double zmax_;  bool defaultparam_;
82 
83 
84   void create_site_dialog(vgui_dialog_extensions &site_dialog,
85                           std::string &site_name,
86                           std::string &site_dir,
87                           std::string &pyr_exe_dir,
88                           std::vector<std::string> &files,
89                           bool* pyr_v, bool* act_v,
90                           std::vector<std::string> &pyr_levels,
91                           std::vector<std::string> &objs,
92                           int *choices,
93                           double &lat, double &lon, double &elev);
94 
95   bwm_io_config_parser* parse_config(std::string const& path = "");
96 };
97 #endif // bwm_site_mgr_h_
98