casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QPData.h
Go to the documentation of this file.
1 //# QPData.h: Connector classes between generic plotter and Qwt data classes.
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 QPDATA_H_
28 #define QPDATA_H_
29 
30 #ifdef AIPS_HAS_QWT
31 
32 #include <casaqt/QwtConfig.h>
34 
35 #if QWT_VERSION < 0x060000
36 #include <qwt_data.h>
37 #endif
38 
39 #include <qwt_raster_data.h>
40 
41 namespace casa {
42 
43 // Connects PlotPointData and QwtData.
44 #if QWT_VERSION >= 0x060000
45 class QPPointData : public QwtSeriesData<QPointF>
46 #else
47 class QPPointData : public QwtData
48 #endif
49  {
50 public:
51  // Constructor which takes the data.
52  QPPointData(PlotPointDataPtr data);
53  // Destructor.
54  ~QPPointData();
55 
56  // Returns the point data.
57  // <group>
58  PlotPointDataPtr data();
59  const PlotPointDataPtr data() const;
60  // </group>
61 
62 
63  // QwtData Methods //
64 
65  // Implements QwtData::copy().
66 #if QWT_VERSION >= 0x060000
67  QPPointData* copy() const;
68 
69  // Implements QwtSeriesData::sample().
70  QPointF sample(size_t i) const;
71 
72 #else
73  QwtData* copy() const;
74 #endif
75 
76  // Implements QwtData::size().
77  size_t size() const;
78 
79  // Implements QwtData::x().
80  double x(size_t i) const;
81 
82  // Implements QwtData::y().
83  double y(size_t i) const;
84 
85  // Overrides QwtData::boundingRect().
86  QwtDoubleRect boundingRect() const;
87 
88 private:
89  PlotPointDataPtr m_data; // Data
90 };
91 
92 
93 // Connects PlotRasterData and QwtRasterData.
94 class QPRasterData : public QwtRasterData {
95 public:
96  // Constructor which takes the raster data.
97  QPRasterData(PlotRasterDataPtr data);
98 
99  // Destructor.
100  ~QPRasterData();
101 
102 
103  // Returns the raster data.
104  // <group>
105  PlotRasterDataPtr data();
106  const PlotRasterDataPtr data() const;
107  // </group>
108 
109  // Returns true if this data is valid, false otherwise.
110  bool isValid() const;
111 
112 
113  // QwtRasterData Methods //
114 
115  // Implements QwtRasterData::copy().
116  QwtRasterData* copy() const;
117 
118  // Implements QwtRasterData::value().
119  double value(double x, double y) const;
120 
121  // Implements QwtRasterData::range().
122  QwtDoubleInterval range() const;
123 
124  // Overrides QwtRasterData::boundingRect().
125  QwtDoubleRect boundingRect() const;
126 
127 private:
128  PlotRasterDataPtr m_data; // Data
129 };
130 
131 } // end namespace casa
132 
133 #endif
134 
135 #endif /* QPDATA_H_ */
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
size_t size() const
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.