casa
$Rev:20696$
|
00001 //# PlotMSData.h: Connects data cache and plotting data objects. 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 PLOTMSDATA_H_ 00028 #define PLOTMSDATA_H_ 00029 00030 #include <graphics/GenericPlotter/PlotData.h> 00031 00032 #include <plotms/Data/PlotMSCache.h> 00033 #include <plotms/Data/PlotMSCacheIndexer.h> 00034 00035 #include <casa/namespace.h> 00036 using namespace std; 00037 00038 namespace casa { 00039 00040 //# Forward declarations. 00041 class PlotMSApp; 00042 00043 00044 // Layer between plot cache and the rest of PlotMS and the GenericPlotter 00045 // classes. 00046 class PlotMSData : public PlotMaskedPointData, public PlotBinnedData { 00047 public: 00048 // Constructor which takes the parent PlotMS. 00049 PlotMSData(PlotMSApp* plotms); 00050 00051 // Copy constructor. See operator=(). 00052 PlotMSData(const PlotMSData& copy); 00053 00054 // Destructor. 00055 ~PlotMSData(); 00056 00057 // Set the internal cache 00058 void setCache(PlotMSCache* cache) {itsCache_=cache;}; 00059 00060 // Implemented PlotData methods. 00061 // <group> 00062 bool willDeleteData() const { return true; } 00063 void setDeleteData(bool del = true) { (void)del; } 00064 bool isValid() const; 00065 // </group> 00066 00067 // Implemented PlotPointData methods. 00068 // <group> 00069 unsigned int size() const; 00070 double xAt(unsigned int i) const; 00071 double yAt(unsigned int i) const; 00072 void xAndYAt(unsigned int index, double& x, double& y) const; 00073 bool minsMaxes(double& xMin, double& xMax, double& yMin, double& yMax); 00074 // </group> 00075 00076 // Implemented PlotMaskedPointData methods. 00077 // <group> 00078 bool maskedAt(unsigned int index) const; 00079 void xyAndMaskAt(unsigned int index, double& x, double& y, 00080 bool& mask) const; 00081 // </group> 00082 00083 // Unimplemented PlotMaskedPointData methods. 00084 // <group> 00085 unsigned int sizeMasked() const { return 0; } 00086 unsigned int sizeUnmasked() const { return size(); } 00087 bool maskedMinsMaxes(double& xMin, double& xMax, double& yMin, 00088 double& yMax) { return minsMaxes(xMin, xMax, yMin, yMax); } 00089 bool unmaskedMinsMaxes(double& xMin, double& xMax, double& yMin, 00090 double& yMax) { return minsMaxes(xMin, xMax, yMin, yMax); } 00091 // </group> 00092 00093 // Implemented PlotBinnedData methods. 00094 // <group> 00095 unsigned int numBins() const; 00096 unsigned int binAt(unsigned int i) const; 00097 bool isBinned() const; 00098 // </group> 00099 00100 00101 // Tells the cache what to colorize on, on the next draw. Returns whether 00102 // the plot needs to be redrawn or not. 00103 bool colorize(bool doColorize, PMS::Axis colorizeAxis); 00104 00105 // Returns the reference value for the given axis, if applicable. 00106 // <group> 00107 bool hasReferenceValue(PMS::Axis axis); 00108 double referenceValue(PMS::Axis axis); 00109 // </group> 00110 00111 // See PlotMSCache::readyForPlotting(). 00112 bool cacheReady() const; 00113 00114 // See PlotMSCache::clear(). 00115 void clearCache(); 00116 00117 // Loads values into the cache using the given vis set, with the given 00118 // axes used for x and y values. See PlotMSCache::load(). 00119 // <group> 00120 00121 /* 00122 I think this is deprecated.... (gmoellen 10May17) 00123 00124 void loadCache(PMS::Axis xAxis, PMS::Axis yAxis, 00125 PMS::DataColumn xData, PMS::DataColumn yData, 00126 const String& msname, 00127 const PlotMSSelection& selection, 00128 const PlotMSAveraging& averaging, 00129 const PlotMSTransformations& transformations, 00130 PlotMSCacheThread* thread = NULL); 00131 */ 00132 00133 void loadCache(const vector<PMS::Axis>& axes, 00134 const vector<PMS::DataColumn>& data, 00135 const String& msname, 00136 const PlotMSSelection& selection, 00137 const PlotMSAveraging& averaging, 00138 const PlotMSTransformations& transformations, 00139 PlotMSCacheThread* thread = NULL); 00140 // </group> 00141 00142 // See PlotMSCache::setUpPlot(). 00143 void setupCache(PMS::Axis xAxis, PMS::Axis yAxis); 00144 00145 // See PlotMSCache::release(). 00146 void releaseCache(const vector<PMS::Axis>& axes); 00147 00148 // See PlotMSCache::locateRange(). 00149 PlotLogMessage* locateRange(const Vector<PlotRegion>& regions); 00150 00151 // See PlotMSCache::flagRange(). 00152 PlotLogMessage* flagRange(const PlotMSFlagging& flagging, 00153 const Vector<PlotRegion>& regions, bool flag = true); 00154 00155 // See PlotMSCache::loadedAxes(). 00156 vector<pair<PMS::Axis, unsigned int> > loadedAxes() const; 00157 00158 00159 // Copy operator. 00160 PlotMSData& operator=(const PlotMSData& copy); 00161 00162 private: 00163 // Parent. 00164 PlotMSApp* itsPlotms_; 00165 00166 // Cache. 00167 PlotMSCachePtr itsCache_; 00168 PlotMSCachePtr itsMSCache_; 00169 PlotMSCachePtr itsCalCache_; 00170 00171 // Indexer 00172 PlotMSCacheIndexerPtr itsIndexer_; 00173 00174 // Last set colorizing parameters. 00175 // <group> 00176 bool itsColorize_; 00177 PMS::Axis itsColorizeAxis_; 00178 // </group> 00179 00180 }; 00181 00182 } 00183 00184 #endif /* PLOTMSDATA_H_ */