1
0
Fork 0

Added flag to fg-construct to use the shared data of the constructed tile in addition to its neighbours'. Useful for rebuilding part of the scenery to fit the neighbours.

This commit is contained in:
Ralf Gerlich 2009-06-05 21:49:59 +02:00
parent d72116c6ab
commit 4ef15f03da
4 changed files with 64 additions and 0 deletions

View file

@ -73,6 +73,10 @@ private:
// data should only be used for fitting, but not rewritten // data should only be used for fitting, but not rewritten
bool writeSharedEdges; bool writeSharedEdges;
// flag indicating whether the shared edge data of the
// tile to be built should be used in addition to neighbour data
bool useOwnSharedEdges;
// detail level constraints // detail level constraints
int min_nodes; int min_nodes;
int max_nodes; int max_nodes;
@ -138,6 +142,10 @@ public:
inline bool get_write_shared_edges() const { return writeSharedEdges; } inline bool get_write_shared_edges() const { return writeSharedEdges; }
inline void set_write_shared_edges( const bool b ) { writeSharedEdges = b; } inline void set_write_shared_edges( const bool b ) { writeSharedEdges = b; }
// own shared edge use flag
inline bool get_use_own_shared_edges() const { return useOwnSharedEdges; }
inline void set_use_own_shared_edges( const bool b ) { useOwnSharedEdges = b; }
// detail level constraints // detail level constraints
inline int get_min_nodes() const { return min_nodes; } inline int get_min_nodes() const { return min_nodes; }
inline void set_min_nodes( const int n ) { min_nodes = n; } inline void set_min_nodes( const int n ) { min_nodes = n; }

View file

@ -1037,6 +1037,9 @@ static void construct_tile( TGConstruct& c ) {
// generated // generated
TGMatch m; TGMatch m;
m.load_neighbor_shared( c ); m.load_neighbor_shared( c );
if ( c.get_use_own_shared_edges() ) {
m.load_missing_shared( c );
}
m.split_tile( c ); m.split_tile( c );
if ( c.get_write_shared_edges() ) { if ( c.get_write_shared_edges() ) {
m.write_shared( c ); m.write_shared( c );
@ -1102,6 +1105,7 @@ static void usage( const string name ) {
cout << " --nudge=<float>" << endl; cout << " --nudge=<float>" << endl;
cout << " --useUKgrid" << endl; cout << " --useUKgrid" << endl;
cout << " --no-write-shared-edges" << endl; cout << " --no-write-shared-edges" << endl;
cout << " --use-own-shared-edges" << endl;
cout << " ] <load directory...>" << endl; cout << " ] <load directory...>" << endl;
exit(-1); exit(-1);
} }
@ -1125,6 +1129,10 @@ int main(int argc, char **argv) {
// data should only be used for fitting, but not rewritten // data should only be used for fitting, but not rewritten
bool writeSharedEdges = true; bool writeSharedEdges = true;
// flag indicating whether the shared edge data of the
// tile to be built should be used in addition to neighbour data
bool useOwnSharedEdges = false;
sglog().setLogLevels( SG_ALL, SG_DEBUG ); sglog().setLogLevels( SG_ALL, SG_DEBUG );
// //
@ -1156,6 +1164,8 @@ int main(int argc, char **argv) {
useUKgrid = true; useUKgrid = true;
} else if (arg.find("--no-write-shared-edges") == 0) { } else if (arg.find("--no-write-shared-edges") == 0) {
writeSharedEdges = false; writeSharedEdges = false;
} else if (arg.find("--use-own-shared-edges") == 0) {
useOwnSharedEdges = true;
} else if (arg.find("--") == 0) { } else if (arg.find("--") == 0) {
usage(argv[0]); usage(argv[0]);
} else { } else {
@ -1219,6 +1229,7 @@ int main(int argc, char **argv) {
c.set_output_base( output_dir ); c.set_output_base( output_dir );
c.set_useUKGrid( useUKgrid ); c.set_useUKGrid( useUKgrid );
c.set_write_shared_edges( writeSharedEdges ); c.set_write_shared_edges( writeSharedEdges );
c.set_use_own_shared_edges( useOwnSharedEdges );
c.set_min_nodes( 50 ); c.set_min_nodes( 50 );
c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) ); c.set_max_nodes( (int)(TG_MAX_NODES * 0.8) );

View file

@ -266,6 +266,48 @@ void TGMatch::load_neighbor_shared( TGConstruct& c ) {
} }
} }
// try to load any missing shared data from our own shared data file
void TGMatch::load_missing_shared( TGConstruct& c ) {
SGBucket b = c.get_bucket();
double clon = b.get_center_lon();
double clat = b.get_center_lat();
string base = c.get_work_base() + "/Shared/";
if ( !nw_flag ) {
scan_share_file( base, b, NW_Corner, NW_Corner );
}
if ( !ne_flag ) {
scan_share_file( base, b, NE_Corner, NE_Corner );
}
if ( !se_flag ) {
scan_share_file( base, b, SE_Corner, SE_Corner );
}
if ( !sw_flag ) {
scan_share_file( base, b, SW_Corner, SW_Corner );
}
if ( !north_flag ) {
scan_share_file( base, b, NORTH, NORTH );
}
if ( !east_flag ) {
scan_share_file( base, b, EAST, EAST );
}
if ( !south_flag ) {
scan_share_file( base, b, SOUTH, SOUTH );
}
if ( !west_flag ) {
scan_share_file( base, b, WEST, WEST );
}
}
// fake a normal for a point which is basically straight up // fake a normal for a point which is basically straight up
Point3D tgFakeNormal( const Point3D& p ) { Point3D tgFakeNormal( const Point3D& p ) {

View file

@ -85,6 +85,9 @@ public:
// true // true
void load_neighbor_shared( TGConstruct& c ); void load_neighbor_shared( TGConstruct& c );
// try to load any missing shared data from our own shared data file
void load_missing_shared( TGConstruct& c );
// scan the specified share file for the specified information // scan the specified share file for the specified information
void scan_share_file( const string& dir, const SGBucket& b, void scan_share_file( const string& dir, const SGBucket& b,
neighbor_type search, neighbor_type dest ); neighbor_type search, neighbor_type dest );