]> git.mxchange.org Git - flightgear.git/commitdiff
Starting work on section that will read in existing neighbor data.
authorcurt <curt>
Mon, 3 May 1999 11:43:41 +0000 (11:43 +0000)
committercurt <curt>
Mon, 3 May 1999 11:43:41 +0000 (11:43 +0000)
Tools/Construct/Match/match.cxx
Tools/Construct/Match/match.hxx

index 9437f2bd9266cddbeee31b82d3750240a990ca5a..9815ebb95394b6b936b17cbd2d331de3dade4331 100644 (file)
@@ -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());
 }
index e95e71bba882b7369d4f8cdbee552fda50e41316..d47344dda651c3c5a2aed49712950d3183a62268 100644 (file)
@@ -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