1
0
Fork 0

hookup --debug to shapefile generation in ogrdecode

This commit is contained in:
Peter Sadrozinski 2013-07-23 20:53:53 -04:00
parent 23aa8a8ef3
commit 9d4f65f766
4 changed files with 15 additions and 4 deletions

View file

@ -1237,5 +1237,5 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
chopper.Add( divided_base, "Hole" ); chopper.Add( divided_base, "Hole" );
chopper.Add( apt_clearing, "Airport" ); chopper.Add( apt_clearing, "Airport" );
chopper.Save(); chopper.Save( false );
} }

View file

@ -214,17 +214,22 @@ long int tgChopper::GenerateIndex( std::string path )
return index; return index;
} }
void tgChopper::Save( void ) void tgChopper::Save( bool DebugShapefiles )
{ {
// traverse the bucket list // traverse the bucket list
bucket_polys_map_interator it; bucket_polys_map_interator it;
char tile_name[16]; char tile_name[16];
char poly_ext[16]; char poly_ext[16];
char layer[32];
char ds_name[64];
for (it=bp_map.begin(); it != bp_map.end(); it++) { for (it=bp_map.begin(); it != bp_map.end(); it++) {
SGBucket b( (*it).first ); SGBucket b( (*it).first );
tgpolygon_list const& polys = (*it).second; tgpolygon_list const& polys = (*it).second;
sprintf(ds_name, "./bucket_%s", b.gen_index_str().c_str() );
std::string path = root_path + "/" + b.gen_base_path(); std::string path = root_path + "/" + b.gen_base_path();
sprintf( tile_name, "%ld", b.gen_index() ); sprintf( tile_name, "%ld", b.gen_index() );
@ -248,6 +253,12 @@ void tgChopper::Save( void )
sgWriteUInt( fp, polys.size() ); sgWriteUInt( fp, polys.size() );
for ( unsigned int i=0; i<polys.size(); i++ ) { for ( unsigned int i=0; i<polys.size(); i++ ) {
polys[i].SaveToGzFile( fp ); polys[i].SaveToGzFile( fp );
if ( DebugShapefiles )
{
sprintf(layer, "poly_%s-%d", b.gen_index_str().c_str(), i );
tgShapefile::FromPolygon( polys[i], ds_name, layer, "poly" );
}
} }
gzclose( fp ); gzclose( fp );

View file

@ -14,7 +14,7 @@ public:
} }
void Add( const tgPolygon& poly, const std::string& type ); void Add( const tgPolygon& poly, const std::string& type );
void Save( void ); void Save( bool DebugShapes );
private: private:
long int GenerateIndex( std::string path ); long int GenerateIndex( std::string path );

View file

@ -685,7 +685,7 @@ int main( int argc, char **argv ) {
OGRDataSource::DestroyDataSource( poDS ); OGRDataSource::DestroyDataSource( poDS );
SG_LOG(SG_GENERAL, SG_ALERT, "Saving to buckets"); SG_LOG(SG_GENERAL, SG_ALERT, "Saving to buckets");
results.Save(); results.Save( save_shapefiles );
return 0; return 0;
} }