casa
$Rev:20696$
|
00001 //# LCStretch.h: Stretch length 1 axes in an LCRegion along straight lines 00002 //# Copyright (C) 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: LCStretch.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef LATTICES_LCSTRETCH_H 00029 #define LATTICES_LCSTRETCH_H 00030 00031 //# Includes 00032 #include <lattices/Lattices/LCRegionMulti.h> 00033 #include <lattices/Lattices/LCBox.h> 00034 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 // <summary> 00039 // Stretch length 1 axes in an LCRegion along straight lines 00040 // </summary> 00041 00042 // <use visibility=export> 00043 00044 // <reviewed reviewer="" date="" tests=""> 00045 // </reviewed> 00046 00047 // <prerequisite> 00048 // <li> <linkto class=LCRegion>LCRegion</linkto> 00049 // </prerequisite> 00050 00051 // <synopsis> 00052 // The LCStretch class is a specialization of class 00053 // <linkto class=LCRegion>LCRegion</linkto>. 00054 // It makes it possible to stretch a LCRegion along straight lines to 00055 // other dimensions. E.g. a circle in the xy-plane can be stretched to 00056 // a cylinder in the xyz-space. 00057 // It can be used for a lattice of any dimensionality as long as the 00058 // dimensionality of the (hyper-)stretch matches the dimensionality of 00059 // the lattice. 00060 // </synopsis> 00061 00062 // <example> 00063 // <srcblock> 00064 // </srcblock> 00065 // </example> 00066 00067 // <todo asof="1997/11/11"> 00068 // <li> Stretch along (slanted) cone lines 00069 // </todo> 00070 00071 class LCStretch: public LCRegionMulti 00072 { 00073 public: 00074 LCStretch(); 00075 00076 // Stretch the given region along axes as given by <src>stretchAxes</src> 00077 // from the bottom left corner (blc) to the top right corner (trc) 00078 // as given by <src>stretchBox</src>. 00079 // The axes to be stretched need to have length 1 in the original region. 00080 // Every kind of box (absolute, relative, fractional, unspecified) 00081 // can be used to define the stretch blc and trc. 00082 // The dimensionality of the LCStretch region is the same as the 00083 // dimensionality of the original region. 00084 // <br> 00085 // The second version takes over the pointer when the switch is true. 00086 // <group> 00087 LCStretch (const LCRegion& region, 00088 const IPosition& stretchAxes, 00089 const LCBox& stretchBox); 00090 LCStretch (Bool takeOver, 00091 const LCRegion* region, 00092 const IPosition& stretchAxes, 00093 const LCBox& stretchBox); 00094 // </group> 00095 00096 // Copy constructor (copy semantics). 00097 LCStretch (const LCStretch& other); 00098 00099 virtual ~LCStretch(); 00100 00101 // Assignment (copy semantics). 00102 LCStretch& operator= (const LCStretch& other); 00103 00104 // Comparison 00105 virtual Bool operator== (const LCRegion& other) const; 00106 00107 // Make a copy of the derived object. 00108 virtual LCRegion* cloneRegion() const; 00109 00110 // Get the original region. 00111 const LCRegion& region() const; 00112 00113 // Get the stretch axes. 00114 const IPosition& stretchAxes() const; 00115 00116 // Get the stretch box. 00117 const LCBox& stretchBox() const; 00118 00119 // Get the class name (to store in the record). 00120 static String className(); 00121 00122 // Get the region type. Returns the class name. 00123 virtual String type() const; 00124 00125 // Convert the (derived) object to a record. 00126 virtual TableRecord toRecord (const String& tableName) const; 00127 00128 // Convert correct object from a record. 00129 static LCStretch* fromRecord (const TableRecord&, 00130 const String& tableName); 00131 00132 protected: 00133 // Construct another LCRegion (for e.g. another lattice) by moving 00134 // this one. It recalculates the bounding box and mask. 00135 // A positive translation value indicates "to right". 00136 virtual LCRegion* doTranslate (const Vector<Float>& translateVector, 00137 const IPosition& newLatticeShape) const; 00138 00139 // Do the actual getting of the mask. 00140 virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section); 00141 00142 // This function is needed here because the niceCursorShape of the 00143 // contributing region does not make any sense (other dimensionality). 00144 virtual IPosition doNiceCursorShape (uInt maxPixels) const; 00145 00146 private: 00147 // Fill the object. 00148 void fill (const IPosition& stretchAxes, const LCBox& stretchBox); 00149 00150 00151 IPosition itsStretchAxes; 00152 LCBox itsStretchBox; 00153 }; 00154 00155 00156 inline const LCRegion& LCStretch::region() const 00157 { 00158 return *(regions()[0]); 00159 } 00160 inline const IPosition& LCStretch::stretchAxes() const 00161 { 00162 return itsStretchAxes; 00163 } 00164 inline const LCBox& LCStretch::stretchBox() const 00165 { 00166 return itsStretchBox; 00167 } 00168 00169 00170 00171 } //# NAMESPACE CASA - END 00172 00173 #endif