00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PSTATSTRIPCHART_H
00020 #define PSTATSTRIPCHART_H
00021
00022 #include <pandatoolbase.h>
00023
00024 #include "pStatGraph.h"
00025 #include "pStatMonitor.h"
00026 #include "pStatClientData.h"
00027
00028 #include <luse.h>
00029 #include <vector_int.h>
00030
00031 #include "pmap.h"
00032
00033 class PStatView;
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 class PStatStripChart : public PStatGraph {
00047 public:
00048 PStatStripChart(PStatMonitor *monitor, PStatView &view,
00049 int collector_index, int xsize, int ysize);
00050 virtual ~PStatStripChart();
00051
00052 void new_data(int frame_number);
00053 void update();
00054 bool first_data() const;
00055
00056 INLINE PStatView &get_view() const;
00057 INLINE int get_collector_index() const;
00058
00059 INLINE void set_horizontal_scale(float time_width);
00060 INLINE float get_horizontal_scale() const;
00061 INLINE void set_vertical_scale(float value_height);
00062 void set_default_vertical_scale();
00063 void set_auto_vertical_scale();
00064 INLINE float get_vertical_scale() const;
00065
00066 INLINE void set_scroll_mode(bool scroll_mode);
00067 INLINE bool get_scroll_mode() const;
00068
00069 int get_collector_under_pixel(int xpoint, int ypoint);
00070 INLINE int timestamp_to_pixel(float time) const;
00071 INLINE float pixel_to_timestamp(int x) const;
00072 INLINE int height_to_pixel(float value) const;
00073 INLINE float pixel_to_height(int y) const;
00074
00075 protected:
00076 class ColorData {
00077 public:
00078 int _collector_index;
00079 float _net_value;
00080 };
00081 typedef pvector<ColorData> FrameData;
00082 typedef pmap<int, FrameData> Data;
00083
00084 const FrameData &get_frame_data(int frame_number);
00085
00086 void changed_size(int xsize, int ysize);
00087 void force_redraw();
00088 void force_reset();
00089 void update_labels();
00090 virtual void normal_guide_bars();
00091
00092 virtual void clear_region();
00093 virtual void copy_region(int start_x, int end_x, int dest_x);
00094 virtual void begin_draw(int from_x, int to_x);
00095 virtual void draw_slice(int x, int frame_number);
00096 virtual void draw_empty(int x);
00097 virtual void draw_cursor(int x);
00098 virtual void end_draw(int from_x, int to_x);
00099 virtual void idle();
00100
00101 private:
00102 void draw_frames(int first_frame, int last_frame);
00103 void draw_pixels(int first_pixel, int last_pixel);
00104
00105 PStatView &_view;
00106 int _collector_index;
00107 bool _scroll_mode;
00108
00109 Data _data;
00110
00111 int _next_frame;
00112 bool _first_data;
00113 int _cursor_pixel;
00114
00115 int _level_index;
00116
00117 float _time_width;
00118 float _start_time;
00119 float _value_height;
00120 };
00121
00122 #include "pStatStripChart.I"
00123
00124 #endif