casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RegionInfo.h
Go to the documentation of this file.
00001 //# RegionInfo.h: union class for the various types of region information
00002 //# Copyright (C) 2011
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 
00029 #ifndef REGION_REGIONINFO_H_
00030 #define REGION_REGIONINFO_H_
00031 
00032 #include <list>
00033 #include <string>
00034 #include <images/Images/ImageStatistics.h>
00035 #include <tr1/memory>
00036 
00037 namespace casa {
00038 
00039     namespace viewer {
00040 
00041         class RegionInfo {
00042             public:
00043 
00044                 enum InfoTypes { MsInfoType, ImageInfoType, SliceInfoType, PVLineInfoType, InvalidInfoType };
00045 
00046                 typedef ImageStatistics<Float>::stat_list stats_t;
00047                 //typedef std::pair<String,String> center_element;
00048                 //typedef std::list<center_element> center_t;
00049                 //typedef std::list<std::pair<String,String> > center_t;
00050                 typedef stats_t center_t;
00051 
00052                 RegionInfo( ) : stat_list_( ), type_(InvalidInfoType) { }
00053                 RegionInfo( const RegionInfo &other ) : stat_list_(other.stat_list_), label_(other.label_), description_(other.description_), type_( other.type_) { }
00054                 virtual ~RegionInfo( ) { }
00055 
00056                 std::tr1::shared_ptr<stats_t> &list( ) { return stat_list_; }
00057                 const std::string &label( ) const { return label_; }
00058                 const std::string &description( ) const { return description_; }
00059                 InfoTypes type( ) const { return type_; }
00060 
00061             protected:
00062             RegionInfo( const std::string &label, const std::string &desc, stats_t *si, InfoTypes t ) : stat_list_(si), label_(label), description_(desc), type_(t) { }
00063 
00064             private:
00065                 std::tr1::shared_ptr<stats_t>  stat_list_;
00066                 std::string label_;
00067                 std::string description_;
00068                 InfoTypes type_;
00069         };
00070 
00071         class MsRegionInfo : public RegionInfo {
00072             public:
00073                 MsRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,MsInfoType) { }
00074                 ~MsRegionInfo( ) { }
00075         };
00076 
00077         class ImageRegionInfo : public RegionInfo {
00078             public:
00079                 ImageRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,ImageInfoType) { }
00080                 ~ImageRegionInfo( ) { }
00081         };
00082         
00083         class SliceRegionInfo : public RegionInfo {
00084                 public:
00085                         SliceRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,SliceInfoType) { }
00086                         ~SliceRegionInfo( ) { }
00087         };
00088 
00089         class PVLineRegionInfo : public RegionInfo {
00090                 public:
00091                         PVLineRegionInfo( const std::string &label, const std::string &desc, stats_t *si,
00092                                                           const std::vector<std::string> &ps, const std::vector<std::string> &ws,
00093                                                           const std::string &pa, const std::string &sep ) :
00094                                         RegionInfo(label,desc,si,PVLineInfoType), pixel_strings_(ps), world_strings_(ws),
00095                                         position_angle(pa), point_separation(sep) { }
00096                         ~PVLineRegionInfo( ) { }
00097                         std::vector<std::string> pixelStrings( ) const { return pixel_strings_; }
00098                         std::vector<std::string> worldStrings( ) const { return world_strings_; }
00099                         const std::string &positionAngle( ) const { return position_angle; }
00100                         const std::string &separation( ) const { return point_separation; }
00101                 private:
00102                         std::vector<std::string> pixel_strings_;
00103                         std::vector<std::string> world_strings_;
00104                         std::string position_angle;
00105                         std::string point_separation;
00106         };
00107 
00108 
00109     }
00110 }
00111 
00112 #endif