casa
$Rev:20696$
|
00001 //# WCCoordinateHandler.h: interface for coordinate handling on WorldCanvas 00002 //# Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000 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_WCCOORDINATEHANDLER_H 00029 #define TRIALDISPLAY_WCCOORDINATEHANDLER_H 00030 00031 #include <casa/aips.h> 00032 #include <casa/Arrays/Vector.h> 00033 00034 namespace casa { //# NAMESPACE CASA - BEGIN 00035 00036 template <class T> class Matrix; 00037 00038 // <summary> 00039 // Base class defining a set of transformations for WorldCanvas coordinates. 00040 // </summary> 00041 // 00042 // <prerequisite> 00043 // <li> Understanding of non-linear World Coordinate Systems 00044 // </prerequisite> 00045 // 00046 // <etymology> 00047 // WCCoordinateHandler : WorldCanvas Coordinate Handler 00048 // </etymology> 00049 // 00050 // <synopsis> 00051 // The WCCoordinateHandler class implements the concept of a coordinate 00052 // transformation pair that can be plugged in to the 00053 // <linkto class="WorldCanvas">WorldCanvas</linkto>. It is designed for 00054 // derivation by the programmer and can thereby be arbitrarily implemented. 00055 // 00056 // This class defines an interface between the WorldCanvas, which uses 00057 // coordinate transformations for various reasons, and the derived class 00058 // that implements these coordinate transformations. 00059 // 00060 // The designer of the derived class must write the Vector<Double> versions 00061 // of linToWorld and worldToLin as described in detail below. It is also 00062 // recommended that the Matrix<Double> versions of linToWorld and worldToLin 00063 // be written to maximize efficiency. 00064 // </synopsis> 00065 // 00066 // <motivation> 00067 // <ul> 00068 // <li>Needed to plug in a user-programmable coordinate transformation functions into 00069 // the world canvas in a convenient way. 00070 // <li> Wanted to bundle these transformations 00071 // into a class to follow OO methods. 00072 // </motivation> 00073 // 00074 // <example> 00075 // <linkto class="DefaultWCCoordinateHandler">DefaultWCCoordinateHandler</linkto> 00076 // </example> 00077 // 00078 00079 class WCCoordinateHandler { 00080 00081 public: 00082 00083 // Default Constructor Required 00084 WCCoordinateHandler(); 00085 00086 // transform the lin point (2-dimensional) into a world coordinate 00087 // (N-dimensional), returning False if the coordinate could not be 00088 // transformed. Derived classes should override. 00089 virtual Bool linToWorld(Vector<Double> & world, 00090 const Vector<Double> & lin) = 0; 00091 00092 // Batch transformation where each row of lin is a coordinate that 00093 // is transformed into each row of world. On input, if the i'th 00094 // position in the failures vector is true, the i'th transformation 00095 // is not attempted. If the j'th transformation fails, the j'th 00096 // position in the failures vector will be set. The return value is 00097 // True only when the failures vector has no position set to True; 00098 // This function is implemented in this base class by making 00099 // repeated calls to the Vector<Double> version of linToWorld. 00100 virtual Bool linToWorld(Matrix<Double> & world, 00101 Vector<Bool> & failures, 00102 const Matrix<Double> & lin); 00103 00104 // transform the world point (N-dimensional) into a lin coordinate 00105 // (2-dimensional), returning False if the coordinate could not be 00106 // transformed. Derived classes should override. 00107 virtual Bool worldToLin(Vector<Double> & lin, 00108 const Vector<Double> & world) = 0; 00109 00110 // Batch transformation where each row of world is a coordinate that 00111 // is transformed into each row of lin. On input, if the i'th 00112 // position in the failures vector is true, the i'th transformation 00113 // is not attempted. If the j'th transformation fails, the j'th 00114 // position in the failures vector will be set. The return value is 00115 // True only when the failures vector has no position set to True; 00116 // This function is implemented in this base class by making 00117 // repeated calls to the Vector<Double> version of worldToLin. 00118 virtual Bool worldToLin(Matrix<Double> & lin, 00119 Vector<Bool> & failures, 00120 const Matrix<Double> & world); 00121 00122 // Return the number of axes in the world coordinates 00123 virtual uInt nWorldAxes() const = 0; 00124 00125 // Routines that give the axes names and the unit. 00126 // <group> 00127 /* virtual Vector<String> worldAxisNames() = 0; */ 00128 /* virtual Vector<String> worldAxisUnits() = 0; */ 00129 // </group> 00130 00131 // Destructor 00132 virtual ~WCCoordinateHandler(); 00133 00134 }; 00135 00136 00137 } //# NAMESPACE CASA - END 00138 00139 #endif