[GRASS-SVN] r71063 - grass/trunk/imagery/i.ortho.photo/lib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 8 10:30:06 PDT 2017


Author: ychemin
Date: 2017-05-08 10:30:06 -0700 (Mon, 08 May 2017)
New Revision: 71063

Modified:
   grass/trunk/imagery/i.ortho.photo/lib/orthophoto.h
   grass/trunk/imagery/i.ortho.photo/lib/ref_points.c
Log:
modifying to support i.ortho.transform requirements

Modified: grass/trunk/imagery/i.ortho.photo/lib/orthophoto.h
===================================================================
--- grass/trunk/imagery/i.ortho.photo/lib/orthophoto.h	2017-05-08 11:24:52 UTC (rev 71062)
+++ grass/trunk/imagery/i.ortho.photo/lib/orthophoto.h	2017-05-08 17:30:06 UTC (rev 71063)
@@ -143,7 +143,7 @@
 			double, MATRIX);
 /* ref_points.c */
 int I_new_ref_point(struct Ortho_Photo_Points *, double, double, double,
-		    double, int);
+		    double, double, double, int);
 int I_get_ref_points(char *, struct Ortho_Photo_Points *);
 int I_put_ref_points(char *, struct Ortho_Photo_Points *);
 

Modified: grass/trunk/imagery/i.ortho.photo/lib/ref_points.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/lib/ref_points.c	2017-05-08 11:24:52 UTC (rev 71062)
+++ grass/trunk/imagery/i.ortho.photo/lib/ref_points.c	2017-05-08 17:30:06 UTC (rev 71063)
@@ -11,7 +11,7 @@
 int I_read_ref_points(FILE * fd, struct Ortho_Photo_Points *cp)
 {
     char buf[100];
-    double e1, e2, n1, n2;
+    double e1, e2, n1, n2, z1, z2;
     int status;
 
     cp->count = 0;
@@ -23,6 +23,8 @@
     cp->e2 = NULL;
     cp->n1 = NULL;
     cp->n2 = NULL;
+    cp->z1 = NULL;
+    cp->z2 = NULL;
     cp->status = NULL;
 
     /*fprintf (stderr, "Try to read one point \n"); */
@@ -30,8 +32,8 @@
 	G_strip(buf);
 	if (*buf == '#' || *buf == 0)
 	    continue;
-	if (sscanf(buf, "%lf%lf%lf%lf%d", &e1, &n1, &e2, &n2, &status) == 5)
-	    I_new_ref_point(cp, e1, n1, e2, n2, status);
+	if (sscanf(buf, "%lf%lf%lf%lf%lf%lf%d", &e1, &n1, &z1, &e2, &n2, &z2, &status) == 7)
+	    I_new_ref_point(cp, e1, n1, z1, e2, n2, z2, status);
 	else
 	    return -4;
     }
@@ -40,8 +42,8 @@
 }
 
 int
-I_new_ref_point(struct Ortho_Photo_Points *cp, double e1, double n1,
-		double e2, double n2, int status)
+I_new_ref_point(struct Ortho_Photo_Points *cp, double e1, double n1, double z1,
+		double e2, double n2, double z2, int status)
 {
     int i;
     size_t size;
@@ -55,6 +57,8 @@
     cp->e2 = (double *)G_realloc(cp->e2, size);
     cp->n1 = (double *)G_realloc(cp->n1, size);
     cp->n2 = (double *)G_realloc(cp->n2, size);
+    cp->z1 = (double *)G_realloc(cp->z1, size);
+    cp->z2 = (double *)G_realloc(cp->z2, size);
     size = cp->count * sizeof(int);
     cp->status = (int *)G_realloc(cp->status, size);
 
@@ -62,6 +66,8 @@
     cp->e2[i] = e2;
     cp->n1[i] = n1;
     cp->n2[i] = n2;
+    cp->z1[i] = z1;
+    cp->z2[i] = z2;
     cp->status[i] = status;
 
     return 0;
@@ -73,13 +79,14 @@
 
     fprintf(fd, "# %7s %15s %15s %15s %9s status\n", "", "image", "", "photo",
 	    "");
-    fprintf(fd, "# %15s %15s %15s %15s   (1=ok)\n", "east", "north", "x",
-	    "y");
+    fprintf(fd, "# %15s %15s %15s %15s %15s %15s   (1=ok)\n", "east", "north", "height",
+            "x", "y", "z");
     fprintf(fd, "#\n");
     for (i = 0; i < cp->count; i++)
 	if (cp->status[i] >= 0)
-	    fprintf(fd, "  %15f %15f %15f %15f %d\n",
-		    cp->e1[i], cp->n1[i], cp->e2[i], cp->n2[i],
+	    fprintf(fd, "  %15f %15f %15f %15f %15f %15f %d\n",
+		    cp->e1[i], cp->n1[i], cp->z1[i], 
+		    cp->e2[i], cp->n2[i], cp->z2[i], 
 		    cp->status[i]);
 
     return 0;



More information about the grass-commit mailing list