Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

bgui_vsol_soview2D.h

Go to the documentation of this file.
00001 // This is brl/bbas/bgui/bgui_vsol_soview2D.h
00002 #ifndef bgui_vsol_soview2D_h_
00003 #define bgui_vsol_soview2D_h_
00004 //--------------------------------------------------------------------------------
00005 //:
00006 // \file
00007 // \brief A collection of vgui_soview2D objects
00008 // \author
00009 //   J.L. Mundy
00010 //
00011 // \verbatim
00012 //  Modifications:
00013 //   J.L. Mundy     June 2, 2003  Initial version.
00014 //   Amir Tamrakar June 06, 2003  Added soview for vsol_polyline_2d.
00015 //   M.R. Johnson  June 20, 2003  Initial version of linked soviews.
00016 //   M.J. Leotta   April 3, 2004  Merged linked soviews back into this file
00017 //   Sancar Adali    May 5, 2004  Created a base class bgui_vsol_soview2D, a base
00018 //                                class for all bgui_vsol_soview2D_xxx objects
00019 //                                It has the sptr to the vsol data object
00020 // \endverbatim
00021 //--------------------------------------------------------------------------------
00022 
00023 #include <vcl_iosfwd.h>
00024 #include <vdgl/vdgl_digital_curve_sptr.h>
00025 #include <vsol/vsol_spatial_object_2d_sptr.h>
00026 #include <vsol/vsol_line_2d_sptr.h>
00027 #include <vsol/vsol_conic_2d_sptr.h>
00028 #include <vsol/vsol_point_2d_sptr.h>
00029 #include <vsol/vsol_polyline_2d_sptr.h>
00030 #include <vsol/vsol_polygon_2d_sptr.h>
00031 #include <vsol/vsol_digital_curve_2d_sptr.h>
00032 
00033 #include <vgui/vgui_soview2D.h>
00034 
00035 
00036 class bgui_vsol_soview2D : public vgui_soview2D
00037 {
00038  public:
00039   //: Constructor - creates a default vsol_spatial_object_2d view
00040   bgui_vsol_soview2D( vsol_spatial_object_2d_sptr const & pt);
00041 
00042   //: Destructor
00043   ~bgui_vsol_soview2D() {}
00044 
00045   //: Print details about this vsol object to the given stream.
00046   vcl_ostream& print(vcl_ostream&) const;
00047 
00048   //: Returns the type of this class
00049   virtual vcl_string type_name() const=0;
00050 
00051   //: Render this 2D digital_curve on the display.
00052   virtual void draw() const=0;
00053   
00054   vsol_spatial_object_2d_sptr base_sptr() const { return sptr_; }
00055 
00056   //: Translate this 2D digital_curve by the given x and y distances.
00057   virtual void translate(float x, float y)=0;
00058 
00059  protected:
00060   //: Smart pointer to a vsol_spatial_object
00061   vsol_spatial_object_2d_sptr sptr_;
00062 };
00063 
00064 
00065 class bgui_vsol_soview2D_point : public bgui_vsol_soview2D
00066 {
00067  public:
00068   //: Constructor - creates a default vsol_point_2d view
00069   bgui_vsol_soview2D_point( vsol_point_2d_sptr const & pt);
00070 
00071   ~bgui_vsol_soview2D_point() {}
00072 
00073   //: Returns the type of this class ('bgui_vsol_soview2D_point').
00074   static vcl_string type_name_() { return "bgui_vsol_soview2D_point"; }
00075   vcl_string type_name() const { return type_name_(); }
00076 
00077   //: Render this 2D point on the display.
00078   void draw() const;
00079 
00080   // Returns vsol_point_2d_sptr of the vsol_spatial_object_2d_sptr
00081   vsol_point_2d_sptr sptr() const;
00082 
00083   //: Returns the distance squared from this 2D point to the given position.
00084   virtual float distance_squared(float x, float y) const;
00085 
00086   //: Returns the centroid of this point (the point location).
00087   void get_centroid(float* x, float* y) const;
00088 
00089   //: Translate this 2D point by the given x and y distances.
00090   void translate(float x, float y);
00091 };
00092 
00093 
00094 //: vsol_line_2d
00095 class bgui_vsol_soview2D_line_seg : public bgui_vsol_soview2D
00096 {
00097  public:
00098   //: Constructor - creates a view of a given vsol_line_2d
00099   bgui_vsol_soview2D_line_seg( vsol_line_2d_sptr const & line);
00100 
00101   //: Destructor - does nothing, smart pointers pass out of scope automatically
00102   ~bgui_vsol_soview2D_line_seg() {}
00103 
00104   //: Returns the type of this class ('bgui_vsol_soview2D_line_seg').
00105   static vcl_string type_name_() { return "bgui_vsol_soview2D_line_seg"; }
00106   vcl_string type_name() const { return type_name_(); }
00107 
00108   //: Render this curve on the display.
00109   virtual void draw() const;
00110 
00111   // Returns a smart pointer to the line
00112   // \note cast from a vsol_spatial_object_2d_sptr in the base class
00113   vsol_line_2d_sptr sptr() const;
00114 
00115   //: Returns the distance squared from this 2D curve to the given position.
00116   virtual float distance_squared(float x, float y) const;
00117 
00118   //: Returns the centroid of this 2D digital_curve.
00119   void get_centroid(float* x, float* y) const;
00120 
00121   //: Translate this 2D digital_curve by the given x and y distances.
00122   virtual void translate(float x, float y);
00123 };
00124 
00125 
00126 //: vsol_conic_2d
00127 // The current implementation is restricted to conics that are a real ellipse
00128 class bgui_vsol_soview2D_conic_seg : public bgui_vsol_soview2D
00129 {
00130  public:
00131   //: Constructor - creates a view of a given vsol_conic_2d
00132   bgui_vsol_soview2D_conic_seg( vsol_conic_2d_sptr const & conic);
00133 
00134   //: Destructor - does nothing, smart pointers pass out of scope automatically
00135   ~bgui_vsol_soview2D_conic_seg() {}
00136 
00137   //: Returns the type of this class ('bgui_vsol_soview2D_conic_seg').
00138   static vcl_string type_name_() { return "bgui_vsol_soview2D_conic_seg"; }
00139   vcl_string type_name() const { return type_name_(); }
00140 
00141   //: Render this 2D digital_curve on the display.
00142   virtual void draw() const;
00143 
00144   // Returns a smart pointer to the line
00145   // \note cast from a vsol_spatial_object_2d_sptr in the base class
00146   vsol_conic_2d_sptr sptr() const;
00147 
00148   //: Returns the distance squared from this curve to the given position.
00149   virtual float distance_squared(float x, float y) const;
00150 
00151   //: Returns the centroid of the conic
00152   void get_centroid(float* x, float* y) const;
00153 
00154   //: Translate this conic  by the given x and y distances.
00155   virtual void translate(float x, float y);
00156 
00157  protected:
00158   //: the center of the ellipse
00159   double xc_, yc_;
00160   //: the major_axis
00161   double major_axis_;
00162   //: the minor_axis
00163   double minor_axis_;
00164   //: the orientation angle
00165   double angle_;
00166   //: parametric angle at p0;
00167   double start_angle_;
00168   //: parametric angle at p1;
00169   double end_angle_;
00170 };
00171 
00172 
00173 //: vsol_polyline_2d
00174 class bgui_vsol_soview2D_polyline : public bgui_vsol_soview2D
00175 {
00176  public:
00177   //: Constructor - creates a view of a given vsol_polyline_2d
00178   bgui_vsol_soview2D_polyline(vsol_polyline_2d_sptr const& pline);
00179 
00180   //: Deconstructor
00181   ~bgui_vsol_soview2D_polyline() {}
00182 
00183   //: Returns the type of this class ('bgui_vsol_soview2D_polyline').
00184   static vcl_string type_name_() { return "bgui_vsol_soview2D_polyline"; }
00185   vcl_string type_name() const { return type_name_(); }
00186 
00187   //: Render this 2D digital_curve on the display.
00188   void draw() const;
00189 
00190   // Returns a smart pointer to the polyline
00191   // \note cast from a vsol_spatial_object_2d_sptr in the base class
00192   vsol_polyline_2d_sptr sptr() const;
00193 
00194   //: Returns the distance squared from this 2D digital_curve to the given position.
00195   virtual float distance_squared(float x, float y) const;
00196 
00197   //: Returns the centroid of this 2D digital_curve.
00198   void get_centroid(float* x, float* y) const;
00199 
00200   //: Translate this 2D digital_curve by the given x and y distances.
00201   void translate(float x, float y);
00202 };
00203 
00204 
00205 //: vsol_polygon_2d
00206 class bgui_vsol_soview2D_polygon : public bgui_vsol_soview2D
00207 {
00208  public:
00209   //: Constructor - creates a view of a vdgl_polygon
00210   bgui_vsol_soview2D_polygon(vsol_polygon_2d_sptr const& e);
00211 
00212   //: Deconstructor
00213   ~bgui_vsol_soview2D_polygon() {}
00214 
00215   //: Returns the type of this class ('bgui_vsol_soview2D_polygon').
00216   static vcl_string type_name_() { return "bgui_vsol_soview2D_polygon"; }
00217   vcl_string type_name() const { return type_name_(); }
00218 
00219   // Returns a smart pointer to the polygon
00220   // \note cast from a vsol_spatial_object_2d_sptr in the base class
00221   vsol_polygon_2d_sptr sptr() const;
00222 
00223   //: Render this 2D digital_curve on the display.
00224   void draw() const;
00225 
00226   //: Returns the distance squared from this 2D digital_curve to the given position.
00227   virtual float distance_squared(float x, float y) const;
00228 
00229   //: Returns the centroid of this 2D digital_curve.
00230   void get_centroid(float* x, float* y) const;
00231 
00232   //: Translate this 2D digital_curve by the given x and y distances.
00233   void translate(float x, float y);
00234 };
00235 
00236 
00237 //: vsol_digital_curve_2d
00238 class bgui_vsol_soview2D_digital_curve : public bgui_vsol_soview2D
00239 {
00240  public:
00241   //: Constructor - creates a view of a vsol_digital_curve_2d
00242   bgui_vsol_soview2D_digital_curve(vsol_digital_curve_2d_sptr const& dc, bool dotted = false);
00243 
00244   //: Destructor - does nothing, smart pointers pass out of scope automatically
00245   ~bgui_vsol_soview2D_digital_curve() {}
00246 
00247   //: Returns the type of this class ('bgui_vsol_soview2D_digital_curve').
00248   static vcl_string type_name_() { return "bgui_vsol_soview2D_digital_curve"; }
00249   vcl_string type_name() const { return type_name_(); }
00250   
00251   // Returns a smart pointer to the digital curve
00252   // \note cast from a vsol_spatial_object_2d_sptr in the base class
00253   vsol_digital_curve_2d_sptr sptr() const;
00254 
00255   //: Render this 2D digital_curve on the display.
00256   void draw() const;
00257 
00258   //: Returns the distance squared from this 2D digital_curve to the given position.
00259   virtual float distance_squared(float x, float y) const;
00260 
00261   //: Returns the centroid of this 2D digital_curve.
00262   void get_centroid(float* x, float* y) const;
00263 
00264   //: Translate this 2D digital_curve by the given x and y distances.
00265   void translate(float x, float y);
00266 
00267  protected:
00268   //: draw the sample points over the line segments
00269   bool draw_dotted_;
00270 };
00271 
00272 
00273 //: vdgl_digital_curve (chain of edgels)
00274 class bgui_vsol_soview2D_edgel_curve : public bgui_vsol_soview2D
00275 {
00276  public:
00277   //: Constructor - creates a view of a vdgl_digital_curve
00278   bgui_vsol_soview2D_edgel_curve(vdgl_digital_curve_sptr const& e, bool dotted = false);
00279 
00280   //: Destructor - does nothing, smart pointers pass out of scope automatically
00281   ~bgui_vsol_soview2D_edgel_curve() {}
00282 
00283   //: Returns the type of this class ('bgui_vsol_soview2D_edgel_curve').
00284   static vcl_string type_name_() { return "bgui_vsol_soview2D_edgel_curve"; }
00285   vcl_string type_name() const { return type_name_(); }
00286 
00287   // Returns a smart pointer to the digital edgel curve
00288   // \note cast from a vsol_spatial_object_2d_sptr in the base class
00289   vdgl_digital_curve_sptr sptr() const;
00290 
00291   //: Render this 2D digital_curve on the display.
00292   void draw() const;
00293 
00294   //: Returns the distance squared from this 2D digital_curve to the given position.
00295   virtual float distance_squared(float x, float y) const;
00296 
00297   //: Returns the centroid of this 2D digital_curve.
00298   void get_centroid(float* x, float* y) const;
00299 
00300   //: Translate this 2D digital_curve by the given x and y distances.
00301   void translate(float x, float y);
00302 
00303  protected:
00304   bool draw_dotted_;
00305 };
00306 
00307 
00308 
00309 #endif // bgui_vsol_soview2D_h_

Generated on Thu Jan 10 14:52:11 2008 for contrib/brl/bbas/bgui by  doxygen 1.4.4