casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TblAsContourDD.h
Go to the documentation of this file.
1 //# TblAsContourDD.h: Display casacore::Data for contour 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_TBLASCONTOURDD_H
30 #define TRIALDISPLAY_TBLASCONTOURDD_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 TblAsContourDM;
49 
50 //# Forward Declarations
51 
52 // <summary>
53 //Class for displaying data within a table as a contour 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 // "TblAsContourDD" 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 contour 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 contour 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 TblAsContourDD object could be construed and used as follows:
91 // <srcblock>
92 // TblAsContourDD *tardd1 = 0;
93 // tardd1 = new TblAsContourDD("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 contour 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  TblAsContourDD(const casacore::String tablename);
131 
132  // Destructor
133  virtual ~TblAsContourDD();
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::Vector;
157  }
158 
159  // Create a new TblAsContourDM 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  TblAsContourDD();
183 
184  // (Required) copy constructor.
185  TblAsContourDD(const TblAsContourDD &other);
186 
187  // (Required) copy assignment.
188  void operator=(const TblAsContourDD &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 TblAsContourDM;
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  // parameters for the control of the contour's apperance
271 
272  };
273 
274 
275 
276 } //# NAMESPACE CASA - END
277 
278 #ifndef AIPS_NO_TEMPLATE_SRC
279 #include <display/DisplayDatas/TblAsContourDDTemplates.tcc>
280 #endif //# AIPS_NO_TEMPLATE_SRC
281 #endif
282 
283 
casacore::Bool arrangeQueryTable()
Arrange the query table (called after changing an option).
casacore::Table * table()
provide read-only access to the table
casacore::Vector< casacore::Double > itsLinblc
Class providing active behaviour for 2d CachingDisplayDatas.
Assistance class for auto-caching of DisplayData objects.
casacore::Bool itsDash
virtual AttributeBuffer optionsAsAttributes()
Return the current options of this DisplayData as an AttributeBuffer.
Main interface class to a read/write table.
Definition: Table.h:153
void constructParameters()
Construct and destruct the parameter set.
casacore::String itsOptQueryString
options - what is the query string and is it unset?
DisplayDataType
WorldCanvasHolder - what type of DisplayData is this, need to know for drawing order.
Definition: DisplayEnums.h:355
Buffer for storing Attributes.
casacore::Float itsScale
virtual casacore::Bool setOptions(casacore::Record &rec, casacore::Record &recOut)
Apply options stored in rec to the DisplayData.
void installDefaultOptions()
set the default options for this display data
DParameterChoice * itsYColumnName
casacore::Vector< double > columnStatistics(const casacore::String &columnName)
get the table column world coordinate range
casacore::Bool itsOptQueryStringUnset
void getTableColumnNames()
get all of the table columnNames
Class for displaying data within a table as a contour image.
virtual ~TblAsContourDD()
Destructor.
casacore::Vector< casacore::String > getColumnNamesOfType(const casacore::Bool isarray)
get all of the table columnNames with a certain data type
defines physical units
Definition: Unit.h:189
DisplayCoordinateSystem itsCoord
holder for the current coordinate system
casacore::Float itsLine
casacore::Table * itsTable
The table to be displayed.
Base class for auto-caching DisplayData objects.
A DisplayMethod to draw Contours from table data.
Regular expression class.
Definition: Regex.h:198
void getCoordinateSystem()
update/set the coordinate system
virtual const casacore::Unit dataUnit()
TblAsContourDD()
(Required) default constructor.
casacore::Vector< casacore::String > itsColumnNames
store all the table column names
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
DParameterChoice * itsXColumnName
what columns are we displaying and do we have a movie axis available
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...
float Float
Definition: aipstype.h:54
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...
Implementation of DisplayParameter to store choice parameters.
virtual casacore::Record getOptions(bool scrub=false) const
Retrieve the current and default options and parameter types.
virtual void setDefaultOptions()
install the default options for this DisplayData
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
casacore::String itsColor
Implementation of drawing in world coordinates on top of a PixelCanvas.
Definition: WorldCanvas.h:204
casacore::Vector data - can go next
Definition: DisplayEnums.h:359
virtual CachingDisplayMethod * newDisplayMethod(WorldCanvas *worldCanvas, AttributeBuffer *wchAttributes, AttributeBuffer *ddAttributes, CachingDisplayData *dd)
Create a new TblAsContourDM for drawing on the given WorldCanvas when the AttributeBuffers are suitab...
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void operator=(const TblAsContourDD &other)
(Required) copy assignment.
virtual Display::DisplayDataType classType()
Return the type of this DisplayData.
DParameterChoice * itsMColumnName
casacore::Table * itsQueryTable
The result from a table query.
casacore::String itsType
DParameterChoice * itsMColumnSet
casacore::Vector< casacore::Float > itsLevels
parameters for the control of the contour&#39;s apperance
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
casacore::Vector< casacore::Double > itsLintrc
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42