Panda3D
pStatGraph.I
1 // Filename: pStatGraph.I
2 // Created by: drose (19Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: PStatGraph::get_monitor
18 // Access: Public
19 // Description: Returns the monitor associated with this chart.
20 ////////////////////////////////////////////////////////////////////
22 get_monitor() const {
23  return _monitor;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: PStatGraph::get_num_labels
28 // Access: Public
29 // Description: Returns the number of labels to be drawn for this
30 // chart.
31 ////////////////////////////////////////////////////////////////////
32 INLINE int PStatGraph::
33 get_num_labels() const {
34  return _labels.size();
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: PStatGraph::get_label_collector
39 // Access: Public
40 // Description: Returns the collector index associated with the nth
41 // label.
42 ////////////////////////////////////////////////////////////////////
43 INLINE int PStatGraph::
44 get_label_collector(int n) const {
45  nassertr(n >= 0 && n < (int)_labels.size(), 0);
46  return _labels[n];
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: PStatGraph::get_label_name
51 // Access: Public
52 // Description: Returns the text associated with the nth label.
53 ////////////////////////////////////////////////////////////////////
54 INLINE string PStatGraph::
55 get_label_name(int n) const {
56  nassertr(n >= 0 && n < (int)_labels.size(), string());
57  return _monitor->get_client_data()->get_collector_name(_labels[n]);
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: PStatGraph::get_label_color
62 // Access: Public
63 // Description: Returns the color associated with the nth label.
64 ////////////////////////////////////////////////////////////////////
66 get_label_color(int n) const {
67  nassertr(n >= 0 && n < (int)_labels.size(), LRGBColor(0.0, 0.0, 0.0));
68  return _monitor->get_collector_color(_labels[n]);
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: PStatGraph::set_target_frame_rate
73 // Access: Public
74 // Description: Sets the target frame rate of the application in Hz.
75 // This only affects the choice of initial scale and the
76 // placement of guide bars.
77 ////////////////////////////////////////////////////////////////////
78 INLINE void PStatGraph::
79 set_target_frame_rate(double frame_rate) {
80  if (_target_frame_rate != frame_rate) {
81  _target_frame_rate = frame_rate;
82  normal_guide_bars();
83  }
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function: PStatGraph::get_target_frame_rate
88 // Access: Public
89 // Description: Returns the indicated target frame rate in Hz. See
90 // set_target_frame_rate().
91 ////////////////////////////////////////////////////////////////////
92 INLINE double PStatGraph::
94  return _target_frame_rate;
95 }
96 
97 ////////////////////////////////////////////////////////////////////
98 // Function: PStatGraph::get_xsize
99 // Access: Public
100 // Description: Returns the width of the chart in pixels.
101 ////////////////////////////////////////////////////////////////////
102 INLINE int PStatGraph::
103 get_xsize() const {
104  return _xsize;
105 }
106 
107 ////////////////////////////////////////////////////////////////////
108 // Function: PStatGraph::get_ysize
109 // Access: Public
110 // Description: Returns the height of the chart in pixels.
111 ////////////////////////////////////////////////////////////////////
112 INLINE int PStatGraph::
113 get_ysize() const {
114  return _ysize;
115 }
116 
117 ////////////////////////////////////////////////////////////////////
118 // Function: PStatGraph::set_guide_bar_units
119 // Access: Public
120 // Description: Sets the units that are displayed for the guide bar
121 // labels. This may be a union of one or more members
122 // of the GuideBarUnits enum.
123 ////////////////////////////////////////////////////////////////////
124 INLINE void PStatGraph::
125 set_guide_bar_units(int guide_bar_units) {
126  if (_guide_bar_units != guide_bar_units) {
127  _guide_bar_units = guide_bar_units;
128  normal_guide_bars();
129  }
130 }
131 
132 ////////////////////////////////////////////////////////////////////
133 // Function: PStatGraph::get_guide_bar_units
134 // Access: Public
135 // Description: Returns the units that are displayed for the guide bar
136 // labels. This may be a union of one or more members
137 // of the GuideBarUnits enum.
138 ////////////////////////////////////////////////////////////////////
139 INLINE int PStatGraph::
141  return _guide_bar_units;
142 }
143 
144 ////////////////////////////////////////////////////////////////////
145 // Function: PStatGraph::set_guide_bar_unit_name
146 // Access: Public
147 // Description: Sets the name of the units to be used for the guide
148 // bars if the units type is set to GBU_named |
149 // GBU_show_units.
150 ////////////////////////////////////////////////////////////////////
151 INLINE void PStatGraph::
152 set_guide_bar_unit_name(const string &unit_name) {
153  _unit_name = unit_name;
154 }
155 
156 ////////////////////////////////////////////////////////////////////
157 // Function: PStatGraph::get_guide_bar_unit_name
158 // Access: Public
159 // Description: Returns the name of the units to be used for the guide
160 // bars if the units type is set to GBU_named |
161 // GBU_show_units.
162 ////////////////////////////////////////////////////////////////////
163 INLINE const string &PStatGraph::
165  return _unit_name;
166 }
int get_xsize() const
Returns the width of the chart in pixels.
Definition: pStatGraph.I:103
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
int get_guide_bar_units() const
Returns the units that are displayed for the guide bar labels.
Definition: pStatGraph.I:140
const string & get_guide_bar_unit_name() const
Returns the name of the units to be used for the guide bars if the units type is set to GBU_named | G...
Definition: pStatGraph.I:164
void set_guide_bar_units(int unit_mask)
Sets the units that are displayed for the guide bar labels.
Definition: pStatGraph.I:125
int get_ysize() const
Returns the height of the chart in pixels.
Definition: pStatGraph.I:113
int get_num_labels() const
Returns the number of labels to be drawn for this chart.
Definition: pStatGraph.I:33
double get_target_frame_rate() const
Returns the indicated target frame rate in Hz.
Definition: pStatGraph.I:93
PStatMonitor * get_monitor() const
Returns the monitor associated with this chart.
Definition: pStatGraph.I:22
string get_label_name(int n) const
Returns the text associated with the nth label.
Definition: pStatGraph.I:55
This is an abstract class that presents the interface to any number of different front-ends for the s...
Definition: pStatMonitor.h:43
int get_label_collector(int n) const
Returns the collector index associated with the nth label.
Definition: pStatGraph.I:44
void set_guide_bar_unit_name(const string &unit_name)
Sets the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_...
Definition: pStatGraph.I:152
void set_target_frame_rate(double frame_rate)
Sets the target frame rate of the application in Hz.
Definition: pStatGraph.I:79
LRGBColor get_label_color(int n) const
Returns the color associated with the nth label.
Definition: pStatGraph.I:66