1
0
Fork 0

- min/max lat/lon command line options - can try to parse entire apt.dat

- lot's of cout -> SG_LOG changes so genapt produces minimal output
This commit is contained in:
PSadrozinski 2011-10-15 14:05:19 -04:00 committed by Christian Schmitt
parent db1a734b19
commit 595a190dd3
15 changed files with 283 additions and 95 deletions

View file

@ -366,23 +366,14 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
// TODO : Need runway object...
for (i=0; i<runways.size(); i++)
{
printf("runway %d from (%lf,%lf) to (%lf,%lf) : midpoint is (%lf,%lf)\n",
i,
runways[i]->GetStart().x(), runways[i]->GetStart().y(),
runways[i]->GetEnd().x(), runways[i]->GetEnd().y(),
runways[i]->GetMidpoint().x(), runways[i]->GetMidpoint().y()
);
apt_lon += runways.at(i)->GetMidpoint().x();
apt_lat += runways.at(i)->GetMidpoint().y();
}
apt_lon = apt_lon / (double)runways.size();
apt_lat = apt_lat / (double)runways.size();
printf("Average is (%lf,%lf\n", apt_lon, apt_lat);
SGBucket b( apt_lon, apt_lat );
SG_LOG(SG_GENERAL, SG_INFO, b.gen_base_path() << "/" << b.gen_index_str());
SG_LOG(SG_GENERAL, SG_DEBUG, b.gen_base_path() << "/" << b.gen_index_str());
superpoly_list rwy_lights;
rwy_lights.clear();
@ -404,7 +395,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
{
for ( i=0; i<features.size(); i++ )
{
SG_LOG(SG_GENERAL, SG_ALERT, "Build Feature Poly " << i << ": " << features[i]->GetDescription() );
SG_LOG(SG_GENERAL, SG_DEBUG, "Build Feature Poly " << i << ": " << features[i]->GetDescription() );
// cut the linear feature in until we get the geometry right...
// features[i]->BuildBtg( altitude, &line_polys, &line_tps, &line_accum );
@ -413,7 +404,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
}
else
{
SG_LOG(SG_GENERAL, SG_ALERT, "no markings");
SG_LOG(SG_GENERAL, SG_DEBUG, "no markings");
}
// Build runways next
@ -460,7 +451,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
{
for ( i=0; i<pavements.size(); i++ )
{
SG_LOG(SG_GENERAL, SG_ALERT, "Build Pavement Poly " << i << ": " << pavements[i]->GetDescription());
SG_LOG(SG_GENERAL, SG_DEBUG, "Build Pavement Poly " << i << ": " << pavements[i]->GetDescription());
if (boundary)
{
@ -474,7 +465,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
}
else
{
SG_LOG(SG_GENERAL, SG_ALERT, "no pavements");
SG_LOG(SG_GENERAL, SG_DEBUG, "no pavements");
}
// build the base and clearing if there's a boundary
@ -488,10 +479,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
SG_LOG(SG_GENERAL, SG_ALERT, "no airport points generated");
return;
}
else
{
SG_LOG(SG_GENERAL, SG_ALERT, "Lookin good");
}
TGPolygon filled_base = tgPolygonStripHoles( apt_base );
TGPolygon divided_base = tgPolygonSplitLongEdges( filled_base, 200.0 );
@ -1025,10 +1012,10 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
SG_LOG(SG_GENERAL, SG_DEBUG, "min = " << min_deg << " max = " << max_deg );
TGAptSurface apt_surf( root, elev_src, min_deg, max_deg, average );
SG_LOG(SG_GENERAL, SG_INFO, "Airport surface created");
SG_LOG(SG_GENERAL, SG_DEBUG, "Airport surface created");
// calculate node elevations
SG_LOG(SG_GENERAL, SG_INFO, "Computing airport node elevations");
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing airport node elevations");
point_list geod_nodes = calc_elevations( apt_surf,
nodes.get_node_list(),
0.0 );
@ -1045,7 +1032,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
#endif
// calc windsock elevations:
SG_LOG(SG_GENERAL, SG_INFO, "Computing windsock node elevations");
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing windsock node elevations");
point_list ws_nodes;
ws_nodes.clear();
for ( i = 0; i < (int)windsocks.size(); ++i )
@ -1056,7 +1043,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
point_list windsock_nodes = calc_elevations( apt_surf, ws_nodes, 0.0 );
SG_LOG(SG_GENERAL, SG_INFO, "Computing beacon node elevations");
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing beacon node elevations");
point_list b_nodes;
b_nodes.clear();
for ( i = 0; i < (int)beacons.size(); ++i )
@ -1067,7 +1054,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
point_list beacon_nodes = calc_elevations( apt_surf, b_nodes, 0.0 );
// calc taxiway sign elevations:
SG_LOG(SG_GENERAL, SG_INFO, "Computing taxiway sign node elevations");
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing taxiway sign node elevations");
point_list ts_nodes;
ts_nodes.clear();
for ( i = 0; i < (int)signs.size(); ++i )
@ -1127,7 +1114,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
else
{
string message = "Ooops missing node when building skirt (in init)";
SG_LOG( SG_GENERAL, SG_INFO, message << " " << p );
SG_LOG( SG_GENERAL, SG_ALERT, message << " " << p );
throw sg_exception( message );
}
@ -1152,7 +1139,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
else
{
string message = "Ooops missing node when building skirt (in loop)";
SG_LOG( SG_GENERAL, SG_INFO, message << " " << p );
SG_LOG( SG_GENERAL, SG_ALERT, message << " " << p );
throw sg_exception( message );
}
}
@ -1176,7 +1163,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
else
{
string message = "Ooops missing node when building skirt (at end)";
SG_LOG( SG_GENERAL, SG_INFO, message << " " << p );
SG_LOG( SG_GENERAL, SG_ALERT, message << " " << p );
throw sg_exception( message );
}
@ -1211,7 +1198,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
typedef elev_map_type::const_iterator const_elev_map_iterator;
elev_map_type elevation_map;
SG_LOG(SG_GENERAL, SG_INFO, "Computing runway/approach lighting elevations");
SG_LOG(SG_GENERAL, SG_DEBUG, "Computing runway/approach lighting elevations");
// pass one, calculate raw elevations from Array
for ( i = 0; i < (int)rwy_lights.size(); ++i )
@ -1254,7 +1241,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
}
}
SG_LOG(SG_GENERAL, SG_INFO, "Done with lighting calc_elevations() num light polys is " << rwy_lights.size() );
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with lighting calc_elevations() num light polys is " << rwy_lights.size() );
// pass two, for each light group check if we need to lift (based
// on flag) and do so, then output next structures.
@ -1263,8 +1250,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
// tmp_light_list is a parallel structure to rwy_lights
point_list geod_light_nodes = tmp_light_list[i].get_poly().get_contour(0);
SG_LOG(SG_GENERAL, SG_INFO, "got a point list with " << geod_light_nodes.size() << " points" );
// this is a little round about, but what we want to calculate the
// light node elevations as ground + an offset so we do them
// seperately, then we add them back into nodes to get the index
@ -1335,8 +1320,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
SGBinObject obj;
SG_LOG(SG_GENERAL, SG_ALERT, "number of NODES is " << wgs84_nodes.size() );
obj.set_gbs_center( gbs_center );
obj.set_gbs_radius( gbs_radius );
obj.set_wgs84_nodes( wgs84_nodes );
@ -1414,7 +1397,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
// write out water buoys
for ( i = 0; i < (int)water_buoys_nodes.size(); ++i )
{
write_index_shared( objpath, b, water_buoys_nodes[i],
write_index_shared( objpath, b, water_buoys_nodes[i],
"Models/Airport/water_rw_buoy.xml",
0.0 );
}

View file

@ -46,7 +46,6 @@ public:
void AddFeature( LinearFeature* feature )
{
SG_LOG(SG_GENERAL, SG_ALERT, "Adding Feature");
features.push_back( feature );
}

View file

@ -139,7 +139,7 @@ TGAptSurface::TGAptSurface( const string& path,
// interesting
if ( xdivs < 8 ) { xdivs = 8; }
if ( ydivs < 8 ) { ydivs = 8; }
SG_LOG(SG_GENERAL, SG_INFO, " M(" << ydivs << "," << xdivs << ")");
SG_LOG(SG_GENERAL, SG_DEBUG, " M(" << ydivs << "," << xdivs << ")");
double dlon = x_deg / xdivs;
double dlat = y_deg / ydivs;
@ -307,13 +307,13 @@ static ColumnVector qr_method( Real* y,
Real* t13, Real* t14, Real* t15,
int nobs, int npred )
{
cout << "QR triangularisation" << endl;;
SG_LOG(SG_GENERAL, SG_DEBUG, "QR triangularisation" );
// QR triangularisation method
// load data - 1s into col 1 of matrix
int npred1 = npred+1;
cout << "nobs = " << nobs << " npred1 = " << npred1 << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "nobs = " << nobs << " npred1 = " << npred1 );
Matrix X(nobs,npred1); ColumnVector Y(nobs);
X.column(1) = 1.0;
@ -437,10 +437,9 @@ void TGAptSurface::fit() {
&t9[0], &t10[0], &t11[0], &t12[0], &t13[0], &t14[0], &t15[0],
nobs, npred
);
cout << "surface_coefficients size = " << surface_coefficients.nrows() << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "surface_coefficients size = " << surface_coefficients.nrows() );
}
CatchAll { cout << BaseException::what(); }
}

View file

@ -30,6 +30,11 @@ public:
Helipad(char* def);
void BuildBtg( float alt_m, superpoly_list* heli_polys, texparams_list* texparams, superpoly_list* heli_lights, ClipPolyType* accum, TGPolygon* apt_base, TGPolygon* apt_clearing );
Point3D GetLoc()
{
return Point3D( heli.lon, heli.lat, 0.0f );
}
private:
struct TGRunway {
// data for whole runway

View file

@ -2836,8 +2836,9 @@ void Runway::gen_runway_lights( float alt_m, superpoly_list *lights ) {
lights->push_back( s[i] );
}
}
cout << "Edge light = " << rwy.edge_lights << " Centre light = " << rwy.centerline_lights << endl;
cout << "ALC1 flag = " << rwy.approach_lights[0] << " ALC2 flag2 = " << rwy.approach_lights[1] << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "Edge light = " << rwy.edge_lights << " Centre light = " << rwy.centerline_lights );
SG_LOG(SG_GENERAL, SG_DEBUG, "ALC1 flag = " << rwy.approach_lights[0] << " ALC2 flag2 = " << rwy.approach_lights[1] );
// Many aproach lighting systems define the threshold lighting
// needed, but for those that don't (i.e. REIL, ODALS, or Edge
// lights defined but no approach lights)
@ -2849,7 +2850,7 @@ void Runway::gen_runway_lights( float alt_m, superpoly_list *lights ) {
approach lighting */ )
{
// forward direction
cout << "threshold lights for forward direction" << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "threshold lights for forward direction" );
superpoly_list s = gen_runway_threshold_lights( 0,
alt_m, false );
for ( i = 0; i < s.size(); ++i ) {
@ -2862,7 +2863,7 @@ void Runway::gen_runway_lights( float alt_m, superpoly_list *lights ) {
approach lighting */ )
{
// reverse direction
cout << "threshold lights for reverse direction" << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "threshold lights for reverse direction" );
superpoly_list s = gen_runway_threshold_lights( 0,
alt_m, true );
for ( i = 0; i < s.size(); ++i ) {

View file

@ -22,7 +22,7 @@ Sign::Sign( char* definition )
sscanf(definition, "%lf %lf %lf %d %d %s", &lat, &lon, &heading, &reserved, &size, sgdef );
SG_LOG(SG_GENERAL, SG_ALERT, "Read Sign: (" << lon << "," << lat << ") heading " << heading << " size " << size << " definition: " << sgdef );
SG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << ") heading " << heading << " size " << size << " definition: " << sgdef );
sgn_def = sgdef;
}

View file

@ -319,8 +319,6 @@ int main(int argc, char **argv)
exit(-1);
}
SG_LOG(SG_GENERAL, SG_INFO, "Creating parser");
// Create the parser...
Parser* parser = new Parser(input_file, work_dir, elev_src);
@ -335,7 +333,6 @@ int main(int argc, char **argv)
// and start the parser
parser->Parse();
}
#if 0
else if ( start_id != "" )
{
// scroll forward in datafile
@ -355,7 +352,6 @@ int main(int argc, char **argv)
// and parser them
parser->Parse();
}
#endif
SG_LOG(SG_GENERAL, SG_INFO, "Done");

View file

@ -28,7 +28,6 @@ bool Parser::IsAirportDefinition( char* line, string icao )
airport = new Airport( code, line );
if ( airport->GetIcao() == icao )
{
match = true;
}
break;
@ -80,7 +79,7 @@ void Parser::AddAirport( string icao )
exit(-1);
}
SG_LOG( SG_GENERAL, SG_ALERT, "Adding airport " << icao << " to parse list");
SG_LOG( SG_GENERAL, SG_INFO, "Adding airport " << icao << " to parse list");
while ( !in.eof() && !found )
{
// remember the position of this line
@ -92,13 +91,209 @@ void Parser::AddAirport( string icao )
// this is and airport definition - remember it
if ( IsAirportDefinition( line, icao ) )
{
SG_LOG( SG_GENERAL, SG_ALERT, "Found airport " << line << " at " << cur_pos );
SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << line << " at " << cur_pos );
parse_positions.push_back( cur_pos );
found = true;
}
}
}
void 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 );
parse_positions.push_back( cur_pos );
found = true;
}
}
}
void Parser::AddAirports( float min_lat, float min_lon, float max_lat, float max_lon )
{
Airport* airport = NULL;
char line[2048];
char* def;
long cur_pos;
long cur_apt_pos;
string cur_apt_name;
char* tok;
int code;
bool match;
bool done;
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
ifstream in( filename.c_str() );
if ( !in.is_open() )
{
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename );
exit(-1);
}
while (!done)
{
// remember the position of this line
cur_pos = in.tellg();
// get a line
in.getline(line, 2048);
def = &line[0];
// Get the number code
tok = strtok(def, " \t\r\n");
if (tok)
{
def += strlen(tok)+1;
code = atoi(tok);
switch(code)
{
case LAND_AIRPORT_CODE:
case SEA_AIRPORT_CODE:
case HELIPORT_CODE:
{
Airport* airport = new Airport( code, def );
if (match)
{
parse_positions.push_back( cur_apt_pos );
airport_icaos.push_back( cur_apt_name );
}
// remember this new apt pos and name, and clear match
cur_apt_pos = cur_pos;
cur_apt_name = airport->GetIcao();
delete airport;
match = false;
}
break;
case END_OF_FILE:
if (match)
{
parse_positions.push_back( cur_apt_pos );
airport_icaos.push_back( cur_apt_name );
}
done = true;
break;
case LAND_RUNWAY_CODE:
// if the the runway start / end coords are within the rect,
// we have a winner
{
Runway* runway = new Runway(def);
Point3D start = runway->GetStart();
Point3D end = runway->GetEnd();
if ( (start.x() >= min_lon ) &&
(start.y() >= min_lat ) &&
(start.x() <= max_lon ) &&
(start.y() <= max_lat ) ) {
match = true;
}
else if ( (end.x() >= min_lon ) &&
(end.y() >= min_lat ) &&
(end.x() <= max_lon ) &&
(end.y() <= max_lat ) ) {
match = true;
}
delete runway;
}
break;
case WATER_RUNWAY_CODE:
// if the the runway start / end coords are within the rect,
// we have a winner
{
WaterRunway* runway = new WaterRunway(def);
Point3D start = runway->GetStart();
Point3D end = runway->GetEnd();
if ( (start.x() >= min_lon ) &&
(start.y() >= min_lat ) &&
(start.x() <= max_lon ) &&
(start.y() <= max_lat ) ) {
match = true;
}
else if ( (end.x() >= min_lon ) &&
(end.y() >= min_lat ) &&
(end.x() <= max_lon ) &&
(end.y() <= max_lat ) ) {
match = true;
}
delete runway;
}
break;
case HELIPAD_CODE:
// if the heliport coords are within the rect, we have
// a winner
{
Helipad* helipad = new Helipad(def);
Point3D loc = helipad->GetLoc();
if ( (loc.x() >= min_lon ) &&
(loc.y() >= min_lat ) &&
(loc.x() <= max_lon ) &&
(loc.y() <= max_lat ) ) {
match = true;
}
delete helipad;
}
break;
case PAVEMENT_CODE:
case LINEAR_FEATURE_CODE:
case BOUNDRY_CODE:
case NODE_CODE:
case BEZIER_NODE_CODE:
case CLOSE_NODE_CODE:
case CLOSE_BEZIER_NODE_CODE:
case TERM_NODE_CODE:
case TERM_BEZIER_NODE_CODE:
case AIRPORT_VIEWPOINT_CODE:
case AIRPLANE_STARTUP_LOCATION_CODE:
case LIGHT_BEACON_CODE:
case WINDSOCK_CODE:
case TAXIWAY_SIGN:
case LIGHTING_OBJECT:
case COMM_FREQ1_CODE:
case COMM_FREQ2_CODE:
case COMM_FREQ3_CODE:
case COMM_FREQ4_CODE:
case COMM_FREQ5_CODE:
case COMM_FREQ6_CODE:
case COMM_FREQ7_CODE:
break;
}
}
}
}
void Parser::Parse()
{
char tmp[2048];
@ -124,7 +319,8 @@ void Parser::Parse()
SetState(STATE_NONE);
in.clear();
SG_LOG( SG_GENERAL, SG_ALERT, "seeking to " << parse_positions[i] );
SG_LOG( SG_GENERAL, SG_ALERT, "\n*******************************************************************" );
SG_LOG( SG_GENERAL, SG_ALERT, "Parsing airport " << airport_icaos[i] << " at " << parse_positions[i] );
in.seekg(parse_positions[i], ios::beg);
gettimeofday(&parse_start, NULL);
@ -152,10 +348,10 @@ void Parser::Parse()
}
SG_LOG( SG_GENERAL, SG_ALERT, "Time to parse " << parse_time.tv_sec << ":" << parse_time.tv_usec );
SG_LOG( SG_GENERAL, SG_ALERT, "Time to build " << build_time.tv_sec << ":" << build_time.tv_usec );
SG_LOG( SG_GENERAL, SG_ALERT, "Time to clean up " << clean_time.tv_sec << ":" << clean_time.tv_usec );
SG_LOG( SG_GENERAL, SG_ALERT, "Time to triangulate " << triangulation_time.tv_sec << ":" << triangulation_time.tv_usec );
SG_LOG( SG_GENERAL, SG_DEBUG, "Time to parse " << parse_time.tv_sec << ":" << parse_time.tv_usec );
SG_LOG( SG_GENERAL, SG_DEBUG, "Time to build " << build_time.tv_sec << ":" << build_time.tv_usec );
SG_LOG( SG_GENERAL, SG_DEBUG, "Time to clean up " << clean_time.tv_sec << ":" << clean_time.tv_usec );
SG_LOG( SG_GENERAL, SG_DEBUG, "Time to triangulate " << triangulation_time.tv_sec << ":" << triangulation_time.tv_usec );
}
}
@ -584,7 +780,7 @@ int Parser::ParseLine(char* line)
break;
case WINDSOCK_CODE:
SetState( STATE_PARSE_SIMPLE );
SG_LOG(SG_GENERAL, SG_ALERT, "Parsing windsock: " << line);
SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing windsock: " << line);
cur_windsock = new Windsock(line);
cur_airport->AddWindsock( cur_windsock );
break;

View file

@ -59,6 +59,7 @@ using namespace std;
typedef std::vector <long> ParseList;
typedef std::vector <string> IcaoList;
class Parser
{
@ -128,6 +129,7 @@ private:
// List of positions in database file to parse
ParseList parse_positions;
IcaoList airport_icaos;
};
#endif

View file

@ -168,7 +168,7 @@ int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* te
{
case 1: // asphalt:
case 2: // concrete
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: asphalt or concrete" << rwy.surface);
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete" << rwy.surface);
gen_rwy( alt_m, material, rwy_polys, texparams, accum );
gen_runway_lights( alt_m, rwy_lights );
break;
@ -176,29 +176,29 @@ int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* te
case 3: // Grass
case 4: // Dirt
case 5: // Gravel
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: Turf, Dirt or Gravel" << rwy.surface );
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Turf, Dirt or Gravel" << rwy.surface );
gen_simple_rwy( alt_m, material, rwy_polys, texparams, accum );
gen_runway_lights( alt_m, rwy_lights );
break;
case 12: // dry lakebed
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: Dry Lakebed");
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Dry Lakebed");
break;
case 13: // water
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: Water");
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Water");
break;
case 14: // snow
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: Snow");
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Snow");
break;
case 15: // transparent
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: transparent");
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: transparent");
break;
default: // unknown
SG_LOG( SG_GENERAL, SG_ALERT, "Build Runway: unknown" << rwy.surface);
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: unknown" << rwy.surface);
break;
}

View file

@ -153,6 +153,16 @@ class WaterRunway
public:
WaterRunway(char* def);
Point3D GetStart(void)
{
return ( Point3D( lon[0], lat[0], 0.0f ));
}
Point3D GetEnd(void)
{
return ( Point3D( lon[1], lat[1], 0.0f ));
}
double width;
int buoys;
char rwnum[2][16];

View file

@ -112,7 +112,7 @@ void Runway::gen_rw_marking( const TGPolygon& runway,
double length = rwy.length / 2.0;
for ( int i=0; i < rw_marking_list.size(); ++i) {
SG_LOG(SG_GENERAL, SG_INFO, "Runway section texture = " << rw_marking_list[i].tex << " lenght: " << rw_marking_list[i].size);
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway section texture = " << rw_marking_list[i].tex << " lenght: " << rw_marking_list[i].size);
if ( end1_pct < 1.0 ) {
start1_pct = end1_pct;
@ -141,7 +141,7 @@ void Runway::gen_rwy( double alt_m,
texparams_list *texparams,
ClipPolyType *accum )
{
SG_LOG( SG_GENERAL, SG_INFO, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]);
SG_LOG( SG_GENERAL, SG_DEBUG, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]);
//
// Generate the basic runway outlines
@ -186,7 +186,7 @@ for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
double length = rwy.length / 2.0;
if ( length < 3075 * SG_FEET_TO_METER ) {
SG_LOG( SG_GENERAL, SG_ALERT,
SG_LOG( SG_GENERAL, SG_DEBUG,
"Runway " << rwy.rwnum[0] << " is not long enough ("
<< rwy.length << ") for precision markings!");
}
@ -209,9 +209,9 @@ for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
heading = rwy.heading;
rwname = rwy.rwnum[1];
}
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << rwy.marking[rwhalf] );
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
if ( rwy.threshold[rwhalf] > 0.0 ) {
SG_LOG( SG_GENERAL, SG_INFO, "Displaced threshold for RW side " << rwhalf << " is "
SG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is "
<< rwy.threshold[rwhalf] );
// reserve 90' for final arrows

View file

@ -78,11 +78,11 @@ for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
else if (rwhalf == 1) {
heading = rwy.heading;
}
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << rwy.marking[rwhalf] );
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
// Displaced threshold if it exists
if ( rwy.threshold[rwhalf] > 0.0 ) {
SG_LOG( SG_GENERAL, SG_INFO, "Displaced threshold for RW side " << rwhalf << " is "
SG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is "
<< rwy.threshold[rwhalf] );
start1_pct = end1_pct;

View file

@ -35,6 +35,7 @@
#include <simgear/misc/strutils.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/math/leastsqs.hxx>
#include <simgear/debug/logstream.hxx>
#include "array.hxx"
@ -78,10 +79,10 @@ bool TGArray::open( const string& file_base ) {
string array_name = file_base + ".arr.gz";
array_in = new sg_gzifstream( array_name );
if ( ! array_in->is_open() ) {
cout << " Cannot open " << array_name << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " Cannot open " << array_name );
success = false;
} else {
cout << " Opening array data file: " << array_name << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " Opening array data file: " << array_name );
}
// open fitted data file
@ -92,9 +93,9 @@ bool TGArray::open( const string& file_base ) {
// can do a really stupid/crude fit on the fly, but it will
// not be nearly as nice as what the offline terrafit utility
// would have produced.
cout << " Cannot open " << fitted_name << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " Cannot open " << fitted_name );
} else {
cout << " Opening fitted data file: " << fitted_name << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " Opening fitted data file: " << fitted_name );
}
return success;
@ -126,10 +127,9 @@ TGArray::parse( SGBucket& b ) {
*array_in >> cols >> col_step;
*array_in >> rows >> row_step;
cout << " origin = " << originx << " " << originy << endl;
cout << " cols = " << cols << " rows = " << rows << endl;
cout << " col_step = " << col_step
<< " row_step = " << row_step <<endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " origin = " << originx << " " << originy );
SG_LOG(SG_GENERAL, SG_DEBUG, " cols = " << cols << " rows = " << rows );
SG_LOG(SG_GENERAL, SG_DEBUG, " col_step = " << col_step << " row_step = " << row_step );
for ( int i = 0; i < cols; i++ ) {
for ( int j = 0; j < rows; j++ ) {
@ -137,7 +137,7 @@ TGArray::parse( SGBucket& b ) {
}
}
cout << " Done parsing\n";
SG_LOG(SG_GENERAL, SG_DEBUG, " Done parsing" );
} else {
// file not open (not found?), fill with zero'd data
@ -152,10 +152,9 @@ TGArray::parse( SGBucket& b ) {
rows = 3;
row_step = (max_y - originy) / (rows - 1);
cout << " origin = " << originx << " " << originy << endl;
cout << " cols = " << cols << " rows = " << rows << endl;
cout << " col_step = " << col_step
<< " row_step = " << row_step <<endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " origin = " << originx << " " << originy );
SG_LOG(SG_GENERAL, SG_DEBUG, " cols = " << cols << " rows = " << rows );
SG_LOG(SG_GENERAL, SG_DEBUG, " col_step = " << col_step << " row_step = " << row_step );
for ( int i = 0; i < cols; i++ ) {
for ( int j = 0; j < rows; j++ ) {
@ -163,7 +162,7 @@ TGArray::parse( SGBucket& b ) {
}
}
cout << " File not open, so using zero'd data" << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, " File not open, so using zero'd data" );
}
// Parse/load the fitted data file
@ -192,16 +191,16 @@ bool TGArray::write( const string root_dir, SGBucket& b ) {
sgp.create_dir( 0755 );
string array_file = path + "/" + b.gen_index_str() + ".arr.new.gz";
cout << "array_file = " << array_file << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "array_file = " << array_file );
// write the file
gzFile fp;
if ( (fp = gzopen( array_file.c_str(), "wb9" )) == NULL ) {
cout << "ERROR: cannot open " << array_file << " for writing!" << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "ERROR: cannot open " << array_file << " for writing!" );
return false;
}
cout << "origin = " << originx << ", " << originy << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "origin = " << originx << ", " << originy );
gzprintf( fp, "%d %d\n", (int)originx, (int)originy );
gzprintf( fp, "%d %d %d %d\n", cols, (int)col_step, rows, (int)row_step );
for ( int i = 0; i < cols; ++i ) {
@ -306,7 +305,7 @@ void TGArray::add_corner_node( int i, int j, double val ) {
double x = (originx + i * col_step) / 3600.0;
double y = (originy + j * row_step) / 3600.0;
// cout << "originx = " << originx << " originy = " << originy << endl;
cout << "corner = " << Point3D(x, y, val) << endl;
SG_LOG(SG_GENERAL, SG_DEBUG, "corner = " << Point3D(x, y, val) );
corner_list.push_back( Point3D(x, y, val) );
}

View file

@ -96,25 +96,23 @@ static void clip_and_write_poly( string root, long int p_index,
fclose(bfp);
*/
cout << "shape contours = " << shape.contours() << " ";
SG_LOG(SG_GENERAL, SG_DEBUG, "shape contours = " << shape.contours() );
for ( int ii = 0; ii < shape.contours(); ii++ ) {
cout << "hole = " << shape.get_hole_flag(ii) << " ";
SG_LOG(SG_GENERAL, SG_DEBUG, " hole = " << shape.get_hole_flag(ii) );
}
cout << endl;
result = tgPolygonInt( base, shape );
// write_polygon(shape, "shape");
// write_polygon(result, "result");
cout << "result contours = " << result.contours() << " ";
SG_LOG(SG_GENERAL, SG_DEBUG, "result contours = " << result.contours() );
for ( int ii = 0; ii < result.contours(); ii++ ) {
cout << "hole = " << result.get_hole_flag(ii) << " ";
SG_LOG(SG_GENERAL, SG_DEBUG, " hole = " << result.get_hole_flag(ii) );
//if ( result.get_hole_flag(ii) ) {
// exit(0);
//}
}
cout << endl;
if ( preserve3d ) {
result.inherit_elevations( shape );
}