Move tile post processing

This commit is contained in:
Gareth Evans
2017-06-06 21:47:05 +01:00
parent 580fc804e2
commit c6873f8dea
2 changed files with 58 additions and 51 deletions

View File

@@ -279,6 +279,47 @@ int loadLIDAR(char *filenames)
smCellsize = tiles[indx].cellsize; smCellsize = tiles[indx].cellsize;
} }
// Update a bunch of globals
if (tiles[indx].max_el > max_elevation)
max_elevation = tiles[indx].max_el;
if (tiles[indx].min_el < min_elevation)
min_elevation = tiles[indx].min_el;
if (max_north == -90 || tiles[indx].max_north > max_north)
max_north = tiles[indx].max_north;
if (min_north == 90 || tiles[indx].min_north < min_north)
min_north = tiles[indx].min_north;
if (tiles[indx].max_west > max_west)
max_west = tiles[indx].max_west;
if (tiles[indx].min_west < min_west)
min_west = tiles[indx].min_west;
if (max_west == -1) {
max_west = tiles[indx].max_west;
} else {
if (abs(tiles[indx].max_west - max_west) < 180) {
if (tiles[indx].max_west > max_west)
max_west = tiles[indx].max_west;
} else {
if (tiles[indx].max_west < max_west)
max_west = tiles[indx].max_west;
}
}
if (min_west == 360) {
min_west = tiles[indx].min_west;
} else {
if (fabs(tiles[indx].min_west - min_west) < 180.0) {
if (tiles[indx].min_west < min_west)
min_west = tiles[indx].min_west;
} else {
if (tiles[indx].min_west > min_west)
min_west = tiles[indx].min_west;
}
}
} }
/* Iterate through all tiles to find the largest x/y dimension /* Iterate through all tiles to find the largest x/y dimension
@@ -314,52 +355,6 @@ int loadLIDAR(char *filenames)
dem[indx].max_el = tiles[indx].max_el; dem[indx].max_el = tiles[indx].max_el;
dem[indx].min_el = tiles[indx].min_el; dem[indx].min_el = tiles[indx].min_el;
if (tiles[indx].max_el > max_elevation)
max_elevation = tiles[indx].max_el;
if (tiles[indx].min_el < min_elevation)
min_elevation = tiles[indx].min_el;
if (max_north == -90)
max_north = dem[indx].max_north;
else if (dem[indx].max_north > max_north)
max_north = dem[indx].max_north;
if (min_north == 90)
min_north = dem[indx].min_north;
else if (dem[indx].min_north < min_north)
min_north = dem[indx].min_north;
if (dem[indx].max_west > max_west)
max_west = dem[indx].max_west;
if (dem[indx].min_west < min_west)
min_west = dem[indx].min_west;
if (max_west == -1) {
max_west = dem[indx].max_west;
} else {
if (abs(dem[indx].max_west - max_west) < 180) {
if (dem[indx].max_west > max_west)
max_west = dem[indx].max_west;
} else {
if (dem[indx].max_west < max_west)
max_west = dem[indx].max_west;
}
}
if (min_west == 360) {
min_west = dem[indx].min_west;
} else {
if (fabs(dem[indx].min_west - min_west) < 180.0) {
if (dem[indx].min_west < min_west)
min_west = dem[indx].min_west;
} else {
if (dem[indx].min_west > min_west)
min_west = dem[indx].min_west;
}
}
/* /*
* Copy the lidar tile data into the dem array. The dem array is rotated * Copy the lidar tile data into the dem array. The dem array is rotated
* 90 degrees (christ knows why...) * 90 degrees (christ knows why...)

View File

@@ -11,10 +11,22 @@ typedef struct _tile_t{
int rows; int rows;
int height; int height;
}; };
union{
double xll; double xll;
double max_west;
};
union{
double yll; double yll;
double min_north;
};
union{
double xur; double xur;
double min_west;
};
union{
double yur; double yur;
double max_north;
};
double cellsize; double cellsize;
long long datastart; long long datastart;
int nodata; int nodata;