-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAvCoordinateSystem.h
More file actions
143 lines (113 loc) · 4.1 KB
/
AvCoordinateSystem.h
File metadata and controls
143 lines (113 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//# Copyright (C) 1995-97 Board of Trustees of the University of Illinois
//#
//# This software, both binary and source, is copyrighted by The
//# Board of Trustees of the University of Illinois. Ownership
//# remains with the University. You should have received a copy
//# of a licensing agreement with this software. See the file
//# "AIPSVIEW_COPYRIGHT", or contact the University at this address:
//#
//# The NCSA AipsView Visualization System
//# National Center for Supercomputing Applications
//# University of Illinois
//# 405 North Mathews Ave.
//# Urbana, IL 61801
//# aipsview@ncsa.uiuc.edu
//#---------------------------------------------------------------------------
// AvCoordinateSystem
#ifndef __AvCoordinateSystem_h__
#define __AvCoordinateSystem_h__
#include "AvString.h"
#include "AvRegex.h"
#include "AvWPosition.h"
class AvCelestialProjection;
class AvLinearMap;
// <summary>
// Coordinate System mapping class that is based on although independent of
// the AIPS++ Coordinate System Classes.
// </summary>
//
//
//
//
// <todo asof="1996/08/01">
// <li> pcmatrix testing
// </todo>
//
class AvCoordinateSystem
{
public:
// Build a linear, default coordinate system
AvCoordinateSystem(const int nAxes);
// Build the coordinate system from the provided information
// return NULL if the information is inconsistent.
AvCoordinateSystem(const int nAxes,
const AvString * ctypes,
const double * crvals,
const double * crpixs,
const double * cdelts,
const double * pcmatrix,
const double * projps,
const double longpole);
// copy constructor and assignment both use copy semantics
// <group>
AvCoordinateSystem(const AvCoordinateSystem& cs);
AvCoordinateSystem & operator = (const AvCoordinateSystem& cs);
// </group>
~AvCoordinateSystem();
// Return the number of axes present in the system
int nAxes() const { return nAxes_; }
// map a point from world coordinates to array coordinates
// <group>
int world2ijk(const AvWPosition & world, AvWPosition & ijk);
int world2ijk(const double * world, double * ijk);
// </group>
// map a point from array coordinates to world coordinates
// <group>
int ijk2world(const AvWPosition & ijk, AvWPosition & world);
int ijk2world(const double * ijk, double * world);
// </group>
// Return the name of the axis by index
const char * axisName(int axisNdx) const
{ return axisNames_[axisNdx].chars(); }
const char * axisUnits(int axisNdx) const
{ return axisUnits_[axisNdx].chars(); }
const char * axisMeasurementName(int axisNdx) const
{ return axisMeasurementNames_[axisNdx].chars(); }
// Return the (0-based) index of the longitude axis or
// -1 if no projection system is being used.
int longitudeAxis() const { return longAxis_; }
// Return the (0-based) index of the latitude axis or
// -1 if no projection system is being used.
int latitudeAxis() const { return latAxis_; }
// return the longpole value
double longpole() const { return longpole_; }
// set axis units and measurementNames. This can vary
// with file type, so AvCS can make no assumptions
void setAxisUnits(int axis, const AvString& units, const AvString& mname);
// Return a string containing value and units for given axes. sigfigs
// is the number of significant digits in the smallest breakdown of
// the value.
AvString valueUnitsStr(int axis, double value, int sigfigs = 4) const;
// Return a string containing the units that would be used
// to print a given value
AvString unitsForValueStr(int axis, double value, const AvString& units) const;
// Return converted valueIn on axis to units
double valueInUnits(int axis, double valueIn, const AvString& units) const;
private:
int nAxes_;
AvCelestialProjection * cp_;
AvLinearMap * lm_;
double * crvals_;
double longpole_;
int longAxis_;
int latAxis_;
// e.g., RA, FREQ
AvString * axisNames_;
// e.g., SIN, LSR
AvString * axisCoordSysNames_;
// e.g., seconds, hertz
AvString * axisUnits_;
// e.g., right ascension, frequency
AvString * axisMeasurementNames_;
};
#endif