MCPcopy Index your code
hub / github.com/MapServer/MapServer / processExtentTag

Function processExtentTag

maptemplate.c:1336–1496  ·  view source on GitHub ↗

** Function process any number of MapServer extent tags (e.g. shpext, mapext, etc...). */

Source from the content-addressed store, hash-verified

1334** Function process any number of MapServer extent tags (e.g. shpext, mapext, etc...).
1335*/
1336static 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 {

Callers 1

processLineFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
findTagFunction · 0.85
getTagArgsFunction · 0.85
msLookupHashTableFunction · 0.85
strcasecmpFunction · 0.85
msProjectionsDifferFunction · 0.85
msProjectRectFunction · 0.85
msInitProjectionFunction · 0.85
msLoadProjectionStringFunction · 0.85
msStrdupFunction · 0.85
msReplaceSubstringFunction · 0.85
findTagEndFunction · 0.85

Tested by

no test coverage detected