UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
SphericalCoordinates.cpp
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #include <string.h>
4 #include "SphericalCoordinates.h"
5 
6 #define PI_OVER_2 (3.14159265358979323e0 / 2.0)
7 
8 using namespace MSP::CCS;
9 
12 _azimuth(0),
13 _elevation(0),
14 _radius(0)
15 {
16 }
17 
19 CoordinateTuple(_coordinateType),
20 _azimuth(0),
21 _elevation(0),
22 _radius(0)
23 {
24 }
25 
27  CoordinateType::Enum _coordinateType, double azOrLon, double elOrLat, double radius) :
28  CoordinateTuple(_coordinateType)
29 {
30  if( _coordinateType == MSP::CCS::CoordinateType::spherical )
31  {
32  setSphericalLongitude( azOrLon );
33  setSphericalLatitude( elOrLat );
34  setRadius( radius );
35  }
36  else
37  {
38  setAzimuth( azOrLon );
39  setElevationAngle( elOrLat );
40  setRange( radius );
41  }
42 }
43 
45  CoordinateType::Enum _coordinateType,
46  const char* __warningMessage,
47  double azOrLon, double elOrLat, double radius) :
48  CoordinateTuple(_coordinateType)
49 {
50  int length = strlen( __warningMessage );
51  strncpy( _warningMessage, __warningMessage, length );
52  _warningMessage[ length ] = '\0';
53 
54  if( _coordinateType == MSP::CCS::CoordinateType::spherical )
55  {
56  setSphericalLongitude( azOrLon );
57  setSphericalLatitude( elOrLat );
58  setRadius( radius );
59  }
60  else
61  {
62  setAzimuth( azOrLon );
63  setElevationAngle( elOrLat );
64  setRange( radius );
65  }
66 }
67 
69 {
71 
72  _azimuth = c._azimuth;
73  _elevation = c._elevation;
74  _radius = c._radius;
75 
76  int length = strlen(c._warningMessage);
77  strncpy(_warningMessage, c._warningMessage, length);
78  _warningMessage[ length ] = '\0';
79 }
80 
82 {
83 }
84 
86 {
87  if (this != &c)
88  {
90 
91  _azimuth = c._azimuth;
92  _elevation = c._elevation;
93  _radius = c._radius;
94 
95  int length = strlen( c._warningMessage );
96  strncpy( _warningMessage, c._warningMessage, length );
97  _warningMessage[ length ] = '\0';
98  }
99 
100  return *this;
101 }
102 
103 void SphericalCoordinates::setLocalSphericalCoord(double az, double el, double range)
104 {
105  _azimuth = az;
106  _elevation = el;
107  _radius = range;
108 }
109 
111 {
112  _azimuth = az;
113 }
114 
116 {
117  _elevation = el;
118 }
119 
121 {
122  _radius = range;
123 }
124 
126 {
127  return _azimuth;
128 }
129 
131 {
132  return _elevation;
133 }
134 
136 {
137  return _radius;
138 }
139 
140 
142  double longitude,
143  double latitude,
144  double radius)
145 {
146  _azimuth = PI_OVER_2 - longitude;
147  _elevation = latitude;
148  _radius = radius;
149 }
150 
152 {
153  _azimuth = PI_OVER_2 - lon;
154 }
155 
157 {
158  _elevation = lat;
159 }
160 
162 {
163  _radius = radius;
164 }
165 
167 {
168  return PI_OVER_2 - _azimuth;
169 }
170 
172 {
173  return _elevation;
174 }
175 
177 {
178  return _radius;
179 }
180 
SphericalCoordinates & operator=(const SphericalCoordinates &cc)
void setSphericalCoord(double longitude, double latitude, double radius)
#define PI_OVER_2
Definition: MGRS.cpp:165
void setLocalSphericalCoord(double az, double el, double range)
CoordinateType::Enum _coordinateType