00001 // Filename: pStatGraph.I 00002 // Created by: drose (19Jul00) 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: PStatGraph::get_monitor 00022 // Access: Public 00023 // Description: Returns the monitor associated with this chart. 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE PStatMonitor *PStatGraph:: 00026 get_monitor() const { 00027 return _monitor; 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: PStatGraph::get_num_labels 00032 // Access: Public 00033 // Description: Returns the number of labels to be drawn for this 00034 // chart. 00035 //////////////////////////////////////////////////////////////////// 00036 INLINE int PStatGraph:: 00037 get_num_labels() const { 00038 return _labels.size(); 00039 } 00040 00041 //////////////////////////////////////////////////////////////////// 00042 // Function: PStatGraph::get_label_collector 00043 // Access: Public 00044 // Description: Returns the collector index associated with the nth 00045 // label. 00046 //////////////////////////////////////////////////////////////////// 00047 INLINE int PStatGraph:: 00048 get_label_collector(int n) const { 00049 nassertr(n >= 0 && n < (int)_labels.size(), 0); 00050 return _labels[n]; 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: PStatGraph::get_label_name 00055 // Access: Public 00056 // Description: Returns the text associated with the nth label. 00057 //////////////////////////////////////////////////////////////////// 00058 INLINE string PStatGraph:: 00059 get_label_name(int n) const { 00060 nassertr(n >= 0 && n < (int)_labels.size(), string()); 00061 return _monitor->get_client_data()->get_collector_name(_labels[n]); 00062 } 00063 00064 //////////////////////////////////////////////////////////////////// 00065 // Function: PStatGraph::get_label_color 00066 // Access: Public 00067 // Description: Returns the color associated with the nth label. 00068 //////////////////////////////////////////////////////////////////// 00069 INLINE RGBColorf PStatGraph:: 00070 get_label_color(int n) const { 00071 nassertr(n >= 0 && n < (int)_labels.size(), RGBColorf(0.0, 0.0, 0.0)); 00072 return _monitor->get_collector_color(_labels[n]); 00073 } 00074 00075 //////////////////////////////////////////////////////////////////// 00076 // Function: PStatGraph::set_target_frame_rate 00077 // Access: Public 00078 // Description: Sets the target frame rate of the application in Hz. 00079 // This only affects the choice of initial scale and the 00080 // placement of guide bars. 00081 //////////////////////////////////////////////////////////////////// 00082 INLINE void PStatGraph:: 00083 set_target_frame_rate(float frame_rate) { 00084 if (_target_frame_rate != frame_rate) { 00085 _target_frame_rate = frame_rate; 00086 normal_guide_bars(); 00087 } 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: PStatGraph::get_target_frame_rate 00092 // Access: Public 00093 // Description: Returns the indicated target frame rate in Hz. See 00094 // set_target_frame_rate(). 00095 //////////////////////////////////////////////////////////////////// 00096 INLINE float PStatGraph:: 00097 get_target_frame_rate() const { 00098 return _target_frame_rate; 00099 } 00100 00101 //////////////////////////////////////////////////////////////////// 00102 // Function: PStatGraph::get_xsize 00103 // Access: Public 00104 // Description: Returns the width of the chart in pixels. 00105 //////////////////////////////////////////////////////////////////// 00106 INLINE int PStatGraph:: 00107 get_xsize() const { 00108 return _xsize; 00109 } 00110 00111 //////////////////////////////////////////////////////////////////// 00112 // Function: PStatGraph::get_ysize 00113 // Access: Public 00114 // Description: Returns the height of the chart in pixels. 00115 //////////////////////////////////////////////////////////////////// 00116 INLINE int PStatGraph:: 00117 get_ysize() const { 00118 return _ysize; 00119 } 00120 00121 //////////////////////////////////////////////////////////////////// 00122 // Function: PStatGraph::set_guide_bar_units 00123 // Access: Public 00124 // Description: Sets the units that are displayed for the guide bar 00125 // labels. This may be a union of one or more members 00126 // of the GuideBarUnits enum. 00127 //////////////////////////////////////////////////////////////////// 00128 INLINE void PStatGraph:: 00129 set_guide_bar_units(int guide_bar_units) { 00130 if (_guide_bar_units != guide_bar_units) { 00131 _guide_bar_units = guide_bar_units; 00132 normal_guide_bars(); 00133 } 00134 } 00135 00136 //////////////////////////////////////////////////////////////////// 00137 // Function: PStatGraph::get_guide_bar_units 00138 // Access: Public 00139 // Description: Returns the units that are displayed for the guide bar 00140 // labels. This may be a union of one or more members 00141 // of the GuideBarUnits enum. 00142 //////////////////////////////////////////////////////////////////// 00143 INLINE int PStatGraph:: 00144 get_guide_bar_units() const { 00145 return _guide_bar_units; 00146 } 00147 00148 //////////////////////////////////////////////////////////////////// 00149 // Function: PStatGraph::set_guide_bar_unit_name 00150 // Access: Public 00151 // Description: Sets the name of the units to be used for the guide 00152 // bars if the units type is set to GBU_named | 00153 // GBU_show_units. 00154 //////////////////////////////////////////////////////////////////// 00155 INLINE void PStatGraph:: 00156 set_guide_bar_unit_name(const string &unit_name) { 00157 _unit_name = unit_name; 00158 } 00159 00160 //////////////////////////////////////////////////////////////////// 00161 // Function: PStatGraph::get_guide_bar_unit_name 00162 // Access: Public 00163 // Description: Returns the name of the units to be used for the guide 00164 // bars if the units type is set to GBU_named | 00165 // GBU_show_units. 00166 //////////////////////////////////////////////////////////////////// 00167 INLINE const string &PStatGraph:: 00168 get_guide_bar_unit_name() const { 00169 return _unit_name; 00170 }