[GRASS-SVN] r68146 - grass/branches/releasebranch_7_0/vector/v.distance

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 25 07:08:34 PDT 2016


Author: wenzeslaus
Date: 2016-03-25 07:08:34 -0700 (Fri, 25 Mar 2016)
New Revision: 68146

Modified:
   grass/branches/releasebranch_7_0/vector/v.distance/distance.c
   grass/branches/releasebranch_7_0/vector/v.distance/main.c
Log:
v.distance: use bbox in 2D and 3D accordingly (see #2734, depends on r68143, backport r66460)

Modified: grass/branches/releasebranch_7_0/vector/v.distance/distance.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.distance/distance.c	2016-03-25 14:02:32 UTC (rev 68145)
+++ grass/branches/releasebranch_7_0/vector/v.distance/distance.c	2016-03-25 14:08:34 UTC (rev 68146)
@@ -289,9 +289,14 @@
     all_inside_outer = all_outside_outer = 1;
     all_outside_inner = 1;
 
+    int in_box;
     for (i = 0; i < Points->n_points; i++) {
-	if (Vect_point_in_box(Points->x[i], Points->y[i],
-			      Points->z[i], abox)) {
+        if (with_z)
+            in_box = Vect_point_in_box(Points->x[i], Points->y[i],
+                                       Points->z[i], abox);
+        else
+            in_box = Vect_point_in_box_2d(Points->x[i], Points->y[i], abox);
+        if (in_box) {
 
 	    int poly;
 	    
@@ -323,8 +328,13 @@
 		int inside_isle = 0;
 
 		for (j = 0; j < nisles; j++) {
-		    if (Vect_point_in_box(Points->x[i], Points->y[i], Points->z[i], 
-					  &ibox[j])) {
+                    if (with_z)
+                        in_box = Vect_point_in_box(Points->x[i], Points->y[i],
+                                                   Points->z[i], &ibox[j]);
+                    else
+                        in_box = Vect_point_in_box_2d(Points->x[i],
+                                                      Points->y[i], &ibox[j]);
+                    if (in_box) {
 
 			poly = Vect_point_in_poly(Points->x[i], Points->y[i], iPoints[j]);
 			

Modified: grass/branches/releasebranch_7_0/vector/v.distance/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.distance/main.c	2016-03-25 14:02:32 UTC (rev 68145)
+++ grass/branches/releasebranch_7_0/vector/v.distance/main.c	2016-03-25 14:08:34 UTC (rev 68146)
@@ -13,7 +13,7 @@
  *               
  * PURPOSE:      Calculates distance from a point to nearest feature in vector layer. 
  *               
- * COPYRIGHT:    (C) 2002-2012 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2002-2015 by the GRASS Development Team
  *
  *               This program is free software under the 
  *               GNU General Public License (>=v2). 



More information about the grass-commit mailing list