Track and position beacons, windsocks, and towers.
This commit is contained in:
parent
92650b6ded
commit
b5894d473f
3 changed files with 133 additions and 6 deletions
|
@ -337,6 +337,9 @@ static void build_runway( const TGRunway& rwy_info,
|
||||||
void build_airport( string airport_id, float alt_m,
|
void build_airport( string airport_id, float alt_m,
|
||||||
string_list& runways_raw,
|
string_list& runways_raw,
|
||||||
string_list& taxiways_raw,
|
string_list& taxiways_raw,
|
||||||
|
string_list& beacons_raw,
|
||||||
|
string_list& towers_raw,
|
||||||
|
string_list& windsocks_raw,
|
||||||
const string& root,
|
const string& root,
|
||||||
const string_list& elev_src )
|
const string_list& elev_src )
|
||||||
{
|
{
|
||||||
|
@ -489,6 +492,75 @@ void build_airport( string airport_id, float alt_m,
|
||||||
taxiways.push_back( taxi );
|
taxiways.push_back( taxi );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
point_list beacons; beacons.clear();
|
||||||
|
for ( i = 0; i < (int)beacons_raw.size(); ++i ) {
|
||||||
|
string beacon_str = beacons_raw[i];
|
||||||
|
|
||||||
|
Point3D beacon;
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, beacon_str);
|
||||||
|
|
||||||
|
string beacon_lat = beacon_str.substr(2, 10);
|
||||||
|
beacon.setlat( atof( beacon_lat.c_str() ) );
|
||||||
|
|
||||||
|
string beacon_lon = beacon_str.substr(13, 11);
|
||||||
|
beacon.setlon( atof( beacon_lon.c_str() ) );
|
||||||
|
|
||||||
|
string beacon_type = beacon_str.substr(25, 1);
|
||||||
|
|
||||||
|
SG_LOG( SG_GENERAL, SG_DEBUG, " beacon = " << beacon );
|
||||||
|
|
||||||
|
beacons.push_back( beacon );
|
||||||
|
}
|
||||||
|
|
||||||
|
point_list towers; towers.clear();
|
||||||
|
for ( i = 0; i < (int)towers_raw.size(); ++i ) {
|
||||||
|
string tower_str = towers_raw[i];
|
||||||
|
|
||||||
|
Point3D tower;
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, tower_str);
|
||||||
|
|
||||||
|
string tower_lat = tower_str.substr(2, 10);
|
||||||
|
tower.setlat( atof( tower_lat.c_str() ) );
|
||||||
|
|
||||||
|
string tower_lon = tower_str.substr(13, 11);
|
||||||
|
tower.setlon( atof( tower_lon.c_str() ) );
|
||||||
|
|
||||||
|
string tower_type = tower_str.substr(25, 1);
|
||||||
|
|
||||||
|
SG_LOG( SG_GENERAL, SG_DEBUG, " tower = " << tower );
|
||||||
|
|
||||||
|
towers.push_back( tower );
|
||||||
|
}
|
||||||
|
|
||||||
|
point_list windsocks; windsocks.clear();
|
||||||
|
int_list windsock_types; windsock_types.clear();
|
||||||
|
for ( i = 0; i < (int)windsocks_raw.size(); ++i ) {
|
||||||
|
string windsock_str = windsocks_raw[i];
|
||||||
|
|
||||||
|
Point3D windsock;
|
||||||
|
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, windsock_str);
|
||||||
|
|
||||||
|
string windsock_lat = windsock_str.substr(2, 10);
|
||||||
|
windsock.setlat( atof( windsock_lat.c_str() ) );
|
||||||
|
|
||||||
|
string windsock_lon = windsock_str.substr(13, 11);
|
||||||
|
windsock.setlon( atof( windsock_lon.c_str() ) );
|
||||||
|
|
||||||
|
string windsock_type = windsock_str.substr(25, 1);
|
||||||
|
|
||||||
|
SG_LOG( SG_GENERAL, SG_DEBUG, " windsock = " << windsock );
|
||||||
|
|
||||||
|
windsocks.push_back( windsock );
|
||||||
|
if ( windsock_type == "0" ) {
|
||||||
|
windsock_types.push_back( 0 );
|
||||||
|
} else {
|
||||||
|
windsock_types.push_back( 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TGSuperPoly sp;
|
TGSuperPoly sp;
|
||||||
TGTexParams tp;
|
TGTexParams tp;
|
||||||
|
|
||||||
|
@ -950,6 +1022,10 @@ void build_airport( string airport_id, float alt_m,
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()");
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Done with base calc_elevations()");
|
||||||
|
|
||||||
|
point_list beacon_nodes = calc_elevations( apt_surf, beacons, 0.0 );
|
||||||
|
point_list tower_nodes = calc_elevations( apt_surf, towers, 0.0 );
|
||||||
|
point_list windsock_nodes = calc_elevations( apt_surf, windsocks, 0.0 );
|
||||||
|
|
||||||
// add base skirt (to hide potential cracks)
|
// add base skirt (to hide potential cracks)
|
||||||
//
|
//
|
||||||
// this has to happen after we've calculated the node elevations
|
// this has to happen after we've calculated the node elevations
|
||||||
|
@ -1145,8 +1221,6 @@ void build_airport( string airport_id, float alt_m,
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "geod pt = " << geod_nodes[i] );
|
SG_LOG(SG_GENERAL, SG_DEBUG, "geod pt = " << geod_nodes[i] );
|
||||||
Point3D cart = sgGeodToCart( p );
|
Point3D cart = sgGeodToCart( p );
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, " cart pt = " << cart );
|
SG_LOG(SG_GENERAL, SG_DEBUG, " cart pt = " << cart );
|
||||||
Point3D geod = sgCartToGeod( cart );
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, " remapped goed pt = " << geod );
|
|
||||||
wgs84_nodes.push_back( cart );
|
wgs84_nodes.push_back( cart );
|
||||||
}
|
}
|
||||||
float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes );
|
float gbs_radius = sgCalcBoundingRadius( gbs_center, wgs84_nodes );
|
||||||
|
@ -1205,8 +1279,36 @@ void build_airport( string airport_id, float alt_m,
|
||||||
fans_v, fans_tc, fan_materials );
|
fans_v, fans_tc, fan_materials );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// write out airport object reference
|
||||||
write_index( objpath, b, name );
|
write_index( objpath, b, name );
|
||||||
|
|
||||||
|
// write out beacon references
|
||||||
|
for ( i = 0; i < (int)beacon_nodes.size(); ++i ) {
|
||||||
|
write_index_shared( objpath, b, beacon_nodes[i],
|
||||||
|
"Models/Airport/beacon.xml",
|
||||||
|
0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// write out tower references
|
||||||
|
for ( i = 0; i < (int)tower_nodes.size(); ++i ) {
|
||||||
|
write_index_shared( objpath, b, tower_nodes[i],
|
||||||
|
"Models/Airport/tower.xml",
|
||||||
|
0.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// write out windsock references
|
||||||
|
for ( i = 0; i < (int)windsock_nodes.size(); ++i ) {
|
||||||
|
if ( windsock_types[i] == 0 ) {
|
||||||
|
write_index_shared( objpath, b, windsock_nodes[i],
|
||||||
|
"Models/Airport/windsock.xml",
|
||||||
|
0.0 );
|
||||||
|
} else {
|
||||||
|
write_index_shared( objpath, b, windsock_nodes[i],
|
||||||
|
"Models/Airport/windsock_lit.xml",
|
||||||
|
0.0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string holepath = root + "/AirportArea";
|
string holepath = root + "/AirportArea";
|
||||||
// long int poly_index = poly_index_next();
|
// long int poly_index = poly_index_next();
|
||||||
// write_boundary( holepath, b, hull, poly_index );
|
// write_boundary( holepath, b, hull, poly_index );
|
||||||
|
|
|
@ -34,8 +34,12 @@
|
||||||
|
|
||||||
|
|
||||||
// build 3d airport
|
// build 3d airport
|
||||||
void build_airport( string airport_id, float alt_m, string_list& runways_raw,
|
void build_airport( string airport_id, float alt_m,
|
||||||
|
string_list& runways_raw,
|
||||||
string_list& taxiways_raw,
|
string_list& taxiways_raw,
|
||||||
|
string_list& beacons_raw,
|
||||||
|
string_list& towers_raw,
|
||||||
|
string_list& windsocks_raw,
|
||||||
const string& root,
|
const string& root,
|
||||||
const string_list& elev_src );
|
const string_list& elev_src );
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ int main( int argc, char **argv ) {
|
||||||
string_list elev_src;
|
string_list elev_src;
|
||||||
elev_src.clear();
|
elev_src.clear();
|
||||||
|
|
||||||
sglog().setLogLevels( SG_GENERAL, SG_DEBUG );
|
sglog().setLogLevels( SG_GENERAL, SG_INFO );
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
string work_dir = "";
|
string work_dir = "";
|
||||||
|
@ -230,7 +230,12 @@ int main( int argc, char **argv ) {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
string_list runways_list, taxiways_list;
|
string_list runways_list;
|
||||||
|
string_list taxiways_list;
|
||||||
|
string_list beacon_list;
|
||||||
|
string_list tower_list;
|
||||||
|
string_list windsock_list;
|
||||||
|
|
||||||
string last_apt_id = "";
|
string last_apt_id = "";
|
||||||
string last_apt_info = "";
|
string last_apt_info = "";
|
||||||
string line;
|
string line;
|
||||||
|
@ -286,6 +291,8 @@ int main( int argc, char **argv ) {
|
||||||
try {
|
try {
|
||||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||||
runways_list, taxiways_list,
|
runways_list, taxiways_list,
|
||||||
|
beacon_list, tower_list,
|
||||||
|
windsock_list,
|
||||||
work_dir, elev_src );
|
work_dir, elev_src );
|
||||||
} catch (sg_exception &e) {
|
} catch (sg_exception &e) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
|
@ -308,12 +315,24 @@ int main( int argc, char **argv ) {
|
||||||
// clear runway list for start of next airport
|
// clear runway list for start of next airport
|
||||||
runways_list.clear();
|
runways_list.clear();
|
||||||
taxiways_list.clear();
|
taxiways_list.clear();
|
||||||
|
beacon_list.clear();
|
||||||
|
tower_list.clear();
|
||||||
|
windsock_list.clear();
|
||||||
} else if ( line[0] == 'R' ) {
|
} else if ( line[0] == 'R' ) {
|
||||||
// runway entry
|
// runway entry
|
||||||
runways_list.push_back(line);
|
runways_list.push_back(line);
|
||||||
} else if ( line[0] == 'T' ) {
|
} else if ( line[0] == 'T' ) {
|
||||||
// runway entry
|
// taxiway entry
|
||||||
taxiways_list.push_back(line);
|
taxiways_list.push_back(line);
|
||||||
|
} else if ( line[0] == 'B' ) {
|
||||||
|
// beacon entry
|
||||||
|
beacon_list.push_back(line);
|
||||||
|
} else if ( line[0] == 'C' ) {
|
||||||
|
// control tower entry
|
||||||
|
tower_list.push_back(line);
|
||||||
|
} else if ( line[0] == 'W' ) {
|
||||||
|
// control tower entry
|
||||||
|
windsock_list.push_back(line);
|
||||||
} else {
|
} else {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Unknown line in file: " << line );
|
"Unknown line in file: " << line );
|
||||||
|
@ -354,6 +373,8 @@ int main( int argc, char **argv ) {
|
||||||
try {
|
try {
|
||||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||||
runways_list, taxiways_list,
|
runways_list, taxiways_list,
|
||||||
|
beacon_list, tower_list,
|
||||||
|
windsock_list,
|
||||||
work_dir, elev_src );
|
work_dir, elev_src );
|
||||||
} catch (sg_exception &e) {
|
} catch (sg_exception &e) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
|
|
Loading…
Reference in a new issue