ActiveCaching2dDD.h

Go to the documentation of this file.
00001 //# ActiveCaching2dDD.h: active 2d implementation of a CachingDisplayData
00002 //# Copyright (C) 1999,2000,2001,2002,2003,2004
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 
00028 #ifndef TRIALDISPLAY_ACTIVECACHING2DDD_H
00029 #define TRIALDISPLAY_ACTIVECACHING2DDD_H
00030 
00031 #include <casa/aips.h>
00032 #include <display/Display/DisplayCoordinateSystem.h>
00033 #include <display/DisplayDatas/CachingDisplayData.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 // <summary>
00038 // Class providing active behaviour for 2d CachingDisplayDatas.
00039 // </summary>
00040 
00041 // <synopsis>
00042 // An "active" DisplayData is one which is able to negotiate
00043 // coordinates on a WorldCanvas, and subsequently provide coordinate
00044 // conversion facilities.  This particular implementation is
00045 // of a two-dimensional (2d) active DisplayData.
00046 // </synopsis>
00047 
00048         class ActiveCaching2dDD : public CachingDisplayData {
00049 
00050         public:
00051 
00052                 // Constructor.  Caller must provide a DisplayCoordinateSystem, and the
00053                 // pixel range (via <src>pixelblc</src> and <src>pixeltrc</src>)
00054                 // over which the DisplayData is expected to function.  The primary
00055                 // use of <src>pixelblc</src> and <src>pixeltrc</src> is to provide
00056                 // limits for the unzoomed WorldCanvas.  <src>coordsys</src> must
00057                 // have only two world and pixel axes, otherwise an exception is
00058                 // thrown, and likewise, <src>pixblc</src> and <src>pixtrc</src>
00059                 // must both be of length two.
00060                 ActiveCaching2dDD(const DisplayCoordinateSystem &coordsys,
00061                                   const Vector<Double> &pixblc,
00062                                   const Vector<Double> &pixtrc);
00063 
00064                 // Destructor.
00065                 virtual ~ActiveCaching2dDD();
00066 
00067                 // Coordinate transformation handlers, called by WorldCanvasHolder.
00068                 // <group>
00069                 virtual Bool linToWorld(Vector<Double> &world, const Vector<Double> &lin);
00070                 virtual Bool worldToLin(Vector<Double> &lin, const Vector<Double> &world);
00071                 // </group>
00072 
00073                 // Format a string containing coordinate information at the given
00074                 // world coordinate.
00075                 virtual String showPosition(const Vector<Double> &world,
00076                                             const Bool &displayAxesOnly = False);
00077 
00078                 // World axis information suppliers.
00079                 // <group>
00080                 virtual Vector<String> worldAxisNames() const;
00081                 virtual Vector<String> worldAxisUnits() const;
00082                 // </group>
00083 
00084                 // Return the number of display elements (ie. drawable images) in
00085                 // this DisplayData.  Both return 1 because this is defined to be a
00086                 // two-dimensional DisplayData, and can only have one view.  That
00087                 // is, there is no third axis to iterate over for multiple views.
00088                 // <group>
00089                 virtual uInt nelements(const WorldCanvasHolder &/*wcHolder*/) const {
00090                         return nelements();
00091                 }
00092                 virtual uInt nelements() const {
00093                         return 1;
00094                 }
00095                 // </group>
00096 
00097                 // Install the default options for this DisplayData.
00098                 virtual void setDefaultOptions();
00099 
00100                 // Apply options stored in <src>rec</src> to the DisplayData.  A
00101                 // return value of <src>True</src> means a refresh is needed.
00102                 // <src>recOut</src> contains any fields which were implicitly
00103                 // changed as a result of the call to this function.
00104                 virtual Bool setOptions(Record &rec, Record &recOut);
00105 
00106                 // Retrieve the current and default options and parameter types.
00107                 virtual Record getOptions( bool scrub=false ) const;
00108 
00109                 // Negotiatiate WorldCanvas linear coordinate system when asked to
00110                 // do so by the WorldCanvasHolder.
00111                 virtual Bool sizeControl(WorldCanvasHolder &wcHolder,
00112                                          AttributeBuffer &holderBuf);
00113 
00114                 // Determine whether DD can draw on the current coordinate system
00115                 // of the given WC[H].
00116                 virtual Bool conformsToCS(const WorldCanvas& wc);
00117 
00118                 // Tidy up the elements of this DisplayData.
00119                 virtual void cleanup();
00120 
00121         protected:
00122 
00123                 // Return the current options of this DisplayData as an
00124                 // AttributeBuffer.  The caller must delete the returned buffer.
00125                 virtual AttributeBuffer optionsAsAttributes();
00126 
00127                 // (Required) default constructor.
00128                 ActiveCaching2dDD();
00129 
00130                 // (Required) copy constructor.
00131                 ActiveCaching2dDD(const ActiveCaching2dDD &other);
00132 
00133                 // (Required) copy assignment.
00134                 void operator=(const ActiveCaching2dDD &other);
00135 
00136                 // Install a DisplayCoordinateSystem and limits.
00137                 void setCoordinateSystem(const DisplayCoordinateSystem &coordsys,
00138                                          const Vector<Double> &pixblc,
00139                                          const Vector<Double> &pixtrc);
00140 
00141                 // Identify a specified world axis by its Coordinate type, number,
00142                 // and axis in that coordinate.
00143                 void identifyWorldAxis(Coordinate::Type &type, Int &coordinate,
00144                                        Int &axisincoord, const uInt worldaxisnum);
00145 
00146                 // Generate a String code for the specified world axis, describing
00147                 // the coordinate type, number and axis in that coordinate.
00148                 String codeWorldAxis(const uInt worldaxisnum);
00149 
00150                 // Return the world axis increments.
00151                 Vector<Double> worldAxisIncrements() const;
00152 
00153                 // Return whether tracking is currently world (T) or pixel (F) coordinates.
00154                 virtual Bool worldCoordTracking() const {
00155                         return itsShowWorldCoordinate;
00156                 }
00157 
00158                 // Store the 2d DisplayCoordinateSystem here.
00159                 DisplayCoordinateSystem itsCoordinateSystem;
00160 
00161                 // Store the 2d pixel corners here.
00162                 Vector<Double> itsPixelBlc, itsPixelTrc;
00163 
00164         private:
00165 
00166                 // Option: aspect ratio for pixels.
00167                 String itsOptionsAspect;
00168 
00169                 // Position tracking
00170                 String itsSpectralUnit;
00171                 String itsVelocityType;
00172                 Bool itsAbsolute;
00173                 Bool itsShowWorldCoordinate;
00174                 Bool itsFractionalPixels;
00175 
00176                 // Set Spectral formatting
00177                 void setSpectralFormatting (DisplayCoordinateSystem& cSys,
00178                                             const String& velTypeString,
00179                                             const String& unitString);
00180 
00181 
00182         };
00183 
00184 
00185 } //# NAMESPACE CASA - END
00186 
00187 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1