[GRASS-SVN] r63338 - in grass-addons/grass7/imagery/i.pr: PRLIB i.pr_blob i.pr_classify i.pr_features_additional i.pr_statistics i.pr_training i.pr_uxb

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 2 14:05:35 PST 2014


Author: zarch
Date: 2014-12-02 14:05:35 -0800 (Tue, 02 Dec 2014)
New Revision: 63338

Modified:
   grass-addons/grass7/imagery/i.pr/PRLIB/blob.c
   grass-addons/grass7/imagery/i.pr/PRLIB/features.c
   grass-addons/grass7/imagery/i.pr/PRLIB/open.c
   grass-addons/grass7/imagery/i.pr/i.pr_blob/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_classify/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_features_additional/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/cell.c
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/graphics.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/write_map.c
   grass-addons/grass7/imagery/i.pr/i.pr_uxb/main.c
Log:
i.pr: raplace grass6 functions to grass7

Modified: grass-addons/grass7/imagery/i.pr/PRLIB/blob.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/PRLIB/blob.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/PRLIB/blob.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -40,9 +40,9 @@
 		if (matrix[blobs[index].row][blobs[index].col] < sites[j].min)
 		    sites[j].min = matrix[blobs[index].row][blobs[index].col];
 		barix +=
-		    G_col_to_easting((double)blobs[index].col + .5, cellhd);
+		    Rast_col_to_easting((double)blobs[index].col + .5, cellhd);
 		bariy +=
-		    G_row_to_northing((double)blobs[index].row + .5, cellhd);
+		    Rast_row_to_northing((double)blobs[index].row + .5, cellhd);
 		index += 1;
 		intindex += 1;
 	    }

Modified: grass-addons/grass7/imagery/i.pr/PRLIB/features.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/PRLIB/features.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/PRLIB/features.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -191,7 +191,7 @@
 		    G_fatal_error(tempbuf);
 		}
 		if ((fp =
-		     G_open_cell_old(features->training.mapnames[i][j],
+		     Rast_open_old(features->training.mapnames[i][j],
 				     mapset)) < 0) {
 		    sprintf(tempbuf,
 			    "compute_features-> Can't open raster map <%s> for reading",
@@ -199,7 +199,7 @@
 		    G_fatal_error(tempbuf);
 		}
 
-		G_get_cellhd(features->training.mapnames[i][j], mapset,
+		Rast_get_cellhd(features->training.mapnames[i][j], mapset,
 			     &cellhd);
 		G_set_window(&cellhd);
 		if ((cellhd.rows != features->training.rows) ||
@@ -212,9 +212,9 @@
 
 
 		for (r = 0; r < features->training.rows; r++) {
-		    G_get_d_raster_row(fp, tf, r);
+		    Rast_get_d_row(fp, tf, r);
 		    for (c = 0; c < features->training.cols; c++) {
-			if (G_is_d_null_value(tf))
+			if (Rast_is_d_null_value(tf))
 			    *tf = 0.0;
 			matrix[i][c + (r * features->training.cols)] = *tf;
 			tf++;
@@ -222,7 +222,7 @@
 		}
 		G_free(rowbuf);
 
-		G_close_cell(fp);
+		Rast_close(fp);
 
 		break;
 	    case TABLE_data:

Modified: grass-addons/grass7/imagery/i.pr/PRLIB/open.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/PRLIB/open.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/PRLIB/open.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -24,7 +24,7 @@
 	exit(1);
     }
 
-    fd = G_open_raster_new(name, CELL_TYPE);
+    fd = Rast_open_new(name, CELL_TYPE);
     if (fd < 0) {
 	sprintf(err, "open_new_CELL-> failed in attempt to open %s\n", name);
 	G_fatal_error(err);
@@ -49,7 +49,7 @@
 	exit(1);
     }
 
-    fd = G_open_raster_new(name, DCELL_TYPE);
+    fd = Rast_open_new(name, DCELL_TYPE);
     if (fd < 0) {
 	sprintf(err, "open_new_DCELL-> failed in attempt to open %s\n", name);
 	G_fatal_error(err);

Modified: grass-addons/grass7/imagery/i.pr/i.pr_blob/main.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_blob/main.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_blob/main.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -106,7 +106,7 @@
 	G_fatal_error(tempbuf);
     }
 
-    if ((fd = G_open_cell_old(opt1->answer, mapset)) < 0) {
+    if ((fd = Rast_open_old(opt1->answer, mapset)) < 0) {
 	sprintf(tempbuf, "error opening raster map <%s>", opt1->answer);
 	G_fatal_error(tempbuf);
     }
@@ -120,15 +120,15 @@
 	matrix[i] = (double *)G_calloc(cellhd.cols, sizeof(double));
 
     for (i = 0; i < cellhd.rows; i++) {
-	G_get_d_raster_row(fd, tf, i);
+	Rast_get_d_row(fd, tf, i);
 	for (j = 0; j < cellhd.cols; j++) {
-	    if (G_is_d_null_value(tf))
+	    if (Rast_is_d_null_value(tf))
 		*tf = maxv + 1.0;
 	    matrix[i][j] = *tf;
 	    tf++;
 	}
     }
-    G_close_cell(fd);
+    Rast_close(fd);
 
     nblobs = 0;
     npoints = 0;

Modified: grass-addons/grass7/imagery/i.pr/i.pr_classify/main.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_classify/main.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_classify/main.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -194,7 +194,7 @@
 
     projected = (double *)G_calloc(features.npc, sizeof(double));
 
-    output_cell = G_allocate_d_raster_buf();
+    output_cell = Rast_allocate_d_buf();
 
     /*open the input maps */
     n_input_map = 0;
@@ -205,7 +205,7 @@
 	    G_fatal_error(tmpbuf);
 	}
 
-	if ((fd[l] = G_open_cell_old(opt1->answers[l], mapset)) < 0) {
+	if ((fd[l] = Rast_open_old(opt1->answers[l], mapset)) < 0) {
 	    sprintf(tmpbuf, "error opening raster map [%s]",
 		    opt1->answers[l]);
 	    G_fatal_error(tmpbuf);
@@ -241,13 +241,13 @@
 			       sizeof(DCELL));
 	tf = rowbuf;
 	for (l = 0; l < features.training.nlayers; l++) {
-	    if (G_get_d_raster_row(fd[l], tf, r) < 0) {
+	    if (Rast_get_d_row(fd[l], tf, r) < 0) {
 		sprintf(tmpbuf, "Error reading raster map <%s>\n",
 			opt1->answers[l]);
 		G_fatal_error(tmpbuf);
 	    }
 	    for (c = 0; c < cellhd.cols; c++) {
-		if (G_is_d_null_value(tf))
+		if (Rast_is_d_null_value(tf))
 		    *tf = 0.0;
 		matrix[l][r][c] = *tf;
 		tf++;
@@ -258,9 +258,9 @@
 
     /*write the first rows of the output map */
     for (c = 1; c <= cellhd.cols; c++)
-	G_set_d_null_value(output_cell, c);
+	Rast_set_d_null_value(output_cell, c);
     for (r = 0; r < borderR; r++)
-	G_put_d_raster_row(fdout, output_cell);
+	Rast_put_d_row(fdout, output_cell);
 
     /*computing... */
     r = features.training.rows;
@@ -398,7 +398,7 @@
 		}
 	    }
 	}
-	G_put_d_raster_row(fdout, output_cell);
+	Rast_put_d_row(fdout, output_cell);
 	percent(r, cellhd.rows, 1);
 
 	if (r < cellhd.rows) {
@@ -412,13 +412,13 @@
 		rowbuf = (DCELL *) G_calloc(cellhd.cols, sizeof(DCELL));
 		tf = rowbuf;
 
-		if (G_get_d_raster_row(fd[l], tf, r) < 0) {
+		if (Rast_get_d_row(fd[l], tf, r) < 0) {
 		    sprintf(tmpbuf, "Error reading raster map <%s>\n",
 			    opt1->answers[l]);
 		    G_fatal_error(tmpbuf);
 		}
 		for (c = 0; c < cellhd.cols; c++) {
-		    if (G_is_d_null_value(tf))
+		    if (Rast_is_d_null_value(tf))
 			*tf = 0.0;
 		    matrix[l][last_row][c] = *tf;
 		    tf++;
@@ -431,11 +431,11 @@
 
     /*write the last rows of the output map */
     for (c = 1; c <= cellhd.cols; c++)
-	G_set_d_null_value(output_cell, c);
+	Rast_set_d_null_value(output_cell, c);
     for (r = 0; r < borderR; r++)
-	G_put_d_raster_row(fdout, output_cell);
+	Rast_put_d_row(fdout, output_cell);
 
-    G_close_cell(fdout);
+    Rast_close(fdout);
     return 0;
 }
 

Modified: grass-addons/grass7/imagery/i.pr/i.pr_features_additional/main.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_features_additional/main.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_features_additional/main.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -255,7 +255,7 @@
 		    G_fatal_error(tempbuf);
 		}
 		if ((fp =
-		     G_open_cell_old(features_out->training.mapnames[i][j],
+		     Rast_open_old(features_out->training.mapnames[i][j],
 				     mapset)) < 0) {
 		    sprintf(tempbuf,
 			    "generate_features-> Can't open raster map <%s> for reading",
@@ -263,7 +263,7 @@
 		    G_fatal_error(tempbuf);
 		}
 
-		G_get_cellhd(features_out->training.mapnames[i][j], mapset,
+		Rast_get_cellhd(features_out->training.mapnames[i][j], mapset,
 			     &cellhd);
 		G_set_window(&cellhd);
 		if ((cellhd.rows != features_out->training.rows) ||
@@ -277,9 +277,9 @@
 
 
 		for (r = 0; r < features_out->training.rows; r++) {
-		    G_get_d_raster_row(fp, tf, r);
+		    Rast_get_d_row(fp, tf, r);
 		    for (c = 0; c < features_out->training.cols; c++) {
-			if (G_is_d_null_value(tf))
+			if (Rast_is_d_null_value(tf))
 			    *tf = 0.0;
 			matrix[i][c + (r * features_out->training.cols)] =
 			    *tf;
@@ -288,7 +288,7 @@
 		}
 		G_free(rowbuf);
 
-		G_close_cell(fp);
+		Rast_close(fp);
 		break;
 	    case TABLE_data:
 		matrix[i] = features_out->training.data[i];

Modified: grass-addons/grass7/imagery/i.pr/i.pr_statistics/cell.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_statistics/cell.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_statistics/cell.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -13,8 +13,8 @@
  * \brief 
  *
  * If the map is a floating-point map, read the map using
- * <tt>G_get_d_raster_row()</tt> and plot using <tt>D_draw_d_cell()</tt>. If the
- * map is an integer map, read the map using <tt>G_get_c_raster_row()</tt> and
+ * <tt>Rast_get_d_row()</tt> and plot using <tt>D_draw_d_cell()</tt>. If the
+ * map is an integer map, read the map using <tt>Rast_get_c_row()</tt> and
  * plot using <tt>D_draw_cell()</tt>.
  *
  *  \param name
@@ -47,14 +47,14 @@
     G_set_window(&wind);
 
     /* Set the colors for the display */
-    if (G_read_colors(name, mapset, &colors) == -1)
+    if (Rast_read_colors(name, mapset, &colors) == -1)
 	G_fatal_error(_("Color file for [%s] not available"), name);
 
     /* Go draw the cell file */
     cell_draw(name, mapset, &colors, overlay);
 
     /* release the colors now */
-    G_free_colors(&colors);
+    Rast_free_colors(&colors);
 
     /* record the cell file */
     /* If overlay add it to the list instead of setting the cell name */
@@ -88,16 +88,16 @@
     D_set_overlay_mode(overlay);
 
     /* Make sure map is available */
-    if ((cellfile = G_open_cell_old(name, mapset)) == -1)
+    if ((cellfile = Rast_open_old(name, mapset)) == -1)
 	G_fatal_error(_("Not able to open cellfile for [%s]"), name);
 
     /* Allocate space for cell buffer */
-    xarray = G_allocate_d_raster_buf();
+    xarray = Rast_allocate_d_buf();
 
     /* loop for array rows */
     for (cur_A_row = 0; cur_A_row != -1;) {
 	/* Get window (array) row currently required */
-	G_get_d_raster_row(cellfile, xarray, cur_A_row);
+	Rast_get_d_row(cellfile, xarray, cur_A_row);
 
 	/* Draw the cell row, and get the next row number */
 	cur_A_row = D_draw_d_raster(cur_A_row, xarray, colors);
@@ -105,7 +105,7 @@
     R_flush();
 
     /* Wrap up and return */
-    G_close_cell(cellfile);
+    Rast_close(cellfile);
     G_free(xarray);
 
     return (0);

Modified: grass-addons/grass7/imagery/i.pr/i.pr_statistics/main.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_statistics/main.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_statistics/main.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -345,7 +345,7 @@
 			intmat[i] = (int *)G_calloc(cellhd.cols, sizeof(int));
 
 		    for (i = 0; i < cellhd.rows; i++)
-			G_zero_cell_buf(intmat[i]);
+			Rast_zero_c_buf(intmat[i]);
 
 		    /*compute output raster map */
 		    index = 0;
@@ -406,7 +406,7 @@
 			    G_fatal_error(tempbuf);
 			}
 
-		    if (G_close_cell(FD) == -1) {
+		    if (Rast_close(FD) == -1) {
 			sprintf(tempbuf, "error closing tmp raster map");
 			G_fatal_error(tempbuf);
 		    }

Modified: grass-addons/grass7/imagery/i.pr/i.pr_training/graphics.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/graphics.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/graphics.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -81,8 +81,8 @@
     VIEW_INFO = makeview(7.5, 45.0, 52.5, 97.5);
     VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
 
-    G_init_colors(&VIEW_MAP1->cell.colors);
-    G_init_colors(&VIEW_IMAGE->cell.colors);
+    Rast_init_colors(&VIEW_MAP1->cell.colors);
+    Rast_init_colors(&VIEW_IMAGE->cell.colors);
 }
 
 
@@ -126,8 +126,8 @@
     VIEW_INFO = makeview(7.5, 45.0, 52.5, 97.5);
     VIEW_MENU = makeview(0.0, 2.5, 0.0, 100.0);
 
-    G_init_colors(&VIEW_MAP1->cell.colors);
-    G_init_colors(&VIEW_IMAGE->cell.colors);
+    Rast_init_colors(&VIEW_MAP1->cell.colors);
+    Rast_init_colors(&VIEW_IMAGE->cell.colors);
 }
 
 void Outline_box(top, bottom, left, right)
@@ -219,8 +219,8 @@
 	read_colors = view == VIEW_IMAGE;
     }
     if (read_colors) {
-	G_free_colors(colors);
-	if (G_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
+	Rast_free_colors(colors);
+	if (Rast_read_colors(view->cell.name, view->cell.mapset, colors) < 0)
 	    return 0;
     }
 
@@ -229,8 +229,8 @@
     /*    D_set_colors (colors); */
 
     G_set_window(&view->cell.head);
-    nrows = G_window_rows();
-    ncols = G_window_cols();
+    nrows = Rast_window_rows();
+    ncols = Rast_window_cols();
 
     left = view->cell.left;
     top = view->cell.top;
@@ -244,7 +244,7 @@
 	    return 1;
     }
 
-    fd = G_open_cell_old(view->cell.name, view->cell.mapset);
+    fd = Rast_open_old(view->cell.name, view->cell.mapset);
     if (fd < 0)
 	return 0;
     cell = G_allocate_cell_buf();
@@ -261,7 +261,7 @@
 	repeat = G_row_repeat_nomask(fd, row);
 	/*      D_raster (cell, ncols, repeat, colors); */
     }
-    G_close_cell(fd);
+    Rast_close(fd);
     G_free(cell);
     /*    if(colors != &VIEW_MAP1->cell.colors)
        D_set_colors(&VIEW_MAP1->cell.colors);

Modified: grass-addons/grass7/imagery/i.pr/i.pr_training/write_map.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/write_map.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/write_map.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -15,31 +15,31 @@
 
     G_set_window(cellhd);
 
-    fd_from = G_open_cell_old(name, mapset);
+    fd_from = Rast_open_old(name, mapset);
     if (fd_from < 0)
 	G_fatal_error(_("Error reading raster map <%s> in mapset <%s>"),
 		      name, mapset);
 
 
-    fd_to = G_open_cell_new(dest);
+    fd_to = Rast_open_c_new(dest);
     if (fd_to < 0)
 	G_fatal_error(_("Error writing raster map <%s> in mapset <%s>"),
 		      dest, G_mapset());
 
-    buf = G_allocate_raster_buf(CELL_TYPE);
+    buf = Rast_allocate_buf(CELL_TYPE);
 
-    ncols = G_window_cols();
-    nrows = G_window_rows();
+    ncols = Rast_window_cols();
+    nrows = Rast_window_rows();
 
     for (row = 0; row < nrows; row++) {
-	G_get_raster_row(fd_from, buf, row, CELL_TYPE);
-	G_put_raster_row(fd_to, buf, CELL_TYPE);
+	Rast_get_row(fd_from, buf, row, CELL_TYPE);
+	Rast_put_row(fd_to, buf, CELL_TYPE);
     }
 
     /* memory cleanup */
     G_free(buf);
-    G_close_cell(fd_to);
-    G_close_cell(fd_from);
+    Rast_close(fd_to);
+    Rast_close(fd_from);
 
 
     if ((mapset = G_find_file("colr", name, mapset)) != NULL) {

Modified: grass-addons/grass7/imagery/i.pr/i.pr_uxb/main.c
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_uxb/main.c	2014-12-02 21:11:56 UTC (rev 63337)
+++ grass-addons/grass7/imagery/i.pr/i.pr_uxb/main.c	2014-12-02 22:05:35 UTC (rev 63338)
@@ -193,7 +193,7 @@
 	    G_fatal_error(tmpbuf);
 	}
 
-	if ((fd[l] = G_open_cell_old(opt1->answers[l], mapset)) < 0) {
+	if ((fd[l] = Rast_open_old(opt1->answers[l], mapset)) < 0) {
 	    sprintf(tmpbuf, "error opening raster map [%s]",
 		    opt1->answers[l]);
 	    G_fatal_error(tmpbuf);
@@ -226,13 +226,13 @@
 			       sizeof(DCELL));
 	tf = rowbuf;
 	for (l = 0; l < features.training.nlayers; l++) {
-	    if (G_get_d_raster_row(fd[l], tf, r) < 0) {
+	    if (Rast_get_d_row(fd[l], tf, r) < 0) {
 		sprintf(tmpbuf, "Error reading raster map <%s>\n",
 			opt1->answers[l]);
 		G_fatal_error(tmpbuf);
 	    }
 	    for (c = 0; c < cellhd.cols; c++) {
-		if (G_is_d_null_value(tf))
+		if (Rast_is_d_null_value(tf))
 		    *tf = 0.0;
 		matrix[l][r][c] = *tf;
 		tf++;
@@ -393,13 +393,13 @@
 		rowbuf = (DCELL *) G_calloc(cellhd.cols, sizeof(DCELL));
 		tf = rowbuf;
 
-		if (G_get_d_raster_row(fd[l], tf, r) < 0) {
+		if (Rast_get_d_row(fd[l], tf, r) < 0) {
 		    sprintf(tmpbuf, "Error reading raster map <%s>\n",
 			    opt1->answers[l]);
 		    G_fatal_error(tmpbuf);
 		}
 		for (c = 0; c < cellhd.cols; c++) {
-		    if (G_is_d_null_value(tf))
+		    if (Rast_is_d_null_value(tf))
 			*tf = 0.0;
 		    matrix[l][last_row][c] = *tf;
 		    tf++;



More information about the grass-commit mailing list