/ msSLDParseTextParams */ / Parse text paramaters like font, placement and color. */ /
| 2766 | /* Parse text paramaters like font, placement and color. */ |
| 2767 | /************************************************************************/ |
| 2768 | int 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); |
no test coverage detected