casa
$Rev:20696$
|
00001 //# LCDifference.h: Make the difference of 2 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: LCDifference.h 18093 2004-11-30 17:51:10Z ddebonis $ 00027 00028 #ifndef LATTICES_LCDIFFERENCE_H 00029 #define LATTICES_LCDIFFERENCE_H 00030 00031 //# Includes 00032 #include <lattices/Lattices/LCRegionMulti.h> 00033 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> 00038 // Make the difference of 2 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 LCDifference class is a specialization of class 00052 // <linkto class=LCRegion>LCRegion</linkto>. 00053 // It makes it possible to "subtract" one region from 00054 // another. For example, imagine an overlapping box 00055 // and circle. The box - circle is the box with the 00056 // chunk taken out of it where the circle overlaps. 00057 // The circle - box is the circle with the chunk 00058 // taken out of it where the box overlaps. 00059 // <p> 00060 // The center of the difference must be inside the lattice 00061 // </synopsis> 00062 00063 // <example> 00064 // <srcblock> 00065 // </srcblock> 00066 // </example> 00067 00068 // <todo asof="1997/11/11"> 00069 // </todo> 00070 00071 class LCDifference: public LCRegionMulti 00072 { 00073 public: 00074 LCDifference(); 00075 00076 // Construct the difference region1 - region2. 00077 LCDifference (const LCRegion& region1, const LCRegion& region2); 00078 00079 // Construct from multiple regions given as a Block. 00080 // When <src>takeOver</src> is True, the destructor will delete the 00081 // given regions. Otherwise a copy of the regions is made. 00082 LCDifference (Bool takeOver, const PtrBlock<const LCRegion*>& regions); 00083 00084 // Copy constructor (copy semantics). 00085 LCDifference (const LCDifference& other); 00086 00087 virtual ~LCDifference(); 00088 00089 // Assignment (copy semantics). 00090 LCDifference& operator= (const LCDifference& other); 00091 00092 // Comparison 00093 virtual Bool operator== (const LCRegion& other) const; 00094 00095 // Make a copy of the derived object. 00096 virtual LCRegion* cloneRegion() const; 00097 00098 // Get the class name (to store in the record). 00099 static String className(); 00100 00101 // Get the region type. Returns className() 00102 virtual String type() const; 00103 00104 // Convert the (derived) object to a record. 00105 virtual TableRecord toRecord (const String& tableName) const; 00106 00107 // Convert correct object from a record. 00108 static LCDifference* fromRecord (const TableRecord&, 00109 const String& tableName); 00110 00111 protected: 00112 // Construct another LCRegion (for e.g. another lattice) by moving 00113 // this one. It recalculates the bounding box and mask. 00114 // A positive translation value indicates "to right". 00115 virtual LCRegion* doTranslate (const Vector<Float>& translateVector, 00116 const IPosition& newLatticeShape) const; 00117 00118 // Do the actual getting of the mask. 00119 virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section); 00120 00121 private: 00122 // Make the bounding box and determine the offsets. 00123 void defineBox(); 00124 }; 00125 00126 00127 00128 } //# NAMESPACE CASA - END 00129 00130 #endif