Browse Source

Vlib: update for changed fn defs

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52535 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 years ago
parent
commit
46cd09da20

+ 2 - 2
lib/vector/Vlib/area.c

@@ -342,7 +342,7 @@ double Vect_area_perimeter(const struct line_pnts *Points)
    \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 @@ int Vect_point_in_area(double x, double y, const struct Map_info *Map,
     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? */
     }

+ 1 - 1
lib/vector/Vlib/bridges.c

@@ -133,7 +133,7 @@ remove_bridges(struct Map_info *Map, int chtype, struct Map_info *Err)
 	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)

+ 6 - 8
lib/vector/Vlib/find.c

@@ -38,8 +38,8 @@ static int sort_by_size(const void *a, const void *b)
     
     if (as->size < bs->size)
 	return -1;
-    else
-	return (as->size > bs->size);
+
+    return (as->size > bs->size);
 }
 
 
@@ -264,17 +264,15 @@ Vect_find_line_list(struct Map_info *map,
 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 @@ int Vect_find_area(struct Map_info *Map, double x, double y)
 
     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 @@ int Vect_find_island(struct Map_info *Map, double x, double y)
     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 */

+ 4 - 4
lib/vector/Vlib/poly.c

@@ -684,7 +684,7 @@ int Vect_point_in_poly(double X, double Y, const struct line_pnts *Points)
  */
 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 @@ Vect_point_in_area_outer_ring(double X, double Y, const struct Map_info *Map,
     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 @@ Vect_point_in_area_outer_ring(double X, double Y, const struct Map_info *Map,
    \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 @@ int Vect_point_in_island(double X, double Y, const struct Map_info *Map,
     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;

+ 6 - 6
lib/vector/Vlib/write_nat.c

@@ -180,11 +180,11 @@ static void V2__add_line_to_topo_nat(struct Map_info *Map, int line,
 		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 @@ int V2_delete_line_nat(struct Map_info *Map, int line)
 	/* 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;