Go to the documentation of this file.00001
00002 #ifndef bgui_picker_tableau_h_
00003 #define bgui_picker_tableau_h_
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <vgui/vgui_tableau.h>
00026 #include <vgui/vgui_event.h>
00027 #include <vgui/vgui_event_condition.h>
00028 #include <vgui/vgui_parent_child_link.h>
00029 #include <vsol/vsol_point_2d_sptr.h>
00030 #include <vsol/vsol_polygon_2d_sptr.h>
00031 #include <vsol/vsol_polyline_2d_sptr.h>
00032 #include "bgui_picker_tableau_sptr.h"
00033
00034 class bgui_picker_tableau : public vgui_tableau
00035 {
00036 public:
00037
00038
00039 bgui_picker_tableau(vgui_tableau_sptr const&);
00040
00041 ~bgui_picker_tableau();
00042 vcl_string type_name() const { return "bgui_picker_tableau";}
00043
00044
00045 bool pick_point(float* x, float* y);
00046
00047
00048 void pick_line(float* x1, float* y1, float* x2, float* y2);
00049
00050
00051 void pick_box(float* x1, float* y1, float *x2, float* y2);
00052
00053
00054
00055
00056 void anchored_pick_point(const float anch_x,
00057 const float anch_y,
00058 float* x, float* y);
00059
00060
00061 void pick_polygon(vsol_polygon_2d_sptr& poly);
00062
00063
00064 void pick_polyline(vsol_polyline_2d_sptr& poly);
00065
00066 bool pick_point_set(vcl_vector< vsol_point_2d_sptr >& ps_list, unsigned max);
00067
00068
00069 void set_color(const float red=1.0f, const float green=1.0f,
00070 const float blue=1.0f) {r = red; g = green; b = blue;}
00071 void set_line_width(const float width=2.0f){w = width;}
00072
00073
00074 bool handle(const vgui_event&);
00075
00076 protected:
00077 vgui_parent_child_link child_tab;
00078
00079 private:
00080
00081 void draw_line();
00082 void draw_anchor_line();
00083
00084
00085 void draw_box();
00086
00087
00088 bool next();
00089
00090 enum object_type {none_enum, point_enum, line_enum, anchor_enum, box_enum,
00091 poly_enum, point_set_enum, polyline_enum};
00092
00093
00094 static object_type obj_type;
00095
00096
00097 bool use_event_;
00098
00099
00100 float pointx1, pointy1, pointx2, pointy2;
00101
00102
00103 float anchor_x, anchor_y;
00104
00105
00106 bool active;
00107 vgui_event_condition gesture0;
00108 vgui_event_condition gesture1;
00109 vgui_event_condition gesture2;
00110
00111 vcl_vector< vsol_point_2d_sptr > point_list;
00112
00113
00114 vcl_vector< vsol_point_2d_sptr > point_set_list;
00115
00116 float last_x;
00117 float last_y;
00118
00119
00120 float r, g, b, w;
00121
00122 bool FIRSTPOINT;
00123
00124 float pointx, pointy;
00125
00126 bool point_ret;
00127
00128
00129 bool picking_completed;
00130
00131 };
00132
00133
00134
00135 struct bgui_picker_tableau_new : public bgui_picker_tableau_sptr
00136 {
00137 typedef bgui_picker_tableau_sptr base;
00138 bgui_picker_tableau_new(vgui_tableau_sptr const& arg1000) : base(new bgui_picker_tableau(arg1000)) {}
00139 };
00140
00141
00142 #endif // DO NOT ADD CODE AFTER THIS LINE! END OF DEFINITION FOR CLASS bgui_picker_tableau.