casa
$Rev:20696$
|
00001 //# TablePlot.h: Implement class for the tableplot DO. 00002 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000,2001,2002,2003-2008 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have receied a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 //# 00028 //# TablePlot Change Log 00029 //# ======================= 00030 //# Data Name Description 00031 //# Nov. 2006 Shannon Jaeger TPPlotter was given a parameter to allow 00032 //# flagged/non-flagged data to be displayed at the 00033 //# same time. 00034 //# Dec 22 2006 Urvashi R.V. Added/updated code documentation. 00035 //# Removed two completely unused function declarations. 00036 //# 00037 //# Feb 11 2007 Urvashi R.V. Added the locateData function. Changed code to 00038 //# adapt to refactored TPPlotter. 00039 //# 00040 //# May 14 2007 Urvashi R.V. Refactored code. Added flag version support, 00041 //# additional plot options, and parameter checks. 00042 //# Aug 24 2007 Urvashi R.V. Refactored code. Made TablePlot a singleton class 00043 //# and added call-back hooks for the application layers. 00044 //# 00045 //# Oct 29 2007 Shannon J. Added new message handling. 00046 00047 #ifndef TABLEPLOT_H 00048 #define TABLEPLOT_H 00049 00050 //# Includes 00051 #include <tableplot/TablePlot/TPPlotter.h> /* TPPlotter.h includes Python.h which must 00052 be included before any system headers */ 00053 #include <casa/aips.h> 00054 #include <tables/Tables/TableIter.h> 00055 #include <tables/Tables/TableError.h> 00056 00057 #include <tableplot/TablePlot/BasePlot.h> 00058 #include <tableplot/TablePlot/CrossPlot.h> 00059 #include <tableplot/TablePlot/PanelParams.h> 00060 00061 #include <tableplot/TablePlot/SLog.h> 00062 00063 00064 namespace casa { //# NAMESPACE CASA - BEGIN 00065 00066 // <summary> 00067 // Class that implements X-Y plotting of data from Table objects. 00068 // </summary> 00069 00070 // <use visibility=export> 00071 00072 // <reviewed reviewer="" date="" tests=""> 00073 // </reviewed> 00074 00075 // <prerequisite> 00076 //#! Classes or concepts you should understand before using this class. 00077 // <li> BasePlot 00078 // <li> TPPlotter 00079 // <li> PanelParams 00080 // <li> PlotOptions 00081 // <li> TPCallBackHooks 00082 // </prerequisite> 00083 00084 // <etymology> 00085 // The TablePlot class allows plotting of data from any kind of 00086 // table. 00087 // </etymology> 00088 00089 // <synopsis> 00090 // Class TablePlot allows the plotting of data from any kind of table 00091 // using generic TaQL expressions to specify the data to be 00092 // plotted. Access to the tables (reading/writing) is controlled via 00093 // the BasePlot class (one basePlot object per table), and all 00094 // plotting operations (plotting/editing) are controlled via the 00095 // TPPlotter class. The TablePlot class controls the use of the 00096 // BasePlot and TPPlotter classes, and provides an interface that 00097 // application programs can directly use. It manages multiple panels 00098 // and plot overlays. 00099 // 00100 // Relation between an application, TablePlot, BasePlot and TPPlotter : 00101 // 00102 // The application code constructs and holds the TablePlot object, the TPPlotter object, 00103 // and a list of BasePlot objects. 00104 // 00105 // <li> One TPPlotter object is used for one plot window. 00106 // Single and multiple panels are supported. 00107 // 00108 // <li> One BasePlot object attaches to and operates on one single table/subtable. 00109 // If the TaQL expressions for the attached table, result in TpDouble Arrays. 00110 // and correspond to multiple data sets to plot, an overlay plot is created. 00111 // 00112 // <li> TablePlot holds a list of BasePlot objects (one for each table being simultaneously 00113 // accessed) and a TPPlotter object. 00114 // and controls the mapping of the BasePlot objects to the supplied TPPlotter 00115 // objects. After the data is read from tables into all BasePlots, the list is passed 00116 // to the TPPlotter class, which reads the data to be plotted from all the BasePlots 00117 // and (currently) creates an overlay plot of data from all the tables in the list. 00118 // In the case of multi-panel plots, TablePlot accepts a list of BaseBlot lists, 00119 // and controls the mapping of each BasePlot list to a separate panel. 00120 // 00121 // 00122 // This design allows the following. 00123 // 00124 // <li> Access to Table data and the Plotting package are independant of each other. 00125 // <li> TaQL expressions can be applied to multiple tables and data from multiple tables 00126 // are kept independant of each other. 00127 // <li> Editing operations on multiple panels of a plot window are handled independantly. 00128 // <li> Design supports the idea of data parallelization and chunking of data to avoid 00129 // the simultaneous use of large amounts of memory. 00130 // <li> Since the application level holds the BasePlot object lists and TPPlotter objects, 00131 // control of mapping BasePlot lists to a TPPlotter (list) is at the application 00132 // level. 00133 // <li> 00134 // </synopsis> 00135 00136 // <example> 00137 // 00138 // (See tableplot_cmpt.cc) 00139 // 00140 // <srcblock> 00141 // 00142 // TablePlot *TP; 00143 // TP = casa::TablePlot::TablePlotInstance(); 00144 // TP->setTableT(SelTABS,TabNames,SelStr); 00145 // PlotOptions pop; Vector<String> Errors(2); 00146 // //... fill in pop. 00147 // Errors = TP->checkInputs(pop,taqlstr,iteraxes); 00148 // TP->plotData(pop,taqlstr); //... or TP->iterMultiPlotStart(pop,taqlstr,iteraxes) 00149 // 00150 // </srcblock> 00151 // </example> 00152 00153 // <motivation> 00154 // This class was written to provide a high-level interface to an application 00155 // that needs to plot and interact with data from multiple tables at once. 00156 // </motivation> 00157 00158 // <templating arg=T> 00159 // <li> 00160 // </templating> 00161 00162 // <thrown> 00163 // <li> 00164 // <li> 00165 // </thrown> 00166 00167 00168 // <todo asof="$DATE:$"> 00169 //# A List of bugs, limitations, extensions or planned refinements. 00170 // <li> Add functions to read out the data being plotted (into python arrays). 00171 // <li> Remove "INFO" from the TablePlot::locateData() function. It is not required. 00172 // </todo> 00173 00174 class TablePlot; 00175 00176 extern TablePlot *tableplot; 00177 00178 class TablePlot 00179 { 00180 public: 00181 // Get a reference to an instance of the TablePlot class. 00182 // TablePlot is a Singleton class, and user applications can 00183 // obtain a reference to the single instance via this function. 00184 // The first call instantiates the class, and subsequent calls 00185 // return pointers to the TablePlot object. 00186 static TablePlot* TablePlotInstance() { 00187 if(!tableplot) 00188 tableplot = new TablePlot; 00189 return tableplot; 00190 } 00191 00192 // Set a list of Table objects that are to be used for subsequent 00193 //plotting. 00194 // These Tables are sent into BasePlot objects, which hold onto them. 00195 // Tables are released in TablePlot::clearPlot, and a callback 00196 // (defined in TPCallBackHooks.h) signals this to the user application. 00197 // The Table objects passed in can be from Tables on disk, reference 00198 // Tables obtained via sub-selection, or in-memory Tables. 00199 // The root Table names are used for handling Flag Versions. 00200 // To disable flag versions, the rootTable names can be empty strings. 00201 // The selection strings are purely for labelling purposes, and will 00202 // appear in the Locate and FlagHistory logger output. 00203 // ArrayColumns in the Tables sent in, need to have the same shape 00204 // across all rows in the Table. For MSs with varying shape columns, 00205 // the Tables should be broken up and sent in as a vector<table>. 00206 Bool setTableT(Vector<Table> &inTabObj, Vector<String> &rootTabNames, 00207 Vector<String> &selection); 00208 00209 // Set a list of Tables by specifying their names. 00210 // This is similar to TablePlot::setTableT(), but explicitly opens the 00211 // Tables with the Table::Update mode, and no explicit lock acquisition. 00212 Bool setTableS(Vector<String> &inTabName, Vector<String> &rootTabNames, 00213 Vector<String> &selection); 00214 00215 // Set names of Table columns to be used for Flags. 00216 // "dataflags" must be the name of an ArrayColumn<bool> 00217 // "rowflags" must be the name of a ScalarColumn<bool> 00218 // These are also the columns that will be used for 00219 // Flag Versions. 00220 Bool useFlagColumns(String dataflags=String("FLAG"), 00221 String rowflags=String("FLAG_ROW")); 00222 00223 // Check if at least one Table has been set. 00224 Bool isTableSet(); 00225 00226 // Choose between a GUI-based or completely command-line based interface. 00227 // This function will reset TablePlot, and instantiate the plotter 00228 // class in no-gui mode. Default is gui=True. 00229 // Note : This function has not been tested since the latest refactoring. 00230 Bool setGui(Bool guiVisible=True); 00231 00232 // Save the plot to an image file, using the pl.savefig command. 00233 Bool saveFigure(const String& filename, const Int dpi, 00234 const String& orientation, const String& papertype, 00235 const String& facecolor, const String& edgecolor ); 00236 00237 Bool saveData(const String& filename); 00238 00239 // Validation check for input parameters. 00240 // This function returns errors and warnings, based on the 00241 // validity of the input parameters. The returned vector<string> is of 00242 // length 2. The first String is Errors and the second is Warnings. 00243 // User applications should not proceed to TablePlot::plotData if 00244 // checkInputs fails with errors. TablePlot::plotData re-verifies 00245 // inputs by calling this function internally as well. 00246 Vector<String> checkInputs(PlotOptions &pop, 00247 Vector<Vector<String> > &datastrvector, Vector<String> &iteraxes); 00248 Vector<String> checkInputs(PlotOptions &pop, Vector<String> &datastr, 00249 Vector<String> &iteraxes); 00250 00251 // Check that the "FLAG(dataFlagColName_p)" 00252 // ArrayColumn in input Tables have the same 00253 // shape across all rows. 00254 Vector<String> checkTables(Vector<Table> &tables); 00255 Bool checkShapes(Table &intab); 00256 00257 // Plot data based on input plot options and [X,Y] TaQL string pairs. 00258 // Plot options are to be sent in via the PlotOptions class. 00259 // [X,Y] TaQL string pairs are sent in via datastrvector. 00260 // datastrvector.nelements() must be the same as nTabObj.nelements(). 00261 // i.e. the same number of Tables currently in use. 00262 // For each Table (the inner Vector), there can be any number of 00263 // XY TaQL pairs. [X1,Y1,X2,Y2,....] and plots from each pair will 00264 // appear as overlaid plots on the same panel. 00265 // each table has one set of taql 00266 // each taql set has one or more taql pairs 00267 Bool plotData(PlotOptions &pop, Vector<Vector<String> > &datastrvector) { 00268 return plotData(pop,datastrvector,String("iter_off")); 00269 }; 00270 00271 // Plot data based on input plot options and [X,Y] TaQL string pairs. 00272 // Same as above, but uses only one [X,Y] TaQL pair for all 00273 // the input Tables. 00274 Bool plotData(PlotOptions &pop, Vector<String> &datastr) { 00275 return plotData(pop,datastr,String("iter_off")); 00276 }; 00277 00278 // Refresh the plot. 00279 // Flags are re-read from all active Table objects, and the 00280 // plots are re-made with all the current plot options for 00281 // each panel and layer. 00282 Bool rePlot(); 00283 00284 // Mark regions to flag. This function calls TPPlotter::markRegion(). 00285 // These regions will apply to all layers of the chosen panel. 00286 Bool markRegions(Int nrows, Int ncols, Int panel, Vector<Double> ®ion); 00287 00288 // Flag all data in regions marked 00289 // using markFlags(). Direction is 1 for FLAG, and 0 for UNFLAG. 00290 Bool flagData(Int direction); 00291 Bool flagData(Int direction, Vector<Int> regs); 00292 00293 // Print out information about the data selected using markFlags() 00294 // It takes in a list of table column names to make lists for. 00295 // INFO is a structure containing all the locate information. 00296 // This function automatically prints out INFO, and provides a 00297 // callback for custom formatting as well, but this 00298 // structure is still accessible here. INFO needs to be empty 00299 // before being passed in, and needs to be deleted after this call. 00300 // TODO - remove INFO from here, and make it an internal parameter. 00301 // Remember to declare it inside, and clean it up at the end of this 00302 // function, after calling dumpLocate from inside. 00303 Bool locateData(Vector<String> columnlist, PtrBlock<Record*> &INFO, 00304 Int doFlag = -1); 00305 Bool locateData(Int doFlag = -1); 00306 00307 // Clear all flags from all the tables attached to the vector of BasePlots 00308 // Dangerous. Please use this carefully. It was put in mainly for 00309 // debugging purposes. 00310 Bool clearAllFlags(Bool forRootTable); 00311 00312 00313 // FlagVersion control functions. 00314 // They apply to all currently set Tables. i.e. all Tables set 00315 // by the previous TablePlot::setTableT call. 00316 // When multiple version names are supplied as a vector, the 00317 // operation is applied to each of them in turn. 00318 Bool saveFlagVersion(String versionname, String comment, String merge); 00319 Bool restoreFlagVersion(Vector<String> versionname, String merge); 00320 Bool deleteFlagVersion(Vector<String> versionname); 00321 Bool getFlagVersionList(Vector<String> &verlist); 00322 00323 // Clear on or all plot panels. 00324 // Specify the co-ordinates of the panels to clear. 00325 // Setting all parameters to 0, indicates "clear all plots". 00326 // BasePlot objects are destroyed in this call, and this 00327 // triggers the "releaseTable" call-back for user-applications. 00328 Bool clearPlot(Int nrows=0, Int ncols=0, Int panel=0); 00329 00330 // Plotting from a series of subtables created by iterating over 00331 // a specified iteration axis. 00332 // Iterations are applied to all the latest Tables set via setTableT. 00333 // This mode of plotting supports multiple panels, with the 00334 // panel configuration set through plotoptions : nrows,ncols. 00335 // Multiple iteration plots can be setup to run as overplots (using 00336 // the regular "overplot" plot option, and two successive 00337 // iterMultiPlotStart calls before the first "next", 00338 // as well as multipanels (see the "separateiterplot" plot option). 00339 Bool iterMultiPlotStart(PlotOptions &pop, 00340 Vector<Vector<String> > &datastrvector,Vector<String> &iteraxes); 00341 Bool iterMultiPlotStart(PlotOptions &pop, Vector<String> &datastr, 00342 Vector<String> &iteraxes); 00343 00344 // Advances to the next iteration. BasePlot objects persist, but 00345 // their attached tables are replaced by the new subtables created 00346 //by TableIter. 00347 Int iterMultiPlotNext(Vector<String> &labelcols, 00348 Vector<Vector<Double> > &labelvals); 00349 00350 // Terminates the iterations. It is called automatically when the end 00351 // of the table is reached. It can also be called before the 00352 // iterations end, to cleanly terminate the 00353 // iterations when desired. 00354 Int iterMultiPlotStop( Bool /*rmplotter*/) { 00355 iterMultiPlotStop(); 00356 return 0; 00357 }; 00358 Bool iterMultiPlotStop(); 00359 00360 // Get the current list of Tables from TablePlot. 00361 Bool getTabVec(Vector<Table> &tabs); 00362 00363 // Allow the user app to directly run a python command. 00364 Bool runPlotCommand(String command); 00365 00366 //Change the state of a button on the Gui. 00367 // button : 'iternext','markregion','flag','unflag','locate' 00368 // state : 'enabled','disabled' 00369 // defaults -> iternext=disabled, all others are enabled. 00370 Bool changeGuiButtonState( String button, String state ); 00371 00372 // Clean up the TablePlot object. 00373 // Clear all plots and release all tables. This triggers the 00374 // "reset call-back" for user applications. 00375 // Note : It is dangerous to call this with closewindow=0. 00376 // Extra rows of buttons might appear 00377 // TODO - do something about this. 00378 Bool resetTP(Int closewindow=1); 00379 00380 // Set the "reset" callback function. 00381 // This callback is triggered when TablePlot::resetTP() is called. 00382 Bool setResetCallBack( String appname, TPResetCallBack * resetter ); 00383 Bool clearResetCallBack( String appname ); 00384 00385 private: 00386 // Default Constructor 00387 TablePlot(); 00388 00389 // Copy Constructor (reference semantics) 00390 TablePlot(TablePlot const &); 00391 00392 // reference = 00393 TablePlot& operator=(TablePlot const&); 00394 00395 // Destructor 00396 ~TablePlot(); 00397 00398 // Instantiate a BasePlot/CrossPlot object for each table. 00399 // To be used in conjunction with upDateBP(). The second argument 00400 // should contain 'CROSS' for a CrossPlot object to be instantiated. 00401 // Otherwise (or left as default), BasePlot objects will be created. 00402 // One way to use this is to have the incoming TAQL pair have its 'X' TaQL 00403 // contain 'CROSS', since for CrossPlots, the x-axis corresponds to 00404 // column indices of the array column selected by the Y-TaQL. 00405 Bool createBP(PtrBlock<BasePlot* > &BPS, Vector<Vector<String> > &taqls); 00406 00407 // Attach each table in the list to a BasePlot object. The first time this 00408 // function is called, it must be preceded by createBP(). Successive calls 00409 // to this function only change the tables/subtables being accessed. This 00410 // feature is used while iterating over an 00411 // iteration axis - subtables created in each iteration are assigned to a 00412 // fixed vector of BasePlot objects. 00413 Bool upDateBP(PtrBlock<BasePlot* > &BPS); 00414 00415 // Clear panels that lie partially or completely underneath 00416 // the plot currently being plotted. This is to mimic the 00417 // behaviour of native matplotlib, and to ensure automatic 00418 // cleanup of plots and associated data structures, when they 00419 // are no longer needed. 00420 Bool clearOverLaps(Int nrows, Int ncols, Int panel); 00421 00422 // Helper function to get the panel index for a particular 00423 // panel. If this panel does not exist in the list, -1 is returned. 00424 Int getPanelIndex(Int nrows, Int ncols, Int panel); 00425 00426 // TP cleanup + initialization. 00427 Bool setupTP(); 00428 00429 // Destroy a BasePlot, and trigger the "releasetable" callback function 00430 // so that user apps know when to delete/close their tables. 00431 Bool deleteBasePlot(Int panel,Int layer); 00432 00433 // Same as plotdata described above. 00434 // The last parameter is for internal use, and signals whether 00435 // TablePlot::plotData is being called in iteration or non-iteration mode. 00436 // This information is used to decide cleanup strategy. 00437 Bool plotData(PlotOptions &pop, Vector<Vector<String> > &datastrvector, 00438 const String iterstate); 00439 Bool plotData(PlotOptions &pop, Vector<String> &datastr, 00440 const String iterstate); 00441 00442 // Read out Flagging information from BasePlots. 00443 // This is to be called soon after a TablePlot::MarkRegions and 00444 // TablePlot::flagData sequence. "flaghist" contains information 00445 // about the table and plot, the regions marked, and the number of 00446 // points selected for flagging/unflagging. 00447 Bool updateFlagHistory(PtrBlock<Record*> &flaghist); 00448 00449 // Print out (formatted) info about the flag history. 00450 Bool dumpFlagHistory(PtrBlock<Record*> &flaghist); 00451 00452 // Print out (formatted) info about the data points selected 00453 // during a locate operation. 00454 // This function triggers the call-back for "printlocater" for 00455 // user apps to perform custom formatting of "locate" output. 00456 Bool dumpLocateInfo(PtrBlock<Record*> &INFO, Int flagdata = -1, 00457 Bool ave = 0); 00458 00459 // Generate an exception. 00460 void TablePlotError(String msg); 00461 00462 // Private class variables. 00463 // number of currently set Tables 00464 Int nTabs_p; 00465 // vector of currently set Tables 00466 Vector<Table> TABS_p; 00467 // root Table names per Table. 00468 Vector<String> rootTabNames_p; 00469 // Strings with selection info oer Table. 00470 Vector<String> tableSelections_p; 00471 // "FLAG" 00472 String dataFlagColName_p; 00473 // "FLAG_ROW" 00474 String rowFlagColName_p; 00475 00476 // Plotter class 00477 TPPlotter *TPLP; 00478 // Holds all active BasePlots. 00479 PtrBlock<PtrBlock<BasePlot* >*> ATBPS; 00480 // Holds tableiters for each Table. 00481 Vector<TableIterator> Iters_p; 00482 00483 // List of parameters per panel. 00484 PtrBlock<PanelParams* > PAN; 00485 00486 // resetTP callback pointer. 00487 PtrBlock<TPResetCallBack *> resetters_p; 00488 // resetTP callback user-app name 00489 Vector<String> appnames_p; 00490 00491 // Input TaqlStrings 00492 Vector<String> DataStr_p; 00493 // Input iteration axes strings. 00494 Vector<String> IterAxes_p; 00495 00496 // Panel co-ordinates of the latest panel. 00497 Int NRows_p,NCols_p; 00498 // Temporary instance of Plot options. 00499 PlotOptions Pop_p; 00500 00501 // Variables for iteration plots. 00502 // Overplots and parallel iterations are controlled 00503 // via these variables. 00504 PtrBlock<PlotOptions*> Pops_p; 00505 PtrBlock<Vector<Vector<String> >* > TaqlStr_p; 00506 PtrBlock<Vector<TableIterator>* > OvpIters_p; 00507 PtrBlock<Vector<String>* > OvpRootTabNames_p; 00508 PtrBlock<Vector<String>* > OvpTabSelections_p; 00509 Vector<String> TitleStrings_p; 00510 String Separate_p; 00511 00512 // Current panel number 00513 Int CurrentPanel_p; 00514 // Flag to signal that setTableT has been called and that 00515 // BasePlots needs to be created/updated with the new Tables. 00516 Int TableTouch_p; 00517 // Flags to signal iterplot mode. 00518 Bool IterPlotOn_p; 00519 Bool IterPlotStarted_p; 00520 // Flag to check if there is a currently displayed plot or not. 00521 Bool isPlotDisplayed_p; 00522 // Flag to indicate if Plot window is currently displayed. 00523 Bool isGuiVisible_p; 00524 00525 // Debug message flags. 00526 Timer tmr; 00527 00528 // Logger instance. 00529 SLog* log; 00530 static String clname; 00531 }; 00532 00533 00534 00535 // <summary> 00536 // Class for GUI binding - Casa C++ to Python and matplotlib. 00537 // </summary> 00538 00539 // <use visibility=export> 00540 00541 // <reviewed reviewer="" date="" tests=""> 00542 // </reviewed> 00543 00544 // <prerequisite> 00545 //#! Classes or concepts you should understand before using this class. 00546 // <li> PlotterGlobals.cc 00547 // </prerequisite> 00548 00549 // <etymology> 00550 // Class for GUI binding 00551 // </etymology> 00552 00553 // <synopsis> 00554 // This class controls the actions to be performed by Plotter-specific 00555 // buttons on the plotter matplotlib Gui. 00556 // One global instance of this class is maintained, and is accessed 00557 // from the Python-C++ binding functions defined in PlotterGlobals.cc 00558 // </synopsis> 00559 00560 // <example> 00561 // 00562 // (See TablePlot.cc, PlotterGlobals.cc) 00563 // 00564 // <srcblock> 00565 // </srcblock> 00566 // </example> 00567 00568 // <motivation> 00569 // This class was written because the python/C++ binding had to be done as 00570 // global functions, and they need access to the current TablePlot. 00571 // </motivation> 00572 00573 // <templating arg=T> 00574 // <li> 00575 // </templating> 00576 00577 // <thrown> 00578 // <li> 00579 // <li> 00580 // </thrown> 00581 00582 00583 // <todo asof="$DATE:$"> 00584 //# A List of bugs, limitations, extensions or planned refinements. 00585 // </todo> 00586 00587 00588 class TPGuiBinder 00589 { 00590 public : 00591 // Constructor 00592 TPGuiBinder( casa::TablePlot* intp ){ 00593 itsTablePlot = intp; 00594 } 00595 // Destructor 00596 ~TPGuiBinder(){}; 00597 // Gui callback to read in regions. 00598 Bool markregion(Int nrows,Int ncols, Int panel, 00599 casa::Vector<casa::Double> region) { 00600 return itsTablePlot->markRegions(nrows, ncols, panel, region); 00601 } 00602 // Gui callback for flagdata 00603 Bool flagdata() { 00604 //Bool ret = itsTablePlot->flagData(1); 00605 Bool ret = itsTablePlot->locateData(1); 00606 return ret; 00607 } 00608 // Gui callback for unflagdata 00609 Bool unflagdata() { 00610 //Bool ret = itsTablePlot->flagData(0); 00611 Bool ret = itsTablePlot->locateData(0); 00612 return ret; 00613 } 00614 // Gui callback for locatedata 00615 Bool locatedata() { 00616 //Vector<String> clist; 00617 //clist.resize(0); 00618 //PtrBlock<Record*> INFO; 00619 //Bool ret = itsTablePlot->locateData(clist, INFO); 00620 /* Clean up the PtrBlock */ 00621 //for(Int i=0;i<(Int)INFO.nelements();i++) 00622 // delete INFO[i]; 00623 //INFO.resize(0); 00624 00625 Bool ret = itsTablePlot->locateData(); 00626 return ret; 00627 } 00628 // Gui callback for iterplotnext 00629 Bool iterplotnext() { 00630 Vector<String> labcol; 00631 Vector<Vector<Double> > labval; 00632 if(itsTablePlot->iterMultiPlotNext(labcol,labval) == -1) 00633 itsTablePlot->changeGuiButtonState("iternext","disabled"); 00634 return True; 00635 } 00636 // Gui callback for iterplotstop. 00637 // Currently not in use. 00638 Bool iterplotstop(){ 00639 return itsTablePlot->iterMultiPlotStop(); 00640 } 00641 // Gui callback for clearplot. 00642 // Currently not in use. 00643 Bool clearplot(){ 00644 return itsTablePlot->clearPlot(0,0,0); 00645 } 00646 // Gui callback for "Quit". 00647 Bool quit(Int closewindow){ 00648 return itsTablePlot->resetTP(closewindow); 00649 } 00650 00651 private: 00652 casa::TablePlot* itsTablePlot; 00653 00654 }; 00655 00656 00657 } //# NAMESPACE CASA - END 00658 00659 //#ifndef AIPS_NO_TEMPLATE_SRC 00660 //#include <tables/TablePlot/TablePlot.cc> 00661 //#endif //# AIPS_NO_TEMPLATE_SRC 00662 #endif 00663