LCOV - code coverage report
Current view: top level - graphics/GenericPlotter - Plot.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 7 0.0 %
Date: 2024-10-04 18:58:15 Functions: 0 12 0.0 %

          Line data    Source code
       1             : //# Plot.h: Plot objects to be drawn on a canvas.
       2             : //# Copyright (C) 2008
       3             : //# Associated Universities, Inc. Washington DC, USA.
       4             : //#
       5             : //# This library is free software; you can redistribute it and/or modify it
       6             : //# under the terms of the GNU Library General Public License as published by
       7             : //# the Free Software Foundation; either version 2 of the License, or (at your
       8             : //# option) any later version.
       9             : //#
      10             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      11             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      12             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      13             : //# License for more details.
      14             : //#
      15             : //# You should have received a copy of the GNU Library General Public License
      16             : //# along with this library; if not, write to the Free Software Foundation,
      17             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      18             : //#
      19             : //# Correspondence concerning AIPS++ should be addressed as follows:
      20             : //#        Internet email: casa-feedback@nrao.edu.
      21             : //#        Postal address: AIPS++ Project Office
      22             : //#                        National Radio Astronomy Observatory
      23             : //#                        520 Edgemont Road
      24             : //#                        Charlottesville, VA 22903-2475 USA
      25             : //#
      26             : //# $Id: $
      27             : #ifndef PLOT_H_
      28             : #define PLOT_H_
      29             : 
      30             : #include <graphics/GenericPlotter/PlotData.h>
      31             : #include <graphics/GenericPlotter/PlotItem.h>
      32             : 
      33             : #include <casacore/casa/BasicSL/String.h>
      34             : 
      35             : namespace casa {
      36             : 
      37             : // A Plot basically consists of data and customization information.  The data
      38             : // is held by the base class whereas any customization should be handled in
      39             : // subclasses.
      40             : class Plot : public virtual PlotItem {
      41             : public:
      42             :     Plot() { }
      43             : 
      44             :     virtual ~Plot() { }
      45             :     
      46             :     
      47             :     // ABSTRACT METHODS //
      48             :     
      49             :     // Returns the data associated with this plot.
      50             :     virtual PlotDataPtr data() const = 0;
      51             :     
      52             :     // Should be called whenever the underlying PlotData has changed, to let
      53             :     // the plot and its attached canvas know that the plot needs to be redrawn.
      54             :     virtual void dataChanged() = 0;
      55             :     
      56             :     // It's likely that any plot subclass (scatter, bar, function, etc.) will
      57             :     // have lines of some sort, so it's safe to have in the base class.
      58             :     
      59             :     // Returns true if this plot has lines shown, false otherwise.
      60             :     virtual bool linesShown() const = 0;
      61             :     
      62             :     // Sets whether or not lines are shown.  If linesShown is true, the
      63             :     // implementation can decide whether to choose the line style shown, or
      64             :     // just use the last set PlotLine.
      65             :     virtual void setLinesShown(bool linesShown = true) = 0;
      66             :     
      67             :     // Returns a copy of the line used for this plot.  Note: if lines are not
      68             :     // shown, then this behavior is undefined.  The last shown line can be
      69             :     // returned, or a line with style NOLINE, or a null pointer, or....
      70             :     virtual PlotLinePtr line() const = 0;
      71             :     
      72             :     // Sets the plot lines to the given line.  Implies setLinesShown(true)
      73             :     // unless the given line's style is set to NOLINE.
      74             :     virtual void setLine(const PlotLine& line) = 0;
      75             :     
      76             :     
      77             :     // IMPLEMENTED METHODS //
      78             :     
      79             :     // Convenience methods for setting line.
      80             :     // <group>
      81             :     virtual void setLine(const PlotLinePtr line) {
      82             :         if(!line.null()) setLine(*line);
      83             :         else             setLinesShown(false);
      84             :     }
      85             :     virtual void setLine(const casacore::String& color,
      86             :                          PlotLine::Style style = PlotLine::SOLID,
      87             :                          double width = 1.0) {
      88             :         PlotLinePtr l = line();
      89             :         l->setColor(color);
      90             :         l->setStyle(style);
      91             :         l->setWidth(width);
      92             :         setLine(*l);
      93             :     }
      94             :     virtual void setLineColor(const casacore::String& color) {
      95             :         PlotLinePtr l = line();
      96             :         l->setColor(color);
      97             :         setLine(*l);
      98             :     }
      99             :     virtual void setLineStyle(PlotLine::Style style) {
     100             :         PlotLinePtr l = line();
     101             :         l->setStyle(style);
     102             :         setLine(*l);
     103             :     }
     104             :     virtual void setLineWidth(double width) {
     105             :         PlotLinePtr l = line();
     106             :         l->setWidth(width);
     107             :         setLine(*l);
     108             :     }
     109             :     // </group>
     110             : };
     111             : 
     112             : 
     113             : // Scatter plot abstract class.  In addition to the abstract methods in Plot, a
     114             : // scatter plot subclass should also have symbol customization for the points.
     115             : // A scatter plot is expected to consist of PlotPointData.
     116             : class ScatterPlot : public virtual Plot {
     117             : public:
     118             :     ScatterPlot() { }
     119             : 
     120             :     virtual ~ScatterPlot() { }
     121             :     
     122             :     
     123             :     // Overrides Plot::data().
     124             :     virtual PlotDataPtr data() const { return pointData(); }
     125             :     
     126             :     // Returns the data value at the given index.  Just a thin layer over the
     127             :     // PlotPointData functionality.
     128             :     virtual ppoint_t pointAt(unsigned int i) const {
     129             :         PlotPointDataPtr data = pointData();
     130             :         if(!data.null()) return ppoint_t(data->xAt(i), data->yAt(i));
     131             :         else             return ppoint_t(0, 0);
     132             :     }
     133             :     
     134             :     // Implements PlotItem::drawCount().  Provides default implementation that
     135             :     // returns the number of plotted points.
     136             :     virtual unsigned int drawCount() const { return pointData()->size(); }
     137             :     
     138             :     
     139             :     // ABSTRACT METHODS //
     140             :     
     141             :     // Returns the point data used for this plot.
     142             :     virtual PlotPointDataPtr pointData() const = 0;
     143             :     
     144             :     // Get/set to connect points in step rather than line
     145             :     virtual bool linesStep() const = 0;
     146             :     virtual void setLinesStep(bool linesStep = true) = 0;
     147             :     
     148             :     // Returns true if symbols are shown, false otherwise.
     149             :     virtual bool symbolsShown() const = 0;
     150             :     
     151             :     // Sets whether symbols are shown or not.  If symbolsShown is true, the
     152             :     // implementation can decide whether to choose the symbol shown, or just
     153             :     // use the last set PlotSymbol.
     154             :     virtual void setSymbolsShown(bool symbolsShown = true) = 0;
     155             :     
     156             :     // Returns a copy of the symbol for this plot.  Note: if symbols are not
     157             :     // shown, then this behavior is undefined.  The last shown symbol can be
     158             :     // returned, or a symbol with style NOSYMBOL, or a null pointer, or....
     159             :     virtual PlotSymbolPtr symbol() const = 0;
     160             :     
     161             :     // Sets the plot symbols to the given symbol. Implies setSymbolsShown(true)
     162             :     // unless the symbol's style is set to NOSYMBOL.
     163             :     virtual void setSymbol(const PlotSymbol& symbol) = 0;
     164             :     
     165             :     
     166             :     // IMPLEMENTED METHODS //
     167             :     
     168             :     // Convenience methods for setting symbol.
     169             :     // <group>
     170             :     virtual void setSymbol(const PlotSymbolPtr symbol) {
     171             :         if(!symbol.null()) setSymbol(*symbol);
     172             :         else               setSymbolsShown(false);
     173             :     }
     174             :     virtual void setSymbol(PlotSymbol::Symbol s) {
     175             :         PlotSymbolPtr sym = symbol();
     176             :         sym->setSymbol(s);
     177             :         setSymbol(*sym);
     178             :     }
     179             :     virtual void setSymbol(char s) {
     180             :         PlotSymbolPtr sym = symbol();
     181             :         sym->setSymbol(s);
     182             :         setSymbol(*sym);
     183             :     }
     184             :     virtual void setSymbolSize(double width, double height) {
     185             :         PlotSymbolPtr sym = symbol();
     186             :         sym->setSize(width, height);
     187             :         setSymbol(*sym);
     188             :     }
     189             :     virtual void setSymbolLine(const PlotLine& line) {
     190             :         PlotSymbolPtr sym = symbol();
     191             :         sym->setLine(line);
     192             :         setSymbol(*sym);
     193             :     }
     194             :     virtual void setSymbolLine(const PlotLinePtr line) {
     195             :         if(!line.null()) setSymbolLine(*line); }
     196             :     virtual void setSymbolLine(const casacore::String& color,
     197             :             PlotLine::Style style = PlotLine::SOLID, double width = 1.0) {
     198             :         PlotSymbolPtr sym = symbol();
     199             :         sym->setLine(color, style, width);
     200             :         setSymbol(*sym);
     201             :     }
     202             :     virtual void setSymbolAreaFill(const PlotAreaFill& fill) {
     203             :         PlotSymbolPtr sym = symbol();
     204             :         sym->setAreaFill(fill);
     205             :         setSymbol(*sym);
     206             :     }
     207             :     virtual void setSymbolAreaFill(const PlotAreaFillPtr fill) {
     208             :         if(!fill.null()) setSymbolAreaFill(*fill); }
     209             :     virtual void setSymbolAreaFill(const casacore::String& color,
     210             :             PlotAreaFill::Pattern pattern = PlotAreaFill::FILL) {
     211             :         PlotSymbolPtr sym = symbol();
     212             :         sym->setAreaFill(color, pattern);
     213             :         setSymbol(*sym);
     214             :     }
     215             :     // </group>
     216             : };
     217             : 
     218             : 
     219             : // Subclass of ScatterPlot that adds masking functionality.  The ScatterPlot
     220             : // customization methods (lines, symbols, etc.) are expected to apply only to
     221             : // unmasked data, while additional methods are provided in MaskedScatterPlot
     222             : // to customize the masked data (which is not shown by default).
     223             : class MaskedScatterPlot : public virtual ScatterPlot {
     224             : public:
     225             :     MaskedScatterPlot() { }
     226             :     
     227             :     virtual ~MaskedScatterPlot() { }
     228             :     
     229             :     
     230             :     // Overrides ScatterPlot::pointData().
     231             :     virtual PlotPointDataPtr pointData() const { return maskedData(); }
     232             :     
     233             :     // Returns whether the data at the given index is masked or not.  Just a
     234             :     // thin layer over the PlotMaskedPointData functionality.
     235             :     virtual bool maskedAt(unsigned int index) const {
     236             :         PlotMaskedPointDataPtr data = maskedData();
     237             :         return !data.null() && data->maskedAt(index);
     238             :     }
     239             :     
     240             :     
     241             :     // ABSTRACT METHODS //
     242             :     
     243             :     // Returns the masked data used for this plot.
     244             :     virtual PlotMaskedPointDataPtr maskedData() const = 0;
     245             :     virtual void clearData() = 0;
     246             : 
     247             :     // Returns true if this plot has lines shown for masked points, false
     248             :     // otherwise.
     249             :     virtual bool maskedLinesShown() const = 0;
     250             :     
     251             :     // Sets whether or not lines are shown for masked points.  If linesShown is
     252             :     // true, the implementation can decide whether to choose the line style
     253             :     // shown, or just use the last set PlotLine.
     254             :     virtual void setMaskedLinesShown(bool linesShown = true) = 0;
     255             :     
     256             :     // Returns a copy of the line used for masked points.  Note: if lines are
     257             :     // not shown, then this behavior is undefined.  The last shown line can be
     258             :     // returned, or a line with style NOLINE, or a null pointer, or....
     259             :     virtual PlotLinePtr maskedLine() const = 0;
     260             :     
     261             :     // Sets the lines for masked points to the given.  Implies
     262             :     // setMaskedLinesShown(true) unless the given line's style is set to
     263             :     // NOLINE.
     264             :     virtual void setMaskedLine(const PlotLine& line) = 0;
     265             :     
     266             :     // Convenience methods for setting line for masked points.
     267             :     // <group>
     268             :     virtual void setMaskedLine(const PlotLinePtr line) {
     269             :         if(!line.null()) setMaskedLine(*line);
     270             :         else             setMaskedLinesShown(false);
     271             :     }
     272             :     virtual void setMaskedLine(const casacore::String& color,
     273             :                          PlotLine::Style style = PlotLine::SOLID,
     274             :                          double width = 1.0) {
     275             :         PlotLinePtr l = maskedLine();
     276             :         l->setColor(color);
     277             :         l->setStyle(style);
     278             :         l->setWidth(width);
     279             :         setMaskedLine(*l);
     280             :     }
     281             :     virtual void setMaskedLineColor(const casacore::String& color) {
     282             :         PlotLinePtr l = maskedLine();
     283             :         l->setColor(color);
     284             :         setMaskedLine(*l);
     285             :     }
     286             :     virtual void setMaskedLineStyle(PlotLine::Style style) {
     287             :         PlotLinePtr l = maskedLine();
     288             :         l->setStyle(style);
     289             :         setMaskedLine(*l);
     290             :     }
     291             :     virtual void setMaskedLineWidth(double width) {
     292             :         PlotLinePtr l = maskedLine();
     293             :         l->setWidth(width);
     294             :         setMaskedLine(*l);
     295             :     }
     296             :     // Get/set connect masked points in step rather than line
     297             :     virtual bool maskedLinesStep() const = 0;
     298             :     virtual void setMaskedLinesStep(bool linesStep = true) = 0;
     299             :     
     300             :     // </group>
     301             :     
     302             :     // Returns true if symbols are shown for masked points, false otherwise.
     303             :     virtual bool maskedSymbolsShown() const = 0;
     304             :     
     305             :     // Sets whether symbols are shown or not for masked points.  If
     306             :     // symbolsShown is true, the implementation can decide whether to choose
     307             :     // the symbol shown, or just use the last set PlotSymbol.
     308             :     virtual void setMaskedSymbolsShown(bool symbolsShown = true) = 0;
     309             :     
     310             :     // Returns a copy of the symbol for masked points.  Note: if symbols are
     311             :     /// not shown, then this behavior is undefined.  The last shown symbol can
     312             :     // be returned, or a symbol with style NOSYMBOL, or a null pointer, or....
     313             :     virtual PlotSymbolPtr maskedSymbol() const = 0;
     314             :     
     315             :     // Sets the symbols for masked points to the given. Implies
     316             :     // setMaskedSymbolsShown(true) unless the symbol's style is set to
     317             :     // NOSYMBOL.
     318             :     virtual void setMaskedSymbol(const PlotSymbol& symbol) = 0;
     319             :     
     320             :     // Convenience methods for setting symbol for masked points.
     321             :     // <group>
     322             :     virtual void setMaskedSymbol(const PlotSymbolPtr symbol) {
     323             :         if(!symbol.null()) setMaskedSymbol(*symbol);
     324             :         else               setMaskedSymbolsShown(false);
     325             :     }
     326             :     virtual void setMaskedSymbol(PlotSymbol::Symbol s) {
     327             :         PlotSymbolPtr sym = maskedSymbol();
     328             :         sym->setSymbol(s);
     329             :         setMaskedSymbol(*sym);
     330             :     }
     331             :     virtual void setMaskedSymbol(char s) {
     332             :         PlotSymbolPtr sym = maskedSymbol();
     333             :         sym->setSymbol(s);
     334             :         setMaskedSymbol(*sym);
     335             :     }
     336             :     virtual void setMaskedSymbolSize(double width, double height) {
     337             :         PlotSymbolPtr sym = maskedSymbol();
     338             :         sym->setSize(width, height);
     339             :         setMaskedSymbol(*sym);
     340             :     }
     341             :     virtual void setMaskedSymbolLine(const PlotLine& line) {
     342             :         PlotSymbolPtr sym = maskedSymbol();
     343             :         sym->setLine(line);
     344             :         setMaskedSymbol(*sym);
     345             :     }
     346             :     virtual void setMaskedSymbolLine(const PlotLinePtr line) {
     347             :         if(!line.null()) setMaskedSymbolLine(*line); }
     348             :     virtual void setMaskedSymbolLine(const casacore::String& color,
     349             :             PlotLine::Style style = PlotLine::SOLID, double width = 1.0) {
     350             :         PlotSymbolPtr sym = maskedSymbol();
     351             :         sym->setLine(color, style, width);
     352             :         setMaskedSymbol(*sym);
     353             :     }
     354             :     virtual void setMaskedSymbolAreaFill(const PlotAreaFill& fill) {
     355             :         PlotSymbolPtr sym = maskedSymbol();
     356             :         sym->setAreaFill(fill);
     357             :         setMaskedSymbol(*sym);
     358             :     }
     359             :     virtual void setMaskedSymbolAreaFill(const PlotAreaFillPtr fill) {
     360             :         if(!fill.null()) setMaskedSymbolAreaFill(*fill); }
     361             :     virtual void setMaskedSymbolAreaFill(const casacore::String& color,
     362             :             PlotAreaFill::Pattern pattern = PlotAreaFill::FILL) {
     363             :         PlotSymbolPtr sym = maskedSymbol();
     364             :         sym->setAreaFill(color, pattern);
     365             :         setMaskedSymbol(*sym);
     366             :     }
     367             :     // </group>
     368             : };
     369             : 
     370             : 
     371             : // An error plot is a scatter plot with error bars drawn.  It is expected to
     372             : // consist of PlotErrorData.
     373             : class ErrorPlot : public virtual ScatterPlot {
     374             : public:
     375             :     ErrorPlot() { }
     376             :     
     377             :     virtual ~ErrorPlot() { }
     378             : 
     379             :     
     380             :     // Overrides ScatterPlot::pointData().
     381             :     virtual PlotPointDataPtr pointData() const { return errorData(); }
     382             :     
     383             :     
     384             :     // ABSTRACT METHODS //
     385             :     
     386             :     // Returns the error data used for this plot.
     387             :     virtual PlotErrorDataPtr errorData() const = 0;
     388             :     
     389             :     // Returns whether the error bar line is shown or not.
     390             :     virtual bool errorLineShown() const = 0;
     391             :     
     392             :     // Sets whether the error bar line is shown.  If show is true, the
     393             :     // implementation can decide whether to choose the line shown, or just
     394             :     // use the last set PlotLine.
     395             :     virtual void setErrorLineShown(bool show = true) = 0;
     396             :     
     397             :     // Returns the line used to draw the error bars.
     398             :     virtual PlotLinePtr errorLine() const = 0;
     399             :     
     400             :     // Sets the line used to draw the error bars.
     401             :     virtual void setErrorLine(const PlotLine& line) = 0;
     402             :     
     403             :     // Convenience methods for setting error line.
     404             :     // <group>
     405             :     virtual void setErrorLine(const PlotLinePtr line) {
     406             :         if(!line.null()) setErrorLine(*line);
     407             :         else             setErrorLineShown(false);
     408             :     }
     409             :     virtual void setErrorLine(const casacore::String& color,
     410             :                               PlotLine::Style style = PlotLine::SOLID,
     411             :                               double width = 1.0) {
     412             :         PlotLinePtr line = errorLine();
     413             :         line->setColor(color);
     414             :         line->setStyle(style);
     415             :         line->setWidth(width);
     416             :         setErrorLine(*line);
     417             :     }
     418             :     virtual void setErrorLineColor(const casacore::String& color) {
     419             :         PlotLinePtr line = errorLine();
     420             :         line->setColor(color);
     421             :         setErrorLine(*line);
     422             :     }
     423             :     virtual void setErrorLineStyle(PlotLine::Style style) {
     424             :         PlotLinePtr line = errorLine();
     425             :         line->setStyle(style);
     426             :         setErrorLine(*line);
     427             :     }
     428             :     virtual void setErrorLineWidth(double width) {
     429             :         PlotLinePtr line = errorLine();
     430             :         line->setWidth(width);
     431             :         setErrorLine(*line);
     432             :     }
     433             :     // </group>
     434             :     
     435             :     // Returns the "cap" size of the error bar.  The cap is the perpendicular
     436             :     // line at the end of the error bar (that makes the error bar look like an
     437             :     // I rather than a |).
     438             :     virtual unsigned int errorCapSize() const = 0;
     439             :     
     440             :     // Sets the error bar cap size in pixels.
     441             :     virtual void setErrorCapSize(unsigned int capSize) = 0;
     442             : };
     443             : 
     444             : 
     445             : // An color plot is a scatter plot with differentiated colors for points in
     446             : // different bins.  It is expected to consist of PlotBinnedData.
     447             : class ColoredPlot : public virtual ScatterPlot {
     448             : public:
     449             :     // Constructor.
     450             :     ColoredPlot() { }
     451             :     
     452             :     // Destructor.
     453             :     virtual ~ColoredPlot() { }
     454             : 
     455             :     
     456             :     // Overrides ScatterPlot::pointData().
     457             :     virtual PlotPointDataPtr pointData() const { return binnedColorData(); }
     458             :     
     459             :     
     460             :     // ABSTRACT METHODS //
     461             :     
     462             :     // Returns the binned data used for this plot.
     463             :     virtual PlotBinnedDataPtr binnedColorData() const = 0;
     464             :     
     465             :     // Returns the color to use for the bin at the given index.  The color
     466             :     // applies to the symbol fill color.
     467             :     virtual PlotColorPtr colorForBin(unsigned int bin) const = 0;
     468             :     
     469             :     // Sets the color to use for the bin at the given index.  The color applies
     470             :     // to the symbol fill color.
     471             :     virtual void setColorForBin(unsigned int bin, const PlotColorPtr color) = 0;
     472             : };
     473             : 
     474             : 
     475             : // Bar plot abstract class.  It is expected to take data in the form of
     476             : // PlotPointData.  The line methods in Plot are used for the bar outlines.
     477             : class BarPlot : public virtual Plot {
     478             : public:
     479             :     BarPlot() { }
     480             :     
     481             :     virtual ~BarPlot() { }
     482             : 
     483             :     
     484             :     // Overrides Plot::data().
     485             :     PlotDataPtr data() const { return pointData(); }
     486             :     
     487             :     // Returns the data value at the given index.  Just a thin layer over the
     488             :     // PlotPointData functionality.
     489             :     virtual ppoint_t pointAt(unsigned int i) const {
     490             :         PlotPointDataPtr data = pointData();
     491             :         if(!data.null()) return ppoint_t(data->xAt(i), data->yAt(i));
     492             :         else             return ppoint_t(0, 0);
     493             :     }
     494             :     
     495             :     // Implements PlotItem::drawCount().  Provides default implementation that
     496             :     // returns the number of plotted points.
     497             :     virtual unsigned int drawCount() const { return pointData()->size(); }
     498             :     
     499             :     
     500             :     // ABSTRACT METHODS //
     501             :     
     502             :     // Returns the data used for the plot.
     503             :     virtual PlotPointDataPtr pointData() const = 0;
     504             :     
     505             :     // Returns whether or not the bars have an area fill or not.
     506             :     virtual bool areaIsFilled() const = 0;
     507             :     
     508             :     // Sets whether the bars have an area fill.  If fill is true, the
     509             :     // implementation can decide whether to choose the area fill, or just
     510             :     // use the last set PlotAreaFill.
     511             :     virtual void setAreaFilled(bool fill = true) = 0;
     512             :     
     513             :     // Returns a copy of the area fill used for the bar interiors.
     514             :     virtual PlotAreaFillPtr areaFill() const = 0;
     515             :     
     516             :     // Sets the area fill used for the bars to the given.
     517             :     virtual void setAreaFill(const PlotAreaFill& areaFill) = 0;
     518             :     
     519             :     
     520             :     // IMPLEMENTED METHODS //
     521             :     
     522             :     // Convenience methods for setting area fill.
     523             :     // <group>
     524             :     virtual void setAreaFill(const PlotAreaFillPtr areaFill) {
     525             :         if(!areaFill.null()) setAreaFill(*areaFill);
     526             :         else                 setAreaFilled(false);
     527             :     }
     528             :     virtual void setAreaFill(const casacore::String& color,
     529             :                           PlotAreaFill::Pattern pattern = PlotAreaFill::FILL) {
     530             :         PlotAreaFillPtr fill = areaFill();
     531             :         fill->setColor(color);
     532             :         fill->setPattern(pattern);
     533             :         setAreaFill(*fill);
     534             :     }
     535             :     // </group>
     536             : };
     537             : 
     538             : 
     539             : // Plot used to show raster (image-like) data.  Expected to use PlotRasterData.
     540             : // The line methods in Plot are used for contour lines (if any).  A RasterPlot
     541             : // can either use the data values directly as colors, or automatically pick
     542             : // colors based on a range of values and a colorbar.  (See PlotRasterData.)
     543             : class RasterPlot : public virtual Plot {
     544             : public:    
     545             :     RasterPlot() { }
     546             :     
     547             :     virtual ~RasterPlot() { }
     548             : 
     549             :     
     550             :     // Overrides Plot::data().
     551             :     PlotDataPtr data() const { return rasterData(); }
     552             :     
     553             :     // Returns the data at the given point.  Just a thin layer over data
     554             :     // functionality.
     555             :     virtual double valueAt(double x, double y) const {
     556             :         PlotRasterDataPtr data = rasterData();
     557             :         if(!data.null()) return data->valueAt(x, y);
     558             :         else             return 0;
     559             :     }
     560             :     
     561             :     
     562             :     // ABSTRACT METHODS //
     563             :     
     564             :     // Returns the data used.
     565             :     virtual PlotRasterDataPtr rasterData() const = 0;
     566             :     
     567             :     // Sets the x range.
     568             :     virtual void setXRange(double from, double to) = 0;
     569             :     
     570             :     // Sets the y range.
     571             :     virtual void setYRange(double from, double to) = 0;
     572             :     
     573             :     // Returns the data format.  See PlotRasterData.
     574             :     virtual PlotRasterData::Format dataFormat() const = 0;
     575             :     
     576             :     // Sets the data format.  See PlotRasterData.
     577             :     virtual void setDataFormat(PlotRasterData::Format f) = 0;
     578             :     
     579             :     // Returns the data origin.  See PlotRasterData.
     580             :     virtual PlotRasterData::Origin dataOrigin() const = 0;
     581             :     
     582             :     // Sets the data origin.  See PlotRasterData.
     583             :     virtual void setDataOrigin(PlotRasterData::Origin o) = 0;
     584             :     
     585             :     // Returns the contour line levels, if any.
     586             :     virtual std::vector<double> contourLines() const = 0;
     587             :     
     588             :     // Sets the contour line levels.
     589             :     virtual void setContourLines(const std::vector<double>& lines) = 0;
     590             : };
     591             : 
     592             : 
     593             : /* Smart pointer definitions */
     594             : 
     595           0 : INHERITANCE_POINTER2(Plot, PlotPtr, PlotItem, PlotItemPtr)
     596           0 : INHERITANCE_POINTER(ScatterPlot, ScatterPlotPtr, Plot, PlotPtr, PlotItem,
     597             :                     PlotItemPtr)
     598           0 : INHERITANCE_POINTER(MaskedScatterPlot, MaskedScatterPlotPtr, ScatterPlot,
     599             :                     ScatterPlotPtr, PlotItem, PlotItemPtr)
     600           0 : INHERITANCE_POINTER(ErrorPlot, ErrorPlotPtr, ScatterPlot, ScatterPlotPtr,
     601             :                     PlotItem, PlotItemPtr)
     602           0 : INHERITANCE_POINTER(ColoredPlot, ColoredPlotPtr, ScatterPlot, ScatterPlotPtr,
     603             :                     PlotItem, PlotItemPtr)
     604           0 : INHERITANCE_POINTER(BarPlot, BarPlotPtr, Plot, PlotPtr, PlotItem, PlotItemPtr)
     605           0 : INHERITANCE_POINTER(RasterPlot, RasterPlotPtr, Plot, PlotPtr, PlotItem,
     606             :                     PlotItemPtr)
     607             : 
     608             : }
     609             : 
     610             : #endif /*PLOT_H_*/

Generated by: LCOV version 1.16