UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
GARSCoordinates.cpp
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #include <stdio.h>
4 #include <string.h>
5 #include "GARSCoordinates.h"
6 
7 
8 using namespace MSP::CCS;
9 
10 
12  CoordinateTuple( CoordinateType::globalAreaReferenceSystem ),
13  _precision( Precision::tenthOfSecond )
14 {
15  strncpy( _GARSString, "361HN37", 7 );
16 }
17 
18 
20  CoordinateTuple( _coordinateType ),
21  _precision( Precision::tenthOfSecond )
22 {
23  strncpy( _GARSString, "361HN37", 7 );
24 }
25 
26 
27 GARSCoordinates::GARSCoordinates( CoordinateType::Enum _coordinateType, const char* __GARSString ) :
28  CoordinateTuple( _coordinateType ),
29  _precision( Precision::tenthOfSecond )
30 {
31  strncpy( _GARSString, __GARSString, 7 );
32  _GARSString[7] = '\0';
33 }
34 
35 
36 GARSCoordinates::GARSCoordinates( CoordinateType::Enum _coordinateType, const char* __GARSString, Precision::Enum __precision ) :
37  CoordinateTuple( _coordinateType ),
38  _precision( __precision )
39 {
40  strncpy( _GARSString, __GARSString, 7 );
41  _GARSString[7] = '\0';
42 }
43 
44 
45 GARSCoordinates::GARSCoordinates( CoordinateType::Enum _coordinateType, const char* __warningMessage, const char* __GARSString, Precision::Enum __precision ) :
46  CoordinateTuple( _coordinateType ),
47  _precision( __precision )
48 {
49  strncpy( _GARSString, __GARSString, 7 );
50  _GARSString[7] = '\0';
51 
52  int length = strlen( __warningMessage );
53  strncpy( _warningMessage, __warningMessage, length );
54  _warningMessage[ length ] = '\0';
55 }
56 
57 
59 {
61 
62  strncpy( _GARSString, c._GARSString, 7 );
63  _GARSString[7] = '\0';
64 
65  _precision = c._precision;
66 
67  int length = strlen( c._warningMessage );
68  strncpy( _warningMessage, c._warningMessage, length );
69  _warningMessage[ length ] = '\0';
70 }
71 
72 
74 {
75 }
76 
77 
79 {
80  if( this != &c )
81  {
83 
84  strncpy( _GARSString, c._GARSString, 7 );
85  _GARSString[7] = '\0';
86 
87  _precision = c._precision;
88 
89  int length = strlen( c._warningMessage );
90  strncpy( _warningMessage, c._warningMessage, length );
91  _warningMessage[ length ] = '\0';
92  }
93 
94  return *this;
95 }
96 
97 
98 void GARSCoordinates::set( char __GARSString[8] )
99 {
100  strncpy( _GARSString, __GARSString, 7 );
101  _GARSString[7] = '\0';
102 }
103 
104 
106 {
107  return _GARSString;
108 }
109 
110 
112 {
113  Precision::Enum temp_precision = _precision;
114 
115  if (temp_precision < 0)
116  temp_precision = Precision::degree;
117  if (temp_precision > 5)
118  temp_precision = Precision::tenthOfSecond;
119 
120  return temp_precision;
121 }
122 
123 // CLASSIFICATION: UNCLASSIFIED