casa
$Rev:20696$
|
00001 //# PlotMSOverPlot.h: Subclass of PlotMSPlot for a single plot/canvas. 00002 //# Copyright (C) 2012 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 PLOTMSOVERPLOT_H_ 00028 #define PLOTMSOVERPLOT_H_ 00029 00030 #include <plotms/Plots/PlotMSPlot.h> 00031 #include <plotms/Data/PlotMSIndexer.h> 00032 #include <casaqt/QwtPlotter/QPScatterPlot.h> 00033 00034 #include <casa/namespace.h> 00035 00036 namespace casa { 00037 00038 class PlotMSOverPlot : public PlotMSPlot { 00039 public: 00040 // Static 00041 00042 // See PlotMSPlot::makeParameters() 00043 // <group> 00044 static PlotMSPlotParameters makeParameters(PlotMSApp *plotms); 00045 static void makeParameters(PlotMSPlotParameters ¶ms, PlotMSApp *plotms); 00046 // </group> 00047 00048 PlotMSOverPlot(PlotMSApp *parent); 00049 virtual ~PlotMSOverPlot(); 00050 00051 // Simple class to hold parameter to resume updating after a threaded 00052 // cache loading 00053 class TCLParams { 00054 public: 00055 // Parameters 00056 // <group> 00057 bool releaseWhenDone; 00058 bool updateCanvas; 00059 bool updateDisplay; 00060 bool endCacheLog; 00061 bool updateIteration; 00062 // </group> 00063 00064 // Constructor 00065 TCLParams() 00066 : 00067 releaseWhenDone(false), 00068 updateCanvas(false), 00069 updateDisplay(false), 00070 endCacheLog(false) 00071 {} 00072 }; 00073 00074 // virtual methods 00075 String name() const; 00076 String spectype() const { return "Over"; } 00077 vector<MaskedScatterPlotPtr> plots() const; 00078 vector<PlotCanvasPtr> canvases() const; 00079 void setupPlotSubtabs(PlotMSPlotTab &tab) const; 00080 void attachToCanvases(); 00081 void detachFromCanvases(); 00082 void plotTabHasChanged(PlotMSPlotTab&) {} 00083 Int iter() { return iter_; } 00084 00085 protected: 00086 // Template pattern methods 00087 bool assignCanvases(PlotMSPages &pages); 00088 bool initializePlot(); 00089 bool parametersHaveChanged_(const PlotMSWatchedParameters ¶ms, 00090 int updateFlag, bool releaseWhenDone); 00091 void updateCanvasesAndPlotsForAxes(); 00092 PlotMSRegions selectedRegions(const vector<PlotCanvasPtr> &canvases) const; 00093 00094 void resize(PlotMSPages&, uInt rows, uInt cols); 00095 00096 void constructorSetup(); 00097 void updatePages(); 00098 bool updateCache(); 00099 bool updateCanvas(); 00100 bool updateDisplay(); 00101 void setColors(); 00102 00103 bool firstIter(); 00104 bool prevIter(); 00105 bool nextIter(); 00106 bool lastIter(); 00107 bool resetIter(); 00108 void recalculateIteration(); 00109 00110 void updatePlots(); 00111 bool updateIndexing(); 00112 00113 void logPoints(); 00114 void logIter(Int iter, Int nIter); 00115 00116 private: 00117 vector<vector<MaskedScatterPlotPtr> > itsPlots_; 00118 vector<vector<PlotCanvasPtr> > itsCanvases_; 00119 vector<vector<QPScatterPlot*> > itsColoredPlots_; 00120 TCLParams itsTCLParams_; 00121 00122 Int iter_; 00123 Int iterStep_; 00124 00125 // Disable copy constructor and assignment operator 00126 // <group> 00127 PlotMSOverPlot(const PlotMSOverPlot&); 00128 PlotMSOverPlot& operator=(const PlotMSOverPlot&); 00129 // </group> 00130 00131 public: 00132 static void cacheLoaded(void *obj, bool wasCanceled) 00133 { 00134 PlotMSOverPlot *cobj = static_cast<PlotMSOverPlot*>(obj); 00135 if(cobj != NULL) 00136 cobj->cacheLoaded_(wasCanceled); 00137 } 00138 private: 00139 void cacheLoaded_(bool wasCanceled); 00140 00141 static const uInt pixelThreshold; 00142 static const uInt mediumThreshold; 00143 static const uInt largeThreshold; 00144 }; 00145 00146 } // namespace casa 00147 00148 #endif//PLOTMSOVERPLOT_H_