[GRASS-SVN] r54538 - in grass/trunk/raster: r.cost r.walk

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 5 12:05:37 PST 2013


Author: martinl
Date: 2013-01-05 12:05:36 -0800 (Sat, 05 Jan 2013)
New Revision: 54538

Modified:
   grass/trunk/raster/r.cost/main.c
   grass/trunk/raster/r.walk/main.c
Log:
r.walk/r.cost: remove unused variables
               rename coordinate to coordinates (see G_OPT_M_COORDS)


Modified: grass/trunk/raster/r.cost/main.c
===================================================================
--- grass/trunk/raster/r.cost/main.c	2013-01-05 19:31:23 UTC (rev 54537)
+++ grass/trunk/raster/r.cost/main.c	2013-01-05 20:05:36 UTC (rev 54538)
@@ -97,7 +97,6 @@
     double min_cost, old_min_cost;
     FCELL cur_dir;
     double zero = 0.0;
-    int at_percent = 0;
     int col, row, nrows, ncols;
     int maxcost;
     int nseg;
@@ -118,7 +117,7 @@
     struct Flag *flag2, *flag3, *flag4, *flag5;
     struct Option *opt1, *opt2, *opt3, *opt4, *opt5, *opt6, *opt7, *opt8;
     struct Option *opt9, *opt10, *opt11, *opt12;
-    struct cost *pres_cell, *new_cell;
+    struct cost *pres_cell;
     struct start_pt *pres_start_pt = NULL;
     struct start_pt *pres_stop_pt = NULL;
     struct cc {
@@ -183,14 +182,14 @@
     opt9->guisection = _("Start");
 
     opt3 = G_define_standard_option(G_OPT_M_COORDS);
-    opt3->key = "start_coordinate";
+    opt3->key = "start_coordinates";
     opt3->multiple = YES;
     opt3->description =
 	_("Coordinates of starting point(s) (E,N)");
     opt3->guisection = _("Start");
 
     opt4 = G_define_standard_option(G_OPT_M_COORDS);
-    opt4->key = "stop_coordinate";
+    opt4->key = "stop_coordinates";
     opt4->multiple = YES;
     opt4->description =
 	_("Coordinates of stopping point(s) (E,N)");
@@ -674,15 +673,13 @@
 
 		    cellval = Rast_get_d_value(ptr2, data_type2);
 		    if (start_with_raster_vals == 1) {
-			new_cell = insert(cellval, row, col);
 			costs.cost_out = cellval;
 			costs.nearest = cellval;
 			segment_put(&cost_seg, &costs, row, col);
 		    }
 		    else {
 			value = &zero;
-			new_cell = insert(zero, row, col);
-			costs.cost_out = *value;
+                        costs.cost_out = *value;
 			costs.nearest = cellval;
 			segment_put(&cost_seg, &costs, row, col);
 		    }
@@ -712,7 +709,6 @@
 	    if (top_start_pt->row < 0 || top_start_pt->row >= nrows
 		|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
 		G_fatal_error(_("Specified starting location outside database window"));
-	    new_cell = insert(zero, top_start_pt->row, top_start_pt->col);
 	    segment_get(&cost_seg, &costs, top_start_pt->row,
 			top_start_pt->col);
 
@@ -734,7 +730,6 @@
 
     G_message(_("Finding cost path..."));
     n_processed = 0;
-    at_percent = 0;
 
     pres_cell = get_lowest();
     while (pres_cell != NULL) {
@@ -983,7 +978,6 @@
 		costs.cost_out = min_cost;
 		costs.nearest = nearest;
 		segment_put(&cost_seg, &costs, row, col);
-		new_cell = insert(min_cost, row, col);
 		if (dir == TRUE) {
 		    segment_put(&dir_seg, &cur_dir, row, col);
 		}
@@ -993,7 +987,6 @@
 		costs.cost_out = min_cost;
 		costs.nearest = nearest;
 		segment_put(&cost_seg, &costs, row, col);
-		new_cell = insert(min_cost, row, col);
 		if (dir == TRUE) {
 		    segment_put(&dir_seg, &cur_dir, row, col);
 		}
@@ -1203,7 +1196,7 @@
 process_answers(char **answers, struct start_pt **points,
 		struct start_pt **top_start_pt)
 {
-    int col, row, n;
+    int col, row;
     double east, north;
     struct start_pt *new_start_pt;
     int got_one = 0;
@@ -1214,7 +1207,7 @@
     if (!answers)
 	return (0);
 
-    for (n = 0; *answers != NULL; answers += 2) {
+    for (; *answers != NULL; answers += 2) {
 	if (!G_scan_easting(*answers, &east, G_projection()))
 	    G_fatal_error(_("Illegal x coordinate <%s>"), *answers);
 	if (!G_scan_northing(*(answers + 1), &north, G_projection()))

Modified: grass/trunk/raster/r.walk/main.c
===================================================================
--- grass/trunk/raster/r.walk/main.c	2013-01-05 19:31:23 UTC (rev 54537)
+++ grass/trunk/raster/r.walk/main.c	2013-01-05 20:05:36 UTC (rev 54538)
@@ -154,7 +154,7 @@
     struct Flag *flag2, *flag3, *flag4, *flag5;
     struct Option *opt1, *opt2, *opt3, *opt4, *opt5, *opt6, *opt7, *opt8;
     struct Option *opt9, *opt10, *opt11, *opt12, *opt13, *opt14, *opt15;
-    struct cost *pres_cell, *new_cell;
+    struct cost *pres_cell;
     struct start_pt *pres_start_pt = NULL;
     struct start_pt *pres_stop_pt = NULL;
     struct cc {
@@ -224,14 +224,14 @@
     opt9->guisection = _("Start");
 
     opt3 = G_define_standard_option(G_OPT_M_COORDS);
-    opt3->key = "start_coordinate";
+    opt3->key = "start_coordinates";
     opt3->multiple = YES;
     opt3->description =
 	_("Coordinates of starting point(s) (E,N)");
     opt3->guisection = _("Start");
 
     opt4 = G_define_standard_option(G_OPT_M_COORDS);
-    opt4->key = "stop_coordinate";
+    opt4->key = "stop_coordinates";
     opt4->multiple = YES;
     opt4->description =
 	_("Coordinates of stopping point(s) (E,N)");
@@ -870,13 +870,11 @@
 
 		    if (start_with_raster_vals == 1) {
 			cellval = Rast_get_d_value(ptr2, data_type2);
-			new_cell = insert(cellval, row, col);
 			costs.cost_out = cellval;
 			segment_put(&cost_seg, &costs, row, col);
 		    }
 		    else {
 			value = &zero;
-			new_cell = insert(zero, row, col);
 			costs.cost_out = *value;
 			segment_put(&cost_seg, &costs, row, col);
 		    }
@@ -907,7 +905,6 @@
 	    if (top_start_pt->row < 0 || top_start_pt->row >= nrows
 		|| top_start_pt->col < 0 || top_start_pt->col >= ncols)
 		G_fatal_error(_("Specified starting location outside database window"));
-	    new_cell = insert(zero, top_start_pt->row, top_start_pt->col);
 	    segment_get(&cost_seg, &costs, top_start_pt->row,
 			top_start_pt->col);
 	    costs.cost_out = *value;
@@ -1375,14 +1372,12 @@
 	    if (Rast_is_d_null_value(&old_min_cost)) {
 		costs.cost_out = min_cost;
 		segment_put(&cost_seg, &costs, row, col);
-		new_cell = insert(min_cost, row, col);
 		if (dir == 1)
 		    segment_put(&dir_seg, &cur_dir, row, col);
 	    }
 	    else if (old_min_cost > min_cost) {
 		costs.cost_out = min_cost;
 		segment_put(&cost_seg, &costs, row, col);
-		new_cell = insert(min_cost, row, col);
 		if (dir == 1)
 		    segment_put(&dir_seg, &cur_dir, row, col);
 	    }
@@ -1532,7 +1527,7 @@
 process_answers(char **answers, struct start_pt **points,
 		struct start_pt **top_start_pt)
 {
-    int col, row, n;
+    int col, row;
     double east, north;
 
     struct start_pt *new_start_pt;
@@ -1543,7 +1538,7 @@
     if (!answers)
 	return (0);
 
-    for (n = 0; *answers != NULL; answers += 2) {
+    for (; *answers != NULL; answers += 2) {
 	if (!G_scan_easting(*answers, &east, G_projection()))
 	    G_fatal_error(_("Illegal x coordinate <%s>"), *answers);
 	if (!G_scan_northing(*(answers + 1), &north, G_projection()))



More information about the grass-commit mailing list