1 /* triload.c -- read in a .node file and fix the z values of the interpolated
4 * Written by Curtis Olson, started November 1997.
6 * Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * (Log is kept at end of this file)
30 #include <sys/types.h>
32 #include "../Dem2node/demparse.h"
37 /* Original DEM which is used to interpolate z values */
41 /* find all the matching files in the specified directory and fix them */
42 void process_files(char *root_path) {
49 if ( (d = opendir(root_path)) == NULL ) {
50 printf("cannot open directory '%s'.", root_path);
54 while ( (de = readdir(d)) != NULL ) {
55 len = strlen(de->d_name);
59 /* printf("--> %s \n", ptr); */
61 if ( strcmp(ptr, ".1.node") == 0 ) {
62 strcpy(file_path, root_path);
63 strcat(file_path, "/");
64 strcat(file_path, de->d_name);
65 printf("File = %s\n", file_path);
67 /* load the input data files */
70 fixnodes(file_path, &dem_mesh);
78 int main(int argc, char **argv) {
79 char demfile[256], root_path[256];
82 printf("Usage %s demfile root_path\n", argv[0]);
86 strcpy(demfile, argv[1]);
87 strcpy(root_path, argv[2]);
89 /* load the corresponding dem file so we can interpolate elev values */
90 dem_parse(demfile, &dem_mesh);
92 /* process all the *.1.node files in the specified directory */
93 process_files(root_path);
100 /* Revision 1.3 1998/01/09 23:03:08 curt
101 /* Restructured to split 1deg x 1deg dem's into 64 subsections.
103 * Revision 1.2 1997/12/02 13:12:07 curt
104 * Updated to fix every node.
106 * Revision 1.1 1997/11/27 00:17:34 curt