/************************************************************************/ /* FLTApplyFilterToLayer */ /* */ /* Use the filter encoding node to create mapserver expressions */ /* and apply it to the layer. */ /************************************************************************/ int FLTApplyFilterToLayer(FilterEncodingNode *psNode, mapObj *map, int iLayerIndex, int bOnlySpatialFilter) { layerObj *layer = map->layers + iLayerIndex; if ( ! layer->vtable) { int rv = 0; if (rv = msLayerOpen(layer) != MS_SUCCESS) return rv; } return layer->vtable->LayerApplyFilterToLayer(psNode, map, iLayerIndex, bOnlySpatialFilter); } /************************************************************************/ /* FLTLayerApplyPlainFilterToLayer */ /* */ /* Helper function for layer virtual table architecture */ /************************************************************************/ int FLTLayerApplyPlainFilterToLayer(FilterEncodingNode *psNode, mapObj *map, int iLayerIndex, int bOnlySpatialFilter) { int *panResults = NULL; int nResults = 0; layerObj *psLayer = NULL; psLayer = &(map->layers[iLayerIndex]); panResults = FLTGetQueryResults(psNode, map, iLayerIndex, &nResults, bOnlySpatialFilter); if (panResults) { // FLTAddToLayerResultCache(panResults, nResults, map, iLayerIndex); /* clear the cache if the results is NULL to make sure there aren't */ /* any left over from intermediate queries. */ } else { if (psLayer && psLayer->resultcache) { if (psLayer->resultcache->results) free (psLayer->resultcache->results); free(psLayer->resultcache); psLayer->resultcache = NULL; } } if (panResults) free(panResults); return MS_SUCCESS; }