PyCanvas.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef PyCanvas_H
15 #define PyCanvas_H
16 
17 #include <string>
18 #include <vector>
19 
20 namespace hippodraw {
21 
22  class CanvasViewProxy;
23  class CanvasWindow;
24  class QtDisplay;
25  class QtCut;
26  class QtView;
27  class NTuple;
28 
43 class PyCanvas
44 {
45 
46 private:
47 
52 
58 
61  bool m_has_gui;
62 
64  mutable std::vector<QtDisplay *> m_displays;
65 
69  void check () const;
70 
72  QtView * findSelectedView ( QtDisplay * display );
73 
74 public:
75 
78  PyCanvas ( CanvasWindow * );
79 
81  PyCanvas ();
82 
85  void show ();
86 
89  void close ();
90 
93  void addDisplay ( QtDisplay * display_wrap );
94 
97  void saveAs ( const std::string & filename );
98 
102  QtDisplay * getDisplay ();
103 
105  const std::vector<QtDisplay *> & getDisplays () const;
106 
109  QtCut * getCut();
110 
112  void selectAllDisplays ( bool flag = true );
113 
115  void selectDisplay ( QtDisplay * display );
116 
119  void print ( const std::string & filename );
120 
122  void saveAsImage( QtDisplay * display, const std::string &filename );
123 
125  void saveSelectedImages(const std::string & filename);
126 
128  void removeDisplay ( QtDisplay * display );
129 
132  const std::vector < std::string > & getTextRepTypes () const;
133 
137  void addTextRep ( QtDisplay * display, const std::string & type );
138 
140  void addText( QtDisplay * display, const std::string &text );
141 
145  void addTextAt ( QtDisplay * display, const std::string &text,
146  double xrel, double yrel );
147 
151  void addTextAtAbs ( QtDisplay * display, const std::string &text,
152  double xabs, double yabs );
153 
156  const std::vector<double> & mouseData();
157 
161  void setPlotMatrix ( unsigned int columns, unsigned int rows );
162 
165  void swapOrientation ();
166 
169  void clear ();
170 
173  int getX ( QtDisplay * display ) const;
174 
177  int getY ( QtDisplay * display ) const;
178 
181  void setX ( QtDisplay * display, double value );
182 
185  void setY ( QtDisplay * display, double value );
186 
189  int getHeight ( QtDisplay * display ) const;
190 
193  int getWidth ( QtDisplay * display ) const;
194 
197  void setHeight ( QtDisplay *, double h );
198 
201  void setWidth ( QtDisplay *, double w );
202 
205  NTuple * getSelPickTable ();
206 
209  NTuple * getPickTable ( QtDisplay * );
210 
211 };
212 
213 } // namespace hippodraw
214 
215 #endif // PyCanvas_H
void clear()
Removes all items from the CanvasWindow.
Definition: PyCanvas.cxx:431
void selectDisplay(QtDisplay *display)
Select a specific display.
Definition: PyCanvas.cxx:207
Qt Displays wraps a derived class of Cut1DPlotter.
Definition: QtCut.h:42
void addText(QtDisplay *display, const std::string &text)
Add a BoxTextRep.
Definition: PyCanvas.cxx:322
A Proxy for the CanvasView class.
bool m_has_gui
Set to true if this canvas as associated GUI CanvasWindow.
Definition: PyCanvas.h:61
This class is the public interface the what the user sees as the canvas object from Python...
Definition: PyCanvas.h:43
int getY(QtDisplay *display) const
Returns the view&#39;s Y coordinate for the display.
Definition: PyCanvas.cxx:516
const std::vector< double > & mouseData()
Retrieve a tuple of (x, y, z) points from the next mouse event.
Definition: PyCanvas.cxx:401
int getHeight(QtDisplay *display) const
Returns the view&#39;s height for the display.
Definition: PyCanvas.cxx:440
void setHeight(QtDisplay *, double h)
Sets the height of the view for the display.
Definition: PyCanvas.cxx:469
CanvasWindow * m_canvas
The actual canvas window in the application thread.
Definition: PyCanvas.h:51
void close()
Closes the canvas window.
Definition: PyCanvas.cxx:94
void swapOrientation()
Swaps the orientation from portrait to landscape and vice verse.
Definition: PyCanvas.cxx:420
void addTextAt(QtDisplay *display, const std::string &text, double xrel, double yrel)
Add a BoxTextRep at a specific location in the selected display item&#39;s canvas coordinate system...
Definition: PyCanvas.cxx:342
void saveSelectedImages(const std::string &filename)
Save the selected images as an image file.
Definition: PyCanvas.cxx:250
void addTextRep(QtDisplay *display, const std::string &type)
Adds a textual data representation to display or type type.
Definition: PyCanvas.cxx:283
const std::vector< QtDisplay * > & getDisplays() const
Returns all displays on the canvas.
Definition: PyCanvas.cxx:160
void setY(QtDisplay *display, double value)
Sets the view&#39;s Y coordinate for the display.
Definition: PyCanvas.cxx:544
PyArray_TYPES type(numeric::array arr)
Definition: num_util.cpp:249
CanvasViewProxy * m_canvas_proxy
The proxy for the CanvasView object.
Definition: PyCanvas.h:57
void check() const
Checks if the CanvasWindow has been closed and throws a runtime_error if it has been.
Definition: PyCanvas.cxx:73
void setX(QtDisplay *display, double value)
Sets the view&#39;s X coordinate for the display.
Definition: PyCanvas.cxx:530
void addDisplay(QtDisplay *display_wrap)
Adds the display to the canvas.
Definition: PyCanvas.cxx:106
The class of derived from ViewBase and QCanvasRectangle for drawing on a QCanvas. ...
Definition: QtView.h:41
void saveAsImage(QtDisplay *display, const std::string &filename)
Save the display as an image file.
Definition: PyCanvas.cxx:230
void setWidth(QtDisplay *, double w)
Sets the width of the view for the display.
Definition: PyCanvas.cxx:485
const std::vector< std::string > & getTextRepTypes() const
Returns the types of textual data representations available.
Definition: PyCanvas.cxx:314
void saveAs(const std::string &filename)
Saves the document to the specified file.
Definition: PyCanvas.cxx:120
A DataSource class implemented with std::vector&lt;double&gt; to store the column data. ...
Definition: NTuple.h:33
void addTextAtAbs(QtDisplay *display, const std::string &text, double xabs, double yabs)
Add a BoxTextRep at a specific location in the selected display item&#39;s canvas coordinate system...
Definition: PyCanvas.cxx:362
void removeDisplay(QtDisplay *display)
Remove a display.
Definition: PyCanvas.cxx:274
void setPlotMatrix(unsigned int columns, unsigned int rows)
Sets the number for columns and rows of plots on each page.
Definition: PyCanvas.cxx:409
Qt Displays wraps a derived class of PlotterBase.
Definition: QtDisplay.h:71
int getWidth(QtDisplay *display) const
Returns the view&#39;s width for the display.
Definition: PyCanvas.cxx:454
void selectAllDisplays(bool flag=true)
Select or un-select all the displays on the canvas.
Definition: PyCanvas.cxx:199
std::vector< QtDisplay * > m_displays
Pointers to QtDisplay objects on the current canvas.
Definition: PyCanvas.h:64
NTuple * getPickTable(QtDisplay *)
Gets the PickTable for the display.
Definition: PyCanvas.cxx:569
PyCanvas()
The default constructor.
Definition: PyCanvas.cxx:57
QtDisplay * getDisplay()
Returns the selected display on the canvas.
Definition: PyCanvas.cxx:142
NTuple * getSelPickTable()
Gets the PickTable of selected display as a NTuple.
Definition: PyCanvas.cxx:558
QtView * findSelectedView(QtDisplay *display)
Return the QtView associated with the given QtDisplay.
Definition: PyCanvas.cxx:266
A concrete window class that contains the canvas and responds to menu item and tool bar events from t...
Definition: CanvasWindow.h:106
int getX(QtDisplay *display) const
Returns the view&#39;s X coordinate for the display.
Definition: PyCanvas.cxx:502
void show()
Displays the canvas window on the screen.
Definition: PyCanvas.cxx:84
QtCut * getCut()
Returns a QtCut object or null pointer if its not a QtCut object.
Definition: PyCanvas.cxx:182
void print(const std::string &filename)
Prints the canvas to a PostScript file.
Definition: PyCanvas.cxx:219

Generated for HippoDraw Class Library by doxygen