forked from ExternalVendorCode/Signal-Server
Move tile post processing
This commit is contained in:
89
inputs.cc
89
inputs.cc
@@ -254,7 +254,7 @@ int loadLIDAR(char *filenames)
|
||||
}
|
||||
|
||||
/* Allocate the tile array */
|
||||
tiles = (tile_t*)calloc(fc,sizeof(tile_t));
|
||||
tiles = (tile_t*) calloc(fc, sizeof(tile_t));
|
||||
|
||||
/* Load each tile in turn */
|
||||
for (indx = 0; indx < fc; indx++) {
|
||||
@@ -279,6 +279,47 @@ int loadLIDAR(char *filenames)
|
||||
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
|
||||
@@ -314,52 +355,6 @@ int loadLIDAR(char *filenames)
|
||||
dem[indx].max_el = tiles[indx].max_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
|
||||
* 90 degrees (christ knows why...)
|
||||
|
20
tiles.hh
20
tiles.hh
@@ -11,10 +11,22 @@ typedef struct _tile_t{
|
||||
int rows;
|
||||
int height;
|
||||
};
|
||||
double xll;
|
||||
double yll;
|
||||
double xur;
|
||||
double yur;
|
||||
union{
|
||||
double xll;
|
||||
double max_west;
|
||||
};
|
||||
union{
|
||||
double yll;
|
||||
double min_north;
|
||||
};
|
||||
union{
|
||||
double xur;
|
||||
double min_west;
|
||||
};
|
||||
union{
|
||||
double yur;
|
||||
double max_north;
|
||||
};
|
||||
double cellsize;
|
||||
long long datastart;
|
||||
int nodata;
|
||||
|
Reference in New Issue
Block a user