From 0d0d1d36c9f992ddd2670221c79ae12115e3e784 Mon Sep 17 00:00:00 2001 From: Christian Schmitt Date: Fri, 8 Feb 2013 11:26:22 +0100 Subject: [PATCH] Adapt logging function to SG logstream changes and enable multithreaded output again --- src/Airports/GenAirports850/airport.cxx | 173 +++++++++--------- src/Airports/GenAirports850/beznode.hxx | 4 +- src/Airports/GenAirports850/closedpoly.cxx | 42 ++--- src/Airports/GenAirports850/debug.cxx | 1 - src/Airports/GenAirports850/debug.hxx | 21 +-- src/Airports/GenAirports850/elevations.cxx | 6 +- src/Airports/GenAirports850/helipad.cxx | 2 +- src/Airports/GenAirports850/linearfeature.cxx | 74 ++++---- .../GenAirports850/linked_objects.cxx | 6 +- src/Airports/GenAirports850/main.cxx | 38 ++-- src/Airports/GenAirports850/object.cxx | 16 +- src/Airports/GenAirports850/parser.cxx | 88 ++++----- src/Airports/GenAirports850/runway.cxx | 18 +- src/Airports/GenAirports850/rwy_gen.cxx | 32 ++-- src/Airports/GenAirports850/rwy_simple.cxx | 4 +- src/Airports/GenAirports850/scheduler.cxx | 50 ++--- src/Airports/GenAirports850/scheduler.hxx | 2 +- src/Airports/GenAirports850/taxiway.cxx | 4 +- 18 files changed, 289 insertions(+), 292 deletions(-) diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index 297ce877..474101b0 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -20,6 +20,7 @@ #include "airport.hxx" #include "beznode.hxx" +#include "debug.hxx" #include "elevations.hxx" #include "global.hxx" #include "helipad.hxx" @@ -76,7 +77,7 @@ Airport::Airport( int c, char* def) altitude *= SG_FEET_TO_METER; - SG_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 << ", control tower " << ct << ", and description " << description ); } Airport::~Airport() @@ -317,7 +318,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) apt_lat = apt_lat / (double)num_samples; SGBucket b( apt_lon, apt_lat ); - SG_LOG(SG_GENERAL, SG_DEBUG, b.gen_base_path() << "/" << b.gen_index_str()); + TG_LOG(SG_GENERAL, SG_DEBUG, b.gen_base_path() << "/" << b.gen_index_str()); // If we are cutting in the linear features, add them first if (pavements.size()) @@ -328,7 +329,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } } - SG_LOG(SG_GENERAL, SG_INFO, "Parse Complete - Runways: " << runways.size() << " Pavements: " << pavements.size() << " Features: " << features.size() << " Taxiways: " << taxiways.size() ); + TG_LOG(SG_GENERAL, SG_INFO, "Parse Complete - Runways: " << runways.size() << " Pavements: " << pavements.size() << " Features: " << features.size() << " Taxiways: " << taxiways.size() ); // Starting to clip the polys (for now - only UNIX builds) build_start.stamp(); @@ -338,10 +339,10 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) { tgAccumulator lf_accum; - SG_LOG(SG_GENERAL, SG_INFO, "Build " << features.size() << " Linear Feature Polys"); + TG_LOG(SG_GENERAL, SG_INFO, "Build " << features.size() << " Linear Feature Polys"); for ( unsigned int i=0; iGetDescription() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Build Feature Poly " << i + 1 << " of " << features.size() << " : " << features[i]->GetDescription() ); features[i]->BuildBtg( line_polys, rwy_lights, lf_accum, make_shapefiles ); } @@ -349,7 +350,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // lf_accum.ToShapefiles( "./lf_accum", "test", false ); log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "Finished building Linear Features for " << icao << " at " << DebugTimeToString(log_time) ); + TG_LOG( SG_GENERAL, SG_ALERT, "Finished building Linear Features for " << icao << " at " << DebugTimeToString(log_time) ); } /* Initialize a new accumulator for the other objects */ @@ -358,10 +359,10 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // Build runways next if (runways.size()) { - SG_LOG(SG_GENERAL, SG_INFO, "Build " << runways.size() << " Runway Polys"); + TG_LOG(SG_GENERAL, SG_INFO, "Build " << runways.size() << " Runway Polys"); for ( unsigned int i=0; iBuildBtg( rwy_lights ); } } @@ -401,10 +402,10 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // Build helipads (use runway poly- and texture list for this) if (helipads.size()) { - SG_LOG(SG_GENERAL, SG_INFO, "Build " << helipads.size() << " Helipad Polys "); + TG_LOG(SG_GENERAL, SG_INFO, "Build " << helipads.size() << " Helipad Polys "); for ( unsigned int i=0; iGetDescription()); + TG_LOG(SG_GENERAL, SG_DEBUG, "Build Pavement " << i + 1 << " of " << pavements.size() << " : " << pavements[i]->GetDescription()); slivers.clear(); if ( isDebugPavement(i) ) { @@ -452,16 +453,16 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "Finished building Pavements for " << icao << " at " << DebugTimeToString(log_time) ); + TG_LOG( SG_GENERAL, SG_ALERT, "Finished building Pavements for " << icao << " at " << DebugTimeToString(log_time) ); } // Build the legacy taxiways if (taxiways.size()) { - SG_LOG(SG_GENERAL, SG_INFO, "Build " << taxiways.size() << " Taxiway Polys "); + TG_LOG(SG_GENERAL, SG_INFO, "Build " << taxiways.size() << " Taxiway Polys "); for ( unsigned int i=0; iGetsShoulder() ) { @@ -509,10 +510,10 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // Build helipad shoulders here if ( helipads.size() ) { - SG_LOG(SG_GENERAL, SG_INFO, "Build " << runways.size() << " Helipad Shoulder Polys "); + TG_LOG(SG_GENERAL, SG_INFO, "Build " << runways.size() << " Helipad Shoulder Polys "); for ( unsigned int i=0; iGetsShoulder() ) { @@ -530,12 +531,12 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) tgPolygon apt_base, apt_clearing; if (boundary.size()) { - SG_LOG(SG_GENERAL, SG_INFO, "Build " << boundary.size() << " Boundary Polys "); + TG_LOG(SG_GENERAL, SG_INFO, "Build " << boundary.size() << " Boundary Polys "); shapefile = ""; for ( unsigned int i=0; iBuildBtg( apt_base, apt_clearing, shapefile ); } } else { @@ -545,7 +546,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) if ( apt_base.TotalNodes() == 0 ) { - SG_LOG(SG_GENERAL, SG_ALERT, "no airport points generated"); + TG_LOG(SG_GENERAL, SG_ALERT, "no airport points generated"); return; } @@ -564,7 +565,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) UniqueSGGeodSet tmp_feat_nodes; // build temporary node list from runways... - SG_LOG(SG_GENERAL, SG_INFO, "Build Node List " ); + TG_LOG(SG_GENERAL, SG_INFO, "Build Node List " ); for ( unsigned int k = 0; k < rwy_polys.size(); ++k ) { tgPolygon poly = rwy_polys[k]; @@ -623,14 +624,14 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "Finished collecting nodes for " << icao << " at " << DebugTimeToString(log_time) ); + TG_LOG( SG_GENERAL, SG_ALERT, "Finished collecting nodes for " << icao << " at " << DebugTimeToString(log_time) ); // second pass : runways for ( unsigned int k = 0; k < rwy_polys.size(); ++k ) { tgPolygon poly = rwy_polys[k]; poly = tgPolygon::AddColinearNodes( poly, tmp_pvmt_nodes ); - SG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.TotalNodes()); + TG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.TotalNodes()); rwy_polys[k] = poly; } @@ -639,7 +640,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) { tgPolygon poly = pvmt_polys[k]; poly = tgPolygon::AddColinearNodes( poly, tmp_pvmt_nodes ); - SG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.TotalNodes()); + TG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.TotalNodes()); pvmt_polys[k] = poly; } @@ -648,12 +649,12 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) { tgPolygon poly = line_polys[k]; poly = tgPolygon::AddColinearNodes( poly, tmp_feat_nodes ); - SG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.TotalNodes()); + TG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.TotalNodes()); line_polys[k] = poly; } log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "Finished adding intermediate nodes for " << icao << " at " << DebugTimeToString(log_time) ); + TG_LOG( SG_GENERAL, SG_ALERT, "Finished adding intermediate nodes for " << icao << " at " << DebugTimeToString(log_time) ); for ( unsigned int k = 0; k < line_polys.size(); ++k ) { @@ -676,7 +677,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "Finished cleaning polys for " << icao << " at " << DebugTimeToString(log_time) ); + TG_LOG( SG_GENERAL, SG_ALERT, "Finished cleaning polys for " << icao << " at " << DebugTimeToString(log_time) ); base_poly = tgPolygon::AddColinearNodes( base_poly, tmp_pvmt_nodes ); base_poly = tgPolygon::Snap( base_poly, gSnap ); @@ -713,14 +714,14 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // tesselate the polygons and prepair them for final output if ( rwy_polys.size() ) { - SG_LOG(SG_GENERAL, SG_INFO, "Tesselating " << rwy_polys.size() << " Runway Polys " ); + TG_LOG(SG_GENERAL, SG_INFO, "Tesselating " << rwy_polys.size() << " Runway Polys " ); for ( unsigned int i = 0; i < rwy_polys.size(); ++i ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating runway poly = " << i + 1 << " of " << rwy_polys.size() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating runway poly = " << i + 1 << " of " << rwy_polys.size() ); - SG_LOG(SG_GENERAL, SG_DEBUG, "contours before " << rwy_polys[i].Contours() << " total points before = " << rwy_polys[i].TotalNodes()); + TG_LOG(SG_GENERAL, SG_DEBUG, "contours before " << rwy_polys[i].Contours() << " total points before = " << rwy_polys[i].TotalNodes()); rwy_polys[i].Tesselate(); - SG_LOG(SG_GENERAL, SG_DEBUG, "triangles after = " << rwy_polys[i].Triangles()); + TG_LOG(SG_GENERAL, SG_DEBUG, "triangles after = " << rwy_polys[i].Triangles()); rwy_polys[i].Texture(); } } @@ -728,14 +729,14 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) if ( pvmt_polys.size() ) { // tesselate the polygons and prepair them for final output - SG_LOG(SG_GENERAL, SG_INFO, "Tesselating " << pvmt_polys.size() << " Pavement Polys " ); + TG_LOG(SG_GENERAL, SG_INFO, "Tesselating " << pvmt_polys.size() << " Pavement Polys " ); for ( unsigned int i = 0; i < pvmt_polys.size(); ++i ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating pavement poly = " << i + 1 << " of " << pvmt_polys.size() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating pavement poly = " << i + 1 << " of " << pvmt_polys.size() ); - SG_LOG(SG_GENERAL, SG_DEBUG, "contours before " << pvmt_polys[i].Contours() << " total points before = " << pvmt_polys[i].TotalNodes()); + TG_LOG(SG_GENERAL, SG_DEBUG, "contours before " << pvmt_polys[i].Contours() << " total points before = " << pvmt_polys[i].TotalNodes()); pvmt_polys[i].Tesselate(); - SG_LOG(SG_GENERAL, SG_DEBUG, "triangles after = " << pvmt_polys[i].Triangles()); + TG_LOG(SG_GENERAL, SG_DEBUG, "triangles after = " << pvmt_polys[i].Triangles()); pvmt_polys[i].Texture(); } } @@ -743,14 +744,14 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) if ( line_polys.size() ) { // tesselate the polygons and prepair them for final output - SG_LOG(SG_GENERAL, SG_INFO, "Tesselating " << line_polys.size() << " Linear Feature Polys " ); + TG_LOG(SG_GENERAL, SG_INFO, "Tesselating " << line_polys.size() << " Linear Feature Polys " ); for ( unsigned int i = 0; i < line_polys.size(); ++i ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating line poly = " << i + 1 << " of " << line_polys.size() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating line poly = " << i + 1 << " of " << line_polys.size() ); - SG_LOG(SG_GENERAL, SG_DEBUG, "contours before " << line_polys[i].Contours() << " total points before = " << line_polys[i].TotalNodes()); + TG_LOG(SG_GENERAL, SG_DEBUG, "contours before " << line_polys[i].Contours() << " total points before = " << line_polys[i].TotalNodes()); line_polys[i].Tesselate(); - SG_LOG(SG_GENERAL, SG_DEBUG, "triangles after = " << line_polys[i].Triangles()); + TG_LOG(SG_GENERAL, SG_DEBUG, "triangles after = " << line_polys[i].Triangles()); line_polys[i].Texture(); } } @@ -759,9 +760,9 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) intersecting contours */ base_poly = tgPolygon::Simplify( base_poly ); - SG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly : " << base_poly.Contours() << " contours " ); + TG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly : " << base_poly.Contours() << " contours " ); base_poly.Tesselate(); - SG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly - done : Triangles = " << base_poly.Triangles()); + TG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly - done : Triangles = " << base_poly.Triangles()); // should we texture base here? triangulation_end.stamp(); @@ -769,7 +770,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // a few airports fail here if ( base_poly.Triangles() == 0 ) { - SG_LOG(SG_GENERAL, SG_ALERT, "no base poly triangles"); + TG_LOG(SG_GENERAL, SG_ALERT, "no base poly triangles"); return; } @@ -814,13 +815,13 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) SGVec3f vnt = SGVec3f::fromGeod( base_poly.GetNode(0, 0) ); vnt = normalize(vnt); - SG_LOG(SG_GENERAL, SG_INFO, "Adding runway nodes and normals"); + TG_LOG(SG_GENERAL, SG_INFO, "Adding runway nodes and normals"); for ( unsigned int k = 0; k < rwy_polys.size(); ++k ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k); + TG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k); std::string material = rwy_polys[k].GetMaterial(); - SG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material); - SG_LOG(SG_GENERAL, SG_DEBUG, "triangles = " << rwy_polys[k].Triangles()); + TG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material); + TG_LOG(SG_GENERAL, SG_DEBUG, "triangles = " << rwy_polys[k].Triangles()); for ( unsigned int i = 0; i < rwy_polys[k].Triangles(); ++i ) { tri_v.clear(); @@ -846,13 +847,13 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } } - SG_LOG(SG_GENERAL, SG_INFO, "Adding pavement nodes and normals"); + TG_LOG(SG_GENERAL, SG_INFO, "Adding pavement nodes and normals"); for ( unsigned int k = 0; k < pvmt_polys.size(); ++k ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k); + TG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k); std::string material = pvmt_polys[k].GetMaterial(); - SG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material); - SG_LOG(SG_GENERAL, SG_DEBUG, "triangles = " << pvmt_polys[k].Triangles()); + TG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material); + TG_LOG(SG_GENERAL, SG_DEBUG, "triangles = " << pvmt_polys[k].Triangles()); for ( unsigned int i = 0; i < pvmt_polys[k].Triangles(); ++i ) { tri_v.clear(); @@ -877,13 +878,13 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } } - SG_LOG(SG_GENERAL, SG_INFO, "Adding line nodes and normals"); + TG_LOG(SG_GENERAL, SG_INFO, "Adding line nodes and normals"); for ( unsigned int k = 0; k < line_polys.size(); ++k ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k); + TG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k); std::string material = line_polys[k].GetMaterial(); - SG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material); - SG_LOG(SG_GENERAL, SG_DEBUG, "triangles = " << line_polys[k].Triangles()); + TG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material); + TG_LOG(SG_GENERAL, SG_DEBUG, "triangles = " << line_polys[k].Triangles()); for ( unsigned int i = 0; i < line_polys[k].Triangles(); ++i ) { tri_v.clear(); @@ -912,7 +913,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) std::vector< SGVec2f > base_txs; int_list base_tc; - SG_LOG(SG_GENERAL, SG_INFO, "Adding base nodes and normals"); + TG_LOG(SG_GENERAL, SG_INFO, "Adding base nodes and normals"); for ( unsigned int i = 0; i < base_poly.Triangles(); ++i ) { tri_v.clear(); @@ -952,7 +953,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) for ( unsigned int j = 0; j < divided_base.ContourSize( i ); ++j ) { index = nodes.add( divided_base.GetNode(i, j) ); - SG_LOG(SG_GENERAL, SG_DEBUG, "added base point " << divided_base.GetNode(i, j) << " at " << index ); + TG_LOG(SG_GENERAL, SG_DEBUG, "added base point " << divided_base.GetNode(i, j) << " at " << index ); } } @@ -963,15 +964,15 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // it avoids biases introduced from the surrounding area if the // airport is located in a bowl or on a hill. - SG_LOG(SG_GENERAL, SG_DEBUG, " calc average elevation"); + TG_LOG(SG_GENERAL, SG_DEBUG, " calc average elevation"); { std::vector < SGGeod > dbg = nodes.get_list(); // dump the node list - SG_LOG(SG_GENERAL, SG_DEBUG, " node list size is " << dbg.size() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " node list size is " << dbg.size() ); for (unsigned int w = 0; w max_deg.getLongitudeDeg() ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "new max lon from node " << j << " is " << p.getLongitudeDeg() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "new max lon from node " << j << " is " << p.getLongitudeDeg() ); max_deg.setLongitudeDeg( p.getLongitudeDeg() ); } if ( p.getLatitudeDeg() < min_deg.getLatitudeDeg() ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "new min lat from node " << j << " is " << p.getLatitudeDeg() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "new min lat from node " << j << " is " << p.getLatitudeDeg() ); min_deg.setLatitudeDeg( p.getLatitudeDeg() ); } if ( p.getLatitudeDeg() > max_deg.getLatitudeDeg() ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "new max lat from node " << j << " is " << p.getLatitudeDeg() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "new max lat from node " << j << " is " << p.getLatitudeDeg() ); max_deg.setLatitudeDeg( p.getLatitudeDeg() ); } } - SG_LOG(SG_GENERAL, SG_DEBUG, "Before extending for lights: min = " << min_deg << " max = " << max_deg ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Before extending for lights: min = " << min_deg << " max = " << max_deg ); // extend the min/max coordinates of airport area to cover all // lights as well - SG_LOG(SG_GENERAL, SG_DEBUG, " extend the min/max coordinates of airport area to cover all lights as well : num rwy lights is " << rwy_lights.size() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " extend the min/max coordinates of airport area to cover all lights as well : num rwy lights is " << rwy_lights.size() ); for ( unsigned int i = 0; i < rwy_lights.size(); ++i ) { - SG_LOG(SG_GENERAL, SG_DEBUG, " extend the min/max coordinates of airport area to cover all lights as well : rwy light " << i << "has " << rwy_lights[i].ContourSize() << " lights " ); + TG_LOG(SG_GENERAL, SG_DEBUG, " extend the min/max coordinates of airport area to cover all lights as well : rwy light " << i << "has " << rwy_lights[i].ContourSize() << " lights " ); for ( unsigned int j = 0; j < rwy_lights[i].ContourSize(); ++j ) { @@ -1048,19 +1049,19 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) max_deg.setLongitudeDeg( max_deg.getLongitudeDeg() + 0.01 * dlon ); min_deg.setLatitudeDeg( min_deg.getLatitudeDeg() - 0.01 * dlat ); max_deg.setLatitudeDeg( max_deg.getLatitudeDeg() + 0.01 * dlat ); - SG_LOG(SG_GENERAL, SG_DEBUG, "min = " << min_deg << " max = " << max_deg ); + TG_LOG(SG_GENERAL, SG_DEBUG, "min = " << min_deg << " max = " << max_deg ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Create Apt surface:" ); - SG_LOG(SG_GENERAL, SG_DEBUG, " root: " << root ); - //SG_LOG(SG_GENERAL, SG_DEBUG, " elev: " << elev_src ); - SG_LOG(SG_GENERAL, SG_DEBUG, " min: " << min_deg ); - SG_LOG(SG_GENERAL, SG_DEBUG, " max: " << max_deg ); - SG_LOG(SG_GENERAL, SG_DEBUG, " average: " << average ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Create Apt surface:" ); + TG_LOG(SG_GENERAL, SG_DEBUG, " root: " << root ); + //TG_LOG(SG_GENERAL, SG_DEBUG, " elev: " << elev_src ); + TG_LOG(SG_GENERAL, SG_DEBUG, " min: " << min_deg ); + TG_LOG(SG_GENERAL, SG_DEBUG, " max: " << max_deg ); + TG_LOG(SG_GENERAL, SG_DEBUG, " average: " << average ); // TODO elevation queries should be performed as member functions of surface tgRectangle aptBounds(min_deg, max_deg); tgSurface apt_surf( root, elev_src, aptBounds, average, slope_max, slope_eps ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Airport surface created"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Airport surface created"); // add light points // pass one, calculate raw elevations from Array @@ -1071,7 +1072,7 @@ void Airport::BuildBtg(const std::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() ); + TG_LOG(SG_GENERAL, SG_INFO, "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. @@ -1094,7 +1095,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } // calculate node elevations - SG_LOG(SG_GENERAL, SG_DEBUG, "Computing airport node elevations"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Computing airport node elevations"); std::vector geod_nodes = calc_elevations( apt_surf, nodes.get_list(), 0.0 ); divided_base = calc_elevations( apt_surf, divided_base, 0.0 ); @@ -1114,9 +1115,9 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) SGVec3d gbs_center = d.getCenter(); double gbs_radius = d.getRadius(); - SG_LOG(SG_GENERAL, SG_DEBUG, "gbs center = " << gbs_center); - SG_LOG(SG_GENERAL, SG_DEBUG, "Done with wgs84 node mapping"); - SG_LOG(SG_GENERAL, SG_DEBUG, " center = " << gbs_center << " radius = " << gbs_radius ); + TG_LOG(SG_GENERAL, SG_DEBUG, "gbs center = " << gbs_center); + TG_LOG(SG_GENERAL, SG_DEBUG, "Done with wgs84 node mapping"); + TG_LOG(SG_GENERAL, SG_DEBUG, " center = " << gbs_center << " radius = " << gbs_radius ); // null structures group_list fans_v; fans_v.clear(); @@ -1171,7 +1172,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) SGGeod ref_geod; // calc elevations and write out windsock references - SG_LOG(SG_GENERAL, SG_DEBUG, "Computing windsock node elevations"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Computing windsock node elevations"); for ( unsigned int i = 0; i < windsocks.size(); ++i ) { diff --git a/src/Airports/GenAirports850/beznode.hxx b/src/Airports/GenAirports850/beznode.hxx index 56dfc88e..3fcac81f 100644 --- a/src/Airports/GenAirports850/beznode.hxx +++ b/src/Airports/GenAirports850/beznode.hxx @@ -8,6 +8,8 @@ #include #include +#include "debug.hxx" + inline double LinearDistance( const SGGeod& p0, const SGGeod& p1 ) { return SGGeodesy::distanceM( p0, p1 ); @@ -259,7 +261,7 @@ public: void Print() { - SG_LOG(SG_GENERAL, SG_DEBUG, + TG_LOG(SG_GENERAL, SG_DEBUG, "\tLoc: " << loc << "\n" << "\tprev_cp: " << prev_cp << "\n" << "\tnext_cp: " << next_cp << "\n" ); diff --git a/src/Airports/GenAirports850/closedpoly.cxx b/src/Airports/GenAirports850/closedpoly.cxx index c7300227..75e90857 100644 --- a/src/Airports/GenAirports850/closedpoly.cxx +++ b/src/Airports/GenAirports850/closedpoly.cxx @@ -63,7 +63,7 @@ ClosedPoly::ClosedPoly( int st, float s, float th, char* desc ) ClosedPoly::~ClosedPoly() { - SG_LOG( SG_GENERAL, SG_DEBUG, "Deleting ClosedPoly " << description ); + TG_LOG( SG_GENERAL, SG_DEBUG, "Deleting ClosedPoly " << description ); } void ClosedPoly::AddNode( BezNode* node ) @@ -75,7 +75,7 @@ void ClosedPoly::AddNode( BezNode* node ) } cur_contour->push_back( node ); - SG_LOG(SG_GENERAL, SG_DEBUG, "CLOSEDPOLY::ADDNODE : " << node->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "CLOSEDPOLY::ADDNODE : " << node->GetLoc() ); // For pavement polys, add a linear feature for each contour if (is_pavement) @@ -92,7 +92,7 @@ void ClosedPoly::AddNode( BezNode* node ) feature_desc += "boundary"; } - SG_LOG(SG_GENERAL, SG_DEBUG, " Adding node " << node->GetLoc() << " to current linear feature " << cur_feature); + TG_LOG(SG_GENERAL, SG_DEBUG, " Adding node " << node->GetLoc() << " to current linear feature " << cur_feature); cur_feature = new LinearFeature(feature_desc, 1.0f ); } cur_feature->AddNode( node ); @@ -101,13 +101,13 @@ void ClosedPoly::AddNode( BezNode* node ) void ClosedPoly::CloseCurContour() { - SG_LOG(SG_GENERAL, SG_DEBUG, "Close Contour"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Close Contour"); // if we are recording a pavement marking - it must be closed - // add the first node of the poly if (cur_feature) { - SG_LOG(SG_GENERAL, SG_DEBUG, "We still have an active linear feature - add the first node to close it"); + TG_LOG(SG_GENERAL, SG_DEBUG, "We still have an active linear feature - add the first node to close it"); cur_feature->Finish(true, features.size() ); features.push_back(cur_feature); @@ -146,7 +146,7 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) double total_dist; int num_segs = BEZIER_DETAIL; - SG_LOG(SG_GENERAL, SG_DEBUG, "Creating a contour with " << src->size() << " nodes"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Creating a contour with " << src->size() << " nodes"); // clear anything in this point list dst.Erase(); @@ -154,7 +154,7 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) // iterate through each bezier node in the contour for (unsigned int i = 0; i <= src->size()-1; i++) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nHandling Node " << i << "\n\n"); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nHandling Node " << i << "\n\n"); curNode = src->at(i); if (i < src->size() - 1) @@ -211,8 +211,8 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) { // If total distance is < 4 meters, then we need to modify num Segments so that each segment >= 2 meters num_segs = ((int)total_dist + 1); - SG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); - SG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( < 16.0) so num_segs is " << num_segs ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( < 16.0) so num_segs is " << num_segs ); } else { @@ -223,16 +223,16 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) { // If total distance is > 800 meters, then we need to modify num Segments so that each segment <= 100 meters num_segs = total_dist / 100.0f + 1; - SG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); - SG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( > 100.0) so num_segs is " << num_segs ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( > 100.0) so num_segs is " << num_segs ); } else { if (curve_type != CURVE_LINEAR) { num_segs = 8; - SG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); - SG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " (OK) so num_segs is " << num_segs ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " (OK) so num_segs is " << num_segs ); } else { @@ -274,11 +274,11 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) if (p==0) { - SG_LOG(SG_GENERAL, SG_DEBUG, "adding Curve Anchor node (type " << curve_type << ") at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "adding Curve Anchor node (type " << curve_type << ") at " << curLoc ); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, " add bezier node (type " << curve_type << ") at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, " add bezier node (type " << curve_type << ") at " << curLoc ); } // now set set cur location for the next iteration @@ -299,11 +299,11 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) if (p==0) { - SG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear anchor node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear anchor node at " << curLoc ); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, " add linear node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, " add linear node at " << curLoc ); } // now set set prev and cur locations for the next iteration @@ -317,7 +317,7 @@ void ClosedPoly::ConvertContour( BezContour* src, tgContour& dst ) // just add the one vertex - dist is small dst.AddNode( curLoc ); - SG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear Anchor node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear Anchor node at " << curLoc ); curLoc = nextLoc; } @@ -333,10 +333,10 @@ void ClosedPoly::Finish() // error handling if (boundary == NULL) { - SG_LOG(SG_GENERAL, SG_ALERT, "no boundary"); + TG_LOG(SG_GENERAL, SG_ALERT, "no boundary"); } - SG_LOG(SG_GENERAL, SG_DEBUG, "Converting a poly with " << holes.size() << " holes"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Converting a poly with " << holes.size() << " holes"); if (boundary != NULL) { @@ -422,7 +422,7 @@ std::string ClosedPoly::GetMaterial( int surface ) break; default: - SG_LOG(SG_GENERAL, SG_ALERT, "ClosedPoly::BuildBtg: unknown surface type " << surface_type ); + TG_LOG(SG_GENERAL, SG_ALERT, "ClosedPoly::BuildBtg: unknown surface type " << surface_type ); exit(1); } diff --git a/src/Airports/GenAirports850/debug.cxx b/src/Airports/GenAirports850/debug.cxx index 8f850482..1ef3227c 100644 --- a/src/Airports/GenAirports850/debug.cxx +++ b/src/Airports/GenAirports850/debug.cxx @@ -3,7 +3,6 @@ std::map thread_prefix_map; -SGMutex logMutex; void DebugRegisterPrefix( const std::string& prefix ) { thread_prefix_map[SGThread::current()] = prefix; } diff --git a/src/Airports/GenAirports850/debug.hxx b/src/Airports/GenAirports850/debug.hxx index 277be825..81a2ec22 100644 --- a/src/Airports/GenAirports850/debug.hxx +++ b/src/Airports/GenAirports850/debug.hxx @@ -14,22 +14,17 @@ typedef std::map, std::less > debug_m typedef debug_map::iterator debug_map_iterator; typedef debug_map::const_iterator debug_map_const_iterator; -/* We'll need a mutex to print log messages 1 at a time */ -extern SGMutex logMutex; - /* This map maps thread IDs to ICAO prefixes */ extern std::map thread_prefix_map; extern void DebugRegisterPrefix( const std::string& prefix ); extern std::string DebugTimeToString(time_t& tt); -#define GENAPT_LOG(C,P,M) do { \ - logstream& __tmplogstreamref(sglog()); \ - if(__tmplogstreamref.would_log(C,P)) { \ - logMutex.lock(); \ - __tmplogstreamref << loglevel(C,P) << thread_prefix_map[SGThread::current()] << ":" << M << std::endl; \ - logMutex.unlock(); \ - } \ - } while(0) - -#endif \ No newline at end of file +#define TG_LOG(C,P,M) do { \ + if(sglog().would_log(C,P)) { \ + std::ostringstream os; \ + os << thread_prefix_map[SGThread::current()] << ":" << M; \ + sglog().log(C, P, __FILE__, __LINE__, os.str()); \ + } \ +} while(0) +#endif diff --git a/src/Airports/GenAirports850/elevations.cxx b/src/Airports/GenAirports850/elevations.cxx index 59d5332d..9eac44cd 100644 --- a/src/Airports/GenAirports850/elevations.cxx +++ b/src/Airports/GenAirports850/elevations.cxx @@ -63,7 +63,7 @@ double tgAverageElevation( const std::string &root, const string_list elev_src, for ( i = 0; i < points.size(); ++i ) { if ( points[i].getElevationM() < -9000.0 && !found_one ) { first = points[i]; - SG_LOG( SG_GENERAL, SG_DEBUG, "found first = " << first ); + TG_LOG( SG_GENERAL, SG_DEBUG, "found first = " << first ); found_one = true; } @@ -81,7 +81,7 @@ double tgAverageElevation( const std::string &root, const string_list elev_src, if ( array.open(array_path) ) { found_file = true; - SG_LOG( SG_GENERAL, SG_DEBUG, "Using array_path = " << array_path ); + TG_LOG( SG_GENERAL, SG_DEBUG, "Using array_path = " << array_path ); } i++; } @@ -123,7 +123,7 @@ double tgAverageElevation( const std::string &root, const string_list elev_src, count++; } double average = total / (double) count; - SG_LOG(SG_GENERAL, SG_DEBUG, "Average surface height of point list = " << average); + TG_LOG(SG_GENERAL, SG_DEBUG, "Average surface height of point list = " << average); return average; } \ No newline at end of file diff --git a/src/Airports/GenAirports850/helipad.cxx b/src/Airports/GenAirports850/helipad.cxx index 73a47b55..7c4d9e6a 100644 --- a/src/Airports/GenAirports850/helipad.cxx +++ b/src/Airports/GenAirports850/helipad.cxx @@ -36,7 +36,7 @@ Helipad::Helipad(char* definition) heli.designator, &heli.lat, &heli.lon, &heli.heading, &heli.length, &heli.width, &heli.surface, &heli.marking, &heli.shoulder, &heli.smoothness, &heli.edge_lights); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read helipad: (" << heli.lon << "," << heli.lat << ") heading: " << heli.heading << " length: " << heli.length << " width: " << heli.width ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read helipad: (" << heli.lon << "," << heli.lat << ") heading: " << heli.heading << " length: " << heli.length << " width: " << heli.width ); } tglightcontour_list Helipad::gen_helipad_lights(double maxsize) { diff --git a/src/Airports/GenAirports850/linearfeature.cxx b/src/Airports/GenAirports850/linearfeature.cxx index d26c24ba..b8b0f7e4 100644 --- a/src/Airports/GenAirports850/linearfeature.cxx +++ b/src/Airports/GenAirports850/linearfeature.cxx @@ -22,7 +22,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) Marking* cur_mark = NULL; Lighting* cur_light = NULL; - SG_LOG(SG_GENERAL, SG_DEBUG, " LinearFeature::ConvertContour - Creating a contour with " << src->size() << " nodes"); + TG_LOG(SG_GENERAL, SG_DEBUG, " LinearFeature::ConvertContour - Creating a contour with " << src->size() << " nodes"); // clear anything in the point list points.Erase(); @@ -50,7 +50,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { if (curNode->GetMarking() != cur_mark->type) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Marking has changed from " << cur_mark->type << " to " << curNode->GetMarking() << " save mark from " << cur_mark->start_idx << " to " << points.GetSize() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Marking has changed from " << cur_mark->type << " to " << curNode->GetMarking() << " save mark from " << cur_mark->start_idx << " to " << points.GetSize() ); // marking has ended, or changed cur_mark->end_idx = points.GetSize(); @@ -59,7 +59,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Continue Marking from " << cur_mark->start_idx << " with type " << cur_mark->type ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Continue Marking from " << cur_mark->start_idx << " with type " << cur_mark->type ); } } @@ -68,7 +68,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { if (curNode->GetMarking()) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Start Marking from " << points.GetSize() << " with type " << curNode->GetMarking() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Start Marking from " << points.GetSize() << " with type " << curNode->GetMarking() ); // we aren't watching a mark, and this node has one cur_mark = new Marking; @@ -87,7 +87,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { if (curNode->GetLighting() != cur_light->type) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Lighting has changed from " << cur_light->type << " to " << curNode->GetLighting() << " save light from " << cur_light->start_idx << " to " << points.GetSize() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Lighting has changed from " << cur_light->type << " to " << curNode->GetLighting() << " save light from " << cur_light->start_idx << " to " << points.GetSize() ); // lighting has ended, or changed : add final light cur_light->end_idx = points.GetSize(); @@ -96,7 +96,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Continue Lighting from " << cur_light->start_idx << " with type " << cur_light->type ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Continue Lighting from " << cur_light->start_idx << " with type " << cur_light->type ); } } @@ -105,7 +105,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { if (curNode->GetLighting()) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Start Lighting from " << points.GetSize() << " with type " << curNode->GetLighting() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Start Lighting from " << points.GetSize() << " with type " << curNode->GetLighting() ); // we aren't watching a mark, and this node has one cur_light = new Lighting; @@ -166,12 +166,12 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { if ( (abs(theta1 - 180.0) < 5.0 ) || (abs(theta1) < 5.0 ) || (isnan(theta1)) ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Quadtratic curve with cp in line : convert to linear: " << description << ": theta is " << theta1 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Quadtratic curve with cp in line : convert to linear: " << description << ": theta is " << theta1 ); curve_type = CURVE_LINEAR; } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Quadtratic curve withOUT cp in line : keep quadtratic: " << description << ": theta is " << theta1 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Quadtratic curve withOUT cp in line : keep quadtratic: " << description << ": theta is " << theta1 ); } } @@ -179,30 +179,30 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { if ( (abs(theta1 - 180.0) < 5.0 ) || (abs(theta1) < 5.0 ) || (isnan(theta1)) ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Cubic curve with cp1 in line : " << description << ": theta is " << theta1 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Cubic curve with cp1 in line : " << description << ": theta is " << theta1 ); if ( (abs(theta2 - 180.0) < 5.0 ) || (abs(theta2) < 5.0 ) || (isnan(theta2)) ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\n and cp2 in line : " << description << ": theta is " << theta2 << " CONVERTING TO LINEAR" ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\n and cp2 in line : " << description << ": theta is " << theta2 << " CONVERTING TO LINEAR" ); curve_type = CURVE_LINEAR; } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "\n BUT cp2 NOT in line : " << description << ": theta is " << theta2 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\n BUT cp2 NOT in line : " << description << ": theta is " << theta2 ); } } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Cubic curve withOUT cp1 in line : keep quadtratic: " << description << ": theta is " << theta1 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature: Cubic curve withOUT cp1 in line : keep quadtratic: " << description << ": theta is " << theta1 ); if ( (abs(theta2 - 180.0) < 5.0 ) || (abs(theta2) < 5.0 ) || (isnan(theta2)) ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\n BUT cp2 IS in line : " << description << ": theta is " << theta2 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\n BUT cp2 IS in line : " << description << ": theta is " << theta2 ); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "\n AND cp2 NOT in line : " << description << ": theta is " << theta2 ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\n AND cp2 NOT in line : " << description << ": theta is " << theta2 ); } } } @@ -213,8 +213,8 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { // If total distance is < 4 meters, then we need to modify num Segments so that each segment >= 1/2 meter num_segs = ((int)total_dist + 1) * 2; - SG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); - SG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( < 4.0) so num_segs is " << num_segs ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( < 4.0) so num_segs is " << num_segs ); } else { @@ -225,16 +225,16 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) { // If total distance is > 800 meters, then we need to modify num Segments so that each segment <= 100 meters num_segs = total_dist / 100.0f + 1; - SG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); - SG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( > 100.0) so num_segs is " << num_segs ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " ( > 100.0) so num_segs is " << num_segs ); } else { if (curve_type != CURVE_LINEAR) { num_segs = 8; - SG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); - SG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " (OK) so num_segs is " << num_segs ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Segment from " << curNode->GetLoc() << " to " << nextNode->GetLoc() ); + TG_LOG(SG_GENERAL, SG_DEBUG, " Distance is " << total_dist << " (OK) so num_segs is " << num_segs ); } else { @@ -269,11 +269,11 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) if (p==0) { - SG_LOG(SG_GENERAL, SG_DEBUG, "adding Curve Anchor node (type " << curve_type << ") at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "adding Curve Anchor node (type " << curve_type << ") at " << curLoc ); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, " add bezier node (type " << curve_type << ") at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, " add bezier node (type " << curve_type << ") at " << curLoc ); } // now set set prev and cur locations for the next iteration @@ -295,11 +295,11 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) if (p==0) { - SG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear anchor node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear anchor node at " << curLoc ); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, " add linear node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, " add linear node at " << curLoc ); } // now set set prev and cur locations for the next iteration @@ -313,7 +313,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) // just add the one vertex - dist is small points.AddNode(curLoc); - SG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear Anchor node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "adding Linear Anchor node at " << curLoc ); curLoc = nextLoc; } @@ -322,7 +322,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) if (closed) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Closed COntour : adding last node at " << curLoc ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Closed COntour : adding last node at " << curLoc ); // need to add the markings for last segment points.AddNode(curLoc); @@ -331,7 +331,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) // check for marking that goes all the way to the end... if (cur_mark) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Marking from " << cur_mark->start_idx << " with type " << cur_mark->type << " ends at the end of the contour: " << points.GetSize() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Marking from " << cur_mark->start_idx << " with type " << cur_mark->type << " ends at the end of the contour: " << points.GetSize() ); cur_mark->end_idx = points.GetSize()-1; marks.push_back(cur_mark); @@ -341,7 +341,7 @@ void LinearFeature::ConvertContour( BezContour* src, bool closed ) // check for lighting that goes all the way to the end... if (cur_light) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Lighting from " << cur_light->start_idx << " with type " << cur_light->type << " ends at the end of the contour: " << points.GetSize() ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::ConvertContour Lighting from " << cur_light->start_idx << " with type " << cur_light->type << " ends at the end of the contour: " << points.GetSize() ); cur_light->end_idx = points.GetSize()-1; lights.push_back(cur_light); @@ -500,13 +500,13 @@ int LinearFeature::Finish( bool closed, unsigned int idx ) break; default: - SG_LOG(SG_GENERAL, SG_ALERT, "LinearFeature::Finish: unknown marking " << marks[i]->type ); + TG_LOG(SG_GENERAL, SG_ALERT, "LinearFeature::Finish: unknown marking " << marks[i]->type ); exit(1); } for (unsigned int j = marks[i]->start_idx; j <= marks[i]->end_idx; j++) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for mark " << i << " whose start idx is " << marks[i]->start_idx << " and end idx is " << marks[i]->end_idx << " cur idx is " << j ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for mark " << i << " whose start idx is " << marks[i]->start_idx << " and end idx is " << marks[i]->end_idx << " cur idx is " << j ); // for each point on the PointsList, generate a quad from // start to next, offset by 2 distnaces from the edge @@ -607,7 +607,7 @@ int LinearFeature::Finish( bool closed, unsigned int idx ) for (unsigned int j = lights[i]->start_idx; j <= lights[i]->end_idx; j++) { - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for light " << i << " whose start idx is " << lights[i]->start_idx << " and end idx is " << lights[i]->end_idx << " cur idx is " << j ); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for light " << i << " whose start idx is " << lights[i]->start_idx << " and end idx is " << lights[i]->end_idx << " cur idx is " << j ); // for each point on the PointsList, offset by 2 distnaces from the edge, and add a point to the superpoly contour if (j == lights[i]->start_idx) { @@ -691,7 +691,7 @@ int LinearFeature::Finish( bool closed, unsigned int idx ) // if there were lights generated - create the superpoly if (cur_light_contour.ContourSize()) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::Finish: Adding light contour with " << cur_light_contour.ContourSize() << " lights" ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::Finish: Adding light contour with " << cur_light_contour.ContourSize() << " lights" ); cur_light_contour.SetFlag(""); lighting_polys.push_back(cur_light_contour); } @@ -699,13 +699,13 @@ int LinearFeature::Finish( bool closed, unsigned int idx ) // create the superpoly for the alternating light color if (alt_light_contour.ContourSize()) { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::Finish: Adding light contour with " << cur_light_contour.ContourSize() << " lights" ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::Finish: Adding light contour with " << cur_light_contour.ContourSize() << " lights" ); alt_light_contour.SetFlag(""); lighting_polys.push_back(cur_light_contour); } else { - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::Finish: No points for linear feature " << description << " light index " << i ); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::Finish: No points for linear feature " << description << " light index " << i ); } } @@ -717,7 +717,7 @@ int LinearFeature::BuildBtg(tgpolygon_list& line_polys, tglightcontour_list& lig tgPolygon poly; SGGeod min, max, minp, maxp; - SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::BuildBtg: " << description); + TG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::BuildBtg: " << description); for ( unsigned int i = 0; i < marking_polys.size(); i++) { // Clipping and triangulation need to copy texparams, and material info... @@ -727,7 +727,7 @@ int LinearFeature::BuildBtg(tgpolygon_list& line_polys, tglightcontour_list& lig accum.Add( marking_polys[i] ); } - SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::BuildBtg: add " << lighting_polys.size() << " light defs"); + TG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::BuildBtg: add " << lighting_polys.size() << " light defs"); for ( unsigned i = 0; i < lighting_polys.size(); i++) { lights.push_back( lighting_polys[i] ); diff --git a/src/Airports/GenAirports850/linked_objects.cxx b/src/Airports/GenAirports850/linked_objects.cxx index ec06b81c..e51ca5a1 100644 --- a/src/Airports/GenAirports850/linked_objects.cxx +++ b/src/Airports/GenAirports850/linked_objects.cxx @@ -6,14 +6,14 @@ Windsock::Windsock( char* definition ) { sscanf(definition, "%lf %lf %d", &lat, &lon, &lit); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read Windsock: (" << lon << "," << lat << ") lit: " << lit ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read Windsock: (" << lon << "," << lat << ") lit: " << lit ); } Beacon::Beacon( char* definition ) { sscanf(definition, "%lf %lf %d", &lat, &lon, &code); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read Beacon: (" << lon << "," << lat << ") code: " << code ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read Beacon: (" << lon << "," << lat << ") code: " << code ); } Sign::Sign( char* definition ) @@ -27,7 +27,7 @@ Sign::Sign( char* definition ) // Flightgear wants the heading to be the heading in which the sign is read heading = -def_heading + 360.0; - SG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << ") heading " << def_heading << " size " << size << " definition: " << sgdef << " calc view heading: " << heading ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read Sign: (" << lon << "," << lat << ") heading " << def_heading << " size " << size << " definition: " << sgdef << " calc view heading: " << heading ); sgn_def = sgdef; } diff --git a/src/Airports/GenAirports850/main.cxx b/src/Airports/GenAirports850/main.cxx index 17ef4877..ec1554bd 100644 --- a/src/Airports/GenAirports850/main.cxx +++ b/src/Airports/GenAirports850/main.cxx @@ -35,7 +35,7 @@ using namespace std; // Display usage static void usage( int argc, char **argv ) { - SG_LOG(SG_GENERAL, SG_ALERT, "Usage: " << argv[0] << "\n--input=" + TG_LOG(SG_GENERAL, SG_ALERT, "Usage: " << argv[0] << "\n--input=" << "\n--work=\n[ --start-id=abcd ] [ --restart-id=abcd ] [ --nudge=n ] " << "[--min-lon=] [--max-lon=] [--min-lat=] [--max-lat=] " << "[ --airport=abcd ] [--max-slope=] [--tile=] [--threads] [--threads=x]" @@ -236,7 +236,7 @@ int main(int argc, char **argv) } else if (arg.find("--debug-taxiways=") == 0) { - SG_LOG(SG_GENERAL, SG_INFO, "add debug taxiway " << arg.substr(17) ); + TG_LOG(SG_GENERAL, SG_INFO, "add debug taxiway " << arg.substr(17) ); debug_taxiway_defs.push_back( arg.substr(17) ); } else if (arg.find("--debug-features=") == 0) @@ -258,26 +258,26 @@ int main(int argc, char **argv) std::string airportareadir=work_dir+"/AirportArea"; // this is the main program - - SG_LOG(SG_GENERAL, SG_INFO, "Genapts850 version " << getTGVersion() << " running with " << num_threads << " threads" ); - SG_LOG(SG_GENERAL, SG_INFO, "Launch command was " << argv[0] ); - SG_LOG(SG_GENERAL, SG_INFO, "Input file = " << input_file); - SG_LOG(SG_GENERAL, SG_INFO, "Work directory = " << work_dir); - SG_LOG(SG_GENERAL, SG_INFO, "Longitude = " << min.getLongitudeDeg() << ':' << max.getLongitudeDeg()); - SG_LOG(SG_GENERAL, SG_INFO, "Latitude = " << min.getLatitudeDeg() << ':' << max.getLatitudeDeg()); - SG_LOG(SG_GENERAL, SG_INFO, "Terrain sources = "); + TG_LOG(SG_GENERAL, SG_INFO, "Genapts850 version " << getTGVersion() << " running with " << num_threads << " threads" ); + TG_LOG(SG_GENERAL, SG_INFO, "Launch command was " << argv[0] ); + TG_LOG(SG_GENERAL, SG_INFO, "Input file = " << input_file); + TG_LOG(SG_GENERAL, SG_INFO, "Work directory = " << work_dir); + TG_LOG(SG_GENERAL, SG_INFO, "Longitude = " << min.getLongitudeDeg() << ':' << max.getLongitudeDeg()); + TG_LOG(SG_GENERAL, SG_INFO, "Latitude = " << min.getLatitudeDeg() << ':' << max.getLatitudeDeg()); + TG_LOG(SG_GENERAL, SG_INFO, "Terrain sources = "); for ( unsigned int i = 0; i < elev_src.size(); ++i ) { - SG_LOG(SG_GENERAL, SG_INFO, " " << work_dir << "/" << elev_src[i] ); + TG_LOG(SG_GENERAL, SG_INFO, " " << work_dir << "/" << elev_src[i] ); } - SG_LOG(SG_GENERAL, SG_INFO, "Nudge = " << nudge); + TG_LOG(SG_GENERAL, SG_INFO, "Nudge = " << nudge); if (!max.isValid() || !min.isValid()) { - SG_LOG(SG_GENERAL, SG_ALERT, "Bad longitude or latitude"); + TG_LOG(SG_GENERAL, SG_ALERT, "Bad longitude or latitude"); exit(1); } // make work directory - SG_LOG(SG_GENERAL, SG_DEBUG, "Creating AirportArea directory"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Creating AirportArea directory"); SGPath sgp( airportareadir ); sgp.append( "dummy" ); @@ -290,21 +290,21 @@ int main(int argc, char **argv) if ( work_dir == "" ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Error: no work directory specified." ); + TG_LOG( SG_GENERAL, SG_ALERT, "Error: no work directory specified." ); usage( argc, argv ); exit(-1); } if ( input_file == "" ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Error: no input file." ); + TG_LOG( SG_GENERAL, SG_ALERT, "Error: no input file." ); exit(-1); } sg_gzifstream in( input_file ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << input_file ); + TG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << input_file ); exit(-1); } @@ -320,7 +320,7 @@ int main(int argc, char **argv) // just find and add the one airport scheduler->AddAirport( airport_id ); - SG_LOG(SG_GENERAL, SG_INFO, "Finished Adding airport - now parse"); + TG_LOG(SG_GENERAL, SG_INFO, "Finished Adding airport - now parse"); // and schedule parsers scheduler->Schedule( num_threads, summary_file ); @@ -328,7 +328,7 @@ int main(int argc, char **argv) else if ( start_id != "" ) { - SG_LOG(SG_GENERAL, SG_INFO, "move forward to " << start_id ); + TG_LOG(SG_GENERAL, SG_INFO, "move forward to " << start_id ); // scroll forward in datafile position = scheduler->FindAirport( start_id ); @@ -350,7 +350,7 @@ int main(int argc, char **argv) } } - SG_LOG(SG_GENERAL, SG_INFO, "Done"); + TG_LOG(SG_GENERAL, SG_INFO, "Done"); exit(0); return 0; diff --git a/src/Airports/GenAirports850/object.cxx b/src/Airports/GenAirports850/object.cxx index e619aaad..3878fa65 100644 --- a/src/Airports/GenAirports850/object.cxx +++ b/src/Airports/GenAirports850/object.cxx @@ -7,7 +7,7 @@ LightingObj::LightingObj( char* definition ) { sscanf(definition, "%lf %lf %d %lf %lf %s", &lat, &lon, &type, &heading, &glideslope, &assoc_rw); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read lighting object: (" << lon << "," << lat << ") heading: " << heading << " type: " << type ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read lighting object: (" << lon << "," << lat << ") heading: " << heading << " type: " << type ); } void LightingObj::BuildBtg( tglightcontour_list& lights ) @@ -30,7 +30,7 @@ void LightingObj::BuildBtg( tglightcontour_list& lights ) if (type == 1) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Generating VASI = " << assoc_rw); + TG_LOG(SG_GENERAL, SG_DEBUG, "Generating VASI = " << assoc_rw); // VASI coordinates describe the center between the two bars. // Space between the bars is 200m @@ -65,7 +65,7 @@ void LightingObj::BuildBtg( tglightcontour_list& lights ) } else if (type == 2) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Generating PAPI 4L = " << assoc_rw); + TG_LOG(SG_GENERAL, SG_DEBUG, "Generating PAPI 4L = " << assoc_rw); // unit1 pt1 = SGGeodesy::direct( ref, left_hdg, -12 ); @@ -80,7 +80,7 @@ void LightingObj::BuildBtg( tglightcontour_list& lights ) } else if (type == 3) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Generating PAPI 4R = " << assoc_rw); + TG_LOG(SG_GENERAL, SG_DEBUG, "Generating PAPI 4R = " << assoc_rw); // unit1 pt1 = SGGeodesy::direct( ref, left_hdg, 12 ); @@ -95,19 +95,19 @@ void LightingObj::BuildBtg( tglightcontour_list& lights ) } else if (type == 4) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Space Shuttle PAPI is deprecated. Use the normal PAPI and set the glideslope accordingly"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Space Shuttle PAPI is deprecated. Use the normal PAPI and set the glideslope accordingly"); return; } else if (type == 5) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Generating tri-colour VASI = " << assoc_rw); + TG_LOG(SG_GENERAL, SG_DEBUG, "Generating tri-colour VASI = " << assoc_rw); // only one light here light_contour.AddLight( ref, normal ); } else if (type == 6) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Generating runway guard light = " << assoc_rw); + TG_LOG(SG_GENERAL, SG_DEBUG, "Generating runway guard light = " << assoc_rw); light_contour.SetType( "RWY_GUARD_LIGHTS" ); @@ -119,7 +119,7 @@ void LightingObj::BuildBtg( tglightcontour_list& lights ) } else { - SG_LOG(SG_GENERAL, SG_ALERT, "Unknown lighting object (PAPI/VASI...) code: " << type); + TG_LOG(SG_GENERAL, SG_ALERT, "Unknown lighting object (PAPI/VASI...) code: " << type); return; } diff --git a/src/Airports/GenAirports850/parser.cxx b/src/Airports/GenAirports850/parser.cxx index d88a3feb..95de72ff 100644 --- a/src/Airports/GenAirports850/parser.cxx +++ b/src/Airports/GenAirports850/parser.cxx @@ -44,7 +44,7 @@ void Parser::set_debug( std::string path, std::vector runway_defs, std::vector taxiway_defs, std::vector feature_defs ) { - SG_LOG(SG_GENERAL, SG_ALERT, "Set debug Path " << path); + TG_LOG(SG_GENERAL, SG_ALERT, "Set debug Path " << path); debug_path = path; @@ -67,7 +67,7 @@ void Parser::set_debug( std::string path, std::vector runway_defs, while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug runway " << i); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug runway " << i); shapes.push_back(i); @@ -96,7 +96,7 @@ void Parser::set_debug( std::string path, std::vector runway_defs, while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug pavement " << i); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug pavement " << i); shapes.push_back(i); @@ -125,7 +125,7 @@ void Parser::set_debug( std::string path, std::vector runway_defs, while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug taxiway " << i); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug taxiway " << i); shapes.push_back(i); @@ -154,7 +154,7 @@ void Parser::set_debug( std::string path, std::vector runway_defs, while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug feature " << i); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug feature " << i); shapes.push_back(i); @@ -183,7 +183,7 @@ void Parser::run() std::ifstream in( filename.c_str() ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); + TG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); exit(-1); } @@ -204,7 +204,7 @@ void Parser::run() // Verify this is and airport definition and get the icao if( GetAirportDefinition( line, icao ) ) { - SG_LOG( SG_GENERAL, SG_INFO, "Found airport " << icao << " at " << pos ); + TG_LOG( SG_GENERAL, SG_INFO, "Found airport " << icao << " at " << pos ); // Start parse at pos SetState(STATE_NONE); @@ -212,8 +212,8 @@ void Parser::run() parse_start.stamp(); log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "\n*******************************************************************" ); - SG_LOG( SG_GENERAL, SG_ALERT, "Start airport " << icao << " at " << pos << ": start time " << ctime(&log_time) ); + TG_LOG( SG_GENERAL, SG_ALERT, "\n*******************************************************************" ); + TG_LOG( SG_GENERAL, SG_ALERT, "Start airport " << icao << " at " << pos << ": start time " << ctime(&log_time) ); in.seekg(pos, std::ios::beg); while ( !in.eof() && (cur_state != STATE_DONE ) ) { @@ -240,11 +240,11 @@ void Parser::run() } log_time = time(0); - SG_LOG( SG_GENERAL, SG_ALERT, "Finished airport " << icao << + TG_LOG( SG_GENERAL, SG_ALERT, "Finished airport " << icao << " : parse " << parse_time << " : build " << build_time << " : clean " << clean_time << " : tesselate " << triangulation_time ); } else { - SG_LOG( SG_GENERAL, SG_INFO, "Not an airport at pos " << pos << " line is: " << line ); + TG_LOG( SG_GENERAL, SG_INFO, "Not an airport at pos " << pos << " line is: " << line ); } } } @@ -401,7 +401,7 @@ LinearFeature* Parser::ParseFeature( char* line ) feature = new LinearFeature(NULL, 0.0f); } - SG_LOG(SG_GENERAL, SG_DEBUG, "Creating Linear Feature with desription \"" << line << "\""); + TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Linear Feature with desription \"" << line << "\""); return feature; } @@ -421,11 +421,11 @@ ClosedPoly* Parser::ParsePavement( char* line ) if (numParams == 4) { d = strstr(line,desc); - SG_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 << " thexture heading " << th << " and description " << d); } else { - SG_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 << " thexture heading " << th ); } poly = new ClosedPoly(st, s, th, d); @@ -451,7 +451,7 @@ ClosedPoly* Parser::ParseBoundary( char* line ) d = (char *)"none"; } - SG_LOG(SG_GENERAL, SG_DEBUG, "Creating Closed Poly for airport boundary : " << d); + TG_LOG(SG_GENERAL, SG_DEBUG, "Creating Closed Poly for airport boundary : " << d); poly = new ClosedPoly(d); return poly; @@ -463,7 +463,7 @@ int Parser::SetState( int state ) // is when we get a non-node line to parse if ( cur_airport && cur_state == STATE_PARSE_PAVEMENT ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Closing and Adding pavement"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Closing and Adding pavement"); cur_pavement->Finish(); cur_airport->AddPavement( cur_pavement ); cur_pavement = NULL; @@ -471,7 +471,7 @@ int Parser::SetState( int state ) if ( cur_airport && cur_state == STATE_PARSE_BOUNDARY ) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Closing and Adding boundary"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Closing and Adding boundary"); cur_boundary->Finish(); cur_airport->AddBoundary( cur_boundary ); cur_boundary = NULL; @@ -507,7 +507,7 @@ int Parser::ParseLine(char* line) if (cur_state == STATE_NONE) { SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing land airport: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing land airport: " << line); cur_airport = new Airport( code, line ); } else @@ -519,7 +519,7 @@ int Parser::ParseLine(char* line) if (cur_state == STATE_NONE) { SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing heliport: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing heliport: " << line); cur_airport = new Airport( code, line ); } else @@ -530,7 +530,7 @@ int Parser::ParseLine(char* line) case LAND_RUNWAY_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing runway: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing runway: " << line); cur_runway = new Runway(line); if (cur_airport) { @@ -540,7 +540,7 @@ int Parser::ParseLine(char* line) case WATER_RUNWAY_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing water runway: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing water runway: " << line); cur_waterrunway = new WaterRunway(line); if (cur_airport) { @@ -549,7 +549,7 @@ int Parser::ParseLine(char* line) break; case HELIPAD_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing helipad: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing helipad: " << line); cur_helipad = new Helipad(line); if (cur_airport) { @@ -559,7 +559,7 @@ int Parser::ParseLine(char* line) case TAXIWAY_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing taxiway: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing taxiway: " << line); cur_taxiway = new Taxiway(line); if (cur_airport) { @@ -569,25 +569,25 @@ int Parser::ParseLine(char* line) case PAVEMENT_CODE: SetState( STATE_PARSE_PAVEMENT ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing pavement: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing pavement: " << line); cur_pavement = ParsePavement( line ); break; case LINEAR_FEATURE_CODE: SetState( STATE_PARSE_FEATURE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Linear Feature: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Linear Feature: " << line); cur_feat = ParseFeature( line ); break; case BOUNDRY_CODE: SetState( STATE_PARSE_BOUNDARY ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing Boundary: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing Boundary: " << line); cur_boundary = ParseBoundary( line ); break; case NODE_CODE: case BEZIER_NODE_CODE: - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing node: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing node: " << line); cur_node = ParseNode( code, line, prev_node ); if ( prev_node && (cur_node != prev_node) ) @@ -612,7 +612,7 @@ int Parser::ParseLine(char* line) case CLOSE_NODE_CODE: case CLOSE_BEZIER_NODE_CODE: - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing close loop node: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing close loop node: " << line); cur_node = ParseNode( code, line, prev_node ); if ( cur_state == STATE_PARSE_PAVEMENT ) @@ -666,7 +666,7 @@ int Parser::ParseLine(char* line) case TERM_NODE_CODE: case TERM_BEZIER_NODE_CODE: - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing termination node: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing termination node: " << line); if ( cur_state == STATE_PARSE_FEATURE ) { @@ -694,7 +694,7 @@ int Parser::ParseLine(char* line) } else { - SG_LOG(SG_GENERAL, SG_ALERT, "Parsing termination node with no previous nodes!!!" ); + TG_LOG(SG_GENERAL, SG_ALERT, "Parsing termination node with no previous nodes!!!" ); // this feature is bogus... delete cur_feat; @@ -708,66 +708,66 @@ int Parser::ParseLine(char* line) case AIRPORT_VIEWPOINT_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing viewpoint: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing viewpoint: " << line); break; case AIRPLANE_STARTUP_LOCATION_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing airplane startup location: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing airplane startup location: " << line); break; case LIGHT_BEACON_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing light beacon: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing light beacon: " << line); cur_beacon = new Beacon(line); cur_airport->AddBeacon( cur_beacon ); break; case WINDSOCK_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing windsock: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing windsock: " << line); cur_windsock = new Windsock(line); cur_airport->AddWindsock( cur_windsock ); break; case TAXIWAY_SIGN: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing taxiway sign: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing taxiway sign: " << line); cur_sign = new Sign(line); cur_airport->AddSign( cur_sign ); break; case LIGHTING_OBJECT: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing lighting object: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing lighting object: " << line); cur_object = new LightingObj(line); cur_airport->AddObj( cur_object ); break; case COMM_FREQ1_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 1: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 1: " << line); break; case COMM_FREQ2_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 2: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 2: " << line); break; case COMM_FREQ3_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 3: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 3: " << line); break; case COMM_FREQ4_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 4: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 4: " << line); break; case COMM_FREQ5_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 5: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 5: " << line); break; case COMM_FREQ6_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 6: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 6: " << line); break; case COMM_FREQ7_CODE: SetState( STATE_PARSE_SIMPLE ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 7: " << line); + TG_LOG(SG_GENERAL, SG_DEBUG, "Parsing commfreq 7: " << line); break; case END_OF_FILE : - SG_LOG(SG_GENERAL, SG_DEBUG, "Reached end of file"); + TG_LOG(SG_GENERAL, SG_DEBUG, "Reached end of file"); SetState( STATE_DONE ); break; } diff --git a/src/Airports/GenAirports850/runway.cxx b/src/Airports/GenAirports850/runway.cxx index 14687386..65549e49 100644 --- a/src/Airports/GenAirports850/runway.cxx +++ b/src/Airports/GenAirports850/runway.cxx @@ -47,7 +47,7 @@ Runway::Runway(char* definition) // calculate runway heading and length (used a lot) SGGeodesy::inverse( GetStart(), GetEnd(), rwy.heading, az2, rwy.length ); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read runway: (" << rwy.lon[0] << "," << rwy.lat[0] << ") to (" << rwy.lon[1] << "," << rwy.lat[1] << ") heading: " << rwy.heading << " length: " << rwy.length << " width: " << rwy.width ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read runway: (" << rwy.lon[0] << "," << rwy.lat[0] << ") to (" << rwy.lon[1] << "," << rwy.lat[1] << ") heading: " << rwy.heading << " length: " << rwy.length << " width: " << rwy.width ); } @@ -56,7 +56,7 @@ WaterRunway::WaterRunway(char* definition) { sscanf(definition, "%lf %d %s %lf %lf %s %lf %lf", &width, &buoys, rwnum[0], &lat[0], &lon[0], rwnum[1], &lat[1], &lon[1]); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read water runway: (" << lon[0] << "," << lat[0] << ") to (" << lon[1] << "," << lat[1] << ") width: " << width << " buoys = " << buoys ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read water runway: (" << lon[0] << "," << lat[0] << ") to (" << lon[1] << "," << lat[1] << ") width: " << width << " buoys = " << buoys ); } tgContour WaterRunway::GetBuoys() @@ -122,7 +122,7 @@ int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights } else { - SG_LOG(SG_GENERAL, SG_WARN, "surface_code = " << rwy.surface); + TG_LOG(SG_GENERAL, SG_WARN, "surface_code = " << rwy.surface); throw sg_exception("unknown runway type!"); } @@ -131,7 +131,7 @@ int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights { case 1: // asphalt: case 2: // concrete - SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete " << rwy.surface); + TG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete " << rwy.surface); gen_rwy( rwy_polys, slivers, accum, shapefile_name ); gen_runway_lights( rwy_lights ); break; @@ -140,25 +140,25 @@ int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights case 4: // Dirt case 5: // Gravel case 12: // dry lakebed - SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Grass, Dirt, Gravel or Dry Lakebed " << rwy.surface ); + TG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Grass, Dirt, Gravel or Dry Lakebed " << rwy.surface ); gen_simple_rwy( rwy_polys, slivers, accum ); gen_runway_lights( rwy_lights ); break; case 13: // water - SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Water"); + TG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Water"); break; case 14: // snow - SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Snow"); + TG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Snow"); break; case 15: // transparent - SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: transparent"); + TG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: transparent"); break; default: // unknown - SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: unknown: " << rwy.surface); + TG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: unknown: " << rwy.surface); break; } diff --git a/src/Airports/GenAirports850/rwy_gen.cxx b/src/Airports/GenAirports850/rwy_gen.cxx index 63b21192..fe53f4a3 100644 --- a/src/Airports/GenAirports850/rwy_gen.cxx +++ b/src/Airports/GenAirports850/rwy_gen.cxx @@ -220,7 +220,7 @@ void Runway::gen_runway_section( const tgPolygon& runway, } } - SG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct << " end len % = " << endl_pct); + TG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct << " end len % = " << endl_pct); double dlx, dly; @@ -241,7 +241,7 @@ void Runway::gen_runway_section( const tgPolygon& runway, SGVec2d t3 = SGVec2d( a2.x() + dlx * endl_pct, a2.y() + dly * endl_pct ); - SG_LOG(SG_GENERAL, SG_DEBUG, "start wid % = " << startw_pct << " end wid % = " << endw_pct); + TG_LOG(SG_GENERAL, SG_DEBUG, "start wid % = " << startw_pct << " end wid % = " << endw_pct); double dwx, dwy; @@ -299,8 +299,8 @@ void Runway::gen_runway_section( const tgPolygon& runway, section = tgPolygon::Snap( section, gSnap ); // print runway points - SG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << material_prefix << material); - SG_LOG(SG_GENERAL, SG_DEBUG, section ); + TG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << material_prefix << material); + TG_LOG(SG_GENERAL, SG_DEBUG, section ); if( shapefile_name.size() ) { tgShapefile::FromPolygon( section, "./airport_dbg", std::string("preclip"), shapefile_name ); @@ -386,7 +386,7 @@ void Runway::gen_runway_section( const tgPolygon& runway, } } - SG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct << " end len % = " << endl_pct); + TG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct << " end len % = " << endl_pct); double dlx, dly; @@ -407,7 +407,7 @@ void Runway::gen_runway_section( const tgPolygon& runway, SGVec2d t3 = SGVec2d( a2.x() + dlx * endl_pct, a2.y() + dly * endl_pct ); - SG_LOG(SG_GENERAL, SG_DEBUG, "start wid % = " << startw_pct << " end wid % = " << endw_pct); + TG_LOG(SG_GENERAL, SG_DEBUG, "start wid % = " << startw_pct << " end wid % = " << endw_pct); double dwx, dwy; @@ -445,8 +445,8 @@ void Runway::gen_runway_section( const tgPolygon& runway, section = tgPolygon::Snap( section, gSnap ); // print runway points - SG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << material_prefix << material); - SG_LOG(SG_GENERAL, SG_DEBUG, section ); + TG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << material_prefix << material); + TG_LOG(SG_GENERAL, SG_DEBUG, section ); // Clip the new polygon against what ever has already been created. tgPolygon clipped = accum.Diff( section ); @@ -497,7 +497,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname, letter = tmp; } } - SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter = " << letter); + TG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter = " << letter); // create runway designation letter if ( !letter.empty() ) { @@ -522,7 +522,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname, rwname = "36"; } - SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation = " << rwname); + TG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation = " << rwname); char tex1[32]; tex1[0] = '\0'; char tex2[32]; tex2[0] = '\0'; @@ -584,7 +584,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys, tgAccumulator& accum, std::string& shapefile_name ) { - SG_LOG( SG_GENERAL, SG_DEBUG, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]); + TG_LOG( SG_GENERAL, SG_DEBUG, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]); std::string section_name = ""; bool debug = shapefile_name.size() != 0; @@ -625,25 +625,25 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys, // Make sure our runway is long enough for the desired marking variant if ( (rwy.marking[rwhalf]==2 || rwy.marking[rwhalf]==4) && length < 1150 * SG_FEET_TO_METER ) { - SG_LOG( SG_GENERAL, SG_ALERT, + TG_LOG( SG_GENERAL, SG_ALERT, "Runway " << rwy.rwnum[rwhalf] << " is not long enough (" << rwy.length << "m) for non-precision markings! Setting runway markings to visual!"); rwy.marking[rwhalf]=1; } if ( (rwy.marking[rwhalf]==3 || rwy.marking[rwhalf]==5) && length < 3075 * SG_FEET_TO_METER ) { - SG_LOG( SG_GENERAL, SG_ALERT, + TG_LOG( SG_GENERAL, SG_ALERT, "Runway " << rwy.rwnum[rwhalf] << " is not long enough (" << rwy.length << "m) for precision markings! Setting runway markings to visual!"); rwy.marking[rwhalf]=1; } - SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] ); + TG_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_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] ); + TG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] ); double final_arrow = rwy.threshold[rwhalf]; @@ -780,7 +780,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys, // Now create the marking sections of the runway type for ( unsigned int i=0; i < rw_marking_list.size(); ++i) { - SG_LOG(SG_GENERAL, SG_DEBUG, "Runway section texture = " << rw_marking_list[i].tex << " start_pct: " << start1_pct << " end_pct: " << end1_pct << " length: " << rw_marking_list[i].size); + TG_LOG(SG_GENERAL, SG_DEBUG, "Runway section texture = " << rw_marking_list[i].tex << " start_pct: " << start1_pct << " end_pct: " << end1_pct << " length: " << rw_marking_list[i].size); if ( end1_pct < 1.0 ) { start1_pct = end1_pct; diff --git a/src/Airports/GenAirports850/rwy_simple.cxx b/src/Airports/GenAirports850/rwy_simple.cxx index fb86004d..60701aeb 100644 --- a/src/Airports/GenAirports850/rwy_simple.cxx +++ b/src/Airports/GenAirports850/rwy_simple.cxx @@ -65,11 +65,11 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys, runway_half.AddNode( 0, runway.GetNode(5) ); } - SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] ); + TG_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_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] ); + TG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] ); start_pct = end_pct; end_pct = start_pct + ( rwy.threshold[rwhalf] / length ); diff --git a/src/Airports/GenAirports850/scheduler.cxx b/src/Airports/GenAirports850/scheduler.cxx index b9d1cd88..932b2caf 100644 --- a/src/Airports/GenAirports850/scheduler.cxx +++ b/src/Airports/GenAirports850/scheduler.cxx @@ -20,7 +20,7 @@ std::ostream& operator<< (std::ostream &out, const AirportInfo &ai) { char snap_string[32]; sprintf( snap_string, "%1.8lf", ai.snap ); - + out << ai.icao; out << ","; out << ai.numRunways; @@ -53,7 +53,7 @@ void Scheduler::set_debug( std::string path, std::vector runway_def std::vector taxiway_defs, std::vector feature_defs ) { - SG_LOG(SG_GENERAL, SG_ALERT, "Set debug Path " << path); + TG_LOG(SG_GENERAL, SG_ALERT, "Set debug Path " << path); debug_path = path; @@ -76,7 +76,7 @@ void Scheduler::set_debug( std::string path, std::vector runway_def while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug runway " << i << " for " << icao ); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug runway " << i << " for " << icao ); shapes.push_back(i); @@ -105,7 +105,7 @@ void Scheduler::set_debug( std::string path, std::vector runway_def while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug pavement " << i << " for " << icao ); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug pavement " << i << " for " << icao ); shapes.push_back(i); @@ -134,7 +134,7 @@ void Scheduler::set_debug( std::string path, std::vector runway_def while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug taxiway " << i << " for " << icao ); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug taxiway " << i << " for " << icao ); shapes.push_back(i); @@ -163,7 +163,7 @@ void Scheduler::set_debug( std::string path, std::vector runway_def while (ss >> i) { - SG_LOG(SG_GENERAL, SG_ALERT, "Adding debug feature " << i << " for " << icao ); + TG_LOG(SG_GENERAL, SG_ALERT, "Adding debug feature " << i << " for " << icao ); shapes.push_back(i); @@ -181,7 +181,7 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao ) int code; Airport* airport = NULL; bool match = false; - + // Get the number code tok = strtok(line, " \t\r\n"); @@ -192,7 +192,7 @@ bool Scheduler::IsAirportDefinition( char* line, std::string icao ) switch(code) { - case LAND_AIRPORT_CODE: + case LAND_AIRPORT_CODE: case SEA_AIRPORT_CODE: case HELIPORT_CODE: airport = new Airport( code, line ); @@ -243,14 +243,14 @@ void Scheduler::AddAirport( std::string icao ) AirportInfo ai; std::ifstream in( filename.c_str() ); - if ( !in.is_open() ) + if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); + TG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); exit(-1); } - SG_LOG( SG_GENERAL, SG_INFO, "Adding airport " << icao << " to parse list"); - while ( !in.eof() && !found ) + TG_LOG( SG_GENERAL, SG_INFO, "Adding airport " << icao << " to parse list"); + while ( !in.eof() && !found ) { // remember the position of this line cur_pos = in.tellg(); @@ -261,14 +261,14 @@ void Scheduler::AddAirport( std::string icao ) // this is and airport definition - remember it if ( IsAirportDefinition( line, icao ) ) { - SG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << icao << " at " << cur_pos ); - + TG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << icao << " at " << cur_pos ); + ai = AirportInfo( icao, cur_pos, gSnap ); global_workQueue.push( ai ); found = true; } - } + } } long Scheduler::FindAirport( std::string icao ) @@ -278,14 +278,14 @@ long Scheduler::FindAirport( std::string icao ) bool found = false; std::ifstream in( filename.c_str() ); - if ( !in.is_open() ) + if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); + TG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); exit(-1); } - SG_LOG( SG_GENERAL, SG_DEBUG, "Finding airport " << icao ); - while ( !in.eof() && !found ) + TG_LOG( SG_GENERAL, SG_DEBUG, "Finding airport " << icao ); + while ( !in.eof() && !found ) { // remember the position of this line cur_pos = in.tellg(); @@ -296,10 +296,10 @@ long Scheduler::FindAirport( std::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 ); + TG_LOG( SG_GENERAL, SG_DEBUG, "Found airport " << line << " at " << cur_pos ); found = true; } - } + } if (found) { @@ -337,7 +337,7 @@ bool Scheduler::AddAirports( long start_pos, tgRectangle* boundingBox ) std::ifstream in( filename.c_str() ); if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); + TG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); exit(-1); } @@ -480,9 +480,9 @@ Scheduler::Scheduler(std::string& datafile, const std::string& root, const strin elevation = elev_src; std::ifstream in( filename.c_str() ); - if ( !in.is_open() ) + if ( !in.is_open() ) { - SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); + TG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << filename ); exit(-1); } } @@ -491,7 +491,7 @@ void Scheduler::Schedule( int num_threads, std::string& summaryfile ) { // std::ofstream csvfile; - // open and truncate the summary file : monitor only appends + // open and truncate the summary file : monitor only appends // csvfile.open( summaryfile.c_str(), std::ios_base::out | std::ios_base::trunc ); // csvfile.close(); diff --git a/src/Airports/GenAirports850/scheduler.hxx b/src/Airports/GenAirports850/scheduler.hxx index 8f2ffaa8..ad979648 100644 --- a/src/Airports/GenAirports850/scheduler.hxx +++ b/src/Airports/GenAirports850/scheduler.hxx @@ -127,4 +127,4 @@ private: debug_map debug_features; }; -#endif \ No newline at end of file +#endif diff --git a/src/Airports/GenAirports850/taxiway.cxx b/src/Airports/GenAirports850/taxiway.cxx index 7bf9a3af..9d815daa 100644 --- a/src/Airports/GenAirports850/taxiway.cxx +++ b/src/Airports/GenAirports850/taxiway.cxx @@ -42,7 +42,7 @@ Taxiway::Taxiway(char* definition) &lat, &lon, designation, &heading, &length, &threshold, &overrun, &width, lighting, &surface, &shoulder, &markings, &smoothness, &signs); - SG_LOG(SG_GENERAL, SG_DEBUG, "Read taxiway: (" << lon << "," << lat << ") heading: " << heading << " length: " << length << " width: " << width ); + TG_LOG(SG_GENERAL, SG_DEBUG, "Read taxiway: (" << lon << "," << lat << ") heading: " << heading << " length: " << length << " width: " << width ); // adjust length and width from feet to meters length *= SG_FEET_TO_METER; @@ -129,7 +129,7 @@ int Taxiway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_light } else { - SG_LOG(SG_GENERAL, SG_WARN, "surface_code = " << surface); + TG_LOG(SG_GENERAL, SG_WARN, "surface_code = " << surface); throw sg_exception("unknown runway type!"); }