00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef DEP_GCLIO_INCLUDED
00022 #define DEP_GCLIO_INCLUDED
00023
00024 #include <cstring>
00025 #include <iostream>
00026 #include "uangle.h"
00027 #include "gkk.h"
00028 #include "utm.h"
00029 #include "lambert1.h"
00030 #include "lambert2.h"
00031 #include "spk.h"
00032
00033 using namespace std;
00034 using namespace GenLib2;
00035
00036 namespace GCL
00037 {
00038
00077 class GCLIO
00078 {
00079 public:
00081 enum ecode
00082 {
00083 UNKNOWN = 1<<0,
00084 VERSION = 1<<1,
00085 ELLIPSOID = 1<<2,
00086 MAP_PROJECTION = 1<<3,
00087 UNIT_ANGLE = 1<<4,
00088 ORIGIN_LATITUDE = 1<<5,
00089 ORIGIN_LONGITUDE = 1<<6,
00090 SCALE = 1<<7,
00091 OFFSET_X = 1<<8,
00092 OFFSET_Y = 1<<9,
00093 STD_PARALLEL_1 = 1<<10,
00094 STD_PARALLEL_2 = 1<<11,
00095 REFERENCE_POINT = 1<<12,
00096 START_DATA = 1<<29,
00097 END_DATA = 1<<30,
00098 END_OF_MAP = 1<<31
00099 };
00100
00104
00105 GCLIO() :
00106 _major(0), _minor(1), _patch(0),
00107 _eflags(0),
00108 _ell_name(),
00109 _acode(UnitAngle::RADIAN),
00110 _map_name(),
00111 _b0(0.), _l0(0.),
00112 _m0(1.),
00113 _x0(0.), _y0(0.),
00114 _b1(0.), _b2(0.),
00115 _bb(0.), _lb(0.), _hb(0.) {}
00116
00118 virtual ~GCLIO() {}
00120
00125 bool is_flag(ecode flg) const
00126 {
00127 return (_eflags & flg) != 0 ? true : false;
00128 }
00129
00134 static ecode code(const char* name);
00135
00139
00140 bool read_header(istream& is);
00141
00143 void write_header(ostream& os) const;
00144
00146 void print_header(ostream& os) const;
00148
00150 UnitAngle::ecode get_acode() const
00151 {
00152 return _acode;
00153 }
00154
00155 public:
00157 int _major;
00158
00160 int _minor;
00161
00163 int _patch;
00164
00166 int _eflags;
00167
00169 string _ell_name;
00170
00172 UnitAngle::ecode _acode;
00173
00175 string _map_name;
00176
00178 double _b0;
00179
00181 double _l0;
00182
00184 double _m0;
00185
00187 double _x0;
00188
00190 double _y0;
00191
00193 double _b1;
00194
00196 double _b2;
00197
00199 double _bb;
00200
00202 double _lb;
00203
00205 double _hb;
00206
00207 private:
00209 struct map_t
00210 {
00212 int code;
00213
00215 const char* name;
00216 };
00217
00219 static map_t _map[];
00220 };
00221
00222
00223
00224
00249 Projection* create(const GCLIO& gcl);
00250
00251 }
00252
00253 #endif