浏览代码

v.overlay output is 2D

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55907 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 12 年之前
父节点
当前提交
5b317320c8
共有 1 个文件被更改,包括 17 次插入2 次删除
  1. 17 2
      vector/v.overlay/main.c

+ 17 - 2
vector/v.overlay/main.c

@@ -33,7 +33,7 @@
 
 int main(int argc, char *argv[])
 {
-    int i, input, line, nlines, operator;
+    int i, j, input, line, nlines, operator;
     int type[2], field[2], ofield[3];
     double snap_thresh;
     struct GModule *module;
@@ -251,7 +251,22 @@ int main(int argc, char *argv[])
 	    }
 	    
 	    /* lines and boundaries must have at least 2 distinct vertices */
-	    Vect_line_prune(Points);
+	    /* Vect_line_prune(Points); */
+
+	    if (Points->n_points > 0) {
+		j = 1;
+		for (i = 1; i < Points->n_points; i++) {
+		    Points->z[i] = 0;	/* Tmp, Out are 2D */
+		    if (Points->x[i] != Points->x[j - 1] ||
+			Points->y[i] != Points->y[j - 1]) {
+			Points->x[j] = Points->x[i];
+			Points->y[j] = Points->y[i];
+			j++;
+		    }
+		}
+		Points->n_points = j;
+	    }
+
 	    if (Points->n_points < 2)
 		continue;