[mapserver-commits] r7193 - branches/branch-5-0/mapserver

svn at osgeo.org svn at osgeo.org
Thu Dec 20 09:44:56 EST 2007


Author: Assefa
Date: 2007-12-20 09:44:56 -0500 (Thu, 20 Dec 2007)
New Revision: 7193

Modified:
   branches/branch-5-0/mapserver/mapogcfilter.c
Log:
Set the layer to be queryable when applying simple filters (#2450)

Modified: branches/branch-5-0/mapserver/mapogcfilter.c
===================================================================
--- branches/branch-5-0/mapserver/mapogcfilter.c	2007-12-19 18:31:01 UTC (rev 7192)
+++ branches/branch-5-0/mapserver/mapogcfilter.c	2007-12-20 14:44:56 UTC (rev 7193)
@@ -909,17 +909,19 @@
 #endif
     }
 
-    /* TODO: Doesn't this code leak the contents of any pre-existing class
-     * in the layer???
-     */
-    if (lp->numclasses == 0 &&
-        msGrowLayerClasses(lp) == NULL)
-        return MS_FAILURE;
-    lp->numclasses = 1; /* set 1 so the query would work */
-    initClass(lp->class[0]);
-    lp->class[0]->type = lp->type;
-    lp->class[0]->template = strdup("ttt.html");
+    /* make sure that the layer can be queried*/
+    if (!lp->template)
+      lp->template = strdup("ttt.html");
 
+    /* if there is no class, create at least one, so that query by rect
+       would work*/
+    if (lp->numclasses == 0)
+    {
+        if (msGrowLayerClasses(lp) == NULL)
+          return MS_FAILURE;
+        initClass(lp->class[0]);
+    }
+
     szExpression = FLTGetSQLExpression(psNode, lp);
     if (szExpression)
     {



More information about the mapserver-commits mailing list