[mapserver-commits] r11712 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sat May 14 16:34:13 EDT 2011


Author: tamas
Date: 2011-05-14 13:34:13 -0700 (Sat, 14 May 2011)
New Revision: 11712

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapcluster.c
Log:
Implement to get all shapes with the clustered layer (#3873)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-05-13 23:45:49 UTC (rev 11711)
+++ trunk/mapserver/HISTORY.TXT	2011-05-14 20:34:13 UTC (rev 11712)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 ------------------------------------------------- 
 
+- Implement to get all shapes with the clustered layer (#3873)
+
 - Union layer: Fixed the crash when styling source layers using attributes (#3870)
 
 - Added GEOS difference operator to expression support (#3871) 

Modified: trunk/mapserver/mapcluster.c
===================================================================
--- trunk/mapserver/mapcluster.c	2011-05-13 23:45:49 UTC (rev 11711)
+++ trunk/mapserver/mapcluster.c	2011-05-14 20:34:13 UTC (rev 11712)
@@ -115,6 +115,8 @@
     int numFiltered;
     /* variables for collecting the best cluster and iterating with NextShape */
     clusterInfo* current;
+    /* check whether all shapes should be returned behind a cluster */
+    int get_all_shapes;
     double rank;
     /* root node of the quad tree */
     clusterTreeNode* root;
@@ -962,6 +964,12 @@
 
     layerinfo->current = layerinfo->finalized; /* restart */
 
+    /* check whether all shapes should be returned from a query */
+    if(msLayerGetProcessingKey(layer, "CLUSTER_GET_ALL_SHAPES") != NULL) 
+        layerinfo->get_all_shapes = MS_TRUE;
+    else
+        layerinfo->get_all_shapes = MS_FALSE;  
+
     /* identify the current extent */
     if(layer->transform == MS_TRUE)
         searchrect = map->extent;
@@ -1149,11 +1157,29 @@
                     avgy += current->y;
                     ++n;
 #endif
+                    /* setting the average position to the same value */
+                    current->avgx = layerinfo->current->avgx;
+                    current->avgy = layerinfo->current->avgy;
+                            
+                    if (current->next == NULL)
+                    {
+                        if (layerinfo->get_all_shapes == MS_TRUE)
+                        {
+                            /* insert the siblings into the finalization list */
+                            current->next = layerinfo->finalized;
+                            layerinfo->finalized = layerinfo->finalizedSiblings;
+                        }
+                        else
+                        {
+                            /* preserve the clustered siblings for later use */
+                            layerinfo->current->siblings = layerinfo->finalizedSiblings;
+                        }
+                        break;
+                    }
+                    
                     current = current->next;
                 }
 
-                /* preserve the clustered siblings for later use */
-                layerinfo->current->siblings = layerinfo->finalizedSiblings;
                 layerinfo->finalizedSiblings = NULL;
             }
         }
@@ -1413,6 +1439,8 @@
 
     layerinfo->root = NULL;
 
+    layerinfo->get_all_shapes = MS_FALSE;
+
     layerinfo->numFeatures = 0;
     layerinfo->numNodes = 0;
 



More information about the mapserver-commits mailing list