Permalink
Browse files

Fix problems with STYLEITEM (#4534)

  • Loading branch information...
1 parent 6d2fe7d commit 82da39e7a4665ec9459ae1fa89851060f438a232 @szekerest szekerest committed Dec 9, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 maplayer.c
View
@@ -702,11 +702,24 @@ int msLayerGetFeatureStyle(mapObj *map, layerObj *layer, classObj *c, shapeObj*
/* try to find out the current style format */
if (strncasecmp(stylestring,"style",5) == 0) {
resetClassStyle(c);
+ c->layer = layer;
if (msMaybeAllocateClassStyle(c, 0))
return(MS_FAILURE);
msUpdateStyleFromString(c->styles[0], stylestring, MS_FALSE);
+ if(c->styles[0]->symbolname) {
+ if((c->styles[0]->symbol = msGetSymbolIndex(&(map->symbolset), c->styles[0]->symbolname, MS_TRUE)) == -1) {
+ msSetError(MS_MISCERR, "Undefined symbol \"%s\" in class of layer %s.", "msLayerGetFeatureStyle()",
+ c->styles[0]->symbolname, layer->name);
+ return MS_FAILURE;
+ }
+ }
} else if (strncasecmp(stylestring,"class",5) == 0) {
+ if (strcasestr(stylestring, " style ") != NULL) {
+ /* reset style if stylestring contains style definitions */
+ resetClassStyle(c);
+ c->layer = layer;
+ }
msUpdateClassFromString(c, stylestring, MS_FALSE);
} else if (strncasecmp(stylestring,"pen",3) == 0 || strncasecmp(stylestring,"brush",5) == 0 ||
strncasecmp(stylestring,"symbol",6) == 0 || strncasecmp(stylestring,"label",5) == 0) {

0 comments on commit 82da39e

Please sign in to comment.