[GRASS-SVN] r41928 - grass/trunk/vector/v.extract
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 20 05:46:44 EDT 2010
Author: mmetz
Date: 2010-04-20 05:46:43 -0400 (Tue, 20 Apr 2010)
New Revision: 41928
Modified:
grass/trunk/vector/v.extract/extract.c
Log:
extract centroids for type=area and layer=-1
Modified: grass/trunk/vector/v.extract/extract.c
===================================================================
--- grass/trunk/vector/v.extract/extract.c 2010-04-19 18:18:03 UTC (rev 41927)
+++ grass/trunk/vector/v.extract/extract.c 2010-04-20 09:46:43 UTC (rev 41928)
@@ -162,7 +162,7 @@
struct Map_info *Out, int new, int select_type, int dissolve,
int field, int type_only, int reverse)
{
- int line;
+ int line, nlines;
struct line_pnts *Points;
struct line_cats *Line_Cats_Old, *CCats;
@@ -188,7 +188,8 @@
qsort(cats_array, ncats_array, sizeof(int), cmp);
/* Cycle through all lines */
- for (line = 1; line <= Vect_get_num_lines(In); line++) {
+ nlines = Vect_get_num_lines(In);
+ for (line = 1; line <= nlines; line++) {
/* default values */
left_area = right_area = 0;
left_field_match = right_field_match = 0;
@@ -197,6 +198,7 @@
centroid_in_area = 0;
write = 0;
+ G_percent(line, nlines, 2);
G_debug(3, "Line = %d", line);
/* Get data */
@@ -206,7 +208,8 @@
if (type & select_type)
type_match = 1;
- field_match = Vect_cat_get(Line_Cats_Old, field, &tmp);
+ if (field > 0)
+ field_match = Vect_cat_get(Line_Cats_Old, field, &tmp);
for (i = 0; i < Line_Cats_Old->n_cats; i++) {
G_debug(3, "field = %d cat = %d", Line_Cats_Old->field[i],
@@ -289,7 +292,7 @@
/* centroid */
if ((type == GV_CENTROID && (select_type & GV_AREA)) &&
- !(centroid_in_area && field_match))
+ !centroid_in_area)
write = 0;
/* areas */
More information about the grass-commit
mailing list