casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LCIntersection.h
Go to the documentation of this file.
1 //# LCIntersection.h: Make the intersection of 2 or more 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_LCINTERSECTION_H
29 #define LATTICES_LCINTERSECTION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // Make the intersection of 2 or more 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 LCIntersection class is a specialization of class
53 // <linkto class=LCRegion>LCRegion</linkto>.
54 // It makes it possible to find the intersection of
55 // given regions.
56 // <p>
57 // The center of the intersection must be inside the lattice
58 // </synopsis>
59 
60 // <example>
61 // <srcblock>
62 // </srcblock>
63 // </example>
64 
65 // <todo asof="1997/11/11">
66 // <li> Expand along (slanted) cone lines
67 // </todo>
68 
70 {
71 public:
73 
74  // Construct the intersection of the given regions.
75  LCIntersection (const LCRegion& region1, const LCRegion& region2);
76 
77  // Construct from multiple regions.
78  LCIntersection (Bool takeOver, const LCRegion* region1,
79  const LCRegion* region2 = 0,
80  const LCRegion* region3 = 0,
81  const LCRegion* region4 = 0,
82  const LCRegion* region5 = 0,
83  const LCRegion* region6 = 0,
84  const LCRegion* region7 = 0,
85  const LCRegion* region8 = 0,
86  const LCRegion* region9 = 0,
87  const LCRegion* region10 = 0);
88 
89  // Construct from multiple regions given as a Block.
90  // When <src>takeOver</src> is True, the destructor will delete the
91  // given regions. Otherwise a copy of the regions is made.
93 
94  // Copy constructor (copy semantics).
95  LCIntersection (const LCIntersection& other);
96 
97  virtual ~LCIntersection();
98 
99  // Assignment (copy semantics).
101 
102  // Comparison
103  virtual Bool operator== (const LCRegion& other) const;
104 
105  // Make a copy of the derived object.
106  virtual LCRegion* cloneRegion() const;
107 
108  // Get the class name (to store in the record).
109  static String className();
110 
111  // Get the region type. Returns className()
112  virtual String type() const;
113 
114  // Convert the (derived) object to a record.
115  virtual TableRecord toRecord (const String& tableName) const;
116 
117  // Convert correct object from a record.
118  static LCIntersection* fromRecord (const TableRecord&,
119  const String& tableName);
120 
121 protected:
122  // Construct another LCRegion (for e.g. another lattice) by moving
123  // this one. It recalculates the bounding box and mask.
124  // A positive translation value indicates "to right".
125  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
126  const IPosition& newLatticeShape) const;
127 
128  // Do the actual getting of the mask.
129  virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
130 
131 private:
132  // Make the bounding box and determine the offsets.
133  void defineBox();
134 
135 
136  //# Define the offsets where to start reading from constituting regions.
138 };
139 
140 
141 
142 } //# NAMESPACE CASACORE - END
143 
144 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:118
void defineBox()
Make the bounding box and determine the offsets.
virtual String type() const
Get the region type.
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
Block< IPosition > itsOffsets
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
static String className()
Get the class name (to store in the record).
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a 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
simple 1-D array
Definition: Allocator.h:210
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
LCIntersection & operator=(const LCIntersection &other)
Assignment (copy semantics).
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual Bool operator==(const LCRegion &other) const
Comparison.
Make the intersection of 2 or more regions.
Make the intersection of 2 or more regions.
Definition: LCRegionMulti.h:76
static LCIntersection * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
Abstract base class to define a region of interest in lattice coordinates.
Definition: LCRegion.h:87