added support for --start-idx so I can restart after a failed airport.
This commit is contained in:
parent
a377f11dad
commit
06d0d8bdd9
6 changed files with 75 additions and 16 deletions
|
@ -1021,9 +1021,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
0.0 );
|
||||
divided_base = calc_elevations( apt_surf, divided_base, 0.0 );
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "DIVIDED");
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, divided_base);
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()");
|
||||
|
||||
#if 0 // TODO : along with taxiway sign elevations
|
||||
|
@ -1041,7 +1038,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
ws_nodes.push_back( p );
|
||||
}
|
||||
point_list windsock_nodes = calc_elevations( apt_surf, ws_nodes, 0.0 );
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done");
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing beacon node elevations");
|
||||
point_list b_nodes;
|
||||
|
@ -1052,6 +1049,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
b_nodes.push_back( p );
|
||||
}
|
||||
point_list beacon_nodes = calc_elevations( apt_surf, b_nodes, 0.0 );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done");
|
||||
|
||||
// calc taxiway sign elevations:
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing taxiway sign node elevations");
|
||||
|
@ -1063,7 +1061,9 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
ts_nodes.push_back( p );
|
||||
}
|
||||
point_list taxisigns_nodes = calc_elevations( apt_surf, ts_nodes, 0.0 );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done");
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing water buoy elevations");
|
||||
// calc water runway buoys elevations:
|
||||
point_list water_buoys_nodes;
|
||||
if ( waterrunways.size() > 0){
|
||||
|
@ -1085,7 +1085,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// add base skirt (to hide potential cracks)
|
||||
//
|
||||
// this has to happen after we've calculated the node elevations
|
||||
|
|
|
@ -20,6 +20,10 @@ class ClosedPoly
|
|||
public:
|
||||
ClosedPoly( char* desc );
|
||||
ClosedPoly( int st, float s, float th, char* desc );
|
||||
~ClosedPoly()
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Deleting ClosedPoly " << description );
|
||||
}
|
||||
|
||||
inline string GetDescription() { return description; }
|
||||
void AddNode( BezNode* node );
|
||||
|
|
|
@ -156,6 +156,7 @@ int main(int argc, char **argv)
|
|||
float min_lat = -90;
|
||||
float max_lat = 90;
|
||||
bool view_osg = false;
|
||||
long position = 0;
|
||||
|
||||
string_list elev_src;
|
||||
elev_src.clear();
|
||||
|
@ -335,11 +336,13 @@ int main(int argc, char **argv)
|
|||
}
|
||||
else if ( start_id != "" )
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "move forward to " << start_id );
|
||||
|
||||
// scroll forward in datafile
|
||||
parser->AddAirport( start_id );
|
||||
position = parser->FindAirport( start_id );
|
||||
|
||||
// add remaining airports within boundary
|
||||
parser->AddAirports( min_lat, min_lon, max_lat, max_lon );
|
||||
parser->AddAirports( position, min_lat, min_lon, max_lat, max_lon );
|
||||
|
||||
// parse all the airports that were found
|
||||
parser->Parse();
|
||||
|
@ -347,7 +350,7 @@ int main(int argc, char **argv)
|
|||
else
|
||||
{
|
||||
// find all airports within given boundary
|
||||
parser->AddAirports( min_lat, min_lon, max_lat, max_lon );
|
||||
parser->AddAirports( 0, min_lat, min_lon, max_lat, max_lon );
|
||||
|
||||
// and parser them
|
||||
parser->Parse();
|
||||
|
|
|
@ -91,15 +91,55 @@ void Parser::AddAirport( string icao )
|
|||
// this is and airport definition - remember it
|
||||
if ( IsAirportDefinition( line, icao ) )
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << line << " at " << cur_pos );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << icao << " at " << cur_pos );
|
||||
parse_positions.push_back( cur_pos );
|
||||
airport_icaos.push_back( icao );
|
||||
airport_icaos.push_back( icao );
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Parser::AddAirports( float min_lat, float min_lon, float max_lat, float max_lon )
|
||||
long Parser::FindAirport( string icao )
|
||||
{
|
||||
char line[2048];
|
||||
long cur_pos;
|
||||
bool found = false;
|
||||
|
||||
ifstream in( filename.c_str() );
|
||||
if ( !in.is_open() )
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Finding airport " << icao );
|
||||
while ( !in.eof() && !found )
|
||||
{
|
||||
// remember the position of this line
|
||||
cur_pos = in.tellg();
|
||||
|
||||
// get a line
|
||||
in.getline(line, 2048);
|
||||
|
||||
// this is and airport definition - remember it
|
||||
if ( IsAirportDefinition( line, icao ) )
|
||||
{
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << line << " at " << cur_pos );
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (found)
|
||||
{
|
||||
return cur_pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Parser::AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon )
|
||||
{
|
||||
Airport* airport = NULL;
|
||||
char line[2048];
|
||||
|
@ -115,7 +155,6 @@ void Parser::AddAirports( float min_lat, float min_lon, float max_lat, float max
|
|||
done = false;
|
||||
match = false;
|
||||
|
||||
|
||||
// start from current position, and push all airports where a runway start or end
|
||||
// lies within the given min/max coordinates
|
||||
|
||||
|
@ -126,6 +165,11 @@ void Parser::AddAirports( float min_lat, float min_lon, float max_lat, float max
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
if (start_pos)
|
||||
{
|
||||
in.seekg(start_pos, ios::beg);
|
||||
}
|
||||
|
||||
while (!done)
|
||||
{
|
||||
// remember the position of this line
|
||||
|
@ -274,6 +318,7 @@ void Parser::Parse()
|
|||
struct timeval build_time;
|
||||
struct timeval clean_time;
|
||||
struct timeval triangulation_time;
|
||||
time_t curtime;
|
||||
|
||||
ifstream in( filename.c_str() );
|
||||
if ( !in.is_open() )
|
||||
|
@ -288,11 +333,12 @@ void Parser::Parse()
|
|||
SetState(STATE_NONE);
|
||||
in.clear();
|
||||
|
||||
gettimeofday(&parse_start, NULL);
|
||||
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "\n*******************************************************************" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Parsing airport " << airport_icaos[i] << " at position " << parse_positions[i] );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Parsing airport " << airport_icaos[i] << " at " << parse_positions[i] << " start time " << ctime(&parse_start.tv_sec) );
|
||||
in.seekg(parse_positions[i], ios::beg);
|
||||
|
||||
gettimeofday(&parse_start, NULL);
|
||||
while ( !in.eof() && (cur_state != STATE_DONE ) )
|
||||
{
|
||||
in.getline(tmp, 2048);
|
||||
|
|
|
@ -84,9 +84,11 @@ public:
|
|||
prev_node = NULL;
|
||||
cur_state = STATE_NONE;
|
||||
}
|
||||
|
||||
|
||||
// int Parse( char* icao );
|
||||
long FindAirport( string icao );
|
||||
void AddAirport( string icao );
|
||||
void AddAirports( float min_lat, float min_lon, float max_lat, float max_lon );
|
||||
void AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon );
|
||||
void Parse( void );
|
||||
|
||||
// osg::Group* CreateOsgGroup( void );
|
||||
|
|
|
@ -115,6 +115,10 @@ TGPolygon WaterRunway::GetNodes()
|
|||
TGPolygon buoy_nodes;
|
||||
buoy_nodes.erase();
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "WaterRunway::GetNodes" );
|
||||
|
||||
if (buoys == 1){ /*no point to calculate stuff we don't need*/
|
||||
|
||||
double heading, az2, length;
|
||||
// calculate runway heading and length
|
||||
geo_inverse_wgs_84( lat[0], lon[0], lat[1], lon[1], &heading, &az2, &length );
|
||||
|
@ -122,6 +126,7 @@ TGPolygon WaterRunway::GetNodes()
|
|||
// create a polygon for the 4 buoy points
|
||||
// TODO: The amount of points can be increased if needed (more buoys)
|
||||
buoy_nodes = gen_wgs84_area(Point3D( (lon[0] + lon[1]) / 2 , (lat[0] + lat[1]) / 2, 0), length, 0, 0, width, heading, 0, false);
|
||||
}
|
||||
return buoy_nodes;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue