[GRASS-SVN] r45225 - grass/branches/releasebranch_6_4/vector/v.digit
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 28 05:08:27 EST 2011
Author: marisn
Date: 2011-01-28 02:08:27 -0800 (Fri, 28 Jan 2011)
New Revision: 45225
Modified:
grass/branches/releasebranch_6_4/vector/v.digit/vertex.c
Log:
v.digit Delete line if it has less than two verticles (fixes #1256 merge from devel6 r44914)
Modified: grass/branches/releasebranch_6_4/vector/v.digit/vertex.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.digit/vertex.c 2011-01-27 15:33:09 UTC (rev 45224)
+++ grass/branches/releasebranch_6_4/vector/v.digit/vertex.c 2011-01-28 10:08:27 UTC (rev 45225)
@@ -243,14 +243,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