Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/LCRegionMulti_8h_source.html
Дата изменения: Unknown Дата индексирования: Mon Feb 14 21:28:14 2011 Кодировка: Поисковые слова: molecular cloud |
00001 //# LCRegionMulti.h: Make the intersection of 2 or more regions 00002 //# Copyright (C) 1998,1999 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: LCRegionMulti.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef LATTICES_LCREGIONMULTI_H 00029 #define LATTICES_LCREGIONMULTI_H 00030 00031 //# Includes 00032 #include <lattices/Lattices/LCRegion.h> 00033 #include <casa/Arrays/IPosition.h> 00034 #include <casa/Containers/Block.h> 00035 00036 00037 namespace casa { //# NAMESPACE CASA - BEGIN 00038 00039 // <summary> 00040 // Make the intersection of 2 or more regions. 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 LCRegionMulti 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 // includes the intersection border. 00059 // It can only be used for a lattice of any dimensionality as long as the 00060 // dimensionality of the (hyper-)intersection matches the dimensionality of 00061 // the lattice. 00062 // <p> 00063 // The center of the intersection must be inside the lattice 00064 // </synopsis> 00065 00066 // <example> 00067 // <srcblock> 00068 // </srcblock> 00069 // </example> 00070 00071 // <todo asof="1997/11/11"> 00072 // <li> 00073 // </todo> 00074 00075 class LCRegionMulti: public LCRegion 00076 { 00077 public: 00078 LCRegionMulti(); 00079 00080 // Construct from 2 regions. 00081 LCRegionMulti (const LCRegion& region1, const LCRegion& region2); 00082 00083 // Construct from multiple regions. 00084 LCRegionMulti (Bool takeOver, const LCRegion* region1, 00085 const LCRegion* region2 = 0, 00086 const LCRegion* region3 = 0, 00087 const LCRegion* region4 = 0, 00088 const LCRegion* region5 = 0, 00089 const LCRegion* region6 = 0, 00090 const LCRegion* region7 = 0, 00091 const LCRegion* region8 = 0, 00092 const LCRegion* region9 = 0, 00093 const LCRegion* region10 = 0); 00094 00095 // Construct from multiple regions given as a Block. 00096 // When <src>takeOver</src> is True, the destructor will delete the 00097 // given regions. Otherwise a copy of the regions is made. 00098 LCRegionMulti (Bool takeOver, const PtrBlock<const LCRegion*>& regions); 00099 00100 // Copy constructor (copy semantics). 00101 LCRegionMulti (const LCRegionMulti& other); 00102 00103 virtual ~LCRegionMulti(); 00104 00105 // Assignment (copy semantics). 00106 LCRegionMulti& operator= (const LCRegionMulti& other); 00107 00108 // Comparison 00109 virtual Bool operator== (const LCRegion& other) const; 00110 00111 // Does the region have a mask? 00112 virtual Bool hasMask() const; 00113 00114 protected: 00115 // Store the contributing regions in a record. 00116 TableRecord makeRecord (const String& tableName) const; 00117 00118 // Retrieve the contributing objects from the record. 00119 static void unmakeRecord (PtrBlock<const LCRegion*>&, 00120 const TableRecord&, 00121 const String& tableName); 00122 00123 // Translate all regions. 00124 void multiTranslate (PtrBlock<const LCRegion*>&, 00125 const Vector<Float>& translateVector, 00126 const IPosition& newLatticeShape) const; 00127 00128 // Determine if all regions have mask (used by LCIntersection). 00129 void fillHasMask(); 00130 00131 // Find which area of the section and region are needed. 00132 // False is returned if no part of the region is included in the section. 00133 Bool findAreas (IPosition& bufStart, IPosition& bufEnd, 00134 IPosition& regStart, IPosition& regEnd, 00135 const Slicer& section, uInt regNr) const; 00136 00137 // Get the contributing regions. 00138 const PtrBlock<const LCRegion*>& regions() const; 00139 00140 protected: 00141 // Construct from lattice shape and region pointer, which is 00142 // taken over. 00143 // Primarily meant for LCExtension. 00144 LCRegionMulti (const LCRegion* region, const IPosition& latticeShape); 00145 00146 // Do the actual getting of an array of values. 00147 virtual Bool doGetSlice (Array<Bool>& buffer, const Slicer& section); 00148 00149 // Get the values from the class derived from Multi. 00150 // It is called when there is a mask. Note that it is not sure 00151 // whether the buffer has the correct size. 00152 virtual void multiGetSlice (Array<Bool>& buffer, 00153 const Slicer& section) = 0; 00154 00155 // Get the best cursor shape. 00156 virtual IPosition doNiceCursorShape (uInt maxPixels) const; 00157 00158 private: 00159 // Check if the regions are correct. 00160 // If needed, make a copy of the region objects. 00161 void init (Bool takeOver); 00162 00163 //# >=0 means this region has a mask. 00164 //# Its value gives the region with the biggest mask. 00165 Int itsHasMask; 00166 PtrBlock<const LCRegion*> itsRegions; 00167 }; 00168 00169 00170 inline const PtrBlock<const LCRegion*>& LCRegionMulti::regions() const 00171 { 00172 return itsRegions; 00173 } 00174 00175 00176 00177 } //# NAMESPACE CASA - END 00178 00179 #endif