casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Projection.h
Go to the documentation of this file.
1 //# Projection.h: Geometric parameters needed for a sky projection to a plane
2 //# Copyright (C) 1997,1998,1999,2000,2001,2003
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 //#
27 //# $Id$
28 
29 #ifndef COORDINATES_PROJECTION_H
30 #define COORDINATES_PROJECTION_H
31 
32 #include <casacore/casa/aips.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 
38 // <summary>
39 // Geometric parameters needed for a sky projection to a plane
40 // </summary>
41 
42 // <use visibility=export>
43 
44 // <reviewed reviewer="Peter Barnes" date="1999/12/24" tests="tProjection">
45 // </reviewed>
46 //
47 // <prerequisite>
48 // <li> Knowledge of astronomical coordinate conversions in general. Probably the
49 // best documents are the papers by Mark Calabretta and Eric Greisen.
50 // The initial draft from 1996 can be found at
51 // http://www.atnf.csiro.au/~mcalabre. It is this draft that the
52 // Coordinate classes are based upon. Since then, this paper has evolved
53 // into three which can be found at the above address, and will be published in the
54 // Astronomy and Astrophysics Supplement Series (probably in 2000).
55 // The design has changed since the initial draft. When these papers
56 // are finalized, and the IAU has ratified the new standards, WCSLIB
57 // (Mark Calabretta's implementation of these conventions) will be
58 // revised for the new designs. At that time, the Coordinate classes
59 // may also be revised.
60 // </prerequisite>
61 //
62 // <synopsis>
63 // This class is used to hold:
64 // <ol>
65 // <li> The type of the projection (e.g. SIN); and
66 // <li> The parameters of the projection, if any. These parameters are described
67 // by Calabretta and Greisen (called PROJP) in the 1996 draft.
68 // In the recent versions, this paper has split into three, and the
69 // projection parameters have been reworked into the PV matrix.
70 // However, these have not yet been implemented in WCSLIB so we
71 // stick with the old ones for now.
72 // </ol>
73 // </synopsis>
74 //
75 // <example>
76 // <srcblock>
77 // Projection proj(Projection::CAR);
78 // cerr << proj.parameters() << endl;
79 // </srcblock>
80 // This projection requires no parameters so the printed parameter
81 // vector would be of zero length.
82 // </example>
83 //
84 // <thrown>
85 // <li> AipsError
86 // </thrown>
87 //
88 // <todo asof="2000/01/01">
89 // <li> Worry about projection parameters which are unit dependent (i.e.
90 // radians vs. degrees).
91 // <li> LONGPOLE should probably go in here.
92 // </todo>
93 //
94 
96 {
97 public:
98  // Hold all the known types of celestial projections.
99  enum Type {
100  // Zenithal/Azimuthal perspective.
102  // Slant zenithal perspective, new
104  // Gnomonic.
105  TAN,
106  // Orthographics/synthesis.
107  SIN,
108  // Stereographic.
109  STG,
110  // zenith/azimuthal equidistant.
111  ARC,
112  // zenithal/azimuthal polynomial.
113  ZPN,
114  // zenithal/azimuthal equal area.
115  ZEA,
116  // Airy.
117  AIR,
118  // Cylindrical perspective.
119  CYP,
120  // Plate carree
121  CAR,
122  // Mercator.
123  MER,
124  // Cylindrical equal area.
126  // Conic perspective.
127  COP,
128  // Conic equidistant.
129  COD,
130  // Conic equal area.
131  COE,
132  // Conic orthomorphic.
133  COO,
134  // Bonne.
135  BON,
136  // Polyconic.
137  PCO,
138  // Sanson-Flamsteed (global sinusoidal).
139  // The old GLS projection is now SFL. The 'GLS'
140  // string will be converted to 'SFL'
141  SFL,
142  // Parabolic.
143  PAR,
144  // Hammer-Aitoff.
145  AIT,
146  // Mollweide.
147  MOL,
148  // COBE quadrilateralized spherical cube.
149  CSC,
150  // Quadrilateralized spherical cube.
152  // Tangential spherical cube.
154  // HEALPix grid
155  HPX,
156  // N_PROJ gives the number of supported projections - it shouldn't be used
157  // as a projection
159 
160  // Construct a projection which needs no parameters. SIN is unique in that
161  // it can be created with 0 or 2 parameters.
163 
164  // Construct a projection from FITS CTYPE keywords
165  Projection(const String& ctypeLin, const String& ctypeLat,
166  const Vector<Double>& parameters);
167 
168  // Construct a projection which needs parameters. The parameter vector must be
169  // the length of the required number of parameters.
171 
172  // Copy constructor (copy semantics).
173  Projection(const Projection &other);
174 
175  // Assignment (copy semantics)
176  Projection &operator=(const Projection &other);
177 
178  // Destructor
179  ~Projection();
180 
181  // What is the Type of this projection?
182  Projection::Type type() const;
183 
184  // What is the type of this projection as a String (e.g. "SIN").
185  // <group>
186  String name() const;
187  static String name(Projection::Type proj);
188  // </group>
189 
190  // Turn a projection type name into a Type.
191  // Returns N_PROJ if the projection is not known.
192  static Projection::Type type(const String &name);
193 
194  // How many parameters does this projection have at most?
195  // What is the minimum number of parameters that have to be supplied?
196  // What are the parameter values?
197  // <group>
198  static uInt nParameters(Projection::Type proj);
199  static uInt nMinParameters(Projection::Type proj);
200  const Vector<Double> &parameters() const;
201  // </group>
202 
203  // Comparison to fractional tolerance.
204  Bool near(const Projection &other, Double tol=1.0e-6) const;
205 
206  // Is this projection a 'zenithal' projection
207  static Bool isZenithal (Projection::Type proj);
208 
209 private:
212 
213  void validate(const Bool verbose=False);
214  Projection::Type type (String& ctypeLong, String& ctypeLat) const;
215 };
216 
217 //#---------- Inlines --------------------------------------------------------------
218 inline Projection::Type Projection::type() const {return which_p;}
219 inline const Vector<Double> & Projection::parameters() const {return parameters_p;}
220 
221 } //# NAMESPACE CASACORE - END
222 
223 #endif
224 
Projection::Type type() const
What is the Type of this projection?
Definition: Projection.h:218
Cylindrical equal area.
Definition: Projection.h:125
Type
Hold all the known types of celestial projections.
Definition: Projection.h:99
N_PROJ gives the number of supported projections - it shouldn&#39;t be used as a projection.
Definition: Projection.h:158
static Bool isZenithal(Projection::Type proj)
Is this projection a &#39;zenithal&#39; projection.
Conic equidistant.
Definition: Projection.h:129
Quadrilateralized spherical cube.
Definition: Projection.h:151
void validate(const Bool verbose=False)
zenith/azimuthal equidistant.
Definition: Projection.h:111
Geometric parameters needed for a sky projection to a plane.
Definition: Projection.h:95
Projection::Type which_p
Definition: Projection.h:210
zenithal/azimuthal polynomial.
Definition: Projection.h:113
Zenithal/Azimuthal perspective.
Definition: Projection.h:101
Projection & operator=(const Projection &other)
Assignment (copy semantics)
Cylindrical perspective.
Definition: Projection.h:119
Projection(Projection::Type which=CAR)
Construct a projection which needs no parameters.
Sanson-Flamsteed (global sinusoidal).
Definition: Projection.h:141
Orthographics/synthesis.
Definition: Projection.h:107
static uInt nMinParameters(Projection::Type proj)
zenithal/azimuthal equal area.
Definition: Projection.h:115
COBE quadrilateralized spherical cube.
Definition: Projection.h:149
String name() const
What is the type of this projection as a String (e.g.
double Double
Definition: aipstype.h:55
Vector< Double > parameters_p
Definition: Projection.h:211
static uInt nParameters(Projection::Type proj)
How many parameters does this projection have at most? What is the minimum number of parameters that ...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Slant zenithal perspective, new.
Definition: Projection.h:103
Conic equal area.
Definition: Projection.h:131
const Bool False
Definition: aipstype.h:44
Conic orthomorphic.
Definition: Projection.h:133
Tangential spherical cube.
Definition: Projection.h:153
const Double e
e and functions thereof:
String: the storage and methods of handling collections of characters.
Definition: String.h:223
~Projection()
Destructor.
const Vector< Double > & parameters() const
Definition: Projection.h:219
Conic perspective.
Definition: Projection.h:127
unsigned int uInt
Definition: aipstype.h:51
Bool near(const Projection &other, Double tol=1.0e-6) const
Comparison to fractional tolerance.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42