Starting work on section that will read in existing neighbor data.
This commit is contained in:
parent
6aa07ad71a
commit
9b5912914d
2 changed files with 57 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Misc/fgstream.hxx>
|
||||
|
||||
#include "match.hxx"
|
||||
|
||||
|
@ -38,6 +39,41 @@ FGMatch::~FGMatch( void ) {
|
|||
}
|
||||
|
||||
|
||||
static bool check_corner( FGMatch::neighbor_type n, FGBucket b ) {
|
||||
double clon = b.get_center_lon();
|
||||
double clat = b.get_center_lat();
|
||||
|
||||
if ( n == FGMatch::SW_Corner ) {
|
||||
fgBucketOffset(clon, clat, -1, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// load any previously existing shared data from all neighbors
|
||||
void FGMatch::load_neighbor_shared( FGConstruct& c ) {
|
||||
sw_flag = se_flag = ne_flag = nw_flag = false;
|
||||
north_flag = south_flag = east_flag = west_flag = false;
|
||||
|
||||
string base = c.get_work_base();
|
||||
FGBucket b = c.get_bucket();
|
||||
|
||||
string dir = base + ".shared/Scenery/" + b.gen_base_path();
|
||||
string command = "mkdir -p " + dir;
|
||||
string file = dir + "/" + b.gen_index_str();
|
||||
cout << "shared data will be written to " << file << endl;
|
||||
|
||||
system(command.c_str());
|
||||
fg_gzifstream in( file );
|
||||
if ( !in ) {
|
||||
cout << "Cannot open file: " << file << endl;
|
||||
}
|
||||
|
||||
while ( in ) { }
|
||||
|
||||
check_corner( SW_Corner, b );
|
||||
}
|
||||
|
||||
|
||||
// extract the shared edge points, normals, and segments. This must
|
||||
// be done after calling load_neighbor_data() and will ignore any
|
||||
// shared data from the current tile that already exists from a
|
||||
|
@ -212,6 +248,7 @@ void FGMatch::write_shared( FGConstruct& c ) {
|
|||
west_normals[i].z() );
|
||||
}
|
||||
|
||||
#if 0 // not needed
|
||||
point_list nodes = c.get_geod_nodes();
|
||||
Point3D p1, p2;
|
||||
|
||||
|
@ -242,6 +279,10 @@ void FGMatch::write_shared( FGConstruct& c ) {
|
|||
fprintf( fp, "w_seg %.6f %.6f %.6f %.6f\n",
|
||||
p1.x(), p1.y(), p2.x(), p2.y() );
|
||||
}
|
||||
#endif
|
||||
|
||||
fclose( fp );
|
||||
|
||||
command = "gzip --force --best " + file;
|
||||
system(command.c_str());
|
||||
}
|
||||
|
|
|
@ -52,12 +52,27 @@ private:
|
|||
point_list north_normals, south_normals, east_normals, west_normals;
|
||||
point_list body_normals;
|
||||
|
||||
// flags
|
||||
bool sw_flag, se_flag, ne_flag, nw_flag;
|
||||
bool north_flag, south_flag, east_flag, west_flag;
|
||||
|
||||
// segment breakdown
|
||||
triseg_list north_segs, south_segs, east_segs, west_segs;
|
||||
triseg_list body_segs;
|
||||
|
||||
public:
|
||||
|
||||
enum neighbor_type {
|
||||
SW_Corner = 1,
|
||||
SE_Corner = 2,
|
||||
NE_Corner = 3,
|
||||
NW_Corner = 4,
|
||||
NORTH = 5,
|
||||
SOUTH = 6,
|
||||
EAST = 7,
|
||||
WEST = 8
|
||||
};
|
||||
|
||||
// Constructor
|
||||
FGMatch( void );
|
||||
|
||||
|
@ -65,7 +80,7 @@ public:
|
|||
~FGMatch( void );
|
||||
|
||||
// load any previously existing shared data from all neighbors
|
||||
void load_neighbor_data();
|
||||
void load_neighbor_shared( FGConstruct& c );
|
||||
|
||||
// extract the shared edge points, normals, and segments. This
|
||||
// must be done after calling load_neighbor_data() and will ignore
|
||||
|
|
Loading…
Reference in a new issue