diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index 0ddb0ca7..f68cdb64 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -482,7 +482,8 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src ) TGPolygon filled_base = tgPolygonStripHoles( apt_base ); TGPolygon divided_base = tgPolygonSplitLongEdges( filled_base, 200.0 ); - TGPolygon base_poly = tgPolygonDiff( divided_base, accum ); + TGPolygon base_poly = tgPolygonDiff( filled_base, accum ); + //TGPolygon base_poly = tgPolygonDiff( divided_base, accum ); gettimeofday(&build_end, NULL); timersub(&build_end, &build_start, &build_time); @@ -713,8 +714,13 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src ) line_polys[i].set_texcoords( tc ); } - SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating base"); - TGPolygon base_tris = polygon_tesselate_alt( base_poly ); +#if 0 + { + string polypath = root + "/AirportArea"; + tgChopNormalPolygon( polypath, "Base", base_poly, false ); + } +#endif + TGPolygon base_tris = polygon_tesselate_alt( base_poly ); gettimeofday(&triangulation_end, NULL); timersub(&triangulation_end, &triangulation_start, &triangulation_time); diff --git a/src/Airports/GenAirports850/parser.cxx b/src/Airports/GenAirports850/parser.cxx index 37a9e318..6175b79c 100644 --- a/src/Airports/GenAirports850/parser.cxx +++ b/src/Airports/GenAirports850/parser.cxx @@ -746,6 +746,7 @@ int Parser::ParseLine(char* line) cur_feat->Finish(); cur_airport->AddFeature( cur_feat ); } + cur_feat = NULL; SetState( STATE_NONE ); } prev_node = NULL; @@ -755,24 +756,39 @@ int Parser::ParseLine(char* line) case TERM_NODE_CODE: case TERM_BEZIER_NODE_CODE: SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing termination node: " << line); - cur_node = ParseNode( code, line, prev_node ); if ( cur_state == STATE_PARSE_FEATURE ) { - if (cur_node != prev_node) + // we have some bad data - termination nodes right after the + // linear feature declaration - can't do anything with a + // single point - detect and delete. + if ( prev_node ) { - cur_feat->AddNode( prev_node ); - cur_feat->AddNode( cur_node ); + cur_node = ParseNode( code, line, prev_node ); + + if (cur_node != prev_node) + { + cur_feat->AddNode( prev_node ); + cur_feat->AddNode( cur_node ); + } + else + { + cur_feat->AddNode( cur_node ); + } + if (cur_airport) + { + cur_feat->Finish(); + cur_airport->AddFeature( cur_feat ); + } } else { - cur_feat->AddNode( cur_node ); - } - if (cur_airport) - { - cur_feat->Finish(); - cur_airport->AddFeature( cur_feat ); + SG_LOG(SG_GENERAL, SG_ALERT, "Parsing termination node with no previous nodes!!!" ); + + // this feature is bogus... + delete cur_feat; } + cur_feat = NULL; SetState( STATE_NONE ); } prev_node = NULL;