[GRASS-SVN] r52535 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 5 01:14:14 PDT 2012


Author: mmetz
Date: 2012-08-05 01:14:14 -0700 (Sun, 05 Aug 2012)
New Revision: 52535

Modified:
   grass/trunk/lib/vector/Vlib/area.c
   grass/trunk/lib/vector/Vlib/bridges.c
   grass/trunk/lib/vector/Vlib/find.c
   grass/trunk/lib/vector/Vlib/poly.c
   grass/trunk/lib/vector/Vlib/write_nat.c
Log:
Vlib: update for changed fn defs

Modified: grass/trunk/lib/vector/Vlib/area.c
===================================================================
--- grass/trunk/lib/vector/Vlib/area.c	2012-08-05 08:12:45 UTC (rev 52534)
+++ grass/trunk/lib/vector/Vlib/area.c	2012-08-05 08:14:14 UTC (rev 52535)
@@ -342,7 +342,7 @@
    \return 0 if not 
  */
 int Vect_point_in_area(double x, double y, const struct Map_info *Map,
-                       int area, struct bound_box box)
+                       int area, struct bound_box *box)
 {
     int i, isle;
     const struct Plus_head *Plus;
@@ -363,7 +363,7 @@
     for (i = 0; i < Area->n_isles; i++) {
 	isle = Area->isles[i];
 	Vect_get_isle_box(Map, isle, &ibox);
-	poly = Vect_point_in_island(x, y, Map, isle, ibox);
+	poly = Vect_point_in_island(x, y, Map, isle, &ibox);
 	if (poly >= 1)
 	    return 0;		/* excludes island boundary (poly == 2), OK? */
     }

Modified: grass/trunk/lib/vector/Vlib/bridges.c
===================================================================
--- grass/trunk/lib/vector/Vlib/bridges.c	2012-08-05 08:12:45 UTC (rev 52534)
+++ grass/trunk/lib/vector/Vlib/bridges.c	2012-08-05 08:14:14 UTC (rev 52535)
@@ -133,7 +133,7 @@
 	while (1) {
 	    next_line =
 		dig_angle_next_line(Plus, current_line, GV_RIGHT,
-				    GV_BOUNDARY);
+				    GV_BOUNDARY, NULL);
 
 	    /* Add this line to the list */
 	    /* TODO: Vect_val_in_list() and Vect_list_append() behave O(n)

Modified: grass/trunk/lib/vector/Vlib/find.c
===================================================================
--- grass/trunk/lib/vector/Vlib/find.c	2012-08-05 08:12:45 UTC (rev 52534)
+++ grass/trunk/lib/vector/Vlib/find.c	2012-08-05 08:14:14 UTC (rev 52535)
@@ -38,8 +38,8 @@
     
     if (as->size < bs->size)
 	return -1;
-    else
-	return (as->size > bs->size);
+
+    return (as->size > bs->size);
 }
 
 
@@ -264,17 +264,15 @@
 int Vect_find_area(struct Map_info *Map, double x, double y)
 {
     int i, ret, area;
-    static int first = 1;
     struct bound_box box;
-    static struct boxlist *List;
+    static struct boxlist *List = NULL;
     static BOX_SIZE *size_list;
     static int alloc_size_list = 0;
 
     G_debug(3, "Vect_find_area() x = %f y = %f", x, y);
 
-    if (first) {
+    if (!List) {
 	List = Vect_new_boxlist(1);
-	first = 0;
 	alloc_size_list = 10;
 	size_list = G_malloc(alloc_size_list * sizeof(BOX_SIZE));
     }
@@ -316,7 +314,7 @@
 
     for (i = 0; i < List->n_values; i++) {
 	area = size_list[i].i;
-	ret = Vect_point_in_area(x, y, Map, area, size_list[i].box);
+	ret = Vect_point_in_area(x, y, Map, area, &size_list[i].box);
 
 	G_debug(3, "    area = %d Vect_point_in_area() = %d", area, ret);
 
@@ -366,7 +364,7 @@
     current = 0;
     for (i = 0; i < List->n_values; i++) {
 	island = List->id[i];
-	ret = Vect_point_in_island(x, y, Map, island, List->box[i]);
+	ret = Vect_point_in_island(x, y, Map, island, &List->box[i]);
 
 	if (ret >= 1) {		/* inside */
 	    if (current > 0) {	/* not first */

Modified: grass/trunk/lib/vector/Vlib/poly.c
===================================================================
--- grass/trunk/lib/vector/Vlib/poly.c	2012-08-05 08:12:45 UTC (rev 52534)
+++ grass/trunk/lib/vector/Vlib/poly.c	2012-08-05 08:14:14 UTC (rev 52535)
@@ -684,7 +684,7 @@
  */
 int
 Vect_point_in_area_outer_ring(double X, double Y, const struct Map_info *Map,
-			      int area, struct bound_box box)
+			      int area, struct bound_box *box)
 {
     static int first = 1;
     int n_intersects, inter;
@@ -706,7 +706,7 @@
     Area = Plus->Area[area];
 
     /* First it must be in box */
-    if (X < box.W || X > box.E || Y > box.N || Y < box.S)
+    if (X < box->W || X > box->E || Y > box->N || Y < box->S)
 	return 0;
 
     n_intersects = 0;
@@ -757,7 +757,7 @@
    \return 2 - on the boundary (exactly may be said only for vertex of vertical/horizontal line)
  */
 int Vect_point_in_island(double X, double Y, const struct Map_info *Map,
-                         int isle, struct bound_box box)
+                         int isle, struct bound_box *box)
 {
     static int first = 1;
     int n_intersects, inter;
@@ -777,7 +777,7 @@
     Plus = &(Map->plus);
     Isle = Plus->Isle[isle];
 
-    if (X < box.W || X > box.E || Y > box.N || Y < box.S)
+    if (X < box->W || X > box->E || Y > box->N || Y < box->S)
 	return 0;
 
     n_intersects = 0;

Modified: grass/trunk/lib/vector/Vlib/write_nat.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_nat.c	2012-08-05 08:12:45 UTC (rev 52534)
+++ grass/trunk/lib/vector/Vlib/write_nat.c	2012-08-05 08:14:14 UTC (rev 52535)
@@ -180,11 +180,11 @@
 		if (!s)
 		    next_line =
 			dig_angle_next_line(plus, line, GV_RIGHT,
-					    GV_BOUNDARY);
+					    GV_BOUNDARY, NULL);
 		else
 		    next_line =
 			dig_angle_next_line(plus, -line, GV_RIGHT,
-					    GV_BOUNDARY);
+					    GV_BOUNDARY, NULL);
 		
 		if (next_line != 0) {	/* there is a boundary to the right */
 		    NLine = plus->Line[abs(next_line)];
@@ -707,25 +707,25 @@
 	/* Adjacent are stored: > 0 - we want right side; < 0 - we want left side */
 	n_adjacent = 0;
 
-	next_line = dig_angle_next_line(plus, line, GV_RIGHT, GV_BOUNDARY);
+	next_line = dig_angle_next_line(plus, line, GV_RIGHT, GV_BOUNDARY, NULL);
 	if (next_line != 0 && abs(next_line) != line) {
 	    /* N1, to the right -> we want the right side for > 0  and left for < 0 */
 	    adjacent[n_adjacent] = next_line;
 	    n_adjacent++;
 	}
-	next_line = dig_angle_next_line(plus, line, GV_LEFT, GV_BOUNDARY);
+	next_line = dig_angle_next_line(plus, line, GV_LEFT, GV_BOUNDARY, NULL);
 	if (next_line != 0 && abs(next_line) != line) {
 	    /* N1, to the left -> we want the left side for > 0  and right for < 0 */
 	    adjacent[n_adjacent] = -next_line;
 	    n_adjacent++;
 	}
-	next_line = dig_angle_next_line(plus, -line, GV_RIGHT, GV_BOUNDARY);
+	next_line = dig_angle_next_line(plus, -line, GV_RIGHT, GV_BOUNDARY, NULL);
 	if (next_line != 0 && abs(next_line) != line) {
 	    /* N2, to the right -> we want the right side for > 0  and left for < 0 */
 	    adjacent[n_adjacent] = next_line;
 	    n_adjacent++;
 	}
-	next_line = dig_angle_next_line(plus, -line, GV_LEFT, GV_BOUNDARY);
+	next_line = dig_angle_next_line(plus, -line, GV_LEFT, GV_BOUNDARY, NULL);
 	if (next_line != 0 && abs(next_line) != line) {
 	    /* N2, to the left -> we want the left side for > 0  and right for < 0 */
 	    adjacent[n_adjacent] = -next_line;



More information about the grass-commit mailing list