00001 //# LCIntersection.h: Make the intersection of 2 or more regions 00002 //# Copyright (C) 1998 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_LCINTERSECTION_H 00029 #define LATTICES_LCINTERSECTION_H 00030 00031 //# Includes 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/lattices/LRegions/LCRegionMulti.h> 00034 00035 00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00037 00038 // <summary> 00039 // Make the intersection of 2 or more regions. 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 LCIntersection class is a specialization of class 00053 // <linkto class=LCRegion>LCRegion</linkto>. 00054 // It makes it possible to find the intersection of 00055 // given regions. 00056 // <p> 00057 // The center of the intersection must be inside the lattice 00058 // </synopsis> 00059 00060 // <example> 00061 // <srcblock> 00062 // </srcblock> 00063 // </example> 00064 00065 // <todo asof="1997/11/11"> 00066 // <li> Expand along (slanted) cone lines 00067 // </todo> 00068 00069 class LCIntersection: public LCRegionMulti 00070 { 00071 public: 00072 LCIntersection(); 00073 00074 // Construct the intersection of the given regions. 00075 LCIntersection (const LCRegion& region1, const LCRegion& region2); 00076 00077 // Construct from multiple regions. 00078 LCIntersection (Bool takeOver, const LCRegion* region1, 00079 const LCRegion* region2 = 0, 00080 const LCRegion* region3 = 0, 00081 const LCRegion* region4 = 0, 00082 const LCRegion* region5 = 0, 00083 const LCRegion* region6 = 0, 00084 const LCRegion* region7 = 0, 00085 const LCRegion* region8 = 0, 00086 const LCRegion* region9 = 0, 00087 const LCRegion* region10 = 0); 00088 00089 // Construct from multiple regions given as a Block. 00090 // When <src>takeOver</src> is True, the destructor will delete the 00091 // given regions. Otherwise a copy of the regions is made. 00092 LCIntersection (Bool takeOver, const PtrBlock<const LCRegion*>& regions); 00093 00094 // Copy constructor (copy semantics). 00095 LCIntersection (const LCIntersection& other); 00096 00097 virtual ~LCIntersection(); 00098 00099 // Assignment (copy semantics). 00100 LCIntersection& operator= (const LCIntersection& other); 00101 00102 // Comparison 00103 virtual Bool operator== (const LCRegion& other) const; 00104 00105 // Make a copy of the derived object. 00106 virtual LCRegion* cloneRegion() const; 00107 00108 // Get the class name (to store in the record). 00109 static String className(); 00110 00111 // Get the region type. Returns className() 00112 virtual String type() const; 00113 00114 // Convert the (derived) object to a record. 00115 virtual TableRecord toRecord (const String& tableName) const; 00116 00117 // Convert correct object from a record. 00118 static LCIntersection* fromRecord (const TableRecord&, 00119 const String& tableName); 00120 00121 protected: 00122 // Construct another LCRegion (for e.g. another lattice) by moving 00123 // this one. It recalculates the bounding box and mask. 00124 // A positive translation value indicates "to right". 00125 virtual LCRegion* doTranslate (const Vector<Float>& translateVector, 00126 const IPosition& newLatticeShape) const; 00127 00128 // Do the actual getting of the mask. 00129 virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section); 00130 00131 private: 00132 // Make the bounding box and determine the offsets. 00133 void defineBox(); 00134 00135 00136 //# Define the offsets where to start reading from constituting regions. 00137 Block<IPosition> itsOffsets; 00138 }; 00139 00140 00141 00142 } //# NAMESPACE CASACORE - END 00143 00144 #endif