Permalink
Browse files

Update symbol references when removing a symbol (#4656)

  • Loading branch information...
1 parent cc9630e commit ab869edeb15de16f699822f97b5a794eba8d2ec6 @szekerest szekerest committed Jun 3, 2013
Showing with 27 additions and 0 deletions.
  1. +27 −0 mapsymbol.c
View
@@ -748,6 +748,33 @@ symbolObj *msRemoveSymbol(symbolSetObj *symbolset, int nSymbolIndex)
symbolset->symbol[i-1]=NULL;
symbolset->numsymbols--;
MS_REFCNT_DECR(symbol);
+ /* update symbol references in the map */
+ if (symbolset->map) {
+ int l,c,s,lb;
+ layerObj *layer;
+ classObj *cl;
+ styleObj *style;
+ labelObj *label;
+ for (l = 0; l < symbolset->map->numlayers; l++) {
+ layer = GET_LAYER(symbolset->map, l);
+ for (c = 0; c < layer->numclasses; c++) {
+ cl = layer->class[c];
+ for (s = 0; s < cl->numstyles; s++) {
+ style = cl->styles[s];
+ if (style->symbol >= nSymbolIndex)
+ --style->symbol;
+ }
+ for (lb = 0; lb < cl->numlabels; lb++) {
+ label = cl->labels[lb];
+ for (s = 0; s < label->numstyles; s++) {
+ style = label->styles[s];
+ if (style->symbol >= nSymbolIndex)
+ --style->symbol;
+ }
+ }
+ }
+ }
+ }
return symbol;
}
}

0 comments on commit ab869ed

Please sign in to comment.