From: curt Date: Wed, 8 Apr 1998 23:05:54 +0000 (+0000) Subject: Adopted Gnu automake/autoconf system. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=104ea85dfe7844e95c16db05a64cbc19427cdbaa;p=flightgear.git Adopted Gnu automake/autoconf system. --- diff --git a/FixNode/Makefile b/FixNode/Makefile deleted file mode 100644 index d5a138928..000000000 --- a/FixNode/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -#--------------------------------------------------------------------------- -# Makefile -# -# Written by Curtis Olson, started October 1997. -# -# Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id$ -# (Log is kept at end of this file) -#--------------------------------------------------------------------------- - - -TARGET = fixnode - -CFILES = fixnode.c main.c triload.c -LDLIBS = -lDEM -lScenery -lm - - -include $(FG_ROOT_SRC)/commondefs - - -#--------------------------------------------------------------------------- -# Rule for TARGET -#--------------------------------------------------------------------------- - -$(TARGET): $(OBJECTS) $(FG_ROOT_LIB)/stamp_libs - $(CC) -o $(TARGET) $(OBJECTS) $(LDFLAGS) $(LDLIBS) - - -include $(COMMONRULES) - - -#--------------------------------------------------------------------------- -# $Log$ -# Revision 1.4 1998/04/06 21:09:44 curt -# Additional win32 support. -# Fixed a bad bug in dem file parsing that was causing the output to be -# flipped about x = y. -# -# Revision 1.3 1998/03/19 02:50:19 curt -# Updated to support -lDEM class. -# -# Revision 1.2 1998/01/21 02:55:50 curt -# Incorporated new make system from Bob Kuehne . -# -# Revision 1.1 1997/11/27 00:17:32 curt -# Initial revision. -# diff --git a/FixNode/Makefile.am b/FixNode/Makefile.am new file mode 100644 index 000000000..4445f8400 --- /dev/null +++ b/FixNode/Makefile.am @@ -0,0 +1,59 @@ +#--------------------------------------------------------------------------- +# Makefile +# +# Written by Curtis Olson, started October 1997. +# +# Copyright (C) 1997 - 1998 Curtis L. Olson - curt@me.umn.edu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id$ +# (Log is kept at end of this file) +#--------------------------------------------------------------------------- + + +bin_PROGRAMS = fixnode + +fixnode_SOURCES = \ + fixnode.cxx fixnode.hxx \ + main.cxx \ + triload.cxx triload.hxx + +fixnode_LDADD = \ + $(top_builddir)/Tools/DEM/libDEM.la \ + $(top_builddir)/Simulator/Scenery/Bucket/libBucket.la + +INCLUDES += -I.. -I../../Simulator + + +#--------------------------------------------------------------------------- +# $Log$ +# Revision 1.1 1998/04/08 23:05:54 curt +# Adopted Gnu automake/autoconf system. +# +# Revision 1.4 1998/04/06 21:09:44 curt +# Additional win32 support. +# Fixed a bad bug in dem file parsing that was causing the output to be +# flipped about x = y. +# +# Revision 1.3 1998/03/19 02:50:19 curt +# Updated to support -lDEM class. +# +# Revision 1.2 1998/01/21 02:55:50 curt +# Incorporated new make system from Bob Kuehne . +# +# Revision 1.1 1997/11/27 00:17:32 curt +# Initial revision. +# diff --git a/FixNode/Makefile.in b/FixNode/Makefile.in new file mode 100644 index 000000000..091d3835a --- /dev/null +++ b/FixNode/Makefile.in @@ -0,0 +1,388 @@ +# Makefile.in generated automatically by automake 1.2h from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +#--------------------------------------------------------------------------- +# Makefile +# +# Written by Curtis Olson, started October 1997. +# +# Copyright (C) 1997 - 1998 Curtis L. Olson - curt@me.umn.edu +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# $Id$ +# (Log is kept at end of this file) +#--------------------------------------------------------------------------- + + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DISTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +CC = @CC@ +CXX = @CXX@ +LD = @LD@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +NM = @NM@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ + +bin_PROGRAMS = fixnode + +fixnode_SOURCES = \ + fixnode.cxx fixnode.hxx \ + main.cxx \ + triload.cxx triload.hxx + +fixnode_LDADD = \ + $(top_builddir)/Tools/DEM/libDEM.la \ + $(top_builddir)/Simulator/Scenery/Bucket/libBucket.la +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../Simulator/Include/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(bin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I../../Simulator/Include +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_LIBS = @X_LIBS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +fixnode_OBJECTS = fixnode.o main.o triload.o +fixnode_DEPENDENCIES = $(top_builddir)/Tools/DEM/libDEM.la \ +$(top_builddir)/Simulator/Scenery/Bucket/libBucket.la +fixnode_LDFLAGS = +CXXFLAGS = @CXXFLAGS@ +CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) +CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +DEP_FILES = .deps/fixnode.P .deps/main.P .deps/triload.P +CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) +SOURCES = $(fixnode_SOURCES) +OBJECTS = $(fixnode_OBJECTS) + +all: Makefile $(PROGRAMS) + +.SUFFIXES: +.SUFFIXES: .S .c .cxx .lo .o .s +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu Tools/FixNode/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-binPROGRAMS: + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + +distclean-binPROGRAMS: + +maintainer-clean-binPROGRAMS: + +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(bin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +fixnode: $(fixnode_OBJECTS) $(fixnode_DEPENDENCIES) + @rm -f fixnode + $(CXXLINK) $(fixnode_LDFLAGS) $(fixnode_OBJECTS) $(fixnode_LDADD) $(LIBS) +.cxx.o: + $(CXXCOMPILE) -c $< +.cxx.lo: + $(LTCXXCOMPILE) -c $< + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = Tools/FixNode + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Tools/FixNode/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + +maintainer-clean-depend: + -rm -rf .deps + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).P -c $< + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< + @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ + < .deps/$(*F).p > .deps/$(*F).P + @-rm -f .deps/$(*F).p + +%.o: %.cxx + @echo '$(CXXCOMPILE) -c $<'; \ + $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $< + +%.lo: %.cxx + @echo '$(LTCXXCOMPILE) -c $<'; \ + $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $< + @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \ + < .deps/$(*F).p > .deps/$(*F).P + @-rm -f .deps/$(*F).p +info: +dvi: +check: all + $(MAKE) +installcheck: +install-exec: install-binPROGRAMS + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: uninstall-binPROGRAMS + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + $(mkinstalldirs) $(DATADIR)$(bindir) + + +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +clean: clean-binPROGRAMS clean-compile clean-libtool clean-tags \ + clean-depend clean-generic mostlyclean + +distclean: distclean-binPROGRAMS distclean-compile distclean-libtool \ + distclean-tags distclean-depend distclean-generic clean + -rm -f config.status + -rm -f libtool + +maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \ + maintainer-clean-libtool maintainer-clean-tags \ + maintainer-clean-depend maintainer-clean-generic \ + distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info dvi installcheck install-exec install-data \ +install uninstall all installdirs mostlyclean-generic distclean-generic \ +clean-generic maintainer-clean-generic clean mostlyclean distclean \ +maintainer-clean + + +INCLUDES += -I.. -I../../Simulator + +#--------------------------------------------------------------------------- +# $Log$ +# Revision 1.1 1998/04/08 23:05:55 curt +# Adopted Gnu automake/autoconf system. +# +# Revision 1.4 1998/04/06 21:09:44 curt +# Additional win32 support. +# Fixed a bad bug in dem file parsing that was causing the output to be +# flipped about x = y. +# +# Revision 1.3 1998/03/19 02:50:19 curt +# Updated to support -lDEM class. +# +# Revision 1.2 1998/01/21 02:55:50 curt +# Incorporated new make system from Bob Kuehne . +# +# Revision 1.1 1997/11/27 00:17:32 curt +# Initial revision. +# + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/FixNode/fixnode.c b/FixNode/fixnode.c deleted file mode 100644 index 5276348d0..000000000 --- a/FixNode/fixnode.c +++ /dev/null @@ -1,98 +0,0 @@ -/* fixnode.c -- traverse the node file and fix the elevation of all the new - * interpolated points. - * - * Written by Curtis Olson, started November 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - */ - - -#include -#include -#include - -#include "fixnode.h" -#include "triload.h" - - -/* load the node information */ -void fixnodes( char *filename, fgDEM dem, - float dem_data[DEM_SIZE_1][DEM_SIZE_1], - double nodes[MAX_NODES][3] ) -{ - char toname[256]; - FILE *fd; - int i; - - printf("Fixing up node elevations\n"); - - /* we could just fix the new nodes as the first "for" statement - * would do, but that leads to funny results (I need to figure out - * why.) So, let's try fixing all of them */ - - /* for ( i = origcount + 1; i <= nodecount; i++ ) { */ - for ( i = 1; i <= nodecount; i++ ) { - /* printf("Current: %d %.2f %.2f %.2f\n", i, nodes[i][0], - nodes[i][1], nodes[i][2]); */ - - nodes[i][2] = - dem.interpolate_altitude(dem_data, nodes[i][0], nodes[i][1]); - - /* printf("Fixed: %d %.2f %.2f %.2f\n", i, nodes[i][0], - nodes[i][1], nodes[i][2]); */ - } - - - sprintf(toname, "%s.orig", filename); - printf("Moving %s to %s\n", filename, toname); - rename(filename, toname); - - printf("Saving new node file: %s\n", filename); - - fd = fopen(filename, "w"); - - fprintf(fd, "%d 2 1 0\n", nodecount); - - for ( i = 1; i <= nodecount; i++ ) { - fprintf(fd, "%d %.2f %.2f %.2f 0\n", i, nodes[i][0], - nodes[i][1], nodes[i][2]); - } - - fclose(fd); -} - - -/* $Log$ -/* Revision 1.5 1998/03/19 02:50:19 curt -/* Updated to support -lDEM class. -/* - * Revision 1.4 1998/03/03 16:00:57 curt - * More c++ compile tweaks. - * - * Revision 1.3 1998/01/09 23:03:08 curt - * Restructured to split 1deg x 1deg dem's into 64 subsections. - * - * Revision 1.2 1997/12/02 13:12:07 curt - * Updated to fix every node. - * - * Revision 1.1 1997/11/27 00:17:33 curt - * Initial revision. - * - */ diff --git a/FixNode/fixnode.cxx b/FixNode/fixnode.cxx new file mode 100644 index 000000000..8acf685a7 --- /dev/null +++ b/FixNode/fixnode.cxx @@ -0,0 +1,101 @@ +/* fixnode.c -- traverse the node file and fix the elevation of all the new + * interpolated points. + * + * Written by Curtis Olson, started November 1997. + * + * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * $Id$ + * (Log is kept at end of this file) + */ + + +#include +#include +#include + +#include "fixnode.hxx" +#include "triload.hxx" + + +/* load the node information */ +void fixnodes( char *filename, fgDEM dem, + float dem_data[DEM_SIZE_1][DEM_SIZE_1], + double nodes[MAX_NODES][3] ) +{ + char toname[256]; + FILE *fd; + int i; + + printf("Fixing up node elevations\n"); + + /* we could just fix the new nodes as the first "for" statement + * would do, but that leads to funny results (I need to figure out + * why.) So, let's try fixing all of them */ + + /* for ( i = origcount + 1; i <= nodecount; i++ ) { */ + for ( i = 1; i <= nodecount; i++ ) { + /* printf("Current: %d %.2f %.2f %.2f\n", i, nodes[i][0], + nodes[i][1], nodes[i][2]); */ + + nodes[i][2] = + dem.interpolate_altitude(dem_data, nodes[i][0], nodes[i][1]); + + /* printf("Fixed: %d %.2f %.2f %.2f\n", i, nodes[i][0], + nodes[i][1], nodes[i][2]); */ + } + + + sprintf(toname, "%s.orig", filename); + printf("Moving %s to %s\n", filename, toname); + rename(filename, toname); + + printf("Saving new node file: %s\n", filename); + + fd = fopen(filename, "w"); + + fprintf(fd, "%d 2 1 0\n", nodecount); + + for ( i = 1; i <= nodecount; i++ ) { + fprintf(fd, "%d %.2f %.2f %.2f 0\n", i, nodes[i][0], + nodes[i][1], nodes[i][2]); + } + + fclose(fd); +} + + +/* $Log$ +/* Revision 1.1 1998/04/08 23:05:56 curt +/* Adopted Gnu automake/autoconf system. +/* + * Revision 1.5 1998/03/19 02:50:19 curt + * Updated to support -lDEM class. + * + * Revision 1.4 1998/03/03 16:00:57 curt + * More c++ compile tweaks. + * + * Revision 1.3 1998/01/09 23:03:08 curt + * Restructured to split 1deg x 1deg dem's into 64 subsections. + * + * Revision 1.2 1997/12/02 13:12:07 curt + * Updated to fix every node. + * + * Revision 1.1 1997/11/27 00:17:33 curt + * Initial revision. + * + */ diff --git a/FixNode/fixnode.h b/FixNode/fixnode.h deleted file mode 100644 index ec83d7b7d..000000000 --- a/FixNode/fixnode.h +++ /dev/null @@ -1,59 +0,0 @@ -// fixnode.h -- traverse the node file and fix the elevation of all the new -// interpolated points. -// -// Written by Curtis Olson, started November 1997. -// -// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -// $Id$ -// (Log is kept at end of this file) -// - - -#ifndef _FIXNODE_H -#define _FIXNODE_H - - -#include -#include - -#include "triload.h" -#include "../DEM/dem.h" - - -// load the node information -void fixnodes( char *basename, fgDEM dem, - float dem_data[DEM_SIZE_1][DEM_SIZE_1], - double nodes[MAX_NODES][3] ); - - -#endif // _FIXNODE_H - - -// $Log$ -// Revision 1.4 1998/03/19 02:50:19 curt -// Updated to support -lDEM class. -// -// Revision 1.3 1998/03/03 16:00:58 curt -// More c++ compile tweaks. -// -// Revision 1.2 1997/12/02 13:12:07 curt -// Updated to fix every node. -// -// Revision 1.1 1997/11/27 00:17:33 curt -// Initial revision. -// diff --git a/FixNode/fixnode.hxx b/FixNode/fixnode.hxx new file mode 100644 index 000000000..370e136a5 --- /dev/null +++ b/FixNode/fixnode.hxx @@ -0,0 +1,63 @@ +// fixnode.h -- traverse the node file and fix the elevation of all the new +// interpolated points. +// +// Written by Curtis Olson, started November 1997. +// +// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ +// (Log is kept at end of this file) +// + + +#ifndef _FIXNODE_H +#define _FIXNODE_H + + +#include +#include + +#include + +#include "triload.hxx" + + +// load the node information +void fixnodes( char *basename, fgDEM dem, + float dem_data[DEM_SIZE_1][DEM_SIZE_1], + double nodes[MAX_NODES][3] ); + + +#endif // _FIXNODE_H + + +// $Log$ +// Revision 1.1 1998/04/08 23:05:56 curt +// Adopted Gnu automake/autoconf system. +// +// Revision 1.4 1998/03/19 02:50:19 curt +// Updated to support -lDEM class. +// +// Revision 1.3 1998/03/03 16:00:58 curt +// More c++ compile tweaks. +// +// Revision 1.2 1997/12/02 13:12:07 curt +// Updated to fix every node. +// +// Revision 1.1 1997/11/27 00:17:33 curt +// Initial revision. +// diff --git a/FixNode/main.c b/FixNode/main.c deleted file mode 100644 index b43c1d174..000000000 --- a/FixNode/main.c +++ /dev/null @@ -1,126 +0,0 @@ -// main.c -- read in a .node file and fix the z values of the interpolated -// points -// -// Written by Curtis Olson, started November 1997. -// -// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -// $Id$ -// (Log is kept at end of this file) -// - - -#include -#include -#include -#include - -#include "../DEM/dem.h" -#include "fixnode.h" -#include "triload.h" - - -// Storage for the original DEM data which is used to interpolate z values -static fgDEM dem; -static float dem_data[DEM_SIZE_1][DEM_SIZE_1]; - -// Node list -static double nodes[MAX_NODES][3]; - - -// find all the matching files in the specified directory and fix them -void process_files(char *root_path) { - DIR *d; - struct dirent *de; - char file_path[256]; - char *ptr; - int len; - - if ( (d = opendir(root_path)) == NULL ) { - printf("cannot open directory '%s'.", root_path); - exit(-1); - } - - while ( (de = readdir(d)) != NULL ) { - len = strlen(de->d_name); - if ( len > 7 ) { - ptr = de->d_name; - ptr += (len - 7); - // printf("--> %s \n", ptr); - - if ( strcmp(ptr, ".1.node") == 0 ) { - strcpy(file_path, root_path); - strcat(file_path, "/"); - strcat(file_path, de->d_name); - printf("File = %s\n", file_path); - - // load the input data files - triload(file_path, nodes); - - fixnodes(file_path, dem, dem_data, nodes); - } - } - } -} - - -// main -int main(int argc, char **argv) { - char demfile[256], root_path[256]; - - if ( argc != 3 ) { - printf("Usage %s demfile root_path\n", argv[0]); - exit(-1); - } - - strcpy(demfile, argv[1]); - strcpy(root_path, argv[2]); - - // load the corresponding dem file so we can interpolate elev values - dem.open(demfile); - dem.parse(dem_data); - dem.close(); - - // process all the *.1.node files in the specified directory - process_files(root_path); - - return(0); -} - - -// $Log$ -// Revision 1.6 1998/04/06 21:09:44 curt -// Additional win32 support. -// Fixed a bad bug in dem file parsing that was causing the output to be -// flipped about x = y. -// -// Revision 1.5 1998/03/19 02:50:20 curt -// Updated to support -lDEM class. -// -// Revision 1.4 1998/03/03 16:00:58 curt -// More c++ compile tweaks. -// -// Revision 1.3 1998/01/09 23:03:08 curt -// Restructured to split 1deg x 1deg dem's into 64 subsections. -// -// Revision 1.2 1997/12/02 13:12:07 curt -// Updated to fix every node. -// -// Revision 1.1 1997/11/27 00:17:34 curt -// Initial revision. -// -// diff --git a/FixNode/main.cxx b/FixNode/main.cxx new file mode 100644 index 000000000..840ee23ae --- /dev/null +++ b/FixNode/main.cxx @@ -0,0 +1,130 @@ +// main.c -- read in a .node file and fix the z values of the interpolated +// points +// +// Written by Curtis Olson, started November 1997. +// +// Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ +// (Log is kept at end of this file) +// + + +#include +#include +#include +#include + +#include + +#include "fixnode.hxx" +#include "triload.hxx" + + +// Storage for the original DEM data which is used to interpolate z values +static fgDEM dem; +static float dem_data[DEM_SIZE_1][DEM_SIZE_1]; + +// Node list +static double nodes[MAX_NODES][3]; + + +// find all the matching files in the specified directory and fix them +void process_files(char *root_path) { + DIR *d; + struct dirent *de; + char file_path[256]; + char *ptr; + int len; + + if ( (d = opendir(root_path)) == NULL ) { + printf("cannot open directory '%s'.", root_path); + exit(-1); + } + + while ( (de = readdir(d)) != NULL ) { + len = strlen(de->d_name); + if ( len > 7 ) { + ptr = de->d_name; + ptr += (len - 7); + // printf("--> %s \n", ptr); + + if ( strcmp(ptr, ".1.node") == 0 ) { + strcpy(file_path, root_path); + strcat(file_path, "/"); + strcat(file_path, de->d_name); + printf("File = %s\n", file_path); + + // load the input data files + triload(file_path, nodes); + + fixnodes(file_path, dem, dem_data, nodes); + } + } + } +} + + +// main +int main(int argc, char **argv) { + char demfile[256], root_path[256]; + + if ( argc != 3 ) { + printf("Usage %s demfile root_path\n", argv[0]); + exit(-1); + } + + strcpy(demfile, argv[1]); + strcpy(root_path, argv[2]); + + // load the corresponding dem file so we can interpolate elev values + dem.open(demfile); + dem.parse(dem_data); + dem.close(); + + // process all the *.1.node files in the specified directory + process_files(root_path); + + return(0); +} + + +// $Log$ +// Revision 1.1 1998/04/08 23:05:57 curt +// Adopted Gnu automake/autoconf system. +// +// Revision 1.6 1998/04/06 21:09:44 curt +// Additional win32 support. +// Fixed a bad bug in dem file parsing that was causing the output to be +// flipped about x = y. +// +// Revision 1.5 1998/03/19 02:50:20 curt +// Updated to support -lDEM class. +// +// Revision 1.4 1998/03/03 16:00:58 curt +// More c++ compile tweaks. +// +// Revision 1.3 1998/01/09 23:03:08 curt +// Restructured to split 1deg x 1deg dem's into 64 subsections. +// +// Revision 1.2 1997/12/02 13:12:07 curt +// Updated to fix every node. +// +// Revision 1.1 1997/11/27 00:17:34 curt +// Initial revision. +// +// diff --git a/FixNode/triload.c b/FixNode/triload.c deleted file mode 100644 index 72d9427f9..000000000 --- a/FixNode/triload.c +++ /dev/null @@ -1,78 +0,0 @@ -/* triload.c -- read in a .node file and fix the z values of the interpolated - * points - * - * Written by Curtis Olson, started November 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - */ - - -#include -#include - -#include "triload.h" - - -int nodecount; - - -/* load the node information */ -void triload(char *filename, double nodes[MAX_NODES][3]) { - FILE *node; - int dim, junk1, junk2; - int i; - - printf("Loading node file: %s ...\n", filename); - if ( (node = fopen(filename, "r")) == NULL ) { - printf("Cannot open file '%s'\n", filename); - exit(-1); - } - - fscanf(node, "%d %d %d %d", &nodecount, &dim, &junk1, &junk2); - - if ( nodecount > MAX_NODES - 1 ) { - printf("Error, too many nodes, need to increase array size\n"); - exit(-1); - } else { - printf(" Expecting %d nodes\n", nodecount); - } - - for ( i = 1; i <= nodecount; i++ ) { - fscanf(node, "%d %lf %lf %lf %d\n", &junk1, - &nodes[i][0], &nodes[i][1], &nodes[i][2], &junk2); - /* printf("%d %.2f %.2f %.2f\n", junk1, nodes[i][0], nodes[i][1], - nodes[i][2]); */ - } - - fclose(node); -} - - -/* $Log$ -/* Revision 1.3 1998/03/03 16:00:59 curt -/* More c++ compile tweaks. -/* - * Revision 1.2 1998/01/09 23:03:09 curt - * Restructured to split 1deg x 1deg dem's into 64 subsections. - * - * Revision 1.1 1997/11/27 00:17:35 curt - * Initial revision. - * - */ diff --git a/FixNode/triload.cxx b/FixNode/triload.cxx new file mode 100644 index 000000000..3986780ac --- /dev/null +++ b/FixNode/triload.cxx @@ -0,0 +1,79 @@ +// triload.cxx -- read in a .node file and fix the z values of the +// interpolated points +// +// Written by Curtis Olson, started November 1997. +// +// Copyright (C) 1997 - 1998 Curtis L. Olson - curt@me.umn.edu +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ +// (Log is kept at end of this file) + + +#include +#include + +#include "triload.hxx" + + +int nodecount; + + +// load the node information +void triload(char *filename, double nodes[MAX_NODES][3]) { + FILE *node; + int dim, junk1, junk2; + int i; + + printf("Loading node file: %s ...\n", filename); + if ( (node = fopen(filename, "r")) == NULL ) { + printf("Cannot open file '%s'\n", filename); + exit(-1); + } + + fscanf(node, "%d %d %d %d", &nodecount, &dim, &junk1, &junk2); + + if ( nodecount > MAX_NODES - 1 ) { + printf("Error, too many nodes, need to increase array size\n"); + exit(-1); + } else { + printf(" Expecting %d nodes\n", nodecount); + } + + for ( i = 1; i <= nodecount; i++ ) { + fscanf(node, "%d %lf %lf %lf %d\n", &junk1, + &nodes[i][0], &nodes[i][1], &nodes[i][2], &junk2); + // printf("%d %.2f %.2f %.2f\n", junk1, nodes[i][0], nodes[i][1], + // nodes[i][2]); + } + + fclose(node); +} + + +// $Log$ +// Revision 1.1 1998/04/08 23:05:58 curt +// Adopted Gnu automake/autoconf system. +// +// Revision 1.3 1998/03/03 16:00:59 curt +// More c++ compile tweaks. +// +// Revision 1.2 1998/01/09 23:03:09 curt +// Restructured to split 1deg x 1deg dem's into 64 subsections. +// +// Revision 1.1 1997/11/27 00:17:35 curt +// Initial revision. +// diff --git a/FixNode/triload.h b/FixNode/triload.h deleted file mode 100644 index c145e11cf..000000000 --- a/FixNode/triload.h +++ /dev/null @@ -1,62 +0,0 @@ -/* triload.h -- read in a .node file and fix the z values of the interpolated - * points - * - * Written by Curtis Olson, started November 1997. - * - * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id$ - * (Log is kept at end of this file) - */ - - -#ifndef _TRILOAD_H -#define _TRILOAD_H - - -#include -#include - - -#define MAX_NODES 200000 -#define MAX_TRIS 400000 - - -extern int nodecount, tricount; - - -/* Initialize a new mesh structure */ -void triload(char *basename, double nodes[MAX_NODES][3]); - - -#endif // _TRILOAD_H - - -/* $Log$ -/* Revision 1.4 1998/03/19 02:50:20 curt -/* Updated to support -lDEM class. -/* - * Revision 1.3 1998/03/03 16:00:59 curt - * More c++ compile tweaks. - * - * Revision 1.2 1998/01/09 23:03:09 curt - * Restructured to split 1deg x 1deg dem's into 64 subsections. - * - * Revision 1.1 1997/11/27 00:17:35 curt - * Initial revision. - * - */ diff --git a/FixNode/triload.hxx b/FixNode/triload.hxx new file mode 100644 index 000000000..de40c1b31 --- /dev/null +++ b/FixNode/triload.hxx @@ -0,0 +1,63 @@ +// triload.hxx -- read in a .node file and fix the z values of the +// interpolated points +// +// Written by Curtis Olson, started November 1997. +// +// Copyright (C) 1997 - 1998 Curtis L. Olson - curt@me.umn.edu +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// +// $Id$ +// (Log is kept at end of this file) + + +#ifndef _TRILOAD_H +#define _TRILOAD_H + + +#include +#include + + +#define MAX_NODES 200000 +#define MAX_TRIS 400000 + + +extern int nodecount, tricount; + + +// Initialize a new mesh structure +void triload(char *basename, double nodes[MAX_NODES][3]); + + +#endif // _TRILOAD_H + + +// $Log$ +// Revision 1.1 1998/04/08 23:06:00 curt +// Adopted Gnu automake/autoconf system. +// +// Revision 1.4 1998/03/19 02:50:20 curt +// Updated to support -lDEM class. +// +// Revision 1.3 1998/03/03 16:00:59 curt +// More c++ compile tweaks. +// +// Revision 1.2 1998/01/09 23:03:09 curt +// Restructured to split 1deg x 1deg dem's into 64 subsections. +// +// Revision 1.1 1997/11/27 00:17:35 curt +// Initial revision. +//