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