Selaa lähdekoodia

wxGUI/vdigit: bug fix in GetRegionSelected()
(merge from devbr6, https://trac.osgeo.org/grass/changeset/33197, https://trac.osgeo.org/grass/changeset/33198)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33199 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 vuotta sitten
vanhempi
commit
ffc850a3cb
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4 3
      gui/wxpython/vdigit/driver_select.cpp

+ 4 - 3
gui/wxpython/vdigit/driver_select.cpp

@@ -415,7 +415,7 @@ std::vector<int> DisplayDriver::GetSelectedVertex(double x, double y, double thr
 */
 std::vector<int> DisplayDriver::GetRegionSelected()
 {
-    int line, area;
+    int line, area, nareas;
     
     std::vector<int> region;
 
@@ -437,7 +437,7 @@ std::vector<int> DisplayDriver::GetRegionSelected()
 	*/
 	int type;
 	bool found;
-	for (int line = 1; line < Vect_get_num_lines(mapInfo); line++) {
+	for (int line = 1; line <= Vect_get_num_lines(mapInfo); line++) {
 	    type = Vect_read_line (mapInfo, NULL, cats, line);
 	    if (!(type & (GV_POINTS | GV_LINES)))
 		continue;
@@ -457,11 +457,12 @@ std::vector<int> DisplayDriver::GetRegionSelected()
 	list = selected.values;
     }
 
+    nareas = Vect_get_num_areas(mapInfo);
     for (int i = 0; i < list->n_values; i++) {
 	line = list->value[i];
 	area = Vect_get_centroid_area(mapInfo, line);
 
-	if (area > 0) {
+	if (area > 0 && area <= nareas) {
 	    if (!Vect_get_area_box(mapInfo, area, &line_box))
 		continue;
 	}