[mapserver-commits] r11438 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 31 16:40:24 EDT 2011


Author: tamas
Date: 2011-03-31 13:40:24 -0700 (Thu, 31 Mar 2011)
New Revision: 11438

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapcluster.c
Log:
fix for the cluster layer returning invalid feature count (#3794)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-03-31 16:26:58 UTC (rev 11437)
+++ trunk/mapserver/HISTORY.TXT	2011-03-31 20:40:24 UTC (rev 11438)
@@ -14,6 +14,8 @@
 
 Current Version (SVN trunk): 
 ---------------------------- 
+- fix for the cluster layer returning invalid feature count (#3794)
+
 - remove some compiler warnings
 
 - fix incorrect scaling of hatch symbol spacing (#3773)

Modified: trunk/mapserver/mapcluster.c
===================================================================
--- trunk/mapserver/mapcluster.c	2011-03-31 16:26:58 UTC (rev 11437)
+++ trunk/mapserver/mapcluster.c	2011-03-31 20:40:24 UTC (rev 11438)
@@ -140,8 +140,6 @@
 /* evaluate the filter expression */
 int msClusterEvaluateFilter(expressionObj* expression, shapeObj *shape)
 {
-    if(!expression->string) return 1; /* empty expressions are ALWAYS true */
-
     if (expression->type == MS_EXPRESSION)
     {
         int status;
@@ -283,7 +281,7 @@
     feature->group = NULL;
     feature->siblings = NULL;
     feature->index = layerinfo->numFeatures;
-    feature->filter = -1; // not yer calculated
+    feature->filter = -1; // not yet calculated
     ++layerinfo->numFeatures;
     return feature;
 }
@@ -514,13 +512,16 @@
 
         if (itemindexes[i] == MSCLUSTER_FEATURECOUNTINDEX)
         {
-            if (base->numsiblings > 0) 
-                base->shape.values[i] = msIntToString(base->numsiblings + 1);
-            else
-                base->shape.values[i] = msStrdup("");
+            if (base->shape.values[i])
+                msFree(base->shape.values[i]);
+
+            base->shape.values[i] = msIntToString(base->numsiblings + 1);
         }
         else if (itemindexes[i] == MSCLUSTER_GROUPINDEX)
         {
+            if (base->shape.values[i])
+                msFree(base->shape.values[i]);
+
             if (base->group) 
                 base->shape.values[i] = msStrdup(base->group);
             else
@@ -576,11 +577,11 @@
     {
         if (itemindexes[i] == MSCLUSTER_FEATURECOUNTINDEX)
         {
-            values[i] = msStrdup(""); // not yet assigned
+            values[i] = NULL; // not yet assigned
         }
         else if (itemindexes[i] == MSCLUSTER_GROUPINDEX)
         {
-            values[i] = msStrdup(""); // not yet assigned
+            values[i] = NULL; // not yet assigned
         }
         else if (shape->values[itemindexes[i]])
             values[i] = msStrdup(shape->values[itemindexes[i]]);
@@ -605,7 +606,7 @@
     clusterInfo* s = node->shapes;
     while (s)
     {
-        if (s->filter < 0)
+        if (s->filter < 0 && layer->cluster.filter.string != NULL)
         {
             InitShapeAttributes(layer, s);
             s->filter = msClusterEvaluateFilter(&layer->cluster.filter, &s->shape);
@@ -1077,6 +1078,9 @@
 
         if (layerinfo->current == NULL)
             break; /* completed */
+
+        /* Update the feature count of the shape */
+        InitShapeAttributes(layer, layerinfo->current);
         
         /* collecting the shapes of the cluster */
         collectClusterShapes(layerinfo, layerinfo->root, layerinfo->current);



More information about the mapserver-commits mailing list