casa
$Rev:20696$
|
00001 //# WCPolygon.h: Class to define a polygonal world coordinate region 00002 //# Copyright (C) 1998,1999,2001 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: WCPolygon.h 20615 2009-06-09 02:16:01Z Malte.Marquarding $ 00027 00028 00029 #ifndef IMAGES_WCELLIPSOID_H 00030 #define IMAGES_WCELLIPSOID_H 00031 00032 #include <casa/aips.h> 00033 #include <coordinates/Coordinates/CoordinateSystem.h> 00034 #include <images/Regions/WCRegion.h> 00035 #include <lattices/Lattices/RegionType.h> 00036 #include <casa/Arrays/Vector.h> 00037 #include <casa/Quanta/Quantum.h> 00038 00039 namespace casa { //# NAMESPACE CASA - BEGIN 00040 00041 00042 // <summary> 00043 // Class to define an n-dimensional ellipsoid in world coordinates. 00044 // 00045 // </summary> 00046 // 00047 // <use visibility=export> 00048 // 00049 // <reviewed reviewer="" date="" tests=""> 00050 // </reviewed> 00051 // 00052 // <prerequisite> 00053 // <li> <linkto class=WCRegion>WCRegion</linkto> 00054 // <li> <linkto class=WCRegion>WCPolygon</linkto> 00055 // <li> <linkto class=LCRegion>LCRegion</linkto> 00056 // <li> <linkto class=CoordinateSystem>CoordinateSystem</linkto> 00057 // </prerequisite> 00058 // 00059 // <synopsis> 00060 // 00061 // </synopsis> 00062 // 00063 00064 // <motivation> 00065 // Users must be able to specify ellipsoids in world as well as lattice 00066 // coordinates. 00067 // </motivation> 00068 // 00069 00070 00071 class WCEllipsoid : public WCRegion 00072 { 00073 public: 00074 00075 // ellipsoid with axes parallel to coordinate axes 00076 WCEllipsoid( 00077 const Vector<Quantity>& center, 00078 const Vector<Quantity>& radii, 00079 const IPosition& pixelAxes, 00080 const CoordinateSystem& cSys, 00081 const RegionType::AbsRelType absRel=RegionType::Abs 00082 ); 00083 00084 // sphere. <src>pixelAxes</src> must have the same base units 00085 // and those pixels musb be square or an exception is thrown. 00086 WCEllipsoid( 00087 const Vector<Quantity>& center, 00088 const Quantity& radius, 00089 const IPosition& pixelAxes, 00090 const CoordinateSystem& cSys, 00091 const RegionType::AbsRelType absRel=RegionType::Abs 00092 ); 00093 00094 // 2-D ellipse . The axes must have the same base units 00095 // and those pixels must be square or an exception is thrown. 00096 // <src>theta</src> is the angle between the <src>pixelAxis0</src> and 00097 // the major axis of the ellipse. 00098 WCEllipsoid( 00099 const Quantity& xcenter, const Quantity& ycenter, 00100 const Quantity& majorAxis, const Quantity& minorAxis, 00101 const Quantity& theta, 00102 const uInt pixelAxis0, const uInt pixelAxis1, 00103 const CoordinateSystem& cSys, 00104 const RegionType::AbsRelType absRel=RegionType::Abs 00105 ); 00106 00107 WCEllipsoid(const WCEllipsoid& that); 00108 00109 WCEllipsoid& operator= (const WCEllipsoid& that); 00110 00111 Bool operator== (const WCRegion& other) const; 00112 00113 WCRegion* cloneRegion() const; 00114 00115 Bool canExtend() const; 00116 00117 String type() const; 00118 00119 static String className(); 00120 00121 static WCEllipsoid* fromRecord( 00122 const TableRecord& rec, 00123 const String& 00124 ); 00125 00126 TableRecord toRecord(const String& tableName) const; 00127 00128 LCRegion* doToLCRegion ( 00129 const CoordinateSystem& csys, 00130 const IPosition& latticeShape, 00131 const IPosition& pixelAxesMap, 00132 const IPosition& outOrder 00133 ) const; 00134 00135 private: 00136 00137 // WARN do not change the order of the members of this enum 00138 // or you will break backward compatibility with records previously 00139 // saved persistently. Add new types to the end of the enum. 00140 enum SpecialType { 00141 NOT_SPECIAL, 00142 SPHERE, 00143 ELLIPSE_2D 00144 }; 00145 00146 WCEllipsoid(); 00147 00148 Vector<Quantity> _center; 00149 Vector<Quantity> _radii; 00150 00151 IPosition _pixelAxes; 00152 CoordinateSystem _csys; 00153 RegionType::AbsRelType _absRel; 00154 Quantity _theta; 00155 SpecialType _specType; 00156 00157 void _checkPixelAxes() const; 00158 void _checkUnits() const; 00159 00160 void _init(); 00161 00162 }; 00163 00164 } //# NAMESPACE CASA - END 00165 00166 #endif