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 
00036 namespace casa {
00037 
00038 
00039         namespace viewer {
00040 
00041                 class Polyline;
00042 
00043 
00044                 class RegionInfo {
00045                 public:
00046 
00047                         enum InfoTypes { MsInfoType, ImageInfoType, SliceInfoType, PVLineInfoType, InvalidInfoType };
00048 
00049                         typedef ImageStatistics<Float>::stat_list stats_t;
00050                         //typedef std::pair<String,String> center_element;
00051                         //typedef std::list<center_element> center_t;
00052                         //typedef std::list<std::pair<String,String> > center_t;
00053                         typedef stats_t center_t;
00054 
00055                         RegionInfo( ) : stat_list_( ), type_(InvalidInfoType) { }
00056                         RegionInfo( const RegionInfo &other ) : stat_list_(other.stat_list_), label_(other.label_), description_(other.description_), type_( other.type_) { }
00057                         virtual ~RegionInfo( ) { }
00058 
00059                         SHARED_PTR<stats_t> &list( ) {
00060                                 return stat_list_;
00061                         }
00062                         const std::string &label( ) const {
00063                                 return label_;
00064                         }
00065                         const std::string &description( ) const {
00066                                 return description_;
00067                         }
00068                         InfoTypes type( ) const {
00069                                 return type_;
00070                         }
00071 
00072                 protected:
00073                         RegionInfo( const std::string &label, const std::string &desc, stats_t *si, InfoTypes t ) : stat_list_(si), label_(label), description_(desc), type_(t) { }
00074 
00075                 private:
00076                         SHARED_PTR<stats_t>  stat_list_;
00077                         std::string label_;
00078                         std::string description_;
00079                         InfoTypes type_;
00080                 };
00081 
00082                 class MsRegionInfo : public RegionInfo {
00083                 public:
00084                         MsRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,MsInfoType) { }
00085                         ~MsRegionInfo( ) { }
00086                 };
00087 
00088                 class ImageRegionInfo : public RegionInfo {
00089                 public:
00090                         ImageRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,ImageInfoType) { }
00091                         ~ImageRegionInfo( ) { }
00092                 };
00093 
00094                 class SliceRegionInfo : public RegionInfo {
00095                 public:
00096                         SliceRegionInfo( const std::string &label, const std::string &desc, stats_t *si, Polyline* polyline ) :
00097                                 RegionInfo(label,desc,si,SliceInfoType), region(polyline) { }
00098                         Polyline* getRegion(){
00099                                 return region;
00100                         }
00101                         ~SliceRegionInfo( ) { }
00102                 private:
00103                         Polyline* region;
00104                 };
00105 
00106                 class PVLineRegionInfo : public RegionInfo {
00107                 public:
00108                         PVLineRegionInfo( const std::string &label, const std::string &desc, stats_t *si,
00109                                           const std::vector<std::string> &ps, const std::vector<std::string> &ws,
00110                                           const std::string &pa, const std::string &sep ) :
00111                                 RegionInfo(label,desc,si,PVLineInfoType), pixel_strings_(ps), world_strings_(ws),
00112                                 position_angle(pa), point_separation(sep) { }
00113                         ~PVLineRegionInfo( ) { }
00114                         std::vector<std::string> pixelStrings( ) const {
00115                                 return pixel_strings_;
00116                         }
00117                         std::vector<std::string> worldStrings( ) const {
00118                                 return world_strings_;
00119                         }
00120                         const std::string &positionAngle( ) const {
00121                                 return position_angle;
00122                         }
00123                         const std::string &separation( ) const {
00124                                 return point_separation;
00125                         }
00126                 private:
00127                         std::vector<std::string> pixel_strings_;
00128                         std::vector<std::string> world_strings_;
00129                         std::string position_angle;
00130                         std::string point_separation;
00131                 };
00132 
00133 
00134         }
00135 }
00136 
00137 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1