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