00001 // This is brl/bbas/bgui/bgui_bargraph_clipon_tableau.h 00002 #ifndef bgui_bargraph_clipon_tableau_h_ 00003 #define bgui_bargraph_clipon_tableau_h_ 00004 //: 00005 // \file 00006 // \author Joe Mundy 00007 // \brief A tableau to produce a bar graph 00008 // The graph is plotted on an easy2D tableau 00009 // which this tableau points to not inherits from 00010 // 00011 // Thus the bar graph is a "clip on" to an existing 00012 // tableau hierarchy that must include something 00013 // with "easy2D" power. 00014 // The bars can have up to eight different colors 00015 // As specified by the input color vector, with elements 00016 // ranging from 0-7; 00017 #include <vbl/vbl_ref_count.h> 00018 #include <vgui/vgui_soview2D.h> 00019 #include <vgui/vgui_easy2D_tableau_sptr.h> 00020 00021 class bgui_bargraph_clipon_tableau : public vbl_ref_count 00022 { 00023 public: 00024 //: Constructor 00025 bgui_bargraph_clipon_tableau(vgui_easy2D_tableau_sptr const& easy); 00026 //: Destructor. 00027 ~bgui_bargraph_clipon_tableau(); 00028 //: Set the color vector, 0-7 color code 00029 void set_color_vector(vcl_vector<unsigned char> const& colors); 00030 00031 //: Update the data vector. Defaults determine size of plot from window 00032 void update(vcl_vector<float> const& bars, const bool fixed = false, 00033 const float scale=1.0); 00034 00035 //: Return the name of this tableau. 00036 vcl_string type_name() const { return "bgui_bargraph_clipon_tableau";} 00037 00038 //: Clear the data 00039 void clear(); 00040 private: 00041 int left_offset_; 00042 int top_offset_; 00043 int graph_width_; 00044 int graph_height_; 00045 int nominal_bar_width_; 00046 vcl_vector<vcl_vector<float> > color_values_; 00047 vcl_vector<unsigned char> color_index_; 00048 vcl_vector<float> bars_; 00049 vgui_easy2D_tableau_sptr easy_; 00050 vcl_vector<vgui_soview2D_lineseg*> bar_plot_; 00051 }; 00052 00053 #include "bgui_bargraph_clipon_tableau_sptr.h" 00054 00055 #endif // bgui_bargraph_clipon_tableau_h_