casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LCDifference.h
Go to the documentation of this file.
1 //# LCDifference.h: Make the difference of 2 regions
2 //# Copyright (C) 1998
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef LATTICES_LCDIFFERENCE_H
29 #define LATTICES_LCDIFFERENCE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // Make the difference of 2 regions.
40 // </summary>
41 
42 // <use visibility=export>
43 
44 // <reviewed reviewer="" date="" tests="">
45 // </reviewed>
46 
47 // <prerequisite>
48 // <li> <linkto class=LCRegion>LCRegion</linkto>
49 // </prerequisite>
50 
51 // <synopsis>
52 // The LCDifference class is a specialization of class
53 // <linkto class=LCRegion>LCRegion</linkto>.
54 // It makes it possible to "subtract" one region from
55 // another. For example, imagine an overlapping box
56 // and circle. The box - circle is the box with the
57 // chunk taken out of it where the circle overlaps.
58 // The circle - box is the circle with the chunk
59 // taken out of it where the box overlaps.
60 // <p>
61 // The center of the difference must be inside the lattice
62 // </synopsis>
63 
64 // <example>
65 // <srcblock>
66 // </srcblock>
67 // </example>
68 
69 // <todo asof="1997/11/11">
70 // </todo>
71 
73 {
74 public:
75  LCDifference();
76 
77  // Construct the difference region1 - region2.
78  LCDifference (const LCRegion& region1, const LCRegion& region2);
79 
80  // Construct from multiple regions given as a Block.
81  // When <src>takeOver</src> is True, the destructor will delete the
82  // given regions. Otherwise a copy of the regions is made.
84 
85  // Copy constructor (copy semantics).
86  LCDifference (const LCDifference& other);
87 
88  virtual ~LCDifference();
89 
90  // Assignment (copy semantics).
91  LCDifference& operator= (const LCDifference& other);
92 
93  // Comparison
94  virtual Bool operator== (const LCRegion& other) const;
95 
96  // Make a copy of the derived object.
97  virtual LCRegion* cloneRegion() const;
98 
99  // Get the class name (to store in the record).
100  static String className();
101 
102  // Get the region type. Returns className()
103  virtual String type() const;
104 
105  // Convert the (derived) object to a record.
106  virtual TableRecord toRecord (const String& tableName) const;
107 
108  // Convert correct object from a record.
109  static LCDifference* fromRecord (const TableRecord&,
110  const String& tableName);
111 
112 protected:
113  // Construct another LCRegion (for e.g. another lattice) by moving
114  // this one. It recalculates the bounding box and mask.
115  // A positive translation value indicates "to right".
116  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
117  const IPosition& newLatticeShape) const;
118 
119  // Do the actual getting of the mask.
120  virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
121 
122 private:
123  // Make the bounding box and determine the offsets.
124  void defineBox();
125 };
126 
127 
128 
129 } //# NAMESPACE CASACORE - END
130 
131 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
Make the difference of 2 regions.
Definition: LCDifference.h:72
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
virtual String type() const
Get the region type.
static LCDifference * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
LCDifference & operator=(const LCDifference &other)
Assignment (copy semantics).
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
virtual Bool operator==(const LCRegion &other) const
Comparison.
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
static String className()
Get the class name (to store in the record).
A drop-in replacement for Block&lt;T*&gt;.
Definition: Block.h:814
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:185
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:288
String: the storage and methods of handling collections of characters.
Definition: String.h:225
Make the intersection of 2 or more regions.
Definition: LCRegionMulti.h:76
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87
void defineBox()
Make the bounding box and determine the offsets.