1
0
Fork 0

GenAirport: Support apt.dat version 1100 parsing

GenAirport: Fix typos
This commit is contained in:
xDraconian 2018-06-16 18:31:10 -05:00 committed by James Turner
parent c9dee9e9b5
commit acfecfbc4d
6 changed files with 57 additions and 24 deletions

View file

@ -55,19 +55,25 @@ Airport::Airport( int c, char* def)
switch( numParams )
{
case 0:
// airport elevation (feet MSL)
altitude = atoi(tok);
break;
case 1:
ct = atoi(tok);
// Airport has a control tower (1=yes, 0=no)
// deprecated v10.00
// ct = atoi(tok);
break;
case 2:
// deprecated - ignore
// default airport buildings (1=yes, 0=no)
// deprecated v8.50
break;
case 3:
// ICAO code (FAA code when ICAO doesn't exist)
icao = tok;
// tok-4 = airport name
description = def;
done = true;
break;
@ -78,7 +84,7 @@ Airport::Airport( int c, char* def)
altitude *= SG_FEET_TO_METER;
TG_LOG( SG_GENERAL, SG_DEBUG, "Read airport with icao " << icao << ", control tower " << ct << ", and description " << description );
TG_LOG(SG_GENERAL, SG_DEBUG, "Read airport with icao " << icao << ", and description " << description);
}
Airport::~Airport()

View file

@ -48,7 +48,7 @@ ClosedPoly::ClosedPoly( int st, float s, float th, char* desc )
smoothness = s;
texture_heading = th;
is_pavement = (surface_type != 15) ? true : false;
is_pavement = (surface_type != 15) ? true : false; // wrong??
is_border = false;
has_feature = true;

View file

@ -13,6 +13,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#include <memory>
#include <string>
#include <iostream>
@ -76,12 +77,12 @@ static void help( int argc, char **argv, const string_list& elev_src ) {
cout << "or by area. By airport, either one airport can be specified using --airport=abcd, where abcd is \n";
cout << "a valid airport code eg. --airport-id=KORD, or a starting airport can be specified using --start-id=abcd \n";
cout << "where once again abcd is a valid airport code. In this case, all airports in the file subsequent to the \n";
cout << "start-id are done. This is convienient when re-starting after a previous error. \n";
cout << "If you want to restart with the airport after a problam icao, use --restart-id=abcd, as this works the same as\n";
cout << "start-id are done. This is convenient when re-starting after a previous error. \n";
cout << "If you want to restart with the airport after a problem icao, use --restart-id=abcd, as this works the same as\n";
cout << " with the exception that the airport abcd is skipped \n";
cout << "\nAn input area may be specified by lat and lon extent using min and max lat and lon. \n";
cout << "Alternatively, you may specify a chunk (10 x 10 degrees) or tile (1 x 1 degree) using a string \n";
cout << "such as eg. w080n40, e000s27. \n";
//cout << "Alternatively, you may specify a chunk (10 x 10 degrees) or tile (1 x 1 degree) using a string \n";
//cout << "such as eg. w080n40, e000s27. \n";
cout << "\nAn input file containing only a subset of the world's \n";
cout << "airports may of course be used.\n";
cout << "\n\n";
@ -339,13 +340,14 @@ int main(int argc, char **argv)
in.getline(line, 20);
in.close();
int code = atoi(line);
if (code == 810) {
TG_LOG( SG_GENERAL, SG_ALERT, "ERROR: This version of genapts does not support version 810 apt.dat files." );
exit(-1);
if (code == 810 || code > 1100) {
TG_LOG(SG_GENERAL, SG_ALERT, "ERROR: This genapts version does not support apt.data version " << code << " files.");
exit(-1);
}
// Create the scheduler
Scheduler* scheduler = new Scheduler(input_file, work_dir, elev_src);
// auto scheduler = std::unique_ptr<Scheduler>(new Scheduler(input_file, work_dir, elev_src));
// Add any debug
scheduler->set_debug( debug_dir, debug_runway_defs, debug_pavement_defs, debug_taxiway_defs, debug_feature_defs );

View file

@ -203,7 +203,7 @@ void Parser::run()
// get a line
in.getline(line, 2048);
// Verify this is and airport definition and get the icao
// Verify this is an airport definition and get the icao
if( GetAirportDefinition( line, icao ) ) {
TG_LOG( SG_GENERAL, SG_INFO, "Found airport " << icao << " at " << pos );
@ -402,7 +402,7 @@ LinearFeature* Parser::ParseFeature( char* line )
feature = new LinearFeature(NULL, 0.0f);
}
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Linear Feature with desription \"" << line << "\"");
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Linear Feature with description \"" << line << "\"");
return feature;
}
@ -410,10 +410,10 @@ LinearFeature* Parser::ParseFeature( char* line )
ClosedPoly* Parser::ParsePavement( char* line )
{
ClosedPoly* poly;
int st = 0;
float s = 0.0f;
float th = 0.0f;
char desc[256];
int st = 0; // surface type
float s = 0.0f; // smoothness
float th = 0.0f; // texture heading
char desc[256]; // description
char *d = NULL;
int numParams;
@ -422,11 +422,11 @@ ClosedPoly* Parser::ParsePavement( char* line )
if (numParams == 4)
{
d = strstr(line,desc);
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Closed Poly with st " << st << " smoothness " << s << " thexture heading " << th << " and description " << d);
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Closed Poly with st " << st << " smoothness " << s << " texture heading " << th << " and description " << d);
}
else
{
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Closed Poly with st " << st << " smoothness " << s << " thexture heading " << th );
TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Closed Poly with st " << st << " smoothness " << s << " texture heading " << th);
}
poly = new ClosedPoly(st, s, th, d);
@ -580,7 +580,7 @@ int Parser::ParseLine(char* line)
cur_feat = ParseFeature( line );
break;
case BOUNDRY_CODE:
case BOUNDARY_CODE:
SetState( STATE_PARSE_BOUNDARY );
TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing Boundary: " << line);
cur_boundary = ParseBoundary( line );

View file

@ -34,7 +34,7 @@
#define PAVEMENT_CODE (110)
#define LINEAR_FEATURE_CODE (120)
#define BOUNDRY_CODE (130)
#define BOUNDARY_CODE (130)
#define NODE_CODE (111)
#define BEZIER_NODE_CODE (112)
@ -60,6 +60,31 @@
#define END_OF_FILE (99)
#define AIRPORT_TRAFFIC_FLOW (1000)
#define TRAFFIC_FLOW_WIND_RULE (1001)
#define TRAFFIC_FLOW_MIN_CEILING_RULE (1002)
#define TRAFFIC_FLOW_MIN_VISIBILITY_RULE (1003)
#define TRAFFIC_FLOW_TIME_RULE (1004)
#define RWY_ARR_DEP_CONSTRAINTS (1100)
#define VFR_TRAFFIC_PATTERN (1101)
#define TAXI_ROUTE_NETWORK_HEADER (1200)
#define TAXI_ROUTE_NETWORK_NODE (1201)
#define TAXI_ROUTE_NETWORK_EDGE (1202)
#define TAXI_ROUTE_NETWORK_OBSOLETE (1203)
#define TAXI_ROUTE_EDGE_ACTIVE_ZONE (1204)
#define TAXI_ROUTE_EDGE_CONTROL (1205)
#define TAXI_ROUTE_EDGE_GROUND_VEHICLES (1206)
#define START_UP_LOCATION (1300)
#define START_UP_LOCATION_METADATA (1301)
#define AIRPORT_IDENTIFICATION_METADATA (1302)
#define TRUCK_PARKING_LOCATION (1400)
#define TRUCK_DESTINATION_LOCATION (1401)
class Parser : public SGThread
{
public:

View file

@ -208,7 +208,7 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao )
case HELIPAD_CODE:
case PAVEMENT_CODE:
case LINEAR_FEATURE_CODE:
case BOUNDRY_CODE:
case BOUNDARY_CODE:
case NODE_CODE:
case BEZIER_NODE_CODE:
case CLOSE_NODE_CODE:
@ -259,7 +259,7 @@ void Scheduler::AddAirport( std::string icao )
// get a line
in.getline(line, 2048);
// this is and airport definition - remember it
// this is an airport definition - remember it
if ( IsAirportDefinition( line, icao ) )
{
TG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << icao << " at " << cur_pos );
@ -441,7 +441,7 @@ bool Scheduler::AddAirports( long start_pos, tgRectangle* boundingBox )
case TAXIWAY_CODE:
case PAVEMENT_CODE:
case LINEAR_FEATURE_CODE:
case BOUNDRY_CODE:
case BOUNDARY_CODE:
case NODE_CODE:
case BEZIER_NODE_CODE:
case CLOSE_NODE_CODE: