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

pandatool/src/pstatserver/pStatStripChart.I

Go to the documentation of this file.
00001 // Filename: pStatStripChart.I
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 
00020 ////////////////////////////////////////////////////////////////////
00021 //     Function: PStatStripChart::get_view
00022 //       Access: Public
00023 //  Description: Returns the View this chart represents.
00024 ////////////////////////////////////////////////////////////////////
00025 INLINE PStatView &PStatStripChart::
00026 get_view() const {
00027   return _view;
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //     Function: PStatStripChart::get_collector_index
00032 //       Access: Public
00033 //  Description: Returns the particular collector whose data this
00034 //               strip chart reflects.
00035 ////////////////////////////////////////////////////////////////////
00036 INLINE int PStatStripChart::
00037 get_collector_index() const {
00038   return _collector_index;
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //     Function: PStatStripChart::set_horizontal_scale
00043 //       Access: Public
00044 //  Description: Changes the amount of time the width of the
00045 //               horizontal axis represents.  This may force a redraw.
00046 ////////////////////////////////////////////////////////////////////
00047 INLINE void PStatStripChart::
00048 set_horizontal_scale(float time_width) {
00049   if (_time_width != time_width) {
00050     if (_scroll_mode) {
00051       _start_time += _time_width - time_width;
00052     } else {
00053       force_reset();
00054     }
00055     _time_width = time_width;
00056   }
00057 }
00058 
00059 ////////////////////////////////////////////////////////////////////
00060 //     Function: PStatStripChart::get_horizontal_scale
00061 //       Access: Public
00062 //  Description: Returns the amount of total time the width of the
00063 //               horizontal axis represents.
00064 ////////////////////////////////////////////////////////////////////
00065 INLINE float PStatStripChart::
00066 get_horizontal_scale() const {
00067   return _time_width;
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //     Function: PStatStripChart::set_vertical_scale
00072 //       Access: Public
00073 //  Description: Changes the value the height of the vertical axis
00074 //               represents.  This may force a redraw.
00075 ////////////////////////////////////////////////////////////////////
00076 INLINE void PStatStripChart::
00077 set_vertical_scale(float value_height) {
00078   if (_value_height != value_height) {
00079     _value_height = value_height;
00080     normal_guide_bars();
00081     force_redraw();
00082   }
00083 }
00084 
00085 ////////////////////////////////////////////////////////////////////
00086 //     Function: PStatStripChart::get_vertical_scale
00087 //       Access: Public
00088 //  Description: Returns total value the height of the vertical axis
00089 //               represents.
00090 ////////////////////////////////////////////////////////////////////
00091 INLINE float PStatStripChart::
00092 get_vertical_scale() const {
00093   return _value_height;
00094 }
00095 
00096 ////////////////////////////////////////////////////////////////////
00097 //     Function: PStatStripChart::set_scroll_mode
00098 //       Access: Public
00099 //  Description: Changes the scroll_mode flag.  When true, the strip
00100 //               chart will update itself by scrolling to the left;
00101 //               when false, the strip chart will wrap around at the
00102 //               right and restart at the left end without scrolling.
00103 ////////////////////////////////////////////////////////////////////
00104 INLINE void PStatStripChart::
00105 set_scroll_mode(bool scroll_mode) {
00106   if (_scroll_mode != scroll_mode) {
00107     _scroll_mode = scroll_mode;
00108     _first_data = true;
00109   }
00110 }
00111 
00112 ////////////////////////////////////////////////////////////////////
00113 //     Function: PStatStripChart::get_scroll_mode
00114 //       Access: Public
00115 //  Description: Returns the current state of the scroll_mode flag.
00116 //               When true, the strip chart will update itself by
00117 //               scrolling to the left; when false, the strip chart
00118 //               will wrap around at the right and restart at the left
00119 //               end without scrolling.
00120 ////////////////////////////////////////////////////////////////////
00121 INLINE bool PStatStripChart::
00122 get_scroll_mode() const {
00123   return _scroll_mode;
00124 }
00125 
00126 ////////////////////////////////////////////////////////////////////
00127 //     Function: PStatStripChart::timestamp_to_pixel
00128 //       Access: Public
00129 //  Description: Converts a timestamp to a horizontal pixel offset.
00130 ////////////////////////////////////////////////////////////////////
00131 INLINE int PStatStripChart::
00132 timestamp_to_pixel(float time) const {
00133   return (int)((float)get_xsize() * (time - _start_time) / _time_width);
00134 }
00135 
00136 ////////////////////////////////////////////////////////////////////
00137 //     Function: PStatStripChart::pixel_to_timestamp
00138 //       Access: Public
00139 //  Description: Converts a horizontal pixel offset to a timestamp.
00140 ////////////////////////////////////////////////////////////////////
00141 INLINE float PStatStripChart::
00142 pixel_to_timestamp(int x) const {
00143   return _time_width * (float)x / (float)get_xsize() + _start_time;
00144 }
00145 
00146 ////////////////////////////////////////////////////////////////////
00147 //     Function: PStatStripChart::height_to_pixel
00148 //       Access: Public
00149 //  Description: Converts a value (i.e. a "height" in the strip chart)
00150 //               to a vertical pixel offset.
00151 ////////////////////////////////////////////////////////////////////
00152 INLINE int PStatStripChart::
00153 height_to_pixel(float value) const {
00154   return get_ysize() - (int)((float)get_ysize() * value / _value_height);
00155 }
00156 
00157 ////////////////////////////////////////////////////////////////////
00158 //     Function: PStatStripChart::pixel_to_height
00159 //       Access: Public
00160 //  Description: Converts a vertical pixel offset to a value (a
00161 //               "height" in the strip chart).
00162 ////////////////////////////////////////////////////////////////////
00163 INLINE float PStatStripChart::
00164 pixel_to_height(int x) const {
00165   return _value_height * (float)(get_ysize() - x) / (float)get_ysize();
00166 }

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