1
0
Fork 0

fixed 2 crashes.

- experimental : I haven't seen that this change has any detrimental effectt, and it avoids a
   crash in triangle library if I don't split long edges before diffing the accumulator to
   generate base_poly.  Side effect could be t-junctions, but preliminary look at KATL seemed to give
   the same (poor) effect - sometimes there are vertical gaps between the airport base and the terrain.
 - Bad data on a few airports - Linear feature definition followed immediately by a
   termination node - can't have a single point for linear feature definition, so I discard it.
This commit is contained in:
PSadrozinski 2011-10-16 22:12:21 -04:00 committed by Christian Schmitt
parent 06d0d8bdd9
commit dfb4ece77e
2 changed files with 35 additions and 13 deletions

View file

@ -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);

View file

@ -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;