ol.Filter is now a (base) class, not an interface any more
ol.Filter can now also be used to provide a simple filter that just evaluates a user provided filter function against a feature.
This commit is contained in:
@@ -7,10 +7,11 @@ goog.require('ol.filter.Filter');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {ol.filter.Filter}
|
||||
* @extends {ol.filter.Filter}
|
||||
* @param {ol.Extent} extent The extent.
|
||||
*/
|
||||
ol.filter.Extent = function(extent) {
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @type {ol.Extent}
|
||||
@@ -19,6 +20,7 @@ ol.filter.Extent = function(extent) {
|
||||
this.extent_ = extent;
|
||||
|
||||
};
|
||||
goog.inherits(ol.filter.Extent, ol.filter.Filter);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,13 +5,20 @@ goog.require('ol.Feature');
|
||||
|
||||
|
||||
/**
|
||||
* @interface
|
||||
* @constructor
|
||||
* @param {function(this:ol.filter.Filter, ol.Feature)=} opt_filterFunction
|
||||
* Filter function. Should return true if the passed feature passes the
|
||||
* filter, false otherwise.
|
||||
*/
|
||||
ol.filter.Filter = function() {};
|
||||
ol.filter.Filter = function(opt_filterFunction) {
|
||||
if (goog.isDef(opt_filterFunction)) {
|
||||
this.applies = opt_filterFunction;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Feature} feature Feature to evaluate.
|
||||
* @param {ol.Feature} feature Feature to evaluate the filter against.
|
||||
* @return {boolean} The provided feature passes this filter.
|
||||
*/
|
||||
ol.filter.Filter.prototype.applies = function(feature) {};
|
||||
ol.filter.Filter.prototype.applies = goog.abstractMethod;
|
||||
|
||||
@@ -8,10 +8,11 @@ goog.require('ol.geom.GeometryType');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {ol.filter.Filter}
|
||||
* @extends {ol.filter.Filter}
|
||||
* @param {ol.geom.GeometryType} type The geometry type.
|
||||
*/
|
||||
ol.filter.Geometry = function(type) {
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @type {ol.geom.GeometryType}
|
||||
@@ -20,6 +21,7 @@ ol.filter.Geometry = function(type) {
|
||||
this.type_ = type;
|
||||
|
||||
};
|
||||
goog.inherits(ol.filter.Geometry, ol.filter.Filter);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,11 +7,12 @@ goog.require('ol.filter.Filter');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements {ol.filter.Filter}
|
||||
* @extends {ol.filter.Filter}
|
||||
* @param {Array.<ol.filter.Filter>} filters Filters to and-combine.
|
||||
* @param {!ol.filter.LogicalOperator} operator Operator.
|
||||
*/
|
||||
ol.filter.Logical = function(filters, operator) {
|
||||
goog.base(this);
|
||||
|
||||
/**
|
||||
* @type {Array.<ol.filter.Filter>}
|
||||
@@ -25,6 +26,7 @@ ol.filter.Logical = function(filters, operator) {
|
||||
this.operator = operator;
|
||||
|
||||
};
|
||||
goog.inherits(ol.filter.Logical, ol.filter.Filter);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user