1
0
Fork 0

Added taxiway/runway sign link creation

This commit is contained in:
PSadrozinski 2011-10-06 21:22:15 -04:00 committed by Christian Schmitt
parent e9a266fdf1
commit 051497bede
8 changed files with 101 additions and 0 deletions

View file

@ -984,6 +984,18 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
}
point_list beacon_nodes = calc_elevations( apt_surf, b_nodes, 0.0 );
// calc taxiway sign elevations:
SG_LOG(SG_GENERAL, SG_INFO, "Computing taxiway sign node elevations");
point_list ts_nodes;
ts_nodes.clear();
for ( i = 0; i < (int)signs.size(); ++i )
{
p = signs[i]->GetLoc();
ts_nodes.push_back( p );
}
point_list taxisigns_nodes = calc_elevations( apt_surf, ts_nodes, 0.0 );
// add base skirt (to hide potential cracks)
//
// this has to happen after we've calculated the node elevations
@ -1294,6 +1306,17 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
0.0 );
}
// write out taxiway signs references
for ( i = 0; i < (int)taxisigns_nodes.size(); ++i )
{
write_object_sign( objpath, b, taxisigns_nodes[i],
signs[i]->GetDefinition(),
0.0 );
}
string holepath = root + "/AirportArea";
// long int poly_index = poly_index_next();

View file

@ -62,6 +62,11 @@ public:
beacons.push_back( beacon );
}
void AddSign( Sign* sign )
{
signs.push_back( sign );
}
void BuildOsg( osg::Group* airport );
void BuildBtg( const string& root, const string_list& elev_src );
@ -77,6 +82,7 @@ private:
LightingObjList lightobjects;
WindsockList windsocks;
BeaconList beacons;
SignList signs;
HelipadList helipads;
};

View file

@ -16,3 +16,14 @@ Beacon::Beacon( char* definition )
SG_LOG(SG_GENERAL, SG_DEBUG, "Read Beacon: (" << lon << "," << lat << ") code: " << code );
}
Sign::Sign( char* definition )
{
char sgdef[128];
sscanf(definition, "%lf %lf %lf %d %d %s", &lat, &lon, &heading, &reserved, &size, sgdef );
SG_LOG(SG_GENERAL, SG_ALERT, "Read Sign: (" << lon << "," << lat << ") heading " << heading << " size " << size << " definition: " << sgdef );
sgn_def = sgdef;
}

View file

@ -57,5 +57,34 @@ public:
typedef std::vector <Beacon *> BeaconList;
class Sign
{
public:
Sign(char* def);
double lat;
double lon;
double heading;
int reserved;
int size;
string sgn_def;
Point3D GetLoc()
{
return Point3D( lon, lat, 0.0f );
}
double GetHeading()
{
return heading;
}
string GetDefinition()
{
return sgn_def;
}
};
typedef std::vector <Sign *> SignList;
#endif

View file

@ -407,6 +407,8 @@ int Parser::ParseLine(char* line)
case TAXIWAY_SIGN:
SetState( STATE_PARSE_SIMPLE );
SG_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 );

View file

@ -93,6 +93,7 @@ private:
LightingObj* cur_object;
Windsock* cur_windsock;
Beacon* cur_beacon;
Sign* cur_sign;
AirportList airports;

View file

@ -115,6 +115,29 @@ void write_index_shared( const string &base, const SGBucket &b,
fclose( fp );
}
void write_object_sign( const string &base, const SGBucket &b,
const Point3D &p, const string& sign,
const double &heading )
{
string dir = base + "/" + b.gen_base_path();
SGPath sgp( dir );
sgp.append( "dummy" );
sgp.create_dir( 0755 );
string file = dir + "/" + b.gen_index_str() + ".ind";
// string file = dir + "/" + name;
cout << "Output file = " << file << endl;
FILE *fp;
if ( (fp = fopen( file.c_str(), "a" )) == NULL ) {
cout << "ERROR: opening " << file << " for writing!" << endl;
exit(-1);
}
fprintf( fp, "OBJECT_SIGN %s %.6f %.6f %.1f %.2f\n", sign.c_str(),
p.lon(), p.lat(), p.elev(), heading );
fclose( fp );
}
void write_boundary( const string& base, const SGBucket& b,
const TGPolygon& bounds, long int p_index )

View file

@ -53,6 +53,12 @@ void write_index_shared( const std::string &base, const SGBucket &b,
const Point3D &p, const std::string& name,
const double &heading );
// update index file (list of shared objects to be included in final
// scenery build)
void write_object_sign( const std::string &base, const SGBucket &b,
const Point3D &p, const std::string& sign,
const double &heading );
void write_boundary( const std::string& base, const SGBucket& b,
const TGPolygon& bounds, long int p_index );