casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QPFactory.h
Go to the documentation of this file.
1 //# QPFactory.h: Qwt implementation of generic PlotFactory class.
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: aips2-request@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 QPFACTORY_H_
28 #define QPFACTORY_H_
29 
30 #ifdef AIPS_HAS_QWT
31 
33 
34 namespace casa {
35 
36 // Implementation of PlotFactory for Qwt plotter.
37 class QPFactory : public PlotFactory {
38 public:
39  // Constructor.
40  QPFactory();
41 
42  // Destructor.
43  ~QPFactory();
44 
45 
46  // Import overloaded methods.
54  using PlotFactory::point;
55  using PlotFactory::color;
56  using PlotFactory::font;
57  using PlotFactory::line;
58  using PlotFactory::symbol;
60 
61 
62  // Implements PlotFactory::canvasHasThreadedDrawing().
63  bool canvasHasThreadedDrawing() const { return true; }
64 
65  // Implements PlotFactory::canvasHasCahcedLayerDrawing().
66  bool canvasHasCachedLayerDrawing() const { return true; }
67 
68  // Implements PlotFactory::canvasHasCachedAxesStack().
69  bool canvasHasCachedAxesStack() const { return true; }
70 
71 
72  // Implements PlotFactory::execLoop().
73  int execLoop();
74 
75  // Implements PlotFactory::implementation().
76  Plotter::Implementation implementation() const { return Plotter::QWT; }
77 
78 
79  // Implements PlotFactory::plotter().
80  PlotterPtr plotter(const casacore::String& windowTitle = "Qwt Plotter",
81  bool showSingleCanvas = true, bool showGUI = true,
82  int logEventFlags = PlotLogger::NO_EVENTS,
83  bool smartDelete = true) const;
84 
85  // Implements PlotFactory::plotter().
86  PlotterPtr plotter(unsigned int nrows, unsigned int ncols,
87  const casacore::String& windowTitle = "Qwt Plotter", bool showGUI = true,
88  int logEventFlags = PlotLogger::NO_EVENTS,
89  bool smartDelete = true) const;
90 
91  // Implements PlotFactory::canvas().
92  PlotCanvasPtr canvas(bool smartDelete = true) const;
93 
94  // Implements PlotFactory::panel().
95  PlotPanelPtr panel(bool smartDelete = true) const;
96 
97  // Implements PlotFactory::button().
98  PlotButtonPtr button(const casacore::String& str, bool isText = true,
99  bool toggleable = false, bool smartDelete = true) const;
100 
101  // Implements PlotFactory::checkbox().
102  PlotCheckboxPtr checkbox(const casacore::String& str, bool smartDelete = true) const;
103 
104 
105  // Implements PlotFactory::scatterPlot().
106  ScatterPlotPtr scatterPlot(PlotPointDataPtr data,
107  const casacore::String& title= "Scatter Plot", bool smartDelete= true) const;
108 
109  // Implements PlotFactory::barPlot().
110  BarPlotPtr barPlot(PlotPointDataPtr data, const casacore::String& title = "Bar Plot",
111  bool smartDelete = true) const;
112 
113  // Implements PlotFactory::rasterPlot().
114  RasterPlotPtr rasterPlot(PlotRasterDataPtr data,
115  const casacore::String& title = "Raster Plot",
116  PlotRasterData::Format format = PlotRasterData::RGB32,
117  bool smartDelete = true) const;
118 
119  // Implements PlotFactory::annotation().
120  PlotAnnotationPtr annotation(const casacore::String& text,
121  const PlotCoordinate& coord, bool smartDelete = true) const;
122 
123  // Implements PlotFactory::shapeRectangle().
124  PlotShapeRectanglePtr shapeRectangle(const PlotCoordinate& upperLeft,
125  const PlotCoordinate& lowerRight, bool smartDelete = true) const;
126 
127  // Implements PlotFactory::shapeEllipse().
128  PlotShapeEllipsePtr shapeEllipse(const PlotCoordinate& center,
129  const PlotCoordinate& radii, bool smartDelete = true) const;
130 
131  // Implements PlotFactory::shapePolygon().
132  PlotShapePolygonPtr shapePolygon(const std::vector<PlotCoordinate>& c,
133  bool smartDelete = true) const;
134 
135  // Implements PlotFactory::shapeLine().
136  PlotShapeLinePtr shapeLine(double location, PlotAxis axis,
137  bool smartDelete = true) const;
138 
139  // Implements PlotFactory::shapeArrow().
140  PlotShapeArrowPtr shapeArrow(const PlotCoordinate& from,
141  const PlotCoordinate& to, PlotShapeArrow::Style fromStyle =
143  PlotShapeArrow::V_ARROW, bool smartDelete = true) const;
144 
145  // Implements PlotFactory::shapePath().
146  PlotShapePathPtr shapePath(const std::vector<PlotCoordinate>& coords,
147  bool smartDelete = true) const;
148 
149  // Implements PlotFactory::shapeArc().
150  PlotShapeArcPtr shapeArc(const PlotCoordinate& start,
151  const PlotCoordinate& widthHeight, int startAngle,
152  int spanAngle, bool smartDelete = true) const;
153 
154  // Implements PlotFactory::point().
155  PlotPointPtr point(const PlotCoordinate& coord,
156  bool smartDelete = true) const;
157 
158 
159  // Implements PlotFactory::color().
160  // <group>
161  PlotColorPtr color(const casacore::String& color, bool smartDelete = true) const;
162  PlotColorPtr color(const PlotColor& copy, bool smartDelete = true) const;
163  // </group>
164 
165  // Implements PlotFactory::allNamedColors().
166  std::vector<casacore::String> allNamedColors() const;
167 
168  // Implements PlotFactory::font().
169  // <group>
170  PlotFontPtr font(const casacore::String& family = "Arial", double pointSize = 12.0,
171  const casacore::String& color = "000000", bool bold = false,
172  bool italics = false, bool underline = false,
173  bool smartDelete = true) const;
174  PlotFontPtr font(const PlotFont& copy, bool smartDelete = true) const;
175  // </group>
176 
177  // Implements PlotFactory::areaFill().
178  // <group>
179  PlotAreaFillPtr areaFill(const casacore::String& color,
181  bool smartDelete = true) const;
182  PlotAreaFillPtr areaFill(const PlotAreaFill& copy,
183  bool smartDelete = true) const;
184  // </group>
185 
186  // Implements PlotFactory::line().
187  // <group>
188  PlotLinePtr line(const casacore::String& color,
189  PlotLine::Style style = PlotLine::SOLID, double width = 1.0,
190  bool smartDelete = true) const;
191  PlotLinePtr line(const PlotLine& copy, bool smartDelete = true) const;
192  // </group>
193 
194  // Implements PlotFactory::symbol().
195  // <group>
196  PlotSymbolPtr symbol(PlotSymbol::Symbol style,
197  bool smartDelete = true) const;
198  PlotSymbolPtr symbol(const PlotSymbol& copy, bool smartDelete= true) const;
199  // </group>
200 
201 
202  // Overrides PlotFactory tool methods.
203  // <group>
204  PlotSelectToolPtr selectTool(bool smartDelete = true) const;
205  PlotZoomToolPtr zoomTool(bool smartDelete = true) const;
206  PlotPanToolPtr panTool(bool smartDelete = true) const;
207  PlotTrackerToolPtr trackerTool(bool smartDelete = true) const;
208 
209  PlotSelectToolPtr selectTool(PlotAxis xAxis, PlotAxis yAxis,
210  PlotCoordinate::System system, bool smartDelete = true) const;
211  PlotZoomToolPtr zoomTool(PlotAxis xAxis, PlotAxis yAxis,
212  PlotCoordinate::System system, bool smartDelete = true) const;
213  PlotPanToolPtr panTool(PlotAxis xAxis, PlotAxis yAxis,
214  PlotCoordinate::System system, bool smartDelete = true) const;
215  PlotTrackerToolPtr trackerTool(PlotAxis xAxis, PlotAxis yAxis,
216  PlotCoordinate::System system, bool smartDelete = true) const;
217  // </group>
218 
219 
220  // Implements PlotFactory::mutex().
221  PlotMutexPtr mutex(bool smartDelete = true) const;
222 
223 
224  // Defaults //
225 
226  // Returns a default font for annotations. Currently: 14-point black
227  // Arial.
228  static PlotFontPtr defaultAnnotationFont(bool smartDelete = true);
229 
230  // Returns a default area fill for bar plots. Currently: blue filled.
231  static PlotAreaFillPtr defaultBarPlotAreaFill(bool smartDelete = true);
232 
233  // Returns a default line for legends. Currently: 1px black solid.
234  static PlotLinePtr defaultLegendLine(bool smartDelete = true);
235 
236  // Returns a default area fill for legends. Currently: white filled.
237  static PlotAreaFillPtr defaultLegendAreaFill(bool smartDelete = true);
238 
239  // Returns a default line for shapes. Currently: 1px black solid.
240  static PlotLinePtr defaultShapeLine(bool smartDelete = true);
241 
242  // Returns a default area fill for shapes. Currently: no fill.
243  static PlotAreaFillPtr defaultShapeAreaFill(bool smartDelete = true);
244 
245  // Returns a default line for scatter plots. Currently: no line.
246  static PlotLinePtr defaultPlotLine(bool smartDelete = true);
247 
248  // Returns a default symbol for scatter plots. Currently: 8x8 blue
249  // circle with no outline.
250  static PlotSymbolPtr defaultPlotSymbol(bool smartDelete = true);
251 
252  // Returns a default masked symbol for masked scatter plots. Currently:
253  // 8x8 red no symbol with no outline.
254  static PlotSymbolPtr defaultPlotMaskedSymbol(bool smartDelete = true);
255 
256  // The default error bar cap, currently 10.
257  static const unsigned int DEFAULT_ERROR_CAP;
258 };
259 
260 }
261 
262 #endif
263 
264 #endif /*QPFACTORY_H_*/
casacore::CountedPtr< PlotAreaFill > PlotAreaFillPtr
Definition: PlotOptions.h:364
static const int NO_EVENTS
No events.
Definition: PlotLogger.h:361
virtual PlotShapeArrowPtr shapeArrow(const PlotCoordinate &from, const PlotCoordinate &to, PlotShapeArrow::Style fromArrow=PlotShapeArrow::NOARROW, PlotShapeArrow::Style toArrow=PlotShapeArrow::V_ARROW, bool smartDelete=true) const =0
Returns a new instance of a PlotShapeArrow for this implementation at the given coordinates with the ...
casacore::CountedPtr< PlotColor > PlotColorPtr
Definition: PlotOptions.h:195
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
virtual PlotSymbolPtr symbol(PlotSymbol::Symbol style, bool smartDelete=true) const =0
Returns a new symbol with the given style.
virtual PlotShapeEllipsePtr shapeEllipse(const PlotCoordinate &center, const PlotCoordinate &radii, bool smartDelete=true) const =0
Return a new instance of a PlotShapeEllipse for this implementation with the given coordinates and ra...
PlotPanToolPtr panTool()
PlotTrackerToolPtr trackerTool()
casacore::CountedPtr< PlotLine > PlotLinePtr
Definition: PlotOptions.h:446
SMART POINTER DEFINITIONS PlotItemPtr PlotShapeLinePtr
Definition: PlotShape.h:378
virtual PlotShapePolygonPtr shapePolygon(const std::vector< PlotCoordinate > &coords, bool smartDelete=true) const =0
Return a new instance of a PlotShapePolygon for this implementation with the given coordinates...
Style
Arrow style.
Definition: PlotShape.h:214
Pattern
Pattern enum, similar in spirit to http://doc.trolltech.com/4.3/qt.html#BrushStyle-enum.
Definition: PlotOptions.h:300
SMART POINTER DEFINITIONS PlotShapeEllipsePtr
Definition: PlotShape.h:374
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
TableExprNode pattern(const TableExprNode &node)
Definition: ExprNode.h:1444
casacore::CountedPtr< PlotCanvas > PlotCanvasPtr
Definition: PlotCanvas.h:1053
PlotZoomToolPtr zoomTool()
SMART POINTER DEFINITIONS *typedef casacore::CountedPtr< PlotPanel > PlotPanelPtr
Definition: PlotPanel.h:188
casacore::CountedPtr< PlotSymbol > PlotSymbolPtr
Definition: PlotOptions.h:604
Implementation
Static //.
Definition: Plotter.h:48
Style
Static //.
Definition: PlotOptions.h:373
PlotAxis
Enum for the four plot axes.
Definition: PlotOptions.h:62
SMART POINTER DEFINITIONS PlotItemPtr PlotItemPtr PlotShapePathPtr
Definition: PlotShape.h:382
virtual PlotAnnotationPtr annotation(const casacore::String &text, const PlotCoordinate &coord, bool smartDelete=true) const =0
Return a new instance of a PlotAnnotation for this implementation with the given text and coordinates...
virtual PlotLinePtr line(const casacore::String &color, PlotLine::Style style=PlotLine::SOLID, double width=1.0, bool smartDelete=true) const =0
Returns a new line with the given color, style, and width.
ScatterPlotPtr
Definition: Plot.h:598
PlotSelectToolPtr selectTool()
Provides access to the individual tools.
virtual PlotFontPtr font(const casacore::String &family="Arial", double pointSize=12, const casacore::String &color="000000", bool bold=false, bool italics=false, bool underline=false, bool smartDelete=true) const =0
Return a new font with the given characteristics.
casacore::CountedPtr< PlotFont > PlotFontPtr
Definition: PlotOptions.h:291
Symbol
Static //.
Definition: PlotOptions.h:456
virtual PlotShapeRectanglePtr shapeRectangle(const PlotCoordinate &upperLeft, const PlotCoordinate &lowerRight, bool smartDelete=true) const =0
Return a new instance of a PlotShapeRectangle for this implementation with the given coordinates...
virtual PlotShapePathPtr shapePath(const std::vector< PlotCoordinate > &coords, bool smartDelete=true) const =0
Returns a new instance of a PlotShapePath for this implementation with the given coordinates.
virtual PlotterPtr plotter(const casacore::String &windowTitle="Plotter", bool showSingleCanvas=true, bool showGUI=true, int logEventFlags=PlotLogger::NO_EVENTS, bool smartDelete=true) const =0
GUI Objects //.
virtual PlotPointPtr point(const PlotCoordinate &coord, bool smartDelete=true) const =0
Returns a new instance of a PlotPoint for this implementation at the given coordinates.
casacore::CountedPtr< PlotMutex > PlotMutexPtr
Definition: PlotOperation.h:64
virtual PlotAreaFillPtr areaFill(const casacore::String &color, PlotAreaFill::Pattern pattern=PlotAreaFill::FILL, bool smartDelete=true) const =0
Returns a new area fill with the given color and pattern.
casacore::CountedPtr< Plotter > PlotterPtr
Definition: Plotter.h:321
const Double c
Fundamental physical constants (SI units):
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of but is it too vague to be useful Since the interface is meant to be a simple plotter
Definition: PlotData.h:48
String: the storage and methods of handling collections of characters.
Definition: String.h:223
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the color(i.e.,"000000"for black) and
virtual PlotColorPtr color(const casacore::String &color, bool smartDelete=true) const =0
Customization Objects //.