#include <QtViewImp.h>
Inheritance diagram for QtViewImp:
This class is most of the implementation of a concrete view. A derived class is needed to handle size attributes.
Sanket Biren Malde <sanket@stanford.edu>
Definition at line 44 of file QtViewImp.h.
Public Member Functions | |
virtual const QFont & | defaultFont () |
virtual void | drawColorLines (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, const std::vector< Color > &colors, float size) |
Draws multiple line segments, each with a different color - that is, a line between x0,y0 and x1,y1, with color[0] =color[1] another between x2,y2 and x3,y3 with color[2]=color[3] and so on. | |
virtual void | drawLines (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, const Color &color, float size) |
Draws multiple line segments - that is, a line between x0,y0 and x1,y2, another between x2,y2 and x3,y3 and so on. | |
virtual void | drawMag (float x, float y, int mag, float fontsize, QFont &) |
virtual void | drawMag (float x, float y, int mag, float fontsize) |
Draws the exponent on the axis label. | |
virtual void | drawPoints (const std::vector< double > &x, const std::vector< double > &y, const std::vector< Color > &colors, hippodraw::Symbol::Type type, float sym_size) |
virtual void | drawPoints (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Symbol::Type type, float sym_size) |
virtual void | drawPolyLine (const std::vector< double > &xpoints, const std::vector< double > &ypoints, hippodraw::Line::Style style, const Color &color, float size) |
Draws a polyline. | |
virtual void | drawSelf () |
Draws itself. | |
virtual void | drawSquare (double x1, double y1, double x2, double y2, int red, int green, int blue) |
Draws a colored square. | |
virtual void | drawText (const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp, bool resize, const FontBase *font) |
Draws a text string at a point in the view's coordinate system. | |
virtual void | drawText (const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp, bool resize) |
virtual void | drawUserText (const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp) |
Draws a text string at a point in the data coordinate system. | |
virtual void | drawViewLines (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, const Color &color, float size) |
Draws multiple line segments. | |
virtual void | drawViewLines (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, bool color, float size) |
Draws multiple line segments. | |
virtual void | drawViewSquare (float x1, float y1, float x2, float y2, int red, int green, int blue) |
Draws a colored square in view space. | |
virtual void | endPlot () |
Finalizes the plot view by unlocking the QApplication. | |
virtual void | fillPickedPoint (double x, double y, std::vector< double > &picked) const =0 |
Fills the picked point vector. | |
virtual double | getAspectRatio () const |
Get the aspect ratio. | |
virtual HippoRectangle | getDrawRect () const =0 |
Returns the drawing Rectangle in the devices coordinate system. | |
virtual HippoRectangle | getMarginRect () const |
Returns the Rectangle within which points representations are draw. | |
PlotterBase * | getPlotter () |
Returns the plotter used by this view. | |
PlotterBase * | getPlotter () const |
Returns the plotter used by this view. | |
const Range & | getRange (hippodraw::Axes::Type axis) const |
Returns the range of the data space on specified axis. | |
const HippoRectangle & | getUserRect () const |
Is called by the AxisRepBase object (or one of its derived objects), and returns the rectangle where the drawing is made. | |
virtual void | initPlot (double aspect)=0 |
Initializes a view before drawing. | |
QtViewImp (const QtViewImp &) | |
The copy constructor. | |
QtViewImp (PlotterBase *plotter) | |
The constructor. | |
void | setCrossX (double val) |
Set the crossX value. | |
void | setCrossY (double val) |
Set the crossY value. | |
virtual void | setDefaultFont (const QFont &font) |
virtual void | setDrawRect (float x, float y, float w, float h)=0 |
Sets the drawing Rectangle in the devices coordinate system. | |
void | setInspector (QObject *) |
Sets the receiver of update messages. | |
virtual void | setPlotter (PlotterBase *plotter) |
Sets the PlotterBase object to plotter. | |
int | toView (double x) const |
Converts the view space coordinate x expressed as a double to one expressed as an int . | |
virtual int | toViewX (double datX) const =0 |
Converts the data space coordinate X to the view space coordinate X. | |
virtual int | toViewY (double datY) const =0 |
Converts the data space coordinate Y to the view space coordinate Y. | |
float | userToDrawColor (double c) const |
Converts a coordinate in user space to drawing space along the color (X) axis. | |
float | userToDrawX (double x) const |
Converts a coordinate in user space to drawing space along the X axis. | |
float | userToDrawY (double x) const |
Converts a coordinate in user space to drawing space along the Y axis. | |
virtual void | willDelete (const Observable *) |
Notifies this Observer object that one of its Observable objects is about to be deleted. | |
Protected Member Functions | |
virtual void | draw_Text (const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp, bool resize, QFont &font) |
virtual void | update (const Observable *display) |
Responds to update message from Observable. | |
Protected Attributes | |
QFont | m_font_default |
QObject * | m_inspector |
The receiver of update messages. | |
QPainter * | m_painter |
The current Qt QPainter object. | |
PlotterBase * | m_plotter |
The plotter object used by this view. | |
Private Member Functions | |
QPen | createPen (const Color &color, float size, hippodraw::Line::Style style) |
Creates a QPen object from the arguments. | |
void | drawMethod (const std::vector< double > &x, const std::vector< double > &y, int opt1, int opt2) |
Draws in the view using the specified method. | |
virtual void | drawPoints (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Symbol::Type type, float sym_size, const Color &color) |
Draws symbol points. | |
void | drawViewMethod (const std::vector< double > &x, const std::vector< double > &y, int opt1, int opt2) |
Draws in the view using the specified method. | |
virtual int | toCanvasX (double dx) const =0 |
Converts coordinate from view space to canvas space. | |
virtual int | toCanvasY (double dy) const =0 |
Converts coordinate from view space to canvas space. | |
void | transformAndFill (QPointArray &array, const std::vector< double > &x, const std::vector< double > &y, int(QtViewImp::*xfunc)(double) const, int(QtViewImp::*yfunc)(double) const ) |
Fills the array with QPoint objects whose coordinates are in the QPaintDevice space from the vectors x and y whose coordinates are in the data space. | |
Static Private Attributes | |
static std::map< hippodraw::Line::Style, Qt::PenStyle > | s_line_style |
The mapping from hippodraw::Line::Style to QPen PenStyle. |
|
The constructor.
Definition at line 40 of file QtViewImp.cxx. References hippodraw::Line::Dash, hippodraw::Line::DashDot, hippodraw::Line::DashDotDot, hippodraw::Line::Dot, hippodraw::FontWeight::Invisible, s_line_style, and hippodraw::Line::Solid. |
|
The copy constructor.
|
|
Creates a QPen object from the arguments.
Definition at line 447 of file QtViewImp.cxx. References Color::getBlue(), Color::getGreen(), Color::getRed(), and s_line_style. Referenced by drawLines(), drawPolyLine(), and drawViewLines(). |
|
Definition at line 913 of file QtViewImp.cxx. References m_font_default. |
|
|
Draws multiple line segments, each with a different color - that is, a line between x0,y0 and x1,y1, with color[0] =color[1] another between x2,y2 and x3,y3 with color[2]=color[3] and so on.
Implements ViewBase. Definition at line 509 of file QtViewImp.cxx. References QPainter::drawLine(), Color::getBlue(), Color::getGreen(), Color::getRed(), m_painter, QPainter::restore(), s_line_style, QPainter::save(), QPainter::setPen(), QPen::setStyle(), toViewX(), and toViewY(). |
|
Draws multiple line segments - that is, a line between x0,y0 and x1,y2, another between x2,y2 and x3,y3 and so on.
Implements ViewBase. Definition at line 482 of file QtViewImp.cxx. References createPen(), QPainter::drawLineSegments(), m_painter, QPainter::restore(), QPainter::save(), QPainter::setPen(), toViewX(), toViewY(), and transformAndFill(). |
|
Definition at line 840 of file QtViewImp.cxx. References QString::arg(), QPainter::drawText(), QString::length(), m_painter, QPainter::restore(), QPainter::save(), QPainter::setFont(), QFont::setPointSize(), and QPainter::translate(). |
|
Draws the exponent on the axis label. The arguments stand for the starting position of the writing ( x, y ), for the value of the magnitude ( mag ), and for the font ( fontsize ).
Implements ViewBase. Definition at line 833 of file QtViewImp.cxx. References m_font_default. |
|
Draws in the view using the specified method. The coordinates are in the user space. Reimplemented in QtView, and QtViewWidget. Definition at line 146 of file QtViewImp.cxx. References QPainter::drawPolyline(), m_painter, num_util::size(), toViewX(), toViewY(), and transformAndFill(). Referenced by drawPolyLine(). |
|
Implements ViewBase. Definition at line 317 of file QtViewImp.cxx. References hippodraw::Symbol::CIRCLE, QPainter::drawEllipse(), QPainter::drawPie(), QPainter::drawPolygon(), hippodraw::Symbol::FILLED_CIRCLE, hippodraw::Symbol::FILLED_TRIANGLE, QPainter::fillRect(), Color::getBlue(), Color::getGreen(), Color::getRed(), m_painter, hippodraw::Symbol::PLUS, QPainter::restore(), QPainter::save(), QPainter::setBrush(), QPainter::setPen(), QPointArray::setPoint(), hippodraw::Symbol::SOLIDSQUARE, hippodraw::Symbol::SQUARE, hippodraw::Symbol::TIMES, toViewX(), toViewY(), and hippodraw::Symbol::TRIANGLE. |
|
Definition at line 300 of file QtViewImp.cxx. |
|
Draws symbol points. x and y are the coordinates, type is the type of symbol, and sym_size is the size. All symbols are draw in the same color. Implements ViewBase. Definition at line 166 of file QtViewImp.cxx. References hippodraw::Symbol::CIRCLE, QPainter::drawEllipse(), QPainter::drawPie(), QPainter::drawPolygon(), hippodraw::Symbol::FILLED_CIRCLE, hippodraw::Symbol::FILLED_TRIANGLE, QPainter::fillRect(), Color::getBlue(), Color::getGreen(), Color::getRed(), m_painter, hippodraw::Symbol::PLUS, QPainter::restore(), QPainter::save(), QPainter::setBrush(), QPainter::setPen(), QPointArray::setPoint(), hippodraw::Symbol::SOLIDSQUARE, hippodraw::Symbol::SQUARE, hippodraw::Symbol::TIMES, toViewX(), toViewY(), and hippodraw::Symbol::TRIANGLE. |
|
Draws a polyline.
Implements ViewBase. Definition at line 463 of file QtViewImp.cxx. References createPen(), drawMethod(), m_painter, QPainter::restore(), QPainter::save(), and QPainter::setPen(). |
|
Draws itself.
Definition at line 60 of file ViewBase.cxx. References PlotterBase::drawIn(), and ViewBase::m_plotter. Referenced by QtViewWidget::draw(), QtView::draw(), QtView::drawWithPixmap(), OpenGLWindow::paint(), and QtViewWidget::paintEvent(). |
|
Draws a colored square. Used for shading on the cuts and the gray plot. Implements ViewBase. Definition at line 865 of file QtViewImp.cxx. References QPainter::fillRect(), m_painter, toViewX(), and toViewY(). |
|
Draws a text string at a point in the view's coordinate system.
Implements ViewBase. Definition at line 791 of file QtViewImp.cxx. References draw_Text(), ViewBase::getDrawRect(), HippoRectangle::getX(), HippoRectangle::getY(), and m_font_default. |
|
Definition at line 781 of file QtViewImp.cxx. |
|
Draws a text string at a point in the data coordinate system.
Implements ViewBase. Definition at line 819 of file QtViewImp.cxx. References draw_Text(), ViewBase::getDrawRect(), HippoRectangle::getX(), HippoRectangle::getY(), m_font_default, userToDrawX(), and userToDrawY(). |
|
Draws multiple line segments.
Implements ViewBase. Definition at line 566 of file QtViewImp.cxx. References createPen(), QPainter::drawLineSegments(), m_painter, QPainter::restore(), QPainter::save(), QPainter::setPen(), toCanvasX(), toCanvasY(), and transformAndFill(). |
|
Draws multiple line segments.
Implements ViewBase. Definition at line 544 of file QtViewImp.cxx. References drawViewMethod(), m_painter, QPainter::pen(), QPainter::restore(), s_line_style, QPainter::save(), QPainter::setPen(), and QPen::setStyle(). |
|
Draws in the view using the specified method. The coordinates are in the view space.
Reimplemented in QtView, and QtViewWidget. Definition at line 126 of file QtViewImp.cxx. References QPainter::drawLineSegments(), m_painter, num_util::size(), toCanvasX(), toCanvasY(), and transformAndFill(). Referenced by drawViewLines(). |
|
Draws a colored square in view space. Used for shading on the cuts and the gray plot. Implements ViewBase. Definition at line 880 of file QtViewImp.cxx. References QPainter::fillRect(), m_painter, toCanvasX(), and toCanvasY(). |
|
Finalizes the plot view by unlocking the QApplication.
Implements ViewBase. Reimplemented in QtView, and QtViewWidget. Definition at line 85 of file QtViewImp.cxx. |
|
Fills the picked point vector. Converts the view coordinates x and y to data coordinates. The results are put in the vector picked. Implemented in QtView, and QtViewWidget. |
|
Get the aspect ratio.
Definition at line 85 of file ViewBase.cxx. References ViewBase::m_plotter. Referenced by CanvasView::contentsMouseMoveEvent(), and QtView::drawWithPixmap(). |
|
Returns the drawing Rectangle in the devices coordinate system. Must be implemented in derived class. Implemented in EpsView, OpenGLView, QtView, and QtViewWidget. Referenced by ViewBaseXML::createElement(), DrawBorder::draw(), draw_Text(), drawText(), AxisRepBase::drawTitle(), drawUserText(), AxisRepBase::drawXLabels(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawYLabels(), AxisRepBase::drawYMag(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), XyPlotter::prepareMarginRect(), AxisRepBase::setFontSize(), AxisRepBase::setXFontSize(), AxisRepBase::setYFontSize(), AxisRepBase::setZFontSize(), XPADDING(), YPADDING(), and ZPADDING(). |
|
Returns the Rectangle within which points representations are draw. The coordinate is shifted by position of view on canvas. Reimplemented from ViewBase. Definition at line 80 of file QtViewImp.cxx. References PlotterBase::getMarginRect(), and ViewBase::m_plotter. |
|
Returns the plotter used by this view.
Definition at line 55 of file ViewBase.cxx. References ViewBase::m_plotter. |
|
Returns the plotter used by this view.
Reimplemented in OpenGLView. Definition at line 50 of file ViewBase.cxx. References ViewBase::m_plotter. Referenced by DisplayController::addTextViewToList(), ViewBaseXML::areDataSourcesSaved(), CutController::connectDataRep(), CanvasView::controlMousePressEvent(), ViewBaseXML::createChild(), CanvasView::fillPlotterList(), CutController::fillTupleCutList(), PyCanvas::findSelectedView(), PyCanvas::getDisplays(), OpenGLView::getPlotter(), CanvasView::getViewFor(), PlotTable::initialize(), DisplayController::removeTextObservers(), PyCanvas::saveAsImage(), CanvasView::saveSelectedAsEps(), CanvasView::setIntervalEnabled(), and CanvasView::viewShowPickTable(). |
|
Returns the range of the data space on specified axis.
Definition at line 68 of file ViewBase.cxx. References ViewBase::m_plotter. Referenced by ContourPointRep::drawContourTicks(). |
|
Is called by the AxisRepBase object (or one of its derived objects), and returns the rectangle where the drawing is made.
Definition at line 75 of file ViewBase.cxx. References PlotterBase::getUserRect(), and ViewBase::m_plotter. Referenced by ContourPointRep::endPlot(), and AxisRepBase::initAxisRect(). |
|
Initializes a view before drawing. The view should check it size. The parameter aspect, if greater than 0.0, sets the aspect ratio of the view, i.e. the ratio of the width to the height. Implemented in EpsView, OpenGLView, QtView, and QtViewWidget. |
|
Set the crossX value.
Definition at line 893 of file QtViewImp.cxx. References ViewBase::m_plotter, and PlotterBase::setCrossX(). Referenced by FigureEditor::contentsMouseMoveEvent(). |
|
Set the crossY value.
Definition at line 898 of file QtViewImp.cxx. References ViewBase::m_plotter, and PlotterBase::setCrossY(). Referenced by FigureEditor::contentsMouseMoveEvent(). |
|
Definition at line 906 of file QtViewImp.cxx. References m_font_default. |
|
Sets the drawing Rectangle in the devices coordinate system.
Implemented in EpsView, OpenGLView, QtView, and QtViewWidget. Referenced by draw_Text(), and ViewBaseXML::getObjects(). |
|
Sets the receiver of update messages. When this object receives update() from one of it Observable objects, it emits a customEvent message to this object, if one exists. Definition at line 58 of file QtViewImp.cxx. References m_inspector. |
|
Sets the PlotterBase object to plotter. The ViewBase object does not own the plotter. If the plotter is being changed, it is up to client code to decide to destroy the previous plotter or not. Reimplemented in OpenGLView, and QtViewWidget. Definition at line 45 of file ViewBase.cxx. References ViewBase::m_plotter. Referenced by QtViewWidget::setPlotter(), and OpenGLView::setPlotter(). |
|
Converts coordinate from view space to canvas space.
Implemented in QtView, and QtViewWidget. Referenced by drawViewLines(), drawViewMethod(), and drawViewSquare(). |
|
Converts coordinate from view space to canvas space.
Implemented in QtView, and QtViewWidget. Referenced by drawViewLines(), drawViewMethod(), and drawViewSquare(). |
|
Converts the view space coordinate x expressed as a
Definition at line 251 of file QtViewImp.h. |
|
Converts the data space coordinate X to the view space coordinate X.
Implemented in QtView, and QtViewWidget. Referenced by drawColorLines(), drawLines(), drawMethod(), drawPoints(), and drawSquare(). |
|
Converts the data space coordinate Y to the view space coordinate Y.
Implemented in QtView, and QtViewWidget. Referenced by drawColorLines(), drawLines(), drawMethod(), drawPoints(), and drawSquare(). |
|
Fills the array with QPoint objects whose coordinates are in the QPaintDevice space from the vectors x and y whose coordinates are in the data space. The member functions xfunc and yfunc of the QtViewImp class are used for the transformation. Definition at line 106 of file QtViewImp.cxx. References QPointArray::setPoint(), and num_util::size(). Referenced by drawLines(), drawMethod(), drawViewLines(), and drawViewMethod(). |
|
Responds to update message from Observable.
Implements ViewBase. Reimplemented in QtView, and QtViewWidget. Definition at line 65 of file QtViewImp.cxx. References m_inspector, QApplication::postEvent(), and QApplication::removePostedEvents(). Referenced by QtViewWidget::update(). |
|
Converts a coordinate in user space to drawing space along the color (X) axis.
Implements ViewBase. Definition at line 99 of file QtViewImp.cxx. References ViewBase::m_plotter, and PlotterBase::userToMarginColor(). |
|
Converts a coordinate in user space to drawing space along the X axis.
Implements ViewBase. Definition at line 89 of file QtViewImp.cxx. References ViewBase::m_plotter, and PlotterBase::userToMarginX(). Referenced by drawUserText(). |
|
Converts a coordinate in user space to drawing space along the Y axis.
Implements ViewBase. Definition at line 94 of file QtViewImp.cxx. References ViewBase::m_plotter, and PlotterBase::userToInvertedMarginY(). Referenced by drawUserText(). |
|
Notifies Since most Observable objects are owned by its Observer, it is the Observer that issued the delete. Thus the default implementation here does nothing. Derived classes that observe objects owned by another should implement this method to remove the Observable from the list they are observing. Reimplemented in FunctionRep, DataSourceController, CutPlotter, TextPlotter, BinningProjector, DyHist1DProjector, DyHist2DProjector, NTupleProjector, Profile2DProjector, and ProfileProjector. Definition at line 25 of file Observer.cxx. Referenced by DataRep::~DataRep(), DataSource::~DataSource(), NTuple::~NTuple(), and RTuple::~RTuple(). |
|
Definition at line 69 of file QtViewImp.h. Referenced by defaultFont(), drawMag(), drawText(), drawUserText(), and setDefaultFont(). |
|
The receiver of update messages.
Definition at line 62 of file QtViewImp.h. Referenced by setInspector(), and update(). |
|
The current Qt QPainter object.
Definition at line 65 of file QtViewImp.h. Referenced by QtViewWidget::draw(), QtView::draw(), draw_Text(), drawColorLines(), drawLines(), drawMag(), QtViewWidget::drawMethod(), drawMethod(), QtView::drawMethod(), drawPoints(), drawPolyLine(), drawSquare(), drawViewLines(), QtViewWidget::drawViewMethod(), drawViewMethod(), QtView::drawViewMethod(), drawViewSquare(), QtView::drawWithPixmap(), and QtViewWidget::paintEvent(). |
|
The plotter object used by this view. Although the plotter object was created externally, the view owns the plotter object. Definition at line 66 of file ViewBase.h. Referenced by QtView::draw(), ViewBase::drawSelf(), QtViewWidget::fillPickedPoint(), QtView::fillPickedPoint(), ViewBase::getAspectRatio(), ViewBase::getMarginRect(), getMarginRect(), ViewBase::getPlotter(), ViewBase::getRange(), ViewBase::getUserRect(), QtViewWidget::mousePressEvent(), QtViewWidget::paintEvent(), QtView::QtView(), setCrossX(), setCrossY(), ViewBase::setPlotter(), QtViewWidget::toViewX(), QtView::toViewX(), OpenGLView::toViewX(), EpsView::toViewX(), QtViewWidget::toViewY(), QtView::toViewY(), OpenGLView::toViewY(), EpsView::toViewY(), userToDrawColor(), OpenGLView::userToDrawColor(), EpsView::userToDrawColor(), userToDrawX(), OpenGLView::userToDrawX(), EpsView::userToDrawX(), userToDrawY(), OpenGLView::userToDrawY(), EpsView::userToDrawY(), and QtView::~QtView(). |
|
The mapping from hippodraw::Line::Style to QPen PenStyle.
Definition at line 37 of file QtViewImp.cxx. Referenced by createPen(), drawColorLines(), drawViewLines(), and QtViewImp(). |