[mapserver-commits] r12824 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Nov 29 08:56:04 EST 2011


Author: tbonfort
Date: 2011-11-29 05:56:04 -0800 (Tue, 29 Nov 2011)
New Revision: 12824

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/maptemplate.c
Log:
Make openlayers wms template request images with mimetype of outputformat defined in the mapfile's imagetype


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-11-29 09:11:07 UTC (rev 12823)
+++ trunk/mapserver/HISTORY.TXT	2011-11-29 13:56:04 UTC (rev 12824)
@@ -15,6 +15,9 @@
 Current Version (SVN trunk, 6.1-dev, future 6.2): 
 -------------------------------------------------
 
+- Make openlayers wms template request images with mimetype of outputformat
+  defined in the mapfile's imagetype
+
 - Fix memory leak in msSLDParseRasterSymbolizer()
 
 - Fix compilation error with clang in renderers/agg/include/agg_renderer_outline_aa.h

Modified: trunk/mapserver/maptemplate.c
===================================================================
--- trunk/mapserver/maptemplate.c	2011-11-29 09:11:07 UTC (rev 12823)
+++ trunk/mapserver/maptemplate.c	2011-11-29 13:56:04 UTC (rev 12824)
@@ -70,7 +70,7 @@
 "                                   '[mapserv_onlineresource]',\n"
 "                                   {layers: '[LAYERS]',\n"
 "                                   bbox: '[minx],[miny],[maxx],[maxy]',\n"
-"                                   width: [mapwidth], height: [mapheight], version: '[VERSION]'},"
+"                                   width: [mapwidth], height: [mapheight], version: '[VERSION]', format:'[openlayers_format]'},"
 "                                   {singleTile: \"true\", ratio:1, projection: '[openlayers_projection]'});\n";
 
 static char *processLine(mapservObj *mapserv, char *instr, FILE *stream, int mode);
@@ -4388,6 +4388,7 @@
     const char *tmpUrl = NULL;
     char *openlayersUrl = olUrl;
     char *projection = NULL;
+    char *format = NULL;
 
     /* 2 CGI parameters are used in the template. we need to transform them
      * to be sure the case match during the template processing. We also
@@ -4408,6 +4409,9 @@
             mapserv->request->ParamNames[i] = msStrdup("VERSION");
         }
     }
+    if(mapserv->map->outputformat->mimetype && *mapserv->map->outputformat->mimetype) {
+      format = mapserv->map->outputformat->mimetype; 
+    }
 
     /* check if the environment variable or config MS_OPENLAYERS_JS_URL is set */
     tmpUrl = msGetConfigOption(mapserv->map, "MS_OPENLAYERS_JS_URL");
@@ -4429,6 +4433,10 @@
     buffer = msReplaceSubstring(buffer, "[openlayers_layer]", layer);
     if (projection)
         buffer = msReplaceSubstring(buffer, "[openlayers_projection]", projection);
+    if (format)
+        buffer = msReplaceSubstring(buffer, "[openlayers_format]", format);
+    else
+        buffer = msReplaceSubstring(buffer, "[openlayers_format]", "image/jpeg");
     msIO_fwrite(buffer, strlen(buffer), 1, stdout);
     free(layer);
     free(buffer);



More information about the mapserver-commits mailing list