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

Function msSLDParseStroke

mapogcsld.c:1172–1296  ·  view source on GitHub ↗

/ void msSLDParseStroke(CPLXMLNode *psStroke, styleObj */ psStyle, int iColorParam) */ / Parse Stroke content into a style object. */ The iColorParm is used to indicate which color object to use */ : */ 0 : for color */ 1

Source from the content-addressed store, hash-verified

1170/* 2 : backgroundcolor */
1171/************************************************************************/
1172int msSLDParseStroke(CPLXMLNode *psStroke, styleObj *psStyle,
1173 mapObj *map, int iColorParam)
1174{
1175 CPLXMLNode *psCssParam = NULL, *psGraphicFill=NULL;
1176 char *psStrkName = NULL;
1177 char *psColor = NULL;
1178 int nLength = 0;
1179 char *pszDashValue = NULL;
1180
1181 if (!psStroke || !psStyle)
1182 return MS_FAILURE;
1183
1184 /* parse css parameters */
1185 psCssParam = CPLGetXMLNode(psStroke, "CssParameter");
1186 /*sld 1.1 used SvgParameter*/
1187 if (psCssParam == NULL)
1188 psCssParam = CPLGetXMLNode(psStroke, "SvgParameter");
1189
1190 while (psCssParam && psCssParam->pszValue &&
1191 (strcasecmp(psCssParam->pszValue, "CssParameter") == 0 ||
1192 strcasecmp(psCssParam->pszValue, "SvgParameter") == 0))
1193 {
1194 psStrkName = (char*)CPLGetXMLValue(psCssParam, "name", NULL);
1195
1196 if (psStrkName)
1197 {
1198 if (strcasecmp(psStrkName, "stroke") == 0)
1199 {
1200 if(psCssParam->psChild && psCssParam->psChild->psNext &&
1201 psCssParam->psChild->psNext->pszValue)
1202 psColor = psCssParam->psChild->psNext->pszValue;
1203
1204 if (psColor)
1205 {
1206 nLength = strlen(psColor);
1207 /* expecting hexadecimal ex : #aaaaff */
1208 if (nLength == 7 && psColor[0] == '#')
1209 {
1210 if (iColorParam == 0)
1211 {
1212 psStyle->color.red = msHexToInt(psColor+1);
1213 psStyle->color.green = msHexToInt(psColor+3);
1214 psStyle->color.blue= msHexToInt(psColor+5);
1215 }
1216 else if (iColorParam == 1)
1217 {
1218 psStyle->outlinecolor.red = msHexToInt(psColor+1);
1219 psStyle->outlinecolor.green = msHexToInt(psColor+3);
1220 psStyle->outlinecolor.blue= msHexToInt(psColor+5);
1221 }
1222 else if (iColorParam == 2)
1223 {
1224 psStyle->backgroundcolor.red = msHexToInt(psColor+1);
1225 psStyle->backgroundcolor.green = msHexToInt(psColor+3);
1226 psStyle->backgroundcolor.blue= msHexToInt(psColor+5);
1227 }
1228 }
1229 }

Callers 2

msSLDParseLineSymbolizerFunction · 0.85

Calls 6

strcasecmpFunction · 0.85
msHexToIntFunction · 0.85
msStrdupFunction · 0.85
msStringSplitFunction · 0.85
msFreeCharArrayFunction · 0.85

Tested by

no test coverage detected