casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QPFactory.h
Go to the documentation of this file.
00001 //# QPFactory.h: Qwt implementation of generic PlotFactory class.
00002 //# Copyright (C) 2008
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id: $
00027 #ifndef QPFACTORY_H_
00028 #define QPFACTORY_H_
00029 
00030 #ifdef AIPS_HAS_QWT
00031 
00032 #include <graphics/GenericPlotter/PlotFactory.h>
00033 
00034 #include <casa/namespace.h>
00035 
00036 namespace casa {
00037 
00038 // Implementation of PlotFactory for Qwt plotter.
00039 class QPFactory : public PlotFactory {
00040 public:
00041     // Constructor.
00042     QPFactory();
00043     
00044     // Destructor.
00045     ~QPFactory();
00046     
00047     
00048     // Import overloaded methods.    
00049     using PlotFactory::plotter;
00050     using PlotFactory::annotation;
00051     using PlotFactory::shapeRectangle;
00052     using PlotFactory::shapeEllipse;
00053     using PlotFactory::shapePolygon;
00054     using PlotFactory::shapeArrow;
00055     using PlotFactory::shapePath;
00056     using PlotFactory::point;
00057     using PlotFactory::color;
00058     using PlotFactory::font;
00059     using PlotFactory::line;
00060     using PlotFactory::symbol;
00061     using PlotFactory::areaFill;
00062 
00063     
00064     // Implements PlotFactory::canvasHasThreadedDrawing().
00065     bool canvasHasThreadedDrawing() const { return true; }
00066     
00067     // Implements PlotFactory::canvasHasCahcedLayerDrawing().
00068     bool canvasHasCachedLayerDrawing() const { return true; }
00069     
00070     // Implements PlotFactory::canvasHasCachedAxesStack().
00071     bool canvasHasCachedAxesStack() const { return true; }
00072     
00073     
00074     // Implements PlotFactory::execLoop().
00075     int execLoop();
00076     
00077     // Implements PlotFactory::implementation().
00078     Plotter::Implementation implementation() const { return Plotter::QWT; }
00079     
00080     
00081     // Implements PlotFactory::plotter().
00082     PlotterPtr plotter(const String& windowTitle = "Qwt Plotter",
00083             bool showSingleCanvas = true, bool showGUI = true,
00084             int logEventFlags = PlotLogger::NO_EVENTS,
00085             bool smartDelete = true) const;
00086     
00087     // Implements PlotFactory::plotter().
00088     PlotterPtr plotter(unsigned int nrows, unsigned int ncols,
00089             const String& windowTitle = "Qwt Plotter", bool showGUI = true,
00090             int logEventFlags = PlotLogger::NO_EVENTS,
00091             bool smartDelete = true) const;
00092     
00093     // Implements PlotFactory::canvas().
00094     PlotCanvasPtr canvas(bool smartDelete = true) const;
00095     
00096     // Implements PlotFactory::panel().
00097     PlotPanelPtr panel(bool smartDelete = true) const;
00098     
00099     // Implements PlotFactory::button().
00100     PlotButtonPtr button(const String& str, bool isText = true,
00101             bool toggleable = false, bool smartDelete = true) const;
00102     
00103     // Implements PlotFactory::checkbox().
00104     PlotCheckboxPtr checkbox(const String& str, bool smartDelete = true) const;
00105 
00106 
00107     // Implements PlotFactory::scatterPlot().
00108     ScatterPlotPtr scatterPlot(PlotPointDataPtr data,
00109             const String& title= "Scatter Plot", bool smartDelete= true) const;
00110     
00111     // Implements PlotFactory::barPlot().
00112     BarPlotPtr barPlot(PlotPointDataPtr data, const String& title = "Bar Plot",
00113             bool smartDelete = true) const;
00114     
00115     // Implements PlotFactory::rasterPlot().
00116     RasterPlotPtr rasterPlot(PlotRasterDataPtr data,
00117             const String& title = "Raster Plot",
00118             PlotRasterData::Format format = PlotRasterData::RGB32,
00119             bool smartDelete = true) const;
00120     
00121     // Implements PlotFactory::annotation().
00122     PlotAnnotationPtr annotation(const String& text,
00123             const PlotCoordinate& coord, bool smartDelete = true) const;
00124     
00125     // Implements PlotFactory::shapeRectangle().
00126     PlotShapeRectanglePtr shapeRectangle(const PlotCoordinate& upperLeft,
00127             const PlotCoordinate& lowerRight, bool smartDelete = true) const;
00128     
00129     // Implements PlotFactory::shapeEllipse().
00130     PlotShapeEllipsePtr shapeEllipse(const PlotCoordinate& center,
00131             const PlotCoordinate& radii, bool smartDelete = true) const;
00132     
00133     // Implements PlotFactory::shapePolygon().
00134     PlotShapePolygonPtr shapePolygon(const vector<PlotCoordinate>& c,
00135             bool smartDelete = true) const;
00136     
00137     // Implements PlotFactory::shapeLine().
00138     PlotShapeLinePtr shapeLine(double location, PlotAxis axis,
00139             bool smartDelete = true) const;
00140     
00141     // Implements PlotFactory::shapeArrow().
00142     PlotShapeArrowPtr shapeArrow(const PlotCoordinate& from,
00143             const PlotCoordinate& to, PlotShapeArrow::Style fromStyle =
00144             PlotShapeArrow::NOARROW, PlotShapeArrow::Style toStyle =
00145             PlotShapeArrow::V_ARROW, bool smartDelete = true) const;
00146     
00147     // Implements PlotFactory::shapePath().
00148     PlotShapePathPtr shapePath(const vector<PlotCoordinate>& coords,
00149             bool smartDelete = true) const;
00150     
00151     // Implements PlotFactory::shapeArc().
00152     PlotShapeArcPtr shapeArc(const PlotCoordinate& start,
00153             const PlotCoordinate& widthHeight, int startAngle,
00154             int spanAngle, bool smartDelete = true) const;
00155     
00156     // Implements PlotFactory::point().
00157     PlotPointPtr point(const PlotCoordinate& coord,
00158             bool smartDelete = true) const;
00159 
00160     
00161     // Implements PlotFactory::color().
00162     // <group>
00163     PlotColorPtr color(const String& color, bool smartDelete = true) const;
00164     PlotColorPtr color(const PlotColor& copy, bool smartDelete = true) const;
00165     // </group>
00166     
00167     // Implements PlotFactory::allNamedColors().
00168     vector<String> allNamedColors() const;
00169     
00170     // Implements PlotFactory::font().
00171     // <group>
00172     PlotFontPtr font(const String& family = "Arial", double pointSize = 12.0,
00173             const String& color = "000000", bool bold = false,
00174             bool italics = false, bool underline = false,
00175             bool smartDelete = true) const;
00176     PlotFontPtr font(const PlotFont& copy, bool smartDelete = true) const;
00177     // </group>
00178     
00179     // Implements PlotFactory::areaFill().
00180     // <group>
00181     PlotAreaFillPtr areaFill(const String& color,
00182             PlotAreaFill::Pattern pattern = PlotAreaFill::NOFILL,
00183             bool smartDelete = true) const;    
00184     PlotAreaFillPtr areaFill(const PlotAreaFill& copy,
00185             bool smartDelete = true) const;
00186     // </group>
00187     
00188     // Implements PlotFactory::line().
00189     // <group>
00190     PlotLinePtr line(const String& color,
00191             PlotLine::Style style = PlotLine::SOLID, double width = 1.0,
00192             bool smartDelete = true) const;
00193     PlotLinePtr line(const PlotLine& copy, bool smartDelete = true) const;
00194     // </group>
00195     
00196     // Implements PlotFactory::symbol().
00197     // <group>
00198     PlotSymbolPtr symbol(PlotSymbol::Symbol style,
00199             bool smartDelete = true) const;
00200     PlotSymbolPtr symbol(const PlotSymbol& copy, bool smartDelete= true) const;
00201     // </group>
00202 
00203 
00204     // Overrides PlotFactory tool methods.
00205     // <group>
00206     PlotSelectToolPtr selectTool(bool smartDelete = true) const;
00207     PlotZoomToolPtr zoomTool(bool smartDelete = true) const;
00208     PlotPanToolPtr panTool(bool smartDelete = true) const;
00209     PlotTrackerToolPtr trackerTool(bool smartDelete = true) const;
00210     
00211     PlotSelectToolPtr selectTool(PlotAxis xAxis, PlotAxis yAxis,
00212             PlotCoordinate::System system, bool smartDelete = true) const;
00213     PlotZoomToolPtr zoomTool(PlotAxis xAxis, PlotAxis yAxis,
00214             PlotCoordinate::System system, bool smartDelete = true) const;
00215     PlotPanToolPtr panTool(PlotAxis xAxis, PlotAxis yAxis,
00216             PlotCoordinate::System system, bool smartDelete = true) const;
00217     PlotTrackerToolPtr trackerTool(PlotAxis xAxis, PlotAxis yAxis,
00218             PlotCoordinate::System system, bool smartDelete = true) const;
00219     // </group>
00220     
00221     
00222     // Implements PlotFactory::mutex().
00223     PlotMutexPtr mutex(bool smartDelete = true) const;
00224     
00225     
00226     // Defaults //
00227     
00228     // Returns a default font for annotations.  Currently: 14-point black
00229     // Arial.
00230     static PlotFontPtr defaultAnnotationFont(bool smartDelete = true);
00231     
00232     // Returns a default area fill for bar plots.  Currently: blue filled.
00233     static PlotAreaFillPtr defaultBarPlotAreaFill(bool smartDelete = true);
00234     
00235     // Returns a default line for legends.  Currently: 1px black solid.
00236     static PlotLinePtr defaultLegendLine(bool smartDelete = true);
00237     
00238     // Returns a default area fill for legends.  Currently: white filled.
00239     static PlotAreaFillPtr defaultLegendAreaFill(bool smartDelete = true);
00240     
00241     // Returns a default line for shapes.  Currently: 1px black solid.
00242     static PlotLinePtr defaultShapeLine(bool smartDelete = true);
00243     
00244     // Returns a default area fill for shapes.  Currently: no fill.
00245     static PlotAreaFillPtr defaultShapeAreaFill(bool smartDelete = true);
00246     
00247     // Returns a default line for scatter plots.  Currently: no line.
00248     static PlotLinePtr defaultPlotLine(bool smartDelete = true);
00249 
00250     // Returns a default symbol for scatter plots.  Currently: 8x8 blue
00251     // circle with no outline.
00252     static PlotSymbolPtr defaultPlotSymbol(bool smartDelete = true);
00253     
00254     // Returns a default masked symbol for masked scatter plots.  Currently:
00255     // 8x8 red no symbol with no outline.
00256     static PlotSymbolPtr defaultPlotMaskedSymbol(bool smartDelete = true);
00257     
00258     // The default error bar cap, currently 10.
00259     static const unsigned int DEFAULT_ERROR_CAP;
00260 };
00261 
00262 }
00263 
00264 #endif
00265 
00266 #endif /*QPFACTORY_H_*/