casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PlotMSMultiPlot.h
Go to the documentation of this file.
00001 //# PlotMSMultiPlot.h: plot with one x (or y) vs. many y's (or x's).
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 PLOTMSMULTIPLOT_H_
00028 #define PLOTMSMULTIPLOT_H_
00029 
00030 #include <plotms/Plots/PlotMSPlot.h>
00031 #include <plotms/Plots/PlotMSSinglePlot.h>
00032 
00033 #include <casa/namespace.h>
00034 
00035 namespace casa {
00036 
00037 // PlotMSMultiPlot is a subclass of PlotMSPlot that handles plots that have one
00038 // x (or y) versus many y's (or x's).
00039 class PlotMSMultiPlot : public PlotMSPlot {
00040 public:
00041     // Static //
00042     
00043     // See PlotMSPlot::makeParameters().
00044     // <group>
00045     static PlotMSPlotParameters makeParameters(PlotMSApp* plotms);
00046     static void makeParameters(PlotMSPlotParameters& params, PlotMSApp* plotms);
00047     // </group>
00048     
00049     
00050     // Non-Static //
00051     
00052     // Constructor which takes PlotMS parent.
00053     PlotMSMultiPlot(PlotMSApp* parent);
00054     
00055     // Destructor.
00056     ~PlotMSMultiPlot();
00057     
00058     
00059     // Implements PlotMSPlot::name().
00060     String name() const;
00061     
00062     // Implements PlotMSPlot::plots().
00063     vector<MaskedScatterPlotPtr> plots() const;
00064     
00065     // Implements PlotMSPlot::canvases().
00066     vector<PlotCanvasPtr> canvases() const;
00067     
00068     // Implements PlotMSPlot::setupPlotSubtabs().
00069     void setupPlotSubtabs(PlotMSPlotTab& tab) const;
00070     
00071     // Implements PlotMSPlot::attachToCanvases().
00072     void attachToCanvases();
00073     
00074     // Implements PlotMSPlot::detachFromCanvases().
00075     void detachFromCanvases();
00076     
00077     // Implements PlotMSPlot::plotTabHasChanged().
00078     void plotTabHasChanged(PlotMSPlotTab& tab);
00079     
00080 protected:
00081     // Implements PlotMSPlot::assignCanvases().
00082     bool assignCanvases(PlotMSPages& pages);
00083     
00084     // Implements PlotMSPlot::initializePlot().
00085     bool initializePlot();
00086     
00087     // Implements PlotMSPlot::parametersHaveChanged_().
00088     bool parametersHaveChanged_(const PlotMSWatchedParameters& params,
00089                 int updateFlag, bool releaseWhenDone);
00090     
00091     // Implements PlotMSPlot::selectedRegions().
00092     PlotMSRegions selectedRegions(
00093                 const vector<PlotCanvasPtr>& canvases) const;
00094     
00095     // Overrides PlotMSPlot::constructorSetup().
00096     void constructorSetup();
00097 
00098     // A temporary override until cache iterated slicing works
00099     virtual void releaseDrawing();    
00100 private:
00101     // Grid of plots.
00102     vector<vector<MaskedScatterPlotPtr> > itsPlots_;
00103     
00104     // Grid of canvases.
00105     vector<vector<PlotCanvasPtr> > itsCanvases_;
00106     
00107     vector<vector<PlotMSData*> > itsIndexers_;
00108     
00109     // See PlotMSSinglePlot::TCLParams class documentation
00110     PlotMSSinglePlot::TCLParams itsTCLParams_;
00111     
00112     
00113     // Updates the plot subtabs for the given number of axes.
00114     void updateSubtabs(unsigned int nRows, unsigned int nCols) const;
00115     
00116     // Updates the canvases and plots for a new number of axes, using the plot
00117     // parameters.
00118     void updateCanvasesAndPlotsForAxes();
00119     
00120     // Updates helper methods.
00121     // <group>
00122     bool updateCache();
00123     bool updateCanvas();
00124     bool updateDisplay();
00125     // </group>
00126     
00127     // Post-thread methods for loading the cache.
00128 public:
00129         static void     cacheLoaded (void *obj, bool wasCanceled)
00130         {
00131                 PlotMSMultiPlot *cobj = static_cast < PlotMSMultiPlot * >(obj);
00132                 if (cobj != NULL)
00133                         cobj->cacheLoaded_ (wasCanceled);
00134         }
00135         
00136 private:
00137         void cacheLoaded_ (bool wasCanceled);
00138 
00139 
00140 };
00141 
00142 }
00143 
00144 #endif /* PLOTMSMULTIPLOT_H_ */