[mapserver-commits] r11604 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Tue Apr 19 17:57:08 EDT 2011
Author: tamas
Date: 2011-04-19 14:57:08 -0700 (Tue, 19 Apr 2011)
New Revision: 11604
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapunion.c
Log:
Union Layer: Add support for the layer FILTER expressions, add "Union:SourceLayerVisible" predefined attribute (#3674)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-04-19 14:58:02 UTC (rev 11603)
+++ trunk/mapserver/HISTORY.TXT 2011-04-19 21:57:08 UTC (rev 11604)
@@ -15,6 +15,9 @@
Current Version (SVN trunk):
----------------------------
+- Union Layer: Add support for the layer FILTER expressions,
+ add "Union:SourceLayerVisible" predefined attribute (#3674)
+
- fix circle layer drawing for edge case when point1.x==point2.x (#1356)
- fix incorrect quantization for images with very large number of
Modified: trunk/mapserver/mapunion.c
===================================================================
--- trunk/mapserver/mapunion.c 2011-04-19 14:58:02 UTC (rev 11603)
+++ trunk/mapserver/mapunion.c 2011-04-19 21:57:08 UTC (rev 11604)
@@ -35,11 +35,13 @@
MS_CVSID("$Id$")
-#define MSUNION_NUMITEMS 2
+#define MSUNION_NUMITEMS 3
#define MSUNION_SOURCELAYERNAME "Union:SourceLayerName"
#define MSUNION_SOURCELAYERNAMEINDEX -100
#define MSUNION_SOURCELAYERGROUP "Union:SourceLayerGroup"
#define MSUNION_SOURCELAYERGROUPINDEX -101
+#define MSUNION_SOURCELAYERVISIBLE "Union:SourceLayerVisible"
+#define MSUNION_SOURCELAYERVISIBLEINDEX -102
typedef struct
{
@@ -259,6 +261,8 @@
itemindexes[i] = MSUNION_SOURCELAYERNAMEINDEX;
else if (EQUAL(layer->items[i], MSUNION_SOURCELAYERGROUP))
itemindexes[i] = MSUNION_SOURCELAYERGROUPINDEX;
+ else if (EQUAL(layer->items[i], MSUNION_SOURCELAYERVISIBLE))
+ itemindexes[i] = MSUNION_SOURCELAYERVISIBLEINDEX;
else
itemindexes[i] = numitems++;
}
@@ -350,6 +354,13 @@
values[i] = msStrdup(srclayer->name);
else if (itemindexes[i] == MSUNION_SOURCELAYERGROUPINDEX)
values[i] = msStrdup(srclayer->group);
+ else if (itemindexes[i] == MSUNION_SOURCELAYERVISIBLEINDEX)
+ {
+ if (srclayer->status == MS_OFF)
+ values[i] = msStrdup("0");
+ else
+ values[i] = msStrdup("1");
+ }
else if (shape->values[itemindexes[i]])
values[i] = msStrdup(shape->values[itemindexes[i]]);
else
@@ -419,9 +430,23 @@
/* construct the item array */
if (layer->iteminfo)
- return BuildFeatureAttributes(layer, srclayer, shape);
+ rv = BuildFeatureAttributes(layer, srclayer, shape);
- return MS_SUCCESS;
+ /* check the layer filter condition */
+ if(layer->filter.string != NULL && layer->numitems > 0 && layer->iteminfo)
+ {
+ if (layer->filter.type == MS_EXPRESSION && layer->filter.tokens == NULL)
+ msTokenizeExpression(&(layer->filter), layer->items, &(layer->numitems));
+
+ if (!msEvalExpression(layer, shape, &(layer->filter), layer->filteritemindex))
+ {
+ /* this shape is filtered */
+ msFreeShape(shape);
+ continue;
+ }
+ }
+
+ return rv;
}
++layerinfo->layerIndex;
@@ -489,7 +514,7 @@
int msUnionLayerGetItems(layerObj *layer)
{
/* we support certain built in attributes */
- layer->numitems = MSUNION_NUMITEMS;
+ layer->numitems = 2;
layer->items = malloc(sizeof(char*) * (layer->numitems));
MS_CHECK_ALLOC(layer->items, layer->numitems * sizeof(char*), MS_FAILURE);
layer->items[0] = msStrdup(MSUNION_SOURCELAYERNAME);
More information about the mapserver-commits
mailing list