This class is the public interface the what the user sees as the canvas object from Python. More...
#include <PyCanvas.h>
Public Member Functions | |
void | addDisplay (QtDisplay *display_wrap) |
Adds the display to the canvas. | |
void | addText (QtDisplay *display, const std::string &text) |
Add a BoxTextRep. | |
void | addTextAt (QtDisplay *display, const std::string &text, double xrel, double yrel) |
Add a BoxTextRep at a specific location in the selected display item's canvas coordinate system. | |
void | addTextAtAbs (QtDisplay *display, const std::string &text, double xabs, double yabs) |
Add a BoxTextRep at a specific location in the selected display item's canvas coordinate system. | |
void | addTextRep (QtDisplay *display, const std::string &type) |
Adds a textual data representation to display or type type. | |
void | clear () |
Removes all items from the CanvasWindow. | |
void | close () |
Closes the canvas window. | |
QtCut * | getCut () |
Returns a QtCut object or null pointer if its not a QtCut object. | |
QtDisplay * | getDisplay () |
Returns the selected display on the canvas. | |
const std::vector< QtDisplay * > & | getDisplays () const |
Returns all displays on the canvas. | |
int | getHeight (QtDisplay *display) const |
Returns the view's height for the display. | |
NTuple * | getPickTable (QtDisplay *) |
Gets the PickTable for the display. | |
NTuple * | getSelPickTable () |
Gets the PickTable of selected display as a NTuple. | |
const std::vector< std::string > & | getTextRepTypes () const |
Returns the types of textual data representations available. | |
int | getWidth (QtDisplay *display) const |
Returns the view's width for the display. | |
int | getX (QtDisplay *display) const |
Returns the view's X coordinate for the display. | |
int | getY (QtDisplay *display) const |
Returns the view's Y coordinate for the display. | |
const std::vector< double > & | mouseData () |
Retrieve a tuple of (x, y, z) points from the next mouse event. | |
void | print (const std::string &filename) |
Prints the canvas to a PostScript file. | |
PyCanvas () | |
The default constructor. | |
PyCanvas (CanvasWindow *) | |
A constructor taking as argument the real canvas used by this object. | |
void | removeDisplay (QtDisplay *display) |
Remove a display. | |
void | saveAs (const std::string &filename) |
Saves the document to the specified file. | |
void | saveAsImage (QtDisplay *display, const std::string &filename) |
Save the display as an image file. | |
void | saveSelectedImages (const std::string &filename) |
Save the selected images as an image file. | |
void | selectAllDisplays (bool flag=true) |
Select or un-select all the displays on the canvas. | |
void | selectDisplay (QtDisplay *display) |
Select a specific display. | |
void | setHeight (QtDisplay *, double h) |
Sets the height of the view for the display. | |
void | setPlotMatrix (unsigned int columns, unsigned int rows) |
Sets the number for columns and rows of plots on each page. | |
void | setWidth (QtDisplay *, double w) |
Sets the width of the view for the display. | |
void | setX (QtDisplay *display, double value) |
Sets the view's X coordinate for the display. | |
void | setY (QtDisplay *display, double value) |
Sets the view's Y coordinate for the display. | |
void | show () |
Displays the canvas window on the screen. | |
void | swapOrientation () |
Swaps the orientation from portrait to landscape and vice verse. | |
Private Member Functions | |
void | check () const |
Checks if the CanvasWindow has been closed and throws a runtime_error if it has been. | |
QtView * | findSelectedView (QtDisplay *display) |
Return the QtView associated with the given QtDisplay. | |
Private Attributes | |
CanvasWindow * | m_canvas |
The actual canvas window in the application thread. | |
CanvasViewProxy * | m_canvas_proxy |
The proxy for the CanvasView object. | |
std::vector< QtDisplay * > | m_displays |
Pointers to QtDisplay objects on the current canvas. | |
bool | m_has_gui |
Set to true if this canvas as associated GUI CanvasWindow. |
This class is the public interface the what the user sees as the canvas object from Python.
Definition at line 43 of file PyCanvas.h.
PyCanvas | ( | CanvasWindow * | window | ) |
A constructor taking as argument the real canvas used by this object.
Definition at line 45 of file PyCanvas.cxx.
References PyCanvas::m_canvas, and PyCanvas::m_canvas_proxy.
PyCanvas | ( | ) |
The default constructor.
Try running batchmode.py
Definition at line 57 of file PyCanvas.cxx.
References PyApp::lock(), PyCanvas::m_canvas, PyCanvas::m_canvas_proxy, and PyApp::unlock().
void addDisplay | ( | QtDisplay * | display_wrap | ) |
Adds the display to the canvas.
Definition at line 106 of file PyCanvas.cxx.
References PyCanvas::check(), QtDisplay::display(), PyApp::hasPendingEvents(), PyCanvas::m_canvas_proxy, PyCanvas::m_displays, and PyCanvas::m_has_gui.
void addText | ( | QtDisplay * | display, | |
const std::string & | text | |||
) |
Add a BoxTextRep.
Definition at line 322 of file PyCanvas.cxx.
References CanvasWindow::addTextDisplay(), PyCanvas::check(), QtDisplay::display(), PyApp::lock(), PyCanvas::m_canvas, PlotterBase::setActivePlot(), and PyApp::unlock().
void addTextAt | ( | QtDisplay * | display, | |
const std::string & | text, | |||
double | xrel, | |||
double | yrel | |||
) |
Add a BoxTextRep at a specific location in the selected display item's canvas coordinate system.
Definition at line 342 of file PyCanvas.cxx.
References CanvasWindow::addTextDisplayAt(), PyCanvas::check(), QtDisplay::display(), PyApp::lock(), PyCanvas::m_canvas, PlotterBase::setActivePlot(), and PyApp::unlock().
void addTextAtAbs | ( | QtDisplay * | display, | |
const std::string & | text, | |||
double | xabs, | |||
double | yabs | |||
) |
Add a BoxTextRep at a specific location in the selected display item's canvas coordinate system.
Definition at line 362 of file PyCanvas.cxx.
References CanvasWindow::addTextDisplayAt(), PyCanvas::check(), QtDisplay::display(), PlotterBase::getTransform(), Range::high(), PyApp::lock(), Range::low(), PyCanvas::m_canvas, PlotterBase::setActivePlot(), BinaryTransform::transform(), PyApp::unlock(), hippodraw::Axes::X, and hippodraw::Axes::Y.
void addTextRep | ( | QtDisplay * | display, | |
const std::string & | type | |||
) |
Adds a textual data representation to display or type type.
Definition at line 283 of file PyCanvas.cxx.
References PyCanvas::check(), FunctionController::instance(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void check | ( | ) | const [private] |
Checks if the CanvasWindow has been closed and throws a runtime_error if it has been.
Definition at line 73 of file PyCanvas.cxx.
References PyCanvas::m_canvas.
Referenced by PyCanvas::addDisplay(), PyCanvas::addText(), PyCanvas::addTextAt(), PyCanvas::addTextAtAbs(), PyCanvas::addTextRep(), PyCanvas::clear(), PyCanvas::findSelectedView(), PyCanvas::getCut(), PyCanvas::getDisplay(), PyCanvas::getDisplays(), PyCanvas::getHeight(), PyCanvas::getPickTable(), PyCanvas::getSelPickTable(), PyCanvas::getTextRepTypes(), PyCanvas::getWidth(), PyCanvas::getX(), PyCanvas::getY(), PyCanvas::mouseData(), PyCanvas::print(), PyCanvas::removeDisplay(), PyCanvas::saveAs(), PyCanvas::saveSelectedImages(), PyCanvas::selectAllDisplays(), PyCanvas::selectDisplay(), PyCanvas::setHeight(), PyCanvas::setPlotMatrix(), PyCanvas::setWidth(), PyCanvas::setX(), PyCanvas::setY(), PyCanvas::show(), and PyCanvas::swapOrientation().
void clear | ( | ) |
Removes all items from the CanvasWindow.
Definition at line 443 of file PyCanvas.cxx.
References PyCanvas::check(), and PyCanvas::m_canvas_proxy.
void close | ( | ) |
Closes the canvas window.
Definition at line 94 of file PyCanvas.cxx.
References PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
Return the QtView associated with the given QtDisplay.
Definition at line 266 of file PyCanvas.cxx.
References PyCanvas::check(), QtDisplay::display(), and PyCanvas::m_canvas.
Referenced by PyCanvas::saveAsImage(), and PyCanvas::selectDisplay().
QtCut * getCut | ( | ) |
Returns a QtCut object or null pointer if its not a QtCut object.
Definition at line 182 of file PyCanvas.cxx.
References PyCanvas::check(), PyCanvas::m_canvas, and CanvasWindow::selectedPlotter().
QtDisplay * getDisplay | ( | ) |
Returns the selected display on the canvas.
If none or more than one display is selected, this routine returns a null pointer
Definition at line 142 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, CanvasWindow::selectedPlotter(), and PyApp::unlock().
const std::vector< QtDisplay * > & getDisplays | ( | ) | const |
Returns all displays on the canvas.
Definition at line 160 of file PyCanvas.cxx.
References PyCanvas::check(), ViewBase::getPlotter(), PyApp::lock(), PyCanvas::m_canvas, PyCanvas::m_displays, PyApp::unlock(), and CanvasWindow::views().
int getHeight | ( | QtDisplay * | display | ) | const |
Returns the view's height for the display.
Definition at line 452 of file PyCanvas.cxx.
References PyCanvas::check(), and PyCanvas::m_canvas.
Gets the PickTable for the display.
Definition at line 581 of file PyCanvas.cxx.
References PyCanvas::check(), QtDisplay::display(), CanvasWindow::getPickTable(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
NTuple * getSelPickTable | ( | ) |
Gets the PickTable of selected display as a NTuple.
Definition at line 570 of file PyCanvas.cxx.
References PyCanvas::check(), CanvasWindow::getPickTable(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
const std::vector< std::string > & getTextRepTypes | ( | ) | const |
Returns the types of textual data representations available.
Definition at line 314 of file PyCanvas.cxx.
References PyCanvas::check(), and DisplayController::instance().
int getWidth | ( | QtDisplay * | display | ) | const |
Returns the view's width for the display.
Definition at line 466 of file PyCanvas.cxx.
References PyCanvas::check(), and PyCanvas::m_canvas.
int getX | ( | QtDisplay * | display | ) | const |
Returns the view's X coordinate for the display.
Definition at line 514 of file PyCanvas.cxx.
References PyCanvas::check(), and PyCanvas::m_canvas.
int getY | ( | QtDisplay * | display | ) | const |
Returns the view's Y coordinate for the display.
Definition at line 528 of file PyCanvas.cxx.
References PyCanvas::check(), and PyCanvas::m_canvas.
const std::vector< double > & mouseData | ( | ) |
Retrieve a tuple of (x, y, z) points from the next mouse event.
Definition at line 413 of file PyCanvas.cxx.
References PyCanvas::check(), PyCanvas::m_canvas, and CanvasWindow::mouseEventData().
void print | ( | const std::string & | filename | ) |
Prints the canvas to a PostScript file.
Definition at line 219 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void removeDisplay | ( | QtDisplay * | display | ) |
Remove a display.
Definition at line 274 of file PyCanvas.cxx.
References PyCanvas::check(), QtDisplay::display(), PyCanvas::m_canvas, and CanvasWindow::removeDisplay().
void saveAs | ( | const std::string & | filename | ) |
Saves the document to the specified file.
Definition at line 120 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, PyCanvas::m_displays, PyCanvas::m_has_gui, CanvasWindow::saveAs(), num_util::size(), and PyApp::unlock().
void saveAsImage | ( | QtDisplay * | display, | |
const std::string & | filename | |||
) |
Save the display as an image file.
Definition at line 230 of file PyCanvas.cxx.
References PyCanvas::findSelectedView(), ViewBase::getPlotter(), PyCanvas::m_canvas_proxy, and PyApp::unlock().
void saveSelectedImages | ( | const std::string & | filename | ) |
Save the selected images as an image file.
Definition at line 250 of file PyCanvas.cxx.
References PyCanvas::check(), CanvasWindow::fileSaveSelectedImages(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void selectAllDisplays | ( | bool | flag = true |
) |
Select or un-select all the displays on the canvas.
Definition at line 199 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void selectDisplay | ( | QtDisplay * | display | ) |
Select a specific display.
Definition at line 207 of file PyCanvas.cxx.
References PyCanvas::check(), PyCanvas::findSelectedView(), PyApp::lock(), PyCanvas::m_canvas, CanvasWindow::setSelected(), and PyApp::unlock().
void setHeight | ( | QtDisplay * | display, | |
double | h | |||
) |
Sets the height of the view for the display.
Definition at line 481 of file PyCanvas.cxx.
References PyCanvas::check(), Rect::getWidth(), Rect::getX(), Rect::getY(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void setPlotMatrix | ( | unsigned int | columns, | |
unsigned int | rows | |||
) |
Sets the number for columns and rows of plots on each page.
Definition at line 421 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void setWidth | ( | QtDisplay * | display, | |
double | w | |||
) |
Sets the width of the view for the display.
Definition at line 497 of file PyCanvas.cxx.
References PyCanvas::check(), Rect::getHeight(), Rect::getX(), Rect::getY(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void setX | ( | QtDisplay * | display, | |
double | value | |||
) |
Sets the view's X coordinate for the display.
Definition at line 542 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void setY | ( | QtDisplay * | display, | |
double | value | |||
) |
Sets the view's Y coordinate for the display.
Definition at line 556 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void show | ( | ) |
Displays the canvas window on the screen.
Definition at line 84 of file PyCanvas.cxx.
References PyCanvas::check(), PyApp::lock(), PyCanvas::m_canvas, and PyApp::unlock().
void swapOrientation | ( | ) |
Swaps the orientation from portrait to landscape and vice verse.
Definition at line 432 of file PyCanvas.cxx.
References PyCanvas::check(), and PyCanvas::m_canvas_proxy.
CanvasWindow* m_canvas [private] |
The actual canvas window in the application thread.
Definition at line 51 of file PyCanvas.h.
Referenced by PyCanvas::addText(), PyCanvas::addTextAt(), PyCanvas::addTextAtAbs(), PyCanvas::addTextRep(), PyCanvas::check(), PyCanvas::close(), PyCanvas::findSelectedView(), PyCanvas::getCut(), PyCanvas::getDisplay(), PyCanvas::getDisplays(), PyCanvas::getHeight(), PyCanvas::getPickTable(), PyCanvas::getSelPickTable(), PyCanvas::getWidth(), PyCanvas::getX(), PyCanvas::getY(), PyCanvas::mouseData(), PyCanvas::print(), PyCanvas::PyCanvas(), PyCanvas::removeDisplay(), PyCanvas::saveAs(), PyCanvas::saveSelectedImages(), PyCanvas::selectAllDisplays(), PyCanvas::selectDisplay(), PyCanvas::setHeight(), PyCanvas::setPlotMatrix(), PyCanvas::setWidth(), PyCanvas::setX(), PyCanvas::setY(), and PyCanvas::show().
CanvasViewProxy* m_canvas_proxy [private] |
The proxy for the CanvasView object.
All messages to the CanvasView should go through the proxy so that it is thread safe.
Definition at line 57 of file PyCanvas.h.
Referenced by PyCanvas::addDisplay(), PyCanvas::clear(), PyCanvas::PyCanvas(), PyCanvas::saveAsImage(), and PyCanvas::swapOrientation().
std::vector<QtDisplay *> m_displays [mutable, private] |
Pointers to QtDisplay objects on the current canvas.
Definition at line 64 of file PyCanvas.h.
Referenced by PyCanvas::addDisplay(), PyCanvas::getDisplays(), and PyCanvas::saveAs().
bool m_has_gui [private] |
Set to true
if this canvas as associated GUI CanvasWindow.
Definition at line 61 of file PyCanvas.h.
Referenced by PyCanvas::addDisplay(), and PyCanvas::saveAs().