[GRASS-SVN] r74333 - grass/trunk/misc/m.nviz.script

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 1 13:29:07 PDT 2019


Author: mmetz
Date: 2019-04-01 13:29:07 -0700 (Mon, 01 Apr 2019)
New Revision: 74333

Modified:
   grass/trunk/misc/m.nviz.script/local.h
   grass/trunk/misc/m.nviz.script/main.c
Log:
m.nviz.script: fix shadowed variables and invalid escape caracters, add comments for bugs

Modified: grass/trunk/misc/m.nviz.script/local.h
===================================================================
--- grass/trunk/misc/m.nviz.script/local.h	2019-04-01 19:32:42 UTC (rev 74332)
+++ grass/trunk/misc/m.nviz.script/local.h	2019-04-01 20:29:07 UTC (rev 74333)
@@ -1,3 +1,5 @@
+/* dist is not initialized !
+ * should dist be DIST ? */
 static double dist, e = 0, n = 0;
 static double DIST, HT;
 int do_profile(double, double, double, double, const char *, int, int);

Modified: grass/trunk/misc/m.nviz.script/main.c
===================================================================
--- grass/trunk/misc/m.nviz.script/main.c	2019-04-01 19:32:42 UTC (rev 74332)
+++ grass/trunk/misc/m.nviz.script/main.c	2019-04-01 20:29:07 UTC (rev 74333)
@@ -240,6 +240,7 @@
     }
 
     /* Coords from Command Line */
+    k = 0;
     for (i = 0; parm.route->answers[i]; i += 2) {
 	/* Test for number coordinate pairs */
 	k = i;
@@ -264,7 +265,7 @@
 		do_profile(e2, e2, n2, n2, name, fd, data_type);
 	}
     }
-	/* done with coordinates */
+    /* done with coordinates */
 
 
     /* Output final part of script */
@@ -292,7 +293,7 @@
     if (parm.f->answer) {
 	/* Full render and save */
 	fprintf(fp, "\nset name %s", img_name);
-	fprintf(fp, "\nset num2 [format \"\%%04d\" $num]");
+	fprintf(fp, "\nset num2 [format \"%%04d\" $num]");
 	fprintf(fp, "\nappend name $num2 \".ppm\"");
 	fprintf(fp, "\nSendScriptLine \"Ndo_framestep $frame 1\"");
 	fprintf(fp, "\nSendScriptLine \"Nwrite_ppm $name \"");
@@ -302,7 +303,7 @@
 	/* Quick draw wire */
 	/* output full variables commented so can be easily changed */
 	fprintf(fp, "\nset name %s", img_name);
-	fprintf(fp, "\nset num2 [format \"\%%04d\" $num]");
+	fprintf(fp, "\nset num2 [format \"%%04d\" $num]");
 	fprintf(fp, "\nappend name $num2 \".ppm\"");
 	fprintf(fp,
 		"\n## To render in full set to 1 and uncomment Nwrite_ppm \"");
@@ -330,7 +331,7 @@
 
 
 /* ************************************
- * Claculate camera and eye coordinates
+ * Calculate camera and eye coordinates
  **************************************/
 int do_profile(double e1, double e2, double n1, double n2,
 	       const char *name, int fd, int data_type)
@@ -350,6 +351,7 @@
 	return 0;
     }
 
+    /* dist is not initialized ! */
     if (rows >= 0 && cols < 0) {
 	/* SE Quad or due east */
 	AZI = fabs(atan((rows / cols)));
@@ -402,6 +404,8 @@
 	read_rast(e2, n2, LEN, fd, 0, data_type);
     }
 
+    /* dist is not used ! */
+
     return 0;
 }				/* done with do_profile */
 
@@ -414,7 +418,7 @@
 int read_rast
     (double east,
      double north,
-     double dist, int fd, int out_type, RASTER_MAP_TYPE data_type)
+     double rrdist, int fd, int out_type, RASTER_MAP_TYPE data_type)
 {
     int row, col, nrows, ncols;
     struct Cell_head window;
@@ -488,7 +492,7 @@
 	/* Set Camera Position */
 	sprintf(buf2, "\nSendScriptLine \"Nmove_to_real %f %f %f\"",
 		east, north, camera_height);
-	key_time += (dist + fabs(camera_height - OLD_DEPTH)) / 10000.;
+	key_time += (rrdist + fabs(camera_height - OLD_DEPTH)) / 10000.;
     }
     else {
 



More information about the grass-commit mailing list