[mapserver-commits] r12314 - trunk/mapserver/mapcache/src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:16:14 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:16:14 -0700 (Fri, 26 Aug 2011)
New Revision: 12314
Modified:
trunk/mapserver/mapcache/src/core.c
Log:
add connection timeout on http requests
closes issue 55.
thomas.bonfort | 2011-02-28 16:23:08 +0100 (Mon, 28 Feb 2011)
Modified: trunk/mapserver/mapcache/src/core.c
===================================================================
--- trunk/mapserver/mapcache/src/core.c 2011-08-26 11:16:10 UTC (rev 12313)
+++ trunk/mapserver/mapcache/src/core.c 2011-08-26 11:16:14 UTC (rev 12314)
@@ -37,32 +37,48 @@
return rettile;
}
+geocache_image* _core_get_single_map(geocache_context *ctx, geocache_map *map) {
+
+ geocache_tile **maptiles;
+ int i,nmaptiles;
+ geocache_tileset_get_map_tiles(ctx,map->tileset,map->grid_link,
+ map->extent, map->width, map->height,
+ &nmaptiles, &maptiles);
+ for(i=0;i<nmaptiles;i++) {
+ geocache_tile *tile = maptiles[i];
+ geocache_tileset_tile_get(ctx, tile);
+ if(GC_HAS_ERROR(ctx))
+ return NULL;
+ }
+ geocache_image *getmapim = geocache_tileset_assemble_map_tiles(ctx,map->tileset,map->grid_link,
+ map->extent, map->width, map->height,
+ nmaptiles, maptiles);
+ return getmapim;
+}
+
geocache_map *geocache_core_get_map(geocache_context *ctx, geocache_request_get_map *req_map) {
#ifdef USE_CAIRO
- if(req_map->nmaps==1) {
- geocache_map *map = req_map->maps[0];
- geocache_tile **maptiles;
- int i,nmaptiles;
- geocache_tileset_get_map_tiles(ctx,map->tileset,map->grid_link,
- map->extent, map->width, map->height,
- &nmaptiles, &maptiles);
- for(i=0;i<nmaptiles;i++) {
- geocache_tile *tile = maptiles[i];
- geocache_tileset_tile_get(ctx, tile);
- if(GC_HAS_ERROR(ctx))
- return NULL;
- }
- geocache_image *getmapim = geocache_tileset_assemble_map_tiles(ctx,map->tileset,map->grid_link,
- map->extent, map->width, map->height,
- nmaptiles, maptiles);
+#ifdef DEBUG
+ if(req_maps->nmaps ==0) {
+ ctx->set_error(ctx,500,"BUG: get_map called with 0 maps");
+ return;
+ }
+#endif
+ int i;
+ geocache_map *basemap = req_map->maps[0];
+ geocache_image *baseim = _core_get_single_map(ctx,basemap);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ for(i=1;i<req_map->nmaps;i++) {
+ geocache_map *overlaymap = req_map->maps[i];
+ geocache_image *overlayim = _core_get_single_map(ctx,overlaymap);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ geocache_image_merge(ctx,baseim,overlayim);
+ if(GC_HAS_ERROR(ctx)) return NULL;
+ }
- geocache_map *getmap = geocache_tileset_map_create(ctx->pool,map->tileset, map->grid_link);
- getmap->data = map->tileset->format->write(ctx,getmapim,map->tileset->format);
- return getmap;
- } else{
- ctx->set_error(ctx,501,"get map not implemented for merged layers");
- return NULL;
- }
+ geocache_map *getmap = geocache_tileset_map_create(ctx->pool,basemap->tileset, basemap->grid_link);
+ getmap->data = basemap->tileset->format->write(ctx,baseim,basemap->tileset->format);
+ return getmap;
#else
ctx->set_error(ctx,501,"wms getmap handling not configured in this build");
return NULL;
More information about the mapserver-commits
mailing list