Commits
Ville Suoranta authored 2abacbf2fba Merge
1 - | //# ComponentShape.h: Base class for component shapes |
2 1 | //# Copyright (C) 1998,1999,2000,2001 |
3 2 | //# Associated Universities, Inc. Washington DC, USA. |
4 3 | //# |
5 4 | //# This library is free software; you can redistribute it and/or modify it |
6 5 | //# under the terms of the GNU Library General Public License as published by |
7 6 | //# the Free Software Foundation; either version 2 of the License, or (at your |
8 7 | //# option) any later version. |
9 8 | //# |
10 9 | //# This library is distributed in the hope that it will be useful, but WITHOUT |
11 10 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
16 15 | //# along with this library; if not, write to the Free Software Foundation, |
17 16 | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. |
18 17 | //# |
19 18 | //# Correspondence concerning AIPS++ should be addressed as follows: |
20 19 | //# Internet email: aips2-request@nrao.edu. |
21 20 | //# Postal address: AIPS++ Project Office |
22 21 | //# National Radio Astronomy Observatory |
23 22 | //# 520 Edgemont Road |
24 23 | //# Charlottesville, VA 22903-2475 USA |
25 24 | //# |
26 - | //# $Id: ComponentShape.h 20739 2009-09-29 01:15:15Z Malte.Marquarding $ |
27 25 | |
28 26 | |
29 27 | |
30 28 | |
31 29 | |
32 30 | |
33 31 | |
34 32 | |
35 33 | |
36 34 | |
43 41 | // <reviewed reviewer="" date="yyyy/mm/dd"> |
44 42 | // </reviewed> |
45 43 | |
46 44 | // <synopsis> |
47 45 | // Base class for annotations |
48 46 | |
49 47 | // In order to minimize maintainability, many parameters are not |
50 48 | // set in the constructor but can be set by mutator methods. |
51 49 | // |
52 50 | // casacore::Input directions will be converted to the reference frame of the |
53 - | // input coordinate system upon construction if necessary. |
51 + | // input coordinate system upon construction if necessary. The coordinate |
52 + | // system specified in the constructor should be that associated with the |
53 + | // image to which the region/annotation is being applied. |
54 54 | // </synopsis> |
55 55 | |
56 56 | class AnnotationBase { |
57 57 | public: |
58 58 | |
59 59 | using RGB = std::vector<float>; |
60 60 | |
61 61 | // The pairs have longitude as the first member and latitude as the second |
62 62 | using Direction = casacore::Vector<std::pair<casacore::Quantity,casacore::Quantity> >; |
63 63 | |
277 277 | ); |
278 278 | |
279 279 | static std::ostream& print( |
280 280 | std::ostream& os, const Direction d |
281 281 | ); |
282 282 | |
283 283 | // Get a list of the user-friendly color names supported |
284 284 | static std::list<std::string> colorChoices(); |
285 285 | |
286 286 | // get the coordinate system associated with this object. |
287 - | // This is the same coordinates system used to construct the object. |
288 - | |
287 + | // This is the same coordinate system used to construct the object. |
289 288 | inline const casacore::CoordinateSystem& getCsys() const { |
290 289 | return _csys; |
291 290 | } |
292 291 | |
293 292 | // DEPRECATED Please use getConvertedDirections() |
294 293 | // the pair elements have longitude as the first member and latitude as the second. |
295 294 | // FIXME make this return of vector of MVDirections |
296 295 | // Returns the same angles as getConvertedDirections() |
297 296 | Direction getDirections() const; |
298 297 | |
317 316 | const casacore::String& dopplerString, |
318 317 | const casacore::Quantity& restfreq |
319 318 | ); |
320 319 | |
321 320 | // same as getDirections, only returns proper MDirections |
322 321 | inline const casacore::Vector<casacore::MDirection>& getConvertedDirections() const { |
323 322 | return _convertedDirections; |
324 323 | } |
325 324 | |
326 325 | protected: |
327 - | |
326 + | // <group> |
328 327 | // if <src>freqRefFrame</src> or <src>dopplerString</src> are empty, |
329 328 | // the values from the spectral coordinate of csys will be used, if one |
330 - | // exists. if restfreq=casacore::Quantity(0, "Hz") -> use the rest frequency associated with the coordinate system |
329 + | // exists. if restfreq=casacore::Quantity(0, "Hz") -> use the rest frequency |
330 + | // associated with the coordinate system. |
331 + | // The provided coordinate system should be that of the image to which |
332 + | // the region/annotation is being applied. |
331 333 | AnnotationBase( |
332 334 | const Type type, const casacore::String& dirRefFrameString, |
333 335 | const casacore::CoordinateSystem& csys, const casacore::Quantity& beginFreq, |
334 336 | const casacore::Quantity& endFreq, |
335 337 | const casacore::String& freqRefFrame, |
336 338 | const casacore::String& dopplerString, |
337 339 | const casacore::Quantity& restfreq, |
338 340 | const casacore::Vector<casacore::Stokes::StokesTypes>& stokes |
339 341 | ); |
340 342 | |
341 343 | // use only if the frame of the input directions is the |
342 344 | // same as the frame of the coordinate system. All frequencies |
343 345 | // are used. |
344 346 | AnnotationBase( |
345 347 | const Type type, const casacore::CoordinateSystem& csys, |
346 348 | const casacore::Vector<casacore::Stokes::StokesTypes>& stokes |
347 349 | ); |
348 - | |
349 - | // the implicitly defined copy constructor is fine |
350 - | // AnnotationBase(const AnnotationBase& other); |
350 + | // <group> |
351 351 | |
352 352 | // assignment operator |
353 353 | AnnotationBase& operator= (const AnnotationBase& other); |
354 354 | |
355 355 | static void _checkMixed( |
356 356 | const casacore::String& origin, |
357 357 | const Direction& dirs |
358 358 | ); |
359 359 | |
360 360 | casacore::MDirection _directionFromQuantities( |
361 361 | const casacore::Quantity& q0, const casacore::Quantity& q1 |
362 362 | ); |
363 363 | |
364 364 | void _checkAndConvertDirections( |
365 365 | const casacore::String& origin, |
366 366 | const Direction& dirs |
367 367 | ); |
368 368 | |
369 369 | virtual void _printPairs(std::ostream& os) const; |
370 370 | |
371 - | |
372 - | |
373 371 | inline const casacore::IPosition& _getDirectionAxes() const { |
374 372 | return _directionAxes; |
375 373 | } |
376 374 | |
377 375 | // direction to string, precision of 0.1 mas |
378 376 | // ra and dec in sexigesimal format, non-equatorial coords in degrees |
379 377 | casacore::String _printDirection( |
380 378 | const casacore::Quantity& longitude, const casacore::Quantity& latitude |
381 379 | ) const; |
382 380 | |