[Genapts] Reduce technical debt. Migrate away from usage of <cstdio>.
This commit is contained in:
parent
a8677d4f16
commit
fb50bb4681
18 changed files with 168 additions and 122 deletions
|
@ -243,7 +243,6 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
||||||
// runway lights
|
// runway lights
|
||||||
tglightcontour_list rwy_lights;
|
tglightcontour_list rwy_lights;
|
||||||
|
|
||||||
bool make_shapefiles = false;
|
|
||||||
char debug_root[32];
|
char debug_root[32];
|
||||||
sprintf(debug_root, "./airport_dbg/%s/", icao.c_str() );
|
sprintf(debug_root, "./airport_dbg/%s/", icao.c_str() );
|
||||||
|
|
||||||
|
@ -305,6 +304,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
||||||
{
|
{
|
||||||
TG_LOG(SG_GENERAL, SG_DEBUG, "Build Feature Poly " << i + 1 << " of " << features.size() << " : " << features[i]->GetDescription() );
|
TG_LOG(SG_GENERAL, SG_DEBUG, "Build Feature Poly " << i + 1 << " of " << features.size() << " : " << features[i]->GetDescription() );
|
||||||
|
|
||||||
|
bool make_shapefiles = false;
|
||||||
features[i]->BuildBtg( line_polys, rwy_lights, lf_accum, make_shapefiles );
|
features[i]->BuildBtg( line_polys, rwy_lights, lf_accum, make_shapefiles );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
||||||
//slivers.clear();
|
//slivers.clear();
|
||||||
|
|
||||||
if ( isDebugRunway(i) ) {
|
if ( isDebugRunway(i) ) {
|
||||||
sprintf( shapefile_name, "runway_%d", i );
|
sprintf( shapefile_name, "runway_%u", i );
|
||||||
} else {
|
} else {
|
||||||
strcpy( shapefile_name, "" );
|
strcpy( shapefile_name, "" );
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
||||||
//slivers.clear();
|
//slivers.clear();
|
||||||
|
|
||||||
if ( isDebugPavement(i) ) {
|
if ( isDebugPavement(i) ) {
|
||||||
sprintf( shapefile_name, "pvmnt_%d", i );
|
sprintf( shapefile_name, "pvmnt_%u", i );
|
||||||
} else {
|
} else {
|
||||||
strcpy( shapefile_name, "" );
|
strcpy( shapefile_name, "" );
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
||||||
//slivers.clear();
|
//slivers.clear();
|
||||||
|
|
||||||
if ( isDebugTaxiway(i) ) {
|
if ( isDebugTaxiway(i) ) {
|
||||||
sprintf( shapefile_name, "taxiway_%d", i );
|
sprintf( shapefile_name, "taxiway_%u", i );
|
||||||
} else {
|
} else {
|
||||||
strcpy( shapefile_name, "" );
|
strcpy( shapefile_name, "" );
|
||||||
}
|
}
|
||||||
|
@ -1106,10 +1106,10 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
||||||
}
|
}
|
||||||
|
|
||||||
SGVec3d gbs_center = SGVec3d::fromGeod( b.get_center() );
|
SGVec3d gbs_center = SGVec3d::fromGeod( b.get_center() );
|
||||||
double dist_squared, radius_squared = 0;
|
double radius_squared = 0;
|
||||||
for ( unsigned int i = 0; i < wgs84_nodes.size(); ++i )
|
for ( unsigned int i = 0; i < wgs84_nodes.size(); ++i )
|
||||||
{
|
{
|
||||||
dist_squared = distSqr(gbs_center, wgs84_nodes[i]);
|
double dist_squared = distSqr(gbs_center, wgs84_nodes[i]);
|
||||||
if ( dist_squared > radius_squared ) {
|
if ( dist_squared > radius_squared ) {
|
||||||
radius_squared = dist_squared;
|
radius_squared = dist_squared;
|
||||||
}
|
}
|
||||||
|
@ -1258,7 +1258,7 @@ bool Airport::CheckZFightingTriangles( const char* prefix, const char* debug_roo
|
||||||
tgContour intContour = intersection.GetContour( m );
|
tgContour intContour = intersection.GetContour( m );
|
||||||
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
||||||
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between runway poly " << i << " and pavement poly " << k << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between runway poly " << i << " and pavement poly " << k << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
||||||
sprintf( desc, "rwy_%06d_pvmt_%06d", i, j );
|
sprintf( desc, "rwy_%06u_pvmt_%06u", i, j );
|
||||||
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
||||||
zfighting = true;
|
zfighting = true;
|
||||||
}
|
}
|
||||||
|
@ -1292,7 +1292,7 @@ bool Airport::CheckZFightingTriangles( const char* prefix, const char* debug_roo
|
||||||
tgContour intContour = intersection.GetContour( m );
|
tgContour intContour = intersection.GetContour( m );
|
||||||
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
||||||
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between pavement poly " << i << " and runway poly " << k << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between pavement poly " << i << " and runway poly " << k << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
||||||
sprintf( desc, "pvmt_%06d_rwy_%06d", i, j );
|
sprintf( desc, "pvmt_%06u_rwy_%06u", i, j );
|
||||||
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
||||||
zfighting = true;
|
zfighting = true;
|
||||||
}
|
}
|
||||||
|
@ -1325,7 +1325,7 @@ bool Airport::CheckZFightingTriangles( const char* prefix, const char* debug_roo
|
||||||
tgContour intContour = intersection.GetContour( m );
|
tgContour intContour = intersection.GetContour( m );
|
||||||
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
||||||
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between base poly and runway poly " << j << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between base poly and runway poly " << j << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
||||||
sprintf( desc, "base_rwy_%06d", j );
|
sprintf( desc, "base_rwy_%06u", j );
|
||||||
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
||||||
zfighting = true;
|
zfighting = true;
|
||||||
}
|
}
|
||||||
|
@ -1353,7 +1353,7 @@ bool Airport::CheckZFightingTriangles( const char* prefix, const char* debug_roo
|
||||||
tgContour intContour = intersection.GetContour( m );
|
tgContour intContour = intersection.GetContour( m );
|
||||||
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
if ( (intContour.GetSize() > 2) && (intContour.GetArea() > min_area_thresh) ) {
|
||||||
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between base poly and pavement poly " << j << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
TG_LOG( SG_GENERAL, SG_ALERT, prefix << "Z-FIGHTING between base poly and pavement poly " << j << " contour has " << intContour.GetSize() << " nodes " << " area is " << intContour.GetArea() );
|
||||||
sprintf( desc, "base_pvmt_%06d", j );
|
sprintf( desc, "base_pvmt_%06u", j );
|
||||||
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
tgShapefile::FromContour( intContour, debug_root, layer, desc );
|
||||||
zfighting = true;
|
zfighting = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ inline double CalculateTheta( const SGVec3d& dirCur, const SGVec3d& dirNext, con
|
||||||
class BezNode
|
class BezNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BezNode( SGGeod l )
|
explicit BezNode( SGGeod l )
|
||||||
{
|
{
|
||||||
loc = l;
|
loc = l;
|
||||||
|
|
||||||
|
|
|
@ -21,48 +21,33 @@ static void stringPurifier( std::string& s )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosedPoly::ClosedPoly( char* desc )
|
ClosedPoly::ClosedPoly( char* desc ) :
|
||||||
|
is_pavement(false),
|
||||||
|
is_border(false),
|
||||||
|
has_feature(false),
|
||||||
|
surface_type(0),
|
||||||
|
smoothness(0.0),
|
||||||
|
texture_heading(0.0),
|
||||||
|
description(std::string(desc ? desc : "none"))
|
||||||
{
|
{
|
||||||
is_pavement = false;
|
is_border = true;
|
||||||
is_border = true;
|
|
||||||
has_feature = false;
|
|
||||||
|
|
||||||
if ( desc )
|
stringPurifier(description);
|
||||||
{
|
|
||||||
description = desc;
|
|
||||||
stringPurifier(description);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
description = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
boundary.clear();
|
boundary.clear();
|
||||||
cur_contour.clear();
|
cur_contour.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosedPoly::ClosedPoly( int st, float s, float th, char* desc )
|
ClosedPoly::ClosedPoly( int st, float s, float th, char* desc ) :
|
||||||
|
ClosedPoly( desc )
|
||||||
{
|
{
|
||||||
surface_type = st;
|
surface_type = st;
|
||||||
smoothness = s;
|
smoothness = s;
|
||||||
texture_heading = th;
|
texture_heading = th;
|
||||||
|
|
||||||
is_pavement = (surface_type != 15) ? true : false; // wrong??
|
is_pavement = (surface_type != 15) ? true : false; // wrong??
|
||||||
is_border = false;
|
is_border = false;
|
||||||
has_feature = true;
|
has_feature = true;
|
||||||
|
|
||||||
if ( desc )
|
|
||||||
{
|
|
||||||
description = desc;
|
|
||||||
stringPurifier(description);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
description = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
boundary.clear();
|
|
||||||
cur_contour.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosedPoly::~ClosedPoly()
|
ClosedPoly::~ClosedPoly()
|
||||||
|
@ -438,10 +423,10 @@ int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tg
|
||||||
|
|
||||||
int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tgAccumulator& accum, std::string& shapefile_name )
|
int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tgAccumulator& accum, std::string& shapefile_name )
|
||||||
{
|
{
|
||||||
char layer[128];
|
|
||||||
|
|
||||||
if ( is_pavement && pre_tess.Contours() )
|
if ( is_pavement && pre_tess.Contours() )
|
||||||
{
|
{
|
||||||
|
char layer[128];
|
||||||
|
|
||||||
if( shapefile_name.size() ) {
|
if( shapefile_name.size() ) {
|
||||||
sprintf( layer, "%s_preclip", shapefile_name.c_str() );
|
sprintf( layer, "%s_preclip", shapefile_name.c_str() );
|
||||||
tgShapefile::FromPolygon( pre_tess, "./airport_dbg", layer, std::string("preclip") );
|
tgShapefile::FromPolygon( pre_tess, "./airport_dbg", layer, std::string("preclip") );
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
class ClosedPoly
|
class ClosedPoly
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ClosedPoly( char* desc );
|
explicit ClosedPoly( char* desc );
|
||||||
ClosedPoly( int st, float s, float th, char* desc );
|
ClosedPoly( int st, float s, float th, char* desc );
|
||||||
~ClosedPoly();
|
~ClosedPoly();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
// lookup node elevations for each point in the SGGeod list. Returns
|
// lookup node elevations for each point in the SGGeod list. Returns
|
||||||
// average of all points. Doesn't modify the original list.
|
// average of all points. Doesn't modify the original list.
|
||||||
double tgAverageElevation( const std::string &root, const string_list elev_src,
|
double tgAverageElevation( const std::string &root, const string_list elev_src,
|
||||||
const std::vector<SGGeod> points_source )
|
const std::vector<SGGeod>& points_source )
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
// lookup node elevations for each point in the SGGeod list. Returns
|
// lookup node elevations for each point in the SGGeod list. Returns
|
||||||
// average of all points. Doesn't modify the original list.
|
// average of all points. Doesn't modify the original list.
|
||||||
double tgAverageElevation( const std::string &root, const string_list elev_src,
|
double tgAverageElevation( const std::string &root, const string_list elev_src,
|
||||||
const std::vector<SGGeod> points_source );
|
const std::vector<SGGeod>& points_source );
|
||||||
|
|
||||||
// lookup node elevations for each point in the specified nurbs++
|
// lookup node elevations for each point in the specified nurbs++
|
||||||
// matrix.
|
// matrix.
|
||||||
|
|
|
@ -23,19 +23,26 @@
|
||||||
#include "runway.hxx"
|
#include "runway.hxx"
|
||||||
#include "debug.hxx"
|
#include "debug.hxx"
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
Helipad::Helipad(char* definition)
|
Helipad::Helipad(char* definition)
|
||||||
{
|
{
|
||||||
|
// helipad format:
|
||||||
|
// designator lat lon heading length width surface markings shoulder smoothness edge-lighting
|
||||||
|
// example:
|
||||||
|
// "H1 21.30433555 -157.85586778 0.00 10.70 10.70 2 0 0 0.25 0\r"
|
||||||
|
|
||||||
// format:
|
std::istringstream ss(definition);
|
||||||
// helipad designator lat lon heading length width surface markings shoulder smoothness edge lighting
|
ss >> heli.designator
|
||||||
|
>> heli.lat
|
||||||
// int fscanf(FILE *stream, const char *format, ...);
|
>> heli.lon
|
||||||
sscanf(definition, "%s %lf %lf %lf %lf %lf %d %d %d %lf %d",
|
>> heli.heading
|
||||||
heli.designator, &heli.lat, &heli.lon, &heli.heading, &heli.length, &heli.width, &heli.surface,
|
>> heli.length
|
||||||
&heli.marking, &heli.shoulder, &heli.smoothness, &heli.edge_lights);
|
>> heli.width
|
||||||
|
>> heli.surface
|
||||||
|
>> heli.marking
|
||||||
|
>> heli.shoulder
|
||||||
|
>> heli.smoothness
|
||||||
|
>> heli.edge_lights;
|
||||||
|
|
||||||
TG_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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
class Helipad
|
class Helipad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Helipad(char* def);
|
explicit Helipad(char* def);
|
||||||
|
|
||||||
void BuildBtg( tgpolygon_list& heli_polys,
|
void BuildBtg( tgpolygon_list& heli_polys,
|
||||||
tglightcontour_list& heli_lights,
|
tglightcontour_list& heli_lights,
|
||||||
|
|
|
@ -72,23 +72,18 @@ typedef std::vector<Lighting*> LightingList;
|
||||||
class LinearFeature
|
class LinearFeature
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LinearFeature( char* desc, double o )
|
LinearFeature( char* desc, double o ) :
|
||||||
|
LinearFeature(std::string(desc ? desc : "none"), o)
|
||||||
{
|
{
|
||||||
if ( desc )
|
|
||||||
{
|
|
||||||
description = desc;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
description = "none";
|
|
||||||
}
|
|
||||||
offset = o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LinearFeature( std::string desc, double o )
|
LinearFeature( const std::string& desc, double o ) :
|
||||||
|
offset(o),
|
||||||
|
width(0),
|
||||||
|
cur_mark(nullptr),
|
||||||
|
cur_light(nullptr),
|
||||||
|
description(desc)
|
||||||
{
|
{
|
||||||
description = desc;
|
|
||||||
offset = o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~LinearFeature();
|
~LinearFeature();
|
||||||
|
|
|
@ -1,35 +1,50 @@
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#include "linked_objects.hxx"
|
#include "linked_objects.hxx"
|
||||||
#include "debug.hxx"
|
#include "debug.hxx"
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
Windsock::Windsock( char* definition )
|
Windsock::Windsock(char* definition)
|
||||||
{
|
{
|
||||||
sscanf(definition, "%lf %lf %d", &lat, &lon, &lit);
|
std::istringstream ss(definition);
|
||||||
|
ss >> lat
|
||||||
|
>> lon
|
||||||
|
>> lit;
|
||||||
|
|
||||||
TG_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 )
|
Beacon::Beacon(char* definition)
|
||||||
{
|
{
|
||||||
sscanf(definition, "%lf %lf %d", &lat, &lon, &code);
|
std::istringstream ss(definition);
|
||||||
|
ss >> lat
|
||||||
|
>> lon
|
||||||
|
>> code;
|
||||||
|
|
||||||
TG_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 )
|
Sign::Sign(char* definition)
|
||||||
{
|
{
|
||||||
char sgdef[256];
|
char sgdef[256];
|
||||||
double def_heading;
|
double def_heading;
|
||||||
|
|
||||||
sscanf(definition, "%lf %lf %lf %d %d %s", &lat, &lon, &def_heading, &reserved, &size, sgdef );
|
std::istringstream ss(definition);
|
||||||
|
ss >> lat
|
||||||
|
>> lon
|
||||||
|
>> def_heading
|
||||||
|
>> reserved
|
||||||
|
>> size
|
||||||
|
>> sgdef;
|
||||||
|
|
||||||
// 850 format sign heading is the heading which points away from the visible numbers
|
// 850 format sign heading is the heading which points away from the visible numbers
|
||||||
// Flightgear wants the heading to be the heading in which the sign is read
|
// Flightgear wants the heading to be the heading in which the sign is read
|
||||||
heading = -def_heading + 360.0;
|
heading = -def_heading + 360.0;
|
||||||
|
|
||||||
TG_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;
|
sgn_def = sgdef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class Windsock
|
class Windsock
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Windsock(char* def);
|
explicit Windsock(char* def);
|
||||||
|
|
||||||
double lat;
|
double lat;
|
||||||
double lon;
|
double lon;
|
||||||
|
@ -31,7 +31,7 @@ typedef std::vector<std::shared_ptr<Windsock>> WindsockList;
|
||||||
class Beacon
|
class Beacon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Beacon(char* def);
|
explicit Beacon(char* def);
|
||||||
|
|
||||||
double lat;
|
double lat;
|
||||||
double lon;
|
double lon;
|
||||||
|
@ -53,7 +53,7 @@ typedef std::vector<std::shared_ptr<Beacon>> BeaconList;
|
||||||
class Sign
|
class Sign
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Sign(char* def);
|
explicit Sign(char* def);
|
||||||
|
|
||||||
double lat;
|
double lat;
|
||||||
double lon;
|
double lon;
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
#include <simgear/math/SGMathFwd.hxx>
|
#include <simgear/math/SGMathFwd.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#include "object.hxx"
|
#include "object.hxx"
|
||||||
#include "debug.hxx"
|
#include "debug.hxx"
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
LightingObj::LightingObj( char* definition )
|
LightingObj::LightingObj( char* definition )
|
||||||
{
|
{
|
||||||
sscanf(definition, "%lf %lf %d %lf %lf %s", &lat, &lon, &type, &heading, &glideslope, &assoc_rw);
|
std::istringstream ss(definition);
|
||||||
|
ss >> lat
|
||||||
|
>> lon
|
||||||
|
>> type
|
||||||
|
>> heading
|
||||||
|
>> glideslope
|
||||||
|
>> assoc_rw;
|
||||||
|
|
||||||
TG_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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
class LightingObj
|
class LightingObj
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LightingObj(char* def);
|
explicit LightingObj(char* def);
|
||||||
|
|
||||||
double lat;
|
double lat;
|
||||||
double lon;
|
double lon;
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
#include <terragear/tg_polygon.hxx>
|
#include <terragear/tg_polygon.hxx>
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include "global.hxx"
|
#include "global.hxx"
|
||||||
#include "apt_math.hxx"
|
#include "apt_math.hxx"
|
||||||
#include "beznode.hxx"
|
#include "beznode.hxx"
|
||||||
|
@ -20,43 +18,74 @@ Runway::Runway(char* definition)
|
||||||
{
|
{
|
||||||
double az2;
|
double az2;
|
||||||
|
|
||||||
// format:
|
// runway format:
|
||||||
// runway width surface shoulder smoothness centerline lights edge lighting distance remaining signs
|
// width surface shoulder smoothness centerline lights edge lighting distance remaining signs
|
||||||
// 100 46.02 2 1 0.00 1 2 1
|
// 46.02 2 1 0.00 1 2 1
|
||||||
//
|
//
|
||||||
// runway number runway end lat runway end long threshold overrun markings approach lighting
|
// runway number runway end lat runway end long threshold overrun markings approach lighting
|
||||||
// 09L 33.63470475 -084.44798671 0.00 120.09 3 7
|
// 09L 33.63470475 -084.44798671 0.00 120.09 3 7
|
||||||
//
|
//
|
||||||
// touchdown zone lighting runway end identifier lights
|
// touchdown zone lighting runway end identifier lights
|
||||||
// 0 1
|
// 0 1
|
||||||
//
|
//
|
||||||
// runway number runway end lat runway end long threshold overrun markings approach lighting
|
// runway number runway end lat runway end long threshold overrun markings approach lighting
|
||||||
// 27R 33.63469907 -084.40893004 0.00 120.09 3 6
|
// 27R 33.63469907 -084.40893004 0.00 120.09 3 6
|
||||||
//
|
//
|
||||||
// touchdown zone lighting runway end identifier lights
|
// touchdown zone lighting runway end identifier lights
|
||||||
// 0 1
|
// 0 1
|
||||||
|
|
||||||
// Parse the line
|
// Parse the line
|
||||||
// 46.02 2 1 0.00 1 2 1 09L 33.63470475 -084.44798671 0.00 120.09 3 7 0 1 27R 33.63469907 -084.40893004 0.00 120.09 3 6 0 1
|
// 46.02 2 1 0.00 1 2 1 09L 33.63470475 -084.44798671 0.00 120.09 3 7 0 1 27R 33.63469907 -084.40893004 0.00 120.09 3 6 0 1
|
||||||
|
|
||||||
// int fscanf(FILE *stream, const char *format, ...);
|
std::istringstream ss(definition);
|
||||||
sscanf(definition, "%lf %d %d %lf %d %d %d %s %lf %lf %lf %lf %d %d %d %d %s %lf %lf %lf %lf %d %d %d %d",
|
ss >> rwy.width
|
||||||
&rwy.width, &rwy.surface, &rwy.shoulder, &rwy.smoothness, &rwy.centerline_lights, &rwy.edge_lights, &rwy.dist_remain_signs,
|
>> rwy.surface
|
||||||
rwy.rwnum[0], &rwy.lat[0], &rwy.lon[0], &rwy.threshold[0], &rwy.overrun[0], &rwy.marking[0], &rwy.approach_lights[0], &rwy.tz_lights[0], &rwy.reil[0],
|
>> rwy.shoulder
|
||||||
rwy.rwnum[1], &rwy.lat[1], &rwy.lon[1], &rwy.threshold[1], &rwy.overrun[1], &rwy.marking[1], &rwy.approach_lights[1], &rwy.tz_lights[1], &rwy.reil[1]
|
>> rwy.smoothness
|
||||||
);
|
>> rwy.centerline_lights
|
||||||
|
>> rwy.edge_lights
|
||||||
|
>> rwy.dist_remain_signs
|
||||||
|
>> rwy.rwnum[0]
|
||||||
|
>> rwy.lat[0]
|
||||||
|
>> rwy.lon[0]
|
||||||
|
>> rwy.threshold[0]
|
||||||
|
>> rwy.overrun[0]
|
||||||
|
>> rwy.marking[0]
|
||||||
|
>> rwy.approach_lights[0]
|
||||||
|
>> rwy.tz_lights[0]
|
||||||
|
>> rwy.reil[0]
|
||||||
|
>> rwy.rwnum[1]
|
||||||
|
>> rwy.lat[1]
|
||||||
|
>> rwy.lon[1]
|
||||||
|
>> rwy.threshold[1]
|
||||||
|
>> rwy.overrun[1]
|
||||||
|
>> rwy.marking[1]
|
||||||
|
>> rwy.approach_lights[1]
|
||||||
|
>> rwy.tz_lights[1]
|
||||||
|
>> rwy.reil[1];
|
||||||
|
|
||||||
// calculate runway heading and length (used a lot)
|
// calculate runway heading and length (used a lot)
|
||||||
SGGeodesy::inverse( GetStart(), GetEnd(), rwy.heading, az2, rwy.length );
|
SGGeodesy::inverse( GetStart(), GetEnd(), rwy.heading, az2, rwy.length );
|
||||||
|
|
||||||
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 );
|
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WaterRunway::WaterRunway(char* definition)
|
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]);
|
std::istringstream ss(definition);
|
||||||
|
ss >> width
|
||||||
|
>> buoys
|
||||||
|
>> rwnum[0]
|
||||||
|
>> lat[0]
|
||||||
|
>> lon[0]
|
||||||
|
>> rwnum[1]
|
||||||
|
>> lat[1]
|
||||||
|
>> lon[1];
|
||||||
|
|
||||||
TG_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 );
|
||||||
}
|
}
|
||||||
|
@ -85,6 +114,7 @@ tgContour WaterRunway::GetBuoys()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return buoys_nodes;
|
return buoys_nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Runway
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Runway(char* def);
|
explicit Runway(char* def);
|
||||||
|
|
||||||
SGGeod GetStart()
|
SGGeod GetStart()
|
||||||
{
|
{
|
||||||
|
@ -184,7 +184,7 @@ typedef std::vector <std::shared_ptr<Runway>> RunwayList;
|
||||||
class WaterRunway
|
class WaterRunway
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WaterRunway(char* def);
|
explicit WaterRunway(char* def);
|
||||||
|
|
||||||
tgContour GetBuoys();
|
tgContour GetBuoys();
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
|
|
||||||
#include <terragear/tg_shapefile.hxx>
|
#include <terragear/tg_shapefile.hxx>
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include "global.hxx"
|
#include "global.hxx"
|
||||||
#include "apt_math.hxx"
|
#include "apt_math.hxx"
|
||||||
#include "beznode.hxx"
|
#include "beznode.hxx"
|
||||||
|
@ -29,20 +27,31 @@ Taxiway::Taxiway(char* definition)
|
||||||
double smoothness;
|
double smoothness;
|
||||||
int signs;
|
int signs;
|
||||||
|
|
||||||
// format:
|
// taxiway format:
|
||||||
// taxiway lat lon designation heading length threshold overrun
|
// lat lon designation heading length threshold overrun
|
||||||
// 10 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0
|
// 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0
|
||||||
//
|
//
|
||||||
// width lighting surface shoulder markings smoothness dist remain
|
// width lighting surface shoulder markings smoothness dist remain
|
||||||
// 60 161161 1 0 0 0.35 0
|
// 60 161161 1 0 0 0.35 0
|
||||||
|
|
||||||
// Parse the line
|
// Parse the line
|
||||||
// 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0 60 161161 1 0 0 0.35 0
|
// 44.38085600 -074.20606200 xxx 79.29 3384 0.0 0.0 60 161161 1 0 0 0.35 0
|
||||||
|
|
||||||
// int fscanf(FILE *stream, const char *format, ...);
|
std::istringstream ss(definition);
|
||||||
sscanf(definition, "%lf %lf %s %lf %lf %lf %lf %lf %s %d %d %d %lf %d",
|
ss >> lat
|
||||||
&lat, &lon, designation, &heading, &length, &threshold, &overrun,
|
>> lon
|
||||||
&width, lighting, &surface, &shoulder, &markings, &smoothness, &signs);
|
>> designation
|
||||||
|
>> heading
|
||||||
|
>> length
|
||||||
|
>> threshold
|
||||||
|
>> overrun
|
||||||
|
>> width
|
||||||
|
>> lighting
|
||||||
|
>> surface
|
||||||
|
>> shoulder
|
||||||
|
>> markings
|
||||||
|
>> smoothness
|
||||||
|
>> signs;
|
||||||
|
|
||||||
TG_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 );
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Taxiway
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Taxiway(char* def);
|
explicit Taxiway(char* def);
|
||||||
|
|
||||||
int BuildBtg( tgpolygon_list& taxi_polys,
|
int BuildBtg( tgpolygon_list& taxi_polys,
|
||||||
tglightcontour_list& taxi_lights,
|
tglightcontour_list& taxi_lights,
|
||||||
|
|
Loading…
Add table
Reference in a new issue