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

Function msSLDParseTextParams

mapogcsld.c:2768–3046  ·  view source on GitHub ↗

/ msSLDParseTextParams */ / Parse text paramaters like font, placement and color. */ /

Source from the content-addressed store, hash-verified

2766/* Parse text paramaters like font, placement and color. */
2767/************************************************************************/
2768int msSLDParseTextParams(CPLXMLNode *psRoot, layerObj *psLayer,
2769 classObj *psClass)
2770{
2771 char szFontName[100];
2772 double dfFontSize = 10;
2773 int bFontSet = 0;
2774
2775 CPLXMLNode *psLabel=NULL, *psFont=NULL;
2776 CPLXMLNode *psCssParam = NULL;
2777 char *pszName=NULL, *pszFontFamily=NULL, *pszFontStyle=NULL;
2778 char *pszFontWeight=NULL;
2779 CPLXMLNode *psLabelPlacement=NULL, *psPointPlacement=NULL, *psLinePlacement=NULL;
2780 CPLXMLNode *psFill = NULL, *psPropertyName=NULL, *psHalo=NULL, *psHaloRadius=NULL, *psHaloFill=NULL;
2781 int nLength = 0;
2782 char *pszColor = NULL;
2783 /* char *pszItem = NULL; */
2784 CPLXMLNode *psTmpNode = NULL;
2785 char *pszClassText = NULL;
2786 char szTmp[100];
2787
2788 szFontName[0]='\0';
2789
2790 if (!psRoot || !psClass || !psLayer)
2791 return MS_FAILURE;
2792
2793 /*set the angle by default to auto. the angle can be
2794 modified Label Placement #2806*/
2795 psClass->label.anglemode = MS_AUTO;
2796
2797
2798 /* label */
2799 /* support literal expression and propertyname
2800 - <TextSymbolizer><Label>MY_COLUMN</Label>
2801 - <TextSymbolizer><Label><ogc:PropertyName>MY_COLUMN</ogc:PropertyName></Label>
2802 Bug 1857 */
2803 psLabel = CPLGetXMLNode(psRoot, "Label");
2804 if (psLabel )
2805 {
2806 psTmpNode = psLabel->psChild;
2807 psPropertyName = CPLGetXMLNode(psLabel, "PropertyName");
2808 if (psPropertyName)
2809 {
2810 while (psTmpNode)
2811 {
2812 /* open bracket to get valid expression */
2813 if (pszClassText == NULL)
2814 pszClassText = msStringConcatenate(pszClassText, "(");
2815
2816 if (psTmpNode->eType == CXT_Text && psTmpNode->pszValue)
2817 {
2818 pszClassText = msStringConcatenate(pszClassText, psTmpNode->pszValue);
2819 }
2820 else if (psTmpNode->eType == CXT_Element &&
2821 strcasecmp(psTmpNode->pszValue,"PropertyName") ==0 &&
2822 CPLGetXMLValue(psTmpNode, NULL, NULL))
2823 {
2824 snprintf(szTmp, sizeof(szTmp), "\"[%s]\"", CPLGetXMLValue(psTmpNode, NULL, NULL));
2825 pszClassText = msStringConcatenate(pszClassText, szTmp);

Callers 1

msSLDParseTextSymbolizerFunction · 0.85

Calls 9

msStringConcatenateFunction · 0.85
strcasecmpFunction · 0.85
msLoadExpressionStringFunction · 0.85
strlcatFunction · 0.85
msLookupHashTableFunction · 0.85
msStrdupFunction · 0.85
ParseTextPointPlacementFunction · 0.85
ParseTextLinePlacementFunction · 0.85
msHexToIntFunction · 0.85

Tested by

no test coverage detected