[GRASS-SVN] r62357 - in grass/branches/releasebranch_7_0: . vector/v.select
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Oct 22 06:16:38 PDT 2014
Author: martinl
Date: 2014-10-22 06:16:38 -0700 (Wed, 22 Oct 2014)
New Revision: 62357
Modified:
grass/branches/releasebranch_7_0/
grass/branches/releasebranch_7_0/vector/v.select/main.c
grass/branches/releasebranch_7_0/vector/v.select/proto.h
grass/branches/releasebranch_7_0/vector/v.select/select.c
Log:
v.select: print info about skipped features separately for ainput and binput
(merge r62356 from trunk)
Property changes on: grass/branches/releasebranch_7_0
___________________________________________________________________
Modified: svn:mergeinfo
- /grass/trunk:62346,62352,62354
+ /grass/trunk:62346,62352,62354,62356
Modified: grass/branches/releasebranch_7_0/vector/v.select/main.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.select/main.c 2014-10-22 13:12:33 UTC (rev 62356)
+++ grass/branches/releasebranch_7_0/vector/v.select/main.c 2014-10-22 13:16:38 UTC (rev 62357)
@@ -29,7 +29,7 @@
{
int iopt;
int operator;
- int nskipped, native;
+ int nskipped[2], native;
int itype[2], ifield[2];
int *ALines; /* List of lines: 0 do not output, 1 - write to output */
@@ -121,21 +121,19 @@
/* Select features */
#ifdef HAVE_GEOS
- nskipped = select_lines(&(In[0]), itype[0], ifield[0],
- &(In[1]), itype[1], ifield[1],
- flag.cat->answer ? 1 : 0, operator,
- parm.relate->answer,
- ALines);
+ select_lines(&(In[0]), itype[0], ifield[0],
+ &(In[1]), itype[1], ifield[1],
+ flag.cat->answer ? 1 : 0, operator,
+ parm.relate->answer,
+ ALines, nskipped);
#else
- nskipped = select_lines(&(In[0]), itype[0], ifield[0],
- &(In[1]), itype[1], ifield[1],
- flag.cat->answer ? 1 : 0, operator,
- NULL,
- ALines);
+ select_lines(&(In[0]), itype[0], ifield[0],
+ &(In[1]), itype[1], ifield[1],
+ flag.cat->answer ? 1 : 0, operator,
+ NULL,
+ ALines, nskipped);
#endif
- Vect_close(&(In[1]));
-
#ifdef HAVE_GEOS
finishGEOS();
#endif
@@ -162,16 +160,19 @@
copy_tabs(&(In[0]), &Out,
nfields, fields, ncats, cats);
}
-
- Vect_close(&(In[0]));
+ /* print info about skipped features & close input maps */
+ for (iopt = 0; iopt < 2; iopt++) {
+ if (nskipped[iopt] > 0) {
+ G_warning(_("%d features from <%s> without category skipped"),
+ nskipped[iopt], Vect_get_full_name(&(In[iopt])));
+ }
+ Vect_close(&(In[iopt]));
+ }
+
Vect_build(&Out);
Vect_close(&Out);
- if (nskipped > 0) {
- G_warning(_("%d features without category skipped"), nskipped);
- }
-
G_done_msg(_("%d features written to output."), Vect_get_num_lines(&Out));
exit(EXIT_SUCCESS);
Modified: grass/branches/releasebranch_7_0/vector/v.select/proto.h
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.select/proto.h 2014-10-22 13:12:33 UTC (rev 62356)
+++ grass/branches/releasebranch_7_0/vector/v.select/proto.h 2014-10-22 13:16:38 UTC (rev 62357)
@@ -36,9 +36,9 @@
#endif
/* select.c */
-int select_lines(struct Map_info *, int, int,
- struct Map_info *, int, int,
- int, int, const char *, int *);
+void select_lines(struct Map_info *, int, int,
+ struct Map_info *, int, int,
+ int, int, const char *, int *, int*);
/* overlap.c */
void add_aarea(struct Map_info *, int, int *);
Modified: grass/branches/releasebranch_7_0/vector/v.select/select.c
===================================================================
--- grass/branches/releasebranch_7_0/vector/v.select/select.c 2014-10-22 13:12:33 UTC (rev 62356)
+++ grass/branches/releasebranch_7_0/vector/v.select/select.c 2014-10-22 13:16:38 UTC (rev 62357)
@@ -6,13 +6,13 @@
#include "proto.h"
-int select_lines(struct Map_info *aIn, int atype, int afield,
- struct Map_info *bIn, int btype, int bfield,
- int cat_flag, int operator, const char *relate,
- int *ALines)
+void select_lines(struct Map_info *aIn, int atype, int afield,
+ struct Map_info *bIn, int btype, int bfield,
+ int cat_flag, int operator, const char *relate,
+ int *ALines, int* nskipped)
{
int i;
- int nalines, aline, nskipped, ltype;
+ int nalines, aline, ltype;
struct line_pnts *APoints, *BPoints;
struct ilist *BoundList, *LList;
@@ -25,7 +25,7 @@
void *AGeom = NULL;
#endif
- nskipped = 0;
+ nskipped[0] = nskipped[1] = 0;
APoints = Vect_new_line_struct();
BPoints = Vect_new_line_struct();
List = Vect_new_boxlist(1);
@@ -51,7 +51,7 @@
/* Check category */
if (!cat_flag && Vect_get_line_cat(aIn, aline, afield) < 0) {
- nskipped++;
+ nskipped[0]++;
continue;
}
@@ -92,7 +92,7 @@
/* Check category */
if (!cat_flag &&
Vect_get_line_cat(bIn, bline, bfield) < 0) {
- nskipped++;
+ nskipped[1]++;
continue;
}
@@ -133,7 +133,7 @@
G_debug(3, " barea = %d", barea);
if (Vect_get_area_cat(bIn, barea, bfield) < 0) {
- nskipped++;
+ nskipped[1]++;
continue;
}
@@ -177,7 +177,7 @@
G_percent(aarea, naareas, 2); /* must be before any continue */
if (Vect_get_area_cat(aIn, aarea, afield) < 0) {
- nskipped++;
+ nskipped[0]++;
continue;
}
@@ -205,7 +205,7 @@
if (!cat_flag &&
Vect_get_line_cat(bIn, bline, bfield) < 0) {
- nskipped++;
+ nskipped[1]++;
continue;
}
@@ -269,7 +269,7 @@
G_debug(3, " barea = %d", barea);
if (Vect_get_area_cat(bIn, barea, bfield) < 0) {
- nskipped++;
+ nskipped[1]++;
continue;
}
@@ -331,5 +331,5 @@
Vect_destroy_boxlist(List);
Vect_destroy_boxlist(TmpList);
- return nskipped;
+ return;
}
More information about the grass-commit
mailing list