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