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