contrib/brl/bbas/bgui3d/bgui3d_examiner_slider_tableau.h
Go to the documentation of this file.
00001 // This is brl/bbas/bgui3d/bgui3d_examiner_slider_tableau.h
00002 #ifndef bgui3d_examiner_slide_tableau_h_
00003 #define bgui3d_examiner_slide_tableau_h_
00004 //:
00005 // \file
00006 // \brief  Basic tableau that wraps Coin3D into VGUI and adds a slider and functionality to examine the scene
00007 //
00008 //         It basically adds the slider to the bgui_3d_examiner_tableau
00009 //         class. The slider keeps a minimum and maximum value which is
00010 //         in the range of [0-255]. Any program using this class can
00011 //         investigate the min-max value by calling minValue() and maxValue()
00012 //         public methods. An example to investigate this values could be
00013 //         setting a SoTimerSensor (Coin3D) and getting the updated values
00014 //         at regular time intervals and doing the required changes/processing
00015 //         based on those values.
00016 //
00017 // \author Gamze Tunali (gamze@lems.brown.edu)
00018 // \date   December 01, 2005
00019 //
00020 // \verbatim
00021 //  Modifications
00022 //   <none yet>
00023 // \endverbatim
00024 
00025 #include "bgui3d_examiner_tableau.h"
00026 #include "bgui3d_examiner_slider_tableau_sptr.h"
00027 
00028 #include <Inventor/nodes/SoImage.h>
00029 #include <Inventor/nodes/SoTransform.h>
00030 #include <Inventor/nodes/SoCone.h>
00031 
00032 class bgui3d_examiner_slider_tableau: public bgui3d_examiner_tableau
00033 {
00034  public:
00035   //: Constructor
00036   bgui3d_examiner_slider_tableau(SoNode * scene_root = NULL);
00037 
00038   //: Destructor
00039   virtual ~bgui3d_examiner_slider_tableau() {}
00040 
00041   bool handle(const vgui_event& e);
00042 
00043   int minValue() const { return min; }
00044   int maxValue() const { return max; }
00045 
00046  protected:
00047   //: Render the scene graph (called on draw events)
00048   virtual bool render();
00049 
00050   void transfer_callback(const bool & remap, const int & n_min,
00051                          const int & n_max);
00052 
00053  private:
00054   void loadSliderImage();
00055   void positionSlider();
00056 
00057   SbVec2s last_viewport_sz_;
00058   int min, max;
00059   SbViewportRegion * slider_vp_;
00060   SoImage * slider_image_;
00061   SoOrthographicCamera* sliderCamera_;
00062   SoTransform *slider_transform, *min_transform, *max_transform;
00063   int slider_height_, slider_width_;
00064   SoCone *min_mark_, *max_mark_;
00065 };
00066 
00067 //: Create a smart pointer to a bgui3d_examiner_tableau.
00068 struct bgui3d_examiner_slider_tableau_new : public bgui3d_examiner_slider_tableau_sptr
00069 {
00070   typedef bgui3d_examiner_slider_tableau_sptr base;
00071   bgui3d_examiner_slider_tableau_new(SoNode* scene_root = NULL)
00072    : base(new bgui3d_examiner_slider_tableau(scene_root)) { }
00073 };
00074 
00075 #endif // bgui3d_examiner_slide_tableau_h_