UNCLASSIFIED

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