Panda3D
|
This is an abstract base class for several different kinds of graphs that have a few things in common, like labels and guide bars. More...
#include "pStatGraph.h"
Classes | |
class | GuideBar |
Public Types | |
enum | GuideBarStyle { GBS_normal , GBS_target , GBS_user } |
enum | GuideBarUnits { GBU_hz = 0x0001 , GBU_ms = 0x0002 , GBU_named = 0x0004 , GBU_show_units = 0x0008 } |
Public Member Functions | |
PStatGraph (PStatMonitor *monitor, int xsize, int ysize) | |
int | add_user_guide_bar (double height) |
Creates a new user guide bar and returns its index number. | |
int | find_user_guide_bar (double from_height, double to_height) const |
Returns the index number of the first user guide bar found whose height is within the indicated range, or -1 if no user guide bars fall within the range. | |
const GuideBar & | get_guide_bar (int n) const |
Returns the nth horizontal guide bar. | |
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 | GBU_show_units. | |
int | get_guide_bar_units () const |
Returns the units that are displayed for the guide bar labels. | |
int | get_label_collector (int n) const |
Returns the collector index associated with the nth label. | |
LRGBColor | get_label_color (int n) const |
Returns the color associated with the nth label. | |
std::string | get_label_name (int n) const |
Returns the text associated with the nth label. | |
PStatMonitor * | get_monitor () const |
Returns the monitor associated with this chart. | |
int | get_num_guide_bars () const |
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. | |
int | get_num_labels () const |
Returns the number of labels to be drawn for this chart. | |
int | get_num_user_guide_bars () const |
Returns the current number of user-defined guide bars. | |
double | get_target_frame_rate () const |
Returns the indicated target frame rate in Hz. | |
GuideBar | get_user_guide_bar (int n) const |
Returns the nth user-defined guide bar. | |
int | get_xsize () const |
Returns the width of the chart in pixels. | |
int | get_ysize () const |
Returns the height of the chart in pixels. | |
void | move_user_guide_bar (int n, double height) |
Adjusts the height of the nth user-defined guide bar. | |
void | remove_user_guide_bar (int n) |
Removes the user guide bar with the indicated index number. | |
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_show_units. | |
void | set_guide_bar_units (int unit_mask) |
Sets the units that are displayed for the guide bar labels. | |
void | set_target_frame_rate (double frame_rate) |
Sets the target frame rate of the application in Hz. | |
Static Public Member Functions | |
static std::string | format_number (double value) |
Returns a string representing the value nicely formatted for its range. | |
static std::string | format_number (double value, int guide_bar_units, const std::string &unit_name=std::string()) |
Returns a string representing the value nicely formatted for its range, including the units as indicated. | |
This is an abstract base class for several different kinds of graphs that have a few things in common, like labels and guide bars.
Definition at line 33 of file pStatGraph.h.
enum PStatGraph::GuideBarStyle |
Definition at line 51 of file pStatGraph.h.
enum PStatGraph::GuideBarUnits |
Definition at line 67 of file pStatGraph.h.
PStatGraph::PStatGraph | ( | PStatMonitor * | monitor, |
int | xsize, | ||
int | ysize ) |
Definition at line 50 of file pStatGraph.cxx.
|
virtual |
Definition at line 65 of file pStatGraph.cxx.
int PStatGraph::add_user_guide_bar | ( | double | height | ) |
Creates a new user guide bar and returns its index number.
Definition at line 124 of file pStatGraph.cxx.
int PStatGraph::find_user_guide_bar | ( | double | from_height, |
double | to_height ) const |
Returns the index number of the first user guide bar found whose height is within the indicated range, or -1 if no user guide bars fall within the range.
Definition at line 143 of file pStatGraph.cxx.
|
static |
Returns a string representing the value nicely formatted for its range.
Definition at line 152 of file pStatGraph.cxx.
Referenced by format_number(), and PStatStripChart::get_total_text().
|
static |
Returns a string representing the value nicely formatted for its range, including the units as indicated.
Definition at line 175 of file pStatGraph.cxx.
References format_number().
const PStatGraph::GuideBar & PStatGraph::get_guide_bar | ( | int | n | ) | const |
Returns the nth horizontal guide bar.
This should be drawn as a horizontal line across the chart at the y pixel location determined by height_to_pixel(bar._height).
It is possible that this bar will be off the top of the chart.
Definition at line 86 of file pStatGraph.cxx.
|
inline |
Returns the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units.
Definition at line 128 of file pStatGraph.I.
Referenced by PStatStripChart::get_total_text().
|
inline |
Returns the units that are displayed for the guide bar labels.
This may be a union of one or more members of the GuideBarUnits enum.
Definition at line 110 of file pStatGraph.I.
Referenced by PStatStripChart::get_total_text(), WinStatsPianoRoll::set_time_units(), and WinStatsStripChart::set_time_units().
|
inline |
Returns the collector index associated with the nth label.
Definition at line 33 of file pStatGraph.I.
|
inline |
Returns the color associated with the nth label.
Definition at line 51 of file pStatGraph.I.
|
inline |
Returns the text associated with the nth label.
Definition at line 42 of file pStatGraph.I.
|
inline |
Returns the monitor associated with this chart.
Definition at line 17 of file pStatGraph.I.
Referenced by PStatStripChart::update().
int PStatGraph::get_num_guide_bars | ( | ) | const |
Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate.
Not all of these may be visible; some may be off the top of the chart because of the vertical scale.
Definition at line 74 of file pStatGraph.cxx.
|
inline |
Returns the number of labels to be drawn for this chart.
Definition at line 25 of file pStatGraph.I.
int PStatGraph::get_num_user_guide_bars | ( | ) | const |
Returns the current number of user-defined guide bars.
Not all of these may be visible.
Definition at line 99 of file pStatGraph.cxx.
|
inline |
Returns the indicated target frame rate in Hz.
Definition at line 73 of file pStatGraph.I.
Referenced by PStatStripChart::set_default_vertical_scale().
PStatGraph::GuideBar PStatGraph::get_user_guide_bar | ( | int | n | ) | const |
Returns the nth user-defined guide bar.
Definition at line 107 of file pStatGraph.cxx.
|
inline |
Returns the width of the chart in pixels.
Definition at line 81 of file pStatGraph.I.
Referenced by PStatStripChart::pixel_to_timestamp(), and PStatStripChart::timestamp_to_pixel().
|
inline |
Returns the height of the chart in pixels.
Definition at line 89 of file pStatGraph.I.
Referenced by PStatStripChart::get_collector_under_pixel(), PStatStripChart::height_to_pixel(), and PStatStripChart::pixel_to_height().
void PStatGraph::move_user_guide_bar | ( | int | n, |
double | height ) |
Adjusts the height of the nth user-defined guide bar.
Definition at line 116 of file pStatGraph.cxx.
void PStatGraph::remove_user_guide_bar | ( | int | n | ) |
Removes the user guide bar with the indicated index number.
All subsequent index numbers are adjusted down one.
Definition at line 133 of file pStatGraph.cxx.
|
inline |
Sets the name of the units to be used for the guide bars if the units type is set to GBU_named | GBU_show_units.
Definition at line 119 of file pStatGraph.I.
|
inline |
Sets the units that are displayed for the guide bar labels.
This may be a union of one or more members of the GuideBarUnits enum.
Definition at line 98 of file pStatGraph.I.
Referenced by WinStatsPianoRoll::set_time_units(), and WinStatsStripChart::set_time_units().
|
inline |
Sets the target frame rate of the application in Hz.
This only affects the choice of initial scale and the placement of guide bars.
Definition at line 61 of file pStatGraph.I.