[mapserver-commits] r12204 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:06:57 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:06:57 -0700 (Fri, 26 Aug 2011)
New Revision: 12204
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/configuration.c
trunk/mapserver/mapcache/src/services.c
Log:
reworked build scripts
thomas.bonfort | 2011-01-06 19:13:51 +0100 (Thu, 06 Jan 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:06:51 UTC (rev 12203)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:06:57 UTC (rev 12204)
@@ -83,5 +83,6 @@
<services>
<wms>true</wms>
<tms>true</tms>
+ <wmts>true</wmts>
</services>
</geocache>
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:06:51 UTC (rev 12203)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:06:57 UTC (rev 12204)
@@ -65,6 +65,7 @@
typedef struct geocache_request geocache_request;
typedef struct geocache_request_get_capabilities geocache_request_get_capabilities;
typedef struct geocache_request_get_capabilities_wms geocache_request_get_capabilities_wms;
+typedef struct geocache_request_get_capabilities_wmts geocache_request_get_capabilities_wmts;
typedef struct geocache_request_get_capabilities_tms geocache_request_get_capabilities_tms;
typedef struct geocache_request_get_tile geocache_request_get_tile;
@@ -345,6 +346,11 @@
char *version;
};
+struct geocache_request_get_capabilities_wmts {
+ geocache_request_get_capabilities request;
+ char *version;
+};
+
/** \defgroup services Services*/
/** @{ */
@@ -412,6 +418,12 @@
*/
geocache_service* geocache_service_tms_create(geocache_context *ctx);
+/**
+ * \brief create and initialize a geocache_service_wtms
+ * \memberof geocache_service_wtms
+ */
+geocache_service* geocache_service_wmts_create(geocache_context *ctx);
+
/** @} */
/** \defgroup image Image Data Handling */
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:06:51 UTC (rev 12203)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:06:57 UTC (rev 12204)
@@ -671,7 +671,14 @@
config->services[GEOCACHE_SERVICE_TMS] = geocache_service_tms_create(ctx);
}
xmlFree(value);
+ } else if(!xmlStrcmp(service_node->name, BAD_CAST "wmts")) {
+ xmlChar* value = xmlNodeGetContent(service_node);
+ if(!value || !*value || xmlStrcmp(value, BAD_CAST "false")) {
+ config->services[GEOCACHE_SERVICE_WMTS] = geocache_service_wmts_create(ctx);
+ }
+ xmlFree(value);
}
+
}
} else if(!xmlStrcmp(cur_node->name, BAD_CAST "merge_format")) {
char* value = (char*) xmlNodeGetContent(cur_node);
Modified: trunk/mapserver/mapcache/src/services.c
===================================================================
--- trunk/mapserver/mapcache/src/services.c 2011-08-26 11:06:51 UTC (rev 12203)
+++ trunk/mapserver/mapcache/src/services.c 2011-08-26 11:06:57 UTC (rev 12204)
@@ -144,6 +144,18 @@
request->request.mime_type = apr_pstrdup(ctx->pool,"text/xml");
}
+void _create_capabilities_wmts(geocache_context *ctx, geocache_request_get_capabilities *req, char *url, char *path_info, geocache_cfg *cfg) {
+ geocache_request_get_capabilities_wmts *request = (geocache_request_get_capabilities_wmts*)req;
+#ifdef DEBUG
+ if(request->request.request.type != GEOCACHE_REQUEST_GET_CAPABILITIES) {
+ ctx->set_error(ctx,GEOCACHE_ERROR,"wrong wms capabilities request");
+ return;
+ }
+#endif
+ request->request.mime_type = apr_pstrdup(ctx->pool,"text/xml");
+ request->request.capabilities = "this is the wmts capabilitities";
+}
+
static const char *tms_0 = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
"<Services>\n"
"<TileMapService version=\"1.0.0\" href=\"%s/1.0.0/\" />\n"
@@ -377,6 +389,40 @@
}
/**
+ * \brief parse a WMTS request
+ * \private \memberof geocache_service_wmts
+ * \sa geocache_service::parse_request()
+ */
+geocache_request* _geocache_service_wmts_parse_request(geocache_context *ctx, char *pathinfo, apr_table_t *params, geocache_cfg *config) {
+ char *str;
+ str = (char*)apr_table_get(params,"SERVICE");
+ if(!str)
+ str = (char*)apr_table_get(params,"service");
+ if(!str || strcasecmp(str,"wmts")) {
+ return NULL;
+ }
+
+ str = (char*)apr_table_get(params,"REQUEST");
+ if(!str)
+ str = (char*)apr_table_get(params,"request");
+ if(!str) {
+ ctx->set_error(ctx, GEOCACHE_REQUEST_ERROR, "received wmts request with no request");
+ return NULL;
+ }
+ if( ! strcasecmp(str,"getcapabilities") ) {
+ geocache_request_get_capabilities_wmts *request = (geocache_request_get_capabilities_wmts*)
+ apr_pcalloc(ctx->pool,sizeof(geocache_request_get_capabilities_wmts));
+ request->request.request.type = GEOCACHE_REQUEST_GET_CAPABILITIES;
+ return (geocache_request*)request;
+ } else if( strcasecmp(str,"gettile")) {
+ ctx->set_error(ctx, GEOCACHE_REQUEST_ERROR, "received wmts request with invalid request %s",str);
+ return NULL;
+ } else {
+ //TODO getTile
+ return NULL;
+ }
+}
+/**
* \brief parse a TMS request
* \private \memberof geocache_service_tms
* \sa geocache_service::parse_request()
@@ -386,6 +432,10 @@
char *last, *key, *endptr;
geocache_tileset *tileset = NULL;
int x,y,z;
+
+ /*if we have some key/values, then we're not a tms request*/
+ if(!apr_is_empty_table(params))
+ return NULL;
/* parse a path_info like /1.0.0/global_mosaic/0/0/0.jpg */
if(pathinfo) {
for (key = apr_strtok(pathinfo, "/", &last); key != NULL;
@@ -484,6 +534,18 @@
return (geocache_service*)service;
}
+geocache_service* geocache_service_wmts_create(geocache_context *ctx) {
+ geocache_service_wmts* service = (geocache_service_wmts*)apr_pcalloc(ctx->pool, sizeof(geocache_service_wmts));
+ if(!service) {
+ ctx->set_error(ctx, GEOCACHE_ALLOC_ERROR, "failed to allocate wtms service");
+ return NULL;
+ }
+ service->service.type = GEOCACHE_SERVICE_WMTS;
+ service->service.parse_request = _geocache_service_wmts_parse_request;
+ service->service.create_capabilities_response = _create_capabilities_wmts;
+ return (geocache_service*)service;
+}
+
/** @} */
More information about the mapserver-commits
mailing list