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

@ -72,6 +72,10 @@ private:
// flag indicating whether this is a rebuild and Shared edge
// data should only be used for fitting, but not rewritten
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
int min_nodes;
@ -137,6 +141,10 @@ public:
// shared edge write flag
inline bool get_write_shared_edges() const { return writeSharedEdges; }
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
inline int get_min_nodes() const { return min_nodes; }

View file

@ -1037,6 +1037,9 @@ static void construct_tile( TGConstruct& c ) {
// generated
TGMatch m;
m.load_neighbor_shared( c );
if ( c.get_use_own_shared_edges() ) {
m.load_missing_shared( c );
}
m.split_tile( c );
if ( c.get_write_shared_edges() ) {
m.write_shared( c );
@ -1102,6 +1105,7 @@ static void usage( const string name ) {
cout << " --nudge=<float>" << endl;
cout << " --useUKgrid" << endl;
cout << " --no-write-shared-edges" << endl;
cout << " --use-own-shared-edges" << endl;
cout << " ] <load directory...>" << endl;
exit(-1);
}
@ -1125,6 +1129,10 @@ int main(int argc, char **argv) {
// data should only be used for fitting, but not rewritten
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 );
//
@ -1156,6 +1164,8 @@ int main(int argc, char **argv) {
useUKgrid = true;
} else if (arg.find("--no-write-shared-edges") == 0) {
writeSharedEdges = false;
} else if (arg.find("--use-own-shared-edges") == 0) {
useOwnSharedEdges = true;
} else if (arg.find("--") == 0) {
usage(argv[0]);
} else {
@ -1219,6 +1229,7 @@ int main(int argc, char **argv) {
c.set_output_base( output_dir );
c.set_useUKGrid( useUKgrid );
c.set_write_shared_edges( writeSharedEdges );
c.set_use_own_shared_edges( useOwnSharedEdges );
c.set_min_nodes( 50 );
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
Point3D tgFakeNormal( const Point3D& p ) {

View file

@ -84,6 +84,9 @@ public:
// shared data for a component exists set that components flag to
// true
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
void scan_share_file( const string& dir, const SGBucket& b,