Line data Source code
1 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
3 : //# License for more details.
4 : //#
5 : //# You should have received a copy of the GNU Library General Public License
6 : //# along with this library; if not, write to the Free Software Foundation,
7 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
8 : //#
9 : //# Correspondence concerning AIPS++ should be addressed as follows:
10 : //# Internet email: aips2-request@nrao.edu.
11 : //# Postal address: AIPS++ Project Office
12 : //# National Radio Astronomy Observatory
13 : //# 520 Edgemont Road
14 : //# Charlottesville, VA 22903-2475 USA
15 : //#
16 :
17 : #include <imageanalysis/Annotations/AnnRotBox.h>
18 :
19 : using namespace casacore;
20 : namespace casa {
21 :
22 0 : AnnRotBox::AnnRotBox(
23 : const Quantity& xcenter,
24 : const Quantity& ycenter,
25 : const Quantity& xwidth,
26 : const Quantity& ywidth, const Quantity& positionAngle,
27 : const String& dirRefFrameString,
28 : const CoordinateSystem& csys, const IPosition& imShape,
29 : const Quantity& beginFreq,
30 : const Quantity& endFreq, const String& freqRefFrameString,
31 : const String& dopplerString, const Quantity& restfreq,
32 : const Vector<Stokes::StokesTypes> stokes,
33 : const Bool annotationOnly,
34 : const Bool requireImageRegion
35 0 : ) : AnnPolygon(
36 : ROTATED_BOX, xcenter, ycenter, xwidth, ywidth,
37 : positionAngle, dirRefFrameString, csys, imShape,
38 : beginFreq, endFreq, freqRefFrameString,
39 : dopplerString, restfreq, stokes, annotationOnly,
40 : requireImageRegion
41 0 : ), _inputCenter(AnnotationBase::Direction(1, std::make_pair(xcenter, ycenter))),
42 : _inputWidths(Vector<Quantity>(2)),
43 0 : _positionAngle(positionAngle) {
44 0 : _inputWidths(0) = xwidth;
45 0 : _inputWidths(1) = ywidth;
46 0 : }
47 :
48 0 : AnnRotBox::AnnRotBox(
49 : const Quantity& xcenter,
50 : const Quantity& ycenter,
51 : const Quantity& xwidth,
52 : const Quantity& ywidth, const Quantity& positionAngle,
53 : const CoordinateSystem& csys, const IPosition& imShape,
54 : const Vector<Stokes::StokesTypes>& stokes,
55 : const Bool requireImageRegion
56 0 : ) : AnnPolygon(
57 : ROTATED_BOX, xcenter, ycenter, xwidth, ywidth,
58 : positionAngle, csys, imShape, stokes, requireImageRegion
59 : ),
60 0 : _inputCenter(AnnotationBase::Direction(1, std::make_pair(xcenter, ycenter))),
61 : _inputWidths(Vector<Quantity>(2)),
62 0 : _positionAngle(positionAngle) {
63 0 : _inputWidths(0) = xwidth;
64 0 : _inputWidths(1) = ywidth;
65 0 : }
66 :
67 0 : AnnRotBox& AnnRotBox::operator= (
68 : const AnnRotBox& other
69 : ) {
70 0 : if (this == &other) {
71 0 : return *this;
72 : }
73 0 : AnnPolygon::operator=(other);
74 0 : _inputCenter.resize(other._inputCenter.nelements());
75 0 : _inputCenter = other._inputCenter;
76 0 : _inputWidths.resize(other._inputWidths.nelements());
77 0 : _inputWidths = other._inputWidths;
78 : //_widths.resize(other._widths.nelements());
79 : //_widths = other._widths;
80 0 : _positionAngle = other._positionAngle;
81 : //_corners.resize(other._corners.nelements());
82 : //_corners = other._corners;
83 0 : return *this;
84 : }
85 :
86 0 : ostream& AnnRotBox::print(ostream &os) const {
87 0 : _printPrefix(os);
88 0 : os << "rotbox [["
89 0 : << _printDirection(_inputCenter[0].first, _inputCenter[0].second)
90 0 : << "], ["
91 0 : << _toArcsec(_inputWidths[0]) << ", "
92 0 : << _toArcsec(_inputWidths[1]) << "], "
93 0 : << _toDeg(_positionAngle) << "]";
94 0 : _printPairs(os);
95 0 : return os;
96 : }
97 :
98 : }
|