casacore
LCUnion.h
Go to the documentation of this file.
1 //# LCUnion.h: Make the union 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_LCUNION_H
29 #define LATTICES_LCUNION_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/lattices/LRegions/LCRegionMulti.h>
34 
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 // <summary>
39 // Make the union 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 LCUnion class is a specialization of class
53 // <linkto class=LCRegion>LCRegion</linkto>.
54 // It makes it possible to extend a LCRegion along straight lines to
55 // other dimensions. E.g. a circle in the xy-plane can be extended to
56 // a cylinder in the xyz-space.
57 // includes the union border.
58 // It can only be used for a lattice of any dimensionality as long as the
59 // dimensionality of the (hyper-)union matches the dimensionality of
60 // the lattice.
61 // <p>
62 // The center of the union must be inside the lattice
63 // </synopsis>
64 
65 // <example>
66 // <srcblock>
67 // </srcblock>
68 // </example>
69 
70 // <todo asof="1997/11/11">
71 // <li> Expand along (slanted) cone lines
72 // </todo>
73 
74 class LCUnion: public LCRegionMulti
75 {
76 public:
78 
79  // Construct the union of the given regions.
80  LCUnion (const LCRegion& region1, const LCRegion& region2);
81 
82  // Construct from multiple regions.
83  // When <src>takeOver</src> is True, the destructor will delete the
84  // given regions. Otherwise a copy of the regions is made.
85  // <group>
86  LCUnion (Bool takeOver, const LCRegion* region1,
87  const LCRegion* region2 = 0,
88  const LCRegion* region3 = 0,
89  const LCRegion* region4 = 0,
90  const LCRegion* region5 = 0,
91  const LCRegion* region6 = 0,
92  const LCRegion* region7 = 0,
93  const LCRegion* region8 = 0,
94  const LCRegion* region9 = 0,
95  const LCRegion* region10 = 0);
97  // </group>
98 
99  // Copy constructor (copy semantics).
100  LCUnion (const LCUnion& other);
101 
102  virtual ~LCUnion();
103 
104  // Assignment (copy semantics).
105  LCUnion& operator= (const LCUnion& other);
106 
107  // Comparison
108  virtual Bool operator== (const LCRegion& other) const;
109 
110  // Make a copy of the derived object.
111  virtual LCRegion* cloneRegion() const;
112 
113  // Get the class name (to store in the record).
114  static String className();
115 
116  // Get the region type. Returns className()
117  virtual String type() const;
118 
119  // Convert the (derived) object to a record.
120  virtual TableRecord toRecord (const String& tableName) const;
121 
122  // Convert correct object from a record.
123  static LCUnion* fromRecord (const TableRecord&,
124  const String& tableName);
125 
126 protected:
127  // Construct another LCRegion (for e.g. another lattice) by moving
128  // this one. It recalculates the bounding box and mask.
129  // A positive translation value indicates "to right".
130  virtual LCRegion* doTranslate (const Vector<Float>& translateVector,
131  const IPosition& newLatticeShape) const;
132 
133  // Do the actual getting of the mask.
134  virtual void multiGetSlice (Array<Bool>& buffer, const Slicer& section);
135 
136 private:
137  // Make the bounding box and determine the offsets.
138  void defineBox();
139 };
140 
141 
142 
143 } //# NAMESPACE CASACORE - END
144 
145 #endif
const PtrBlock< const LCRegion * > & regions() const
Get the contributing regions.
virtual ~LCUnion()
virtual Bool operator==(const LCRegion &other) const
Comparison.
LCUnion(const LCUnion &other)
Copy constructor (copy semantics).
virtual String type() const
Get the region type.
static String className()
Get the class name (to store in the record).
virtual LCRegion * doTranslate(const Vector< Float > &translateVector, const IPosition &newLatticeShape) const
Construct another LCRegion (for e.g.
LCUnion(Bool takeOver, const PtrBlock< const LCRegion * > &regions)
virtual TableRecord toRecord(const String &tableName) const
Convert the (derived) object to a record.
virtual void multiGetSlice(Array< Bool > &buffer, const Slicer &section)
Do the actual getting of the mask.
LCUnion(const LCRegion &region1, const LCRegion &region2)
Construct the union of the given regions.
LCUnion(Bool takeOver, const LCRegion *region1, const LCRegion *region2=0, const LCRegion *region3=0, const LCRegion *region4=0, const LCRegion *region5=0, const LCRegion *region6=0, const LCRegion *region7=0, const LCRegion *region8=0, const LCRegion *region9=0, const LCRegion *region10=0)
Construct from multiple regions.
static LCUnion * fromRecord(const TableRecord &, const String &tableName)
Convert correct object from a record.
virtual LCRegion * cloneRegion() const
Make a copy of the derived object.
LCUnion & operator=(const LCUnion &other)
Assignment (copy semantics).
void defineBox()
Make the bounding box and determine the offsets.
A drop-in replacement for Block<T*>.
Definition: Block.h:814
String: the storage and methods of handling collections of characters.
Definition: String.h:225
this file contains all the compiler specific defines
Definition: mainpage.dox:28
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42