1
0
Fork 0

Update counter index names to make the code more explicite.

This commit is contained in:
curt 2003-03-19 22:48:35 +00:00
parent 123fb92d40
commit f526985854
2 changed files with 9 additions and 9 deletions

View file

@ -240,9 +240,9 @@ bool TGHgt::write_whole_ascii( const string& file ) {
} }
gzprintf( fp, "%d\n%d\n", rows, cols ); gzprintf( fp, "%d\n%d\n", rows, cols );
for ( int i = 0; i < rows; i++ ) { for ( int row = rows - 1; row >= 0; row-- ) {
for ( int j = 0; j < cols; j++ ) { for ( int col = 0; col < cols; col++ ) {
gzprintf( fp, "%d\n", (int)data[i][j] ); gzprintf( fp, "%d\n", (int)data[col][row] );
} }
} }
gzclose(fp); gzclose(fp);
@ -263,9 +263,9 @@ bool
TGHgt::has_non_zero_elev (int start_x, int span_x, TGHgt::has_non_zero_elev (int start_x, int span_x,
int start_y, int span_y) const int start_y, int span_y) const
{ {
for ( int i = start_x; i < start_x + span_x; i++ ) { for ( int row = start_y; row < start_y + span_y; row++ ) {
for ( int j = start_y; j < start_y + span_y; j++ ) { for ( int col = start_x; col < start_x + span_x; col++ ) {
if ( data[i][j] != 0 ) if ( data[col][row] != 0 )
return true; return true;
} }
} }

View file

@ -3,8 +3,8 @@
#include "hgt.hxx" #include "hgt.hxx"
int main() { int main() {
// SGPath path1( "/stage/fgfs03/SRTM/United_States/N33W080/1arcsec/N33W080.hgt.gz" ); // SGPath path3( "/stage/fgfs03/SRTM/United_States/N38W124/3arcsec/N38W124.hgt.gz" );
SGPath path3( "N37W123/3arcsec/N37W123.hgt.gz" ); SGPath path3( "/home/curt/trash/N38W124.hgt.gz" );
// TGHgt hgt1( 1, path1 ); // TGHgt hgt1( 1, path1 );
TGHgt hgt3( 3, path3 ); TGHgt hgt3( 3, path3 );
@ -14,5 +14,5 @@ int main() {
// SGBucket b(-79.5, 33.5); // SGBucket b(-79.5, 33.5);
// hgt1.write_area( ".", b ); // hgt1.write_area( ".", b );
hgt3.write_whole_ascii( "test.ahgt" ); hgt3.write_whole_ascii( "w124n38.txt.gz" );
} }