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