Przeglądaj źródła

vlib: Vect_get_line_box(): set T/B to PORT_DOUBLE_MAX for 2D data

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47917 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 lat temu
rodzic
commit
6b34bd8eac
2 zmienionych plików z 8 dodań i 13 usunięć
  1. 7 7
      lib/vector/Vlib/box.c
  2. 1 6
      lib/vector/diglib/box.c

+ 7 - 7
lib/vector/Vlib/box.c

@@ -213,12 +213,7 @@ int Vect_get_line_box(const struct Map_info *Map, int line, struct bound_box * B
     Line = Plus->Line[line];
 
     if (Line == NULL) {		/* dead */
-	Box->N = 0;
-	Box->S = 0;
-	Box->E = 0;
-	Box->W = 0;
-	Box->T = 0;
-	Box->B = 0;
+	G_zero(Box, sizeof(struct bound_box));
 	return 0;
     }
     else {
@@ -263,7 +258,7 @@ int Vect_get_line_box(const struct Map_info *Map, int line, struct bound_box * B
 	    dig_boxlist_add(list, line, bbox);
 	    
 	    if (dig_find_line_box(Plus, list) == 0)
-		G_fatal_error(_("Could not find line box"));
+		G_fatal_error(_("Unable to find bbox for featured %d"), line);
 
 	    Box->N = list->box[0].N;
 	    Box->S = list->box[0].S;
@@ -274,6 +269,11 @@ int Vect_get_line_box(const struct Map_info *Map, int line, struct bound_box * B
 	}
     }
 
+    if (!Vect_is_3d(Map)) {
+	Box->T =  PORT_DOUBLE_MAX;
+	Box->B = -PORT_DOUBLE_MAX;
+    }
+
     return 1;
 }
 

+ 1 - 6
lib/vector/diglib/box.c

@@ -26,12 +26,7 @@ int dig_line_box(const struct line_pnts *Points, struct bound_box * Box)
     int i;
 
     if (Points->n_points <= 0) {
-	Box->N = 0;
-	Box->S = 0;
-	Box->E = 0;
-	Box->W = 0;
-	Box->T = 0;
-	Box->B = 0;
+	G_zero(Box, sizeof(struct bound_box));
 	return 0;
     }