[GRASS-SVN] r44914 - grass/branches/develbranch_6/vector/v.digit
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jan 9 15:13:20 EST 2011
Author: marisn
Date: 2011-01-09 12:13:20 -0800 (Sun, 09 Jan 2011)
New Revision: 44914
Modified:
grass/branches/develbranch_6/vector/v.digit/vertex.c
Log:
v.digit Delete line if it has less than two verticles (fixes #1256)
Modified: grass/branches/develbranch_6/vector/v.digit/vertex.c
===================================================================
--- grass/branches/develbranch_6/vector/v.digit/vertex.c 2011-01-09 14:54:57 UTC (rev 44913)
+++ grass/branches/develbranch_6/vector/v.digit/vertex.c 2011-01-09 20:13:20 UTC (rev 44914)
@@ -244,14 +244,23 @@
type = Vect_read_line(&Map, rv->Points, rv->Cats, rv->last_line);
np = rv->Points->n_points;
- for (i = rv->last_seg; i < np - 1; i++) {
- rv->Points->x[i] = rv->Points->x[i + 1];
- rv->Points->y[i] = rv->Points->y[i + 1];
- rv->Points->z[i] = rv->Points->z[i + 1];
+
+ /* Lines should have at least two vertices (start and end node). */
+ if (np < 3 && Vect_line_alive(&Map, rv->last_line)) {
+ Vect_delete_line(&Map, rv->last_line);
+ for (i = 0; i < rv->Cats->n_cats; i++) {
+ check_record(rv->Cats->field[i], rv->Cats->cat[i]);
+ }
+ } else {
+ for (i = rv->last_seg; i < np - 1; i++) {
+ rv->Points->x[i] = rv->Points->x[i + 1];
+ rv->Points->y[i] = rv->Points->y[i + 1];
+ rv->Points->z[i] = rv->Points->z[i + 1];
+ }
+ rv->Points->n_points--;
+ Vect_rewrite_line(&Map, rv->last_line, type, rv->Points,
+ rv->Cats);
}
- rv->Points->n_points--;
- Vect_rewrite_line(&Map, rv->last_line, type, rv->Points,
- rv->Cats);
updated_lines_and_nodes_erase_refresh_display();
rv->last_line = 0;
}
More information about the grass-commit
mailing list