casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ComponentListWrapper.h
Go to the documentation of this file.
00001 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2000
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef COMPONENTLISTWRAPPER_H_
00027 #define COMPONENTLISTWRAPPER_H_
00028 
00029 #include <casa/BasicSL/String.h>
00030 #include <components/ComponentModels/ComponentList.h>
00031 #include <QTextStream>
00032 namespace casa {
00033 
00034 template <class T> class ImageInterface;
00035 class RegionShape;
00036 class RegionBox;
00037 
00042 class ComponentListWrapper {
00043 public:
00044         ComponentListWrapper();
00045         int getSize() const;
00046         string getRA( int i ) const;
00047         string getDEC( int i ) const;
00048         string getType( int i ) const;
00049         Quantity getMajorAxis( int i ) const;
00050         Quantity getMinorAxis( int i ) const;
00051         Quantity getAngle( int i ) const;
00052         Quantum< Vector<double> > getLatLong( int i ) const;
00053         Quantity getFlux( int i ) const;
00054         //QString getEstimateFixed( int index ) const;
00055         void clear();
00056         void remove( QVector<int> indices );
00057         void fromComponentList( ComponentList list );
00058         bool fromRecord( String& errorMsg, Record& record );
00059         bool toEstimateFile( QTextStream& stream,
00060                         ImageInterface<Float>* image, QString& errorMsg,
00061                         bool screenEstimates = false, RegionBox* screenBox = NULL) const;
00062         QList<RegionShape*> toDrawingDisplay( ImageInterface<Float>* image, const QString& colorName) const;
00063         bool toRegionFile( ImageInterface<float>* image, int channelIndex, const QString& filePath ) const;
00064         virtual ~ComponentListWrapper();
00065 
00066 private:
00067         void toRecord( Record& record, const Quantity& quantity ) const;
00068         double getRAValue( int i, const String& unit ) const;
00069         double getDECValue( int i, const String& unit ) const;
00070         double radiansToDegrees( double value ) const;
00071         double degreesToArcSecs( double Value ) const;
00072         Quantity getAxis( int listIndex, int shapeIndex, bool toArcSecs ) const;
00073         double rotateAngle( double value ) const;
00074         void deconvolve(const ImageInterface<float>* image, int channel,
00075                         Quantity& majorAxis, Quantity& minorAxis, Quantity& positionAngle) const;
00076 
00077         ComponentList skyList;
00078         const String RAD;
00079         const String DEG;
00080         const String ARC_SEC;
00081 };
00082 
00083 } /* namespace casa */
00084 #endif /* COMPONENTLISTWRAPPER_H_ */