00001 //# WedgeDD.h: Color Wedge DisplayData 00002 //# Copyright (C) 2001,2002 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 00027 #ifndef TRIALDISPLAY_WEDGEDD_H 00028 #define TRIALDISPLAY_WEDGEDD_H 00029 00030 #include <casa/aips.h> 00031 #include <display/DisplayDatas/ActiveCaching2dDD.h> 00032 #include <display/Display/DisplayCoordinateSystem.h> 00033 #include <display/DisplayCanvas/WCCSNLAxisLabeller.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 class WCPowerScaleHandler; 00038 template <class T> class Matrix; 00039 00040 class WedgeDM; 00041 00042 // <summary> 00043 // A DisplayData to draw color wedges 00044 // </summary> 00045 // 00046 // <use visibility=export> 00047 // 00048 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00049 // </reviewed> 00050 // 00051 // <prerequisite> 00052 // <li> DisplayData 00053 // </li> CachingDisplayData 00054 // </prerequisite> 00055 // 00056 // <etymology> 00057 // </etymology> 00058 // 00059 // <synopsis> This DisplayData can be created by itself. It's main 00060 // task though is to set up a coordinate system form the data range 00061 // and units of another DisplayData. The user can control this through 00062 // options in this DisplayData: "datamin", "datamax, "dataunit" and 00063 // "powercycles". 00064 00065 // </synopsis> 00066 // 00067 // <example> 00068 // <srcBlock> 00069 // </srcBlock> 00070 // </example> 00071 // 00072 // <motivation> 00073 // Users want wedges 00074 //</motivation> 00075 // 00076 // <todo> 00077 // Transposed wedges 00078 // </todo> 00079 // 00080 00081 class WedgeDD : public ActiveCaching2dDD { 00082 00083 public: 00084 00085 WedgeDD( DisplayData *image ); 00086 00087 // Destructor. 00088 virtual ~WedgeDD(); 00089 00090 // Constructor help function, creates coordinatesystem and fills data Matrix 00091 virtual void setup(); 00092 00093 // The coordinate sydtem needs to be update when the data range changes 00094 virtual void updateCsys(); 00095 00096 // Axis labeller, 5th step in the WCHolder refresh cycle 00097 virtual Bool labelAxes(const WCRefreshEvent &ev); 00098 virtual Bool canLabelAxes() const; 00099 bool isDisplayable( ) const; 00100 00101 // Return the data unit. 00102 virtual const Unit dataUnit() const; 00103 const IPosition dataShape() const { 00104 return IPosition( ); 00105 } 00106 uInt dataDim() const { 00107 return 0; 00108 } 00109 std::vector<int> displayAxes( ) const { 00110 return std::vector<int>( ); 00111 } 00112 00113 // Format the wedge value at the given world position. 00114 virtual String showValue(const Vector<Double> &world); 00115 00116 // Install the default options for this DisplayData. 00117 virtual void setDefaultOptions(); 00118 00119 // Apply options stored in <src>rec</src> to the DisplayData. A 00120 // return value of <src>True</src> means a refresh is needed. 00121 // <src>recOut</src> contains any fields which were implicitly 00122 // changed as a result of the call to this function. 00123 virtual Bool setOptions(Record &rec, Record &recOut); 00124 00125 // Retrieve the current and default options and parameter types. 00126 virtual Record getOptions( bool scrub=false ) const; 00127 00128 // Return the type of this DisplayData. 00129 virtual Display::DisplayDataType classType() { 00130 return Display::Raster; 00131 } 00132 // Pure virtual function from DisplayData... 00133 String dataType() const { 00134 return "wedge"; 00135 } 00136 00137 // Create a new AxesDisplayMethod for drawing on the given 00138 // WorldCanvas when the AttributeBuffers are suitably matched to the 00139 // current state of this DisplayData and of the WorldCanvas/Holder. 00140 // The tag is a unique number used to identify the age of the newly 00141 // constructed CachingDisplayMethod. 00142 virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas, 00143 AttributeBuffer *wchAttributes, 00144 AttributeBuffer *ddAttributes, 00145 CachingDisplayData *dd); 00146 00147 // Return the current options of this DisplayData as an 00148 // AttributeBuffer. 00149 virtual AttributeBuffer optionsAsAttributes(); 00150 00151 // Take actions on removal from WC[H] (notably, deletion of drawlists). 00152 virtual void notifyUnregister(WorldCanvasHolder& wcHolder, 00153 Bool ignoreRefresh = False); 00154 00155 const static String WEDGE_PREFIX; 00156 00157 std::string errorMessage( ) const { return ""; } 00158 00159 protected: 00160 00161 00162 00163 private: 00164 // (Required) copy constructor. 00165 WedgeDD(const WedgeDD &other); 00166 00167 // (Required) copy assignment. 00168 void operator=(const WedgeDD &other); 00169 friend class WedgeDM; 00170 // Data minimum and maximum to set up the coordinate system 00171 Float itsMin, itsMax; 00172 // the length of the Vector 00173 uInt itsLength; 00174 // the unit of the input data 00175 String itsDataUnit; 00176 //<group> 00177 // the power law adjustment for for the scle handler 00178 Float itsPowerCycles; 00179 WCPowerScaleHandler* itsPowerScaleHandler; 00180 00181 String itsOptionsMode; 00182 //</group> 00183 // the axis labeller 00184 WCCSNLAxisLabeller itsAxisLabeller; 00185 // The actual colorbar data 00186 Matrix<Float> itsColorbar; 00187 // the local coordinate system - gets exported to the parent DD 00188 DisplayCoordinateSystem itsCoordinateSystem; 00189 00190 DlHandle<DisplayData> ihandle_; 00191 }; 00192 00193 00194 } //# NAMESPACE CASA - END 00195 00196 #endif