diff --git a/src/Airports/GenAirports/build.cxx b/src/Airports/GenAirports/build.cxx index e0f25c56..c9026713 100644 --- a/src/Airports/GenAirports/build.cxx +++ b/src/Airports/GenAirports/build.cxx @@ -500,8 +500,8 @@ void build_airport( string airport_raw, float alt_m, string type_flag = runways[i].surface_flags.substr(2, 1); if ( type_flag == "P" ) { build_runway( runways[i], elev * SG_FEET_TO_METER, - &rwy_polys, &texparams, &accum, &apt_base, - &apt_clearing ); + &rwy_polys, &texparams, &accum, + &apt_base, &apt_clearing ); } } @@ -510,8 +510,8 @@ void build_airport( string airport_raw, float alt_m, string type_flag = runways[i].surface_flags.substr(2, 1); if ( type_flag == "R" || type_flag == "V" ) { build_runway( runways[i], elev * SG_FEET_TO_METER, - &rwy_polys, &texparams, &accum, &apt_base, - &apt_clearing ); + &rwy_polys, &texparams, &accum, + &apt_base, &apt_clearing ); } } @@ -521,8 +521,8 @@ void build_airport( string airport_raw, float alt_m, if ( type_flag != string("P") && type_flag != string("R") && type_flag != string("V") ) { build_runway( runways[i], elev * SG_FEET_TO_METER, - &rwy_polys, &texparams, &accum, &apt_base, - &apt_clearing ); + &rwy_polys, &texparams, &accum, + &apt_base, &apt_clearing ); } } @@ -929,6 +929,8 @@ void build_airport( string airport_raw, float alt_m, point_list geod_nodes = calc_elevations( apt_surf, nodes.get_node_list(), 0.0 ); divided_base = calc_elevations( apt_surf, divided_base, 0.0 ); + cout << "DIVIDED" << endl; + cout << divided_base << endl; SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()"); diff --git a/src/BuildTiles/Clipper/clipper.cxx b/src/BuildTiles/Clipper/clipper.cxx index 2d13f80a..675f5ce8 100644 --- a/src/BuildTiles/Clipper/clipper.cxx +++ b/src/BuildTiles/Clipper/clipper.cxx @@ -129,7 +129,9 @@ bool TGClipper::load_polys(const string& path) { } p = Point3D(startx, starty, startz); poly.add_node( i, p ); - fixed_elevations.unique_add( p ); + if ( poly3d ) { + fixed_elevations.unique_add( p ); + } for ( j = 1; j < count - 1; ++j ) { in >> x; @@ -141,7 +143,9 @@ bool TGClipper::load_polys(const string& path) { } p = Point3D( x, y, z ); poly.add_node( i, p ); - fixed_elevations.unique_add( p ); + if ( poly3d ) { + fixed_elevations.unique_add( p ); + } } in >> lastx; @@ -159,7 +163,9 @@ bool TGClipper::load_polys(const string& path) { } else { p = Point3D( lastx, lasty, lastz ); poly.add_node( i, p ); - fixed_elevations.unique_add( p ); + if ( poly3d ) { + fixed_elevations.unique_add( p ); + } } } diff --git a/src/BuildTiles/Main/README b/src/BuildTiles/Main/README new file mode 100644 index 00000000..5f99c998 --- /dev/null +++ b/src/BuildTiles/Main/README @@ -0,0 +1,17 @@ +Sample command line to build a specific tile-id: + +./fgfs-construct --min-angle=10 --work-dir=/stage/fgfs04/curt/Work --output-dir=/stage/fgfs04/curt/FlightGear --tile-id=942050 /stage/fgfs04/curt/Work/AirportArea /stage/fgfs04/curt/Work/AirportObj /stage/fgfs04/curt/Work/GSHHS-Ponds /stage/fgfs04/curt/Work/GSHHS-Islands /stage/fgfs04/curt/Work/GSHHS-Lakes /stage/fgfs04/curt/Work/GSHHS-LandMass /stage/fgfs04/curt/Work/USA-Hydro /stage/fgfs04/curt/Work/USA-Urban /stage/fgfs04/curt/Work/SRTM-1 2>&1 | less + +Sample command line to build tiles intersecting an area specified by a +point and a lat/lon distance (in degrees.) + +./fgfs-construct --min-angle=0 --work-dir=/stage/fgfs04/curt/Work --output-dir=/stage/fgfs04/curt/FlightGear --lon=-122.374843 --lat=37.619002 --xdist=0.5 --ydist=0.5 --cover=/stage/fgfs04/curt/Work/LC-Global/gusgs2_0ll.img.old /stage/fgfs04/curt/Work/AirportArea /stage/fgfs04/curt/Work/AirportObj /stage/fgfs04/curt/Work/GSHHS-Ponds /stage/fgfs04/curt/Work/GSHHS-Islands /stage/fgfs04/curt/Work/GSHHS-Lakes /stage/fgfs04/curt/Work/GSHHS-LandMass /stage/fgfs04/curt/Work/USA-Hydro /stage/fgfs04/curt/Work/USA-Urban /stage/fgfs04/curt/Work/SRTM-1 + +Sample command line with standard airports: + +./fgfs-construct --output-dir=. --work-dir=/stage/fgfs01/curt/Work --cover=/stage/fgfs01/curt/Work/LC-Global/gusgs2_0ll.img --tile-id=958424 /stage/fgfs01/curt/Work/AirportArea /stage/fgfs01/curt/Work/AirportObj /stage/fgfs01/curt/Work/GSHHS-Ponds /stage/fgfs01/curt/Work/GSHHS-Islands /stage/fgfs01/curt/Work/GSHHS-Lakes /stage/fgfs01/curt/Work/GSHHS-LandMass /stage/fgfs01/curt/Work/USA-Hydro /stage/fgfs01/curt/Work/USA-Urban /stage/fgfs01/curt/Work/DEM-3 /stage/fgfs01/curt/Work/DEM-30 + +Similar command line but using Photo airports: + +./fgfs-construct --output-dir=. --work-dir=/stage/fgfs01/curt/Work --cover=/stage/fgfs01/curt/Work/LC-Global/gusgs2_0ll.img --tile-id=958424 /stage/fgfs01/curt/Work/PhotoArea /stage/fgfs01/curt/Work/PhotoObj /stage/fgfs01/curt/Work/GSHHS-Ponds /stage/fgfs01/curt/Work/GSHHS-Islands /stage/fgfs01/curt/Work/GSHHS-Lakes /stage/fgfs01/curt/Work/GSHHS-LandMass /stage/fgfs01/curt/Work/USA-Hydro /stage/fgfs01/curt/Work/USA-Urban /stage/fgfs01/curt/Work/DEM-3 /stage/fgfs01/curt/Work/DEM-30 + diff --git a/src/BuildTiles/Main/construct.hxx b/src/BuildTiles/Main/construct.hxx index 61c6cb5c..a80a753a 100644 --- a/src/BuildTiles/Main/construct.hxx +++ b/src/BuildTiles/Main/construct.hxx @@ -83,6 +83,10 @@ private: // clipped polygons (gpc format) TGPolyList clipped_polys; + // Fixed elevations (from polygon input data with z values + // pre-specified) + TGTriNodes fixed_elevations; + // raw node list (after triangulation) TGTriNodes tri_nodes; @@ -148,6 +152,11 @@ public: inline TGPolyList get_clipped_polys() const { return clipped_polys; } inline void set_clipped_polys( TGPolyList p ) { clipped_polys = p; } + // Fixed elevations (from polygon input data with z values + // pre-specified) + inline TGTriNodes get_fixed_elevations() const { return fixed_elevations; } + inline void set_fixed_elevations( TGTriNodes n ) { fixed_elevations = n; } + // node list (after triangulation) inline TGTriNodes get_tri_nodes() const { return tri_nodes; } inline void set_tri_nodes( TGTriNodes n ) { tri_nodes = n; } diff --git a/src/BuildTiles/Main/main.cxx b/src/BuildTiles/Main/main.cxx index 77054b7e..73173a4a 100644 --- a/src/BuildTiles/Main/main.cxx +++ b/src/BuildTiles/Main/main.cxx @@ -404,6 +404,7 @@ static int load_polys( TGConstruct& c ) { // update main data repository c.set_clipped_polys( clipper.get_polys_clipped() ); + c.set_fixed_elevations( clipper.get_fixed_elevations() ); return count; } @@ -494,11 +495,19 @@ static void fix_point_heights( TGConstruct& c, const TGArray& array ) point_list raw_nodes = c.get_tri_nodes().get_node_list(); for ( i = 0; i < (int)raw_nodes.size(); ++i ) { - cout << " fixing = " << raw_nodes[i] << " = "; - z = array.interpolate_altitude( raw_nodes[i].x() * 3600.0, - raw_nodes[i].y() * 3600.0 ); + cout << " fixing = " << raw_nodes[i] << " "; + int index = c.get_fixed_elevations().find( raw_nodes[i] ); + if ( index >= 0 ) { + // found an elevation we want to preserve + z = c.get_fixed_elevations().get_node(index).z(); + cout << " forced = " << z << endl; + } else { + // interpolate point from DEM data. + z = array.interpolate_altitude( raw_nodes[i].x() * 3600.0, + raw_nodes[i].y() * 3600.0 ); + cout << " interpolated = " << z << endl; + } raw_nodes[i].setz( z ); - cout << raw_nodes[i].z() << endl; } cout << "flattening ocean connected nodes" << endl; diff --git a/src/Lib/Polygon/split-bin.cxx b/src/Lib/Polygon/split-bin.cxx index 4e619a69..6a5aa947 100644 --- a/src/Lib/Polygon/split-bin.cxx +++ b/src/Lib/Polygon/split-bin.cxx @@ -89,6 +89,9 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area, */ result = polygon_int( base, shape ); + if ( preserve3d ) { + result.inherit_elevations( shape ); + } if ( result.contours() > 0 ) { long int t_index = b.gen_index();