Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/pstatserver/pStatStripChart.h

Go to the documentation of this file.
00001 // Filename: pStatStripChart.h
00002 // Created by:  drose (15Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : PStatStripChart
00037 // Description : This is an abstract class that presents the interface
00038 //               for drawing a basic strip-chart, showing the relative
00039 //               value over an interval of time for several different
00040 //               collectors, differentiated by bands of color.
00041 //
00042 //               This class just manages all the strip-chart logic;
00043 //               the actual nuts and bolts of drawing pixels is left
00044 //               to a user-derived class.
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

Generated on Fri May 2 03:21:40 2003 for Panda-Tool by doxygen1.3