Skip to content
Permalink
Browse files

refactor time dimension to be backend agnostic

  • Loading branch information...
tbonfort committed Jan 23, 2018
1 parent aae1a9f commit 69f04713be2d9b755a4710bf63ea86e86bcd22e4
Showing with 661 additions and 569 deletions.
  1. +14 −1 include/mapcache.h
  2. +8 −1 lib/configuration_xml.c
  3. +12 −562 lib/dimension.c
  4. +27 −0 lib/dimension_pg.c
  5. +409 −0 lib/dimension_sqlite.c
  6. +186 −0 lib/dimension_time.c
  7. +1 −1 lib/service_wms.c
  8. +2 −2 lib/tileset.c
  9. +2 −2 util/mapcache_seed.c
@@ -1562,6 +1562,7 @@ MS_DLL_EXPORT apr_array_header_t *mapcache_requested_dimensions_clone(apr_pool_t

struct mapcache_dimension {
mapcache_dimension_type type;
int isTime;
char *name;
char *unit;
apr_table_t *metadata;
@@ -1570,7 +1571,14 @@ struct mapcache_dimension {
/**
* \brief return the list of dimension values that match the requested entry
*/
apr_array_header_t* (*get_entries_for_value)(mapcache_context *ctx, mapcache_dimension *dimension, const char *value,
apr_array_header_t* (*_get_entries_for_value)(mapcache_context *ctx, mapcache_dimension *dimension, const char *value,
mapcache_tileset *tileset, mapcache_extent *extent, mapcache_grid *grid);

/**
* \brief return the list of dimension values that match the requested time range
*/
apr_array_header_t* (*_get_entries_for_time_range)(mapcache_context *ctx, mapcache_dimension *dimension, const char *value,
time_t start, time_t end,
mapcache_tileset *tileset, mapcache_extent *extent, mapcache_grid *grid);

/**
@@ -1596,6 +1604,11 @@ mapcache_dimension* mapcache_dimension_sqlite_create(mapcache_context *ctx, apr_
mapcache_dimension* mapcache_dimension_regex_create(mapcache_context *ctx, apr_pool_t *pool);
mapcache_dimension* mapcache_dimension_time_create(mapcache_context *ctx, apr_pool_t *pool);

apr_array_header_t* mapcache_dimension_get_entries_for_value(mapcache_context *ctx, mapcache_dimension *dimension, const char *value,
mapcache_tileset *tileset, mapcache_extent *extent, mapcache_grid *grid);
apr_array_header_t* mapcache_dimension_time_get_entries_for_value(mapcache_context *ctx, mapcache_dimension *dimension, const char *value,
mapcache_tileset *tileset, mapcache_extent *extent, mapcache_grid *grid);

int mapcache_is_axis_inverted(const char *srs);

typedef struct mapcache_pooled_connection_container mapcache_pooled_connection_container;
@@ -55,6 +55,7 @@ void parseDimensions(mapcache_context *ctx, ezxml_t node, mapcache_tileset *tile
char *name = (char*)ezxml_attr(dimension_node,"name");
char *type = (char*)ezxml_attr(dimension_node,"type");
char *unit = (char*)ezxml_attr(dimension_node,"unit");
char *time = (char*)ezxml_attr(dimension_node,"time");
char *default_value = (char*)ezxml_attr(dimension_node,"default");

mapcache_dimension *dimension = NULL;
@@ -72,7 +73,9 @@ void parseDimensions(mapcache_context *ctx, ezxml_t node, mapcache_tileset *tile
} else if(!strcmp(type,"sqlite")) {
dimension = mapcache_dimension_sqlite_create(ctx,ctx->pool);
} else if(!strcmp(type,"time")) {
dimension = mapcache_dimension_time_create(ctx,ctx->pool);
//backwards compatibility
dimension = mapcache_dimension_sqlite_create(ctx,ctx->pool);
dimension->isTime = 1;
} else {
ctx->set_error(ctx,400,"unknown dimension type \"%s\"",type);
return;
@@ -88,6 +91,10 @@ void parseDimensions(mapcache_context *ctx, ezxml_t node, mapcache_tileset *tile
if(unit && *unit) {
dimension->unit = apr_pstrdup(ctx->pool,unit);
}

if(time && *time && !strcasecmp(time,"true")) {
dimension->isTime = 1;
}

if(default_value && *default_value) {
dimension->default_value = apr_pstrdup(ctx->pool,default_value);

0 comments on commit 69f0471

Please sign in to comment.
You can’t perform that action at this time.