[mapserver-commits] r12483 - in trunk/mapserver/mapcache: . src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:30:44 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:30:44 -0700 (Fri, 26 Aug 2011)
New Revision: 12483

Modified:
   trunk/mapserver/mapcache/geocache.xml
   trunk/mapserver/mapcache/src/configuration.c
   trunk/mapserver/mapcache/src/core.c
   trunk/mapserver/mapcache/src/service_wms.c
Log:


Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml	2011-08-26 11:30:39 UTC (rev 12482)
+++ trunk/mapserver/mapcache/geocache.xml	2011-08-26 11:30:44 UTC (rev 12483)
@@ -427,7 +427,7 @@
            values under around 80 produce small images but with visible artifacts.
            YMMV
       -->
-      <quality>95</quality>   
+      <quality>75</quality>   
    </format>
    <format name="PNG_BEST" type ="PNG">
       <compression>best</compression>
@@ -697,10 +697,10 @@
       <format>mixed</format>
       <grid>WGS84</grid>
    </tileset>
-   <tileset name="test3">
+   <tileset name="brgm">
       <source>basic</source>
       <cache>disk</cache>
-      <format>PNG8</format>
+      <format>PNG</format>
       <grid>WGS84</grid>
       <metatile>5 5</metatile>
       <metabuffer>30</metabuffer>
@@ -711,7 +711,7 @@
          <abstract>see http://mapserver-utils.googlecode.com</abstract>
       </metadata>
       <source>osm</source>
-      <cache>tmpl</cache>
+      <cache>disk</cache>
       <format>PNG</format>
       <grid>FXX</grid>
       <grid>MILLER</grid>
@@ -781,6 +781,12 @@
       - bilinear: slower, higher qulity
       -->
       <resample_mode>bilinear</resample_mode>
+      
+      <!-- format
+         image format to use when assembling tiles
+      -->
+      <format>myjpeg</format>
+
    </service>
    <service type="wmts" enabled="true"/>
    <service type="tms" enabled="true"/>

Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:30:39 UTC (rev 12482)
+++ trunk/mapserver/mapcache/src/configuration.c	2011-08-26 11:30:44 UTC (rev 12483)
@@ -154,9 +154,9 @@
          geocache_imageio_create_png_q_format(pool,"PNG8",GEOCACHE_COMPRESSION_FAST,256),
          "PNG8");
    geocache_configuration_add_image_format(cfg,
-         geocache_imageio_create_jpeg_format(pool,"JPEG",95),
+         geocache_imageio_create_jpeg_format(pool,"JPEG",90),
          "JPEG");
-   cfg->default_image_format = geocache_configuration_get_image_format(cfg,"PNG8");
+   cfg->default_image_format = geocache_configuration_get_image_format(cfg,"JPEG");
    cfg->reporting = GEOCACHE_REPORT_MSG;
 
    grid = geocache_grid_create(pool);

Modified: trunk/mapserver/mapcache/src/core.c
===================================================================
--- trunk/mapserver/mapcache/src/core.c	2011-08-26 11:30:39 UTC (rev 12482)
+++ trunk/mapserver/mapcache/src/core.c	2011-08-26 11:30:44 UTC (rev 12483)
@@ -93,19 +93,14 @@
    }
 #endif
 
+   geocache_image_format *format = req_map->getmap_format; /* always defined, defaults to JPEG */
+   
    if(req_map->getmap_strategy == GEOCACHE_GETMAP_ERROR) {
       ctx->set_error(ctx, 404, "full wms support disabled");
       return NULL;
    } else if(req_map->getmap_strategy == GEOCACHE_GETMAP_ASSEMBLE) {
       int i;
       geocache_map *basemap = req_map->maps[0];
-      geocache_image_format *format = basemap->tileset->format;
-      if(req_map->getmap_format) {
-         format = req_map->getmap_format;
-      }
-      if(!format) {
-         format = ctx->config->default_image_format; /* this one is always defined */
-      }
       geocache_image *baseim = _core_get_single_map(ctx,basemap,req_map->resample_mode);
       if(GC_HAS_ERROR(ctx)) return NULL;
       for(i=1;i<req_map->nmaps;i++) {
@@ -118,7 +113,7 @@
          if(!basemap->expires || overlaymap->expires<basemap->expires) basemap->expires = overlaymap->expires;
 
       }
-      basemap->data = format->write(ctx,baseim,basemap->tileset->format);
+      basemap->data = format->write(ctx,baseim,format);
       return basemap;
    } else /*if(ctx->config->getmap_strategy == GEOCACHE_GETMAP_FORWARD)*/ {
       int i;
@@ -137,7 +132,7 @@
             geocache_image_merge(ctx,baseim,overlayim);
             if(GC_HAS_ERROR(ctx)) return NULL;
          }
-         basemap->data = basemap->tileset->format->write(ctx,baseim,basemap->tileset->format);
+         basemap->data = format->write(ctx,baseim,format);
       }
       return basemap;
    }

Modified: trunk/mapserver/mapcache/src/service_wms.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wms.c	2011-08-26 11:30:39 UTC (rev 12482)
+++ trunk/mapserver/mapcache/src/service_wms.c	2011-08-26 11:30:44 UTC (rev 12483)
@@ -962,6 +962,15 @@
       }
    }
    
+   wms->getmap_format = geocache_configuration_get_image_format(cfg,"JPEG");
+   if ((rule_node = ezxml_child(node,"format")) != NULL) {
+      wms->getmap_format = geocache_configuration_get_image_format(cfg,rule_node->txt);
+      if(!wms->getmap_format) {
+         ctx->set_error(ctx,400, "unknown <format> %s for wms service", rule_node->txt);
+         return;
+      }
+   }
+   
    if ((rule_node = ezxml_child(node,"resample_mode")) != NULL) {
       if(!strcmp(rule_node->txt,"nearest")) {
          wms->resample_mode = GEOCACHE_RESAMPLE_NEAREST;
@@ -992,6 +1001,7 @@
 #endif
    service->getmap_strategy = GEOCACHE_GETMAP_ASSEMBLE;
    service->resample_mode = GEOCACHE_RESAMPLE_BILINEAR;
+   service->getmap_format = NULL;
    return (geocache_service*)service;
 }
 



More information about the mapserver-commits mailing list