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

Function processShplabelTag

maptemplate.c:1499–1843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1497
1498
1499static int processShplabelTag(layerObj *layer, char **line, shapeObj *origshape)
1500{
1501 char *tag, *tagStart, *tagEnd;
1502 char *tagValue=NULL;
1503 hashTableObj *tagArgs=NULL;
1504 int tagOffset, tagLength;
1505 char *format;
1506 char *argValue=NULL;
1507 char *projectionString=NULL;
1508 shapeObj tShape;
1509 int precision=0;
1510 int clip_to_map=MS_TRUE;
1511 int use_label_settings=MS_FALSE;
1512 double cellsize=0;
1513 int labelposvalid = MS_FALSE;
1514 pointObj labelPos;
1515 int i,status;
1516 char number[64]; /* holds a single number in the extent */
1517 char numberFormat[16];
1518 shapeObj *shape = NULL;
1519
1520 if(!*line) {
1521 msSetError(MS_WEBERR, "Invalid line pointer.", "processShplabelTag()");
1522 return(MS_FAILURE);
1523 }
1524 if( msCheckParentPointer(layer->map,"map")==MS_FAILURE )
1525 return MS_FAILURE;
1526
1527 tagStart = findTag(*line, "shplabel");
1528
1529 /* It is OK to have no shplabel tags, just return. */
1530 if( !tagStart )
1531 return MS_SUCCESS;
1532
1533 if(!origshape || origshape->numlines <= 0) { /* I suppose we need to make sure the part has vertices (need shape checker?) */
1534 msSetError(MS_WEBERR, "Null or empty shape.", "processShplabelTag()");
1535 return(MS_FAILURE);
1536 }
1537
1538
1539 while (tagStart)
1540 {
1541 if (shape)
1542 msFreeShape(shape);
1543 shape = (shapeObj *) msSmallMalloc(sizeof(shapeObj));
1544 msInitShape(shape);
1545 msCopyShape(origshape, shape);
1546
1547 projectionString = NULL;
1548 format = "$x,$y";
1549 tagOffset = tagStart - *line;
1550
1551 if(getTagArgs("shplabel", tagStart, &tagArgs) != MS_SUCCESS) return(MS_FAILURE);
1552 if(tagArgs)
1553 {
1554 argValue = msLookupHashTable(tagArgs, "format");
1555 if(argValue) format = argValue;
1556

Callers 1

processLineFunction · 0.85

Calls 15

msSetErrorFunction · 0.85
msCheckParentPointerFunction · 0.85
findTagFunction · 0.85
msFreeShapeFunction · 0.85
msSmallMallocFunction · 0.85
msInitShapeFunction · 0.85
msCopyShapeFunction · 0.85
getTagArgsFunction · 0.85
msLookupHashTableFunction · 0.85
strcasecmpFunction · 0.85
msProjectionsDifferFunction · 0.85
msProjectShapeFunction · 0.85

Tested by

no test coverage detected