From 9c43f4785eb1861381bddc50af57eea5578baf8f Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 14 Apr 2004 14:34:13 +0000 Subject: [PATCH] Add a routine to place a "shared" object into the Work tree so the tile builder can pick it up later in the final assembly process. --- src/Lib/Output/output.cxx | 35 +++++++++++++++++++++++++++++++++-- src/Lib/Output/output.hxx | 10 ++++++++-- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/Lib/Output/output.cxx b/src/Lib/Output/output.cxx index 980988d6..87602e5c 100644 --- a/src/Lib/Output/output.cxx +++ b/src/Lib/Output/output.cxx @@ -67,8 +67,9 @@ void write_polygon( const TGPolygon& poly, const string& base ) { } -// update index -void write_index(const string& base, const SGBucket& b, const string& name) { +// update index file (list of objects to be included in final scenery build) +void write_index( const string& base, const SGBucket& b, const string& name ) +{ string dir = base + "/" + b.gen_base_path(); #ifdef _MSC_VER fg_mkdir( dir.c_str() ); @@ -92,6 +93,36 @@ void write_index(const string& base, const SGBucket& b, const string& name) { } +// update index file (list of shared objects to be included in final +// scenery build) +void write_index_shared( const string &base, const SGBucket &b, + const Point3D &p, const string& name, + const double &heading ) +{ + string dir = base + "/" + b.gen_base_path(); +#ifdef _MSC_VER + fg_mkdir( dir.c_str() ); +#else + string command = "mkdir -p " + dir; + system(command.c_str()); +#endif + + 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_SHARED %s %.6f %.6f %.1f %.2f\n", name.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 e74179ce..b4defbc3 100644 --- a/src/Lib/Output/output.hxx +++ b/src/Lib/Output/output.hxx @@ -46,8 +46,14 @@ void write_polygon( const TGPolygon& poly, const string& base ); -// update index -void write_index(const string& base, const SGBucket& b, const string& name); +// update index file (list of objects to be included in final scenery build) +void write_index( const string& base, const SGBucket& b, const string& name ); + +// update index file (list of shared objects to be included in final +// scenery build) +void write_index_shared( const string &base, const SGBucket &b, + const Point3D &p, const string& name, + const double &heading ); void write_boundary( const string& base, const SGBucket& b, const TGPolygon& bounds, long int p_index );