casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PlotMSSinglePlot.h
Go to the documentation of this file.
00001 //# PlotMSSinglePlot.h: Subclass of PlotMSPlot for a single plot/canvas.
00002 //# Copyright (C) 2009
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 received 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 #ifndef PLOTMSSINGLEPLOT_H_
00028 #define PLOTMSSINGLEPLOT_H_
00029 
00030 #include <plotms/Plots/PlotMSPlot.h>
00031 
00032 #include <casa/namespace.h>
00033 
00034 namespace casa {
00035 
00036 // Implementation of PlotMSPlot for a single plot on a single canvas.  Uses
00037 // PlotMSSinglePlotParameters in addition to PlotMSPlotParameters.
00038 class PlotMSSinglePlot : public PlotMSPlot {
00039 public:
00040     // Static //    
00041     
00042     // See PlotMSPlot::makeParameters().
00043     // <group>
00044     static PlotMSPlotParameters makeParameters(PlotMSApp* plotms);
00045     static void makeParameters(PlotMSPlotParameters& params, PlotMSApp* plotms);
00046     // </group>
00047     
00048     
00049     // Simple class to hold parameter to resume updating after a threaded
00050     // cache loading.
00051     class TCLParams {
00052     public:
00053         // Constructor.
00054         TCLParams() : releaseWhenDone(false), updateCanvas(false),
00055                 updateDisplay(false), endCacheLog(false) { }
00056         
00057         // Destructor.
00058         ~TCLParams() { }
00059         
00060         // Parameters.
00061         // <group>
00062         bool releaseWhenDone;
00063         bool updateCanvas;
00064         bool updateDisplay;
00065         bool endCacheLog;
00066         // </group>
00067     };
00068     
00069     
00070     // Non-Static //
00071     
00072     // Constructor which takes the PlotMS parent.  Starts out with default
00073     // parameters.
00074     PlotMSSinglePlot(PlotMSApp* parent);
00075     
00076     // Destructor.
00077     ~PlotMSSinglePlot();
00078     
00079     
00080     // Include overloaded methods.
00081     using PlotMSPlot::initializePlot;
00082     
00083     
00084     // Implements PlotMSPlot::name().
00085     String name() const;
00086     
00087     // Implements PlotMSPlot::plots().
00088     vector<MaskedScatterPlotPtr> plots() const;
00089     
00090     // Implements PlotMSPlot::canvases().
00091     vector<PlotCanvasPtr> canvases() const;
00092     
00093     // Implements PlotMSPlot::setupPlotSubtabs().
00094     void setupPlotSubtabs(PlotMSPlotTab& tab) const;
00095     
00096     // Implements PlotMSPlot::attachToCanvases().
00097     void attachToCanvases();
00098     
00099     // Implements PlotMSPlot::detachFromCanvases().
00100     void detachFromCanvases();
00101     
00102     // Implements PlotMSPlot::plotTabHasChanged().
00103     void plotTabHasChanged(PlotMSPlotTab& tab) { (void)tab; }
00104     
00105 protected:
00106     // Implements PlotMSPlot::assignCanvases().
00107     bool assignCanvases(PlotMSPages& pages);
00108     
00109     // Implements PlotMSPlot::initializePlot().
00110     bool initializePlot();
00111     
00112     // Implements PlotMSPlot::parametersHaveChanged_().
00113     bool parametersHaveChanged_(const PlotMSWatchedParameters& params,
00114                 int updateFlag, bool releaseWhenDone);
00115     
00116     // Implements PlotMSPlot::selectedRegions().
00117     PlotMSRegions selectedRegions(
00118                 const vector<PlotCanvasPtr>& canvases) const;
00119     
00120     // Overrides PlotMSPlot::constructorSetup().
00121     void constructorSetup();
00122     
00123 private:    
00124     // Convenient access to single plot.
00125     MaskedScatterPlotPtr itsPlot_;
00126     
00127     // Convenient access to single plot as a colored plot.
00128     ColoredPlotPtr itsColoredPlot_;
00129     
00130     // Convenient access to single canvas.
00131     PlotCanvasPtr itsCanvas_;
00132     
00133     // See TCLParams class documentation
00134     TCLParams itsTCLParams_;
00135     
00136     
00137     // Disable copy constructor and operator for now.
00138     // <group>
00139     PlotMSSinglePlot(const PlotMSSinglePlot& copy);
00140     PlotMSSinglePlot& operator=(const PlotMSSinglePlot& copy);
00141     // </group>
00142     
00143     // Updates helper methods.
00144     // <group>
00145     bool updateCache();
00146     bool updateCanvas();
00147     bool updateDisplay();
00148     // </group>
00149     
00150     // Post-thread methods for loading the cache.
00151     public:
00152         static void cacheLoaded (void *obj, bool wasCanceled)
00153         {
00154              PlotMSSinglePlot *cobj = static_cast < PlotMSSinglePlot * >(obj);
00155              if (cobj != NULL)
00156                   cobj->cacheLoaded_ (wasCanceled);
00157         }
00158         
00159         private:
00160         void cacheLoaded_ (bool wasCanceled);
00161         
00162 
00163 };
00164 
00165 }
00166 
00167 #endif /* PLOTMSSINGLEPLOT_H_ */