casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QPExporter.h
Go to the documentation of this file.
1 //# Copyright (C) 2008
2 //# Associated Universities, Inc. Washington DC, USA.
3 //#
4 //# This library is free software; you can redistribute it and/or modify it
5 //# under the terms of the GNU Library General Public License as published by
6 //# the Free Software Foundation; either version 2 of the License, or (at your
7 //# option) any later version.
8 //#
9 //# This library is distributed in the hope that it will be useful, but WITHOUT
10 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 //# License for more details.
13 //#
14 //# You should have received a copy of the GNU Library General Public License
15 //# along with this library; if not, write to the Free Software Foundation,
16 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 //#
18 //# Correspondence concerning AIPS++ should be addressed as follows:
19 //# Internet email: aips2-request@nrao.edu.
20 //# Postal address: AIPS++ Project Office
21 //# National Radio Astronomy Observatory
22 //# 520 Edgemont Road
23 //# Charlottesville, VA 22903-2475 USA
24 //#
25 
26 #ifndef QPEXPORTER_H_
27 #define QPEXPORTER_H_
28 
31 #include <QImage>
32 
33 namespace casa {
34 
35 class PlotCanvas;
36 class QPExportCanvas;
37 class QPPlotter;
42 class QPExporter {
43 public:
44 
45 
46  // Exports the given canvas to the given format.
47  static bool exportCanvas(PlotCanvas* canvas, const PlotExportFormat& format);
48 
49  // Exports the given plotter to the given format.
50  static bool exportPlotter(QPPlotter* plotter, const PlotExportFormat& format);
51 
52  // Exports a collection of canvases to the given format.
53  static bool exportCanvases(std::vector<QPExportCanvas*>& canvases,
54  const PlotExportFormat& format, PlotCanvas* grabCanvas,
55  QPPlotter* grabPlotter);
56 
57  virtual ~QPExporter();
58 
59 private:
60  QPExporter();
61  static bool exportPostscript( const PlotExportFormat& format,
62  std::vector<QPExportCanvas*> &qcanvases,
63  QPExportCanvas* grabCanvas, QPPlotter* grabPlotter);
64 
65  static QImage produceHighResImage(
66  const PlotExportFormat& format,
67  std::vector<QPExportCanvas*> &qcanvases,
68  int width, int height,
69  int rowIndex, int columnIndex,
70  bool &wasCanceled);
71 
72  static QImage produceScreenImage(
73  const PlotExportFormat& format,
74  std::vector<QPExportCanvas*> &qcanvases,
75  int width, int height,
76  int rowCount, int colCount,
77  bool &wasCanceled);
78 
79  static bool exportToImageFile(
80  const PlotExportFormat& format,
81  std::vector<QPExportCanvas*> &qcanvases,
82  QPExportCanvas* grabCanvas,
83  QPPlotter* grabPlotter);
84 
85  static int findAxisHeight( std::vector<QPExportCanvas*> &qcanvases );
86  static int findAxisWidth( std::vector<QPExportCanvas*> &qcanvases );
87  static int getCanvasCount( std::vector<QPExportCanvas*> &qcanvases );
88  static void getAxesCount(std::vector<QPExportCanvas*> &qcanvases,
89  casacore::Int& externalX, casacore::Int& externalY);
90  static void findGridProperties( QPExportCanvas* grabCanvas, QPPlotter* grabPlotter,
91  casacore::Int& width, casacore::Int& height, casacore::Int& gridRows, casacore::Int& gridCols);
92  static void findXAxisLocations(casacore::Int numX, casacore::Bool vertical, casacore::Bool& top, casacore::Bool& bottom);
93  static void findYAxisLocations(casacore::Int numY, casacore::Bool vertical, casacore::Bool& left, casacore::Bool& right);
94  static void findYAxisSecondRow(casacore::Int numY, casacore::Bool isLeftAxis, casacore::Bool& left, casacore::Bool& right);
95  static void findYAxisSecondRow(casacore::Int numY, casacore::Int nCols, std::vector<QPExportCanvas*> &qcanvases,
96  casacore::Bool& left, casacore::Bool& right);
97 
100 };
101 
102 } /* namespace casa */
103 #endif /* QPEXPORTER_H_ */
static bool exportPostscript(const PlotExportFormat &format, std::vector< QPExportCanvas * > &qcanvases, QPExportCanvas *grabCanvas, QPPlotter *grabPlotter)
int Int
Definition: aipstype.h:50
static const casacore::String EXPORT_NAME
Definition: QPExporter.h:99
static bool exportToImageFile(const PlotExportFormat &format, std::vector< QPExportCanvas * > &qcanvases, QPExportCanvas *grabCanvas, QPPlotter *grabPlotter)
static int getCanvasCount(std::vector< QPExportCanvas * > &qcanvases)
static bool exportCanvases(std::vector< QPExportCanvas * > &canvases, const PlotExportFormat &format, PlotCanvas *grabCanvas, QPPlotter *grabPlotter)
Exports a collection of canvases to the given format.
static void findGridProperties(QPExportCanvas *grabCanvas, QPPlotter *grabPlotter, casacore::Int &width, casacore::Int &height, casacore::Int &gridRows, casacore::Int &gridCols)
virtual ~QPExporter()
static QImage produceScreenImage(const PlotExportFormat &format, std::vector< QPExportCanvas * > &qcanvases, int width, int height, int rowCount, int colCount, bool &wasCanceled)
static int findAxisHeight(std::vector< QPExportCanvas * > &qcanvases)
static void getAxesCount(std::vector< QPExportCanvas * > &qcanvases, casacore::Int &externalX, casacore::Int &externalY)
Interface implemented by classes that can export their draw area (QPAxis &amp; QPCanvas).
static void findYAxisSecondRow(casacore::Int numY, casacore::Bool isLeftAxis, casacore::Bool &left, casacore::Bool &right)
static bool exportCanvas(PlotCanvas *canvas, const PlotExportFormat &format)
Exports the given canvas to the given format.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
PlotExportFormat contains parameters for exporting a canvas to a file.
Definition: PlotOptions.h:817
Utility class for exporting plots.
Definition: QPExporter.h:42
static const casacore::String CLASS_NAME
Definition: QPExporter.h:98
PlotCanvas is an area for different PlotItems to be attached and drawn.
Definition: PlotCanvas.h:83
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
static bool exportPlotter(QPPlotter *plotter, const PlotExportFormat &format)
Exports the given plotter to the given format.
static int findAxisWidth(std::vector< QPExportCanvas * > &qcanvases)
static void findXAxisLocations(casacore::Int numX, casacore::Bool vertical, casacore::Bool &top, casacore::Bool &bottom)
static QImage produceHighResImage(const PlotExportFormat &format, std::vector< QPExportCanvas * > &qcanvases, int width, int height, int rowIndex, int columnIndex, bool &wasCanceled)
static void findYAxisLocations(casacore::Int numY, casacore::Bool vertical, casacore::Bool &left, casacore::Bool &right)