casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TblAsRasterDD.h
Go to the documentation of this file.
1 //# TblAsRasterDD.h: Display casacore::Data for raster displays of data from a table
2 //# Copyright (C) 2000,2001,2002
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 //#
27 //# $Id$
28 
29 #ifndef TRIALDISPLAY_TBLASRASTERDD_H
30 #define TRIALDISPLAY_TBLASRASTERDD_H
31 
32 #include <casa/aips.h>
33 #include <casa/Arrays/Vector.h>
39 
40 namespace casacore{
41 
42  class Table;
43  class Regex;
44 }
45 
46 namespace casa { //# NAMESPACE CASA - BEGIN
47 
48  class TblAsRasterDM;
49 
50 //# Forward Declarations
51 
52 // <summary>
53 //Class for displaying data within a table as a raster image.
54 // </summary>
55 
56 // <use visibility=local> or <use visibility=export>
57 
58 // <reviewed reviewer="" date="" tests="" demos="">
59 // </reviewed>
60 
61 // <prerequisite>
62 // <li> ActiveCaching2dDD
63 // <li> CachingDisplayData
64 // <li> Table
65 // </prerequisite>
66 //
67 // <etymology>
68 // "TblAsRasterDD" is a implementation of a <linkto class=ActiveCaching2dDD>
69 // ActiveCaching2dDD </linkto> which provides for the display of data held
70 // within a table to be displayed as a raster image in an environment where
71 // individual depictions of the data are automatically cached.
72 // </etymology>
73 //
74 // <synopsis>
75 // This class adds to the interface defined in <linkto
76 // class=DisplayData>DisplayData </linkto>. It adds the capability to
77 // display vector/array data from a <linkto class=casacore::Table>Table</linkto>
78 // column as a raster image. It is assumed that the Y axis is defined
79 // to be either the row number of the table column being displayed or
80 // the scalar value from the same row number in a different table
81 // column (e.g. plotting intensity as a function of frequency against
82 // row number or time determined from a different column of the table).
83 // The X axis is assumed to be a one dimensional array or vector of
84 // of data for each row in the column being displayed. It is assumed
85 // that the length of this array/vector does not change throughout the
86 // column of the table.
87 // </synopsis>
88 //
89 // <example>
90 // A TblAsRasterDD object could be construed and used as follows:
91 // <srcblock>
92 // TblAsRasterDD *tardd1 = 0;
93 // tardd1 = new TblAsRasterDD("tablename");
94 // Colormap cmap1("Hot Metal 2");
95 // tardd1->setColormap(&cmap1, 1.0);
96 // wcHolder->addDisplayData((DisplayData *)tardd1);
97 // </srcblock>
98 // </example>
99 //
100 // <motivation>
101 // To allow the display of data from a table as a raster image.
102 // </motivation>
103 //
104 // <templating arg=T>
105 // </templating>
106 //
107 // <thrown>
108 // </thrown>
109 //
110 // <todo asof="2000/10/30">
111 // <li> make sure complex data are handled correctly
112 // <li> make sure table column units can be determined properly
113 // <li> make sure a scalar table column can be used for y axis
114 // <li> extend to n-dimensional arrays in table column
115 // <li> when constructed with *table we need to keep table from being deleted
116 // <li> handle movie axis once ActiveCachingNDim exists
117 // <li> implement showValue()
118 // </todo>
119 
121 
122  public:
123 
124  // constructors
125  // given an already constructed table
127 
128  // given a string which gives the full pathname and filename of a table
129  // on disk
130  TblAsRasterDD(const casacore::String tablename);
131 
132  // Destructor
133  virtual ~TblAsRasterDD();
134 
135  // format the table value at the give world position
137 
138  // get the data unit
139  virtual const casacore::Unit dataUnit(const casacore::String column);
140  virtual const casacore::Unit dataUnit();
141 
142  // install the default options for this DisplayData
143  virtual void setDefaultOptions();
144 
145  // Apply options stored in <src>rec</src> to the DisplayData. A
146  // return value of <src>true</src> means a refresh is needed.
147  // <src>recOut</src> contains any fields which were implicitly
148  // changed as a result of the call to this function.
150 
151  // Retrieve the current and default options and parameter types.
152  virtual casacore::Record getOptions( bool scrub=false ) const;
153 
154  // Return the type of this DisplayData.
156  return Display::Raster;
157  }
158 
159  // Create a new TblAsRasterDM for drawing on the given
160  // WorldCanvas when the AttributeBuffers are suitably matched to the
161  // current state of this DisplayData and of the WorldCanvas/Holder.
162  // The tag is a unique number used to identify the age of the newly
163  // constructed CachingDisplayMethod.
164  virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
165  AttributeBuffer *wchAttributes,
166  AttributeBuffer *ddAttributes,
167  CachingDisplayData *dd);
168 
169  // Return the current options of this DisplayData as an
170  // AttributeBuffer.
172 
173  //provide read-only access to the table
175 
176  // Clean up (ie. delete any existing cached display list).
177  virtual void cleanup();
178 
179  protected:
180 
181  // (Required) default constructor.
182  TblAsRasterDD();
183 
184  // (Required) copy constructor.
185  TblAsRasterDD(const TblAsRasterDD &other);
186 
187  // (Required) copy assignment.
188  void operator=(const TblAsRasterDD &other);
189 
190 // Get the value of the named keyword, or the first keyword matching
191  // <src>regex</src>, and return it in <src>value</src>. The return
192  // value is <src>true</src> for success, and <src>false</src> for
193  // failure, which is the result if the wrong type <src>T</src> is
194  // requested.
195  // <group>
196  template <class T> casacore::Bool getTableKeyword(T &value,
197  const casacore::String keyword) const;
198  template <class T> casacore::Bool getTableKeyword(T &value, const casacore::Regex &regex) const;
199  // </group>
200 
201  // Get the value of the named keyword, or the first keyword matching
202  // <src>regex</src> for the named column, and return it in
203  // <src>value</src>. The return value is <src>true</src> for
204  // success, and <src>false</src> for failure, which is the result if // the wrong type <src>T</src> is requested, or if the keyword
205  // doesn't exist.
206  // <group>
207  template <class T> casacore::Bool getColumnKeyword(T &value, const casacore::String column,
208  const casacore::String keyword) const;
209  template <class T> casacore::Bool getColumnKeyword(T &value, const casacore::String column,
210  const casacore::Regex &regex) const;
211  // </group>
212  private:
213 
214  friend class TblAsRasterDM;
215 
216  // The table to be displayed
218 
219  // The result from a table query
221 
222  // store all the table column names
224 
225  // what columns are we displaying and do we have a movie axis available
230 
231  // options - what is the query string and is it unset?
234 
235  // set the default options for this display data
236  void installDefaultOptions();
237 
238  // Arrange the query table (called after changing an option).
240 
241  // holder for the current coordinate system
244 
245  // update/set the coordinate system
246  void getCoordinateSystem();
247  void setCoordinateSystem();
248 
249  // get all of the table columnNames
250  void getTableColumnNames();
251 
252  // get the table column world coordinate range
254 
255  // get all of the table columnNames with a certain data type
257 
258  // Construct and destruct the parameter set.
259  // <group>
260  void constructParameters();
261  void destructParameters();
262  // </group>
263 
264  };
265 
266 
267 
268 } //# NAMESPACE CASA - END
269 
270 #ifndef AIPS_NO_TEMPLATE_SRC
271 #include <display/DisplayDatas/TblAsRasterDDTemplates.tcc>
272 #endif //# AIPS_NO_TEMPLATE_SRC
273 #endif
274 
275 
virtual const casacore::Unit dataUnit()
casacore::Bool getTableKeyword(T &value, const casacore::String keyword) const
Get the value of the named keyword, or the first keyword matching regex, and return it in value...
Class providing active behaviour for 2d CachingDisplayDatas.
Assistance class for auto-caching of DisplayData objects.
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply options stored in rec to the DisplayData.
Class for displaying data within a table as a raster image.
Main interface class to a read/write table.
Definition: Table.h:153
casacore::Table * table()
provide read-only access to the table
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
Buffer for storing Attributes.
virtual casacore::String showValue(const casacore::Vector< casacore::Double > &world)
format the table value at the give world position
virtual void setDefaultOptions()
install the default options for this DisplayData
virtual void cleanup()
Clean up (ie.
casacore::Vector< casacore::Double > itsLintrc
A DisplayMethod to draw Raster images from table data.
Definition: TblAsRasterDM.h:63
casacore::Table * itsTable
The table to be displayed.
void constructParameters()
Construct and destruct the parameter set.
casacore::Vector< casacore::String > itsColumnNames
store all the table column names
DisplayCoordinateSystem itsCoord
holder for the current coordinate system
defines physical units
Definition: Unit.h:189
casacore::String itsOptQueryString
options - what is the query string and is it unset?
casacore::Bool itsOptQueryStringUnset
void getCoordinateSystem()
update/set the coordinate system
TblAsRasterDD()
(Required) default constructor.
DParameterChoice * itsMColumnSet
Base class for auto-caching DisplayData objects.
Regular expression class.
Definition: Regex.h:198
casacore::Bool arrangeQueryTable()
Arrange the query table (called after changing an option).
void installDefaultOptions()
set the default options for this display data
DParameterChoice * itsYColumnName
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Rastered data - should go first.
Definition: DisplayEnums.h:357
DParameterChoice * itsXColumnName
what columns are we displaying and do we have a movie axis available
casacore::Vector< double > columnStatistics(const casacore::String &columnName)
get the table column world coordinate range
DParameterChoice * itsMColumnName
virtual Display::DisplayDataType classType()
Return the type of this DisplayData.
Implementation of DisplayParameter to store choice parameters.
virtual CachingDisplayMethod * newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)
Create a new TblAsRasterDM for drawing on the given WorldCanvas when the AttributeBuffers are suitabl...
virtual ~TblAsRasterDD()
Destructor.
virtual AttributeBuffer optionsAsAttributes()
Return the current options of this DisplayData as an AttributeBuffer.
void operator=(const TblAsRasterDD &other)
(Required) copy assignment.
casacore::Table * itsQueryTable
The result from a table query.
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition: ExprNode.h:1440
casacore::Vector< casacore::Double > itsLinblc
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the current and default options and parameter types.
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
casacore::Vector< casacore::String > getColumnNamesOfType(const casacore::Bool isarray)
get all of the table columnNames with a certain data type
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void getTableColumnNames()
get all of the table columnNames
casacore::Bool getColumnKeyword(T &value, const casacore::String column, const casacore::String keyword) const
Get the value of the named keyword, or the first keyword matching regex for the named column...
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42