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