[mapserver-commits] r8020 - branches/branch-5-2/mapserver

svn at osgeo.org svn at osgeo.org
Mon Nov 17 08:55:38 EST 2008


Author: Assefa
Date: 2008-11-17 08:55:37 -0500 (Mon, 17 Nov 2008)
New Revision: 8020

Modified:
   branches/branch-5-2/mapserver/HISTORY.TXT
   branches/branch-5-2/mapserver/mapcopy.c
   branches/branch-5-2/mapserver/mapogcsld.c
Log:
Add Support for SLD TextSymbolizer HALO and ANGLE (#2806)

Modified: branches/branch-5-2/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-2/mapserver/HISTORY.TXT	2008-11-17 13:53:09 UTC (rev 8019)
+++ branches/branch-5-2/mapserver/HISTORY.TXT	2008-11-17 13:55:37 UTC (rev 8020)
@@ -13,6 +13,8 @@
 Current Version (SVN branch-5-2)
 --------------------------------
 
+- Add Support for SLD TextSymbolizer HALO and ANGLE (#2806)
+
 - Fix crash when an invalid bbox filter is used (#2805)
 
 - raster query fix for tileindex with relative paths (#2722)

Modified: branches/branch-5-2/mapserver/mapcopy.c
===================================================================
--- branches/branch-5-2/mapserver/mapcopy.c	2008-11-17 13:53:09 UTC (rev 8019)
+++ branches/branch-5-2/mapserver/mapcopy.c	2008-11-17 13:55:37 UTC (rev 8020)
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id:$
+ * $Id$
  *
  * Project: MapServer
  * Purpose: Functions to allow copying/cloning of maps
@@ -298,6 +298,8 @@
 
     MS_COPYSTRING(dst->encoding, src->encoding);
 
+    MS_COPYSTELEM(outlinewidth);
+
     return MS_SUCCESS;
 }
 

Modified: branches/branch-5-2/mapserver/mapogcsld.c
===================================================================
--- branches/branch-5-2/mapserver/mapogcsld.c	2008-11-17 13:53:09 UTC (rev 8019)
+++ branches/branch-5-2/mapserver/mapogcsld.c	2008-11-17 13:55:37 UTC (rev 8020)
@@ -2502,7 +2502,7 @@
     char *pszName=NULL, *pszFontFamily=NULL, *pszFontStyle=NULL;
     char *pszFontWeight=NULL; 
     CPLXMLNode *psLabelPlacement=NULL, *psPointPlacement=NULL, *psLinePlacement=NULL;
-    CPLXMLNode *psFill = NULL, *psPropertyName=NULL;
+    CPLXMLNode *psFill = NULL, *psPropertyName=NULL, *psHalo=NULL, *psHaloRadius=NULL, *psHaloFill=NULL;
     int nLength = 0;
     char *pszColor = NULL;
     /* char *pszItem = NULL; */
@@ -2514,6 +2514,11 @@
 
     if (psRoot && psClass && psLayer)
     {
+        /*set the angle by defulat to auto. the angle can be
+          modified Label Placement #2806*/
+        psClass->label.autoangle = MS_TRUE;
+
+
         /* label  */
         /* support literal expression  and  propertyname 
          - <TextSymbolizer><Label>MY_COLUMN</Label>
@@ -2671,11 +2676,55 @@
                     if (psPointPlacement)
                       ParseTextPointPlacement(psPointPlacement, psClass);
                     if (psLinePlacement)
-                      ParseTextLinePlacement(psPointPlacement, psClass);
+                      ParseTextLinePlacement(psLinePlacement, psClass);
                 }
 
-                
 /* -------------------------------------------------------------------- */
+/*      parse the halo parameter.                                       */
+/* -------------------------------------------------------------------- */
+                psHalo = CPLGetXMLNode(psRoot, "Halo");
+                if (psHalo)
+                {
+                    psHaloRadius =  CPLGetXMLNode(psHalo, "Radius");
+                    if (psHaloRadius && psHaloRadius->psChild && psHaloRadius->psChild->pszValue)
+                      psClass->label.outlinewidth = atoi(psHaloRadius->psChild->pszValue);
+
+                    psHaloFill =  CPLGetXMLNode(psHalo, "Fill");
+                    if (psHaloFill)
+                    {
+                        psCssParam =  CPLGetXMLNode(psHaloFill, "CssParameter");
+                        while (psCssParam && psCssParam->pszValue && 
+                           strcasecmp(psCssParam->pszValue, "CssParameter") == 0)
+                        {
+                            pszName = (char*)CPLGetXMLValue(psCssParam, "name", NULL);
+                            if (pszName)
+                            {
+                                if (strcasecmp(pszName, "fill") == 0)
+                                {
+                                    if(psCssParam->psChild && psCssParam->psChild->psNext && 
+                                       psCssParam->psChild->psNext->pszValue)
+                                      pszColor = psCssParam->psChild->psNext->pszValue;
+
+                                    if (pszColor)
+                                    {
+                                        nLength = strlen(pszColor);
+                                        /* expecting hexadecimal ex : #aaaaff */
+                                        if (nLength == 7 && pszColor[0] == '#')
+                                        {
+                                            psClass->label.outlinecolor.red = msHexToInt(pszColor+1);
+                                            psClass->label.outlinecolor.green = msHexToInt(pszColor+3);
+                                            psClass->label.outlinecolor.blue = msHexToInt(pszColor+5);
+                                        }
+                                    }
+                                }
+                            }
+                            psCssParam = psCssParam->psNext;
+                        }
+
+                    }
+                    
+                }  
+/* -------------------------------------------------------------------- */
 /*      Parse the color                                                 */
 /* -------------------------------------------------------------------- */
                 psFill = CPLGetXMLNode(psRoot, "Fill");
@@ -2822,11 +2871,23 @@
     CPLXMLNode *psOffset = NULL;
     if (psRoot && psClass)
     {
+        /*if there is a line placement, we will assume that the 
+              best setting for mapserver would be for the text to follow
+              the line #2806*/
+        psClass->label.autofollow = MS_TRUE;         
+        psClass->label.autoangle = MS_TRUE; 
+
         psOffset = CPLGetXMLNode(psRoot, "PerpendicularOffset");
         if (psOffset && psOffset->psChild && psOffset->psChild->pszValue)
         {
             psClass->label.offsetx = atoi(psOffset->psChild->pszValue);
             psClass->label.offsety = atoi(psOffset->psChild->pszValue);
+
+            /*if there is a PerpendicularOffset, we will assume that the 
+              best setting for mapserver would be for use angle 0 and the
+              the offset #2806*/
+            psClass->label.autoangle = MS_FALSE;
+            psClass->label.autofollow = MS_FALSE; 
         }
     }
             



More information about the mapserver-commits mailing list