contrib/brl/bbas/bgui/bgui_vsol2D_tableau.h
Go to the documentation of this file.
00001 // This is brl/bbas/bgui/bgui_vsol2D_tableau.h
00002 #ifndef bgui_vsol2D_tableau_h_
00003 #define bgui_vsol2D_tableau_h_
00004 //-----------------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief A child tableau of vgui_easy2D_tableau that knows how to display vsol objects.
00008 // \author
00009 //   Amir Tamrakar
00010 //
00011 //   Default styles are defined for each geometry object soview.
00012 //   Users can change the default style by using the set_*_style commands,
00013 //
00014 // \verbatim
00015 //  Modifications:
00016 //   Amir Tamrakar April 22, 2002    Initial version: Separated from vtol_tableau_2d
00017 //   Mark Johnson June 13, 2003      Stopped using interior class functions to
00018 //                                   highlight objects. Added support for
00019 //                                   specifying colors of individual objects.
00020 //   Mark Johnson June 20, 2003      Added support for 'linked' digital curve.
00021 //   Matt Leotta  April 3, 2004      Cleaned up the interface and add switched to
00022 //                                   vgui_style_sptr instead of vgui_style_factory
00023 //   Nhon Trinh   Sep 20, 2005       Added support for elliptical curve segment.
00024 // \endverbatim
00025 //-----------------------------------------------------------------------------
00026 #include <vcl_vector.h>
00027 
00028 #include <vsol/vsol_spatial_object_2d_sptr.h>
00029 #include <vsol/vsol_point_2d_sptr.h>
00030 #include <vsol/vsol_line_2d_sptr.h>
00031 #include <vsol/vsol_conic_2d_sptr.h>
00032 #include <vsol/vsol_polygon_2d_sptr.h>
00033 #include <vsol/vsol_polyline_2d_sptr.h>
00034 #include <vsol/vsol_poly_set_2d_sptr.h>
00035 #include <vsol/vsol_digital_curve_2d_sptr.h>
00036 
00037 #include <vdgl/vdgl_digital_curve_sptr.h>
00038 
00039 #include <vgui/vgui_tableau_sptr.h>
00040 #include <vgui/vgui_image_tableau_sptr.h>
00041 #include <vgui/vgui_easy2D_tableau.h>
00042 #include <vgui/vgui_style_sptr.h>
00043 
00044 #include "bgui_vsol2D_tableau_sptr.h"
00045 
00046 class bgui_vsol_soview2D_point;
00047 class bgui_vsol_soview2D_line_seg;
00048 class bgui_vsol_soview2D_conic_seg;
00049 class bgui_vsol_soview2D_polyline;
00050 class bgui_vsol_soview2D_polygon;
00051 class bgui_vsol_soview2D_polygon_set;
00052 class bgui_vsol_soview2D_digital_curve;
00053 class bgui_vsol_soview2D_edgel_curve;
00054 
00055 class bgui_vsol2D_tableau : public vgui_easy2D_tableau
00056 {
00057  public:
00058   bgui_vsol2D_tableau(const char* n="unnamed");
00059 
00060   bgui_vsol2D_tableau(vgui_image_tableau_sptr const& it,
00061                              const char* n="unnamed");
00062 
00063   bgui_vsol2D_tableau(vgui_tableau_sptr const& t,
00064                              const char* n="unnamed");
00065 
00066   ~bgui_vsol2D_tableau();
00067 
00068   //: Returns the type of this tableau ('bgui_vsol2D_tableau').
00069   vcl_string type_name() const { return "bgui_vsol2D_tableau";}
00070 
00071   //: display for vsol_point_2d
00072   bgui_vsol_soview2D_point*
00073     add_vsol_point_2d(vsol_point_2d_sptr const& p,
00074                       const vgui_style_sptr& style = NULL);
00075 
00076   //: display for vsol_line_2d
00077   bgui_vsol_soview2D_line_seg*
00078     add_vsol_line_2d(vsol_line_2d_sptr const& line,
00079                      const vgui_style_sptr& style = NULL);
00080 
00081   //: display for vsol_conic_2d
00082   bgui_vsol_soview2D_conic_seg*
00083     add_vsol_conic_2d(vsol_conic_2d_sptr const& conic,
00084                       const vgui_style_sptr& style = NULL);
00085 
00086   //: display for vsol_polyline_2d
00087   bgui_vsol_soview2D_polyline*
00088     add_vsol_polyline_2d(vsol_polyline_2d_sptr const& pline,
00089                          const vgui_style_sptr& style = NULL);
00090 
00091   //: display for vsol_polygon_2d
00092   bgui_vsol_soview2D_polygon*
00093     add_vsol_polygon_2d(vsol_polygon_2d_sptr const& pline,
00094                         const vgui_style_sptr& style = NULL);
00095 
00096   //: display for vsol_polygon_2d
00097   bgui_vsol_soview2D_polygon_set*
00098     add_vsol_polygon_2d_set(vsol_poly_set_2d_sptr const& set,
00099                             const vgui_style_sptr& style = NULL);
00100 
00101   //: display for vsol_digital_curve_2d
00102   bgui_vsol_soview2D_digital_curve*
00103     add_digital_curve(vsol_digital_curve_2d_sptr const& dc,
00104                       const vgui_style_sptr& style = NULL);
00105 
00106   //: display for vsol_digital_curve_2d (dotted)
00107   bgui_vsol_soview2D_digital_curve*
00108     add_dotted_digital_curve(vsol_digital_curve_2d_sptr const& dc,
00109                              const vgui_style_sptr& style = NULL);
00110 
00111   //: display for vdgl_digital_curve
00112   bgui_vsol_soview2D_edgel_curve*
00113     add_edgel_curve(vdgl_digital_curve_sptr const& dc,
00114                       const vgui_style_sptr& style = NULL);
00115 
00116   //: display for vdgl_digital_curve (dotted)
00117   bgui_vsol_soview2D_edgel_curve*
00118     add_dotted_edgel_curve(vdgl_digital_curve_sptr const& dc,
00119                              const vgui_style_sptr& style = NULL);
00120 
00121   void add_spatial_object(vsol_spatial_object_2d_sptr const& sos,
00122                           const vgui_style_sptr& style = NULL);
00123 
00124   //: display methods for vectors of vsol classes (not grouped)
00125   void add_spatial_objects(vcl_vector<vsol_spatial_object_2d_sptr> const& sos,
00126                            const vgui_style_sptr& style = NULL);
00127 
00128 
00129   //: Methods for changing the default style of displayable objects
00130   void set_vsol_spatial_object_2d_style(vsol_spatial_object_2d_sptr sos,
00131                                         const vgui_style_sptr& style);
00132   void set_vsol_point_2d_style(const vgui_style_sptr& style);
00133   void set_vsol_line_2d_style(const vgui_style_sptr& style);
00134   void set_vsol_conic_2d_style(const vgui_style_sptr& style);
00135   void set_vsol_polyline_2d_style(const vgui_style_sptr& style);
00136   void set_digital_curve_style(const vgui_style_sptr& style);
00137   void set_dotted_digital_curve_style(const vgui_style_sptr& style);
00138   void set_edgel_curve_style(const vgui_style_sptr& style);
00139   void set_dotted_edgel_curve_style(const vgui_style_sptr& style);
00140 
00141  protected:
00142 
00143   //: Default styles
00144   vgui_style_sptr point_style_;
00145   vgui_style_sptr line_style_;
00146   vgui_style_sptr conic_style_;
00147   vgui_style_sptr polyline_style_;
00148   vgui_style_sptr digital_curve_style_;
00149   vgui_style_sptr dotted_digital_curve_style_;
00150   vgui_style_sptr edgel_curve_style_;
00151   vgui_style_sptr dotted_edgel_curve_style_;
00152 
00153   void init();
00154 };
00155 
00156 //this stuff is needed to establish inheritance between tableau  smart pointers
00157 //cloned from xcv_image_tableau
00158 struct bgui_vsol2D_tableau_new : public bgui_vsol2D_tableau_sptr
00159 {
00160   typedef bgui_vsol2D_tableau_sptr base;
00161 
00162   bgui_vsol2D_tableau_new(const char* n="unnamed") :
00163     base(new bgui_vsol2D_tableau(n)) { }
00164   bgui_vsol2D_tableau_new(vgui_image_tableau_sptr const& it,
00165                                  const char* n="unnamed") :
00166     base(new bgui_vsol2D_tableau(it,n)) { }
00167 
00168   bgui_vsol2D_tableau_new(vgui_tableau_sptr const& t, const char* n="unnamed")
00169     :  base(new bgui_vsol2D_tableau(t, n)) { }
00170 
00171   operator vgui_easy2D_tableau_sptr () const { vgui_easy2D_tableau_sptr tt; tt.vertical_cast(*this); return tt; }
00172 };
00173 
00174 #endif // bgui_vsol2D_tableau_h_