[GRASS-SVN] r54318 - grass/trunk/imagery/i.ortho.photo/i.ortho.rectify

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 16 15:14:49 PST 2012


Author: mmetz
Date: 2012-12-16 15:14:48 -0800 (Sun, 16 Dec 2012)
New Revision: 54318

Modified:
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/Makefile
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/angle.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear_f.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic_f.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/equ.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/exec.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/get_wind.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/main.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/nearest.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/readcell.c
   grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/rectify.c
Log:
i.ortho.rectify update

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/Makefile
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/Makefile	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/Makefile	2012-12-16 23:14:48 UTC (rev 54318)
@@ -4,10 +4,10 @@
 
 # for DEBUG3 see README!
 #EXTRA_CFLAGS = -I../libes -DDEBUG3
-EXTRA_CFLAGS = -I../libes
+EXTRA_CFLAGS = -I../lib
 
-LIBES     = $(IMAGERYLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
-DEPENDENCIES= $(IMAGERYDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
+LIBES     = $(IMAGERYLIB) $(RASTERLIB) $(GISLIB) $(IORTHOLIB) $(VASKLIB) $(CURSES) $(GMATHLIB)
+DEPENDENCIES= $(IMAGERYDEP) $(RASTERDEP) $(IORTHODEP) $(GISDEP) $(VASKDEP) $(GMATHDEP)
 
 include $(MODULE_TOPDIR)/include/Make/Module.make
 

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/angle.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/angle.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/angle.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -40,13 +40,12 @@
     /* align target window to elevation map, otherwise we get artefacts
      * like in r.slope.aspect -a */
      
-    if (G_get_cellhd(elev_name, elev_mapset, &cellhd) < 0)
-	return 0;
+    Rast_get_cellhd(elev_name, elev_mapset, &cellhd);
 
-    G_align_window(&target_window, &cellhd);
-    G_set_window(&target_window);
+    Rast_align_window(&target_window, &cellhd);
+    Rast_set_window(&target_window);
     
-    elevfd = G_open_cell_old(elev_name, elev_mapset);
+    elevfd = Rast_open_old(elev_name, elev_mapset);
     if (elevfd < 0) {
 	G_fatal_error(_("Could not open elevation raster"));
 	return 1;
@@ -55,11 +54,11 @@
     nrows = target_window.rows;
     ncols = target_window.cols;
     
-    outfd = G_open_raster_new(name, FCELL_TYPE);
-    fbuf0 = G_allocate_raster_buf(FCELL_TYPE);
-    fbuf1 = G_allocate_raster_buf(FCELL_TYPE);
-    fbuf2 = G_allocate_raster_buf(FCELL_TYPE);
-    outbuf = G_allocate_raster_buf(FCELL_TYPE);
+    outfd = Rast_open_new(name, FCELL_TYPE);
+    fbuf0 = Rast_allocate_buf(FCELL_TYPE);
+    fbuf1 = Rast_allocate_buf(FCELL_TYPE);
+    fbuf2 = Rast_allocate_buf(FCELL_TYPE);
+    outbuf = Rast_allocate_buf(FCELL_TYPE);
     
     /* give warning if location units are different from meters and zfactor=1 */
     factor = G_database_units_to_meters_factor();
@@ -67,26 +66,26 @@
 	G_warning(_("Converting units to meters, factor=%.6f"), factor);
 
     G_begin_distance_calculations();
-    north = G_row_to_northing(0.5, &target_window);
-    ns_med = G_row_to_northing(1.5, &target_window);
-    south = G_row_to_northing(2.5, &target_window);
-    east = G_col_to_easting(2.5, &target_window);
-    west = G_col_to_easting(0.5, &target_window);
+    north = Rast_row_to_northing(0.5, &target_window);
+    ns_med = Rast_row_to_northing(1.5, &target_window);
+    south = Rast_row_to_northing(2.5, &target_window);
+    east = Rast_col_to_easting(2.5, &target_window);
+    west = Rast_col_to_easting(0.5, &target_window);
     V = G_distance(east, north, east, south) * 4;
     H = G_distance(east, ns_med, west, ns_med) * 4;
     
     c_angle_min = 90;
-    G_get_raster_row(elevfd, fbuf1, 0, FCELL_TYPE);
-    G_get_raster_row(elevfd, fbuf2, 1, FCELL_TYPE);
+    Rast_get_row(elevfd, fbuf1, 0, FCELL_TYPE);
+    Rast_get_row(elevfd, fbuf2, 1, FCELL_TYPE);
 
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 	
-	G_set_null_value(outbuf, ncols, FCELL_TYPE);
+	Rast_set_null_value(outbuf, ncols, FCELL_TYPE);
 
 	/* first and last row */
 	if (row == 0 || row == nrows - 1) {
-	    G_put_raster_row(outfd, outbuf, FCELL_TYPE);
+	    Rast_put_row(outfd, outbuf, FCELL_TYPE);
 	    continue;
 	}
 	
@@ -95,38 +94,38 @@
 	fbuf1 = fbuf2;
 	fbuf2 = tmpbuf;
 	
-	G_get_raster_row(elevfd, fbuf2, row + 1, FCELL_TYPE);
+	Rast_get_row(elevfd, fbuf2, row + 1, FCELL_TYPE);
 
-	north = G_row_to_northing(row + 0.5, &target_window);
+	north = Rast_row_to_northing(row + 0.5, &target_window);
 
 	for (col = 1; col < ncols - 1; col++) {
 	    
 	    e1 = fbuf0[col - 1];
-	    if (G_is_d_null_value(&e1))
+	    if (Rast_is_d_null_value(&e1))
 		continue;
 	    e2 = fbuf0[col];
-	    if (G_is_d_null_value(&e2))
+	    if (Rast_is_d_null_value(&e2))
 		continue;
 	    e3 = fbuf0[col + 1];
-	    if (G_is_d_null_value(&e3))
+	    if (Rast_is_d_null_value(&e3))
 		continue;
 	    e4 = fbuf1[col - 1];
-	    if (G_is_d_null_value(&e4))
+	    if (Rast_is_d_null_value(&e4))
 		continue;
 	    e5 = fbuf1[col];
-	    if (G_is_d_null_value(&e5))
+	    if (Rast_is_d_null_value(&e5))
 		continue;
 	    e6 = fbuf1[col + 1];
-	    if (G_is_d_null_value(&e6))
+	    if (Rast_is_d_null_value(&e6))
 		continue;
 	    e7 = fbuf2[col - 1];
-	    if (G_is_d_null_value(&e7))
+	    if (Rast_is_d_null_value(&e7))
 		continue;
 	    e8 = fbuf2[col];
-	    if (G_is_d_null_value(&e8))
+	    if (Rast_is_d_null_value(&e8))
 		continue;
 	    e9 = fbuf2[col + 1];
-	    if (G_is_d_null_value(&e9))
+	    if (Rast_is_d_null_value(&e9))
 		continue;
 	    
 	    dx = ((e1 + e4 + e4 + e7) - (e3 + e6 + e6 + e9)) / H;
@@ -153,7 +152,7 @@
 	    }
 	    
 	    /* camera altitude angle in radians */
-	    east = G_col_to_easting(col + 0.5, &target_window);
+	    east = Rast_col_to_easting(col + 0.5, &target_window);
 	    dx = east - XC;
 	    dy = north - YC;
 	    dz = ZC - e5;
@@ -175,43 +174,43 @@
 	    if (c_angle_min > outbuf[col])
 		c_angle_min = outbuf[col];
 	}
-	G_put_raster_row(outfd, outbuf, FCELL_TYPE);
+	Rast_put_row(outfd, outbuf, FCELL_TYPE);
     }
     G_percent(row, nrows, 2);
 
-    G_close_cell(elevfd);
-    G_close_cell(outfd);
+    Rast_close(elevfd);
+    Rast_close(outfd);
     G_free(fbuf0);
     G_free(fbuf1);
     G_free(fbuf2);
     G_free(outbuf);
 
     type = "raster";
-    G_short_history(name, type, &hist);
-    G_command_history(&hist);
-    G_write_history(name, &hist);
+    Rast_short_history(name, type, &hist);
+    Rast_command_history(&hist);
+    Rast_write_history(name, &hist);
     
-    G_init_colors(&colr);
+    Rast_init_colors(&colr);
     if (c_angle_min < 0) {
 	clr_min = (FCELL)((int)(c_angle_min / 10 - 1)) * 10;
 	clr_max = 0;
-	G_add_f_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
+	Rast_add_f_color_rule(&clr_min, 0, 0, 0, &clr_max, 0,
 				  0, 0, &colr);
     }
     clr_min = 0;
     clr_max = 10;
-    G_add_f_raster_color_rule(&clr_min, 0, 0, 0, &clr_max, 255,
+    Rast_add_f_color_rule(&clr_min, 0, 0, 0, &clr_max, 255,
 			      0, 0, &colr);
     clr_min = 10;
     clr_max = 40;
-    G_add_f_raster_color_rule(&clr_min, 255, 0, 0, &clr_max, 255,
+    Rast_add_f_color_rule(&clr_min, 255, 0, 0, &clr_max, 255,
 			      255, 0, &colr);
     clr_min = 40;
     clr_max = 90;
-    G_add_f_raster_color_rule(&clr_min, 255, 255, 0, &clr_max, 0,
+    Rast_add_f_color_rule(&clr_min, 255, 255, 0, &clr_max, 0,
 			      255, 0, &colr);
 
-    G_write_colors(name, G_mapset(), &colr);
+    Rast_write_colors(name, G_mapset(), &colr);
 
     select_current_env();
 

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -34,15 +34,15 @@
 
     /* check for out of bounds - if out of bounds set NULL value and return */
     if (row < 0 || row + 1 >= cellhd->rows || col < 0 || col + 1 >= cellhd->cols) {
-	G_set_null_value(obufptr, 1, cell_type);
+	Rast_set_null_value(obufptr, 1, cell_type);
 	return;
     }
 
     for (i = 0; i < 2; i++)
 	for (j = 0; j < 2; j++) {
 	    const DCELL *cellp = CPTR(ibuffer, row + i, col + j);
-	    if (G_is_d_null_value(cellp)) {
-		G_set_null_value(obufptr, 1, cell_type);
+	    if (Rast_is_d_null_value(cellp)) {
+		Rast_set_null_value(obufptr, 1, cell_type);
 		return;
 	    }
 	    c[i][j] = *cellp;
@@ -52,7 +52,7 @@
     t = *col_idx - 0.5 - col;
     u = *row_idx - 0.5 - row;
 
-    result = G_interp_bilinear(t, u, c[0][0], c[0][1], c[1][0], c[1][1]);
+    result = Rast_interp_bilinear(t, u, c[0][0], c[0][1], c[1][0], c[1][1]);
 
-    G_set_raster_value_d(obufptr, result, cell_type);
+    Rast_set_d_value(obufptr, result, cell_type);
 }

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear_f.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear_f.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/bilinear_f.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -29,20 +29,20 @@
 
     /* check for out of bounds - if out of bounds set NULL value     */
     if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
-        G_set_null_value(obufptr, 1, cell_type);
+        Rast_set_null_value(obufptr, 1, cell_type);
         return;
     }
 
     cellp = CPTR(ibuffer, row, col);
     /* if nearest is null, all the other interps will be null */
-    if (G_is_d_null_value(cellp)) {
-        G_set_null_value(obufptr, 1, cell_type);
+    if (Rast_is_d_null_value(cellp)) {
+        Rast_set_null_value(obufptr, 1, cell_type);
         return;
     }
     cell = *cellp;
 
     p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
     /* fallback to nearest if bilinear is null */
-    if (G_is_d_null_value(obufptr))
-        G_set_raster_value_d(obufptr, cell, cell_type);
+    if (Rast_is_d_null_value(obufptr))
+        Rast_set_d_value(obufptr, cell, cell_type);
 }

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -38,15 +38,15 @@
     /* check for out of bounds of map - if out of bounds set NULL value     */
     if (row - 1 < 0 || row + 2 >= cellhd->rows ||
 	col - 1 < 0 || col + 2 >= cellhd->cols) {
-	G_set_null_value(obufptr, 1, cell_type);
+	Rast_set_null_value(obufptr, 1, cell_type);
 	return;
     }
 
     for (i = 0; i < 4; i++)
 	for (j = 0; j < 4; j++) {
 	    const DCELL *cellp = CPTR(ibuffer, row - 1 + i, col - 1 + j);
-	    if (G_is_d_null_value(cellp)) {
-		G_set_null_value(obufptr, 1, cell_type);
+	    if (Rast_is_d_null_value(cellp)) {
+		Rast_set_null_value(obufptr, 1, cell_type);
 		return;
 	    }
 	    cell[i][j] = *cellp;
@@ -57,10 +57,10 @@
     u = *row_idx - 0.5 - row;
 
     for (i = 0; i < 4; i++) {
-	val[i] = G_interp_cubic(t, cell[i][0], cell[i][1], cell[i][2], cell[i][3]);
+	val[i] = Rast_interp_cubic(t, cell[i][0], cell[i][1], cell[i][2], cell[i][3]);
     }
 
-    result = G_interp_cubic(u, val[0], val[1], val[2], val[3]);
+    result = Rast_interp_cubic(u, val[0], val[1], val[2], val[3]);
 
-    G_set_raster_value_d(obufptr, result, cell_type);
+    Rast_set_d_value(obufptr, result, cell_type);
 }

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic_f.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic_f.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/cubic_f.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -30,24 +30,24 @@
 
     /* check for out of bounds - if out of bounds set NULL value     */
     if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
-        G_set_null_value(obufptr, 1, cell_type);
+        Rast_set_null_value(obufptr, 1, cell_type);
         return;
     }
 
     cellp = CPTR(ibuffer, row, col);
     /* if nearest is null, all the other interps will be null */
-    if (G_is_d_null_value(cellp)) {
-        G_set_null_value(obufptr, 1, cell_type);
+    if (Rast_is_d_null_value(cellp)) {
+        Rast_set_null_value(obufptr, 1, cell_type);
         return;
     }
     cell = *cellp;
     
     p_cubic(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
     /* fallback to bilinear if cubic is null */
-    if (G_is_d_null_value(obufptr)) {
+    if (Rast_is_d_null_value(obufptr)) {
         p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
         /* fallback to nearest if bilinear is null */
-	if (G_is_d_null_value(obufptr))
-	    G_set_raster_value_d(obufptr, cell, cell_type);
+	if (Rast_is_d_null_value(obufptr))
+	    Rast_set_d_value(obufptr, cell, cell_type);
     }
 }

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/equ.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/equ.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/equ.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -30,7 +30,7 @@
 	z2 = group.control_points.z2[i];
 
 	/* image to photo transformation */
-	I_georef(e1, n1, &e0, &n0, group.E12, group.N12);
+	I_georef(e1, n1, &e0, &n0, group.E12, group.N12, 1);
 	I_new_con_point(&temp_points, e0, n0, z1, e2, n2, z2, status);
     }
 

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/exec.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/exec.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/exec.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -38,14 +38,14 @@
 	    target_window.rows, target_window.cols, target_window.north,
 	    target_window.south, target_window.west, target_window.east);
 
-    elevfd = G_open_cell_old(elev_name, elev_mapset);
+    elevfd = Rast_open_old(elev_name, elev_mapset);
     if (elevfd < 0) {
 	G_fatal_error(_("Could not open elevation raster"));
 	return 1;
     }
     ebuffer = readcell(elevfd, seg_mb_elev, 1);
     select_target_env();
-    G_close_cell(elevfd);
+    Rast_close(elevfd);
 
     /* get an average elevation of the control points */
     /* this is used only if target cells have no elevation */
@@ -73,12 +73,12 @@
 
 	select_current_env();
 
-	cats_ok = G_read_cats(name, mapset, &cats) >= 0;
-	colr_ok = G_read_colors(name, mapset, &colr) > 0;
+	cats_ok = Rast_read_cats(name, mapset, &cats) >= 0;
+	colr_ok = Rast_read_colors(name, mapset, &colr) > 0;
 
 	/* Initialze History */
-	if (G_read_history(name, mapset, &hist) < 0)
-	    G_short_history(result, type, &hist);
+	if (Rast_read_history(name, mapset, &hist) < 0)
+	    Rast_short_history(result, type, &hist);
 	G_debug(2, "reading was fine...");
 
 	time(&start_time);
@@ -89,16 +89,16 @@
 	    G_debug(2, "Done. Writing results...");
 	    select_target_env();
 	    if (cats_ok) {
-		G_write_cats(result, &cats);
-		G_free_cats(&cats);
+		Rast_write_cats(result, &cats);
+		Rast_free_cats(&cats);
 	    }
 	    if (colr_ok) {
-		G_write_colors(result, G_mapset(), &colr);
-		G_free_colors(&colr);
+		Rast_write_colors(result, G_mapset(), &colr);
+		Rast_free_colors(&colr);
 	    }
 	    /* Write out History */
-	    G_command_history(&hist);
-	    G_write_history(result, &hist);
+	    Rast_command_history(&hist);
+	    Rast_write_history(result, &hist);
 
 	    select_current_env();
 	    time(&rectify_time);

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/get_wind.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/get_wind.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/get_wind.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -16,11 +16,11 @@
 	    continue;
 
 	if (count++ == 0) {
-	    G_get_cellhd(group.group_ref.file[i].name,
+	    Rast_get_cellhd(group.group_ref.file[i].name,
 			 group.group_ref.file[i].mapset, cellhd);
 	}
 	else {
-	    G_get_cellhd(group.group_ref.file[i].name,
+	    Rast_get_cellhd(group.group_ref.file[i].name,
 			 group.group_ref.file[i].mapset, &win);
 	    /* max extends */
 	    if (cellhd->north < win.north)
@@ -70,7 +70,7 @@
 
     /* compute ortho ref of all corners */
 
-    I_georef(w1->west, w1->north, &e0, &n0, group.E12, group.N12);
+    I_georef(w1->west, w1->north, &e0, &n0, group.E12, group.N12, 1);
     I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
 			group.XC, group.YC, group.ZC, group.MI);
 
@@ -88,7 +88,7 @@
     nw.n = n;
     nw.e = e;
 
-    I_georef(w1->east, w1->north, &e0, &n0, group.E12, group.N12);
+    I_georef(w1->east, w1->north, &e0, &n0, group.E12, group.N12, 1);
     I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
 			group.XC, group.YC, group.ZC, group.MI);
 
@@ -108,7 +108,7 @@
     if (e < w2->west)
 	w2->west = e;
 
-    I_georef(w1->west, w1->south, &e0, &n0, group.E12, group.N12);
+    I_georef(w1->west, w1->south, &e0, &n0, group.E12, group.N12, 1);
     I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
 			group.XC, group.YC, group.ZC, group.MI);
 
@@ -128,7 +128,7 @@
     if (e < w2->west)
 	w2->west = e;
 
-    I_georef(w1->east, w1->south, &e0, &n0, group.E12, group.N12);
+    I_georef(w1->east, w1->south, &e0, &n0, group.E12, group.N12, 1);
     I_inverse_ortho_ref(e0, n0, aver_z, &e, &n, &z1, &group.camera_ref,
 			group.XC, group.YC, group.ZC, group.MI);
 

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/main.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/main.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/main.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -83,7 +83,8 @@
     G_gisinit(argv[0]);
 
     module = G_define_module();
-    module->keywords = _("imagery, orthorectify");
+    G_add_keyword(_("imagery"));
+    G_add_keyword(_("orthorectify"));
     module->description =
 	_("Orthorectifies an image by using the image to photo coordinate transformation matrix.");
 
@@ -201,7 +202,7 @@
 
 	for (m = 0; m < k; m++) {
 	    got_file = 0;
-	    if (G__name_is_fully_qualified(ifile->answers[m], xname, xmapset)) {
+	    if (G_name_is_fully_qualified(ifile->answers[m], xname, xmapset)) {
 		name = xname;
 		mapset = xmapset;
 	    }
@@ -277,7 +278,7 @@
 	    if (G_legal_filename(result) < 0)
 		G_fatal_error(_("Extension <%s> is illegal"), extension);
 		
-	    if (G_find_cell(result, G_mapset())) {
+	    if (G_find_raster2(result, G_mapset())) {
 		G_warning(_("The following raster map already exists in"));
 		G_warning(_("target LOCATION %s, MAPSET %s:"),
 			  G_location(), G_mapset());
@@ -286,7 +287,7 @@
 	    }
 	}
 	if (angle->answer) {
-	    if (G_find_cell(angle->answer, G_mapset())) {
+	    if (G_find_raster2(angle->answer, G_mapset())) {
 		G_warning(_("The following raster map already exists in"));
 		G_warning(_("target LOCATION %s, MAPSET %s:"),
 			  G_location(), G_mapset());
@@ -328,7 +329,7 @@
 
     /* get the elevation layer header in target location */
     select_target_env();
-    G_get_cellhd(elev_name, elev_mapset, &elevhd);
+    Rast_get_cellhd(elev_name, elev_mapset, &elevhd);
     select_current_env();
     
     /* determine memory for elevation and imagery */
@@ -342,7 +343,7 @@
 	max_rows = max_cols = 0;
 	for (i = 0; i < group.group_ref.nfiles; i++) {
 	    if (ref_list[i]) {
-		G_get_cellhd(group.group_ref.file[i].name,
+		Rast_get_cellhd(group.group_ref.file[i].name,
 			     group.group_ref.file[i].mapset, &cellhd);
 		if (max_rows < cellhd.rows)
 		    max_rows = cellhd.rows;

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/nearest.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/nearest.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/nearest.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -24,16 +24,16 @@
 
     /* check for out of bounds - if out of bounds set NULL value     */
     if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
-	G_set_null_value(obufptr, 1, cell_type);
+	Rast_set_null_value(obufptr, 1, cell_type);
 	return;
     }
 
     cellp = CPTR(ibuffer, row, col);
 
-    if (G_is_d_null_value(cellp)) {
-	G_set_null_value(obufptr, 1, cell_type);
+    if (Rast_is_d_null_value(cellp)) {
+	Rast_set_null_value(obufptr, 1, cell_type);
 	return;
     }
 
-    G_set_raster_value_d(obufptr, *cellp, cell_type);
+    Rast_set_d_value(obufptr, *cellp, cell_type);
 }

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/readcell.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/readcell.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/readcell.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -29,8 +29,8 @@
     else
 	select_current_env();
 
-    nrows = G_window_rows();
-    ncols = G_window_cols();
+    nrows = Rast_window_rows();
+    ncols = Rast_window_cols();
 
     /* Temporary file must be created in the same location/mapset 
      * where the module was called */
@@ -86,7 +86,7 @@
 	    if (row + y >= nrows)
 		break;
 
-	    G_get_d_raster_row(fdi, &tmpbuf[y * nx * BDIM], row + y);
+	    Rast_get_d_row(fdi, &tmpbuf[y * nx * BDIM], row + y);
 	}
 
 	for (x = 0; x < nx; x++)

Modified: grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/rectify.c
===================================================================
--- grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/rectify.c	2012-12-16 23:14:13 UTC (rev 54317)
+++ grass/trunk/imagery/i.ortho.photo/i.ortho.rectify/rectify.c	2012-12-16 23:14:48 UTC (rev 54318)
@@ -25,23 +25,19 @@
     struct cache *ibuffer;
 
     select_current_env();
-    if (G_get_cellhd(name, mapset, &cellhd) < 0)
-	return 0;
+    Rast_get_cellhd(name, mapset, &cellhd);
 
     /* open the file to be rectified
      * set window to cellhd first to be able to read file exactly
      */
-    G_set_window(&cellhd);
-    infd = G_open_cell_old(name, mapset);
-    if (infd < 0) {
-	return 0;
-    }
-    map_type = G_get_raster_map_type(infd);
-    cell_size = G_raster_size(map_type);
+    Rast_set_input_window(&cellhd);
+    infd = Rast_open_old(name, mapset);
+    map_type = Rast_get_map_type(infd);
+    cell_size = Rast_cell_size(map_type);
 
     ibuffer = readcell(infd, seg_mb_img, 0);
 
-    G_close_cell(infd);		/* (pmx) 17 april 2000 */
+    Rast_close(infd);		/* (pmx) 17 april 2000 */
 
     G_message(_("Rectify <%s@%s> (location <%s>)"),
 	      name, mapset, G_location());
@@ -55,7 +51,7 @@
 
     if (strcmp(interp_method, "nearest") != 0) {
 	map_type = DCELL_TYPE;
-	cell_size = G_raster_size(map_type);
+	cell_size = Rast_cell_size(map_type);
     }
 
     /* open the result file into target window
@@ -64,15 +60,15 @@
      * but those open for reading are
      */
 
-    outfd = G_open_raster_new(result, map_type);
-    trast = G_allocate_raster_buf(map_type);
+    outfd = Rast_open_new(result, map_type);
+    trast = Rast_allocate_output_buf(map_type);
 
     for (row = 0; row < nrows; row++) {
-	n1 = target_window.north - (row  + 0.5) * target_window.ns_res;
+	n1 = target_window.north - (row + 0.5) * target_window.ns_res;
 
 	G_percent(row, nrows, 2);
 
-	G_set_null_value(trast, ncols, map_type);
+	Rast_set_null_value(trast, ncols, map_type);
 	tptr = trast;
 	for (col = 0; col < ncols; col++) {
 	    DCELL *zp = CPTR(ebuffer, row, col);
@@ -80,7 +76,7 @@
 	    e1 = target_window.west + (col + 0.5) * target_window.ew_res;
 	    
 	    /* if target cell has no elevation, set to aver_z */
-	    if (G_is_d_null_value(zp)) {
+	    if (Rast_is_d_null_value(zp)) {
 		G_warning(_("No elevation available at row = %d, col = %d"), row, col);
 		z1 = aver_z;
 	    }
@@ -95,7 +91,7 @@
 		    ex1, nx1);
 
 	    /* photo coordinates ex1, nx1 to image coordinates ex, nx */
-	    I_georef(ex1, nx1, &ex, &nx, group.E21, group.N21);
+	    I_georef(ex1, nx1, &ex, &nx, group.E21, group.N21, 1);
 
 	    G_debug(5, "\t\tAfter geo ref: ex = %f \t nx =  %f", ex, nx);
 
@@ -108,18 +104,17 @@
 
 	    tptr = G_incr_void_ptr(tptr, cell_size);
 	}
-	G_put_raster_row(outfd, trast, map_type);
+	Rast_put_row(outfd, trast, map_type);
     }
     G_percent(1, 1, 1);
 
-    G_close_cell(outfd);
+    Rast_close(outfd);		/* (pmx) 17 april 2000 */
     G_free(trast);
 
     close(ibuffer->fd);
     release_cache(ibuffer);
 
-    if (G_get_cellhd(result, G_mapset(), &cellhd) < 0)
-	return 0;
+    Rast_get_cellhd(result, G_mapset(), &cellhd);
 
     if (cellhd.proj == 0) {	/* x,y imagery */
 	cellhd.proj = target_window.proj;



More information about the grass-commit mailing list