# OpenLayers.Strategy.Filter

Strategy for limiting features that get added to a layer by evaluating a filter. The strategy maintains a cache of all features until removeFeatures is called on the layer.

#### Inherits from

- OpenLayers.Strategy

Summary

OpenLayers.Strategy.Filter | Strategy for limiting features that get added to a layer by evaluating a filter.
Properties |
filter | {OpenLayers.Filter} Filter for limiting features sent to the layer.
cache | {Array(OpenLayers.Feature.Vector)} List of currently cached features.
caching | {Boolean} The filter is currently caching features.
Constructor |
OpenLayers.Strategy.Filter | Create a new filter strategy.
Functions |
activate | Activate the strategy.
deactivate | Deactivate the strategy.
handleAdd |
handleRemove |
setFilter | Update the filter for this strategy.

### Properties

### filter

{OpenLayers.Filter} Filter for limiting features sent to the layer. Use the setFilter method to update this filter after construction.

### cache

{Array(OpenLayers.Feature.Vector)} List of currently cached features.

### caching

{Boolean} The filter is currently caching features.

### Constructor

### OpenLayers.Strategy.Filter

Create a new filter strategy.

#### Parameters

options | {Object} Optional object whose properties will be set on the instance.

### Functions

### activate

> activate: function()

Activate the strategy. Register any listeners, do appropriate setup. By default, this strategy automatically activates itself when a layer is added to a map.

#### Returns

{Boolean} True if the strategy was successfully activated or false if the strategy was already active.

### deactivate

> deactivate: function()

Deactivate the strategy. Clear the feature cache.

#### Returns

{Boolean} True if the strategy was successfully deactivated or false if the strategy was already inactive.

### handleAdd

> handleAdd: function( | event | )

### handleRemove

> handleRemove: function( | event | )

### setFilter

> setFilter: function( | filter | )

Update the filter for this strategy. This will re-evaluate any features on the layer and in the cache. Only features for which filter.evalute(feature) returns true will be added to the layer. Others will be cached by the strategy.

#### Parameters

filter | {OpenLayers.Filter} A filter for evaluating features.

This class represents an OGC Filter.
Vector features use the OpenLayers.Geometry classes as geometry description.

> activate: function()

Activate the strategy.

> deactivate: function()

Deactivate the strategy.

> handleAdd: function( | event | )

> handleRemove: function( | event | )

> setFilter: function( | filter | )

Update the filter for this strategy.
Abstract vector layer strategy class.
Close