casa
$Rev:20696$
|
00001 //# LCExtension.h: Extend an LCRegion along straight lines to other dimensions 00002 //# Copyright (C) 1998,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: LCExtension.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef LATTICES_LCEXTENSION_H 00029 #define LATTICES_LCEXTENSION_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 // Extend an LCRegion along straight lines to other dimensions 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 LCExtension class is a specialization of class 00053 // <linkto class=LCRegion>LCRegion</linkto>. 00054 // It makes it possible to extend a LCRegion along straight lines to 00055 // other dimensions. E.g. a circle in the xy-plane can be extended 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-)extension 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> Extend along (slanted) cone lines 00069 // </todo> 00070 00071 class LCExtension: public LCRegionMulti 00072 { 00073 public: 00074 LCExtension(); 00075 00076 // Extend the given region along axes as given by <src>extendAxes</src> 00077 // from the bottom left corner (blc) to the top right corner (trc) 00078 // as given by <src>extendBox</src>. 00079 // Every kind of box (absolute, relative, fractional, unspecified) 00080 // can be used to define the extension blc and trc. 00081 // The sum of the dimensionality of the region and the extend box 00082 // make up the dimensionality of the LCExtension region. 00083 // Similarly the lattice shapes in region and box are combined. 00084 // <br> 00085 // The second version takes over the pointer when the switch is true. 00086 // <group> 00087 LCExtension (const LCRegion& region, 00088 const IPosition& extendAxes, 00089 const LCBox& extendBox); 00090 LCExtension (Bool takeOver, 00091 const LCRegion* region, 00092 const IPosition& extendAxes, 00093 const LCBox& extendBox); 00094 // </group> 00095 00096 // Copy constructor (copy semantics). 00097 LCExtension (const LCExtension& other); 00098 00099 virtual ~LCExtension(); 00100 00101 // Assignment (copy semantics). 00102 LCExtension& operator= (const LCExtension& 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 extend axes. 00114 const IPosition& extendAxes() const; 00115 00116 // Get the extend box. 00117 const LCBox& extendBox() 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 LCExtension* 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 // <group> 00149 void fillRegionAxes(); 00150 void fill (const IPosition& stretchAxes, const LCBox& stretchBox); 00151 // </group> 00152 00153 IPosition itsExtendAxes; 00154 IPosition itsRegionAxes; 00155 LCBox itsExtendBox; 00156 }; 00157 00158 00159 inline const LCRegion& LCExtension::region() const 00160 { 00161 return *(regions()[0]); 00162 } 00163 inline const IPosition& LCExtension::extendAxes() const 00164 { 00165 return itsExtendAxes; 00166 } 00167 inline const LCBox& LCExtension::extendBox() const 00168 { 00169 return itsExtendBox; 00170 } 00171 00172 00173 00174 } //# NAMESPACE CASA - END 00175 00176 #endif