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