[mapserver-commits] r12904 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Dec 20 07:57:23 EST 2011


Author: tbonfort
Date: 2011-12-20 04:57:23 -0800 (Tue, 20 Dec 2011)
New Revision: 12904

Modified:
   trunk/mapserver/mapogcsld.c
Log:
add fill-opacity, stroke-opacity and stroke-width to sld pointsymbolizer


Modified: trunk/mapserver/mapogcsld.c
===================================================================
--- trunk/mapserver/mapogcsld.c	2011-12-19 14:33:09 UTC (rev 12903)
+++ trunk/mapserver/mapogcsld.c	2011-12-20 12:57:23 UTC (rev 12904)
@@ -1661,7 +1661,7 @@
     CPLXMLNode *psWellKnownName, *psStroke, *psFill;
     CPLXMLNode *psDisplacement=NULL, *psDisplacementX=NULL, *psDisplacementY=NULL;
     CPLXMLNode *psOpacity=NULL, *psRotation=NULL;
-    char *psColor=NULL, *psColorName = NULL;
+    char *psName=NULL, *psValue = NULL;
     int nLength = 0;
     char *pszSymbolName = NULL;
     int bFilled = 0, bStroked=0;
@@ -1788,27 +1788,39 @@
                                (strcasecmp(psCssParam->pszValue, "CssParameter") == 0 ||
                                 strcasecmp(psCssParam->pszValue, "SvgParameter") == 0))
                         {
-                            psColorName = 
+                            psName = 
                               (char*)CPLGetXMLValue(psCssParam, "name", NULL);
-                            if (psColorName && 
-                                strcasecmp(psColorName, "fill") == 0)
+                            if (psName && 
+                                strcasecmp(psName, "fill") == 0)
                             {
                                 if(psCssParam->psChild && 
                                    psCssParam->psChild->psNext && 
                                    psCssParam->psChild->psNext->pszValue)
-                                  psColor = psCssParam->psChild->psNext->pszValue;
+                                  psValue = psCssParam->psChild->psNext->pszValue;
 
-                                if (psColor)
+                                if (psValue)
                                 {
-                                    nLength = strlen(psColor);
-                                    if (nLength == 7 && psColor[0] == '#')
+                                    nLength = strlen(psValue);
+                                    if (nLength == 7 && psValue[0] == '#')
                                     {
-                                        msSLDSetColorObject(psColor,
+                                        msSLDSetColorObject(psValue,
                                                             &psStyle->color);
                                     }
                                 }
-                                break;
                             }
+                            else if (psName && 
+                                strcasecmp(psName, "fill-opacity") == 0)
+                            {
+                                if(psCssParam->psChild && 
+                                   psCssParam->psChild->psNext && 
+                                   psCssParam->psChild->psNext->pszValue)
+                                  psValue = psCssParam->psChild->psNext->pszValue;
+
+                                if (psValue)
+                                {
+                                    psStyle->color.alpha = (int)(atof(psValue)*255);
+                                }
+                            }
                         
                             psCssParam = psCssParam->psNext;
                         }
@@ -1824,27 +1836,52 @@
                                (strcasecmp(psCssParam->pszValue, "CssParameter") == 0 ||
                                 strcasecmp(psCssParam->pszValue, "SvgParameter") == 0))
                         {
-                            psColorName = 
+                            psName = 
                               (char*)CPLGetXMLValue(psCssParam, "name", NULL);
-                            if (psColorName && 
-                                strcasecmp(psColorName, "stroke") == 0) 
+                            if (psName && 
+                                strcasecmp(psName, "stroke") == 0) 
                             {
                                 if(psCssParam->psChild && 
                                    psCssParam->psChild->psNext && 
                                    psCssParam->psChild->psNext->pszValue)
-                                  psColor = psCssParam->psChild->psNext->pszValue;
+                                  psValue = psCssParam->psChild->psNext->pszValue;
 
-                                if (psColor)
+                                if (psValue)
                                 {
-                                    nLength = strlen(psColor);
-                                    if (nLength == 7 && psColor[0] == '#')
+                                    nLength = strlen(psValue);
+                                    if (nLength == 7 && psValue[0] == '#')
                                     {
-                                      msSLDSetColorObject(psColor,
+                                      msSLDSetColorObject(psValue,
                                                           &psStyle->outlinecolor);
                                     }
                                 }
-                                break;
                             }
+                            else if (psName && 
+                                strcasecmp(psName, "stroke-opacity") == 0)
+                            {
+                                if(psCssParam->psChild && 
+                                   psCssParam->psChild->psNext && 
+                                   psCssParam->psChild->psNext->pszValue)
+                                  psValue = psCssParam->psChild->psNext->pszValue;
+
+                                if (psValue)
+                                {
+                                    psStyle->outlinecolor.alpha = (int)(atof(psValue)*255);
+                                }
+                            }
+                            else if (psName && 
+                                strcasecmp(psName, "stroke-width") == 0)
+                            {
+                                if(psCssParam->psChild && 
+                                   psCssParam->psChild->psNext && 
+                                   psCssParam->psChild->psNext->pszValue)
+                                  psValue = psCssParam->psChild->psNext->pszValue;
+
+                                if (psValue)
+                                {
+                                    psStyle->width = atof(psValue);
+                                }
+                            }
                         
                             psCssParam = psCssParam->psNext;
                         }



More information about the mapserver-commits mailing list