[mapserver-commits] r11710 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri May 13 13:37:01 EDT 2011
Author: tamas
Date: 2011-05-13 10:37:01 -0700 (Fri, 13 May 2011)
New Revision: 11710
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapunion.c
Log:
Union layer: Fixed the crash when styling source layers using attributes (#3870)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-05-13 17:36:33 UTC (rev 11709)
+++ trunk/mapserver/HISTORY.TXT 2011-05-13 17:37:01 UTC (rev 11710)
@@ -15,6 +15,8 @@
Current Version (SVN trunk, 6.1-dev, future 6.2):
-------------------------------------------------
+- Union layer: Fixed the crash when styling source layers using attributes (#3870)
+
- Added GEOS difference operator to expression support (#3871)
Version 6.0.0 (2011-05-11)
Modified: trunk/mapserver/mapunion.c
===================================================================
--- trunk/mapserver/mapunion.c 2011-05-13 17:36:33 UTC (rev 11709)
+++ trunk/mapserver/mapunion.c 2011-05-13 17:37:01 UTC (rev 11710)
@@ -47,6 +47,7 @@
{
int layerIndex; /* current source layer index */
int classIndex; /* current class index */
+ char* classText; /* current class text (autostyle) */
int layerCount; /* number of the source layers */
layerObj* layers; /* structure to the source layers */
int *status; /* the layer status */
@@ -74,6 +75,7 @@
msFree(layerinfo->layers);
msFree(layerinfo->status);
msFree(layerinfo->classgroup);
+ msFree(layerinfo->classText);
msFree(layerinfo);
layer->layerinfo = NULL;
@@ -117,6 +119,8 @@
layerinfo->nclasses = 0;
layerinfo->layerCount = 0;
+
+ layerinfo->classText = NULL;
layerNames = msStringSplit(layer->connection, ',', &layerCount);
@@ -254,7 +258,7 @@
/* allocate the iteminfo index array - same order as the item list */
int msUnionLayerInitItemInfo(layerObj *layer)
{
- int i, j, numitems;
+ int i, numitems;
int *itemindexes;
char* itemlist = NULL;
@@ -456,6 +460,13 @@
/* Generic feature style handling as per RFC-61 */
msLayerGetFeatureStyle(layer->map, srclayer, srclayer->class[layerinfo->classIndex], shape);
}
+ /* set up annotation */
+ msFree(layerinfo->classText);
+ if((srclayer->class[layerinfo->classIndex]->text.string || srclayer->labelitem) &&
+ srclayer->class[layerinfo->classIndex]->label.size != -1)
+ layerinfo->classText = msShapeGetAnnotation(srclayer, shape);
+ else
+ layerinfo->classText = NULL;
}
#ifdef USE_PROJ
@@ -465,7 +476,10 @@
else
srclayer->project = MS_FALSE;
#endif
-
+ /* update the layer styles with the bound values */
+ if(msBindLayerToShape(srclayer, shape, MS_FALSE) != MS_SUCCESS)
+ return MS_FAILURE;
+
shape->tileindex = layerinfo->layerIndex;
/* construct the item array */
@@ -611,7 +625,7 @@
}
else
{
- int i;
+ int i,j;
classObj* src = srclayer->class[layerinfo->classIndex];
/* copy the style from the current class index */
/* free any previous styles on the dst layer */
@@ -628,6 +642,13 @@
msSetError(MS_MEMERR, "Failed to copy style.", "msUnionLayerGetAutoStyle()");
return MS_FAILURE;
}
+ /* remove the bindings on the style */
+ for(j=0; j<MS_STYLE_BINDING_LENGTH; j++)
+ {
+ msFree(c->styles[i]->bindings[j].item);
+ c->styles[i]->bindings[j].item = NULL;
+ }
+ c->styles[i]->numbindings = 0;
}
if (msCopyLabel(&(c->label), &(src->label)) != MS_SUCCESS)
@@ -636,8 +657,18 @@
return MS_FAILURE;
}
+ /* remove the bindings on the label */
+ for(j=0; j<MS_LABEL_BINDING_LENGTH; j++)
+ {
+ msFree(c->label.bindings[j].item);
+ c->label.bindings[j].item = NULL;
+ }
+ c->label.numbindings = 0;
+
c->type = src->type;
c->layer = layer;
+ c->text.string = layerinfo->classText;
+ layerinfo->classText = NULL;
}
return MS_SUCCESS;
}
More information about the mapserver-commits
mailing list