diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index 333986a4..6b9d41d7 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -178,8 +178,6 @@ bool Airport::isDebugFeature( int feat ) return dbg; } - - void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) { tgcontour_list slivers; diff --git a/src/Airports/GenAirports850/airport.hxx b/src/Airports/GenAirports850/airport.hxx index 11064043..af29827b 100644 --- a/src/Airports/GenAirports850/airport.hxx +++ b/src/Airports/GenAirports850/airport.hxx @@ -158,7 +158,7 @@ private: SGTimeStamp triangulation_time; // debug - std::string debug_path; + std::string debug_path; debug_map debug_runways; debug_map debug_pavements; debug_map debug_taxiways; diff --git a/src/Airports/GenAirports850/rwy_gen.cxx b/src/Airports/GenAirports850/rwy_gen.cxx index a9802d6a..79f01fcc 100644 --- a/src/Airports/GenAirports850/rwy_gen.cxx +++ b/src/Airports/GenAirports850/rwy_gen.cxx @@ -611,7 +611,6 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys, runway_half.AddNode( 0, runway.GetNode(5) ); runway_half.AddNode( 0, runway.GetNode(2) ); } - else { heading = rwy.heading; diff --git a/src/BuildTiles/Main/priorities.hxx b/src/BuildTiles/Main/priorities.hxx index 69a028fb..4d90adae 100644 --- a/src/BuildTiles/Main/priorities.hxx +++ b/src/BuildTiles/Main/priorities.hxx @@ -19,7 +19,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. // // $Id: names.hxx,v 1.14 2005-09-28 16:43:18 curt Exp $ - + #ifndef _PRIORITIES_HXX #define _PRIORITIES_HXX @@ -31,11 +31,11 @@ #include -class TGAreaDefinition { +class TGAreaDefinition +{ public: - TGAreaDefinition( const std::string& n, const std::string& c, unsigned int p ) : - name(n), - category(c) + TGAreaDefinition(const std::string& n, const std::string& c, unsigned int p) : name(n), + category(c) { priority = p; smooth_method = 0; @@ -43,128 +43,143 @@ public: default_layer = 0; }; - std::string const& GetName() const { + std::string const& GetName() const + { return name; } - unsigned int GetPriority() const { + unsigned int GetPriority() const + { return priority; } - std::string const& GetCategory() const { + std::string const& GetCategory() const + { return category; } private: - std::string name; + std::string name; unsigned int priority; - std::string category; + std::string category; // future improvements unsigned int smooth_method; - tgTexMethod texture_method; - bool layered; + tgTexMethod texture_method; + bool layered; unsigned int default_layer; }; typedef std::vector area_definition_list; typedef area_definition_list::const_iterator area_definition_iterator; -class TGAreaDefinitions { +class TGAreaDefinitions +{ public: - TGAreaDefinitions() : - sliver_area_name("") + TGAreaDefinitions() : sliver_area_name("") { sliver_area_priority = 0; }; - int init( const std::string& filename ); - unsigned int size() const { + int init(const std::string& filename); + unsigned int size() const + { return area_defs.size(); } - bool is_hole_area( unsigned int p ) const { - if ( area_defs[p].GetCategory() == "hole" ) { + bool is_hole_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "hole") { return true; } else { return false; } } - bool is_landmass_area( unsigned int p ) const { - if (( area_defs[p].GetCategory() == "landmass" ) || - ( area_defs[p].GetCategory() == "other" ) || - ( area_defs[p].GetCategory() == "cliff" )) { + bool is_landmass_area(unsigned int p) const + { + if ((area_defs[p].GetCategory() == "landmass") || + (area_defs[p].GetCategory() == "other") || + (area_defs[p].GetCategory() == "cliff")) { return true; } else { return false; } } - bool is_island_area( unsigned int p ) const { - if ( area_defs[p].GetCategory() == "island" ) { + bool is_island_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "island") { return true; } else { return false; } } - bool is_road_area( unsigned int p ) const { - if ( area_defs[p].GetCategory() == "road" ) { + bool is_road_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "road") { return true; } else { return false; } } - bool is_water_area( unsigned int p ) const { - if ( ( area_defs[p].GetCategory() == "ocean" ) || - ( area_defs[p].GetCategory() == "lake" ) ){ + bool is_water_area(unsigned int p) const + { + if ((area_defs[p].GetCategory() == "ocean") || + (area_defs[p].GetCategory() == "lake")) { return true; } else { return false; } } - bool is_lake_area( unsigned int p ) const { - if ( area_defs[p].GetCategory() == "lake" ) { + bool is_lake_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "lake") { return true; } else { return false; } } - bool is_stream_area( unsigned int p ) const { - if ( area_defs[p].GetCategory() == "stream" ) { + bool is_stream_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "stream") { return true; } else { return false; } } - bool is_ocean_area( unsigned int p ) const { - if ( area_defs[p].GetCategory() == "ocean" ) { + bool is_ocean_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "ocean") { return true; } else { return false; } } - bool is_cliff_area( unsigned int p ) const { - if (area_defs[p].GetCategory() == "cliff" ) { - return true; - } else { - return false; - } - } + bool is_cliff_area(unsigned int p) const + { + if (area_defs[p].GetCategory() == "cliff") { + return true; + } else { + return false; + } + } - std::string const& get_area_name( unsigned int p ) const { + std::string const& get_area_name(unsigned int p) const + { return area_defs[p].GetName(); } - unsigned int get_area_priority( const std::string& name ) const { - for (unsigned int i=0; i < area_defs.size(); i++) { - if ( area_defs[i].GetName() == name ) { + unsigned int get_area_priority(const std::string& name) const + { + for (unsigned int i = 0; i < area_defs.size(); i++) { + if (area_defs[i].GetName() == name) { return i; } } @@ -175,18 +190,20 @@ public: } - std::string const& get_sliver_area_name( void ) const { + std::string const& get_sliver_area_name(void) const + { return sliver_area_name; } - unsigned int get_sliver_area_priority( void ) const { + unsigned int get_sliver_area_priority(void) const + { return sliver_area_priority; } private: area_definition_list area_defs; - std::string sliver_area_name; + std::string sliver_area_name; unsigned int sliver_area_priority; }; diff --git a/src/BuildTiles/Main/tgconstruct.hxx b/src/BuildTiles/Main/tgconstruct.hxx index 295d0635..ab8323d4 100644 --- a/src/BuildTiles/Main/tgconstruct.hxx +++ b/src/BuildTiles/Main/tgconstruct.hxx @@ -26,33 +26,33 @@ #define _CONSTRUCT_HXX -#ifndef __cplusplus -# error This library requires C++ -#endif +#ifndef __cplusplus +#error This library requires C++ +#endif -#include #include +#include #include -#include #include +#include #include "tglandclass.hxx" #include "priorities.hxx" -#define FIND_SLIVERS (0) +#define FIND_SLIVERS (0) // Stage2 shared edge data struct TGNeighborFaces { public: - SGGeod node; + SGGeod node; - double_list elevations; // we'll take the average + double_list elevations; // we'll take the average double_list face_areas; std::vector face_normals; }; -typedef std::vector < TGNeighborFaces > neighbor_face_list; +typedef std::vector neighbor_face_list; typedef neighbor_face_list::iterator neighbor_face_list_iterator; typedef neighbor_face_list::const_iterator const_neighbor_face_list_iterator; @@ -60,14 +60,14 @@ class TGConstruct : public SGThread { public: // Constructor - TGConstruct( const TGAreaDefinitions& areas, unsigned int s, SGLockedQueue& q, SGMutex* l ); + TGConstruct(const TGAreaDefinitions& areas, unsigned int s, SGLockedQueue& q, SGMutex* l); // Destructor ~TGConstruct(); // New shared edge matching - void SaveToIntermediateFiles( int stage ); - void LoadFromIntermediateFiles( int stage ); + void SaveToIntermediateFiles(int stage); + void LoadFromIntermediateFiles(int stage); #if 0 int load_landcover (); @@ -83,93 +83,96 @@ public: #endif // paths - void set_paths( const std::string& work, const std::string& share, const std::string& match, - const std::string& output, const std::vector& load_dirs ); - void set_options( bool ignore_lm, double n ); + void set_paths(const std::string& work, const std::string& share, const std::string& match, + const std::string& output, const std::vector& load_dirs); + void set_options(bool ignore_lm, double n); // TODO : REMOVE inline TGNodes* get_nodes() { return &nodes; } // node list in geodetic coords (with fixed elevation) - inline void get_geod_nodes( std::vector& points ) const { nodes.get_geod_nodes( points ); } + inline void get_geod_nodes(std::vector& points) const { nodes.get_geod_nodes(points); } // normal list (for each point) in cart coords (for smooth shading) - inline void get_point_normals( std::vector& normals ) const { nodes.get_normals( normals ); } + inline void get_point_normals(std::vector& normals) const { nodes.get_normals(normals); } // Debug - void set_debug( std::string path, std::vector area_defs, std::vector shape_defs ); + void set_debug(std::string path, std::vector area_defs, std::vector shape_defs); + + void CreateMatchedEdgeFiles(std::vector& bucketList); - void CreateMatchedEdgeFiles( std::vector& bucketList ); - private: virtual void run(); // Ocean tile or not - bool IsOceanTile() { return isOcean; } + bool IsOceanTile() { return isOcean; } // Load Data - void LoadElevationArray( bool add_nodes ); - int LoadLandclassPolys( void ); - bool CheckMatchingNode( SGGeod& node, bool road, bool fixed ); - - SGGeod GetNearestNodeLatitude( const SGGeod& node, const std::vector& selection ); - SGGeod GetNearestNodeLongitude( const SGGeod& node, const std::vector& selection ); + void LoadElevationArray(bool add_nodes); + int LoadLandclassPolys(void); + bool CheckMatchingNode(SGGeod& node, bool road, bool fixed); + + SGGeod GetNearestNodeLatitude(const SGGeod& node, const std::vector& selection); + SGGeod GetNearestNodeLongitude(const SGGeod& node, const std::vector& selection); // Clip Data - bool ClipLandclassPolys( void ); + bool ClipLandclassPolys(void); // Clip Helpers -// void move_slivers( TGPolygon& in, TGPolygon& out ); -// void merge_slivers( TGLandclass& clipped, tgcontour_list& sliver_list ); + // void move_slivers( TGPolygon& in, TGPolygon& out ); + // void merge_slivers( TGLandclass& clipped, tgcontour_list& sliver_list ); // Shared edge Matching - void SaveSharedEdgeData( int stage ); - void LoadSharedEdgeData( int stage ); + void writeGeodCollection(std::vector&, gzFile&); + void writeFaceCollection(std::string&&, std::vector&); + void SaveSharedEdgeData(int stage); + void LoadSharedEdgeData(int stage); + void LoadMatchedEdge(int, int); void LoadMatchedEdgeFiles(); - void LoadNeighboorEdgeDataStage1( SGBucket& b, std::vector& north, std::vector& south, std::vector& east, std::vector& west ); - void LoadNeighboorMatchDataStage1( SGBucket& b, std::vector& north, std::vector& south, std::vector& east, std::vector& west ); + void LoadNeighborEdgeDataStage1(SGBucket& b, std::vector& north, std::vector& south, std::vector& east, std::vector& west); + void LoadNeighborMatchDataStage1(SGBucket& b, std::vector& north, std::vector& south, std::vector& east, std::vector& west); - void ReadNeighborFaces( gzFile& fp ); - void WriteNeighborFaces( gzFile& fp, const SGGeod& pt ) const; - TGNeighborFaces* AddNeighborFaces( const SGGeod& node ); - TGNeighborFaces* FindNeighborFaces( const SGGeod& node ); + void ReadNeighborFaces(gzFile& fp); + void WriteNeighborFaces(gzFile& fp, const SGGeod& pt) const; + TGNeighborFaces* AddNeighborFaces(const SGGeod& node); + TGNeighborFaces* FindNeighborFaces(const SGGeod& node); // Polygon Cleaning - void CleanClippedPolys( void ); - void FixTJunctions( void ); + void CleanClippedPolys(void); + void FixTJunctions(void); // Tesselation - void TesselatePolys( void ); + void TesselatePolys(void); // Elevation and Flattening - void CalcElevations( void ); - void AverageEdgeElevations( void ); + void CalcElevations(void); + void AverageEdgeElevations(void); // Normals and texture coords - void LookupNodesPerVertex( void ); - void LookupFacesPerNode( void ); - void CalcFaceNormals( void ); - void CalcPointNormals( void ); - void CalcTextureCoordinates( void ); + void LookupNodesPerVertex(void); + void LookupFacesPerNode(void); + void CalcFaceNormals(void); + void CalcPointNormals(void); + void CalcTextureCoordinates(void); // Helpers - SGVec3f calc_normal( double area, const SGVec3d& p1, const SGVec3d& p2, const SGVec3d& p3 ) const; + SGVec3f calc_normal(double area, const SGVec3d& p1, const SGVec3d& p2, const SGVec3d& p3) const; // Output - void WriteBtgFile( void ); - void AddCustomObjects( void ); + void WriteBtgFile(void); + void AddCustomObjects(void); // Misc - void calc_normals( std::vector& geod_nodes, std::vector& wgs84_nodes, tgPolygon& sp ); + void calc_normals(std::vector& geod_nodes, std::vector& wgs84_nodes, tgPolygon& sp); // debug - void get_debug( void ); - bool IsDebugShape( unsigned int id ); - bool IsDebugArea( unsigned int area ); + void get_debug(void); + bool IsDebugShape(unsigned int id); + bool IsDebugArea(unsigned int area); private: TGAreaDefinitions const& area_defs; - + // construct stage to perform SGLockedQueue& workQueue; unsigned int total_tiles; @@ -187,7 +190,7 @@ private: std::vector load_dirs; - const static double gSnap; // approx 1 mm + const static double gSnap; // approx 1 mm // flag indicating whether to ignore the landmass bool ignoreLandmass; @@ -209,11 +212,11 @@ private: std::vector debug_shapes; // OGR encode variables for debug: - void* ds_id; // If we are going to build shapefiles - void* l_id; // datasource and layer IDs - char ds_name[128]; - char layer_name[128]; - char feature_name[128]; + void* ds_id; // If we are going to build shapefiles + void* l_id; // datasource and layer IDs + char ds_name[128]; + char layer_name[128]; + char feature_name[128]; // this bucket SGBucket bucket; @@ -234,10 +237,10 @@ private: unsigned int num_areas; // Neighbor Faces - neighbor_face_list neighbor_faces; - + neighbor_face_list neighbor_faces; + // file lock - SGMutex* lock; + SGMutex* lock; }; #endif // _CONSTRUCT_HXX diff --git a/src/BuildTiles/Main/tgconstruct_cleanup.cxx b/src/BuildTiles/Main/tgconstruct_cleanup.cxx index 255fc35b..27424b65 100644 --- a/src/BuildTiles/Main/tgconstruct_cleanup.cxx +++ b/src/BuildTiles/Main/tgconstruct_cleanup.cxx @@ -22,7 +22,7 @@ // $Id: construct.cxx,v 1.4 2004-11-19 22:25:49 curt Exp $ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -32,28 +32,29 @@ #include "tgconstruct.hxx" -void TGConstruct::FixTJunctions( void ) { +void TGConstruct::FixTJunctions(void) +{ int before, after; std::vector points; tgRectangle bb; // traverse each poly, and add intermediate nodes - for ( unsigned int i = 0; i < area_defs.size(); ++i ) { - for( unsigned int j = 0; j < polys_clipped.area_size(i); ++j ) { + for (unsigned int i = 0; i < area_defs.size(); ++i) { + for (unsigned int j = 0; j < polys_clipped.area_size(i); ++j) { tgPolygon current = polys_clipped.get_poly(i, j); bb = current.GetBoundingBox(); - nodes.get_nodes_inside( bb.getMin(), bb.getMax(), points ); + nodes.get_nodes_inside(bb.getMin(), bb.getMax(), points); - before = current.TotalNodes(); - current = tgPolygon::AddColinearNodes( current, points ); - after = current.TotalNodes(); + before = current.TotalNodes(); + current = tgPolygon::AddColinearNodes(current, points); + after = current.TotalNodes(); if (before != after) { - SG_LOG( SG_CLIPPER, SG_DEBUG, "Fixed T-Junctions in " << area_defs.get_area_name(i) << ":" << j+1 << " of " << (int)polys_clipped.area_size(i) << " nodes increased from " << before << " to " << after ); + SG_LOG(SG_CLIPPER, SG_DEBUG, "Fixed T-Junctions in " << area_defs.get_area_name(i) << ":" << j + 1 << " of " << (int)polys_clipped.area_size(i) << " nodes increased from " << before << " to " << after); } /* Save it back */ - polys_clipped.set_poly( i, j, current ); + polys_clipped.set_poly(i, j, current); } } } @@ -81,33 +82,34 @@ void TGConstruct::merge_slivers( TGLandclass& clipped, tgcontour_list& sliver_l } #endif -void TGConstruct::CleanClippedPolys() { +void TGConstruct::CleanClippedPolys() +{ // Clean the polys - for ( unsigned int area = 0; area < area_defs.size(); area++ ) { - for( unsigned int p = 0; p < polys_clipped.area_size(area); p++ ) { + for (unsigned int area = 0; area < area_defs.size(); area++) { + for (unsigned int p = 0; p < polys_clipped.area_size(area); p++) { char layer[32]; tgPolygon poly = polys_clipped.get_poly(area, p); // step 1 : snap poly = tgPolygon::Snap(poly, gSnap); - if ( IsDebugShape( poly.GetId() ) ) { - sprintf(layer, "snapped_%d", poly.GetId() ); - tgShapefile::FromPolygon( poly, ds_name, layer, "poly" ); + if (IsDebugShape(poly.GetId())) { + sprintf(layer, "snapped_%d", poly.GetId()); + tgShapefile::FromPolygon(poly, ds_name, layer, "poly"); } // step 2 : remove_dups - poly = tgPolygon::RemoveDups( poly ); - if ( IsDebugShape( poly.GetId() ) ) { - sprintf(layer, "rem_dups_%d", poly.GetId() ); - tgShapefile::FromPolygon( poly, ds_name, layer, "poly" ); + poly = tgPolygon::RemoveDups(poly); + if (IsDebugShape(poly.GetId())) { + sprintf(layer, "rem_dups_%d", poly.GetId()); + tgShapefile::FromPolygon(poly, ds_name, layer, "poly"); } // step 3 : remove cycles - poly = tgPolygon::RemoveCycles( poly ); - if ( IsDebugShape( poly.GetId() ) ) { - sprintf(layer, "rem_cycles_%d", poly.GetId() ); - tgShapefile::FromPolygon( poly, ds_name, layer, "poly" ); + poly = tgPolygon::RemoveCycles(poly); + if (IsDebugShape(poly.GetId())) { + sprintf(layer, "rem_cycles_%d", poly.GetId()); + tgShapefile::FromPolygon(poly, ds_name, layer, "poly"); } polys_clipped.set_poly(area, p, poly); @@ -115,28 +117,28 @@ void TGConstruct::CleanClippedPolys() { } } -void TGConstruct::AverageEdgeElevations( void ) +void TGConstruct::AverageEdgeElevations(void) { - for ( unsigned int i = 0; i < neighbor_faces.size(); i++ ) { + for (unsigned int i = 0; i < neighbor_faces.size(); i++) { TGNeighborFaces faces = neighbor_faces[i]; double elevation = 0.0; unsigned int num_elevations = faces.elevations.size(); - for ( unsigned int j = 0; j < num_elevations; j++ ) { + for (unsigned int j = 0; j < num_elevations; j++) { elevation += faces.elevations[j]; } elevation = elevation / num_elevations; /* Find this node, and update it's elevation */ - int idx = nodes.find( faces.node ); + int idx = nodes.find(faces.node); if (idx != -1) { - TGNode const& node = nodes.get_node( idx ); + TGNode const& node = nodes.get_node(idx); - if ( !node.GetFixedPosition() ) { + if (!node.GetFixedPosition()) { // set elevation as the average between all tiles that have it - nodes.SetElevation( idx, elevation ); + nodes.SetElevation(idx, elevation); } } } diff --git a/src/BuildTiles/Main/tgconstruct_debug.cxx b/src/BuildTiles/Main/tgconstruct_debug.cxx index 50697ddd..3dce9576 100644 --- a/src/BuildTiles/Main/tgconstruct_debug.cxx +++ b/src/BuildTiles/Main/tgconstruct_debug.cxx @@ -21,7 +21,7 @@ // $Id: construct.cxx,v 1.4 2004-11-19 22:25:49 curt Exp $ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -32,7 +32,7 @@ using std::string; -void TGConstruct::set_debug( std::string path, std::vector a_defs, std::vector s_defs ) +void TGConstruct::set_debug(std::string path, std::vector a_defs, std::vector s_defs) { debug_path = path; @@ -40,7 +40,7 @@ void TGConstruct::set_debug( std::string path, std::vector a_defs, std:: debug_shape_defs = s_defs; } -void TGConstruct::get_debug( void ) +void TGConstruct::get_debug(void) { // clear out any previous entries debug_areas.clear(); @@ -48,20 +48,19 @@ void TGConstruct::get_debug( void ) /* Find any ids for our tile */ for (unsigned int i = 0; i < debug_area_defs.size(); ++i) { - string dsd = debug_area_defs[i]; - size_t d_pos = dsd.find(":"); - string tile = dsd.substr(0, d_pos); + string dsd = debug_area_defs[i]; + size_t d_pos = dsd.find(":"); + string tile = dsd.substr(0, d_pos); - if ( tile == bucket.gen_index_str() ) { + if (tile == bucket.gen_index_str()) { dsd.erase(0, d_pos + 1); - if ( dsd == "all" ) { + if (dsd == "all") { debug_all = true; } else { std::stringstream ss(dsd); int idx; - while (ss >> idx) - { + while (ss >> idx) { SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug area " << idx); debug_areas.push_back(idx); @@ -74,20 +73,19 @@ void TGConstruct::get_debug( void ) } for (unsigned int i = 0; i < debug_shape_defs.size(); ++i) { - string dsd = debug_shape_defs[i]; - size_t d_pos = dsd.find(":"); - string tile = dsd.substr(0, d_pos); + string dsd = debug_shape_defs[i]; + size_t d_pos = dsd.find(":"); + string tile = dsd.substr(0, d_pos); - if ( tile == bucket.gen_index_str() ) { + if (tile == bucket.gen_index_str()) { dsd.erase(0, d_pos + 1); - if ( dsd == "all" ) { + if (dsd == "all") { debug_all = true; } else { std::stringstream ss(dsd); int idx; - while (ss >> idx) - { + while (ss >> idx) { SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug shape " << idx); debug_shapes.push_back(idx); @@ -100,16 +98,16 @@ void TGConstruct::get_debug( void ) } } -bool TGConstruct::IsDebugShape( unsigned int id ) +bool TGConstruct::IsDebugShape(unsigned int id) { bool is_debug = false; /* Check global flag */ - if ( debug_all ) { + if (debug_all) { is_debug = true; } else { - for (unsigned int i=0; i +#include #endif #include @@ -32,33 +32,34 @@ using std::string; // Load elevation data from an Array file (a regular grid of elevation data) // and return list of fitted nodes. -void TGConstruct::LoadElevationArray( bool add_nodes ) { +void TGConstruct::LoadElevationArray(bool add_nodes) +{ string base = bucket.gen_base_path(); - for ( int i = 0; i < (int)load_dirs.size(); ++i ) { + for (int i = 0; i < (int)load_dirs.size(); ++i) { string array_path = work_base + "/" + load_dirs[i] + "/" + base + "/" + bucket.gen_index_str(); - if ( array.open(array_path) ) { + if (array.open(array_path)) { break; } else { SG_LOG(SG_GENERAL, SG_DEBUG, "Failed to open Array file " << array_path); } } - array.parse( bucket ); - array.remove_voids( ); + array.parse(bucket); + array.remove_voids(); - if ( add_nodes ) { + if (add_nodes) { std::vector const& corner_list = array.get_corner_list(); for (unsigned int i = 0; i < corner_list.size(); ++i) { - nodes.unique_add( corner_list[i] ); + nodes.unique_add(corner_list[i]); } std::vector const& fit_list = array.get_fitted_list(); for (unsigned int i = 0; i < fit_list.size(); ++i) { SGGeod node = fit_list[i]; - if ( CheckMatchingNode( node, false, false ) ) { - nodes.unique_add( node ); + if (CheckMatchingNode(node, false, false)) { + nodes.unique_add(node); } } } @@ -67,19 +68,19 @@ void TGConstruct::LoadElevationArray( bool add_nodes ) { // fix the elevations of the geodetic nodes // This should be done in the nodes class itself, except for the need for the triangle type // hopefully, this will get better when we have the area lookup via superpoly... -void TGConstruct::CalcElevations( void ) +void TGConstruct::CalcElevations(void) { std::vector raw_nodes; double e1, e2, e3, min; - int n1, n2, n3; + int n1, n2, n3; for (int i = 0; i < (int)nodes.size(); ++i) { - TGNode const& node = nodes.get_node( i ); + TGNode const& node = nodes.get_node(i); SGGeod pos = node.GetPosition(); - if ( !node.GetFixedPosition() ) { + if (!node.GetFixedPosition()) { // set elevation as interpolated point from DEM data. - nodes.SetElevation( i, array.altitude_from_grid(pos.getLongitudeDeg() * 3600.0, pos.getLatitudeDeg() * 3600.0) ); + nodes.SetElevation(i, array.altitude_from_grid(pos.getLongitudeDeg() * 3600.0, pos.getLatitudeDeg() * 3600.0)); } } @@ -87,137 +88,149 @@ void TGConstruct::CalcElevations( void ) // now flatten some stuff for (unsigned int area = 0; area < area_defs.size(); area++) { - if ( area_defs.is_lake_area(area) ) { - for (int p = 0; p < (int)polys_clipped.area_size(area); ++p ) { - SG_LOG( SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p+1 << " of " << polys_clipped.area_size(area) ); - tgPolygon poly = polys_clipped.get_poly( area, p ); + if (area_defs.is_lake_area(area)) { + for (int p = 0; p < (int)polys_clipped.area_size(area); ++p) { + SG_LOG(SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p + 1 << " of " << polys_clipped.area_size(area)); + tgPolygon poly = polys_clipped.get_poly(area, p); - for (unsigned int tri=0; tri < poly.Triangles(); tri++) { - n1 = poly.GetTriIdx( tri, 0 ); + for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { + n1 = poly.GetTriIdx(tri, 0); e1 = nodes.get_node(n1).GetPosition().getElevationM(); - n2 = poly.GetTriIdx( tri, 1 ); + n2 = poly.GetTriIdx(tri, 1); e2 = nodes.get_node(n2).GetPosition().getElevationM(); - n3 = poly.GetTriIdx( tri, 2 ); + n3 = poly.GetTriIdx(tri, 2); e3 = nodes.get_node(n3).GetPosition().getElevationM(); min = e1; - if ( e2 < min ) { min = e2; } - if ( e3 < min ) { min = e3; } + if (e2 < min) { min = e2; } + if (e3 < min) { min = e3; } - nodes.SetElevation( n1, min ); - nodes.SetElevation( n2, min ); - nodes.SetElevation( n3, min ); + nodes.SetElevation(n1, min); + nodes.SetElevation(n2, min); + nodes.SetElevation(n3, min); } } } - if ( area_defs.is_stream_area(area) ) { - for (unsigned int p = 0; p < polys_clipped.area_size(area); ++p ) { - SG_LOG( SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p+1 << " of " << polys_clipped.area_size(area) ); - tgPolygon poly = polys_clipped.get_poly( area, p ); + if (area_defs.is_stream_area(area)) { + for (unsigned int p = 0; p < polys_clipped.area_size(area); ++p) { + SG_LOG(SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p + 1 << " of " << polys_clipped.area_size(area)); + tgPolygon poly = polys_clipped.get_poly(area, p); - for (unsigned int tri=0; tri < poly.Triangles(); tri++) { - n1 = poly.GetTriIdx( tri, 0 ); + for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { + n1 = poly.GetTriIdx(tri, 0); e1 = nodes.get_node(n1).GetPosition().getElevationM(); - n2 = poly.GetTriIdx( tri, 1 ); + n2 = poly.GetTriIdx(tri, 1); e2 = nodes.get_node(n2).GetPosition().getElevationM(); - n3 = poly.GetTriIdx( tri, 2 ); + n3 = poly.GetTriIdx(tri, 2); e3 = nodes.get_node(n3).GetPosition().getElevationM(); min = e1; SGGeod src = raw_nodes[n1]; - if ( e2 < min ) { min = e2; src = raw_nodes[n2]; } - if ( e3 < min ) { min = e3; src = raw_nodes[n3]; } + if (e2 < min) { + min = e2; + src = raw_nodes[n2]; + } + if (e3 < min) { + min = e3; + src = raw_nodes[n3]; + } double d1, d2, d3; - if ( min == e1 ) { + if (min == e1) { d1 = 0.0f; } else { - d1 = SGGeodesy::distanceM( src, raw_nodes[n1] ); + d1 = SGGeodesy::distanceM(src, raw_nodes[n1]); } - if ( min == e2 ) { + if (min == e2) { d2 = 0.0f; } else { - d2 = SGGeodesy::distanceM( src, raw_nodes[n2] ); + d2 = SGGeodesy::distanceM(src, raw_nodes[n2]); } - if ( min == e3 ) { + if (min == e3) { d3 = 0.0f; } else { - d3 = SGGeodesy::distanceM( src, raw_nodes[n3] ); + d3 = SGGeodesy::distanceM(src, raw_nodes[n3]); } double max1 = d1 * 0.20 + min; double max2 = d2 * 0.20 + min; double max3 = d3 * 0.20 + min; - if ( max1 < e1 ) { nodes.SetElevation( n1, max1 ); } - if ( max2 < e2 ) { nodes.SetElevation( n2, max2 ); } - if ( max3 < e3 ) { nodes.SetElevation( n3, max3 ); } + if (max1 < e1) { nodes.SetElevation(n1, max1); } + if (max2 < e2) { nodes.SetElevation(n2, max2); } + if (max3 < e3) { nodes.SetElevation(n3, max3); } } } } - if ( area_defs.is_road_area(area) ) { - for (int p = 0; p < (int)polys_clipped.area_size(area); ++p ) { - SG_LOG( SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p+1 << " of " << polys_clipped.area_size(area) ); - tgPolygon poly = polys_clipped.get_poly( area, p ); + if (area_defs.is_road_area(area)) { + for (int p = 0; p < (int)polys_clipped.area_size(area); ++p) { + SG_LOG(SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p + 1 << " of " << polys_clipped.area_size(area)); + tgPolygon poly = polys_clipped.get_poly(area, p); - for (unsigned int tri=0; tri < poly.Triangles(); tri++) { - n1 = poly.GetTriIdx( tri, 0 ); + for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { + n1 = poly.GetTriIdx(tri, 0); e1 = nodes.get_node(n1).GetPosition().getElevationM(); - n2 = poly.GetTriIdx( tri, 1 ); + n2 = poly.GetTriIdx(tri, 1); e2 = nodes.get_node(n2).GetPosition().getElevationM(); - n3 = poly.GetTriIdx( tri, 2 ); + n3 = poly.GetTriIdx(tri, 2); e3 = nodes.get_node(n3).GetPosition().getElevationM(); min = e1; SGGeod src = raw_nodes[n1]; - if ( e2 < min ) { min = e2; src = raw_nodes[n2]; } - if ( e3 < min ) { min = e3; src = raw_nodes[n3]; } + if (e2 < min) { + min = e2; + src = raw_nodes[n2]; + } + if (e3 < min) { + min = e3; + src = raw_nodes[n3]; + } double d1, d2, d3; - if ( min == e1 ) { + if (min == e1) { d1 = 0.0f; } else { - d1 = SGGeodesy::distanceM( src, raw_nodes[n1] ); + d1 = SGGeodesy::distanceM(src, raw_nodes[n1]); } - if ( min == e2 ) { + if (min == e2) { d2 = 0.0f; } else { - d2 = SGGeodesy::distanceM( src, raw_nodes[n2] ); + d2 = SGGeodesy::distanceM(src, raw_nodes[n2]); } - if ( min == e3 ) { + if (min == e3) { d3 = 0.0f; } else { - d3 = SGGeodesy::distanceM( src, raw_nodes[n3] ); + d3 = SGGeodesy::distanceM(src, raw_nodes[n3]); } double max1 = d1 * 0.30 + min; double max2 = d2 * 0.30 + min; double max3 = d3 * 0.30 + min; - if ( max1 < e1 ) { nodes.SetElevation( n1, max1 ); } - if ( max2 < e2 ) { nodes.SetElevation( n2, max2 ); } - if ( max3 < e3 ) { nodes.SetElevation( n3, max3 ); } + if (max1 < e1) { nodes.SetElevation(n1, max1); } + if (max2 < e2) { nodes.SetElevation(n2, max2); } + if (max3 < e3) { nodes.SetElevation(n3, max3); } } } } - if ( area_defs.is_ocean_area(area) ) { - for (int p = 0; p < (int)polys_clipped.area_size(area); ++p ) { - SG_LOG( SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p+1 << " of " << polys_clipped.area_size(area) ); - tgPolygon poly = polys_clipped.get_poly( area, p ); + if (area_defs.is_ocean_area(area)) { + for (int p = 0; p < (int)polys_clipped.area_size(area); ++p) { + SG_LOG(SG_CLIPPER, SG_DEBUG, "Flattening " << area_defs.get_area_name(area) << ":" << p + 1 << " of " << polys_clipped.area_size(area)); + tgPolygon poly = polys_clipped.get_poly(area, p); - for (unsigned int tri=0; tri < poly.Triangles(); tri++) { - n1 = poly.GetTriIdx( tri, 0 ); - n2 = poly.GetTriIdx( tri, 1 ); - n3 = poly.GetTriIdx( tri, 2 ); + for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { + n1 = poly.GetTriIdx(tri, 0); + n2 = poly.GetTriIdx(tri, 1); + n3 = poly.GetTriIdx(tri, 2); - nodes.SetElevation( n1, 0.0 ); - nodes.SetElevation( n2, 0.0 ); - nodes.SetElevation( n3, 0.0 ); + nodes.SetElevation(n1, 0.0); + nodes.SetElevation(n2, 0.0); + nodes.SetElevation(n3, 0.0); } } } diff --git a/src/BuildTiles/Main/tgconstruct_lookup.cxx b/src/BuildTiles/Main/tgconstruct_lookup.cxx index 62c65f8b..2053a988 100644 --- a/src/BuildTiles/Main/tgconstruct_lookup.cxx +++ b/src/BuildTiles/Main/tgconstruct_lookup.cxx @@ -22,7 +22,7 @@ // $Id: construct.cxx,v 1.4 2004-11-19 22:25:49 curt Exp $ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -32,20 +32,20 @@ // This function populates the Superpoly tri_idx polygon. // This polygon is a mirror of tris, except the verticies are // indexes into the node array (cast as unsigned long) -void TGConstruct::LookupNodesPerVertex( void ) +void TGConstruct::LookupNodesPerVertex(void) { // for each node, traverse all the triangles - and create face lists - for ( unsigned int area = 0; area < area_defs.size(); area++ ) { - for( unsigned int p = 0; p < polys_clipped.area_size(area); p++ ) { - tgPolygon& poly = polys_clipped.get_poly( area, p ); + for (unsigned int area = 0; area < area_defs.size(); area++) { + for (unsigned int p = 0; p < polys_clipped.area_size(area); p++) { + tgPolygon& poly = polys_clipped.get_poly(area, p); - for (unsigned int tri=0; tri < poly.Triangles(); tri++) { + for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { for (unsigned int vertex = 0; vertex < 3; vertex++) { - int idx = nodes.find( poly.GetTriNode( tri, vertex ) ); + int idx = nodes.find(poly.GetTriNode(tri, vertex)); if (idx >= 0) { - poly.SetTriIdx( tri, vertex, idx ); + poly.SetTriIdx(tri, vertex, idx); } else { - SG_LOG(SG_GENERAL, SG_ALERT, "didn't find vertex! " << poly.GetTriNode( tri, vertex ) ); + SG_LOG(SG_GENERAL, SG_ALERT, "didn't find vertex! " << poly.GetTriNode(tri, vertex)); exit(0); } } @@ -54,17 +54,17 @@ void TGConstruct::LookupNodesPerVertex( void ) } } -void TGConstruct::LookupFacesPerNode( void ) +void TGConstruct::LookupFacesPerNode(void) { // Add each face that includes a node to the node's face list - for ( unsigned int area = 0; area < area_defs.size(); area++ ) { - for( unsigned int p = 0; p < polys_clipped.area_size(area); p++ ) { - tgPolygon const& poly = polys_clipped.get_poly(area, p ); + for (unsigned int area = 0; area < area_defs.size(); area++) { + for (unsigned int p = 0; p < polys_clipped.area_size(area); p++) { + tgPolygon const& poly = polys_clipped.get_poly(area, p); - for (unsigned int tri=0; tri < poly.Triangles(); tri++) { + for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { for (int v = 0; v < 3; v++) { - int i = poly.GetTriIdx( tri, v ); - nodes.AddFace( i, area, p, tri ); + int i = poly.GetTriIdx(tri, v); + nodes.AddFace(i, area, p, tri); } } } diff --git a/src/BuildTiles/Main/tgconstruct_math.cxx b/src/BuildTiles/Main/tgconstruct_math.cxx index 5faf012f..50436518 100644 --- a/src/BuildTiles/Main/tgconstruct_math.cxx +++ b/src/BuildTiles/Main/tgconstruct_math.cxx @@ -21,14 +21,15 @@ // $Id: construct.cxx,v 1.4 2004-11-19 22:25:49 curt Exp $ #ifdef HAVE_CONFIG_H -# include +#include #endif #include #include "tgconstruct.hxx" -SGVec3f TGConstruct::calc_normal( double area, const SGVec3d& p1, const SGVec3d& p2, const SGVec3d& p3 ) const { +SGVec3f TGConstruct::calc_normal(double area, const SGVec3d& p1, const SGVec3d& p2, const SGVec3d& p3) const +{ SGVec3f v1, v2; SGVec3f normal; @@ -41,17 +42,17 @@ SGVec3f TGConstruct::calc_normal( double area, const SGVec3d& p1, const SGVec3d& bool degenerate = false; const double area_eps = 1.0e-12; - if ( area < area_eps ) { + if (area < area_eps) { degenerate = true; - } else if ( fabs(p1.x() - p2.x()) < SG_EPSILON && fabs(p1.x() - p3.x()) < SG_EPSILON ) { + } else if (fabs(p1.x() - p2.x()) < SG_EPSILON && fabs(p1.x() - p3.x()) < SG_EPSILON) { degenerate = true; - } else if ( fabs(p1.y() - p2.y()) < SG_EPSILON && fabs(p1.y() - p3.y()) < SG_EPSILON ) { + } else if (fabs(p1.y() - p2.y()) < SG_EPSILON && fabs(p1.y() - p3.y()) < SG_EPSILON) { degenerate = true; - } else if ( fabs(p1.z() - p2.z()) < SG_EPSILON && fabs(p1.z() - p3.z()) < SG_EPSILON ) { + } else if (fabs(p1.z() - p2.z()) < SG_EPSILON && fabs(p1.z() - p3.z()) < SG_EPSILON) { degenerate = true; } - if ( degenerate ) { + if (degenerate) { normal = normalize(SGVec3f(p1.x(), p1.y(), p1.z())); } else { v1[0] = p2.x() - p1.x(); @@ -66,90 +67,91 @@ SGVec3f TGConstruct::calc_normal( double area, const SGVec3d& p1, const SGVec3d& return normal; } -void TGConstruct::calc_normals( std::vector& geod_nodes, std::vector& wgs84_nodes, tgPolygon& poly ) { +void TGConstruct::calc_normals(std::vector& geod_nodes, std::vector& wgs84_nodes, tgPolygon& poly) +{ // for each face in the superpoly, calculate a face normal SGVec3f normal; for (unsigned int tri = 0; tri < poly.Triangles(); tri++) { - SGGeod g1 = geod_nodes[ poly.GetTriIdx( tri, 0 ) ]; - SGGeod g2 = geod_nodes[ poly.GetTriIdx( tri, 1 ) ]; - SGGeod g3 = geod_nodes[ poly.GetTriIdx( tri, 2 ) ]; + SGGeod g1 = geod_nodes[poly.GetTriIdx(tri, 0)]; + SGGeod g2 = geod_nodes[poly.GetTriIdx(tri, 1)]; + SGGeod g3 = geod_nodes[poly.GetTriIdx(tri, 2)]; - SGVec3d v1 = wgs84_nodes[ poly.GetTriIdx( tri, 0 ) ]; - SGVec3d v2 = wgs84_nodes[ poly.GetTriIdx( tri, 1 ) ]; - SGVec3d v3 = wgs84_nodes[ poly.GetTriIdx( tri, 2 ) ]; + SGVec3d v1 = wgs84_nodes[poly.GetTriIdx(tri, 0)]; + SGVec3d v2 = wgs84_nodes[poly.GetTriIdx(tri, 1)]; + SGVec3d v3 = wgs84_nodes[poly.GetTriIdx(tri, 2)]; - double area = tgTriangle::area( g1, g2, g3 ); - normal = calc_normal( area, v1, v2, v3 ); + double area = tgTriangle::area(g1, g2, g3); + normal = calc_normal(area, v1, v2, v3); - poly.SetTriFaceArea( tri, area ); - poly.SetTriFaceNormal( tri, normal ); + poly.SetTriFaceArea(tri, area); + poly.SetTriFaceNormal(tri, normal); } } -void TGConstruct::CalcFaceNormals( void ) +void TGConstruct::CalcFaceNormals(void) { // traverse the superpols, and calc normals for each tri within std::vector wgs84_nodes; - nodes.get_wgs84_nodes( wgs84_nodes ); + nodes.get_wgs84_nodes(wgs84_nodes); - std::vector geod_nodes; - nodes.get_geod_nodes( geod_nodes ); + std::vector geod_nodes; + nodes.get_geod_nodes(geod_nodes); for (unsigned int area = 0; area < area_defs.size(); area++) { - for (unsigned int p = 0; p < polys_clipped.area_size(area); p++ ) { - SG_LOG( SG_CLIPPER, SG_DEBUG, "Calculating face normals for " << area_defs.get_area_name(area) << ":" << p+1 << " of " << polys_in.area_size(area) ); - calc_normals( geod_nodes, wgs84_nodes, polys_clipped.get_poly( area, p ) ); + for (unsigned int p = 0; p < polys_clipped.area_size(area); p++) { + SG_LOG(SG_CLIPPER, SG_DEBUG, "Calculating face normals for " << area_defs.get_area_name(area) << ":" << p + 1 << " of " << polys_in.area_size(area)); + calc_normals(geod_nodes, wgs84_nodes, polys_clipped.get_poly(area, p)); } } } -void TGConstruct::CalcPointNormals( void ) +void TGConstruct::CalcPointNormals(void) { // traverse triangle structure building the face normal table SGVec3f normal; - double face_area; + double face_area; std::vector wgs84_nodes; - nodes.get_wgs84_nodes( wgs84_nodes ); + nodes.get_wgs84_nodes(wgs84_nodes); unsigned int one_percent = nodes.size() / 100; unsigned int cur_percent = 1; - for ( unsigned int i = 0; iface_areas.size(); - for ( int j = 0; j < num_faces; j++ ) { - normal = neighbor_faces->face_normals[j]; + for (int j = 0; j < num_faces; j++) { + normal = neighbor_faces->face_normals[j]; face_area = neighbor_faces->face_areas[j]; normal *= face_area; @@ -159,6 +161,6 @@ void TGConstruct::CalcPointNormals( void ) } average /= total_area; - nodes.SetNormal( i, average ); + nodes.SetNormal(i, average); } } \ No newline at end of file diff --git a/src/BuildTiles/Main/tgconstruct_tesselate.cxx b/src/BuildTiles/Main/tgconstruct_tesselate.cxx index 3406bfdd..e4f92f66 100644 --- a/src/BuildTiles/Main/tgconstruct_tesselate.cxx +++ b/src/BuildTiles/Main/tgconstruct_tesselate.cxx @@ -22,7 +22,7 @@ // $Id: construct.cxx,v 1.4 2004-11-19 22:25:49 curt Exp $ #ifdef HAVE_CONFIG_H -# include +#include #endif #include @@ -31,56 +31,55 @@ #include "tgconstruct.hxx" -void TGConstruct::TesselatePolys( void ) +void TGConstruct::TesselatePolys(void) { // tesselate the polygons and prepair them for final output std::vector poly_extra; SGGeod min, max; for (unsigned int area = 0; area < area_defs.size(); area++) { - for (unsigned int p = 0; p < polys_clipped.area_size(area); p++ ) { - tgPolygon poly = polys_clipped.get_poly(area, p ); + for (unsigned int p = 0; p < polys_clipped.area_size(area); p++) { + tgPolygon poly = polys_clipped.get_poly(area, p); - if ( IsDebugShape( poly.GetId() ) ) { + if (IsDebugShape(poly.GetId())) { char layer[32]; - sprintf(layer, "pretess_%u_%u", area, p ); - tgShapefile::FromPolygon( poly, ds_name, layer, "poly" ); + sprintf(layer, "pretess_%u_%u", area, p); + tgShapefile::FromPolygon(poly, ds_name, layer, "poly"); } tgRectangle rect = poly.GetBoundingBox(); - nodes.get_geod_inside( rect.getMin(), rect.getMax(), poly_extra ); + nodes.get_geod_inside(rect.getMin(), rect.getMax(), poly_extra); - SG_LOG( SG_CLIPPER, SG_DEBUG, "Tesselating " << area_defs.get_area_name(area) << "(" << area << "): " << - p+1 << " of " << polys_clipped.area_size(area) << ": id = " << poly.GetId() ); + SG_LOG(SG_CLIPPER, SG_DEBUG, "Tesselating " << area_defs.get_area_name(area) << "(" << area << "): " << p + 1 << " of " << polys_clipped.area_size(area) << ": id = " << poly.GetId()); - if ( IsDebugShape( poly.GetId() ) ) { - SG_LOG( SG_CLIPPER, SG_INFO, poly ); + if (IsDebugShape(poly.GetId())) { + SG_LOG(SG_CLIPPER, SG_INFO, poly); } - poly.Tesselate( poly_extra ); + poly.Tesselate(poly_extra); - polys_clipped.set_poly( area, p, poly ); + polys_clipped.set_poly(area, p, poly); } } for (unsigned int area = 0; area < area_defs.size(); area++) { - bool isRoad = area_defs.is_road_area( area ); - for (unsigned int p = 0; p < polys_clipped.area_size(area); p++ ) { - tgPolygon& poly = polys_clipped.get_poly(area, p ); + bool isRoad = area_defs.is_road_area(area); + for (unsigned int p = 0; p < polys_clipped.area_size(area); p++) { + tgPolygon& poly = polys_clipped.get_poly(area, p); // ensure all added nodes are accounted for - for (unsigned int k=0; k < poly.Triangles(); k++) { + for (unsigned int k = 0; k < poly.Triangles(); k++) { for (int l = 0; l < 3; l++) { // ensure we have all nodes... - SGGeod node = poly.GetTriNode( k, l ); - if ( CheckMatchingNode( node, isRoad, false ) ) { - nodes.unique_add( node ); + SGGeod node = poly.GetTriNode(k, l); + if (CheckMatchingNode(node, isRoad, false)) { + nodes.unique_add(node); } else { - SG_LOG( SG_GENERAL, SG_INFO, "after tesselation, we can't add a node - quit"); + SG_LOG(SG_GENERAL, SG_INFO, "after tesselation, we can't add a node - quit"); exit(1); } } } } } -} \ No newline at end of file +} diff --git a/src/BuildTiles/Main/tglandclass.cxx b/src/BuildTiles/Main/tglandclass.cxx index 5d2782a5..475d63fe 100644 --- a/src/BuildTiles/Main/tglandclass.cxx +++ b/src/BuildTiles/Main/tglandclass.cxx @@ -27,7 +27,7 @@ // $Id: construct.hxx,v 1.13 2004-11-19 22:25:49 curt Exp $ #ifdef HAVE_CONFIG_H -# include +#include #endif #include "tglandclass.hxx" @@ -35,7 +35,7 @@ void TGLandclass::clear(void) { - for (unsigned int i=0; i