Permalink
Browse files

Add support for raster tile index with tiles of mixed SRS (TILESRS ke…

…yword)
  • Loading branch information...
1 parent ca9ca29 commit 57012f820b9c52fee825b37459e453fee99bd63d @rouault rouault committed Jun 30, 2013
Showing with 2,055 additions and 1,859 deletions.
  1. +2 −0 mapcopy.c
  2. +14 −0 mapfile.c
  3. +2 −1 mapfile.dtd
  4. +1 −0 mapfile.h
  5. +14 −0 maplayer.c
  6. +1,554 −1,545 maplexer.c
  7. +1 −0 maplexer.l
  8. +7 −0 mapogr.cpp
  9. +357 −159 mapraster.c
  10. +69 −0 mapraster.h
  11. +25 −154 maprasterquery.c
  12. +2 −0 mapserver.h
  13. +7 −0 mapshape.c
View
@@ -956,6 +956,8 @@ int msCopyLayer(layerObj *dst, layerObj *src)
MS_COPYSTRING(dst->tileitem, src->tileitem);
MS_COPYSTELEM(tileitemindex);
+ MS_COPYSTRING(dst->tilesrs, src->tilesrs);
+
MS_COPYSTRING(dst->tileindex, src->tileindex);
return_value = msCopyProjection(&(dst->projection),&(src->projection));
View
@@ -3838,6 +3838,7 @@ int initLayer(layerObj *layer, mapObj *map)
layer->tileitem = msStrdup("location");
layer->tileitemindex = -1;
layer->tileindex = NULL;
+ layer->tilesrs = NULL;
layer->bandsitem = NULL;
layer->bandsitemindex = -1;
@@ -3943,6 +3944,7 @@ int freeLayer(layerObj *layer)
msFree(layer->template);
msFree(layer->tileindex);
msFree(layer->tileitem);
+ msFree(layer->tilesrs);
msFree(layer->bandsitem);
msFree(layer->plugin_library);
msFree(layer->plugin_library_original);
@@ -4517,6 +4519,17 @@ int loadLayer(layerObj *layer, mapObj *map)
}
}
break;
+ case(TILESRS):
+ if(getString(&layer->tilesrs) == MS_FAILURE) return(-1); /* getString() cleans up previously allocated string */
+ if(msyysource == MS_URL_TOKENS) {
+ if(msValidateParameter(layer->tilesrs, msLookupHashTable(&(layer->validation), "tilesrs"), msLookupHashTable(&(map->web.validation), "tilesrs"), NULL, NULL) != MS_SUCCESS) {
+ msSetError(MS_MISCERR, "URL-based TILESRS configuration failed pattern validation." , "loadLayer()");
+ msFree(layer->tilesrs);
+ layer->tilesrs=NULL;
+ return(-1);
+ }
+ }
+ break;
case(TOLERANCE):
if(getDouble(&(layer->tolerance)) == -1) return(-1);
break;
@@ -4640,6 +4653,7 @@ static void writeLayer(FILE *stream, int indent, layerObj *layer)
writeString(stream, indent, "TEMPLATE", NULL, layer->template);
writeString(stream, indent, "TILEINDEX", NULL, layer->tileindex);
writeString(stream, indent, "TILEITEM", NULL, layer->tileitem);
+ writeString(stream, indent, "TILESRS", NULL, layer->tilesrs);
writeNumber(stream, indent, "TOLERANCE", -1, layer->tolerance);
writeKeyword(stream, indent, "TOLERANCEUNITS", layer->toleranceunits, 7, MS_INCHES, "INCHES", MS_FEET ,"FEET", MS_MILES, "MILES", MS_METERS, "METERS", MS_KILOMETERS, "KILOMETERS", MS_NAUTICALMILES, "NAUTICALMILES", MS_DD, "DD");
writeKeyword(stream, indent, "TRANSFORM", layer->transform, 10, MS_FALSE, "FALSE", MS_UL, "UL", MS_UC, "UC", MS_UR, "UR", MS_CL, "CL", MS_CC, "CC", MS_CR, "CR", MS_LL, "LL", MS_LC, "LC", MS_LR, "LR");
View
@@ -124,7 +124,7 @@
a LAYER object
-->
<!ELEMENT LAYER
- (CLASS|CLASSITEM|CONNECTION|CONNECTIONTYPE|DATA|DESCRIPTION|FEATURE|FILTER|FILTERITEM|FOOTER|GROUP|HEADER|TEMPLATE|LABELANGLEITEM|LABELCACHE|LABELITEM|LABELMAXSCALE|LABELMINSCALE|LABELREQUIRES|LABELSIZEITEM|MAXFEATURES|MAXSCALE|MINSCALE|OFFSITE|POSTLABELCACHE|PROJECTION|REQUIRES|SYMBOLSCALE|TILEINDEX|TILEITEM|TOLERANCE|TOLERANCEUNITS|TRANSFORM|TRANSPARENCY|METADATA)*
+ (CLASS|CLASSITEM|CONNECTION|CONNECTIONTYPE|DATA|DESCRIPTION|FEATURE|FILTER|FILTERITEM|FOOTER|GROUP|HEADER|TEMPLATE|LABELANGLEITEM|LABELCACHE|LABELITEM|LABELMAXSCALE|LABELMINSCALE|LABELREQUIRES|LABELSIZEITEM|MAXFEATURES|MAXSCALE|MINSCALE|OFFSITE|POSTLABELCACHE|PROJECTION|REQUIRES|SYMBOLSCALE|TILEINDEX|TILEITEM|TILESRS|TOLERANCE|TOLERANCEUNITS|TRANSFORM|TRANSPARENCY|METADATA)*
>
<!ATTLIST LAYER
NAME NMTOKEN #REQUIRED
@@ -159,6 +159,7 @@
<!ELEMENT SYMBOLSCALE (#PCDATA)>
<!ELEMENT TILEINDEX (#PCDATA)>
<!ELEMENT TILEITEM (#PCDATA)>
+<!ELEMENT TILESRS (#PCDATA)>
<!ELEMENT TOLERANCE (#PCDATA)>
<!ELEMENT TOLERANCEUNITS (#PCDATA)>
<!ELEMENT TRANSFORM (#PCDATA)>
View
@@ -315,5 +315,6 @@ enum MS_TOKEN_SOURCES {MS_FILE_TOKENS=0, MS_STRING_TOKENS, MS_URL_TOKENS};
/* rfc59 bindvals objects */
#define BINDVALS 2000
+#define TILESRS 1272
#endif /* MAPFILE_H */
View
@@ -88,6 +88,11 @@ int msLayerRestoreFromScaletokens(layerObj *layer)
layer->tileitem = layer->orig_tileitem;
layer->orig_tileitem = NULL;
}
+ if(layer->orig_tilesrs) {
+ msFree(layer->tilesrs);
+ layer->tilesrs = layer->orig_tilesrs;
+ layer->orig_tilesrs = NULL;
+ }
if(layer->orig_filter) {
msLoadExpressionString(&(layer->filter),layer->orig_filter);
msFree(layer->orig_filter);
@@ -151,6 +156,15 @@ int msLayerApplyScaletokens(layerObj *layer, double scale)
layer->tileitem = msStrdup(layer->tileitem);
layer->tileitem = msReplaceSubstring(layer->tileitem,st->name,ste->value);
}
+ if(layer->tilesrs && strstr(layer->tilesrs,st->name)) {
+ if(layer->debug >= MS_DEBUGLEVEL_DEBUG) {
+ msDebug("replacing scaletoken (%s) with (%s) in layer->tilesrs (%s) for scale=%f\n",
+ st->name,ste->value,layer->name,scale);
+ }
+ layer->orig_tilesrs = layer->tilesrs;
+ layer->tilesrs = msStrdup(layer->tilesrs);
+ layer->tilesrs = msReplaceSubstring(layer->tilesrs,st->name,ste->value);
+ }
if(layer->filteritem && strstr(layer->filteritem,st->name)) {
if(layer->debug >= MS_DEBUGLEVEL_DEBUG) {
msDebug("replacing scaletoken (%s) with (%s) in layer->filteritem (%s) for scale=%f\n",
Oops, something went wrong.

0 comments on commit 57012f8

Please sign in to comment.