diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index 73f1b71e..45649ba4 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -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(); diff --git a/src/Airports/GenAirports850/airport.hxx b/src/Airports/GenAirports850/airport.hxx index 5dbaa4d1..72d61dd0 100644 --- a/src/Airports/GenAirports850/airport.hxx +++ b/src/Airports/GenAirports850/airport.hxx @@ -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; }; diff --git a/src/Airports/GenAirports850/linked_objects.cxx b/src/Airports/GenAirports850/linked_objects.cxx index 468ea40c..983bc7a6 100644 --- a/src/Airports/GenAirports850/linked_objects.cxx +++ b/src/Airports/GenAirports850/linked_objects.cxx @@ -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; +} + diff --git a/src/Airports/GenAirports850/linked_objects.hxx b/src/Airports/GenAirports850/linked_objects.hxx index 6a9cff1b..a04afa2c 100644 --- a/src/Airports/GenAirports850/linked_objects.hxx +++ b/src/Airports/GenAirports850/linked_objects.hxx @@ -57,5 +57,34 @@ public: typedef std::vector 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 SignList; #endif diff --git a/src/Airports/GenAirports850/parser.cxx b/src/Airports/GenAirports850/parser.cxx index 2a6bfa2b..497a3e8c 100644 --- a/src/Airports/GenAirports850/parser.cxx +++ b/src/Airports/GenAirports850/parser.cxx @@ -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 ); diff --git a/src/Airports/GenAirports850/parser.hxx b/src/Airports/GenAirports850/parser.hxx index c3579168..fa1ab36e 100644 --- a/src/Airports/GenAirports850/parser.hxx +++ b/src/Airports/GenAirports850/parser.hxx @@ -93,6 +93,7 @@ private: LightingObj* cur_object; Windsock* cur_windsock; Beacon* cur_beacon; + Sign* cur_sign; AirportList airports; diff --git a/src/Lib/Output/output.cxx b/src/Lib/Output/output.cxx index 5222b664..bef2b0b0 100644 --- a/src/Lib/Output/output.cxx +++ b/src/Lib/Output/output.cxx @@ -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 ) diff --git a/src/Lib/Output/output.hxx b/src/Lib/Output/output.hxx index b1d10633..5d300138 100644 --- a/src/Lib/Output/output.hxx +++ b/src/Lib/Output/output.hxx @@ -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 );