]> git.mxchange.org Git - flightgear.git/blobdiff - DEM/dem.hxx
Tweaks to use newbucket.hxx
[flightgear.git] / DEM / dem.hxx
index 4a84871d27c0deb5ec5de43374a858572eab9e03..57969352ad7ff4587e739ebc4c3925dcf01d4227 100644 (file)
@@ -35,8 +35,8 @@
 
 #include <stdio.h>
 
-#include <Bucket/bucketutils.h>
-#include <zlib/zlib.h>
+#include <Bucket/newbucket.hxx>
+#include <Misc/fgstream.hxx>
 
 
 #define DEM_SIZE 1200
 
 
 class fgDEM {
+
+private:
+
     // file pointer for input
-    gzFile *fd;
+    // gzFile fd;
+    fg_gzifstream *in;
 
     // coordinates (in arc seconds) of south west corner
     double originx, originy;
@@ -77,29 +81,41 @@ class fgDEM {
     int do_data;
     int cur_col, cur_row;
 
+    // return next token from input stream
+    string next_token();
+
+    // return next integer from input stream
+    int next_int();
+
+    // return next double from input stream
+    double next_double();
+
+    // return next exponential num from input stream
+    double next_exp();
+
 public:
 
-    // Constructor (opens a DEM file)
+    // Constructor
     fgDEM( void );
+    fgDEM( const string& file );
+
+    // Destructor
+    ~fgDEM( void );
 
     // open a DEM file (use "-" if input is coming from stdin)
-    int open ( char *file );
+    int open ( const string& file );
 
     // close a DEM file
-    int close ( void );
+    int close();
 
     // parse a DEM file
-    int parse( void );
+    int parse();
 
     // read and parse DEM "A" record
-    void read_a_record( void );
+    int read_a_record();
 
     // read and parse DEM "B" record
-    void read_b_record( void );
-
-    // Informational methods
-    double info_originx( void ) { return(originx); }
-    double info_originy( void ) { return(originy); }
+    void read_b_record();
 
     // return the current altitude based on mesh data.  We should
     // rewrite this to interpolate exact values, but for now this is
@@ -107,7 +123,7 @@ public:
     double interpolate_altitude( double lon, double lat );
 
     // Use least squares to fit a simpler data set to dem data
-    void fit( char *fg_root, double error, struct fgBUCKET *p );
+    void fit( double error, const FGBucket& p );
 
     // Initialize output mesh structure
     void outputmesh_init( void );
@@ -119,10 +135,15 @@ public:
     void outputmesh_set_pt( int i, int j, double value );
 
     // Write out a node file that can be used by the "triangle" program
-    void outputmesh_output_nodes( char *fg_root, struct fgBUCKET *p );
+    void outputmesh_output_nodes( const string& fg_root, const FGBucket& p );
 
-    // Destructor
-    ~fgDEM( void );
+    // Informational methods
+    inline double get_originx() const { return originx; }
+    inline double get_originy() const { return originy; }
+    inline int get_cols() const { return cols; }
+    inline int get_rows() const { return rows; }
+    inline double get_col_step() const { return col_step; }
+    inline double get_row_step() const { return row_step; }
 };
 
 
@@ -130,6 +151,30 @@ public:
 
 
 // $Log$
+// Revision 1.11  1999/03/11 23:31:57  curt
+// Tweaks to use newbucket.hxx
+//
+// Revision 1.10  1999/03/10 01:09:13  curt
+// Tweaks to go along with scenery tools overhaul.
+// Added a new constructor that accepts the file name.
+//
+// Revision 1.9  1998/10/16 19:08:14  curt
+// Portability updates from Bernie Bright.
+//
+// Revision 1.8  1998/09/19 17:59:46  curt
+// Use c++ streams (fg_gzifstream).  Also converted many character arrays to
+// the string class.
+//
+// Revision 1.7  1998/07/04 00:47:19  curt
+// typedef'd struct fgBUCKET.
+//
+// Revision 1.6  1998/06/05 18:14:40  curt
+// Abort out early when reading the "A" record if it doesn't look like
+// a proper DEM file.
+//
+// Revision 1.5  1998/04/22 13:14:46  curt
+// Fixed a bug in zlib usage.
+//
 // Revision 1.4  1998/04/21 17:03:41  curt
 // Prepairing for C++ integration.
 //