source: Sophya/trunk/Poubelle/archTOI.old/asigps.cc@ 4010

Last change on this file since 4010 was 634, checked in by ansari, 26 years ago

linux-ppc, gcc 2.95.1

File size: 1.3 KB
Line 
1// asigps.cc
2// Eric Aubourg CEA/DAPNIA/SPP aout 1999
3
4#include "asigps.h"
5#include <fstream.h>
6#include <stdio.h>
7
8ASIGPS::ASIGPS(string const& filename) {
9 readFile(filename);
10}
11
12void ASIGPS::readFile(string const& filename) {
13 ifstream f(filename.c_str());
14 double omjd=0;
15 while (f) {
16 char line[500];
17 f.getline(line,500);
18 if (!f) break;
19 char*p = line;
20 double mjd, lat, lon, alt;
21 if (*p != '3' && *p != '2') continue;
22 p++;
23 if (*p != 'D' && *p != 'd') continue;
24 p+=3;
25 if (strncmp(p,"99/jul/1",8)) continue;
26 p+=8;
27 if (*p == '7') mjd = 1376.5;
28 else if (*p == '8') mjd = 1377.5;
29 else continue;
30 p++;p++;
31 int h,m,s;
32 sscanf(p,"%2d:%2d:%2d",&h,&m,&s);
33 mjd += (h+m/60.+s/3600.)/24.;
34 p += 9;
35 if (*p == 'N') s = 1;
36 else if (*p == 'S') s = -1;
37 else continue;
38 p++;
39 int d,fm;
40 sscanf(p,"%2d.%2d,%3d",&d,&m,&fm);
41 lat = s*(d + m/60. + fm/60000.);
42 p+=10;
43 if (*p == 'E') s = 1;
44 else if (*p == 'W') s = -1;
45 else continue;
46 p++;
47 sscanf(p,"%3d.%2d,%3d",&d,&m,&fm);
48 lon = s*(d + m/60. + fm/60000.);
49 p+=11;
50 sscanf(p,"%5d",&d);
51 alt = d;
52 p+=5;
53 if (*p != 'm') continue;
54 if (mjd < omjd) continue;
55 omjd = mjd;
56 AddValue(mjd, lat, lon, alt);
57 }
58}
Note: See TracBrowser for help on using the repository browser.