[GRASS-SVN] r73822 - grass/branches/releasebranch_7_4/vector/v.distance

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 21 13:41:41 PST 2018


Author: mmetz
Date: 2018-12-21 13:41:41 -0800 (Fri, 21 Dec 2018)
New Revision: 73822

Modified:
   grass/branches/releasebranch_7_4/vector/v.distance/main.c
Log:
v.distance: speed improvement for small dmax (backport trunk r73820)

Modified: grass/branches/releasebranch_7_4/vector/v.distance/main.c
===================================================================
--- grass/branches/releasebranch_7_4/vector/v.distance/main.c	2018-12-21 21:41:15 UTC (rev 73821)
+++ grass/branches/releasebranch_7_4/vector/v.distance/main.c	2018-12-21 21:41:41 UTC (rev 73822)
@@ -503,6 +503,20 @@
 	max_step[0] = max_map;
     }
 
+    if (max > 0) {
+	G_debug(2, "reduce max steps");
+	for (i = 0; i < n_max_steps; i++) {
+	    if (max_step[i] > max) {
+		if (i == 1) {
+		    i = 0;
+		}
+		n_max_steps = i + 1;
+		max_step[i] = max;
+		break;
+	    }
+	}
+    }
+
     /* Open database driver */
     db_init_string(&stmt);
     db_init_string(&dbstr);
@@ -698,7 +712,7 @@
 	near = NULL;
 	nlines = Vect_get_num_lines(&From);
 
-	G_percent(0, 0, 4);
+	G_percent(0, nlines, 4);
 	for (fline = 1; fline <= nlines; fline++) {
 	    int tmp_tcat;
 	    double tmp_min = (min < 0 ? 0 : min);
@@ -982,6 +996,7 @@
 	near = NULL;
 
 	G_message(_("Finding nearest features for areas..."));
+	G_percent(0, nfromareas, 2);
 	for (area = 1; area <= nfromareas; area++) {
 	    int tmp_tcat;
 	    double tmp_min = (min < 0 ? 0 : min);



More information about the grass-commit mailing list