From b408b351d093bb521c90eac2a4640a66fbf531ef Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sat, 2 Oct 2010 10:06:34 +0200 Subject: [PATCH 1/4] Fix index trashing --- src/BuildTiles/GenOutput/genobj.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/BuildTiles/GenOutput/genobj.cxx b/src/BuildTiles/GenOutput/genobj.cxx index d2b41762..a8f80d2e 100644 --- a/src/BuildTiles/GenOutput/genobj.cxx +++ b/src/BuildTiles/GenOutput/genobj.cxx @@ -209,14 +209,15 @@ int TGGenOutput::build( TGConstruct& c ) { ti_list.push_back( index ); } } else { + int k; std::vector < SGGeod > convGeodNodes; - for ( j = 0; j < geod_nodes.size(); j++ ) { - Point3D node = geod_nodes[j]; + for ( k = 0; k < geod_nodes.size(); k++ ) { + Point3D node = geod_nodes[k]; 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]; + for ( k = 0; k < (int)tp_list.size(); ++k ) { + SGVec2f tc = tp_list[k]; // 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 ); @@ -287,7 +288,7 @@ void TGGenOutput::calc_group_bounding_sphere( TGConstruct& c, } -// caclulate the bounding sphere for the specified triangle face +// calculate the bounding sphere for the specified triangle face void TGGenOutput::calc_bounding_sphere( TGConstruct& c, const TGTriEle& t, Point3D *center, double *radius ) { From dab333f858d422700b7db2d176a2f77f300a0d20 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sat, 2 Oct 2010 10:13:54 +0200 Subject: [PATCH 2/4] Fix MSVC90 projects --- projects/VC90/Array/Array.vcproj | 8 ++++---- projects/VC90/DEM/DEM.vcproj | 8 ++++---- projects/VC90/DemChop/DemChop.vcproj | 8 ++++---- projects/VC90/GenOutput/GenOutput.vcproj | 8 ++++---- projects/VC90/Geometry/Geometry.vcproj | 8 ++++---- projects/VC90/HGT/HGT.vcproj | 8 ++++---- projects/VC90/Match/Match.vcproj | 8 ++++---- projects/VC90/Optimize/Optimize.vcproj | 8 ++++---- projects/VC90/Output/Output.vcproj | 8 ++++---- projects/VC90/Polygon/Polygon.vcproj | 8 ++++---- projects/VC90/Terra/Terra.vcproj | 8 ++++---- projects/VC90/TriangleJRS/TriangleJRS.vcproj | 8 ++++---- projects/VC90/Triangulate/Triangulate.vcproj | 8 ++++---- projects/VC90/clipper/clipper.vcproj | 8 ++++---- projects/VC90/deminfo/deminfo.vcproj | 8 ++++---- projects/VC90/e00/e00.vcproj | 8 ++++---- projects/VC90/e00lines/e00lines.vcproj | 8 ++++---- projects/VC90/fgfs-construct/fgfs-construct.vcproj | 8 ++++---- .../VC90/fgfs-tools-clients/fgfs-tools-clients.vcproj | 8 ++++---- projects/VC90/fgfs-tools-server/fgfs-tools-server.vcproj | 8 ++++---- projects/VC90/fillvoids/fillvoids.vcproj | 8 ++++---- projects/VC90/genapts/genapts.vcproj | 8 ++++---- projects/VC90/gshhs/gshhs.vcproj | 8 ++++---- projects/VC90/hgtchop/hgtchop.vcproj | 8 ++++---- projects/VC90/landcover/landcover.vcproj | 8 ++++---- projects/VC90/libTerra/libTerra.vcproj | 8 ++++---- projects/VC90/noaa-decode/noaa-decode.vcproj | 8 ++++---- projects/VC90/ogr-decode/ogr-decode.vcproj | 8 ++++---- projects/VC90/osgb36/osgb36.vcproj | 8 ++++---- projects/VC90/poly2ogr/poly2ogr.vcproj | 8 ++++---- projects/VC90/poly2tri/poly2tri.vcproj | 8 ++++---- projects/VC90/raw2ascii/raw2ascii.vcproj | 8 ++++---- projects/VC90/shape-decode/shape-decode.vcproj | 8 ++++---- projects/VC90/shapelib/shapelib.vcproj | 8 ++++---- projects/VC90/srtmchop/srtmchop.vcproj | 8 ++++---- projects/VC90/terrafit/terrafit.vcproj | 8 ++++---- projects/VC90/testarray/testarray.vcproj | 8 ++++---- projects/VC90/tguserdef/tguserdef.vcproj | 8 ++++---- projects/VC90/tgvpf/tgvpf.vcproj | 8 ++++---- projects/VC90/vpf/vpf.vcproj | 8 ++++---- 40 files changed, 160 insertions(+), 160 deletions(-) diff --git a/projects/VC90/Array/Array.vcproj b/projects/VC90/Array/Array.vcproj index 96389280..4fafadb7 100644 --- a/projects/VC90/Array/Array.vcproj +++ b/projects/VC90/Array/Array.vcproj @@ -45,7 +45,7 @@ Date: Sat, 2 Oct 2010 10:25:36 +0200 Subject: [PATCH 3/4] Better fix by Geoff McLane --- src/BuildTiles/GenOutput/genobj.cxx | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/BuildTiles/GenOutput/genobj.cxx b/src/BuildTiles/GenOutput/genobj.cxx index a8f80d2e..aa1fa87e 100644 --- a/src/BuildTiles/GenOutput/genobj.cxx +++ b/src/BuildTiles/GenOutput/genobj.cxx @@ -147,7 +147,7 @@ int_list TGGenOutput::calc_tex_coords( TGConstruct& c, point_list geod_nodes, // build the necessary output structures based on the triangulation // data int TGGenOutput::build( TGConstruct& c ) { - int i, j; + int i, j, k; TGTriNodes trinodes = c.get_tri_nodes(); @@ -183,7 +183,11 @@ int TGGenOutput::build( TGConstruct& c ) { cout << "calculating texture coordinates" << endl; cout << "c.get_useUKGrid() = " << c.get_useUKGrid() << endl; tex_coords.clear(); - + std::vector < SGGeod > convGeodNodes; + for ( k = 0; k < geod_nodes.size(); k++ ) { + Point3D node = geod_nodes[k]; + convGeodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); + } for ( i = 0; i < TG_MAX_AREA_TYPES; ++i ) { // cout << " area = " << i << endl; for ( j = 0; j < (int)fans[i].size(); ++j ) { @@ -203,18 +207,12 @@ int TGGenOutput::build( TGConstruct& c ) { 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 ) { + for ( 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 { - int k; - std::vector < SGGeod > convGeodNodes; - for ( k = 0; k < geod_nodes.size(); k++ ) { - Point3D node = geod_nodes[k]; - convGeodNodes.push_back( SGGeod::fromDegM( node.x(), node.y(), node.z() ) ); - } std::vector< SGVec2f > tp_list = sgCalcTexCoords( b, convGeodNodes, fans[i][j] ); for ( k = 0; k < (int)tp_list.size(); ++k ) { SGVec2f tc = tp_list[k]; @@ -236,7 +234,7 @@ int TGGenOutput::build( TGConstruct& c ) { } -// caclulate the bounding sphere for a list of triangle faces +// calculate the bounding sphere for a list of triangle faces void TGGenOutput::calc_group_bounding_sphere( TGConstruct& c, const opt_list& fans, Point3D *center, double *radius ) From 68dc3066d4e84abfa7b79fa6713d5baa1b1d7e13 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Mon, 4 Oct 2010 08:21:47 +0200 Subject: [PATCH 4/4] Comment out a useless empty loop --- src/BuildTiles/Clipper/clipper.cxx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/BuildTiles/Clipper/clipper.cxx b/src/BuildTiles/Clipper/clipper.cxx index 03d7f698..4fdcd456 100644 --- a/src/BuildTiles/Clipper/clipper.cxx +++ b/src/BuildTiles/Clipper/clipper.cxx @@ -412,15 +412,15 @@ void TGClipper::merge_slivers( TGPolyList& clipped, TGPolygon& slivers ) { // cout << "press return: "; // string input; // cin >> input; - } else { - /* cout << " poly not a match" << endl; - cout << " original = " << original_contours - << " result = " << result_contours << endl; - cout << " sliver = " << endl; */ - for ( k = 0; k < (int)contour.size(); ++k ) { - // cout << " " << contour[k].x() << ", " - // << contour[k].y() << endl; - } + //} else { + // cout << " poly not a match" << endl; + // cout << " original = " << original_contours + // << " result = " << result_contours << endl; + // cout << " sliver = " << endl; + // for ( k = 0; k < (int)contour.size(); ++k ) { + // cout << " " << contour[k].x() << ", " + // << contour[k].y() << endl; + // } } } }