1
0
Fork 0

Updated dem libs to support z units == 1 (feet).

This is not tested since I do not have data in feet to work with.
This commit is contained in:
curt 2002-10-08 15:28:53 +00:00
parent fbb232280e
commit 9b63deeb03
4 changed files with 73 additions and 11 deletions

View file

@ -1,17 +1,65 @@
#!/bin/sh #!/bin/sh
echo "Running aclocal" OSTYPE=`uname -s`
aclocal MACHINE=`uname -m`
AUTO_MAKE_VERSION=`automake --version | head -1 | awk '{print $4}' | sed -e 's/\.\([0-9]*\).*/\1/'`
if test $AUTO_MAKE_VERSION -lt 15; then
echo ""
echo "You need to upgrade to automake version 1.5 or greater."
echo "Most distributions have packages available to install or you can"
echo "find the source for the most recent version at"
echo "ftp://ftp.gnu.org/gnu/automake"
exit 1
fi
echo "Host info: $OSTYPE $MACHINE"
echo -n " automake: `automake --version | head -1 | awk '{print $4}'`"
echo " ($AUTO_MAKE_VERSION)"
echo ""
ACLOCAL_OPTS=""
if [ $AUTO_MAKE_VERSION -ge 14 ]; then
if [ $OSTYPE = "IRIX" -o $OSTYPE = "IRIX64" ]; then echo " -I ."
ACLOCAL_OPTS="-I ."
fi
fi
echo "Running aclocal $ACLOCAL_OPTS"
aclocal $ACLOCAL_OPTS
echo "Running autoheader" echo "Running autoheader"
autoheader autoheader
if [ ! -e src/Include/config.h.in ]; then
echo "ERROR: autoheader didn't create simgear/simgear_config.h.in!"
exit 1
fi
echo "Running automake" echo -n "Running automake"
automake --add-missing if [ $OSTYPE = "IRIX" -o $OSTYPE = "IRIX64" ]; then
echo " --add-missing --include-deps"
automake --add-missing --include-deps
else
echo " --add-missing"
automake --add-missing
fi
echo "Running autoconf" echo "Running autoconf"
autoconf autoconf
if [ ! -e configure ]; then
echo "ERROR: configure was not created!"
exit 1
fi
# fixup Makefiles for Irix
if test "$OSTYPE" = "IRIX" -o "$OSTYPE" = "IRIX64"; then
echo "Fixing Makefiles for Irix"
for n in `find . -name Makefile.in`; do \
mv -f $n $n.ar-new; \
sed 's/$(AR) cru/$(AR) -o/g' $n.ar-new > $n; \
rm -f $n.ar-new; \
done;
fi
echo "" echo ""
echo "======================================" echo "======================================"

View file

@ -184,6 +184,7 @@ AC_CHECK_LIB(plibul, ulInit,,,)
AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" ) AM_CONDITIONAL(HAVE_XWINDOWS, test "x$ac_cv_lib_X11_XCreateWindow" = "xyes" )
AC_LANG_PUSH(C++)
dnl Check for "plib" without which we cannot go on dnl Check for "plib" without which we cannot go on
AC_CHECK_HEADER(plib/pu.h) AC_CHECK_HEADER(plib/pu.h)
if test "x$ac_cv_header_plib_pu_h" != "xyes"; then if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
@ -196,6 +197,7 @@ if test "x$ac_cv_header_plib_pu_h" != "xyes"; then
echo "configure aborted." echo "configure aborted."
exit exit
fi fi
AC_LANG_POP
dnl Check if Generic Polygon Clipping library is installed dnl Check if Generic Polygon Clipping library is installed
dnl (from http://www.cs.man.ac.uk/aig/staff/alan/software/) dnl (from http://www.cs.man.ac.uk/aig/staff/alan/software/)

View file

@ -77,7 +77,9 @@ SG_USING_STD(endl);
#endif //0 #endif //0
FGDem::FGDem( void ) { FGDem::FGDem( void ) :
z_units(2) // meters
{
// cout << "class FGDem CONstructor called." << endl; // cout << "class FGDem CONstructor called." << endl;
dem_data = new float[DEM_SIZE_1][DEM_SIZE_1]; dem_data = new float[DEM_SIZE_1][DEM_SIZE_1];
output_data = new float[DEM_SIZE_1][DEM_SIZE_1]; output_data = new float[DEM_SIZE_1][DEM_SIZE_1];
@ -240,8 +242,8 @@ FGDem::read_a_record() {
// Units code; 2 represents meters as the unit of measure for // Units code; 2 represents meters as the unit of measure for
// elevation coordinates throughout the file. // elevation coordinates throughout the file.
inum = next_int(); z_units = inum = next_int();
if ( inum != 2 ) { if ( z_units != 1 && z_units != 2 ) {
cout << " Unknown (Z) units code = " << inum << "!\n"; cout << " Unknown (Z) units code = " << inum << "!\n";
exit(-1); exit(-1);
} }
@ -271,6 +273,11 @@ FGDem::read_a_record() {
// Minimum/maximum elevations in meters // Minimum/maximum elevations in meters
dem_z1 = next_exp(); dem_z1 = next_exp();
dem_z2 = next_exp(); dem_z2 = next_exp();
if ( z_units == 1 ) {
// convert to meters
dem_z1 *= SG_FEET_TO_METER;
dem_z2 *= SG_FEET_TO_METER;
}
cout << " Elevation range " << dem_z1 << " to " << dem_z2 << "\n"; cout << " Elevation range " << dem_z1 << " to " << dem_z2 << "\n";
// Counterclockwise angle from the primary axis of ground // Counterclockwise angle from the primary axis of ground
@ -314,7 +321,6 @@ void
FGDem::read_b_record( ) { FGDem::read_b_record( ) {
string token; string token;
int i; int i;
int last;
// row / column id of this profile // row / column id of this profile
prof_row = next_int(); prof_row = next_int();
@ -341,9 +347,14 @@ FGDem::read_b_record( ) {
token = next_token(); token = next_token();
// One (usually) dimensional array (1,prof_num_rows) of elevations // One (usually) dimensional array (1,prof_num_rows) of elevations
last = 0; float last = 0.0;
for ( i = 0; i < prof_num_rows; i++ ) { for ( i = 0; i < prof_num_rows; i++ ) {
prof_data = next_int(); prof_data = (float)next_int();
if ( z_units == 1 ) {
// convert to meters
prof_data *= SG_FEET_TO_METER;
}
// a bit of sanity checking that is unfortunately necessary // a bit of sanity checking that is unfortunately necessary
if ( prof_data > 10000 ) { // meters if ( prof_data > 10000 ) { // meters

View file

@ -73,12 +73,13 @@ private:
int prof_col, prof_row; int prof_col, prof_row;
int prof_num_cols, prof_num_rows; int prof_num_cols, prof_num_rows;
double prof_x1, prof_y1; double prof_x1, prof_y1;
int prof_data; float prof_data;
// temporary values for the class to use // temporary values for the class to use
char option_name[32]; char option_name[32];
int do_data; int do_data;
int cur_col, cur_row; int cur_col, cur_row;
int z_units; // 1 = feet, 2 = meters
// return next token from input stream // return next token from input stream
string next_token(); string next_token();