/ msSLDGeneratePolygonSLD */ / Generate SLD for a Polygon layer. */ /
| 3824 | /* Generate SLD for a Polygon layer. */ |
| 3825 | /************************************************************************/ |
| 3826 | char *msSLDGeneratePolygonSLD(styleObj *psStyle, layerObj *psLayer, int nVersion) |
| 3827 | { |
| 3828 | #if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) |
| 3829 | |
| 3830 | char szTmp[100]; |
| 3831 | char *pszSLD = NULL; |
| 3832 | char szHexColor[7]; |
| 3833 | char *pszGraphicSLD = NULL; |
| 3834 | double dfSize; |
| 3835 | char sCssParam[30]; |
| 3836 | char sNameSpace[10]; |
| 3837 | |
| 3838 | sCssParam[0] = '\0'; |
| 3839 | if (nVersion > OWS_1_0_0) |
| 3840 | strcpy(sCssParam, "se:SvgParameter"); |
| 3841 | else |
| 3842 | strcpy(sCssParam, "CssParameter"); |
| 3843 | |
| 3844 | sNameSpace[0] = '\0'; |
| 3845 | if (nVersion > OWS_1_0_0) |
| 3846 | strcpy(sNameSpace, "se:"); |
| 3847 | |
| 3848 | snprintf(szTmp, sizeof(szTmp), "<%sPolygonSymbolizer>\n", sNameSpace); |
| 3849 | |
| 3850 | pszSLD = msStringConcatenate(pszSLD, szTmp); |
| 3851 | /* fill */ |
| 3852 | if (psStyle->color.red != -1 && psStyle->color.green != -1 && |
| 3853 | psStyle->color.blue != -1) |
| 3854 | { |
| 3855 | |
| 3856 | snprintf(szTmp, sizeof(szTmp), "<%sFill>\n", sNameSpace); |
| 3857 | |
| 3858 | pszSLD = msStringConcatenate(pszSLD, szTmp); |
| 3859 | |
| 3860 | pszGraphicSLD = msSLDGetGraphicSLD(psStyle, psLayer, 0, nVersion); |
| 3861 | if (pszGraphicSLD) |
| 3862 | { |
| 3863 | snprintf(szTmp, sizeof(szTmp), "<%sGraphicFill>\n", sNameSpace); |
| 3864 | |
| 3865 | pszSLD = msStringConcatenate(pszSLD, szTmp); |
| 3866 | |
| 3867 | pszSLD = msStringConcatenate(pszSLD, pszGraphicSLD); |
| 3868 | |
| 3869 | snprintf(szTmp, sizeof(szTmp), "</%sGraphicFill>\n", sNameSpace); |
| 3870 | |
| 3871 | pszSLD = msStringConcatenate(pszSLD, szTmp); |
| 3872 | |
| 3873 | free(pszGraphicSLD); |
| 3874 | pszGraphicSLD = NULL; |
| 3875 | } |
| 3876 | |
| 3877 | sprintf(szHexColor,"%02x%02x%02x",psStyle->color.red, |
| 3878 | psStyle->color.green,psStyle->color.blue); |
| 3879 | |
| 3880 | snprintf(szTmp, sizeof(szTmp), |
| 3881 | "<%s name=\"fill\">#%s</%s>\n", |
| 3882 | sCssParam, szHexColor, sCssParam); |
| 3883 | pszSLD = msStringConcatenate(pszSLD, szTmp); |
no test coverage detected