diff --git a/src/Airports/GenAirports/apt_surface.cxx b/src/Airports/GenAirports/apt_surface.cxx index ad3246fd..c9c83371 100644 --- a/src/Airports/GenAirports/apt_surface.cxx +++ b/src/Airports/GenAirports/apt_surface.cxx @@ -97,6 +97,10 @@ static void calc_elevations( const string &root, Matrix_Point3Df &Pts ) { // found/opened array.parse( b ); + // this will do a hasty job of removing voids by inserting + // data from the nearest neighbor (sort of) + array.remove_voids(); + // update all the non-updated elevations that are inside // this array file double elev; @@ -150,8 +154,8 @@ TGAptSurface::TGAptSurface( const string& path, cout << "Area size = " << x_m << " x " << y_m << " (m)" << endl; - int xdivs = (int)(x_m / 1200.0) + 1; - int ydivs = (int)(y_m / 1200.0) + 1; + int xdivs = (int)(x_m / 600.0) + 1; + int ydivs = (int)(y_m / 600.0) + 1; if ( xdivs < 3 ) { xdivs = 3; } if ( ydivs < 3 ) { ydivs = 3; } @@ -160,13 +164,13 @@ TGAptSurface::TGAptSurface( const string& path, double dlon = x_deg / xdivs; double dlat = y_deg / ydivs; - // Build the double res input grid + // Build the extra res input grid int mult = 10; - Matrix_Point3Df dPts((xdivs+1) * mult, (ydivs + 1) * mult); + Matrix_Point3Df dPts((xdivs+2) * mult + 1, (ydivs+2) * mult + 1); for ( int i = 0; i < dPts.rows(); ++i ) { for ( int j = 0; j < dPts.cols(); ++j ) { - dPts(i,j) = Point3Df( min_deg.lon() + i * (dlon/(double)mult), - min_deg.lat() + j * (dlat/(double)mult), + dPts(i,j) = Point3Df( min_deg.lon() + (i-mult)*(dlon/(double)mult), + min_deg.lat() + (j-mult)*(dlat/(double)mult), -9999 ); } } @@ -176,13 +180,14 @@ TGAptSurface::TGAptSurface( const string& path, // Build the normal res input grid from the double res version Matrix_Point3Df Pts(xdivs + 1, ydivs + 1); - for ( int i = 0; i <= xdivs; ++i ) { - for ( int j = 0; j <= ydivs; ++j ) { + for ( int i = 0; i < xdivs + 1; ++i ) { + for ( int j = 0; j < ydivs + 1; ++j ) { cout << i << "," << j << endl; double accum = 0.0; for ( int ii = 0; ii < mult; ++ii ) { for ( int jj = 0; jj < mult; ++jj ) { - accum += dPts(mult * i + ii, mult * j + jj).z(); + accum += dPts(mult*(i+1) - (mult/2) + ii, + mult*(j+1) - (mult/2) + jj).z(); } } Pts(i,j) = Point3Df( min_deg.lon() + i * dlon, diff --git a/src/Airports/GenAirports/build.cxx b/src/Airports/GenAirports/build.cxx index 770e780c..b487ac40 100644 --- a/src/Airports/GenAirports/build.cxx +++ b/src/Airports/GenAirports/build.cxx @@ -308,7 +308,7 @@ static void build_runway( const TGRunway& rwy_info, } else { base = gen_runway_area_w_extend( rwy_info, 20, 20 ); // also clear a safe area around the runway - safe_base = gen_runway_area_w_extend( rwy_info, 300, 120 ); + safe_base = gen_runway_area_w_extend( rwy_info, 300, 60 ); } *apt_clearing = polygon_union(safe_base, *apt_clearing); @@ -860,7 +860,7 @@ void build_airport( string airport_raw, float alt_m, tri_materials.push_back( "Grass" ); base_txs.clear(); - base_txs = calc_tex_coords( b, nodes.get_node_list(), tri_v ); + base_txs = sgCalcTexCoords( b, nodes.get_node_list(), tri_v ); base_tc.clear(); for ( j = 0; j < (int)base_txs.size(); ++j ) { @@ -1014,7 +1014,7 @@ void build_airport( string airport_raw, float alt_m, strip_materials.push_back( "Grass" ); base_txs.clear(); - base_txs = calc_tex_coords( b, nodes.get_node_list(), strip_v ); + base_txs = sgCalcTexCoords( b, nodes.get_node_list(), strip_v ); base_tc.clear(); for ( j = 0; j < (int)base_txs.size(); ++j ) { @@ -1080,6 +1080,11 @@ void build_airport( string airport_raw, float alt_m, point_list geod_light_nodes = tmp_light_list[i].get_poly().get_contour(0); +#if 0 + // This code forces the elevation of all the approach lighting + // components for a particular runway end up to the highest + // max elevation for any of the points. That can cause other + // problem so let's nuke code this for the moment. string flag = rwy_lights[i].get_flag(); if ( flag != (string)"" ) { const_elev_map_iterator it = elevation_map.find( flag ); @@ -1090,6 +1095,7 @@ void build_airport( string airport_raw, float alt_m, } } } +#endif // this is a little round about, but what we want to calculate the // light node elevations as ground + an offset so we do them