[mapserver-commits] r7696 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Jun 18 18:43:53 EDT 2008
Author: Assefa
Date: 2008-06-18 18:43:53 -0400 (Wed, 18 Jun 2008)
New Revision: 7696
Modified:
trunk/mapserver/mapogcfilter.c
trunk/mapserver/mapquery.c
trunk/mapserver/mapserver.h
Log:
Filter Encoding: Modify DWithin definition (#2564)
Modified: trunk/mapserver/mapogcfilter.c
===================================================================
--- trunk/mapserver/mapogcfilter.c 2008-06-18 21:40:51 UTC (rev 7695)
+++ trunk/mapserver/mapogcfilter.c 2008-06-18 22:43:53 UTC (rev 7696)
@@ -88,8 +88,7 @@
return MS_GEOS_TOUCHES;
else if (strcasecmp(pszValue, "Crosses") == 0)
return MS_GEOS_CROSSES;
- else if (strcasecmp(pszValue, "Within") == 0 ||
- strcasecmp(pszValue, "DWithin") == 0)
+ else if (strcasecmp(pszValue, "Within") == 0)
return MS_GEOS_WITHIN;
else if (strcasecmp(pszValue, "Contains") == 0)
return MS_GEOS_CONTAINS;
@@ -97,6 +96,8 @@
return MS_GEOS_OVERLAPS;
else if (strcasecmp(pszValue, "Beyond") == 0)
return MS_GEOS_BEYOND;
+ else if (strcasecmp(pszValue, "DWithin") == 0)
+ return MS_GEOS_DWITHIN;
return -1;
}
@@ -318,7 +319,8 @@
else if (bPointQuery && psQueryShape && psQueryShape->numlines > 0
&& psQueryShape->line[0].numpoints > 0) /* && dfDistance >=0) */
{
- if (bUseGeos)
+
+ if (bUseGeos)
{
if ((strcasecmp(psNode->pszValue, "DWithin") == 0 ||
strcasecmp(psNode->pszValue, "Beyond") == 0 ) &&
Modified: trunk/mapserver/mapquery.c
===================================================================
--- trunk/mapserver/mapquery.c 2008-06-18 21:40:51 UTC (rev 7695)
+++ trunk/mapserver/mapquery.c 2008-06-18 22:43:53 UTC (rev 7696)
@@ -1217,7 +1217,7 @@
/************************************************************************/
/* msQueryByOperator */
/* */
-/* uary using a shape and a valid operator : all queries are */
+/* query using a shape and a valid operator : all queries are */
/* done using geos. */
/************************************************************************/
int msQueryByOperator(mapObj *map, int qlayer, shapeObj *selectshape,
@@ -1227,11 +1227,12 @@
int start, stop=0, l;
shapeObj shape;
layerObj *lp;
- char status;
+ int status;
rectObj searchrect;
int nclasses = 0;
int *classgroup = NULL;
+ double dfValue;
msInitShape(&shape);
@@ -1394,16 +1395,24 @@
status = MS_FALSE;
break;
- /*beyond is opposite of dwith use in filter encoding
- see ticket 2105*/
+ /*beyond is opposite of dwithin use in filter encoding
+ see ticket 2105, 2564*/
case MS_GEOS_BEYOND:
- status = msGEOSWithin(&shape, selectshape);
- if (status != MS_TRUE && status != MS_FALSE)
- status = MS_FALSE;
- else
- status = !status;
+ status = MS_FALSE;
+ dfValue = msGEOSDistance(&shape, selectshape);
+ if (dfValue > 0.0)
+ status = MS_TRUE;
break;
+ /*dwithin is used with filter encoding (#2564)*/
+ case MS_GEOS_DWITHIN:
+ status = MS_FALSE;
+ dfValue = msGEOSDistance(&shape, selectshape);
+ if (dfValue == 0.0)
+ status = MS_TRUE;
+
+ break;
+
default:
msSetError(MS_QUERYERR, "Unknown GEOS Operator.", "msQueryByOperator()");
return(MS_FAILURE);
Modified: trunk/mapserver/mapserver.h
===================================================================
--- trunk/mapserver/mapserver.h 2008-06-18 21:40:51 UTC (rev 7695)
+++ trunk/mapserver/mapserver.h 2008-06-18 22:43:53 UTC (rev 7696)
@@ -350,7 +350,7 @@
enum MS_RETURN_VALUE {MS_SUCCESS, MS_FAILURE, MS_DONE};
enum MS_IMAGEMODE { MS_IMAGEMODE_PC256, MS_IMAGEMODE_RGB, MS_IMAGEMODE_RGBA, MS_IMAGEMODE_INT16, MS_IMAGEMODE_FLOAT32, MS_IMAGEMODE_BYTE, MS_IMAGEMODE_NULL };
-enum MS_GEOS_OPERATOR {MS_GEOS_EQUALS, MS_GEOS_DISJOINT, MS_GEOS_TOUCHES, MS_GEOS_OVERLAPS, MS_GEOS_CROSSES, MS_GEOS_INTERSECTS, MS_GEOS_WITHIN, MS_GEOS_CONTAINS, MS_GEOS_BEYOND};
+ enum MS_GEOS_OPERATOR {MS_GEOS_EQUALS, MS_GEOS_DISJOINT, MS_GEOS_TOUCHES, MS_GEOS_OVERLAPS, MS_GEOS_CROSSES, MS_GEOS_INTERSECTS, MS_GEOS_WITHIN, MS_GEOS_CONTAINS, MS_GEOS_BEYOND, MS_GEOS_DWITHIN};
#define MS_FILE_DEFAULT MS_FILE_MAP
#ifndef SWIG
More information about the mapserver-commits
mailing list