Merge pull request #7772 from marcjansen/named-filter-exports
Named exports from filter module
This commit is contained in:
@@ -6,7 +6,7 @@ import {assert} from '../asserts.js';
|
||||
import GML2 from '../format/GML2.js';
|
||||
import GML3 from '../format/GML3.js';
|
||||
import GMLBase from '../format/GMLBase.js';
|
||||
import _ol_format_filter_ from '../format/filter.js';
|
||||
import {and as andFilter, bbox as bboxFilter} from '../format/filter.js';
|
||||
import XMLFeature from '../format/XMLFeature.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import Geometry from '../geom/Geometry.js';
|
||||
@@ -959,11 +959,11 @@ WFS.prototype.writeGetFeature = function(options) {
|
||||
if (options.bbox) {
|
||||
assert(options.geometryName,
|
||||
12); // `options.geometryName` must also be provided when `options.bbox` is set
|
||||
const bbox = _ol_format_filter_.bbox(
|
||||
const bbox = bboxFilter(
|
||||
/** @type {string} */ (options.geometryName), options.bbox, options.srsName);
|
||||
if (filter) {
|
||||
// if bbox and filter are both set, combine the two into a single filter
|
||||
filter = _ol_format_filter_.and(filter, bbox);
|
||||
filter = andFilter(filter, bbox);
|
||||
} else {
|
||||
filter = bbox;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
/**
|
||||
* @module ol/format/filter
|
||||
*/
|
||||
import _ol_format_filter_And_ from '../format/filter/And.js';
|
||||
import _ol_format_filter_Bbox_ from '../format/filter/Bbox.js';
|
||||
import _ol_format_filter_Contains_ from '../format/filter/Contains.js';
|
||||
import _ol_format_filter_During_ from '../format/filter/During.js';
|
||||
import _ol_format_filter_EqualTo_ from '../format/filter/EqualTo.js';
|
||||
import _ol_format_filter_GreaterThan_ from '../format/filter/GreaterThan.js';
|
||||
import _ol_format_filter_GreaterThanOrEqualTo_ from '../format/filter/GreaterThanOrEqualTo.js';
|
||||
import _ol_format_filter_Intersects_ from '../format/filter/Intersects.js';
|
||||
import _ol_format_filter_IsBetween_ from '../format/filter/IsBetween.js';
|
||||
import _ol_format_filter_IsLike_ from '../format/filter/IsLike.js';
|
||||
import _ol_format_filter_IsNull_ from '../format/filter/IsNull.js';
|
||||
import _ol_format_filter_LessThan_ from '../format/filter/LessThan.js';
|
||||
import _ol_format_filter_LessThanOrEqualTo_ from '../format/filter/LessThanOrEqualTo.js';
|
||||
import _ol_format_filter_Not_ from '../format/filter/Not.js';
|
||||
import _ol_format_filter_NotEqualTo_ from '../format/filter/NotEqualTo.js';
|
||||
import _ol_format_filter_Or_ from '../format/filter/Or.js';
|
||||
import _ol_format_filter_Within_ from '../format/filter/Within.js';
|
||||
const _ol_format_filter_ = {};
|
||||
import And from '../format/filter/And.js';
|
||||
import Bbox from '../format/filter/Bbox.js';
|
||||
import Contains from '../format/filter/Contains.js';
|
||||
import During from '../format/filter/During.js';
|
||||
import EqualTo from '../format/filter/EqualTo.js';
|
||||
import GreaterThan from '../format/filter/GreaterThan.js';
|
||||
import GreaterThanOrEqualTo from '../format/filter/GreaterThanOrEqualTo.js';
|
||||
import Intersects from '../format/filter/Intersects.js';
|
||||
import IsBetween from '../format/filter/IsBetween.js';
|
||||
import IsLike from '../format/filter/IsLike.js';
|
||||
import IsNull from '../format/filter/IsNull.js';
|
||||
import LessThan from '../format/filter/LessThan.js';
|
||||
import LessThanOrEqualTo from '../format/filter/LessThanOrEqualTo.js';
|
||||
import Not from '../format/filter/Not.js';
|
||||
import NotEqualTo from '../format/filter/NotEqualTo.js';
|
||||
import Or from '../format/filter/Or.js';
|
||||
import Within from '../format/filter/Within.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -28,10 +27,10 @@ const _ol_format_filter_ = {};
|
||||
* @returns {!ol.format.filter.And} `<And>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.and = function(conditions) {
|
||||
export function and(conditions) {
|
||||
const params = [null].concat(Array.prototype.slice.call(arguments));
|
||||
return new (Function.prototype.bind.apply(_ol_format_filter_And_, params));
|
||||
};
|
||||
return new (Function.prototype.bind.apply(And, params));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,10 +40,10 @@ _ol_format_filter_.and = function(conditions) {
|
||||
* @returns {!ol.format.filter.Or} `<Or>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.or = function(conditions) {
|
||||
export function or(conditions) {
|
||||
const params = [null].concat(Array.prototype.slice.call(arguments));
|
||||
return new (Function.prototype.bind.apply(_ol_format_filter_Or_, params));
|
||||
};
|
||||
return new (Function.prototype.bind.apply(Or, params));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -54,9 +53,9 @@ _ol_format_filter_.or = function(conditions) {
|
||||
* @returns {!ol.format.filter.Not} `<Not>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.not = function(condition) {
|
||||
return new _ol_format_filter_Not_(condition);
|
||||
};
|
||||
export function not(condition) {
|
||||
return new Not(condition);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -70,9 +69,9 @@ _ol_format_filter_.not = function(condition) {
|
||||
* @returns {!ol.format.filter.Bbox} `<BBOX>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.bbox = function(geometryName, extent, opt_srsName) {
|
||||
return new _ol_format_filter_Bbox_(geometryName, extent, opt_srsName);
|
||||
};
|
||||
export function bbox(geometryName, extent, opt_srsName) {
|
||||
return new Bbox(geometryName, extent, opt_srsName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a `<Contains>` operator to test whether a geometry-valued property
|
||||
@@ -85,9 +84,9 @@ _ol_format_filter_.bbox = function(geometryName, extent, opt_srsName) {
|
||||
* @returns {!ol.format.filter.Contains} `<Contains>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.contains = function(geometryName, geometry, opt_srsName) {
|
||||
return new _ol_format_filter_Contains_(geometryName, geometry, opt_srsName);
|
||||
};
|
||||
export function contains(geometryName, geometry, opt_srsName) {
|
||||
return new Contains(geometryName, geometry, opt_srsName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a `<Intersects>` operator to test whether a geometry-valued property
|
||||
@@ -100,9 +99,9 @@ _ol_format_filter_.contains = function(geometryName, geometry, opt_srsName) {
|
||||
* @returns {!ol.format.filter.Intersects} `<Intersects>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.intersects = function(geometryName, geometry, opt_srsName) {
|
||||
return new _ol_format_filter_Intersects_(geometryName, geometry, opt_srsName);
|
||||
};
|
||||
export function intersects(geometryName, geometry, opt_srsName) {
|
||||
return new Intersects(geometryName, geometry, opt_srsName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a `<Within>` operator to test whether a geometry-valued property
|
||||
@@ -115,9 +114,9 @@ _ol_format_filter_.intersects = function(geometryName, geometry, opt_srsName) {
|
||||
* @returns {!ol.format.filter.Within} `<Within>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.within = function(geometryName, geometry, opt_srsName) {
|
||||
return new _ol_format_filter_Within_(geometryName, geometry, opt_srsName);
|
||||
};
|
||||
export function within(geometryName, geometry, opt_srsName) {
|
||||
return new Within(geometryName, geometry, opt_srsName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -129,9 +128,9 @@ _ol_format_filter_.within = function(geometryName, geometry, opt_srsName) {
|
||||
* @returns {!ol.format.filter.EqualTo} `<PropertyIsEqualTo>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.equalTo = function(propertyName, expression, opt_matchCase) {
|
||||
return new _ol_format_filter_EqualTo_(propertyName, expression, opt_matchCase);
|
||||
};
|
||||
export function equalTo(propertyName, expression, opt_matchCase) {
|
||||
return new EqualTo(propertyName, expression, opt_matchCase);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -143,9 +142,9 @@ _ol_format_filter_.equalTo = function(propertyName, expression, opt_matchCase) {
|
||||
* @returns {!ol.format.filter.NotEqualTo} `<PropertyIsNotEqualTo>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.notEqualTo = function(propertyName, expression, opt_matchCase) {
|
||||
return new _ol_format_filter_NotEqualTo_(propertyName, expression, opt_matchCase);
|
||||
};
|
||||
export function notEqualTo(propertyName, expression, opt_matchCase) {
|
||||
return new NotEqualTo(propertyName, expression, opt_matchCase);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -156,9 +155,9 @@ _ol_format_filter_.notEqualTo = function(propertyName, expression, opt_matchCase
|
||||
* @returns {!ol.format.filter.LessThan} `<PropertyIsLessThan>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.lessThan = function(propertyName, expression) {
|
||||
return new _ol_format_filter_LessThan_(propertyName, expression);
|
||||
};
|
||||
export function lessThan(propertyName, expression) {
|
||||
return new LessThan(propertyName, expression);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -169,9 +168,9 @@ _ol_format_filter_.lessThan = function(propertyName, expression) {
|
||||
* @returns {!ol.format.filter.LessThanOrEqualTo} `<PropertyIsLessThanOrEqualTo>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.lessThanOrEqualTo = function(propertyName, expression) {
|
||||
return new _ol_format_filter_LessThanOrEqualTo_(propertyName, expression);
|
||||
};
|
||||
export function lessThanOrEqualTo(propertyName, expression) {
|
||||
return new LessThanOrEqualTo(propertyName, expression);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -182,9 +181,9 @@ _ol_format_filter_.lessThanOrEqualTo = function(propertyName, expression) {
|
||||
* @returns {!ol.format.filter.GreaterThan} `<PropertyIsGreaterThan>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.greaterThan = function(propertyName, expression) {
|
||||
return new _ol_format_filter_GreaterThan_(propertyName, expression);
|
||||
};
|
||||
export function greaterThan(propertyName, expression) {
|
||||
return new GreaterThan(propertyName, expression);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -195,9 +194,9 @@ _ol_format_filter_.greaterThan = function(propertyName, expression) {
|
||||
* @returns {!ol.format.filter.GreaterThanOrEqualTo} `<PropertyIsGreaterThanOrEqualTo>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.greaterThanOrEqualTo = function(propertyName, expression) {
|
||||
return new _ol_format_filter_GreaterThanOrEqualTo_(propertyName, expression);
|
||||
};
|
||||
export function greaterThanOrEqualTo(propertyName, expression) {
|
||||
return new GreaterThanOrEqualTo(propertyName, expression);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -208,9 +207,9 @@ _ol_format_filter_.greaterThanOrEqualTo = function(propertyName, expression) {
|
||||
* @returns {!ol.format.filter.IsNull} `<PropertyIsNull>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.isNull = function(propertyName) {
|
||||
return new _ol_format_filter_IsNull_(propertyName);
|
||||
};
|
||||
export function isNull(propertyName) {
|
||||
return new IsNull(propertyName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -223,9 +222,9 @@ _ol_format_filter_.isNull = function(propertyName) {
|
||||
* @returns {!ol.format.filter.IsBetween} `<PropertyIsBetween>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.between = function(propertyName, lowerBoundary, upperBoundary) {
|
||||
return new _ol_format_filter_IsBetween_(propertyName, lowerBoundary, upperBoundary);
|
||||
};
|
||||
export function between(propertyName, lowerBoundary, upperBoundary) {
|
||||
return new IsBetween(propertyName, lowerBoundary, upperBoundary);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -244,11 +243,11 @@ _ol_format_filter_.between = function(propertyName, lowerBoundary, upperBoundary
|
||||
* @returns {!ol.format.filter.IsLike} `<PropertyIsLike>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.like = function(propertyName, pattern,
|
||||
export function like(propertyName, pattern,
|
||||
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) {
|
||||
return new _ol_format_filter_IsLike_(propertyName, pattern,
|
||||
return new IsLike(propertyName, pattern,
|
||||
opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -260,7 +259,6 @@ _ol_format_filter_.like = function(propertyName, pattern,
|
||||
* @returns {!ol.format.filter.During} `<During>` operator.
|
||||
* @api
|
||||
*/
|
||||
_ol_format_filter_.during = function(propertyName, begin, end) {
|
||||
return new _ol_format_filter_During_(propertyName, begin, end);
|
||||
};
|
||||
export default _ol_format_filter_;
|
||||
export function during(propertyName, begin, end) {
|
||||
return new During(propertyName, begin, end);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user