casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
WedgeDD.h
Go to the documentation of this file.
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 <coordinates/Coordinates/CoordinateSystem.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 
00099   bool isDisplayable( ) const;
00100 
00101   // Return the data unit.
00102   virtual const Unit dataUnit() const;
00103   const IPosition dataShape() const { return IPosition( ); }
00104   const uInt dataDim() const { return 0; }
00105   std::vector<int> displayAxes( ) const { return std::vector<int>( ); }
00106 
00107   // Format the wedge value at the given world position.
00108   virtual String showValue(const Vector<Double> &world);
00109 
00110   // Install the default options for this DisplayData.
00111   virtual void setDefaultOptions();
00112   
00113   // Apply options stored in <src>rec</src> to the DisplayData.  A
00114   // return value of <src>True</src> means a refresh is needed.
00115   // <src>recOut</src> contains any fields which were implicitly 
00116   // changed as a result of the call to this function.
00117   virtual Bool setOptions(Record &rec, Record &recOut);
00118 
00119   // Retrieve the current and default options and parameter types.
00120   virtual Record getOptions();
00121 
00122   // Return the type of this DisplayData.
00123   virtual Display::DisplayDataType classType()
00124   { return Display::Raster;}
00125   // Pure virtual function from DisplayData...
00126   String dataType() const { return "wedge"; }
00127   
00128   // Create a new AxesDisplayMethod for drawing on the given
00129   // WorldCanvas when the AttributeBuffers are suitably matched to the
00130   // current state of this DisplayData and of the WorldCanvas/Holder.
00131   // The tag is a unique number used to identify the age of the newly
00132   // constructed CachingDisplayMethod.
00133   virtual CachingDisplayMethod *newDisplayMethod(WorldCanvas *worldCanvas,
00134                                          AttributeBuffer *wchAttributes,
00135                                          AttributeBuffer *ddAttributes,
00136                                          CachingDisplayData *dd);
00137  
00138   // Return the current options of this DisplayData as an
00139   // AttributeBuffer.
00140   virtual AttributeBuffer optionsAsAttributes();
00141 
00142   // Take actions on removal from WC[H] (notably, deletion of drawlists).
00143   virtual void notifyUnregister(WorldCanvasHolder& wcHolder,
00144                                 Bool ignoreRefresh = False);
00145 
00146   const static String WEDGE_PREFIX;
00147 
00148 protected:
00149 
00150 
00151 
00152 private:
00153   // (Required) copy constructor.
00154    WedgeDD(const WedgeDD &other);
00155 
00156    // (Required) copy assignment.
00157    void operator=(const WedgeDD &other);
00158   friend class WedgeDM;
00159   // Data minimum and maximum to set up the coordinate system
00160   Float itsMin, itsMax;
00161   // the length of the Vector
00162   uInt itsLength;
00163   // the unit of the input data
00164   String itsDataUnit;
00165   //<group>
00166   // the power law adjustment for for the scle handler
00167   Float itsPowerCycles;
00168   WCPowerScaleHandler* itsPowerScaleHandler;
00169 
00170   String itsOptionsMode;
00171   //</group>
00172   // the axis labeller  
00173   WCCSNLAxisLabeller itsAxisLabeller;
00174   // The actual colorbar data
00175   Matrix<Float> itsColorbar;
00176   // the local coordinate system - gets exported to the parent DD
00177   CoordinateSystem itsCoordinateSystem;
00178 
00179   DlHandle<DisplayData> ihandle_;
00180 };
00181 
00182 
00183 } //# NAMESPACE CASA - END
00184 
00185 #endif