[mapserver-commits] r13171 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Feb 23 14:25:10 EST 2012


Author: sdlime
Date: 2012-02-23 11:25:10 -0800 (Thu, 23 Feb 2012)
New Revision: 13171

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapservutil.c
Log:
Added classgroup parameter support to the CGI (in msCGILoadMap()). (#4207)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2012-02-23 19:19:17 UTC (rev 13170)
+++ trunk/mapserver/HISTORY.TXT	2012-02-23 19:25:10 UTC (rev 13171)
@@ -15,6 +15,8 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 -------------------------------------------------
 
+- Added classgroup CGI parameter support (#4207)
+
 - Java mapscript: renamed shared library and completed libtool support (#2595)
 
 - Fixed WCS 2.0 axis order (#4191)

Modified: trunk/mapserver/mapservutil.c
===================================================================
--- trunk/mapserver/mapservutil.c	2012-02-23 19:19:17 UTC (rev 13170)
+++ trunk/mapserver/mapservutil.c	2012-02-23 19:25:10 UTC (rev 13171)
@@ -166,15 +166,27 @@
   }\
 } while (0)
 
+static void setClassGroup(layerObj *layer, char *classgroup) {
+  int i;
 
+  if(!layer || !classgroup) return;
 
+  for(i=0; i<layer->numclasses; i++) {
+    if(layer->class[i]->group && strcmp(layer->class[i]->group, classgroup) == 0) {
+      msFree(layer->classgroup);
+      layer->classgroup = msStrdup(classgroup); 
+      return; /* bail */
+    }
+  }
+}
+
 /*
 ** Extract Map File name from params and load it.  
 ** Returns map object or NULL on error.
 */
 mapObj *msCGILoadMap(mapservObj *mapserv)
 {
-  int i;
+  int i, j;
   mapObj *map = NULL;
   static mapObj *preloadedmap = NULL;
   static time_t preloadedmap_mtime;
@@ -233,8 +245,6 @@
 
   if(!map) return NULL;
 
-
-
   if(!msLookupHashTable(&(map->web.validation), "immutable")) {
      /* check for any %variable% substitutions here, also do any map_ changes, we do this here so WMS/WFS  */
      /* services can take advantage of these "vendor specific" extensions */
@@ -247,13 +257,21 @@
          */
         if(strncasecmp(mapserv->request->ParamNames[i],"qstring",7) == 0) continue;
 
-        if(strncasecmp(mapserv->request->ParamNames[i],"map_",4) == 0 || strncasecmp(mapserv->request->ParamNames[i],"map.",4) == 0) { /* check to see if there are any additions to the mapfile */
+        /* check to see if there are any additions to the mapfile */
+        if(strncasecmp(mapserv->request->ParamNames[i],"map_",4) == 0 || strncasecmp(mapserv->request->ParamNames[i],"map.",4) == 0) {
            if(msUpdateMapFromURL(map, mapserv->request->ParamNames[i], mapserv->request->ParamValues[i]) != MS_SUCCESS) {
               msFreeMap(map);
               return NULL;
            }
            continue;
         }
+
+        if(strncasecmp(mapserv->request->ParamNames[i],"classgroup",10) == 0) { /* #4207 */
+          for(j=0; j<map->numlayers; j++) {
+            setClassGroup(GET_LAYER(map, j), mapserv->request->ParamValues[i]);
+          }
+          continue;
+        }
      }
 
      msApplySubstitutions(map, mapserv->request->ParamNames, mapserv->request->ParamValues, mapserv->request->NumParams);



More information about the mapserver-commits mailing list