[mapserver-commits] r12284 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:13:48 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:13:47 -0700 (Fri, 26 Aug 2011)
New Revision: 12284
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/include/geocache.h
trunk/mapserver/mapcache/src/configuration.c
trunk/mapserver/mapcache/src/service_demo.c
trunk/mapserver/mapcache/src/service_tms.c
trunk/mapserver/mapcache/src/service_wms.c
trunk/mapserver/mapcache/src/service_wmts.c
trunk/mapserver/mapcache/src/services.c
Log:
mark functions as static
thomas.bonfort | 2011-01-25 16:31:48 +0100 (Tue, 25 Jan 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:13:47 UTC (rev 12284)
@@ -467,6 +467,9 @@
<!-- OGC WMTS -->
<wmts>true</wmts>
+
+ <!-- Google Maps -->
+ <gmaps>true</gmaps>
<!-- demo
interface with a simple openlayers map serving the configured layers through WMS.
Modified: trunk/mapserver/mapcache/include/geocache.h
===================================================================
--- trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/include/geocache.h 2011-08-26 11:13:47 UTC (rev 12284)
@@ -75,6 +75,7 @@
typedef struct geocache_service geocache_service;
typedef struct geocache_service_wms geocache_service_wms;
typedef struct geocache_service_wmts geocache_service_wmts;
+typedef struct geocache_service_gmaps geocache_service_gmaps;
typedef struct geocache_service_tms geocache_service_tms;
typedef struct geocache_service_demo geocache_service_demo;
typedef struct geocache_server_cfg geocache_server_cfg;
@@ -366,11 +367,11 @@
/** \defgroup services Services*/
/** @{ */
-#define GEOCACHE_SERVICES_COUNT 4
+#define GEOCACHE_SERVICES_COUNT 5
typedef enum {
GEOCACHE_SERVICE_WMS = 0, GEOCACHE_SERVICE_TMS, GEOCACHE_SERVICE_WMTS,
- GEOCACHE_SERVICE_DEMO
+ GEOCACHE_SERVICE_DEMO, GEOCACHE_SERVICE_GMAPS
} geocache_service_type;
#define GEOCACHE_UNITS_COUNT 3
@@ -397,7 +398,7 @@
/**
* \brief allocates and populates a geocache_request corresponding to the parameters received
*/
- void (*parse_request)(geocache_context *ctx, geocache_request **request, const char *path_info, apr_table_t *params, geocache_cfg * config);
+ void (*parse_request)(geocache_context *ctx, geocache_service *service, geocache_request **request, const char *path_info, apr_table_t *params, geocache_cfg * config);
/**
* \param request the received request (should be of type GEOCACHE_REQUEST_CAPABILITIES
@@ -420,6 +421,7 @@
*/
struct geocache_service_tms {
geocache_service service;
+ int reverse_y;
};
/**\class geocache_service_wmts
@@ -445,6 +447,12 @@
geocache_service* geocache_service_wms_create(geocache_context *ctx);
/**
+ * \brief create and initialize a geocache_service_gmaps
+ * \memberof geocache_service_gmaps
+ */
+geocache_service* geocache_service_gmaps_create(geocache_context *ctx);
+
+/**
* \brief create and initialize a geocache_service_tms
* \memberof geocache_service_tms
*/
Modified: trunk/mapserver/mapcache/src/configuration.c
===================================================================
--- trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/src/configuration.c 2011-08-26 11:13:47 UTC (rev 12284)
@@ -791,6 +791,11 @@
config->services[GEOCACHE_SERVICE_TMS] = geocache_service_tms_create(ctx);
}
}
+ if ((node = ezxml_child(root,"gmaps")) != NULL) {
+ if(!node->txt || !*node->txt || strcmp(node->txt, "false")) {
+ config->services[GEOCACHE_SERVICE_GMAPS] = geocache_service_gmaps_create(ctx);
+ }
+ }
if ((node = ezxml_child(root,"demo")) != NULL) {
if(!node->txt || !*node->txt || strcmp(node->txt, "false")) {
config->services[GEOCACHE_SERVICE_DEMO] = geocache_service_demo_create(ctx);
Modified: trunk/mapserver/mapcache/src/service_demo.c
===================================================================
--- trunk/mapserver/mapcache/src/service_demo.c 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/src/service_demo.c 2011-08-26 11:13:47 UTC (rev 12284)
@@ -52,7 +52,7 @@
* \private \memberof geocache_service_demo
* \sa geocache_service::parse_request()
*/
-void _geocache_service_demo_parse_request(geocache_context *ctx, geocache_request **request,
+void _geocache_service_demo_parse_request(geocache_context *ctx, geocache_service *this, geocache_request **request,
const char *cpathinfo, apr_table_t *params, geocache_cfg *config) {
*request = (geocache_request*)apr_pcalloc(
ctx->pool,sizeof(geocache_request_get_capabilities));
Modified: trunk/mapserver/mapcache/src/service_tms.c
===================================================================
--- trunk/mapserver/mapcache/src/service_tms.c 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/src/service_tms.c 2011-08-26 11:13:47 UTC (rev 12284)
@@ -134,7 +134,7 @@
* \private \memberof geocache_service_tms
* \sa geocache_service::parse_request()
*/
-void _geocache_service_tms_parse_request(geocache_context *ctx, geocache_request **request,
+void _geocache_service_tms_parse_request(geocache_context *ctx, geocache_service *this, geocache_request **request,
const char *cpathinfo, apr_table_t *params, geocache_cfg *config) {
int index = 0;
char *last, *key, *endptr;
@@ -142,7 +142,11 @@
geocache_grid_link *grid_link = NULL;
char *pathinfo;
int x=-1,y=-1,z=-1;
-
+
+ if(this->type == GEOCACHE_SERVICE_GMAPS) {
+ index++;
+ /* skip the version part of the url */
+ }
if(cpathinfo) {
pathinfo = apr_pstrdup(ctx->pool,cpathinfo);
/* parse a path_info like /1.0.0/global_mosaic/0/0/0.jpg */
@@ -230,7 +234,11 @@
req->tiles = (geocache_tile**)apr_pcalloc(ctx->pool,sizeof(geocache_tile*));
req->tiles[0] = geocache_tileset_tile_create(ctx->pool, tileset);
req->tiles[0]->x = x;
- req->tiles[0]->y = y;
+ if(((geocache_service_tms*)this)->reverse_y) {
+ req->tiles[0]->y = grid_link->grid->levels[z]->maxy - y - 1;
+ } else {
+ req->tiles[0]->y = y;
+ }
req->tiles[0]->z = z;
req->tiles[0]->grid_link = grid_link;
geocache_tileset_tile_validate(ctx,req->tiles[0]);
@@ -265,11 +273,30 @@
}
service->service.url_prefix = apr_pstrdup(ctx->pool,"tms");
service->service.type = GEOCACHE_SERVICE_TMS;
+ service->reverse_y = 0;
service->service.parse_request = _geocache_service_tms_parse_request;
service->service.create_capabilities_response = _create_capabilities_tms;
return (geocache_service*)service;
}
+void _create_capabilities_gmaps(geocache_context *ctx, geocache_request_get_capabilities *req, char *url, char *path_info, geocache_cfg *cfg) {
+ ctx->set_error(ctx,501,"gmaps service does not support capapbilities");
+}
+
+geocache_service* geocache_service_gmaps_create(geocache_context *ctx) {
+ geocache_service_tms* service = (geocache_service_tms*)apr_pcalloc(ctx->pool, sizeof(geocache_service_tms));
+ if(!service) {
+ ctx->set_error(ctx, 500, "failed to allocate gmaps service");
+ return NULL;
+ }
+ service->service.url_prefix = apr_pstrdup(ctx->pool,"gmaps");
+ service->reverse_y = 1;
+ service->service.type = GEOCACHE_SERVICE_GMAPS;
+ service->service.parse_request = _geocache_service_tms_parse_request;
+ service->service.create_capabilities_response = _create_capabilities_gmaps;
+ return (geocache_service*)service;
+}
+
/** @} */
/* vim: ai ts=3 sts=3 et sw=3
*/
Modified: trunk/mapserver/mapcache/src/service_wms.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wms.c 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/src/service_wms.c 2011-08-26 11:13:47 UTC (rev 12284)
@@ -207,7 +207,7 @@
* \private \memberof geocache_service_wms
* \sa geocache_service::parse_request()
*/
-void _geocache_service_wms_parse_request(geocache_context *ctx, geocache_request **request,
+void _geocache_service_wms_parse_request(geocache_context *ctx, geocache_service *this, geocache_request **request,
const char *pathinfo, apr_table_t *params, geocache_cfg *config) {
const char *str = NULL;
const char *srs=NULL;
Modified: trunk/mapserver/mapcache/src/service_wmts.c
===================================================================
--- trunk/mapserver/mapcache/src/service_wmts.c 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/src/service_wmts.c 2011-08-26 11:13:47 UTC (rev 12284)
@@ -278,7 +278,7 @@
* \private \memberof geocache_service_wmts
* \sa geocache_service::parse_request()
*/
-void _geocache_service_wmts_parse_request(geocache_context *ctx, geocache_request **request,
+void _geocache_service_wmts_parse_request(geocache_context *ctx, geocache_service *this, geocache_request **request,
const char *pathinfo, apr_table_t *params, geocache_cfg *config) {
const char *str, *service = NULL, *style = NULL, *version = NULL, *layer = NULL, *matrixset = NULL,
*matrix = NULL, *tilecol = NULL, *tilerow = NULL, *format = NULL, *extension = NULL;
Modified: trunk/mapserver/mapcache/src/services.c
===================================================================
--- trunk/mapserver/mapcache/src/services.c 2011-08-26 11:13:40 UTC (rev 12283)
+++ trunk/mapserver/mapcache/src/services.c 2011-08-26 11:13:47 UTC (rev 12284)
@@ -50,7 +50,7 @@
if(strncmp(service->url_prefix,pathinfo, prefixlen)) continue; /*skip a service who's prefix does not correspond */
if(*(pathinfo+prefixlen)!='/' && *(pathinfo+prefixlen)!='\0') continue; /*we matched the prefix but there are trailing characters*/
pathinfo += prefixlen; /* advance pathinfo to after the service prefix */
- service->parse_request(ctx,request,pathinfo,params,config);
+ service->parse_request(ctx,service,request,pathinfo,params,config);
GC_CHECK_ERROR(ctx);
(*request)->service = service;
return;
More information about the mapserver-commits
mailing list