Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PyCanvas Class Reference

#include <PyCanvas.h>

Collaboration diagram for PyCanvas:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class is the public interface the what the user sees as the canvas object from Python.

Requests:
Be able to retrieve, from Python, information on active displays on the canvas such as a display identifier, axis labels, etc .
..

Bug:
Windows only.
Calling this from a script freezes application. Probably cause is that we are directly calling method in one window from another. Probable fix is either to post event or to talk with the canvas instead of canvas window.

Author:
James Chiang <jchiang@slac.stanford.edu>

Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 41 of file 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 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.
QtCutgetCut ()
 Returns a QtCut object or null pointer if its not a QtCut object.
QtDisplaygetDisplay ()
 Returns the selected display on the canvas.
const std::vector< QtDisplay * > & getDisplays () const
 Returns all displays on the canvas.
const std::vector< std::string > & getTextRepTypes () const
 Returns the types of textual data representations available.
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 setPlotMatrix (unsigned int columns, unsigned int rows)
 Sets the number for columns and rows of plots on each page.
void show ()
 Displays the canvas window on the screen.

Private Member Functions

QtViewfindSelectedView (QtDisplay *display)
 Return the QtView associated with the given QtDisplay.

Private Attributes

QApplicationm_app
 The application object.
CanvasWindowm_canvas
 The actual canvas window in the application thread.
std::vector< QtDisplay * > m_displays
 Pointers to QtDisplay objects on the current canvas.


Constructor & Destructor Documentation

PyCanvas::PyCanvas CanvasWindow  ) 
 

A constructor taking as argument the real canvas used by this object.

Definition at line 173 of file PyCanvas.cxx.

References m_app, and m_canvas.

PyCanvas::PyCanvas  ) 
 

The default constructor.

Definition at line 179 of file PyCanvas.cxx.

References QApplication::lock(), m_app, m_canvas, and QApplication::unlock().


Member Function Documentation

void PyCanvas::addDisplay QtDisplay display_wrap  ) 
 

Adds the display to the canvas.

Definition at line 205 of file PyCanvas.cxx.

References CanvasWindow::addPlotDisplay(), QtDisplay::display(), QApplication::lock(), m_app, m_canvas, and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::addText QtDisplay display,
const std::string text
 

Add a BoxTextRep.

Definition at line 397 of file PyCanvas.cxx.

References CanvasWindow::addTextDisplay(), QtDisplay::display(), QApplication::lock(), m_app, m_canvas, PlotterBase::setActivePlot(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::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 416 of file PyCanvas.cxx.

References CanvasWindow::addTextDisplayAt(), QtDisplay::display(), QApplication::lock(), m_app, m_canvas, PlotterBase::setActivePlot(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::addTextRep QtDisplay display,
const std::string type
 

Adds a textual data representation to display or type type.

Definition at line 360 of file PyCanvas.cxx.

References FunctionController::instance(), m_app, and m_canvas.

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::clear  ) 
 

Removes all items from the CanvasWindow.

Definition at line 454 of file PyCanvas.cxx.

References m_app, and m_canvas.

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::close  ) 
 

Closes the canvas window.

Definition at line 198 of file PyCanvas.cxx.

References m_app, and m_canvas.

Referenced by hippodraw::Python::export_Canvas().

QtView * PyCanvas::findSelectedView QtDisplay display  )  [private]
 

Return the QtView associated with the given QtDisplay.

Definition at line 337 of file PyCanvas.cxx.

References QtDisplay::display(), ViewBase::getPlotter(), CanvasWindow::getViewFor(), m_canvas, and CanvasWindow::views().

Referenced by saveAsImage(), and selectDisplay().

QtCut * PyCanvas::getCut  ) 
 

Returns a QtCut object or null pointer if its not a QtCut object.

Definition at line 260 of file PyCanvas.cxx.

References m_canvas, and CanvasWindow::selectedPlotter().

Referenced by hippodraw::Python::export_Canvas().

QtDisplay * PyCanvas::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 226 of file PyCanvas.cxx.

References m_app, m_canvas, and CanvasWindow::selectedPlotter().

Referenced by hippodraw::Python::export_Canvas().

const std::vector< QtDisplay * > & PyCanvas::getDisplays  )  const
 

Returns all displays on the canvas.

Definition at line 239 of file PyCanvas.cxx.

References ViewBase::getPlotter(), QApplication::lock(), m_app, m_canvas, m_displays, QApplication::unlock(), and CanvasWindow::views().

Referenced by hippodraw::Python::export_Canvas().

const std::vector< std::string > & PyCanvas::getTextRepTypes  )  const
 

Returns the types of textual data representations available.

Definition at line 390 of file PyCanvas.cxx.

References DisplayController::instance().

Referenced by hippodraw::Python::export_Canvas().

const std::vector< double > & PyCanvas::mouseData  ) 
 

Retrieve a tuple of (x, y, z) points from the next mouse event.

Definition at line 435 of file PyCanvas.cxx.

References m_canvas, and CanvasWindow::mouseEventData().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::print const std::string filename  ) 
 

Prints the canvas to a PostScript file.

Definition at line 294 of file PyCanvas.cxx.

References m_app, and m_canvas.

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::removeDisplay QtDisplay display  ) 
 

Remove a display.

Definition at line 352 of file PyCanvas.cxx.

References QtDisplay::display(), m_canvas, and CanvasWindow::removeDisplay().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::saveAs const std::string filename  ) 
 

Saves the document to the specified file.

Definition at line 219 of file PyCanvas.cxx.

References QApplication::lock(), m_app, m_canvas, CanvasWindow::saveAs(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::saveAsImage QtDisplay display,
const std::string filename
 

Save the display as an image file.

Definition at line 301 of file PyCanvas.cxx.

References findSelectedView(), ViewBase::getPlotter(), QApplication::lock(), m_app, m_canvas, CanvasWindow::savePlotAsImageImmediate(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::saveSelectedImages const std::string filename  ) 
 

Save the selected images as an image file.

Definition at line 322 of file PyCanvas.cxx.

References CanvasWindow::fileSaveSelectedImages(), QApplication::lock(), m_app, m_canvas, and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::selectAllDisplays bool  flag = true  ) 
 

Select or un-select all the displays on the canvas.

Definition at line 276 of file PyCanvas.cxx.

References QApplication::lock(), m_app, m_canvas, and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::selectDisplay QtDisplay display  ) 
 

Select a specific display.

Definition at line 283 of file PyCanvas.cxx.

References findSelectedView(), QApplication::lock(), m_app, m_canvas, CanvasWindow::setSelected(), and QApplication::unlock().

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::setPlotMatrix unsigned int  columns,
unsigned int  rows
 

Sets the number for columns and rows of plots on each page.

Definition at line 442 of file PyCanvas.cxx.

References m_app, and m_canvas.

Referenced by hippodraw::Python::export_Canvas().

void PyCanvas::show  ) 
 

Displays the canvas window on the screen.

Definition at line 189 of file PyCanvas.cxx.

References m_app, and m_canvas.

Referenced by hippodraw::Python::export_Canvas().


Member Data Documentation

QApplication* PyCanvas::m_app [private]
 

The application object.

Definition at line 50 of file PyCanvas.h.

Referenced by addDisplay(), addText(), addTextAt(), addTextRep(), clear(), close(), getDisplay(), getDisplays(), print(), PyCanvas(), saveAs(), saveAsImage(), saveSelectedImages(), selectAllDisplays(), selectDisplay(), setPlotMatrix(), and show().

CanvasWindow* PyCanvas::m_canvas [private]
 

The actual canvas window in the application thread.

Definition at line 47 of file PyCanvas.h.

Referenced by addDisplay(), addText(), addTextAt(), addTextRep(), clear(), close(), findSelectedView(), getCut(), getDisplay(), getDisplays(), mouseData(), print(), PyCanvas(), removeDisplay(), saveAs(), saveAsImage(), saveSelectedImages(), selectAllDisplays(), selectDisplay(), setPlotMatrix(), and show().

std::vector<QtDisplay *> PyCanvas::m_displays [mutable, private]
 

Pointers to QtDisplay objects on the current canvas.

Definition at line 53 of file PyCanvas.h.

Referenced by getDisplays().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3