浏览代码

potential bug avoided, cosmetics

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36406 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 16 年之前
父节点
当前提交
09146b64f4
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 2 0
      lib/vector/Vlib/build_nat.c
  2. 2 2
      lib/vector/diglib/poly.c

+ 2 - 0
lib/vector/Vlib/build_nat.c

@@ -82,7 +82,9 @@ int Vect_build_line_area(struct Map_info *Map, int iline, int side)
 	else
 	    direction = GV_BACKWARD;
 	Vect_append_points(APoints, Points, direction);
+	APoints->n_points--; /* skip last point, avoids duplicates */
     }
+    APoints->n_points++; /* close polygon */
 
     /* dig_find_area_poly(APoints, &area_size); */
 

+ 2 - 2
lib/vector/diglib/poly.c

@@ -154,11 +154,11 @@ double dig_find_poly_orientation(struct line_pnts *Points)
     /* find next distinct point */
     pnext = pcur + 1;
     while (pnext != pcur) {
-	if (pnext == npoints)
-	    pnext = 0;
 	if (x[pcur] != x[pnext] || y[pcur] != y[pnext])
 	    break;
 	pnext++;
+	if (pnext == npoints)
+	    pnext = 0;
     }
 
     /* find previous distinct point */