Panda3D
Classes | Public Member Functions | List of all members
PStatPianoRoll Class Reference

This is an abstract class that presents the interface for drawing a piano- roll type chart: it shows the time spent in each of a number of collectors as a horizontal bar of color, with time as the horizontal axis. More...

#include "pStatPianoRoll.h"

Inheritance diagram for PStatPianoRoll:
PStatGraph WinStatsPianoRoll

Public Member Functions

 PStatPianoRoll (PStatMonitor *monitor, int thread_index, int xsize, int ysize)
 
double get_horizontal_scale () const
 Returns the amount of total time the width of the horizontal axis represents. More...
 
int height_to_pixel (double value) const
 Converts a value (i.e. More...
 
double pixel_to_height (int y) const
 Converts a horizontal pixel offset to a value (a "height" in the strip chart). More...
 
double pixel_to_timestamp (int x) const
 Converts a horizontal pixel offset to a timestamp. More...
 
void set_horizontal_scale (double time_width)
 Changes the amount of time the width of the horizontal axis represents. More...
 
int timestamp_to_pixel (double time) const
 Converts a timestamp to a horizontal pixel offset. More...
 
void update ()
 Updates the chart with the latest data. More...
 
- Public Member Functions inherited from PStatGraph
 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. More...
 
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. More...
 
const GuideBarget_guide_bar (int n) const
 Returns the nth horizontal guide bar. More...
 
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. More...
 
int get_guide_bar_units () const
 Returns the units that are displayed for the guide bar labels. More...
 
int get_label_collector (int n) const
 Returns the collector index associated with the nth label. More...
 
LRGBColor get_label_color (int n) const
 Returns the color associated with the nth label. More...
 
std::string get_label_name (int n) const
 Returns the text associated with the nth label. More...
 
PStatMonitorget_monitor () const
 Returns the monitor associated with this chart. More...
 
int get_num_guide_bars () const
 Returns the number of horizontal guide bars that should be drawn, based on the indicated target frame rate. More...
 
int get_num_labels () const
 Returns the number of labels to be drawn for this chart. More...
 
int get_num_user_guide_bars () const
 Returns the current number of user-defined guide bars. More...
 
double get_target_frame_rate () const
 Returns the indicated target frame rate in Hz. More...
 
GuideBar get_user_guide_bar (int n) const
 Returns the nth user-defined guide bar. More...
 
int get_xsize () const
 Returns the width of the chart in pixels. More...
 
int get_ysize () const
 Returns the height of the chart in pixels. More...
 
void move_user_guide_bar (int n, double height)
 Adjusts the height of the nth user-defined guide bar. More...
 
void remove_user_guide_bar (int n)
 Removes the user guide bar with the indicated index number. More...
 
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. More...
 
void set_guide_bar_units (int unit_mask)
 Sets the units that are displayed for the guide bar labels. More...
 
void set_target_frame_rate (double frame_rate)
 Sets the target frame rate of the application in Hz. More...
 

Additional Inherited Members

- Public Types inherited from PStatGraph
enum  GuideBarStyle { GBS_normal, GBS_target, GBS_user }
 
enum  GuideBarUnits { GBU_hz = 0x0001, GBU_ms = 0x0002, GBU_named = 0x0004, GBU_show_units = 0x0008 }
 
- Static Public Member Functions inherited from PStatGraph
static std::string format_number (double value)
 Returns a string representing the value nicely formatted for its range. More...
 
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. More...
 

Detailed Description

This is an abstract class that presents the interface for drawing a piano- roll type chart: it shows the time spent in each of a number of collectors as a horizontal bar of color, with time as the horizontal axis.

This class just manages all the piano-roll logic; the actual nuts and bolts of drawing pixels is left to a user-derived class.

Definition at line 38 of file pStatPianoRoll.h.

Member Function Documentation

◆ get_horizontal_scale()

double PStatPianoRoll::get_horizontal_scale ( ) const
inline

Returns the amount of total time the width of the horizontal axis represents.

Definition at line 32 of file pStatPianoRoll.I.

◆ height_to_pixel()

int PStatPianoRoll::height_to_pixel ( double  value) const
inline

Converts a value (i.e.

a "height" in the strip chart) to a horizontal pixel offset.

Definition at line 57 of file pStatPianoRoll.I.

◆ pixel_to_height()

double PStatPianoRoll::pixel_to_height ( int  y) const
inline

Converts a horizontal pixel offset to a value (a "height" in the strip chart).

Definition at line 66 of file pStatPianoRoll.I.

◆ pixel_to_timestamp()

double PStatPianoRoll::pixel_to_timestamp ( int  x) const
inline

Converts a horizontal pixel offset to a timestamp.

Definition at line 48 of file pStatPianoRoll.I.

◆ set_horizontal_scale()

void PStatPianoRoll::set_horizontal_scale ( double  time_width)
inline

Changes the amount of time the width of the horizontal axis represents.

This may force a redraw.

Definition at line 19 of file pStatPianoRoll.I.

Referenced by WinStatsPianoRoll::set_horizontal_scale().

◆ timestamp_to_pixel()

int PStatPianoRoll::timestamp_to_pixel ( double  time) const
inline

Converts a timestamp to a horizontal pixel offset.

Definition at line 40 of file pStatPianoRoll.I.

◆ update()

void PStatPianoRoll::update ( )

The documentation for this class was generated from the following files: