[mapserver-commits] r9541 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Wed Nov 11 10:03:26 EST 2009
Author: assefa
Date: 2009-11-11 10:03:26 -0500 (Wed, 11 Nov 2009)
New Revision: 9541
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapogcsld.c
Log:
Support name aliases used in sld text symbolizer (#3114)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2009-11-11 11:05:37 UTC (rev 9540)
+++ trunk/mapserver/HISTORY.TXT 2009-11-11 15:03:26 UTC (rev 9541)
@@ -14,6 +14,8 @@
Current Version (SVN trunk):
----------------------------
+- Support name aliases used in sld text symbolizer (#3114)
+
- decode html and unicode entities for polygon truetype symbol fills
- Parse PropertyName parameter for wfs requests (#675)
Modified: trunk/mapserver/mapogcsld.c
===================================================================
--- trunk/mapserver/mapogcsld.c 2009-11-11 11:05:37 UTC (rev 9540)
+++ trunk/mapserver/mapogcsld.c 2009-11-11 15:03:26 UTC (rev 9541)
@@ -145,7 +145,7 @@
int nLayers = 0;
layerObj *pasLayers = NULL;
- int i, j, k, iClass;
+ int i, j, k, z, iClass;
int bUseSpecificLayer = 0;
int bSuccess =0;
const char *pszTmp = NULL;
@@ -153,6 +153,10 @@
int nLayerStatus = 0;
/*const char *pszSLDNotSupported = NULL;*/
char *tmpfilename = NULL;
+ const char *pszFullName = NULL;
+ char szTmp[256];
+ char *pszTmp1=NULL;
+ char *pszTmp2 = NULL;
pasLayers = msSLDParseSLD(map, psSLDXML, &nLayers);
@@ -220,6 +224,35 @@
GET_LAYER(map, i)->class[iClass]->layer = GET_LAYER(map, i);
GET_LAYER(map, i)->class[iClass]->type = GET_LAYER(map, i)->type;
GET_LAYER(map, i)->numclasses++;
+
+ /*aliases may have been used as part of the sld text symbolizer for
+ label element. Try to process it if that is the case #3114*/
+ if (msLayerOpen(GET_LAYER(map, i)) == MS_SUCCESS &&
+ msLayerGetItems(GET_LAYER(map, i)) == MS_SUCCESS)
+ {
+ if (GET_LAYER(map, i)->class[iClass]->text.string)
+ {
+ for(z=0; z<GET_LAYER(map, i)->numitems; z++)
+ {
+ if (!GET_LAYER(map, i)->items[z] || strlen(GET_LAYER(map, i)->items[z]) <= 0)
+ continue;
+ sprintf(szTmp, "%s_alias", GET_LAYER(map, i)->items[z]);
+ pszFullName = msOWSLookupMetadata(&(GET_LAYER(map, i)->metadata), "G", szTmp);
+ pszTmp1 = strdup( GET_LAYER(map, i)->class[iClass]->text.string);
+ if (pszFullName != NULL && (strstr(pszTmp1, pszFullName) != NULL))
+ {
+ char *tmpstr1= NULL;
+ tmpstr1 = msReplaceSubstring(pszTmp1, pszFullName, GET_LAYER(map, i)->items[z]);
+ pszTmp2 = (char *)malloc(sizeof(char)*(strlen(tmpstr1)+3));
+ sprintf(pszTmp2,"(%s)",tmpstr1);
+ msLoadExpressionString(&(GET_LAYER(map, i)->class[iClass]->text), pszTmp2);
+ msFree(pszTmp2);
+ }
+ msFree(pszTmp1);
+ }
+ }
+ }
+
iClass++;
}
}
@@ -2864,25 +2897,13 @@
pszClassText = msStringConcatenate(pszClassText, "])");
}
}
- /*
- psPropertyName = CPLGetXMLNode(psLabel, "PropertyName");
- if (psPropertyName && psPropertyName->psChild &&
- psPropertyName->psChild->pszValue)
- pszItem = psPropertyName->psChild->pszValue;
- else if (psLabel->psChild && psLabel->psChild->pszValue)
- pszItem = psLabel->psChild->pszValue;
- */
+
if (pszClassText) /* pszItem) */
{
- /* if (psLayer->labelitem)
- free (psLayer->labelitem);
- psLayer->labelitem = strdup(pszItem);
- */
-
-
msLoadExpressionString(&psClass->text, pszClassText);
free(pszClassText);
+
/* font */
psFont = CPLGetXMLNode(psRoot, "Font");
if (psFont)
More information about the mapserver-commits
mailing list