Line data Source code
1 : //# Copyright (C) 1998,1999,2000
2 : //# Associated Universities, Inc. Washington DC, USA.
3 : //#
4 : //# This library is free software; you can redistribute it and/or modify it
5 : //# under the terms of the GNU Library General Public License as published by
6 : //# the Free Software Foundation; either version 2 of the License, or (at your
7 : //# option) any later version.
8 : //#
9 : //# This library is distributed in the hope that it will be useful, but WITHOUT
10 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 : //# License for more details.
13 : //#
14 : //# You should have received a copy of the GNU Library General Public License
15 : //# along with this library; if not, write to the Free Software Foundation,
16 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
17 : //#
18 : //# Correspondence concerning AIPS++ should be addressed as follows:
19 : //# Internet email: aips2-request@nrao.edu.
20 : //# Postal address: AIPS++ Project Office
21 : //# National Radio Astronomy Observatory
22 : //# 520 Edgemont Road
23 : //# Charlottesville, VA 22903-2475 USA
24 : //#
25 :
26 : #include <imageanalysis/Annotations/AnnVector.h>
27 :
28 : using namespace casacore;
29 : namespace casa {
30 :
31 0 : AnnVector::AnnVector(
32 : const Quantity& xStart,
33 : const Quantity& yStart,
34 : const Quantity& xEnd,
35 : const Quantity& yEnd,
36 : const String& dirRefFrameString,
37 : const CoordinateSystem& csys,
38 : const Quantity& beginFreq,
39 : const Quantity& endFreq,
40 : const String& freqRefFrame,
41 : const String& dopplerString,
42 : const Quantity& restfreq,
43 : const Vector<Stokes::StokesTypes>& stokes
44 0 : ) : AnnotationBase(
45 : VECTOR, dirRefFrameString, csys, beginFreq, endFreq,
46 : freqRefFrame, dopplerString, restfreq, stokes
47 : ),
48 0 : _inputPoints(AnnotationBase::Direction(2)) {
49 0 : _init(xStart, yStart, xEnd, yEnd);
50 0 : }
51 :
52 0 : AnnVector::AnnVector(
53 : const Quantity& xStart,
54 : const Quantity& yStart,
55 : const Quantity& xEnd,
56 : const Quantity& yEnd,
57 : const CoordinateSystem& csys,
58 : const Vector<Stokes::StokesTypes>& stokes
59 0 : ) : AnnotationBase(VECTOR, csys, stokes),
60 0 : _inputPoints(AnnotationBase::Direction(2)) {
61 0 : _init(xStart, yStart, xEnd, yEnd);
62 0 : }
63 :
64 0 : AnnVector& AnnVector::operator= (
65 : const AnnVector& other
66 : ) {
67 0 : if (this == &other) {
68 0 : return *this;
69 : }
70 0 : AnnotationBase::operator=(other);
71 0 : _inputPoints.resize(other._inputPoints.shape());
72 0 : _inputPoints = other._inputPoints;
73 0 : return *this;
74 : }
75 :
76 0 : void AnnVector::_init(
77 : const Quantity& xBegin, const Quantity& yBegin,
78 : const Quantity& xEnd, const Quantity& yEnd
79 : ) {
80 0 : _inputPoints[0].first = xBegin;
81 0 : _inputPoints[0].second = yBegin;
82 0 : _inputPoints[1].first = xEnd;
83 0 : _inputPoints[1].second = yEnd;
84 0 : _checkAndConvertDirections(String(__FUNCTION__), _inputPoints);
85 0 : }
86 :
87 0 : Vector<MDirection> AnnVector::getEndPoints() const {
88 0 : return getConvertedDirections();
89 : }
90 :
91 0 : ostream& AnnVector::print(ostream &os) const {
92 0 : os << "vector [["
93 0 : << _printDirection(_inputPoints[0].first, _inputPoints[0].second)
94 0 : << "], ["
95 0 : << _printDirection(_inputPoints[1].first, _inputPoints[1].second)
96 0 : << "]]";
97 0 : _printPairs(os);
98 0 : return os;
99 : }
100 :
101 : }
102 :
103 :
|