1 //#define _CRTDBG_MAP_ALLOC
2
3 #include <bwm/bwm_tableau_mgr.h>
4 #include <bwm/bwm_process_mgr.h>
5 #include <bwm/bwm_menu.h>
6 #include <bwm/bwm_macros.h>
7 #include <bwm/bwm_load_commands.h>
8
9 #include "vgui/vgui.h"
10 #include "vgui/vgui_shell_tableau.h"
11 #include "vgui/vgui_window.h"
12 #include "vgui/vgui_adaptor.h"
13
14 #include "vgui/vgui_grid_tableau.h"
15 #include "vgui/vgui_composite_tableau.h"
16 #include "vgui/vgui_viewer2D_tableau.h"
17
18 #include "vsl/vsl_binary_io.h"
19 #include <vsol/vsol_polygon_2d.h>
20 #include <vsol/vsol_polygon_2d_sptr.h>
21 #include <vsol/vsol_digital_curve_2d.h>
22 #include <vsol/vsol_digital_curve_2d_sptr.h>
23 #include <vsol/vsol_polyline_2d_sptr.h>
24 #include <vsol/vsol_polyline_2d.h>
25 #include <vsol/vsol_point_2d.h>
26 #include <vsol/vsol_point_2d_sptr.h>
27
main(int argc,char ** argv)28 int main(int argc, char** argv)
29 {
30
31 vsl_add_to_binary_loader(vsol_polygon_2d());
32 vsl_add_to_binary_loader(vsol_polyline_2d());
33 vsl_add_to_binary_loader(vsol_point_2d());
34 vsl_add_to_binary_loader(vsol_digital_curve_2d());
35 // _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
36
37 // initialize vgui
38 // Ming: force option "--mfc-use-gl" to use gl
39 // so that it is MUCH faster if running on a
40 // computer with nice graphic card.
41 //vgui::init(argc, argv);
42 int my_argc = argc+1;
43 char** my_argv = new char*[argc+1];
44 for (int i=0; i<argc; i++)
45 my_argv[i] = argv[i];
46 my_argv[argc] = new char[13];
47 std::strcpy(my_argv[argc], "--mfc-use-gl");
48 vgui::init(my_argc, my_argv);
49 #if 0
50 delete[] my_argv[argc];
51 delete[] my_argv;
52 #endif
53 // tableau types registering
54 REG_TABLEAU(bwm_load_img_command);
55 REG_TABLEAU(bwm_load_rat_cam_command);
56 REG_TABLEAU(bwm_load_proj_cam_command);
57 REG_TABLEAU(bwm_load_generic_cam_command);
58 REG_TABLEAU(bwm_load_fiducial_command);
59 #if 0 //enable only if video processing is desired
60 REG_TABLEAU(bwm_load_video_command);
61 #endif
62 // correspondence processes
63 REG_PROCESS(bwm_corresp_process_command);
64
65 // image processes
66 REG_PROCESS(bwm_histogram_process_command);
67 REG_PROCESS(bwm_histogram_poly_process_command);
68 REG_PROCESS(bwm_intens_profile_process_command);
69 REG_PROCESS(bwm_range_map_process_command);
70 REG_PROCESS(bwm_step_edge_process_command);
71 REG_PROCESS(bwm_detect_lines_process_command);
72
73
74 // Set up the app_menu
75 vgui_menu main_menu;
76 bwm_menu app_menu;
77 vgui_menu menu_holder = app_menu.add_to_menu(main_menu);
78
79 bwm_tableau_mgr* mgr = bwm_tableau_mgr::instance();
80
81 // Put the grid into a shell tableau at the top the hierarchy
82 vgui_shell_tableau_new shell(mgr->grid());
83
84 // Create a window, add the tableau and show it on screen.
85 // int result = vgui::run(shell, 600, 600, menu_holder, "Brown World Modeler" );
86 vgui_window* win = vgui::produce_window(600, 600, menu_holder, "World Modeler");
87 win->get_adaptor()->set_tableau(shell);
88 win->set_statusbar(true);
89 std::string title = "BWM with toolkit : " + vgui::toolkit_name();
90 win->set_title(title);
91 win->show();
92 vgui::run();
93 delete bwm_tableau_mgr::instance();
94 }
95