1 // array.hxx -- Array management class
3 // Written by Curtis Olson, started March 1998.
5 // Copyright (C) 1998 - 1999 Curtis L. Olson - curt@flightgear.org
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 // (Log is kept at end of this file)
30 # error This library requires C++
34 #include <Bucket/newbucket.hxx>
35 #include <Misc/fgstream.hxx>
38 #define ARRAY_SIZE 1200
39 #define ARRAY_SIZE_1 1201
46 // file pointer for input
50 // coordinates (in arc seconds) of south west corner
51 double originx, originy;
53 // number of columns and rows
56 // Distance between column and row data points (in arc seconds)
57 double col_step, row_step;
59 // pointers to the actual grid data allocated here
60 float (*in_data)[ARRAY_SIZE_1];
61 float (*out_data)[ARRAY_SIZE_1];
63 // Current "A" Record Information
64 // char dem_description[80], dem_quadrangle[80];
65 // double dem_x1, dem_y1, dem_x2, dem_y2, dem_x3, dem_y3, dem_x4, dem_y4;
66 // double dem_z1, dem_z2;
67 // int dem_resolution, dem_num_profiles;
69 // Current "B" Record Information
70 // int prof_col, prof_row;
71 // int prof_num_cols, prof_num_rows;
72 // double prof_x1, prof_y1;
75 // temporary values for the class to use
76 // char option_name[32];
78 // int cur_col, cur_row;
80 // Initialize output mesh structure
81 void outputmesh_init( void );
83 // Get the value of a mesh node
84 double outputmesh_get_pt( int i, int j );
86 // Set the value of a mesh node
87 void outputmesh_set_pt( int i, int j, double value );
90 // Write out a node file that can be used by the "triangle" program
91 void outputmesh_output_nodes( const string& fg_root, FGBucket& p );
98 FGArray( const string& file );
103 // open an Array file (use "-" if input is coming from stdin)
104 int open ( const string& file );
106 // close a Array file
109 // parse a Array file
112 // Use least squares to fit a simpler data set to dem data
113 void fit( double error );
115 // return the current altitude based on grid data. We should
116 // rewrite this to interpolate exact values, but for now this is
118 double interpolate_altitude( double lon, double lat );
120 // Informational methods
121 inline double get_originx() const { return originx; }
122 inline double get_originy() const { return originy; }
123 inline int get_cols() const { return cols; }
124 inline int get_rows() const { return rows; }
125 inline double get_col_step() const { return col_step; }
126 inline double get_row_step() const { return row_step; }
134 // Revision 1.2 1999/03/13 23:50:27 curt
135 // Tweaked output formatting a bit.
137 // Revision 1.1 1999/03/13 18:45:02 curt
138 // Initial revision. (derived from libDEM.a code.)