00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PSTATGRAPH_H
00020 #define PSTATGRAPH_H
00021
00022 #include <pandatoolbase.h>
00023
00024 #include "pStatMonitor.h"
00025 #include "pStatClientData.h"
00026
00027 #include <luse.h>
00028 #include <vector_int.h>
00029
00030 #include "pmap.h"
00031
00032 class PStatView;
00033
00034
00035
00036
00037
00038
00039
00040 class PStatGraph {
00041 public:
00042 PStatGraph(PStatMonitor *monitor, int xsize, int ysize);
00043 virtual ~PStatGraph();
00044
00045 INLINE PStatMonitor *get_monitor() const;
00046
00047 INLINE int get_num_labels() const;
00048 INLINE int get_label_collector(int n) const;
00049 INLINE string get_label_name(int n) const;
00050 INLINE RGBColorf get_label_color(int n) const;
00051
00052 INLINE void set_target_frame_rate(float frame_rate);
00053 INLINE float get_target_frame_rate() const;
00054
00055 INLINE int get_xsize() const;
00056 INLINE int get_ysize() const;
00057
00058 class GuideBar {
00059 public:
00060 GuideBar(float height, const string &label, bool is_target);
00061 GuideBar(const GuideBar ©);
00062
00063 float _height;
00064 string _label;
00065 bool _is_target;
00066 };
00067
00068 enum GuideBarUnits {
00069 GBU_hz = 0x0001,
00070 GBU_ms = 0x0002,
00071 GBU_named = 0x0004,
00072 GBU_show_units = 0x0008,
00073 };
00074
00075 int get_num_guide_bars() const;
00076 const GuideBar &get_guide_bar(int n) const;
00077
00078 INLINE void set_guide_bar_units(int unit_mask);
00079 INLINE int get_guide_bar_units() const;
00080 INLINE void set_guide_bar_unit_name(const string &unit_name);
00081 INLINE const string &get_guide_bar_unit_name() const;
00082
00083 static string format_number(float value);
00084 static string format_number(float value, int guide_bar_units,
00085 const string &unit_name = string());
00086
00087 protected:
00088 virtual void normal_guide_bars()=0;
00089 void update_guide_bars(int num_bars, float scale);
00090 GuideBar make_guide_bar(float value) const;
00091
00092 bool _labels_changed;
00093 bool _guide_bars_changed;
00094
00095 PT(PStatMonitor) _monitor;
00096
00097 float _target_frame_rate;
00098
00099 int _xsize;
00100 int _ysize;
00101
00102
00103
00104 typedef vector_int Labels;
00105 Labels _labels;
00106
00107 typedef pvector<GuideBar> GuideBars;
00108 GuideBars _guide_bars;
00109 int _guide_bar_units;
00110 string _unit_name;
00111 };
00112
00113 #include "pStatGraph.I"
00114
00115 #endif