Rainer Emrich:
Updates to DEM parser to make it more compliant with the spec.
This commit is contained in:
parent
3169a0255f
commit
f7a4a8bfa0
1 changed files with 38 additions and 9 deletions
|
@ -176,7 +176,7 @@ int
|
||||||
TGDem::read_a_record() {
|
TGDem::read_a_record() {
|
||||||
int i, inum;
|
int i, inum;
|
||||||
double dnum;
|
double dnum;
|
||||||
string name, token;
|
string name, token, buf;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
// get the name field (144 characters)
|
// get the name field (144 characters)
|
||||||
|
@ -267,7 +267,11 @@ TGDem::read_a_record() {
|
||||||
// Counterclockwise angle from the primary axis of ground
|
// Counterclockwise angle from the primary axis of ground
|
||||||
// planimetric referenced to the primary axis of the DEM local
|
// planimetric referenced to the primary axis of the DEM local
|
||||||
// reference system.
|
// reference system.
|
||||||
token = next_token();
|
|
||||||
|
// eat and discard 24 characters (we don't use this value)
|
||||||
|
for ( i = 0; i < 24; i++ ) {
|
||||||
|
in->get(c);
|
||||||
|
}
|
||||||
|
|
||||||
// Accuracy code; 0 indicates that a record of accuracy does not
|
// Accuracy code; 0 indicates that a record of accuracy does not
|
||||||
// exist and that no record type C will follow.
|
// exist and that no record type C will follow.
|
||||||
|
@ -277,14 +281,33 @@ TGDem::read_a_record() {
|
||||||
|
|
||||||
// I will eventually have to do something with this for data at
|
// I will eventually have to do something with this for data at
|
||||||
// higher latitudes */
|
// higher latitudes */
|
||||||
token = next_token();
|
|
||||||
cout << " accuracy & spacial resolution string = " << token << endl;
|
|
||||||
i = token.length();
|
|
||||||
cout << " length = " << i << "\n";
|
|
||||||
|
|
||||||
inum = atoi( token.substr( 0, i - 36 ).c_str() );
|
// get the accuracy field (6 characters)
|
||||||
row_step = atof( token.substr( i - 24, 12 ).c_str() );
|
name.erase();
|
||||||
col_step = atof( token.substr( i - 36, 12 ).c_str() );
|
for ( i = 0; i < 6; i++ ) {
|
||||||
|
in->get(c);
|
||||||
|
name += c;
|
||||||
|
}
|
||||||
|
inum = atoi( name.c_str() );
|
||||||
|
|
||||||
|
// get the spacial resolution (3*12 characters)
|
||||||
|
name.erase();
|
||||||
|
for ( i = 0; i < 12; i++ ) {
|
||||||
|
in->get(c);
|
||||||
|
name += c;
|
||||||
|
}
|
||||||
|
col_step = atof( name.c_str() );
|
||||||
|
name.erase();
|
||||||
|
for ( i = 0; i < 12; i++ ) {
|
||||||
|
in->get(c);
|
||||||
|
name += c;
|
||||||
|
}
|
||||||
|
row_step = atof( name.c_str() );
|
||||||
|
name.erase();
|
||||||
|
for ( i = 0; i < 12; i++ ) {
|
||||||
|
in->get(c);
|
||||||
|
name += c;
|
||||||
|
}
|
||||||
cout << " Accuracy code = " << inum << "\n";
|
cout << " Accuracy code = " << inum << "\n";
|
||||||
cout << " column step = " << col_step <<
|
cout << " column step = " << col_step <<
|
||||||
" row step = " << row_step << "\n";
|
" row step = " << row_step << "\n";
|
||||||
|
@ -296,6 +319,12 @@ TGDem::read_a_record() {
|
||||||
dem_num_profiles = cols = next_int();
|
dem_num_profiles = cols = next_int();
|
||||||
cout << " Expecting " << dem_num_profiles << " profiles\n";
|
cout << " Expecting " << dem_num_profiles << " profiles\n";
|
||||||
|
|
||||||
|
// eat characters to the end of the A record which we [hopefully]
|
||||||
|
// know is guaranteed to be 160 characters away.
|
||||||
|
for ( i = 0; i < 160; i++ ) {
|
||||||
|
in->get(c);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue