** Function process any number of MapServer extent tags (e.g. shpext, mapext, etc...). */
| 1334 | ** Function process any number of MapServer extent tags (e.g. shpext, mapext, etc...). |
| 1335 | */ |
| 1336 | static int processExtentTag(mapservObj *mapserv, char **line, char *name, rectObj *extent, projectionObj *rectProj) |
| 1337 | { |
| 1338 | char *argValue; |
| 1339 | |
| 1340 | char *tag, *tagStart, *tagEnd; |
| 1341 | hashTableObj *tagArgs=NULL; |
| 1342 | int tagOffset, tagLength; |
| 1343 | |
| 1344 | char *encodedTagValue=NULL, *tagValue=NULL; |
| 1345 | |
| 1346 | rectObj tempExtent; |
| 1347 | double xExpand, yExpand; |
| 1348 | |
| 1349 | char number[64]; /* holds a single number in the extent */ |
| 1350 | char numberFormat[16]; |
| 1351 | char *format; |
| 1352 | |
| 1353 | int precision; |
| 1354 | int escape; |
| 1355 | |
| 1356 | char *projectionString=NULL; |
| 1357 | |
| 1358 | if(!*line) { |
| 1359 | msSetError(MS_WEBERR, "Invalid line pointer.", "processExtentTag()"); |
| 1360 | return(MS_FAILURE); |
| 1361 | } |
| 1362 | |
| 1363 | tagStart = findTag(*line, name); /* this supports any extent */ |
| 1364 | |
| 1365 | /* It is OK to have no include tags, just return. */ |
| 1366 | if(!tagStart) return MS_SUCCESS; |
| 1367 | |
| 1368 | /* hack to handle tags like 'mapext_esc' easily */ |
| 1369 | if(strstr(name, "_esc")) escape = ESCAPE_URL; |
| 1370 | |
| 1371 | while(tagStart) { |
| 1372 | xExpand = yExpand = 0; /* set tag argument defaults */ |
| 1373 | precision = -1; |
| 1374 | format = "$minx $miny $maxx $maxy"; |
| 1375 | if(strstr(name, "_esc")) |
| 1376 | escape = ESCAPE_URL; |
| 1377 | else |
| 1378 | escape = ESCAPE_HTML; |
| 1379 | projectionString = NULL; |
| 1380 | |
| 1381 | tagOffset = tagStart - *line; |
| 1382 | |
| 1383 | /* check for any tag arguments */ |
| 1384 | if(getTagArgs(name, tagStart, &tagArgs) != MS_SUCCESS) return(MS_FAILURE); |
| 1385 | if(tagArgs) { |
| 1386 | argValue = msLookupHashTable(tagArgs, "expand"); |
| 1387 | if(argValue) { |
| 1388 | if(strchr(argValue, '%') != NULL) { |
| 1389 | float f; |
| 1390 | sscanf(argValue, "%f%%", &f); |
| 1391 | xExpand = ((f/100.0)*(extent->maxx-extent->minx))/2; |
| 1392 | yExpand = ((f/100.0)*(extent->maxy-extent->miny))/2; |
| 1393 | } else { |
no test coverage detected