Panda3D
|
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"
Classes | |
class | BarBuilder |
class | ColorBar |
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. | |
int | height_to_pixel (double value) const |
Converts a value (i.e. | |
double | pixel_to_height (int y) const |
Converts a horizontal pixel offset to a value (a "height" in the strip chart). | |
double | pixel_to_timestamp (int x) const |
Converts a horizontal pixel offset to a timestamp. | |
void | set_horizontal_scale (double time_width) |
Changes the amount of time the width of the horizontal axis represents. | |
int | timestamp_to_pixel (double time) const |
Converts a timestamp to a horizontal pixel offset. | |
void | update () |
Updates the chart with the latest data. | |
Protected Member Functions | |
virtual void | begin_draw () |
Should be overridden by the user class. | |
virtual void | begin_row (int row) |
Should be overridden by the user class. | |
void | changed_size (int xsize, int ysize) |
To be called by the user class when the widget size has changed. | |
virtual void | draw_bar (int row, int from_x, int to_x) |
Draws a single bar in the chart for the indicated row, in the color get_row_color(row), for the indicated horizontal pixel range. | |
virtual void | end_draw () |
Should be overridden by the user class. | |
virtual void | end_row (int row) |
Should be overridden by the user class. | |
void | force_redraw () |
To be called by the user class when the whole thing needs to be redrawn for some reason. | |
virtual void | idle () |
Should be overridden by the user class to perform any other updates might be necessary after the bars have been redrawn. | |
virtual void | normal_guide_bars () |
Calls update_guide_bars with parameters suitable to this kind of graph. | |
Protected Attributes | |
int | _thread_index |
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 43 of file pStatPianoRoll.h.
void PStatPianoRoll::begin_draw | ( | ) | [protected, virtual] |
Should be overridden by the user class.
This hook will be called before drawing any bars in the chart.
Reimplemented in GtkStatsPianoRoll, and WinStatsPianoRoll.
Definition at line 212 of file pStatPianoRoll.cxx.
Referenced by force_redraw().
void PStatPianoRoll::begin_row | ( | int | row | ) | [protected, virtual] |
Should be overridden by the user class.
This hook will be called before drawing any one row of bars. These bars correspond to the collector whose index is get_row_collector(row), and in the color get_row_color(row).
Definition at line 225 of file pStatPianoRoll.cxx.
Referenced by force_redraw().
void PStatPianoRoll::changed_size | ( | int | xsize, |
int | ysize | ||
) | [protected] |
To be called by the user class when the widget size has changed.
This updates the chart's internal data and causes it to issue redraw commands to reflect the new size.
Definition at line 157 of file pStatPianoRoll.cxx.
References force_redraw(), and normal_guide_bars().
Referenced by GtkStatsPianoRoll::changed_graph_size(), and WinStatsPianoRoll::changed_graph_size().
void PStatPianoRoll::draw_bar | ( | int | row, |
int | from_x, | ||
int | to_x | ||
) | [protected, virtual] |
Draws a single bar in the chart for the indicated row, in the color get_row_color(row), for the indicated horizontal pixel range.
Reimplemented in GtkStatsPianoRoll, and WinStatsPianoRoll.
Definition at line 236 of file pStatPianoRoll.cxx.
Referenced by force_redraw().
void PStatPianoRoll::end_draw | ( | ) | [protected, virtual] |
Should be overridden by the user class.
This hook will be called after drawing a series of color bars in the chart.
Reimplemented in GtkStatsPianoRoll, and WinStatsPianoRoll.
Definition at line 258 of file pStatPianoRoll.cxx.
Referenced by force_redraw().
void PStatPianoRoll::end_row | ( | int | row | ) | [protected, virtual] |
Should be overridden by the user class.
This hook will be called after drawing a series of color bars for a single row.
Definition at line 247 of file pStatPianoRoll.cxx.
Referenced by force_redraw().
void PStatPianoRoll::force_redraw | ( | ) | [protected] |
To be called by the user class when the whole thing needs to be redrawn for some reason.
Reimplemented in GtkStatsPianoRoll, and WinStatsPianoRoll.
Definition at line 174 of file pStatPianoRoll.cxx.
References begin_draw(), begin_row(), draw_bar(), end_draw(), end_row(), and timestamp_to_pixel().
Referenced by changed_size(), set_horizontal_scale(), and update().
double PStatPianoRoll::get_horizontal_scale | ( | ) | const [inline] |
Returns the amount of total time the width of the horizontal axis represents.
Definition at line 37 of file pStatPianoRoll.I.
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 68 of file pStatPianoRoll.I.
void PStatPianoRoll::idle | ( | ) | [protected, virtual] |
Should be overridden by the user class to perform any other updates might be necessary after the bars have been redrawn.
Reimplemented in GtkStatsPianoRoll, and WinStatsPianoRoll.
Definition at line 269 of file pStatPianoRoll.cxx.
Referenced by update().
void PStatPianoRoll::normal_guide_bars | ( | ) | [protected, virtual] |
Calls update_guide_bars with parameters suitable to this kind of graph.
Implements PStatGraph.
Definition at line 200 of file pStatPianoRoll.cxx.
References PStatGraph::get_xsize(), and PStatGraph::update_guide_bars().
Referenced by changed_size(), and set_horizontal_scale().
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 79 of file pStatPianoRoll.I.
double PStatPianoRoll::pixel_to_timestamp | ( | int | x | ) | const [inline] |
Converts a horizontal pixel offset to a timestamp.
Definition at line 57 of file pStatPianoRoll.I.
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.
Reimplemented in GtkStatsPianoRoll, and WinStatsPianoRoll.
Definition at line 22 of file pStatPianoRoll.I.
References force_redraw(), and normal_guide_bars().
Referenced by GtkStatsPianoRoll::set_horizontal_scale(), and WinStatsPianoRoll::set_horizontal_scale().
int PStatPianoRoll::timestamp_to_pixel | ( | double | time | ) | const [inline] |
Converts a timestamp to a horizontal pixel offset.
Definition at line 47 of file pStatPianoRoll.I.
Referenced by force_redraw().
void PStatPianoRoll::update | ( | ) |
Updates the chart with the latest data.
Definition at line 126 of file pStatPianoRoll.cxx.
References force_redraw(), PStatThreadData::get_frame(), PStatThreadData::get_latest_frame_number(), PStatClientData::get_num_collectors(), PStatClientData::get_num_threads(), PStatClientData::get_thread_data(), idle(), and PStatThreadData::is_empty().