#include <ViewBase.h>
Inheritance diagram for ViewBase:
A view is a rectangle on the graphic device into which drawing is done. Derived classes provide a concrete implementation based on some graphics toolkit. Examples are the QtView and EpsView classes.
A view is an Observer of a PlotterBase object, the base class of plotters. When it receives the Observer::update message, it initiates drawing by calling back the PlotterBase object with a pointer to itself. Drawing can also be initiated by an application by calling the PlotterBase object with view. For example, an EPS file can be generated by a plotter by calling it with an EpsView.
Views are responsible for the translation from the data coordinate space used by the PlotterBase object to the graphics device coordinate space. They maintain their own coordinate system as float
objects to be compatible with scalable graphics toolkits such as Postscript.
Oded Wurman <owurman@stanford.edu>
Definition at line 59 of file ViewBase.h.
Public Member Functions | |
virtual void | drawColorLines (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, const std::vector< Color > &color, float size)=0 |
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)=0 |
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)=0 |
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)=0 |
Draws symbol points. | |
virtual void | drawPoints (const std::vector< double > &x, const std::vector< double > &y, hippodraw::Symbol::Type type, float sym_size, const Color &color)=0 |
Draws symbol points. | |
virtual void | drawPolyLine (const std::vector< double > &xpoints, const std::vector< double > &ypoints, hippodraw::Line::Style style, const Color &color, float size)=0 |
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)=0 |
Draws a colored square. | |
virtual void | drawText (const std::string &s, float x, float y, float fontsize, float angle=0.0, char xp= 'l', char yp= 't', bool resize=false, const FontBase *font=0)=0 |
Draws a text string at a point in the view's coordinate system. | |
virtual void | drawUserText (const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp)=0 |
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)=0 |
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)=0 |
Draws multiple line segments. | |
virtual void | drawViewSquare (float x1, float y1, float x2, float y2, int red, int green, int blue)=0 |
Draws a colored square in view space. | |
virtual void | endPlot ()=0 |
Finalizes a view when all drawing has been done. | |
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. | |
virtual void | setDrawRect (float x, float y, float w, float h)=0 |
Sets the drawing Rectangle in the devices coordinate system. | |
virtual void | setPlotter (PlotterBase *plotter) |
Sets the PlotterBase object to plotter. | |
virtual void | update (const Observable *)=0 |
Implements the update method of the Observer pattern. | |
virtual float | userToDrawColor (double c) const =0 |
Converts a coordinate in user space to drawing space along the color (X) axis. | |
virtual float | userToDrawX (double x) const =0 |
Converts a coordinate in user space to drawing space along the X axis. | |
virtual float | userToDrawY (double y) const =0 |
Converts a coordinate in user space to drawing space along the Y axis. | |
ViewBase (const ViewBase &) | |
The copy constructor. | |
ViewBase (PlotterBase *plotter) | |
The following constructor takes a plotter as an argument to use with a drawing. | |
ViewBase () | |
The default constructor. | |
virtual void | willDelete (const Observable *) |
Notifies this Observer object that one of its Observable objects is about to be deleted. | |
virtual | ~ViewBase () |
The virtual destructor. | |
Protected Attributes | |
PlotterBase * | m_plotter |
The plotter object used by this view. |
|
The default constructor.
Definition at line 27 of file ViewBase.cxx. |
|
The following constructor takes a plotter as an argument to use with a drawing.
Definition at line 32 of file ViewBase.cxx. |
|
The copy constructor.
|
|
The virtual destructor.
Definition at line 37 of file ViewBase.cxx. |
|
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.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by ContourPointRep::endPlot(). |
|
Draws multiple line segments - that is, a line between x0,y0 and x1,y2, another between x2,y2 and x3,y3 and so on.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by AxisRepBase::drawCrossHairs(). |
|
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 ).
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by AxisRepBase::drawXTickLabels(), and AxisRepBase::drawYMag(). |
|
Draws symbol points. x and y are the coordinates, type is the type of symbol, and sym_size is the size. hue is the hue parameters for each point. The saturation and brightness are set to 1.0. Implemented in EpsView, OpenGLView, and QtViewImp. |
|
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. Implemented in EpsView, OpenGLView, and QtViewImp. |
|
Draws a polyline.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by AxisRepBase::drawAxesLines(), and AxisRepBase::drawGridLines(). |
|
Draws itself.
Definition at line 60 of file ViewBase.cxx. References PlotterBase::drawIn(), and 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. Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by CutRangeRep::drawInvertedRange1D(), CutRangeRep::drawInvertedRange2D(), and CutRangeRep::drawNormalRange(). |
|
Draws a text string at a point in the view's coordinate system.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by RepBase::displayError(), TotalTextRep::drawProjectedValues(), FuncParmRep::drawProjectedValues(), FuncChiRep::drawProjectedValues(), BoxTextRep::drawProjectedValues(), AverageTextRep::drawProjectedValues(), AxisRepBase::drawTitle(), AxisRepBase::drawXLabels(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawYLabels(), AxisRepBase::drawYTickLabels(), AxisRepColor::drawZLabels(), and AxisRepColor::drawZTickLabels(). |
|
Draws a text string at a point in the data coordinate system.
Implemented in EpsView, OpenGLView, and QtViewImp. |
|
Draws multiple line segments.
Implemented in EpsView, OpenGLView, and QtViewImp. |
|
Draws multiple line segments.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by DrawBorder::draw(), ContourPointRep::drawContourTicks(), DrawBorder::drawKnob(), AxisRepBase::drawXTickLines(), AxisRepBase::drawYTickLines(), and AxisRepColor::drawZTickLines(). |
|
Draws a colored square in view space. Used for shading on the cuts and the gray plot. Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by AxisRepColor::drawColorScale(). |
|
Finalizes a view when all drawing has been done.
Implemented in EpsView, OpenGLView, QtView, QtViewImp, and QtViewWidget. |
|
Get the aspect ratio.
Definition at line 85 of file ViewBase.cxx. References 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(), QtViewImp::draw_Text(), QtViewImp::drawText(), AxisRepBase::drawTitle(), QtViewImp::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.
Reimplemented in QtViewImp. Definition at line 80 of file ViewBase.cxx. References PlotterBase::getMarginRect(), and m_plotter. Referenced by AxisRepColor::drawColorScale(), ContourPointRep::drawContourTicks(), AxisRepBase::drawTitle(), AxisRepBase::drawXLabels(), AxisRepBase::drawXTickLabels(), AxisRepBase::drawXTickLines(), AxisRepBase::drawYLabels(), AxisRepBase::drawYMag(), AxisRepBase::drawYTickLines(), AxisRepColor::drawZLabels(), AxisRepColor::drawZTickLabels(), and AxisRepColor::drawZTickLines(). |
|
Returns the plotter used by this view.
Definition at line 55 of file ViewBase.cxx. References m_plotter. |
|
Returns the plotter used by this view.
Reimplemented in OpenGLView. Definition at line 50 of file ViewBase.cxx. References 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 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 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. |
|
Sets the drawing Rectangle in the devices coordinate system.
Implemented in EpsView, OpenGLView, QtView, and QtViewWidget. Referenced by QtViewImp::draw_Text(), and ViewBaseXML::getObjects(). |
|
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 m_plotter. Referenced by QtViewWidget::setPlotter(), and OpenGLView::setPlotter(). |
|
Implements the update method of the Observer pattern. Derived classes should send a message to what ever object is the parent of this ViewBase object. Implements hippodraw::Observer. Implemented in EpsView, OpenGLView, QtView, QtViewImp, and QtViewWidget. |
|
Converts a coordinate in user space to drawing space along the color (X) axis.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by ContourPointRep::drawContourTicks(), AxisRepColor::drawZTickLabels(), and AxisRepColor::drawZTickLines(). |
|
Converts a coordinate in user space to drawing space along the X axis.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by AxisRepBase::drawXTickLabels(), AxisRepBase::drawXTickLines(), AxisRepBase::drawYTickLabels(), and AxisRepBase::drawYTickLines(). |
|
Converts a coordinate in user space to drawing space along the Y axis.
Implemented in EpsView, OpenGLView, and QtViewImp. Referenced by AxisRepBase::drawXTickLabels(), AxisRepBase::drawXTickLines(), AxisRepBase::drawYTickLabels(), and AxisRepBase::drawYTickLines(). |
|
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(). |
|
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(), drawSelf(), QtViewWidget::fillPickedPoint(), QtView::fillPickedPoint(), getAspectRatio(), getMarginRect(), QtViewImp::getMarginRect(), getPlotter(), getRange(), getUserRect(), QtViewWidget::mousePressEvent(), QtViewWidget::paintEvent(), QtView::QtView(), QtViewImp::setCrossX(), QtViewImp::setCrossY(), setPlotter(), QtViewWidget::toViewX(), QtView::toViewX(), OpenGLView::toViewX(), EpsView::toViewX(), QtViewWidget::toViewY(), QtView::toViewY(), OpenGLView::toViewY(), EpsView::toViewY(), QtViewImp::userToDrawColor(), OpenGLView::userToDrawColor(), EpsView::userToDrawColor(), QtViewImp::userToDrawX(), OpenGLView::userToDrawX(), EpsView::userToDrawX(), QtViewImp::userToDrawY(), OpenGLView::userToDrawY(), EpsView::userToDrawY(), and QtView::~QtView(). |