]> git.mxchange.org Git - flightgear.git/blobdiff - Airports/genapt.cxx
Converted to new logstream debugging facility. This allows release
[flightgear.git] / Airports / genapt.cxx
index 4d62bcf23c4f6dd226e7a6ee5b96b0b8f5a96f69..b65c5fa7ab94ce0ad7fc7778d0b888f08f545200 100644 (file)
@@ -31,7 +31,7 @@
 using namespace std;
 #endif
 
-#include <Debug/fg_debug.h>
+#include <Debug/logstream.hxx>
 // #include <Include/fg_types.h>
 #include <Math/fg_geodesy.hxx>
 #include <Math/mat3.h>
@@ -50,54 +50,14 @@ typedef container::iterator iterator;
 typedef container::const_iterator const_iterator;
 
 
-/*
-// Calculate distance between to Point3D's
-static double calc_dist(const Point3D& p1, const Point3D& p2) {
-    double x, y, z;
-    x = p1.x() - p2.x();
-    y = p1.y() - p2.y();
-    z = p1.z() - p2.z();
-    return sqrt(x*x + y*y + z*z);
-}
-*/
-
-
 #define FG_APT_BASE_TEX_CONSTANT 2000.0
 
-#ifdef OLD_TEX_COORDS
-// Calculate texture coordinates for a given point.
-static fgPoint3d
-calc_tex_coords(const fgPoint3d& p) {
-    fgPoint3d tex;
-
-    cout << "Texture coordinates = " << 
-       FG_APT_BASE_TEX_CONSTANT * p.lon << "  " << 
-       FG_APT_BASE_TEX_CONSTANT * p.lat << "\n";
-
-    tex.x = fmod(FG_APT_BASE_TEX_CONSTANT * p.lon, 10.0);
-    tex.y = fmod(FG_APT_BASE_TEX_CONSTANT * p.lat, 10.0);
-
-    if ( tex.x < 0.0 ) {
-       tex.x += 10.0;
-    }
-
-    if ( tex.y < 0.0 ) {
-       tex.y += 10.0;
-    }
-
-    cout << "Texture coordinates = " << tex.x << "  " << tex.y << "\n";
-
-    return tex;
-}
-#endif
-
-
 // Calculate texture coordinates for a given point.
 static Point3D calc_tex_coords(double *node, const Point3D& ref) {
     Point3D cp;
     Point3D pp;
 
-    cp.setvals( node[0] + ref.x(), node[1] + ref.y(), node[2] + ref.z() );
+    cp = Point3D( node[0] + ref.x(), node[1] + ref.y(), node[2] + ref.z() );
 
     pp = fgCartToPolar3d(cp);
 
@@ -137,9 +97,9 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
 
     // find airport base material in the properties list
     if ( ! material_mgr.find( APT_BASE_MATERIAL, fragment.material_ptr )) {
-       fgPrintf( FG_TERRAIN, FG_ALERT, 
-                 "Ack! unknown material name = %s in fgAptGenerat()\n",
-                 APT_BASE_MATERIAL );
+       FG_LOG( FG_TERRAIN, FG_ALERT, 
+               "Ack! unknown material name = " << APT_BASE_MATERIAL 
+               << " in fgAptGenerat()" );
     }
 
     printf(" tile center = %.2f %.2f %.2f\n", 
@@ -181,7 +141,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
 
     i = 1;
     tex = calc_tex_coords( t->nodes[i], t->center );
-    dist = distance3D(average, cart);
+    dist = cart.distance3D(average);
     if ( dist > max_dist ) {
        max_dist = dist;
     }
@@ -201,7 +161,7 @@ gen_base( const Point3D& average, const container& perimeter, fgTILE *t)
        fragment.add_face(center_num, i - 1, i);
 
        tex = calc_tex_coords( t->nodes[i], t->center );
-       dist = distance3D(average, cart);
+       dist = cart.distance3D(average);
        if ( dist > max_dist ) {
            max_dist = dist;
        }
@@ -259,10 +219,10 @@ fgAptGenerate(const string& path, fgTILE *tile)
     apt_id = "";
 
     // read in each line of the file
-    in.eat_comments();
+    in >> skipcomment;
     while ( ! in.eof() )
     {
-       in.stream() >> token;
+       in >> token;
 
        if ( token == "a" ) {
            // airport info record (start of airport)
@@ -274,7 +234,7 @@ fgAptGenerate(const string& path, fgTILE *tile)
            }
 
            cout << "Reading airport record\n";
-           in.stream() >> apt_id;
+           in >> apt_id;
            apt_name = "";
            i = 1;
            avex = avey = avez = 0.0;
@@ -290,7 +250,7 @@ fgAptGenerate(const string& path, fgTILE *tile)
            // out of the base terrain.  The points are given in
            // counter clockwise order and are specified in lon/lat
            // degrees.
-           in.stream() >> p;
+           in >> p;
            avex += tile->nodes[i][0];
            avey += tile->nodes[i][1];
            avez += tile->nodes[i][2];
@@ -302,17 +262,16 @@ fgAptGenerate(const string& path, fgTILE *tile)
            while ( in.get(c) && c != '\n' );
        }
 
-       // airports.insert(a);
-       in.eat_comments();
+       in >> skipcomment;
     }
 
     if ( apt_id != "" ) {
        // we have just finished reading and airport record.
        // process the info
        size = perimeter.size();
-       average.setvals( avex / (double)size + tile->center.x(),
-                        avey / (double)size + tile->center.y(),
-                        avez / (double)size + tile->center.z() );
+       average = Point3D( avex / (double)size + tile->center.x(),
+                          avey / (double)size + tile->center.y(),
+                          avez / (double)size + tile->center.z() );
 
        gen_base(average, perimeter, tile);
     }
@@ -322,6 +281,20 @@ fgAptGenerate(const string& path, fgTILE *tile)
 
 
 // $Log$
+// Revision 1.9  1998/11/06 21:17:32  curt
+// Converted to new logstream debugging facility.  This allows release
+// builds with no messages at all (and no performance impact) by using
+// the -DFG_NDEBUG flag.
+//
+// Revision 1.8  1998/11/06 14:46:59  curt
+// Changes to track Bernie's updates to fgstream.
+//
+// Revision 1.7  1998/10/20 18:26:06  curt
+// Updates to point3d.hxx
+//
+// Revision 1.6  1998/10/18 01:17:16  curt
+// Point3D tweaks.
+//
 // Revision 1.5  1998/10/16 23:27:14  curt
 // C++-ifying.
 //