[GRASS-SVN] r44218 - grass/branches/develbranch_6/vector/v.select
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Nov 7 12:40:50 EST 2010
Author: martinl
Date: 2010-11-07 09:40:50 -0800 (Sun, 07 Nov 2010)
New Revision: 44218
Modified:
grass/branches/develbranch_6/vector/v.select/args.c
grass/branches/develbranch_6/vector/v.select/description.html
grass/branches/develbranch_6/vector/v.select/main.c
grass/branches/develbranch_6/vector/v.select/proto.h
Log:
v.select: simplify module interface (no geos flag)
(merge r44216 from trunk)
Modified: grass/branches/develbranch_6/vector/v.select/args.c
===================================================================
--- grass/branches/develbranch_6/vector/v.select/args.c 2010-11-07 17:37:50 UTC (rev 44217)
+++ grass/branches/develbranch_6/vector/v.select/args.c 2010-11-07 17:40:50 UTC (rev 44218)
@@ -47,23 +47,25 @@
_("A feature is written to output if the result of operation 'ainput operator binput' is true. "
"An input feature is considered to be true, if category of given layer is defined.");
parm->operator->answer = "overlap";
+ parm->operator->guisection = _("Required");
#ifndef HAVE_GEOS
parm->operator->options = "overlap";
parm->operator->descriptions = _("overlap;features partially or completely overlap");
parm->relate = NULL;
#else
- parm->operator->options = "equals,disjoint,intersects,touches,crosses,within,contains,overlap,relate";
- parm->operator->descriptions = _("equals;features are spatially equals (requires flag 'g');"
- "disjoint;features do not spatially intersect (requires flag 'g');"
- "intersects;features spatially intersect (requires flag 'g');"
- "touches;features spatially touches (requires flag 'g');"
- "crosses;features spatially crosses (requires flag 'g');"
- "within;feature A is completely inside feature B (requires flag 'g');"
- "contains;feature B is completely inside feature A (requires flag 'g');"
- "overlap;features spatilly overlap;"
- "relate;feature A is spatially related to feature B "
- "(requires 'relate' option and flag 'g');");
+ parm->operator->options = "overlap,equals,disjoint,intersects,touches,crosses,within,contains,overlaps,relate";
+ parm->operator->descriptions = _("overlap;features partially or completely overlap;"
+ "equals;features are spatially equals (using GEOS);"
+ "disjoint;features do not spatially intersect (using GEOS);"
+ "intersects;features spatially intersect (using GEOS);"
+ "touches;features spatially touches (using GEOS);"
+ "crosses;features spatially crosses (using GEOS);"
+ "within;feature A is completely inside feature B (using GEOS);"
+ "contains;feature B is completely inside feature A (using GEOS);"
+ "overlaps;features spatially overlap (using GEOS);"
+ "relate;feature A is spatially related to feature B (using GEOS, "
+ "requires 'relate' option);");
parm->relate = G_define_option();
parm->relate->key = "relate";
@@ -85,11 +87,4 @@
flag->reverse->key = 'r';
flag->reverse->description = _("Reverse selection");
flag->reverse->guisection = _("Selection");
-#ifdef HAVE_GEOS
- flag->geos = G_define_flag();
- flag->geos->key = 'g';
- flag->geos->description = _("Use GEOS operators");
-#else
- flag->geos = NULL;
-#endif
}
Modified: grass/branches/develbranch_6/vector/v.select/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.select/description.html 2010-11-07 17:37:50 UTC (rev 44217)
+++ grass/branches/develbranch_6/vector/v.select/description.html 2010-11-07 17:40:50 UTC (rev 44218)
@@ -18,7 +18,7 @@
<li><tt>crosses</tt> - features spatially crosses</li>
<li><tt>within</tt> - feature A is completely inside feature B</li>
<li><tt>contains</tt> - feature B is completely inside feature A</li>
- <li><tt>overlap</tt> - features spatially overlap</li>
+ <li><tt>overlaps</tt> - features spatially overlap</li>
<li><tt>relate</tt> - feature A is spatially related to feature B</li>
</ul>
@@ -54,7 +54,7 @@
</pre></div>
<h2>TODO</h2>
-
+
Processing areas with GEOS is currently incredibly slow. Significant
speed-up is required.
Modified: grass/branches/develbranch_6/vector/v.select/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.select/main.c 2010-11-07 17:37:50 UTC (rev 44217)
+++ grass/branches/develbranch_6/vector/v.select/main.c 2010-11-07 17:40:50 UTC (rev 44218)
@@ -75,18 +75,17 @@
operator = OP_WITHIN;
else if (parm.operator->answer[0] == 'c' && parm.operator->answer[1] == 'o')
operator = OP_CONTAINS;
- else if (parm.operator->answer[0] == 'o')
- operator = OP_OVERLAPS;
+ else if (parm.operator->answer[0] == 'o') {
+ if (strcmp(parm.operator->answer, "overlaps") == 0)
+ operator = OP_OVERLAPS;
+ else
+ operator = OP_OVERLAP;
+ }
else if (parm.operator->answer[0] == 'r')
operator = OP_RELATE;
else
G_fatal_error(_("Unknown operator"));
- if (operator != OP_OVERLAPS && flag.geos && !flag.geos->answer) {
- G_fatal_error(_("Enable GEOS operators (flag '%c') to use '%s'"),
- flag.geos->key, parm.operator->answer);
- }
-
if (operator == OP_RELATE && !parm.relate->answer) {
G_fatal_error(_("Required parameter <%s> not set"),
parm.relate->key);
@@ -162,7 +161,7 @@
}
/* Read line and check type */
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
AGeom = Vect_read_line_geos(&(In[0]), aline, <ype);
#endif
@@ -204,7 +203,7 @@
continue;
}
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
if(line_relate_geos(&(In[1]), AGeom,
bline, operator, parm.relate->answer)) {
@@ -246,7 +245,7 @@
continue;
}
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
if(area_relate_geos(&(In[1]), AGeom,
barea, operator, parm.relate->answer)) {
@@ -263,7 +262,7 @@
}
}
}
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
GEOSGeom_destroy(AGeom);
#endif
@@ -294,7 +293,7 @@
abox.T = PORT_DOUBLE_MAX;
abox.B = -PORT_DOUBLE_MAX;
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
AGeom = Vect_read_area_geos(&(In[0]), aarea);
#endif
@@ -317,7 +316,7 @@
continue;
}
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
if(line_relate_geos(&(In[1]), AGeom,
bline, operator, parm.relate->answer)) {
@@ -386,7 +385,7 @@
bcentroid = Vect_get_area_centroid(&(In[1]), barea);
Vect_read_line(&(In[1]), BPoints, NULL, bcentroid);
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
if(area_relate_geos(&(In[1]), AGeom,
barea, operator, parm.relate->answer)) {
@@ -416,7 +415,7 @@
}
}
}
- if (flag.geos && flag.geos->answer) {
+ if (operator != OP_OVERLAP) {
#ifdef HAVE_GEOS
GEOSGeom_destroy(AGeom);
#endif
Modified: grass/branches/develbranch_6/vector/v.select/proto.h
===================================================================
--- grass/branches/develbranch_6/vector/v.select/proto.h 2010-11-07 17:37:50 UTC (rev 44217)
+++ grass/branches/develbranch_6/vector/v.select/proto.h 2010-11-07 17:40:50 UTC (rev 44218)
@@ -9,14 +9,15 @@
#define OP_WITHIN 5
#define OP_CONTAINS 6
#define OP_OVERLAPS 7
-#define OP_RELATE 8
+#define OP_OVERLAP 8
+#define OP_RELATE 9
struct GParm {
struct Option *input[2], *output, *type[2], *field[2],
*operator, *relate;
};
struct GFlag {
- struct Flag *table, *reverse, *geos, *cat;
+ struct Flag *table, *reverse, *cat;
};
/* args.c */
More information about the grass-commit
mailing list