[mapserver-commits] r12242 - in trunk/mapserver/mapcache: include src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:10:05 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:10:05 -0700 (Fri, 26 Aug 2011)
New Revision: 12242

Modified:
   trunk/mapserver/mapcache/include/geocache.h
   trunk/mapserver/mapcache/src/service_tms.c
   trunk/mapserver/mapcache/src/service_wmts.c
   trunk/mapserver/mapcache/src/tileset.c
Log:
temp commit to backup. initial gdal warping code
thomas.bonfort | 2011-01-12 18:35:59 +0100 (Wed, 12 Jan 2011)

Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h	2011-08-26 11:10:00 UTC (rev 12241)
+++ trunk/mapserver/mapcache/include/geocache.h	2011-08-26 11:10:05 UTC (rev 12242)
@@ -785,6 +785,14 @@
 void geocache_tileset_tile_lookup(geocache_context *ctx, geocache_tile *tile, double *bbox);
 
 /**
+ * \brief verify the created tile respects configured constraints
+ * @param tile
+ * @param r
+ * @return
+ */
+void geocache_tileset_tile_validate(geocache_context *ctx, geocache_tile *tile);
+
+/**
  * compute level for a given resolution
  * 
  * computes the integer level for the given resolution. the input resolution will be set to the exact
@@ -862,7 +870,6 @@
 
 geocache_grid* geocache_grid_create(apr_pool_t *pool);
 
-
 /* in util.c */
 int geocache_util_extract_int_list(geocache_context *ctx, const char* args, const char sep, int **numbers,
         int *numbers_count);

Modified: trunk/mapserver/mapcache/src/service_tms.c
===================================================================
--- trunk/mapserver/mapcache/src/service_tms.c	2011-08-26 11:10:00 UTC (rev 12241)
+++ trunk/mapserver/mapcache/src/service_tms.c	2011-08-26 11:10:05 UTC (rev 12242)
@@ -133,7 +133,7 @@
    char *last, *key, *endptr;
    geocache_tileset *tileset = NULL;
    char *pathinfo;
-   int x,y,z;
+   int x=-1,y=-1,z=-1;
    
    if(cpathinfo) {
       pathinfo = apr_pstrdup(ctx->pool,cpathinfo);
@@ -172,7 +172,7 @@
          case 5:
             y = (int)strtol(key,&endptr,10);
             if(*endptr != '.') {
-               ctx->log(ctx,GEOCACHE_REQUEST_ERROR, "received tms request %s with invalid y %s", pathinfo, key);
+               ctx->set_error(ctx,GEOCACHE_REQUEST_ERROR, "received tms request %s with invalid y %s", pathinfo, key);
                return;
             }
             break;
@@ -191,6 +191,8 @@
       req->tiles[0]->x = x;
       req->tiles[0]->y = y;
       req->tiles[0]->z = z;
+      geocache_tileset_tile_validate(ctx,req->tiles[0]);
+      GC_CHECK_ERROR(ctx);
       *request = (geocache_request*)req;
       return;
    } else if(index<3) {
@@ -225,4 +227,4 @@
    return (geocache_service*)service;
 }
 
-/** @} */
\ No newline at end of file
+/** @} */

Modified: trunk/mapserver/mapcache/src/service_wmts.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wmts.c	2011-08-26 11:10:00 UTC (rev 12241)
+++ trunk/mapserver/mapcache/src/service_wmts.c	2011-08-26 11:10:05 UTC (rev 12242)
@@ -362,7 +362,9 @@
       req->tiles[0]->x = col;
       req->tiles[0]->y = row;
       req->tiles[0]->z = level;
-      
+
+      geocache_tileset_tile_validate(ctx,req->tiles[0]);
+
       *request = (geocache_request*)req;
       return;
    }
@@ -381,4 +383,4 @@
    return (geocache_service*)service;
 }
 
-/** @} */
\ No newline at end of file
+/** @} */

Modified: trunk/mapserver/mapcache/src/tileset.c
===================================================================
--- trunk/mapserver/mapcache/src/tileset.c	2011-08-26 11:10:00 UTC (rev 12241)
+++ trunk/mapserver/mapcache/src/tileset.c	2011-08-26 11:10:05 UTC (rev 12242)
@@ -37,6 +37,14 @@
    ctx->set_error(ctx, GEOCACHE_TILESET_ERROR, "tileset %s: failed lookup for resolution %f", tileset->name, *resolution);
 }
 
+void geocache_tileset_tile_validate(geocache_context *ctx, geocache_tile *tile) {
+   if(tile->z < 0 || tile->z >= tile->tileset->grid->levels) {
+      ctx->set_error(ctx,GEOCACHE_REQUEST_ERROR,"invalid tile z level");
+      return;
+   }
+   /* TODO: check restricted extent when implemented */
+}
+
 /*
  * update the tile by setting it's x,y,z value given a bbox.
  * will return GEOCACHE_TILESET_WRONG_RESOLUTION or GEOCACHE_TILESET_WRONG_EXTENT



More information about the mapserver-commits mailing list