diff --git a/src/Airports/GenAirports/apt_surface.hxx b/src/Airports/GenAirports/apt_surface.hxx index a578ba51..81237e0a 100644 --- a/src/Airports/GenAirports/apt_surface.hxx +++ b/src/Airports/GenAirports/apt_surface.hxx @@ -36,7 +36,7 @@ #include // need matrix applications #include // need matrix output routines -#include +#include /*** diff --git a/src/Airports/GenAirports/build.cxx b/src/Airports/GenAirports/build.cxx index 60f76e52..5c3237cf 100644 --- a/src/Airports/GenAirports/build.cxx +++ b/src/Airports/GenAirports/build.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -460,9 +461,6 @@ void build_airport( string airport_id, float alt_m, SGBucket b( apt_lon / (double)rwy_count, apt_lat / (double)rwy_count ); SG_LOG(SG_GENERAL, SG_INFO, b.gen_base_path() << "/" << b.gen_index_str()); - Point3D center_geod( b.get_center_lon() * SGD_DEGREES_TO_RADIANS, - b.get_center_lat() * SGD_DEGREES_TO_RADIANS, 0 ); - Point3D gbs_center = sgGeodToCart( center_geod ); point_list beacons; beacons.clear(); for ( i = 0; i < (int)beacons_raw.size(); ++i ) { @@ -903,7 +901,6 @@ void build_airport( string airport_id, float alt_m, group_list strips_tc; strips_tc.clear(); string_list strip_materials; strip_materials.clear(); - Point3D tc; int index; int_list pt_v, tri_v, strip_v; int_list pt_n, tri_n, strip_n; @@ -946,7 +943,7 @@ void build_airport( string airport_id, float alt_m, index = normals.unique_add( vn ); tri_n.push_back( index ); - tc = tri_txs.get_pt( i, j ); + Point3D tc = tri_txs.get_pt( i, j ); index = texcoords.unique_add( tc ); tri_tc.push_back( index ); } @@ -958,7 +955,7 @@ void build_airport( string airport_id, float alt_m, } // add base points - point_list base_txs; + std::vector< SGVec2f > base_txs; int_list base_tc; for ( i = 0; i < base_tris.contours(); ++i ) { tri_v.clear(); @@ -976,14 +973,19 @@ void build_airport( string airport_id, float alt_m, tris_n.push_back( tri_n ); tri_materials.push_back( "Grass" ); + std::vector < SGGeod > geodNodes; + for ( j = 0; j < nodes.get_node_list().size(); j++ ) { + Point3D node = nodes.get_node_list()[j]; + geodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); + } base_txs.clear(); - base_txs = sgCalcTexCoords( b, nodes.get_node_list(), tri_v ); + base_txs = sgCalcTexCoords( b, geodNodes, tri_v ); base_tc.clear(); for ( j = 0; j < (int)base_txs.size(); ++j ) { - tc = base_txs[j]; + SGVec2f tc = base_txs[j]; // SG_LOG(SG_GENERAL, SG_DEBUG, "base_tc = " << tc); - index = texcoords.simple_add( tc ); + index = texcoords.simple_add( Point3D( tc.x(), tc.y(), 0 ) ); base_tc.push_back( index ); } tris_tc.push_back( base_tc ); @@ -1163,14 +1165,19 @@ void build_airport( string airport_id, float alt_m, strips_n.push_back( strip_n ); strip_materials.push_back( "Grass" ); + std::vector < SGGeod > geodNodes; + for ( j = 0; j < nodes.get_node_list().size(); j++ ) { + Point3D node = nodes.get_node_list()[j]; + geodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); + } base_txs.clear(); - base_txs = sgCalcTexCoords( b, nodes.get_node_list(), strip_v ); + base_txs = sgCalcTexCoords( b, geodNodes, strip_v ); base_tc.clear(); for ( j = 0; j < (int)base_txs.size(); ++j ) { - tc = base_txs[j]; + SGVec2f tc = base_txs[j]; // SG_LOG(SG_GENERAL, SG_DEBUG, "base_tc = " << tc); - index = texcoords.simple_add( tc ); + index = texcoords.simple_add( Point3D( tc.x(), tc.y(), 0 ) ); base_tc.push_back( index ); } strips_tc.push_back( base_tc ); @@ -1273,17 +1280,22 @@ void build_airport( string airport_id, float alt_m, } // calculate wgs84 mapping of nodes - point_list wgs84_nodes; + std::vector< SGVec3d > wgs84_nodes; for ( i = 0; i < (int)geod_nodes.size(); ++i ) { - p.setx( geod_nodes[i].x() * SGD_DEGREES_TO_RADIANS ); - p.sety( geod_nodes[i].y() * SGD_DEGREES_TO_RADIANS ); - p.setz( geod_nodes[i].z() ); - SG_LOG(SG_GENERAL, SG_DEBUG, "geod pt = " << geod_nodes[i] ); - Point3D cart = sgGeodToCart( p ); + SGGeod geod = SGGeod::fromDegM( geod_nodes[i].x(), geod_nodes[i].y(), geod_nodes[i].z() ); + SG_LOG(SG_GENERAL, SG_DEBUG, "geod pt = " << geod_nodes[i] ); + SGVec3d cart = SGVec3d::fromGeod(geod); SG_LOG(SG_GENERAL, SG_DEBUG, " cart pt = " << cart ); wgs84_nodes.push_back( cart ); } - float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes ); + SGSphered d; + for ( i = 0; i < wgs84_nodes.size(); ++i ) { + d.expandBy(wgs84_nodes[ i ]); + } + + SGVec3d gbs_center = d.getCenter(); + double gbs_radius = d.getRadius(); + cout << "gbs center = " << gbs_center << endl; SG_LOG(SG_GENERAL, SG_DEBUG, "Done with wgs84 node mapping"); SG_LOG(SG_GENERAL, SG_DEBUG, " center = " << gbs_center << " radius = " << gbs_radius ); @@ -1296,14 +1308,26 @@ void build_airport( string airport_id, float alt_m, string objpath = root + "/AirportObj"; string name = airport_id + ".btg"; + + std::vector< SGVec3f > normals_3f; + for ( i=0; i < normals.get_node_list().size(); i++ ) { + Point3D node = normals.get_node_list()[i]; + normals_3f.push_back( node.toSGVec3f() ); + } + + std::vector< SGVec2f > texcoords_2f; + for ( i=0; i < texcoords.get_node_list().size(); i++ ) { + Point3D node = texcoords.get_node_list()[i]; + texcoords_2f.push_back( node.toSGVec2f() ); + } SGBinObject obj; obj.set_gbs_center( gbs_center ); obj.set_gbs_radius( gbs_radius ); obj.set_wgs84_nodes( wgs84_nodes ); - obj.set_normals( normals.get_node_list() ); - obj.set_texcoords( texcoords.get_node_list() ); + obj.set_normals( normals_3f ); + obj.set_texcoords( texcoords_2f ); obj.set_pts_v( pts_v ); obj.set_pts_n( pts_n ); obj.set_pt_materials( pt_materials ); diff --git a/src/Airports/GenAirports/lights.cxx b/src/Airports/GenAirports/lights.cxx index f5171818..2c62d363 100644 --- a/src/Airports/GenAirports/lights.cxx +++ b/src/Airports/GenAirports/lights.cxx @@ -35,6 +35,7 @@ using std::cout; using std::endl; +using std::string; // calculate the runway light direction vector. We take the center of diff --git a/src/Airports/GenAirports/point2d.hxx b/src/Airports/GenAirports/point2d.hxx index f509ac68..ebd36274 100644 --- a/src/Airports/GenAirports/point2d.hxx +++ b/src/Airports/GenAirports/point2d.hxx @@ -27,7 +27,7 @@ #include -#include +#include // convert a point from cartesian to polar coordinates diff --git a/src/Airports/GenAirports/poly_extra.hxx b/src/Airports/GenAirports/poly_extra.hxx index 0c27c136..a56a2eaf 100644 --- a/src/Airports/GenAirports/poly_extra.hxx +++ b/src/Airports/GenAirports/poly_extra.hxx @@ -26,7 +26,7 @@ #define _POLY_EXTRA_HXX -#include +#include #include #include diff --git a/src/Airports/GenAirports/runway.hxx b/src/Airports/GenAirports/runway.hxx index a023087f..2d6e6aaf 100644 --- a/src/Airports/GenAirports/runway.hxx +++ b/src/Airports/GenAirports/runway.hxx @@ -29,13 +29,13 @@ #include #include -#include +#include #include struct TGRunway { - string rwy_no; + std::string rwy_no; double lon; double lat; @@ -47,9 +47,9 @@ struct TGRunway { double stopway1; double stopway2; - string lighting_flags; + std::string lighting_flags; int surface_code; - string shoulder_code; + std::string shoulder_code; int marking_code; double smoothness; bool dist_remaining; @@ -69,7 +69,7 @@ struct TGRunway { }; -typedef vector < TGRunway > runway_list; +typedef std::vector < TGRunway > runway_list; typedef runway_list::iterator runway_list_iterator; typedef runway_list::const_iterator const_runway_list_iterator; diff --git a/src/Airports/GenAirports/rwy_common.cxx b/src/Airports/GenAirports/rwy_common.cxx index 0f26f918..c9339a26 100644 --- a/src/Airports/GenAirports/rwy_common.cxx +++ b/src/Airports/GenAirports/rwy_common.cxx @@ -29,6 +29,8 @@ #include "poly_extra.hxx" #include "rwy_common.hxx" +using std::string; + void gen_number_block( const TGRunway& rwy_info, const string& material, diff --git a/src/Airports/GenAirports/rwy_common.hxx b/src/Airports/GenAirports/rwy_common.hxx index 5ae6b41c..7521fc84 100644 --- a/src/Airports/GenAirports/rwy_common.hxx +++ b/src/Airports/GenAirports/rwy_common.hxx @@ -34,7 +34,7 @@ void gen_number_block( const TGRunway& rwy_info, - const string& material, + const std::string& material, TGPolygon poly, double heading, int num, double start_pct, double end_pct, superpoly_list *rwy_polys, @@ -45,7 +45,7 @@ void gen_number_block( const TGRunway& rwy_info, void gen_runway_stopway( const TGRunway& rwy_info, const TGPolygon& runway_a, const TGPolygon& runway_b, - const string& prefix, + const std::string& prefix, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon* accum ); @@ -57,8 +57,8 @@ void gen_runway_section( const TGRunway& rwy_info, double startw_pct, double endw_pct, double minu, double maxu, double minv, double maxv, double heading, - const string& prefix, - const string& material, + const std::string& prefix, + const std::string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); diff --git a/src/Airports/GenAirports/rwy_nonprec.cxx b/src/Airports/GenAirports/rwy_nonprec.cxx index 58a3b91e..ddf62680 100644 --- a/src/Airports/GenAirports/rwy_nonprec.cxx +++ b/src/Airports/GenAirports/rwy_nonprec.cxx @@ -28,6 +28,8 @@ #include "rwy_common.hxx" #include "rwy_nonprec.hxx" +using std::string; + // generate a non-precision approach runway. The routine modifies // rwy_polys, texparams, and accum. For specific details and diff --git a/src/Airports/GenAirports/rwy_nonprec.hxx b/src/Airports/GenAirports/rwy_nonprec.hxx index c6f9745c..b7c70790 100644 --- a/src/Airports/GenAirports/rwy_nonprec.hxx +++ b/src/Airports/GenAirports/rwy_nonprec.hxx @@ -40,7 +40,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info, double alt_m, - const string& material, + const std::string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); diff --git a/src/Airports/GenAirports/rwy_prec.cxx b/src/Airports/GenAirports/rwy_prec.cxx index 6ee9bf52..c98c6b0a 100644 --- a/src/Airports/GenAirports/rwy_prec.cxx +++ b/src/Airports/GenAirports/rwy_prec.cxx @@ -28,6 +28,8 @@ #include "rwy_common.hxx" #include "rwy_nonprec.hxx" +using std::string; + // generate a precision approach runway. The routine modifies // rwy_polys, texparams, and accum. For specific details and diff --git a/src/Airports/GenAirports/rwy_prec.hxx b/src/Airports/GenAirports/rwy_prec.hxx index 46862142..313b7ae5 100644 --- a/src/Airports/GenAirports/rwy_prec.hxx +++ b/src/Airports/GenAirports/rwy_prec.hxx @@ -40,7 +40,7 @@ void gen_precision_rwy( const TGRunway& rwy_info, double alt_m, - const string& material, + const std::string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); diff --git a/src/Airports/GenAirports/rwy_simple.cxx b/src/Airports/GenAirports/rwy_simple.cxx index eafe516b..d88f42d4 100644 --- a/src/Airports/GenAirports/rwy_simple.cxx +++ b/src/Airports/GenAirports/rwy_simple.cxx @@ -31,6 +31,8 @@ #include "texparams.hxx" #include "rwy_nonprec.hxx" +using std::string; + // generate a simple runway. The routine modifies rwy_polys, // texparams, and accum diff --git a/src/Airports/GenAirports/rwy_simple.hxx b/src/Airports/GenAirports/rwy_simple.hxx index 126d8ebc..6b3183ab 100644 --- a/src/Airports/GenAirports/rwy_simple.hxx +++ b/src/Airports/GenAirports/rwy_simple.hxx @@ -37,7 +37,7 @@ // texparams, and accum void gen_simple_rwy( const TGRunway& rwy_info, double alt_m, - const string& material, + const std::string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); diff --git a/src/Airports/GenAirports/rwy_visual.cxx b/src/Airports/GenAirports/rwy_visual.cxx index 3b071f54..06fff338 100644 --- a/src/Airports/GenAirports/rwy_visual.cxx +++ b/src/Airports/GenAirports/rwy_visual.cxx @@ -29,6 +29,8 @@ #include "rwy_common.hxx" #include "rwy_visual.hxx" +using std::string; + // generate a visual approach runway. The routine modifies rwy_polys, // texparams, and accum. For specific details and dimensions of diff --git a/src/Airports/GenAirports/rwy_visual.hxx b/src/Airports/GenAirports/rwy_visual.hxx index 060defb2..897aae69 100644 --- a/src/Airports/GenAirports/rwy_visual.hxx +++ b/src/Airports/GenAirports/rwy_visual.hxx @@ -40,7 +40,7 @@ void gen_visual_rwy( const TGRunway& rwy_info, double alt_m, - const string& material, + const std::string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); diff --git a/src/Airports/GenAirports/taxiway.cxx b/src/Airports/GenAirports/taxiway.cxx index e5f72f4e..d62f1c95 100644 --- a/src/Airports/GenAirports/taxiway.cxx +++ b/src/Airports/GenAirports/taxiway.cxx @@ -31,6 +31,8 @@ #include "texparams.hxx" #include "taxiway.hxx" +using std::string; + // generate a taxiway. The routine modifies rwy_polys, texparams, and // accum diff --git a/src/Airports/GenAirports/taxiway.hxx b/src/Airports/GenAirports/taxiway.hxx index 8fb70c43..b6ed7dcf 100644 --- a/src/Airports/GenAirports/taxiway.hxx +++ b/src/Airports/GenAirports/taxiway.hxx @@ -37,7 +37,7 @@ // accum void gen_taxiway( const TGRunway& rwy_info, double alt_m, - const string& material, + const std::string& material, superpoly_list *rwy_polys, texparams_list *texparams, TGPolygon *accum ); diff --git a/src/BuildTiles/Clipper/clipper.cxx b/src/BuildTiles/Clipper/clipper.cxx index 69e6f657..03d7f698 100644 --- a/src/BuildTiles/Clipper/clipper.cxx +++ b/src/BuildTiles/Clipper/clipper.cxx @@ -41,6 +41,7 @@ using std::cout; using std::endl; +using std::string; #define MASK_CLIP 1 diff --git a/src/BuildTiles/Clipper/testclipper.cxx b/src/BuildTiles/Clipper/testclipper.cxx index 6b0a2c0e..d0bdf1a6 100644 --- a/src/BuildTiles/Clipper/testclipper.cxx +++ b/src/BuildTiles/Clipper/testclipper.cxx @@ -29,6 +29,7 @@ using std::cout; using std::endl; +using std::string; int main( int argc, char **argv ) { diff --git a/src/BuildTiles/GenOutput/genobj.cxx b/src/BuildTiles/GenOutput/genobj.cxx index 1eb3c699..d2b41762 100644 --- a/src/BuildTiles/GenOutput/genobj.cxx +++ b/src/BuildTiles/GenOutput/genobj.cxx @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -38,33 +39,20 @@ using std::cout; using std::endl; +using std::string; // calculate the global bounding sphere. Center is the center of the // tile and zero elevation void TGGenOutput::calc_gbs( TGConstruct& c ) { - double dist_squared; - double radius_squared = 0; - - SGBucket b = c.get_bucket(); - - Point3D p( b.get_center_lon() * SGD_DEGREES_TO_RADIANS, - b.get_center_lat() * SGD_DEGREES_TO_RADIANS, - 0 ); - - gbs_center = sgGeodToCart(p); - point_list wgs84_nodes = c.get_wgs84_nodes(); - const_point_list_iterator current = wgs84_nodes.begin(); - const_point_list_iterator last = wgs84_nodes.end(); - for ( ; current != last; ++current ) { - dist_squared = gbs_center.distance3Dsquared(*current); - if ( dist_squared > radius_squared ) { - radius_squared = dist_squared; - } + SGSphered d; + for ( int i = 0; i < wgs84_nodes.size(); ++i ) { + d.expandBy(wgs84_nodes[ i ].toSGVec3d()); } - - gbs_radius = sqrt(radius_squared); + + gbs_center = d.getCenter(); + gbs_radius = d.getRadius(); } @@ -203,27 +191,38 @@ int TGGenOutput::build( TGConstruct& c ) { // cout << fans[i][j].size() << " === " // << t_list.size() << endl; SGBucket b = c.get_bucket(); - point_list tp_list; Point3D ourPosition; ourPosition.setlon(b.get_chunk_lon()); ourPosition.setlat(b.get_chunk_lat()); + int_list ti_list; + ti_list.clear(); //dcl - here read the flag to check if we are building UK grid //If so - check if the bucket is within the UK lat & lon if( (c.get_useUKGrid()) && (isInUK(ourPosition)) ) { + point_list tp_list; tp_list = UK_calc_tex_coords( b, geod_nodes, fans[i][j], 1.0 ); + for ( int k = 0; k < (int)tp_list.size(); ++k ) { + // cout << " tc = " << tp_list[k] << endl; + int index = tex_coords.simple_add( tp_list[k] ); + ti_list.push_back( index ); + } } else { - tp_list = sgCalcTexCoords( b, geod_nodes, fans[i][j] ); + std::vector < SGGeod > convGeodNodes; + for ( j = 0; j < geod_nodes.size(); j++ ) { + Point3D node = geod_nodes[j]; + convGeodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); + } + std::vector< SGVec2f > tp_list = sgCalcTexCoords( b, convGeodNodes, fans[i][j] ); + for ( j = 0; j < (int)tp_list.size(); ++j ) { + SGVec2f tc = tp_list[j]; + // SG_LOG(SG_GENERAL, SG_DEBUG, "base_tc = " << tc); + int index = tex_coords.simple_add( Point3D( tc.x(), tc.y(), 0 ) ); + ti_list.push_back( index ); + } } - int_list ti_list; - ti_list.clear(); - for ( int k = 0; k < (int)tp_list.size(); ++k ) { - // cout << " tc = " << tp_list[k] << endl; - int index = tex_coords.simple_add( tp_list[k] ); - ti_list.push_back( index ); - } textures[i].push_back( ti_list ); } } @@ -455,14 +454,26 @@ int TGGenOutput::write( TGConstruct &c ) { string name = b.gen_index_str(); name += ".btg"; - point_list wgs84_nodes = c.get_wgs84_nodes(); - point_list normals = c.get_point_normals(); + std::vector< SGVec3d > wgs84_nodes; + for ( i = 0; i < c.get_wgs84_nodes().size(); i++ ) { + Point3D node = c.get_wgs84_nodes()[i]; + wgs84_nodes.push_back( node.toSGVec3d() ); + } + std::vector< SGVec3f > normals; + for ( i = 0; i < c.get_point_normals().size(); i++ ) { + Point3D node = c.get_point_normals()[i]; + normals.push_back( node.toSGVec3f() ); + } cout << "dumping normals = " << normals.size() << endl; /* for ( i = 0; i < (int)normals.size(); ++i ) { Point3D p = normals[i]; printf("vn %.5f %.5f %.5f\n", p.x(), p.y(), p.z()); } */ - point_list texcoords = tex_coords.get_node_list(); + std::vector< SGVec2f > texcoords; + for ( i = 0; i < tex_coords.get_node_list().size(); i++ ) { + Point3D node = tex_coords.get_node_list()[i]; + texcoords.push_back( node.toSGVec2f() ); + } // allocate and initialize triangle group structures group_list tris_v; group_list tris_tc; string_list tri_materials; diff --git a/src/BuildTiles/GenOutput/genobj.hxx b/src/BuildTiles/GenOutput/genobj.hxx index 3a4ff16b..6438650c 100644 --- a/src/BuildTiles/GenOutput/genobj.hxx +++ b/src/BuildTiles/GenOutput/genobj.hxx @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include @@ -66,7 +66,7 @@ private: tex_list textures[TG_MAX_AREA_TYPES]; // global bounding sphere - Point3D gbs_center; + SGVec3d gbs_center; double gbs_radius; // calculate the global bounding sphere. Center is the average of diff --git a/src/BuildTiles/Main/main.cxx b/src/BuildTiles/Main/main.cxx index 542fd841..f666187e 100644 --- a/src/BuildTiles/Main/main.cxx +++ b/src/BuildTiles/Main/main.cxx @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -444,6 +443,14 @@ static double distance2D( const Point3D p1, const Point3D p2 ) { return sqrt( dx*dx + dy*dy ); } +inline void calc_gc_course_dist( const Point3D& start, const Point3D& dest, + double *course, double *dist ) +{ + SGGeoc gs = start.toSGGeoc(); + SGGeoc gd = dest.toSGGeoc(); + *course = SGGeoc::courseRad(gs, gd); + *dist = SGGeoc::distanceM(gs, gd); +} // calculate spherical distance between two points (lon, lat specified // in degrees, result returned in meters) diff --git a/src/BuildTiles/Match/match.cxx b/src/BuildTiles/Match/match.cxx index 2bbc7a28..cf35c929 100644 --- a/src/BuildTiles/Match/match.cxx +++ b/src/BuildTiles/Match/match.cxx @@ -26,7 +26,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/BuildTiles/Match/match.hxx b/src/BuildTiles/Match/match.hxx index 6a9c65c6..4332c2f9 100644 --- a/src/BuildTiles/Match/match.hxx +++ b/src/BuildTiles/Match/match.hxx @@ -89,7 +89,7 @@ public: void load_missing_shared( TGConstruct& c ); // scan the specified share file for the specified information - void scan_share_file( const string& dir, const SGBucket& b, + void scan_share_file( const std::string& dir, const SGBucket& b, neighbor_type search, neighbor_type dest ); // try to find info for the specified shared component diff --git a/src/BuildTiles/Osgb36/osgb36.hxx b/src/BuildTiles/Osgb36/osgb36.hxx index bd65aad2..0cd757c0 100644 --- a/src/BuildTiles/Osgb36/osgb36.hxx +++ b/src/BuildTiles/Osgb36/osgb36.hxx @@ -19,7 +19,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include +#include //******************************************************************* // diff --git a/src/BuildTiles/Osgb36/osgbtc.hxx b/src/BuildTiles/Osgb36/osgbtc.hxx index 9bb0dd5d..7438b7e6 100644 --- a/src/BuildTiles/Osgb36/osgbtc.hxx +++ b/src/BuildTiles/Osgb36/osgbtc.hxx @@ -3,7 +3,7 @@ #include -#include +#include #include diff --git a/src/BuildTiles/Osgb36/testosgb36.cxx b/src/BuildTiles/Osgb36/testosgb36.cxx index 1ba98cef..7e889029 100644 --- a/src/BuildTiles/Osgb36/testosgb36.cxx +++ b/src/BuildTiles/Osgb36/testosgb36.cxx @@ -1,5 +1,5 @@ #include -#include +#include #include diff --git a/src/BuildTiles/Osgb36/uk.hxx b/src/BuildTiles/Osgb36/uk.hxx index cf1db277..55f40eac 100644 --- a/src/BuildTiles/Osgb36/uk.hxx +++ b/src/BuildTiles/Osgb36/uk.hxx @@ -18,7 +18,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#include +#include //Returns true if a point is within the mainland UK, excluding //Northern Ireland. Requires lat and lon to be passed in degrees. diff --git a/src/BuildTiles/Triangulate/triangle.cxx b/src/BuildTiles/Triangulate/triangle.cxx index fa20d87d..b341eac4 100644 --- a/src/BuildTiles/Triangulate/triangle.cxx +++ b/src/BuildTiles/Triangulate/triangle.cxx @@ -30,6 +30,7 @@ using std::cout; using std::endl; +using std::string; // Constructor diff --git a/src/BuildTiles/Triangulate/triangle.hxx b/src/BuildTiles/Triangulate/triangle.hxx index 5ccf8c19..20ac71c0 100644 --- a/src/BuildTiles/Triangulate/triangle.hxx +++ b/src/BuildTiles/Triangulate/triangle.hxx @@ -31,7 +31,7 @@ #include -#include +#include #include #include
diff --git a/src/Lib/Array/Makefile.am b/src/Lib/Array/Makefile.am index 4b8cf3d0..10636d51 100644 --- a/src/Lib/Array/Makefile.am +++ b/src/Lib/Array/Makefile.am @@ -12,4 +12,4 @@ testarray_LDADD = \ -lsgbucket -lsgmath -lsgmisc -lsgdebug -lsgxml \ $(support_LIBS) -lz -INCLUDES = -I$(top_srcdir)/src +INCLUDES = -I$(top_srcdir)/src/Lib diff --git a/src/Lib/Array/array.hxx b/src/Lib/Array/array.hxx index 972274ff..ec5462d1 100644 --- a/src/Lib/Array/array.hxx +++ b/src/Lib/Array/array.hxx @@ -36,7 +36,7 @@ #include #include -#include +#include #include #include @@ -74,13 +74,13 @@ public: // Constructor TGArray( void ); - TGArray( const string& file ); + TGArray( const std::string& file ); // Destructor ~TGArray( void ); // open an Array file (use "-" if input is coming from stdin) - bool open ( const string& file_base ); + bool open ( const std::string& file_base ); // return if array was successfully opened or not inline bool is_open() { @@ -98,7 +98,7 @@ public: bool parse( SGBucket& b ); // write an Array file - bool write( const string root_dir, SGBucket& b ); + bool write( const std::string root_dir, SGBucket& b ); // do our best to remove voids by picking data from the nearest // neighbor. diff --git a/src/Lib/Array/testarray.cxx b/src/Lib/Array/testarray.cxx index c0af429f..776dbaf1 100644 --- a/src/Lib/Array/testarray.cxx +++ b/src/Lib/Array/testarray.cxx @@ -13,6 +13,7 @@ using std::cout; using std::endl; +using std::string; #ifdef _MSC_VER #define M_ISDIR _S_IFDIR diff --git a/src/Lib/Geometry/line.hxx b/src/Lib/Geometry/line.hxx index b4e89ea1..1700580c 100644 --- a/src/Lib/Geometry/line.hxx +++ b/src/Lib/Geometry/line.hxx @@ -12,7 +12,7 @@ #endif #include -#include +#include #include diff --git a/src/Lib/Geometry/point3d.hxx b/src/Lib/Geometry/point3d.hxx new file mode 100644 index 00000000..03c7c043 --- /dev/null +++ b/src/Lib/Geometry/point3d.hxx @@ -0,0 +1,460 @@ +/** + * \file point3d.hxx + * A 3d point class (depricated). This class is depricated and we are + * in the process of removing all usage of it in favor of plib's "sg" + * library of point, vector, and math routines. Plib's sg lib is less + * object oriented, but integrates more seamlessly with opengl. + * + * Adapted from algebra3 by Jean-Francois Doue, started October 1998. + */ + +// Copyright (C) 1998 Curtis L. Olson - http://www.flightgear.org/~curt +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Library General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Library General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// $Id$ + + +#ifndef _POINT3D_HXX +#define _POINT3D_HXX + + +#ifndef __cplusplus +# error This library requires C++ +#endif + +#include + +#include +#include +#include +#include +#include + +#include + + +const double fgPoint3_Epsilon = 0.0000001; + +enum {PX, PY, PZ}; // axes + +// Kludge for msvc++ 6.0 - requires forward decls of friend functions. +class Point3D; +std::istream& operator>> ( std::istream&, Point3D& ); +std::ostream& operator<< ( std::ostream&, const Point3D& ); +Point3D operator- (const Point3D& p); // -p1 +bool operator== (const Point3D& a, const Point3D& b); // p1 == p2? + + +/** + * 3D Point class. + */ + +class Point3D { + +protected: + + double n[3]; + +public: + + /** Default constructor */ + Point3D(); + Point3D(const double x, const double y, const double z); + explicit Point3D(const double d); + Point3D(const Point3D &p); + + static Point3D fromSGGeod(const SGGeod& geod); + static Point3D fromSGGeoc(const SGGeoc& geoc); + static Point3D fromSGVec3(const SGVec3& cart); + static Point3D fromSGVec3(const SGVec3& cart); + static Point3D fromSGVec2(const SGVec2& cart); + + // Assignment operators + + Point3D& operator = ( const Point3D& p ); // assignment of a Point3D + Point3D& operator += ( const Point3D& p ); // incrementation by a Point3D + Point3D& operator -= ( const Point3D& p ); // decrementation by a Point3D + Point3D& operator *= ( const double d ); // multiplication by a constant + Point3D& operator /= ( const double d ); // division by a constant + + void setx(const double x); + void sety(const double y); + void setz(const double z); + void setlon(const double x); + void setlat(const double y); + void setradius(const double z); + void setelev(const double z); + + // Queries + + double& operator [] ( int i); // indexing + double operator[] (int i) const; // read-only indexing + + inline const double *get_n() const { return n; }; + double x() const; // cartesian x + double y() const; // cartesian y + double z() const; // cartesian z + + double lon() const; // polar longitude + double lat() const; // polar latitude + double radius() const; // polar radius + double elev() const; // geodetic elevation (if specifying a surface point) + + SGGeod toSGGeod(void) const; + SGGeoc toSGGeoc(void) const; + + SGVec3d toSGVec3d(void) const; + SGVec3f toSGVec3f(void) const; + SGVec2f toSGVec2f(void) const; + + // friends + friend Point3D operator - (const Point3D& p); // -p1 + friend bool operator == (const Point3D& a, const Point3D& b); // p1 == p2? + friend std::istream& operator>> ( std::istream&, Point3D& ); + friend std::ostream& operator<< ( std::ostream&, const Point3D& ); + + // Special functions + double distance3D(const Point3D& a) const; // distance between + double distance3Dsquared(const Point3D& a) const; // distance between ^ 2 +}; + + +// input from stream +inline std::istream& +operator >> ( std::istream& in, Point3D& p) +{ + char c; + + in >> p.n[PX]; + + // read past optional comma + while ( in.get(c) ) { + if ( (c != ' ') && (c != ',') ) { + // push back on the stream + in.putback(c); + break; + } + } + + in >> p.n[PY]; + + // read past optional comma + while ( in.get(c) ) { + if ( (c != ' ') && (c != ',') ) { + // push back on the stream + in.putback(c); + break; + } + } + + in >> p.n[PZ]; + + return in; +} + +inline std::ostream& +operator<< ( std::ostream& out, const Point3D& p ) +{ + return out << p.n[PX] << ", " << p.n[PY] << ", " << p.n[PZ]; +} + +/////////////////////////// +// +// Point3D Member functions +// +/////////////////////////// + +// CONSTRUCTORS + +inline Point3D::Point3D() +{ + n[PX] = n[PY] = 0.0; + n[PZ] = -9999.0; +} + +inline Point3D::Point3D(const double x, const double y, const double z) +{ + n[PX] = x; n[PY] = y; n[PZ] = z; +} + +inline Point3D::Point3D(const double d) +{ + n[PX] = n[PY] = n[PZ] = d; +} + +inline Point3D::Point3D(const Point3D& p) +{ + n[PX] = p.n[PX]; n[PY] = p.n[PY]; n[PZ] = p.n[PZ]; +} + +inline Point3D Point3D::fromSGGeod(const SGGeod& geod) +{ + Point3D pt; + pt.setlon(geod.getLongitudeRad()); + pt.setlat(geod.getLatitudeRad()); + pt.setelev(geod.getElevationM()); + return pt; +} + +inline Point3D Point3D::fromSGGeoc(const SGGeoc& geoc) +{ + Point3D pt; + pt.setlon(geoc.getLongitudeRad()); + pt.setlat(geoc.getLatitudeRad()); + pt.setradius(geoc.getRadiusM()); + return pt; +} + +inline Point3D Point3D::fromSGVec3(const SGVec3& cart) +{ + Point3D pt; + pt.setx(cart.x()); + pt.sety(cart.y()); + pt.setz(cart.z()); + return pt; +} + +inline Point3D Point3D::fromSGVec3(const SGVec3& cart) +{ + Point3D pt; + pt.setx(cart.x()); + pt.sety(cart.y()); + pt.setz(cart.z()); + return pt; +} + +inline Point3D Point3D::fromSGVec2(const SGVec2& cart) +{ + Point3D pt; + pt.setx(cart.x()); + pt.sety(cart.y()); + pt.setz(0); + return pt; +} + +// ASSIGNMENT OPERATORS + +inline Point3D& Point3D::operator = (const Point3D& p) +{ + n[PX] = p.n[PX]; n[PY] = p.n[PY]; n[PZ] = p.n[PZ]; return *this; +} + +inline Point3D& Point3D::operator += ( const Point3D& p ) +{ + n[PX] += p.n[PX]; n[PY] += p.n[PY]; n[PZ] += p.n[PZ]; return *this; +} + +inline Point3D& Point3D::operator -= ( const Point3D& p ) +{ + n[PX] -= p.n[PX]; n[PY] -= p.n[PY]; n[PZ] -= p.n[PZ]; return *this; +} + +inline Point3D& Point3D::operator *= ( const double d ) +{ + n[PX] *= d; n[PY] *= d; n[PZ] *= d; return *this; +} + +inline Point3D& Point3D::operator /= ( const double d ) +{ + double d_inv = 1./d; n[PX] *= d_inv; n[PY] *= d_inv; n[PZ] *= d_inv; + return *this; +} + +inline void Point3D::setx(const double x) { + n[PX] = x; +} + +inline void Point3D::sety(const double y) { + n[PY] = y; +} + +inline void Point3D::setz(const double z) { + n[PZ] = z; +} + +inline void Point3D::setlon(const double x) { + n[PX] = x; +} + +inline void Point3D::setlat(const double y) { + n[PY] = y; +} + +inline void Point3D::setradius(const double z) { + n[PZ] = z; +} + +inline void Point3D::setelev(const double z) { + n[PZ] = z; +} + +// QUERIES + +inline double& Point3D::operator [] ( int i) +{ + assert(! (i < PX || i > PZ)); + return n[i]; +} + +inline double Point3D::operator [] ( int i) const { + assert(! (i < PX || i > PZ)); + return n[i]; +} + + +inline double Point3D::x() const { return n[PX]; } + +inline double Point3D::y() const { return n[PY]; } + +inline double Point3D::z() const { return n[PZ]; } + +inline double Point3D::lon() const { return n[PX]; } + +inline double Point3D::lat() const { return n[PY]; } + +inline double Point3D::radius() const { return n[PZ]; } + +inline double Point3D::elev() const { return n[PZ]; } + +inline SGGeod Point3D::toSGGeod(void) const +{ + SGGeod geod; + geod.setLongitudeRad(lon()); + geod.setLatitudeRad(lat()); + geod.setElevationM(elev()); + return geod; +} + +inline SGGeoc Point3D::toSGGeoc(void) const +{ + SGGeoc geoc; + geoc.setLongitudeRad(lon()); + geoc.setLatitudeRad(lat()); + geoc.setRadiusM(radius()); + return geoc; +} + +inline SGVec3d Point3D::toSGVec3d(void) const +{ + return SGVec3d(x(), y(), z()); +} + +inline SGVec3f Point3D::toSGVec3f(void) const +{ + return SGVec3f(x(), y(), z()); +} + +inline SGVec2f Point3D::toSGVec2f(void) const +{ + return SGVec2f(x(), y()); +} + +// FRIENDS + +inline Point3D operator - (const Point3D& a) +{ + return Point3D(-a.n[PX],-a.n[PY],-a.n[PZ]); +} + +inline Point3D operator + (const Point3D& a, const Point3D& b) +{ + return Point3D(a) += b; +} + +inline Point3D operator - (const Point3D& a, const Point3D& b) +{ + return Point3D(a) -= b; +} + +inline Point3D operator * (const Point3D& a, const double d) +{ + return Point3D(a) *= d; +} + +inline Point3D operator * (const double d, const Point3D& a) +{ + return a*d; +} + +inline Point3D operator / (const Point3D& a, const double d) +{ + return Point3D(a) *= (1.0 / d ); +} + +inline bool operator == (const Point3D& a, const Point3D& b) +{ + return + fabs(a.n[PX] - b.n[PX]) < fgPoint3_Epsilon && + fabs(a.n[PY] - b.n[PY]) < fgPoint3_Epsilon && + fabs(a.n[PZ] - b.n[PZ]) < fgPoint3_Epsilon; +} + +inline bool operator != (const Point3D& a, const Point3D& b) +{ + return !(a == b); +} + +// Special functions + +inline double +Point3D::distance3D(const Point3D& a ) const +{ + double x, y, z; + + x = n[PX] - a.n[PX]; + y = n[PY] - a.n[PY]; + z = n[PZ] - a.n[PZ]; + + return sqrt(x*x + y*y + z*z); +} + + +inline double +Point3D::distance3Dsquared(const Point3D& a ) const +{ + double x, y, z; + + x = n[PX] - a.n[PX]; + y = n[PY] - a.n[PY]; + z = n[PZ] - a.n[PZ]; + + return(x*x + y*y + z*z); +} + + +typedef std::vector< Point3D > point_list; + +typedef point_list::iterator point_list_iterator; + +typedef point_list::const_iterator const_point_list_iterator; + +inline Point3D sgCartToGeod( const Point3D& p ) +{ + SGGeod geod; + SGGeodesy::SGCartToGeod(SGVec3d(p.x(), p.y(), p.z()), geod); + return Point3D::fromSGGeod(geod); +} + +inline Point3D sgGeodToCart(const Point3D& geod) +{ + SGVec3 cart; + SGGeodesy::SGGeodToCart(SGGeod::fromRadM(geod.lon(), geod.lat(), geod.elev()), cart); + return Point3D::fromSGVec3(cart); +} + +#endif // _POINT3D_HXX + + diff --git a/src/Lib/Geometry/poly_support.cxx b/src/Lib/Geometry/poly_support.cxx index d41d7b70..24d9fd46 100644 --- a/src/Lib/Geometry/poly_support.cxx +++ b/src/Lib/Geometry/poly_support.cxx @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -49,11 +49,12 @@ extern "C" { #include "trinodes.hxx" #include "trisegs.hxx" +using std::copy; using std::cout; using std::endl; -using std::sort; -using std::copy; using std::ostream_iterator; +using std::sort; +using std::vector; // Given a line segment specified by two endpoints p1 and p2, return // the slope of the line. @@ -429,6 +430,13 @@ static void write_tree_element( TGContourNode *node, TGPolygon& p, int hole=0) { } } +class Point3DYOrdering { +public: + bool operator()(const Point3D& a, const Point3D& b) const { + return a.y() -#include +#include #include diff --git a/src/Lib/Geometry/trinodes.hxx b/src/Lib/Geometry/trinodes.hxx index 75927eb4..6998a73c 100644 --- a/src/Lib/Geometry/trinodes.hxx +++ b/src/Lib/Geometry/trinodes.hxx @@ -31,7 +31,7 @@ #include -#include +#include #include diff --git a/src/Lib/Geometry/trisegs.cxx b/src/Lib/Geometry/trisegs.cxx index a9fcc5dc..bcaa3b2c 100644 --- a/src/Lib/Geometry/trisegs.cxx +++ b/src/Lib/Geometry/trisegs.cxx @@ -22,7 +22,7 @@ #include #include -#include +#include #include diff --git a/src/Lib/Geometry/util.cxx b/src/Lib/Geometry/util.cxx index 1ad947a7..eb67be22 100644 --- a/src/Lib/Geometry/util.cxx +++ b/src/Lib/Geometry/util.cxx @@ -12,6 +12,8 @@ #include +using std::vector; + namespace tg { diff --git a/src/Lib/Geometry/util.hxx b/src/Lib/Geometry/util.hxx index 7c0c985f..f82f97ac 100644 --- a/src/Lib/Geometry/util.hxx +++ b/src/Lib/Geometry/util.hxx @@ -12,7 +12,7 @@ #endif #include -#include +#include #include diff --git a/src/Lib/Output/output.hxx b/src/Lib/Output/output.hxx index db3be7a9..b77720ca 100644 --- a/src/Lib/Output/output.hxx +++ b/src/Lib/Output/output.hxx @@ -44,18 +44,18 @@ #include -void write_polygon( const TGPolygon& poly, const string& base ); +void write_polygon( const TGPolygon& poly, const std::string& base ); // update index file (list of objects to be included in final scenery build) -void write_index( const string& base, const SGBucket& b, const string& name ); +void write_index( const std::string& base, const SGBucket& b, const std::string& name ); // update index file (list of shared objects to be included in final // scenery build) -void write_index_shared( const string &base, const SGBucket &b, - const Point3D &p, const string& name, +void write_index_shared( const std::string &base, const SGBucket &b, + const Point3D &p, const std::string& name, const double &heading ); -void write_boundary( const string& base, const SGBucket& b, +void write_boundary( const std::string& base, const SGBucket& b, const TGPolygon& bounds, long int p_index ); #endif // _TG_OUTPUT_HXX diff --git a/src/Lib/Polygon/chop.hxx b/src/Lib/Polygon/chop.hxx index 4530684e..52eed6f0 100644 --- a/src/Lib/Polygon/chop.hxx +++ b/src/Lib/Polygon/chop.hxx @@ -27,12 +27,14 @@ #define _TG_CHOP_HXX +#include + #include "polygon.hxx" // process polygon shape (chop up along tile boundaries and write each // polygon piece to a file) -void tgChopNormalPolygon( const string& path, const string& poly_type, +void tgChopNormalPolygon( const std::string& path, const std::string& poly_type, const TGPolygon& shape, bool preserve3d ); @@ -40,7 +42,7 @@ void tgChopNormalPolygon( const string& path, const string& poly_type, // polygon piece to a file) This has a front end to a crude clipper // that doesn't handle holes so beware. This routine is appropriate // for breaking down really huge structures if needed. -void tgChopBigSimplePolygon( const string& path, const string& poly_type, +void tgChopBigSimplePolygon( const std::string& path, const std::string& poly_type, const TGPolygon& shape, bool preserve3d ); #endif // _TG_CHOP_HXX diff --git a/src/Lib/Polygon/polygon.cxx b/src/Lib/Polygon/polygon.cxx index 23cdb844..a19dabd7 100644 --- a/src/Lib/Polygon/polygon.cxx +++ b/src/Lib/Polygon/polygon.cxx @@ -31,7 +31,7 @@ extern "C" { #include #include -#include +#include #include #include diff --git a/src/Lib/Polygon/polygon.hxx b/src/Lib/Polygon/polygon.hxx index d0d45eb2..1e322e56 100644 --- a/src/Lib/Polygon/polygon.hxx +++ b/src/Lib/Polygon/polygon.hxx @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include diff --git a/src/Prep/GSHHS/gshhs_split.hxx b/src/Prep/GSHHS/gshhs_split.hxx index 2e82bac8..86bcccb1 100644 --- a/src/Prep/GSHHS/gshhs_split.hxx +++ b/src/Prep/GSHHS/gshhs_split.hxx @@ -24,6 +24,7 @@ #ifndef _GSHHS_SPLIT_HXX #define _GSHHS_SPLIT_HXX +#include #include @@ -31,13 +32,13 @@ // process shape front end ... split shape into lon = -180 ... 180, // -360 ... -180, and 180 ... 360 ... shift the offset sections and // process each separately -void split_and_shift_chunk( const string& path, const string& poly_type, +void split_and_shift_chunk( const std::string& path, const std::string& poly_type, const TGPolygon& shape ); // process a large shape through my crude polygon splitter to reduce // the polygon sizes before handing off to gpc -void gshhs_split_polygon( const string& path, const string& poly_type, TGPolygon& shape, +void gshhs_split_polygon( const std::string& path, const std::string& poly_type, TGPolygon& shape, const double min, const double max ); diff --git a/src/Prep/Photo/photo.cxx b/src/Prep/Photo/photo.cxx index c482ce91..a70e588b 100644 --- a/src/Prep/Photo/photo.cxx +++ b/src/Prep/Photo/photo.cxx @@ -35,7 +35,9 @@ #include #include #include -#include +#include +#include +#include #include #include @@ -237,31 +239,37 @@ int main( int argc, char **argv ) { } // wgs84 cartesian nodes - point_list wgs84_nodes; wgs84_nodes.clear(); + std::vector< SGVec3d > wgs84_nodes; wgs84_nodes.clear(); for ( i = 0; i < (int)geod_nodes.size(); ++i ) { - Point3D p = Point3D( geod_nodes[i].x() * SGD_DEGREES_TO_RADIANS, - geod_nodes[i].y() * SGD_DEGREES_TO_RADIANS, - geod_nodes[i].z() ); - cout << sgGeodToCart( p ) << endl; - wgs84_nodes.push_back( sgGeodToCart( p ) ); + SGGeod geod; + geod = SGGeod::fromDegM( geod_nodes[i].x(), geod_nodes[i].y(), geod_nodes[i].z() ); + SGVec3d cart = SGVec3d::fromGeod(geod); + cout << cart << endl; + wgs84_nodes.push_back( cart ); } // bounding sphere SGBucket b( (x0 + x2) / 2, (y0 + y2) / 2 ); - Point3D center_geod( b.get_center_lon() * SGD_DEGREES_TO_RADIANS, - b.get_center_lat() * SGD_DEGREES_TO_RADIANS, 0 ); - Point3D gbs_center = sgGeodToCart( center_geod ); + SGSphered d; + for ( i = 0; i < wgs84_nodes.size(); ++i ) { + d.expandBy(wgs84_nodes[ i ]); + } + + SGVec3d gbs_center = d.getCenter(); + double gbs_radius = d.getRadius(); cout << "gbs center = " << gbs_center << endl; - float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes ); // normals - point_list normals = wgs84_nodes; - sgdVec3 vn; - for ( i = 0; i < (int)normals.size(); ++i ) { - sgdSetVec3( vn, normals[i].x(), normals[i].y(), normals[i].z() ); - sgdNormalizeVec3( vn ); - normals[i] = Point3D( vn[0], vn[1], vn[2] ); - // cout << normals[i] << endl; + std::vector< SGVec3f > normals; + for ( i = 0; i < (int)wgs84_nodes.size(); ++i ) { + normals.push_back(toVec3f(normalize( wgs84_nodes[i] ))); + } + + const point_list &tc_nodes = texcoords.get_node_list(); + std::vector< SGVec2f > texcoords_vec; + for ( i = 0; i < (int)tc_nodes.size(); ++i ) + { + texcoords_vec.push_back( SGVec2f( tc_nodes[i].x(), tc_nodes[i].y() ) ); } // build the object @@ -281,7 +289,7 @@ int main( int argc, char **argv ) { obj.set_gbs_radius( gbs_radius ); obj.set_wgs84_nodes( wgs84_nodes ); obj.set_normals( normals ); - obj.set_texcoords( texcoords.get_node_list() ); + obj.set_texcoords( texcoords_vec ); obj.set_tris_v( tris_v ); obj.set_tris_tc( tris_tc ); obj.set_tri_materials( tri_materials ); diff --git a/src/Prep/UserDef/tguserdef.cxx b/src/Prep/UserDef/tguserdef.cxx index 773c15cb..b0b1af05 100644 --- a/src/Prep/UserDef/tguserdef.cxx +++ b/src/Prep/UserDef/tguserdef.cxx @@ -3,7 +3,7 @@ #endif #include -#include +#include #include #include #include diff --git a/src/Utils/poly2ogr/poly2ogr.cxx b/src/Utils/poly2ogr/poly2ogr.cxx index b5a772b5..02fa45fe 100644 --- a/src/Utils/poly2ogr/poly2ogr.cxx +++ b/src/Utils/poly2ogr/poly2ogr.cxx @@ -45,6 +45,8 @@ #include +using std::string; + typedef std::map LayerMap; const char* format_name="ESRI Shapefile"; @@ -265,7 +267,7 @@ void process_scenery_file(const std::string& path) { return; } - Point3D gbs_center = binObject.get_gbs_center(); + SGVec3d gbs_center = binObject.get_gbs_center(); const std::vector& wgs84_nodes = binObject.get_wgs84_nodes(); std::vector geod_nodes; const size_t node_count = wgs84_nodes.size();