105 using namespace MSP::CCS;
123 const double PI = 3.14159265358979323e0;
199 char _15_minute_value_str[2] =
"";
200 char _5_minute_value_str[2] =
"";
201 double round_error = 5.0e-11;
202 char* _15_minute_array[2][2] = {{
"3",
"1"}, {
"4",
"2"}};
203 char* _5_minute_array[3][3] = {{
"7",
"4",
"1"}, {
"8",
"5",
"2"}, {
"9",
"6",
"3"}};
204 double long_minutes, lat_minutes;
205 double long_remainder, lat_remainder;
206 long horiz_index_30, vert_index_30;
207 long horiz_index_15, vert_index_15;
208 long horiz_index_5, vert_index_5;
223 latitude = 89.99999999999;
225 if( longitude >= 180.0 )
230 long_minutes = ( longitude -
MIN_LONGITUDE ) * 60.0 + round_error;
231 lat_minutes = ( latitude -
MIN_LATITUDE ) * 60.0 + round_error;
235 horiz_index_30 = ( long )( long_minutes / 30.0 );
236 vert_index_30 = ( long )( lat_minutes / 30.0 );
239 long_remainder = long_minutes - ( horiz_index_30 ) * 30.0;
240 lat_remainder = lat_minutes - ( vert_index_30 ) * 30.0;
243 horiz_index_15 = ( long )( long_remainder / 15.0 );
244 vert_index_15 = ( long )( lat_remainder / 15.0 );
247 long_remainder = long_remainder - ( horiz_index_15 ) * 15.0;
248 lat_remainder = lat_remainder - ( vert_index_15 ) * 15.0;
251 horiz_index_5 = ( long )( long_remainder / 5.0 );
252 vert_index_5 = ( long )( lat_remainder / 5.0 );
255 ew_value = horiz_index_30 + 1;
258 letter_index[0] = ( long )( vert_index_30 / 24.0 );
261 letter_index[1] = ( long )( vert_index_30 - letter_index[0] * 24.0 );
275 strcpy( _15_minute_value_str, _15_minute_array[horiz_index_15][vert_index_15] );
278 strcpy( _5_minute_value_str, _5_minute_array[horiz_index_5][vert_index_5] );
283 else if( ew_value < 100 )
290 strcat( GARSString, _15_minute_value_str);
293 strcat( GARSString, _5_minute_value_str);
296 GARSString[7] =
'\0';
320 char _15_minute_value = 0;
321 char _5_minute_value = 0;
322 double lat_minutes = 0;
323 double lon_minutes = 0;
324 double longitude, latitude;
326 char* GARSString = garsCoordinates->
GARSString();
328 gars_length = strlen( GARSString );
332 while( isdigit( GARSString[index] ) )
334 ew_str[index] = GARSString[index];
342 ew_value = atoi( ew_str );
344 letter = GARSString[index];
345 if( !isalpha( letter ) )
350 letter = GARSString[++index];
351 if( !isalpha( letter ) )
357 if( index + 1 < gars_length )
360 _15_minute_value = GARSString[++index];
361 if( !isdigit( _15_minute_value ) || _15_minute_value < _1 || _15_minute_value >
_4 )
365 if( index + 1 < gars_length )
368 _5_minute_value = GARSString[++index];
369 if( !isdigit( _5_minute_value ) || _5_minute_value < _1 || _5_minute_value >
_9 )
375 longitude = ( ( ( ew_value - 1.0 ) / 2.0 ) - 180.0 );
388 latitude = ( ( -90.0 + ( ns_str[0] * 12.0 ) ) + ( ns_str[1] / 2.0 ) );
390 switch( _15_minute_value )
407 switch( _5_minute_value )
443 if( _5_minute_value )
448 else if( _15_minute_value )