]> git.mxchange.org Git - flightgear.git/commitdiff
Updated to support -lDEM class.
authorcurt <curt>
Thu, 19 Mar 1998 02:50:19 +0000 (02:50 +0000)
committercurt <curt>
Thu, 19 Mar 1998 02:50:19 +0000 (02:50 +0000)
FixNode/Makefile
FixNode/fixnode.c
FixNode/fixnode.h
FixNode/main.c
FixNode/triload.h

index 80e346cd38e84c94a36d20324e884649a74c9019..b259c623d1d282689ebf0ab169a625995de0514a 100644 (file)
@@ -27,7 +27,7 @@
 TARGET = fixnode
 
 CFILES = fixnode.c main.c triload.c
-LDLIBS = ../Dem2node/demparse.o ../Dem2node/mesh.o -lm
+LDLIBS = -lDEM -lScenery -lm
 
 
 include $(FG_ROOT_SRC)/commondefs
@@ -46,6 +46,9 @@ include $(COMMONRULES)
 
 #---------------------------------------------------------------------------
 # $Log$
+# 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 <rpk@sgi.com>.
 #
index afd7070828095ab1f0baa619ad46bbe974ef8b0b..5276348d04fce6d98c01922737b3fe41b8a5ed6c 100644 (file)
 #include <unistd.h>
 
 #include "fixnode.h"
-#include "../Dem2node/mesh.h"
 #include "triload.h"
 
 
 /* load the node information */
-void fixnodes(char *filename, struct MESH *m, double nodes[MAX_NODES][3]) {
+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;
@@ -50,7 +52,8 @@ void fixnodes(char *filename, struct MESH *m, double nodes[MAX_NODES][3]) {
        /* printf("Current: %d %.2f %.2f %.2f\n", i, nodes[i][0],
               nodes[i][1], nodes[i][2]); */
 
-       nodes[i][2] = mesh_altitude(m, nodes[i][0], nodes[i][1]);
+       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]); */
@@ -77,9 +80,12 @@ void fixnodes(char *filename, struct MESH *m, double nodes[MAX_NODES][3]) {
 
 
 /* $Log$
-/* Revision 1.4  1998/03/03 16:00:57  curt
-/* More c++ compile tweaks.
+/* 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.
  *
index ee6501ac38f380ff915f932767f927aa11365feb..ec83d7b7d4abf318f2549908c04a3b206dd73c62 100644 (file)
@@ -1,55 +1,59 @@
-/* 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
+// 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 <stdio.h>
 #include <string.h>
 
 #include "triload.h"
-#include "../Dem2node/mesh.h"
+#include "../DEM/dem.h"
 
 
-/* load the node information */
-void fixnodes(char *basename, struct MESH *m, double nodes[MAX_NODES][3]);
+// 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 */
+#endif // _FIXNODE_H
 
 
-/* $Log$
-/* 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.
- *
- */
+// $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.
+//
index c2caca7e14ee79b21846e1510225773019714e12..e903df6137f51e9cc9c609a235c94804ba9d7c63 100644 (file)
@@ -1,27 +1,27 @@
-/* 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)
- */
+// 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 <dirent.h>
 #include <string.h>
 #include <sys/types.h>
 
-#include "../Dem2node/demparse.h"
+#include "../DEM/dem.h"
 #include "fixnode.h"
 #include "triload.h"
 
 
-/* Original DEM which is used to interpolate z values */
-static struct MESH dem_mesh;
+// 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 */
+// Node list
 static double nodes[MAX_NODES][3];
 
-/* find all the matching files in the specified directory and fix them */
+
+// find all the matching files in the specified directory and fix them
 void process_files(char *root_path) {
     DIR *d;
     struct dirent *de;
@@ -58,7 +60,7 @@ void process_files(char *root_path) {
        if ( len > 7 ) {
            ptr = de->d_name;
            ptr += (len - 7);
-           /* printf("--> %s \n", ptr); */
+           // printf("--> %s \n", ptr);
 
            if ( strcmp(ptr, ".1.node") == 0 ) {
                strcpy(file_path, root_path);
@@ -66,17 +68,17 @@ void process_files(char *root_path) {
                strcat(file_path, de->d_name);
                printf("File = %s\n", file_path);
 
-               /* load the input data files */
+               // load the input data files
                triload(file_path, nodes);
 
-               fixnodes(file_path, &dem_mesh, nodes);
+               fixnodes(file_path, dem, dem_data, nodes);
            }
        }
     }
 }
 
 
-/* main */
+// main
 int main(int argc, char **argv) {
     char demfile[256], root_path[256];
 
@@ -88,27 +90,32 @@ int main(int argc, char **argv) {
     strcpy(demfile, argv[1]);
     strcpy(root_path, argv[2]);
 
-    /* load the corresponding dem file so we can interpolate elev values */
-    dem_parse(demfile, &dem_mesh);
+    // 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 all the *.1.node files in the specified directory
     process_files(root_path);
 
     return(0);
 }
 
 
-/* $Log$
-/* 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.
- *
- */
+// $Log$
+// 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.
+//
+//
index 8b5e32451e5b4a4c0cbfa6beb90f55ae8d7e006f..c145e11cf2693f3c2dd7f2e9c5d55b5c582eeaca 100644 (file)
@@ -24,8 +24,8 @@
  */
 
 
-#ifndef TRILOAD_H
-#define TRILOAD_H
+#ifndef _TRILOAD_H
+#define _TRILOAD_H
 
 
 #include <stdio.h>
@@ -43,13 +43,16 @@ extern int nodecount, tricount;
 void triload(char *basename, double nodes[MAX_NODES][3]);
 
 
-#endif /* TRILOAD_H */
+#endif // _TRILOAD_H
 
 
 /* $Log$
-/* Revision 1.3  1998/03/03 16:00:59  curt
-/* More c++ compile tweaks.
+/* 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.
  *