MCPcopy Create free account
hub / github.com/MapServer/MapServer / msSLDParseGraphicFillOrStroke

Function msSLDParseGraphicFillOrStroke

mapogcsld.c:1563–1793  ·  view source on GitHub ↗

/ msSLDParseGraphicFillOrStroke */ / Parse the GraphicFill Or GraphicStroke node : look for a */ Marker symbol and set the style for that symbol. */ /

Source from the content-addressed store, hash-verified

1561/* Marker symbol and set the style for that symbol. */
1562/************************************************************************/
1563int msSLDParseGraphicFillOrStroke(CPLXMLNode *psRoot,
1564 char *pszDashValue,
1565 styleObj *psStyle, mapObj *map,
1566 int bPointLayer)
1567{
1568 CPLXMLNode *psCssParam, *psGraphic, *psExternalGraphic, *psMark, *psSize;
1569 CPLXMLNode *psWellKnownName, *psStroke, *psFill;
1570 CPLXMLNode *psDisplacement=NULL, *psDisplacementX=NULL, *psDisplacementY=NULL;
1571 CPLXMLNode *psOpacity=NULL, *psRotation=NULL;
1572 char *psColor=NULL, *psColorName = NULL;
1573 int nLength = 0;
1574 char *pszSymbolName = NULL;
1575 int bFilled = 0, bStroked=0;
1576 CPLXMLNode *psPropertyName=NULL;
1577 char szTmp[256];
1578
1579 bPointLayer=0;
1580
1581 if (!psRoot || !psStyle || !map)
1582 return MS_FAILURE;
1583/* ==================================================================== */
1584/* This a definition taken from the specification (11.3.2) : */
1585/* Graphics can either be referenced from an external URL in a common format (such as*/
1586/* GIF or SVG) or may be derived from a Mark. Multiple external URLs and marks may be*/
1587/* referenced with the semantic that they all provide the equivalent graphic in different*/
1588/* formats. */
1589/* */
1590/* For this reason, we only need to support one Mark and one */
1591/* ExtrnalGraphic ???? */
1592/* ==================================================================== */
1593 psGraphic = CPLGetXMLNode(psRoot, "Graphic");
1594 if (psGraphic)
1595 {
1596 /* extract symbol size */
1597 psSize = CPLGetXMLNode(psGraphic, "Size");
1598 if (psSize && psSize->psChild && psSize->psChild->pszValue)
1599 psStyle->size = atof(psSize->psChild->pszValue);
1600 else
1601 {
1602 /*do not set a default for external symbols #2305*/
1603 psExternalGraphic = CPLGetXMLNode(psGraphic, "ExternalGraphic");
1604 if (!psExternalGraphic)
1605 psStyle->size = 6; /* default value */
1606 }
1607
1608 /*SLD 1.1.0 extract opacity, rotation, displacement*/
1609 psOpacity = CPLGetXMLNode(psGraphic, "Opacity");
1610 if (psOpacity && psOpacity->psChild && psOpacity->psChild->pszValue)
1611 psStyle->opacity = (int)(atof(psOpacity->psChild->pszValue) * 100);
1612
1613 psRotation = CPLGetXMLNode(psGraphic, "Rotation");
1614 if (psRotation)
1615 {
1616 psPropertyName = CPLGetXMLNode(psRotation, "PropertyName");
1617 if (psPropertyName)
1618 {
1619 snprintf(szTmp, sizeof(szTmp), "%s", CPLGetXMLValue(psPropertyName, NULL, NULL));
1620 psStyle->bindings[MS_STYLE_BINDING_ANGLE].item = msStrdup(szTmp);

Callers 3

msSLDParseStrokeFunction · 0.85
msSLDParsePolygonFillFunction · 0.85

Calls 6

msStrdupFunction · 0.85
strcasecmpFunction · 0.85
msGetSymbolIndexFunction · 0.85
msSLDSetColorObjectFunction · 0.85
msSLDGetMarkSymbolFunction · 0.85

Tested by

no test coverage detected