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

Function msSLDParsePolygonSymbolizer

mapogcsld.c:1376–1475  ·  view source on GitHub ↗

/ void msSLDParsePolygonSymbolizer(CPLXMLNode *psRoot, */ layerObj *psLayer) */ / */ */ */ */

Source from the content-addressed store, hash-verified

1374/* */
1375/************************************************************************/
1376int msSLDParsePolygonSymbolizer(CPLXMLNode *psRoot, layerObj *psLayer,
1377 int bNewClass)
1378{
1379 CPLXMLNode *psFill, *psStroke;
1380 int nClassId=0, iStyle=0;
1381 CPLXMLNode *psDisplacement=NULL, *psDisplacementX=NULL, *psDisplacementY=NULL;
1382 int nOffsetX=-1, nOffsetY=-1;
1383
1384 if (!psRoot || !psLayer)
1385 return MS_FAILURE;
1386
1387 /*parse displacement for SLD 1.1.0*/
1388 psDisplacement = CPLGetXMLNode(psRoot, "Displacement");
1389 if (psDisplacement)
1390 {
1391 psDisplacementX = CPLGetXMLNode(psDisplacement, "DisplacementX");
1392 psDisplacementY = CPLGetXMLNode(psDisplacement, "DisplacementY");
1393 /* psCssParam->psChild->psNext->pszValue) */
1394 if (psDisplacementX &&
1395 psDisplacementX->psChild &&
1396 psDisplacementX->psChild->pszValue &&
1397 psDisplacementY &&
1398 psDisplacementY->psChild &&
1399 psDisplacementY->psChild->pszValue)
1400 {
1401 nOffsetX = atoi(psDisplacementX->psChild->pszValue);
1402 nOffsetY = atoi(psDisplacementY->psChild->pszValue);
1403 }
1404 }
1405
1406 psFill = CPLGetXMLNode(psRoot, "Fill");
1407 if (psFill)
1408 {
1409 if (bNewClass || psLayer->numclasses <= 0)
1410 {
1411 if (msGrowLayerClasses(psLayer) == NULL)
1412 return MS_FAILURE;
1413 initClass(psLayer->class[psLayer->numclasses]);
1414 nClassId = psLayer->numclasses;
1415 psLayer->numclasses++;
1416 }
1417 else
1418 nClassId = psLayer->numclasses-1;
1419
1420 iStyle = psLayer->class[nClassId]->numstyles;
1421 msMaybeAllocateClassStyle(psLayer->class[nClassId], iStyle);
1422
1423 msSLDParsePolygonFill(psFill, psLayer->class[nClassId]->styles[iStyle],
1424 psLayer->map);
1425
1426 if (nOffsetX > 0 && nOffsetY > 0)
1427 {
1428 psLayer->class[nClassId]->styles[iStyle]->offsetx = nOffsetX;
1429 psLayer->class[nClassId]->styles[iStyle]->offsety = nOffsetY;
1430 }
1431 }
1432 /* stroke wich corresponds to the outilne in mapserver */
1433 /* is drawn after the fill */

Callers 1

msSLDParseRuleFunction · 0.85

Calls 5

msGrowLayerClassesFunction · 0.85
initClassFunction · 0.85
msSLDParsePolygonFillFunction · 0.85
msSLDParseStrokeFunction · 0.85

Tested by

no test coverage detected