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