casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TblAsXYDD.h
Go to the documentation of this file.
1 //# TblAsXYDD.h: Display casacore::Data for xy 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_TBLASXYDD_H
30 #define TRIALDISPLAY_TBLASXYDD_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 TblAsXYDM;
49 
50 //# Forward Declarations
51 
52 // <summary>
53 //Class for displaying data within a table as a xy 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 // "TblAsXYDD" 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 xy 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 data from a <linkto class=casacore::Table>Table</linkto>
78 // column as a xy 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 the data in a scalar table column.
84 // </synopsis>
85 //
86 // <example>
87 // A TblAsXYDD object could be construed and used as follows:
88 // <srcblock>
89 // TblAsXYDD *tardd1 = 0;
90 // tardd1 = new TblAsXYDD("tablename");
91 // Colormap cmap1("Hot Metal 2");
92 // tardd1->setColormap(&cmap1, 1.0);
93 // wcHolder->addDisplayData((DisplayData *)tardd1);
94 // </srcblock>
95 // </example>
96 //
97 // <motivation>
98 // To allow the display of data from a table as a xy image.
99 // </motivation>
100 //
101 // <templating arg=T>
102 // </templating>
103 //
104 // <thrown>
105 // </thrown>
106 //
107 // <todo asof="2000/10/30">
108 // <li> make sure complex data are handled correctly
109 // <li> make sure table column units can be determined properly
110 // <li> make sure a scalar table column can be used for y axis
111 // <li> extend to n-dimensional arrays in table column
112 // <li> when constructed with *table we need to keep table from being deleted
113 // <li> handle movie axis once ActiveCachingNDim exists
114 // <li> implement showValue()
115 // <li> be able to derive xy plot data from columns with arrays
116 // <li> choose whether to draw points, lines or both
117 // </todo>
118 
119  class TblAsXYDD : public ActiveCaching2dDD {
120 
121  public:
122 
123  // constructors
124  // given an already constructed table
126 
127  // given a string which gives the full pathname and filename of a table
128  // on disk
129  TblAsXYDD(const casacore::String tablename);
130 
131  // Destructor
132  virtual ~TblAsXYDD();
133 
134  // format the table value at the give world position
136 
137  // get the data unit
138  virtual const casacore::Unit dataUnit(const casacore::String column);
139  virtual const casacore::Unit dataUnit();
140 
141  // install the default options for this DisplayData
142  virtual void setDefaultOptions();
143 
144  // Apply options stored in <src>rec</src> to the DisplayData. A
145  // return value of <src>true</src> means a refresh is needed.
146  // <src>recOut</src> contains any fields which were implicitly
147  // changed as a result of the call to this function.
149 
150  // Retrieve the current and default options and parameter types.
151  virtual casacore::Record getOptions( bool scrub=false ) const;
152 
153  // Return the type of this DisplayData.
155  return Display::Vector;
156  }
157 
158  // Create a new TblAsXyDM for drawing on the given
159  // WorldCanvas when the AttributeBuffers are suitably matched to the
160  // current state of this DisplayData and of the WorldCanvas/Holder.
161  // The tag is a unique number used to identify the age of the newly
162  // constructed CachingDisplayMethod.
163  virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
164  AttributeBuffer *wchAttributes,
165  AttributeBuffer *ddAttributes,
166  CachingDisplayData *dd);
167 
168  // Return the current options of this DisplayData as an
169  // AttributeBuffer.
171 
172  //provide read-only access to the table
174 
175  // Clean up (ie. delete any existing cached display list).
176  virtual void cleanup();
177 
178  protected:
179 
180  // (Required) default constructor.
181  TblAsXYDD();
182 
183  // (Required) copy constructor.
184  TblAsXYDD(const TblAsXYDD &other);
185 
186  // (Required) copy assignment.
187  void operator=(const TblAsXYDD &other);
188 
189 // Get the value of the named keyword, or the first keyword matching
190  // <src>regex</src>, and return it in <src>value</src>. The return
191  // value is <src>true</src> for success, and <src>false</src> for
192  // failure, which is the result if the wrong type <src>T</src> is
193  // requested.
194  // <group>
195  template <class T> casacore::Bool getTableKeyword(T &value,
196  const casacore::String keyword) const;
197  template <class T> casacore::Bool getTableKeyword(T &value, const casacore::Regex &regex) const;
198  // </group>
199 
200  // Get the value of the named keyword, or the first keyword matching
201  // <src>regex</src> for the named column, and return it in
202  // <src>value</src>. The return value is <src>true</src> for
203  // success, and <src>false</src> for failure, which is the result if // the wrong type <src>T</src> is requested, or if the keyword
204  // doesn't exist.
205  // <group>
206  template <class T> casacore::Bool getColumnKeyword(T &value, const casacore::String column,
207  const casacore::String keyword) const;
208  template <class T> casacore::Bool getColumnKeyword(T &value, const casacore::String column,
209  const casacore::Regex &regex) const;
210  // </group>
211  private:
212 
213  friend class TblAsXYDM;
214 
215  // The table to be displayed
217 
218  // The result from a table query
220 
221  // store all the table column names
223 
224  // what columns are we displaying and do we have a movie axis available
229 
230  // options - what is the query string and is it unset?
233 
234  // set the default options for this display data
235  void installDefaultOptions();
236 
237  // Arrange the query table (called after changing an option).
239 
240  // holder for the current coordinate system
243 
244  // update/set the coordinate system
245  void getCoordinateSystem();
246  void setCoordinateSystem();
247 
248  // get all of the table columnNames
249  void getTableColumnNames();
250 
251  // get the table column world coordinate range
253 
254  // get all of the table columnNames with a certain data type
256 
257  // Construct and destruct the parameter set.
258  // <group>
259  void constructParameters();
260  void destructParameters();
261  // </group>
262 
263  };
264 
265 
266 
267 } //# NAMESPACE CASA - END
268 
269 #ifndef AIPS_NO_TEMPLATE_SRC
270 #include <display/DisplayDatas/TblAsXYDDTemplates.tcc>
271 #endif //# AIPS_NO_TEMPLATE_SRC
272 #endif
273 
274 
casacore::Bool itsOptQueryStringUnset
Definition: TblAsXYDD.h:232
Class providing active behaviour for 2d CachingDisplayDatas.
Assistance class for auto-caching of DisplayData objects.
virtual ~TblAsXYDD()
Destructor.
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...
void getTableColumnNames()
get all of the table columnNames
virtual const casacore::Unit dataUnit()
Main interface class to a read/write table.
Definition: Table.h:153
void getCoordinateSystem()
update/set the coordinate system
Class for displaying data within a table as a xy image.
Definition: TblAsXYDD.h:119
casacore::Vector< casacore::String > getColumnNamesOfType()
get all of the table columnNames with a certain data type
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
Buffer for storing Attributes.
DParameterChoice * itsXColumnName
what columns are we displaying and do we have a movie axis available
Definition: TblAsXYDD.h:225
casacore::Vector< double > columnStatistics(const casacore::String &columnName)
get the table column world coordinate range
void constructParameters()
Construct and destruct the parameter set.
casacore::Vector< casacore::String > itsColumnNames
store all the table column names
Definition: TblAsXYDD.h:222
void destructParameters()
casacore::Table * itsQueryTable
The result from a table query.
Definition: TblAsXYDD.h:219
A DisplayMethod to draw XY plots from table data.
Definition: TblAsXYDM.h:64
casacore::Vector< casacore::Double > itsLinblc
Definition: TblAsXYDD.h:242
void setCoordinateSystem()
DParameterChoice * itsYColumnName
Definition: TblAsXYDD.h:226
virtual CachingDisplayMethod * newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)
Create a new TblAsXyDM for drawing on the given WorldCanvas when the AttributeBuffers are suitably ma...
casacore::Table * itsTable
The table to be displayed.
Definition: TblAsXYDD.h:216
defines physical units
Definition: Unit.h:189
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply options stored in rec to the DisplayData.
void operator=(const TblAsXYDD &other)
(Required) copy assignment.
Base class for auto-caching DisplayData objects.
Regular expression class.
Definition: Regex.h:198
virtual Display::DisplayDataType classType()
Return the type of this DisplayData.
Definition: TblAsXYDD.h:154
void installDefaultOptions()
set the default options for this display data
virtual void setDefaultOptions()
install the default options for this DisplayData
virtual AttributeBuffer optionsAsAttributes()
Return the current options of this DisplayData as an AttributeBuffer.
casacore::Vector< casacore::Double > itsLintrc
Definition: TblAsXYDD.h:242
DParameterChoice * itsMColumnSet
Definition: TblAsXYDD.h:228
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
casacore::String itsOptQueryString
options - what is the query string and is it unset?
Definition: TblAsXYDD.h:231
Implementation of DisplayParameter to store choice parameters.
virtual void cleanup()
Clean up (ie.
virtual casacore::String showValue(const casacore::Vector< casacore::Double > &world)
format the table value at the give world position
TableExprNode regex(const TableExprNode &node)
Functions for regular expression matching and pattern matching.
Definition: ExprNode.h:1440
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
DisplayCoordinateSystem itsCoord
holder for the current coordinate system
Definition: TblAsXYDD.h:241
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the current and default options and parameter types.
TblAsXYDD()
(Required) default constructor.
casacore::Vector data - can go next
Definition: DisplayEnums.h:359
casacore::Table * table()
provide read-only access to the table
String: the storage and methods of handling collections of characters.
Definition: String.h:223
DParameterChoice * itsMColumnName
Definition: TblAsXYDD.h:227
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...
casacore::Bool arrangeQueryTable()
Arrange the query table (called after changing an option).
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