casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RegionInfo.h
Go to the documentation of this file.
1 //# RegionInfo.h: union class for the various types of region information
2 //# Copyright (C) 2011
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 
29 #ifndef REGION_REGIONINFO_H_
30 #define REGION_REGIONINFO_H_
31 
32 #include <list>
33 #include <string>
35 
36 namespace casa {
37 
38 
39  namespace viewer {
40 
41  class Polyline;
42 
43 
44  class RegionInfo {
45  public:
46 
48 
50  //typedef std::pair<casacore::String,String> center_element;
51  //typedef std::list<center_element> center_t;
52  //typedef std::list<std::pair<casacore::String,String> > center_t;
53  typedef stats_t center_t;
54 
56  RegionInfo( const RegionInfo &other ) : stat_list_(other.stat_list_), label_(other.label_), description_(other.description_), type_( other.type_) { }
57  virtual ~RegionInfo( ) { }
58 
59  std::shared_ptr<stats_t> &list( ) {
60  return stat_list_;
61  }
62  const std::string &label( ) const {
63  return label_;
64  }
65  const std::string &description( ) const {
66  return description_;
67  }
68  InfoTypes type( ) const {
69  return type_;
70  }
71 
72  protected:
73  RegionInfo( const std::string &label, const std::string &desc, stats_t *si, InfoTypes t ) : stat_list_(si), label_(label), description_(desc), type_(t) { }
74 
75  private:
76  std::shared_ptr<stats_t> stat_list_;
77  std::string label_;
78  std::string description_;
80  };
81 
82  class MsRegionInfo : public RegionInfo {
83  public:
84  MsRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,MsInfoType) { }
86  };
87 
88  class ImageRegionInfo : public RegionInfo {
89  public:
90  ImageRegionInfo( const std::string &label, const std::string &desc, stats_t *si ) : RegionInfo(label,desc,si,ImageInfoType) { }
92  };
93 
94  class SliceRegionInfo : public RegionInfo {
95  public:
96  SliceRegionInfo( const std::string &label, const std::string &desc, stats_t *si, Polyline* polyline ) :
97  RegionInfo(label,desc,si,SliceInfoType), region(polyline) { }
99  return region;
100  }
102  private:
104  };
105 
106  class PVLineRegionInfo : public RegionInfo {
107  public:
108  PVLineRegionInfo( const std::string &label, const std::string &desc, stats_t *si,
109  const std::vector<std::string> &ps, const std::vector<std::string> &ws,
110  const std::string &pa, const std::string &sep ) :
111  RegionInfo(label,desc,si,PVLineInfoType), pixel_strings_(ps), world_strings_(ws),
112  position_angle(pa), point_separation(sep) { }
114  std::vector<std::string> pixelStrings( ) const {
115  return pixel_strings_;
116  }
117  std::vector<std::string> worldStrings( ) const {
118  return world_strings_;
119  }
120  const std::string &positionAngle( ) const {
121  return position_angle;
122  }
123  const std::string &separation( ) const {
124  return point_separation;
125  }
126  private:
127  std::vector<std::string> pixel_strings_;
128  std::vector<std::string> world_strings_;
129  std::string position_angle;
130  std::string point_separation;
131  };
132 
133 
134  }
135 }
136 
137 #endif
const std::string & separation() const
Definition: RegionInfo.h:123
std::vector< std::string > pixelStrings() const
Definition: RegionInfo.h:114
MsRegionInfo(const std::string &label, const std::string &desc, stats_t *si)
Definition: RegionInfo.h:84
PVLineRegionInfo(const std::string &label, const std::string &desc, stats_t *si, const std::vector< std::string > &ps, const std::vector< std::string > &ws, const std::string &pa, const std::string &sep)
Definition: RegionInfo.h:108
std::vector< std::string > worldStrings() const
Definition: RegionInfo.h:117
casacore::ImageStatistics< casacore::Float >::stat_list stats_t
Definition: RegionInfo.h:49
std::shared_ptr< stats_t > stat_list_
Definition: RegionInfo.h:76
std::shared_ptr< stats_t > & list()
Definition: RegionInfo.h:59
const std::string & label() const
Definition: RegionInfo.h:62
const std::string & description() const
Definition: RegionInfo.h:65
std::list< stat_element > stat_list
std::vector< std::string > world_strings_
Definition: RegionInfo.h:128
LatticeExprNode pa(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds 180/pi*atan2(left,right)/2.
RegionInfo(const RegionInfo &other)
Definition: RegionInfo.h:56
std::vector< std::string > pixel_strings_
Definition: RegionInfo.h:127
InfoTypes type() const
Definition: RegionInfo.h:68
SliceRegionInfo(const std::string &label, const std::string &desc, stats_t *si, Polyline *polyline)
Definition: RegionInfo.h:96
const std::string & positionAngle() const
Definition: RegionInfo.h:120
ImageRegionInfo(const std::string &label, const std::string &desc, stats_t *si)
Definition: RegionInfo.h:90
std::string description_
Definition: RegionInfo.h:78
RegionInfo(const std::string &label, const std::string &desc, stats_t *si, InfoTypes t)
Definition: RegionInfo.h:73
stats_t center_t
typedef std::pair&lt;casacore::String,String&gt; center_element; typedef std::list&lt;center_element&gt; center_t...
Definition: RegionInfo.h:53