#include <CanvasView.h>
Inheritance diagram for CanvasView:


Sanket B. Malde <sanket@stanford.edu>
Definition at line 77 of file CanvasView.h.
Public Member Functions | |
| void | add (QCanvasItem *item) |
| Adds the item to the canvas. | |
| void | addFromPasteboard () |
| Adds from pasteboard. | |
| void | addFuncDisplay (PlotterBase *plotter, const std::string &s) |
| Add a text display which displays functions parameters. | |
| void | addPage () |
| Adds a page to the canvas. | |
| void | addPlotDisplay (PlotterBase *plotter) |
| Creates a QtView object for the display and inserts it onto the canvas in the next available free place. | |
| void | addPlotDisplay (PlotterBase *plotter, bool select) |
| Creates a QtView object for the display and inserts it onto the canvas in the next available free place. | |
| void | addSelectedItem (QCanvasItem *item) |
| Add an item to the selected list. | |
| void | addTextDisplay (PlotterBase *plotter, const std::string &s, const std::string &text=std::string()) |
| Add a display of text Adds a display of text to that will be associated with plotter. | |
| std::pair< double, double > | addTextDisplayAt (PlotterBase *plotter, const std::string &type, const std::string &text, double xrel, double yrel) |
| Adds a text display at the relative position (xrel, yrel) in the selected item's coordinates. | |
| const std::string & | applicationName () const |
| Returns the name of the application. | |
| canvas () const | |
| CanvasView (QCanvas *, QWidget *parent=0, const char *name=0, Qt::WFlags f=0) | |
| void | clear () |
| Removes all the QCanvasItem objects from the canvas. | |
| void | copyFromPasteboard () |
| Copies from the pasteboard. | |
| void | copySelectedToPasteboard () |
| Copies selected items to pasteboard. | |
| void | deleteSelected (bool paste) |
| Removes the selected items from canvas and copies them to the pasteboard. | |
| drawContents (QPainter *p, int cx, int cy, int cw, int ch) | |
| void | ensureVisible (const QCanvasItem *item) |
| Scrolls the canvas, if needed, so the QCanvasItem item is visible. | |
| void | exportTextTuple (const std::string &suffix) |
| Saves the DataSource as a text NTuple. | |
| void | fillPlotterList (std::vector< PlotterBase * > &plotter_list) |
| Clears and fills plotter_list with all the PlotterBase objects on the canvas. | |
| std::vector< double > & | getCurrentRange () |
| Returns the current range of the selected plotter. | |
| Inspector * | getInspector () |
| Gets the inspector object. | |
| std::vector< QCanvasItem * > & | getSelectedItems () |
| Return the vector of selected items. | |
| std::vector< PlotterBase * > | getSelectedPlotters () const |
| Returns a list of selected plotters. | |
| QtView * | getViewFor (const PlotterBase *plotter) const |
| Returns the QtView object that is the Observer of the plotter. | |
| bool | getZoomMode () const |
| Returns the bool indicating whether zoom mode is enabled or not. | |
| void | helpAbout () |
| Brings up dialog version numbers and contributors. | |
| void | initFrom (const std::list< ViewBase * > &views) |
| void | initFromFile (const std::string &filename) |
| Initializes canvas from data in file filename. | |
| inverseWorldMatrix () const | |
| bool | isSingleItemSelected () const |
| Returns true if just one item is selected, else returns false. | |
| const std::vector< double > & | mouseEventData () |
| Retrieve a vector of (x, y, z) points from the next mouse event. | |
| void | notifyObservers () |
| Notifies observers of a change in CanvasView. | |
| void | paste (QCanvasItem *item) |
| Adds the item to the canvas. | |
| void | pasteViews (const std::list< ViewBase * > &views) |
| Adds the views to the canvas. | |
| void | placeGraph (QCanvasRectangle *) |
| Moves the QCanvasRectangle object to place on the canvas where it will not collide with existing QCanvasItem object and not be off the usable page area. | |
| void | previousView () |
| Switches View to the previous view for the selected item on the canvas. | |
| virtual void | print (const std::string &filename) |
| Prints the view to Postscript file filename. | |
| virtual void | print () |
| Prints the canvas. | |
| void | remove (QCanvasItem *item) |
| Removes the item from the canvas and destroys it. | |
| void | removeDisplay (PlotterBase *plotter) |
| Removes the display from the canvas. | |
| void | removeSelected () |
| Removes the selected objects from the canvas. | |
| void | removeSelectedItem (QCanvasItem *item) |
| Removes an item from the selection list. | |
| void | resizeEvent (QResizeEvent *e) |
| Resizes the QCanvas in response to parent window receiving QResizeEvent. | |
| void | restoreFromSelectCopy () |
| Restores the selected views from the selection copy. | |
| void | reTile () |
| Re-tiles the canvas. | |
| void | reTilePage () |
| Re-tiles the current page. | |
| void | saveAs (const std::string &filename) const |
| Saves the canvas to a XML file. | |
| void | savePlotAsImage (const PlotterBase *, const std::string &filename) |
| Saves the selected plot as image file filename. | |
| void | saveSelectedImages (const std::string &filename) |
| Save the selected objects to an image file, overwriting the file. | |
| void | saveSelectedImages () |
| Saves the selected QCanvasItem objects to a image file. | |
| void | scaleBy (double factor) |
| Scales the size of the images by factor. | |
| QCanvasItem * | selectedItem () const |
| Returns the selected QCanvasItem. | |
| PlotterBase * | selectedPlotter () const |
| Returns the selected PlotterBase object. | |
| const std::vector< const ViewBase * > & | selectedViews () const |
| Returns temporary list of selected QtView objects on the canvas. | |
| void | setAddedSelected (bool yes) |
| Sets to flag to make plot in its selected state when added to the canvas. | |
| void | setAllSelected (bool flag=true) |
| Sets selection flag on all QCanvasItem objects. | |
| setCanvas (QCanvas *canvas) | |
| void | setCurrentRange () |
| Saves the current range of the selected plotter. | |
| void | setFonts (const QFont &font) |
| Sets the fonts for the views. | |
| void | setInspector (Inspector *inspector) |
| Sets the Inspector object. | |
| void | setIntervalEnabled (bool yes=true) |
Sets the display interval feature of all views to enabled if yes is true, otherwise sets the feature to disable. | |
| void | setLocked (bool flag) |
| Sets the selected QCanvasItem to be locked in size and position. | |
| void | setPlotMatrix (unsigned int columns, unsigned int rows) |
| Sets the number of columns and rows of plots displayed on each page. | |
| void | setPrinterSettings () |
| Set the default printer settings. | |
| void | setSelectedFlags () |
| Set the selected flags. | |
| void | setSelectedItem (QCanvasItem *) |
| Set the selected QCanvasItem. | |
| void | setup () |
| Raises the settings dialog. | |
| setWorldMatrix (const QWMatrix &wm) | |
| void | setZoomMode (bool flag) |
| Sets the zoom mode to flag. | |
| void | showInspector () |
| Show the Inspector window. | |
| void | showPrinterMargins (bool on) |
| Sets showing the printer margins on or off. | |
| sizeHint () const | |
| const std::vector< const ViewBase * > & | views () const |
| Returns temporary list of all QtView objects on the canvas. | |
| void | viewShowPickTable () |
| Show the pick table. | |
| void | viewZoomIn () |
| Enlarges the view of the canvas. | |
| void | viewZoomOut () |
| Reduces the view of the canvas. | |
| void | viewZoomReset () |
| Returns the view to normal size. | |
| worldMatrix () const | |
Static Public Member Functions | |
| static void | setAppKey (const std::string &) |
| Sets the QSettings application key. | |
Protected Types | |
| enum | Location { none, invalid, upper_left, upper_middle, upper_right, middle_left, middle_right, lower_left, lower_middle, lower_right } |
| Possible locations where on a QCanvasItem the mouse cursor was when clicked. More... | |
Protected Member Functions | |
| void | addPageMargin (int x, int y) |
| Adds page margin. | |
| void | calcPrinterMetrics () |
| Calculate the size of a page by using the printer metrics. | |
| void | clearSelectedList () |
| De-selects all items, making the selection list empty. | |
| void | contentsMouseMoveEvent (QMouseEvent *, double aspect) |
| Moves or resizes the selected QCanvasItem object. | |
| virtual void | contentsMouseMoveEvent (QMouseEvent *) |
| Overrides the QScrollView event handler. | |
| virtual void | contentsMousePressEvent (QMouseEvent *) |
| virtual void | contentsMouseReleaseEvent (QMouseEvent *) |
| Overrides inherited method to receive mouse released events. | |
| virtual void | controlMousePressEvent () |
| Overrides inherited method to receive mouse pressed events. | |
| QRect | getSelectedBounds () const |
| Returns a QRect that enclosed the selected QCanvasItem objects. | |
| void | initPrinter () |
| Initializes the printer settings from the saved settings. | |
| double | maximumZ () const |
| Returns the largest Z value of all the items on the canvas. | |
| void | placeGraphOnSelected (QCanvasRectangle *item) |
| Adds the item on top of the currently selected item. | |
| void | print (QPrinter *printer) |
| Prints the view to the printer. | |
| void | removeFromItemList (QCanvasItem *item) |
| Removes the item from list of items on the canvas. | |
| void | resizeCanvasToFit (QCanvasItem *item) |
| Resizes the canvas if necessary so that the item is on the canvas. | |
| void | saveAreaAsPixmap (const QRect &area, const std::string &filename) |
| Saves the area area as pixmap to file filename. | |
| void | savePrinterSettings () |
| Saves the printer setting with QSettings. | |
| void | saveSelectedAsPixmap (const std::string &filename) |
| Save the selected objects as Pixmap image file filename. | |
| void | setCollidingSelected (const QCanvasItem *target) |
| Sets all QCanvasItems that collide with target to selected state. | |
| void | setSelectedItems (bool state) |
| Sets the selected items to selection state state. | |
| void | setUnselectedVisible (bool yes) |
| Sets the unselected items to visible or not. | |
| void | whereClicked () |
| Finds which knob on the selected item was clicked. | |
Protected Attributes | |
| int | m_apage_h |
| The actual Page height in Postscript points. | |
| int | m_apage_w |
| The actual Page width in Postscript points. | |
| QCanvas * | m_canvas |
| The canvas object. | |
| std::vector< QCanvasItem * > | m_items |
| The list of view items on the canvas. | |
| bool | m_printer_bounds |
| A flag to indicate if rectangle display usable printer boundary should be displayed or not. | |
| double | m_scale_factor |
| The scale factor. | |
| std::vector< QCanvasItem * > | m_selected_list |
| The list of currently selected QCanvasItem objects. | |
| int | m_upage_h |
| The usable Page height in Postscript points. | |
| int | m_upage_w |
| The usable Page width in Postscript points. | |
| Location | m_whereClicked |
| Location where the mouse cursor clicked the object. | |
| bool | m_zoom_mode |
Set to true if zoom Mode is enabled. | |
| QPoint | moving_start |
| The starting point of a mouse drag. | |
| QPoint | zoom_start |
| The starting point of a mouse drag.for zoom. | |
Static Protected Attributes | |
| static QString | s_app_key |
| The QSettings application key for searching for setting. | |
| static QPrinter * | s_printer = 0 |
| The single QPrinter instance. | |
| static QString | s_registry |
| The QSettings Windows registry key. | |
Private Member Functions | |
| void | addView (QtView *view, bool select) |
| Adds a QtView object to the CanvasView. | |
| virtual void | calcDefaultSize (QtView *view, double aspect_ratio=0.0) |
| Sets the default size and position for the view. | |
| QFileDialog * | createImageDialog () |
| Creates the QFileDialog with supported filters string for supported image types. | |
| bool | existingFileWarning (const std::string &filename) |
| Raises dialog to query over writing existing file. | |
| void | fillSelectedWithObservers (std::vector< const ViewBase * > &) |
| Fills the input vector with selected items and their observers. | |
| void | initSettings () |
| Initialize the settings save from previous session. | |
| void | invalidImageFormatError (const std::string &filename) |
| Raises dialog box for error in image format. | |
| void | moveToPlotter (const PlotterBase *plotter, QtView *view) |
| Moves the view to a nice position with respect to the plotter's QCanvasItem. | |
| std::pair< double, double > | moveToPlotterAt (const PlotterBase *plotter, QtView *view, double x, double y) |
| Moves the view to the specified position with respect to the currently view for plotter. | |
| void | placeItems (const std::vector< QCanvasItem * > &items) |
| Places each item in items on the canvas. | |
| void | saveSelectedAsEps (const std::string &filename) |
| Saves the selected objects as EPS image file filename. | |
| void | saveSelectedImages (const std::string &filename, bool check_existing) |
| Saves the selected objects to image file filename. | |
| void | saveSettings () const |
| Saves the settings for use in future session. | |
| void | setChanged (bool yes=true) |
| Sets the canvas as being changed. | |
| void | setVisibleNonViews (bool visible) |
| Sets visible state of QCanvasItem objects that are not also QtView objects to visible. | |
Static Private Member Functions | |
| static void | createImageFilters () |
| Creates the image filters string. | |
| static bool | isValidImageFormat (const std::string &suffix) |
Returns true if suffix string is one for valid image format. | |
| static void | toLower (std::string &upper) |
| Converts the string to lower case. | |
Private Attributes | |
| QCanvasRectangle * | drag_rect |
| Rectangle showing the area which is to be magnified. | |
| bool | m_add_selected |
Set to true if displays should be selected when added. | |
| std::vector< double > | m_current_range |
| Set to the current range of the slected plotter. | |
| QFileDialog * | m_image_dialog |
| The QFileDialog for saving images. | |
| Inspector * | m_inspector |
| The Inspector object. | |
| std::vector< double > | m_mouseData |
| 3-vector of mouse event data | |
| int | m_num_height |
| Number of default sized plots vertically. | |
| int | m_num_width |
| Number of default sized plots horizontally. | |
| std::vector< const ViewBase * > | m_sel_views |
| Temporary list of selected QtView objects on the canvas. | |
| std::map< const QtView *, PickTable * > | m_table_map |
| A map from a view to the PickTable. | |
| std::vector< const ViewBase * > | m_views |
| Temporary list of QtView objects on the canvas. | |
| XmlController * | m_xml_controller |
| The XML controller. | |
Static Private Attributes | |
| static const std::string | s_app_name = "HippoDraw" |
| The application name. | |
| static std::string | s_image_filters |
| A QFileDialog filters string for supported image types. | |
|
|
Possible locations where on a QCanvasItem the mouse cursor was when clicked.
Definition at line 191 of file FigureEditor.h. |
|
||||||||||||||||||||
|
Definition at line 99 of file CanvasView.cxx. References QtXMLController::instance(). |
|
|
Adds the item to the canvas. Expands the canvas' size if necessary. Definition at line 1373 of file FigureEditor.cxx. Referenced by addView(), and initFrom(). |
|
|
Adds from pasteboard. Copies from the pasteboard and adds the plot to next available space. Definition at line 297 of file CanvasView.cxx. References addView(), XmlController::getFromPasteboard(), QtViewFactory::instance(), m_xml_controller, FigureEditor::placeGraph(), and views(). |
|
||||||||||||
|
Add a text display which displays functions parameters.
Definition at line 801 of file CanvasView.cxx. References addView(), FunctionController::createFuncView(), QtViewFactory::instance(), FunctionController::instance(), and moveToPlotter(). Referenced by CanvasWindow::addFuncDisplay(). |
|
|
Adds a page to the canvas.
Definition at line 1590 of file FigureEditor.cxx. References FigureEditor::addPageMargin(), QCanvas::height(), FigureEditor::m_apage_h, FigureEditor::m_canvas, QCanvas::resize(), and QCanvas::width(). Referenced by CanvasWindow::viewAddPage(). |
|
||||||||||||
|
Adds page margin. Adds an indication of the page's margin. Only the contents inside the margin is printable. Definition at line 221 of file FigureEditor.cxx. References FigureEditor::m_apage_h, FigureEditor::m_apage_w, FigureEditor::m_canvas, FigureEditor::m_printer_bounds, FigureEditor::m_upage_h, and FigureEditor::m_upage_w. Referenced by FigureEditor::addPage(), and FigureEditor::showPrinterMargins(). |
|
|
Creates a QtView object for the display and inserts it onto the canvas in the next available free place.
Selects the created view if the user settings for this is Definition at line 571 of file CanvasView.cxx. References addPlotDisplay(), and m_add_selected. |
|
||||||||||||
|
Creates a QtView object for the display and inserts it onto the canvas in the next available free place. Selects the created view if select is true. Definition at line 576 of file CanvasView.cxx. References addView(), calcDefaultSize(), ViewFactory::createView(), QtViewFactory::instance(), m_inspector, FigureEditor::m_upage_w, FigureEditor::placeGraph(), and setInspector(). Referenced by CanvasWindow::addDisplay(), CanvasWindow::addPlotDisplay(), and addPlotDisplay(). |
|
|
Add an item to the selected list.
Definition at line 333 of file FigureEditor.cxx. Referenced by FigureEditor::contentsMousePressEvent(), pasteViews(), and FigureEditor::setSelectedItem(). |
|
||||||||||||||||
|
Add a display of text Adds a display of text to that will be associated with plotter. Uses the optional text if needed by the display. Definition at line 757 of file CanvasView.cxx. References addView(), DisplayController::createTextView(), QtViewFactory::instance(), DisplayController::instance(), and moveToPlotter(). Referenced by CanvasWindow::addTextDisplay(). |
|
||||||||||||||||||||||||
|
Adds a text display at the relative position (xrel, yrel) in the selected item's coordinates. This method returns the relative coordinates of the lower left corner as a pair of doubles. Definition at line 778 of file CanvasView.cxx. References addView(), DisplayController::createTextView(), QtViewFactory::instance(), DisplayController::instance(), and moveToPlotterAt(). Referenced by CanvasWindow::addTextDisplayAt(). |
|
||||||||||||
|
Adds a QtView object to the CanvasView.
If select is Definition at line 453 of file CanvasView.cxx. References FigureEditor::add(), FigureEditor::ensureVisible(), fillSelectedWithObservers(), m_xml_controller, notifyObservers(), and FigureEditor::setSelectedItem(). Referenced by addFromPasteboard(), addFuncDisplay(), addPlotDisplay(), addTextDisplay(), and addTextDisplayAt(). |
|
|
Returns the name of the application.
Definition at line 1691 of file CanvasView.cxx. References s_app_name. Referenced by initFromFile(). |
|
||||||||||||
|
Sets the default size and position for the view.
Definition at line 556 of file CanvasView.cxx. References m_num_height, m_num_width, FigureEditor::m_upage_h, and FigureEditor::m_upage_w. Referenced by addPlotDisplay(). |
|
|
Calculate the size of a page by using the printer metrics. The size of a printable page is calculated on the basis that one pixel will become one Postscript point. A QPaintDeviceMetrics object is created to find the actual and usable size of a page in millimeters which is then converted to Postscript Points. Definition at line 251 of file FigureEditor.cxx. References QSize::height(), QString::isNull(), FigureEditor::m_apage_h, FigureEditor::m_apage_w, FigureEditor::m_upage_h, FigureEditor::m_upage_w, QPrinter::printerName(), FigureEditor::s_printer, std::swap(), and QSize::width(). Referenced by FigureEditor::print(). |
|
|
Removes all the QCanvasItem objects from the canvas.
Reimplemented from FigureEditor. Definition at line 348 of file CanvasView.cxx. References FigureEditor::clear(), and notifyObservers(). Referenced by CanvasWindow::clear(). |
|
|
De-selects all items, making the selection list empty.
Definition at line 478 of file FigureEditor.cxx. References FigureEditor::m_selected_list, and FigureEditor::setSelectedItems(). Referenced by pasteViews(). |
|
||||||||||||
|
|
Overrides the QScrollView event handler.
Definition at line 1179 of file CanvasView.cxx. References QMouseEvent::button(), QCanvasView::canvas(), FigureEditor::contentsMouseMoveEvent(), drag_rect, ViewBase::getAspectRatio(), FigureEditor::getZoomMode(), QCanvasView::inverseWorldMatrix(), FigureEditor::isSingleItemSelected(), std::max(), std::min(), FigureEditor::selectedItem(), QMouseEvent::state(), QPoint::x(), QPoint::y(), and FigureEditor::zoom_start. |
|
|
Reimplemented from FigureEditor. Definition at line 1164 of file CanvasView.cxx. References FigureEditor::contentsMousePressEvent(), fillSelectedWithObservers(), m_xml_controller, notifyObservers(), XmlController::saveToSelectionCopy(), and selectedViews(). |
|
|
Overrides inherited method to receive mouse released events.
Definition at line 1439 of file CanvasView.cxx. References QMouseEvent::button(), QCanvasView::canvas(), QStatusBar::clear(), drag_rect, FigureEditor::getZoomMode(), FigureEditor::invalid, QCanvasView::inverseWorldMatrix(), FigureEditor::isSingleItemSelected(), m_mouseData, m_table_map, FigureEditor::m_whereClicked, std::max(), std::min(), mouseEvent, QMouseEvent::pos(), FigureEditor::selectedItem(), selectedPlotter(), setCurrentRange(), PlotterBase::setCurrentRangeSaved(), QtView::setShowCrossHairs(), QtView::update(), QWaitCondition::wakeAll(), QPoint::x(), QPoint::y(), hippodraw::Axes::Z, and FigureEditor::zoom_start. |
|
|
Overrides inherited method to receive mouse pressed events.
Implements FigureEditor. Definition at line 1133 of file CanvasView.cxx. References ViewBase::getPlotter(), and FigureEditor::m_selected_list. |
|
|
Copies from the pasteboard. Copies from pasteboard and pastes the views to the canvas. Definition at line 285 of file CanvasView.cxx. References XmlController::getFromPasteboard(), QtViewFactory::instance(), m_xml_controller, pasteViews(), and views(). Referenced by CanvasWindow::editPaste(). |
|