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

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:06:29 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:06:29 -0700 (Fri, 26 Aug 2011)
New Revision: 12199

Modified:
   trunk/mapserver/mapcache/include/geocache.h
   trunk/mapserver/mapcache/src/mod_geocache.c
   trunk/mapserver/mapcache/src/services.c
Log:
add metadata elements for ogc title, abstract, etc... partial implementation
added WMTS WellKnownScaleSet
thomas.bonfort | 2011-01-05 18:17:19 +0100 (Wed, 05 Jan 2011)

Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h	2011-08-26 11:06:25 UTC (rev 12198)
+++ trunk/mapserver/mapcache/include/geocache.h	2011-08-26 11:06:29 UTC (rev 12199)
@@ -283,10 +283,19 @@
 
 /** @} */
 
+
+typedef enum {
+   GEOCACHE_REQUEST_UNKNOWN,
+   GEOCACHE_REQUEST_GET_TILE,
+   GEOCACHE_REQUEST_GET_CAPABILITIES
+} geocache_request_type;
 /**
  * \brief a request sent by a client
  */
 struct geocache_request {
+   geocache_request_type type;
+
+   char *capabilities;
     /**
      * a list of tiles requested by the client
      */

Modified: trunk/mapserver/mapcache/src/mod_geocache.c
===================================================================
--- trunk/mapserver/mapcache/src/mod_geocache.c	2011-08-26 11:06:25 UTC (rev 12198)
+++ trunk/mapserver/mapcache/src/mod_geocache.c	2011-08-26 11:06:29 UTC (rev 12199)
@@ -190,6 +190,14 @@
    return OK;
 }
 
+static int geocache_write_capabilities(geocache_context_apache_request *ctx, geocache_request *request) {
+   int rc;
+   request_rec *r = ctx->request;
+   ap_rputs(request->capabilities, r);
+
+   return OK;
+}
+
 static int mod_geocache_request_handler(request_rec *r) {
    apr_table_t *params;
    geocache_cfg *config = NULL;
@@ -218,11 +226,17 @@
       if(request || GC_HAS_ERROR(global_ctx))
          break;
    }
-   if(!request || !request->ntiles || GC_HAS_ERROR(global_ctx)) {
+   if(!request || GC_HAS_ERROR(global_ctx)) {
       return report_error(HTTP_BAD_REQUEST, apache_ctx);
    }
 
+   if(request->type == GEOCACHE_REQUEST_GET_CAPABILITIES) {
+      return geocache_write_capabilities(apache_ctx,request);
+   } else if( request->type != GEOCACHE_REQUEST_GET_TILE || !request->ntiles) {
+      return report_error(HTTP_BAD_REQUEST, apache_ctx);
+   }
 
+
    for(i=0;i<request->ntiles;i++) {
       geocache_tile *tile = request->tiles[i];
       geocache_tileset_tile_get(global_ctx, tile);

Modified: trunk/mapserver/mapcache/src/services.c
===================================================================
--- trunk/mapserver/mapcache/src/services.c	2011-08-26 11:06:25 UTC (rev 12198)
+++ trunk/mapserver/mapcache/src/services.c	2011-08-26 11:06:29 UTC (rev 12199)
@@ -21,6 +21,14 @@
 /** \addtogroup services */
 /** @{ */
 
+
+geocache_request* _geocache_service_wms_capabilities(geocache_context *ctx, geocache_cfg *cfg) {
+   geocache_request *request = (geocache_request*)apr_pcalloc(ctx->pool,sizeof(geocache_request));
+   request->type = GEOCACHE_REQUEST_GET_CAPABILITIES;
+   request->capabilities = apr_pstrdup(ctx->pool,"<?xml>this is the capabilities document");
+   return request;
+}
+
 /**
  * \brief parse a WMS request
  * \private \memberof geocache_service_wms
@@ -42,10 +50,16 @@
    str = (char*)apr_table_get(params,"REQUEST");
    if(!str)
       str = (char*)apr_table_get(params,"request");
-   if(!str || strcasecmp(str,"getmap")) {
-      ctx->set_error(ctx, GEOCACHE_REQUEST_ERROR, "received wms request that wasn't a getmap: %s", str);
+   if(!str) {
+      ctx->set_error(ctx, GEOCACHE_REQUEST_ERROR, "received wms with no request");
       return NULL;
    }
+   if( ! strcasecmp(str,"getcapabilities") ) {
+      return _geocache_service_wms_capabilities(ctx, config);
+   } else if( strcasecmp(str,"getmap")) {
+      ctx->set_error(ctx, GEOCACHE_REQUEST_ERROR, "received wms with invalid request %s",str);
+      return NULL;
+   }
 
 
    str = (char*)apr_table_get(params,"BBOX");
@@ -112,6 +126,7 @@
       int count=1;
       char *sep=",";
       request = (geocache_request*)apr_pcalloc(ctx->pool,sizeof(geocache_request));
+      request->type = GEOCACHE_REQUEST_GET_TILE;
       str = apr_pstrdup(ctx->pool,str);
       for(key=str;*key;key++) if(*key == ',') count++;
       request->ntiles = 0;



More information about the mapserver-commits mailing list