diff --git a/src/ol/format/ogc/filter.js b/src/ol/format/ogc/filter.js deleted file mode 100644 index 46d96b32bb..0000000000 --- a/src/ol/format/ogc/filter.js +++ /dev/null @@ -1,745 +0,0 @@ -goog.provide('ol.format.ogc.filter'); -goog.provide('ol.format.ogc.filter.Filter'); -goog.provide('ol.format.ogc.filter.Logical'); -goog.provide('ol.format.ogc.filter.LogicalBinary'); -goog.provide('ol.format.ogc.filter.And'); -goog.provide('ol.format.ogc.filter.Or'); -goog.provide('ol.format.ogc.filter.Not'); -goog.provide('ol.format.ogc.filter.Bbox'); -goog.provide('ol.format.ogc.filter.Intersects'); -goog.provide('ol.format.ogc.filter.Within'); -goog.provide('ol.format.ogc.filter.Comparison'); -goog.provide('ol.format.ogc.filter.ComparisonBinary'); -goog.provide('ol.format.ogc.filter.EqualTo'); -goog.provide('ol.format.ogc.filter.NotEqualTo'); -goog.provide('ol.format.ogc.filter.LessThan'); -goog.provide('ol.format.ogc.filter.LessThanOrEqualTo'); -goog.provide('ol.format.ogc.filter.GreaterThan'); -goog.provide('ol.format.ogc.filter.GreaterThanOrEqualTo'); -goog.provide('ol.format.ogc.filter.IsNull'); -goog.provide('ol.format.ogc.filter.IsBetween'); -goog.provide('ol.format.ogc.filter.IsLike'); - - -/** - * Create a logical `` operator between two filter conditions. - * - * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. - * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. - * @returns {!ol.format.ogc.filter.And} `` operator. - * @api - */ -ol.format.ogc.filter.and = function(conditionA, conditionB) { - return new ol.format.ogc.filter.And(conditionA, conditionB); -}; - - -/** - * Create a logical `` operator between two filter conditions. - * - * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. - * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. - * @returns {!ol.format.ogc.filter.Or} `` operator. - * @api - */ -ol.format.ogc.filter.or = function(conditionA, conditionB) { - return new ol.format.ogc.filter.Or(conditionA, conditionB); -}; - - -/** - * Represents a logical `` operator for a filter condition. - * - * @param {!ol.format.ogc.filter.Filter} condition Filter condition. - * @returns {!ol.format.ogc.filter.Not} `` operator. - * @api - */ -ol.format.ogc.filter.not = function(condition) { - return new ol.format.ogc.filter.Not(condition); -}; - - -/** - * Create a `` operator to test whether a geometry-valued property - * intersects a fixed bounding box - * - * @param {!string} geometryName Geometry name to use. - * @param {!ol.Extent} extent Extent. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @returns {!ol.format.ogc.filter.Bbox} `` operator. - * @api - */ -ol.format.ogc.filter.bbox = function(geometryName, extent, opt_srsName) { - return new ol.format.ogc.filter.Bbox(geometryName, extent, opt_srsName); -}; - -/** - * Create a `` operator to test whether a geometry-valued property - * intersects a given geometry. - * - * @param {!string} geometryName Geometry name to use. - * @param {!ol.geom.Geometry} geometry Geometry. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @returns {!ol.format.ogc.filter.Intersects} `` operator. - * @api - */ -ol.format.ogc.filter.intersects = function(geometryName, geometry, opt_srsName) { - return new ol.format.ogc.filter.Intersects(geometryName, geometry, opt_srsName); -}; - -/** - * Create a `` operator to test whether a geometry-valued property - * is within a given geometry. - * - * @param {!string} geometryName Geometry name to use. - * @param {!ol.geom.Geometry} geometry Geometry. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @returns {!ol.format.ogc.filter.Within} `` operator. - * @api - */ -ol.format.ogc.filter.within = function(geometryName, geometry, opt_srsName) { - return new ol.format.ogc.filter.Within(geometryName, geometry, opt_srsName); -}; - - -/** - * Creates a `` comparison operator. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!(string|number)} expression The value to compare. - * @param {boolean=} opt_matchCase Case-sensitive? - * @returns {!ol.format.ogc.filter.EqualTo} `` operator. - * @api - */ -ol.format.ogc.filter.equalTo = function(propertyName, expression, opt_matchCase) { - return new ol.format.ogc.filter.EqualTo(propertyName, expression, opt_matchCase); -}; - - -/** - * Creates a `` comparison operator. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!(string|number)} expression The value to compare. - * @param {boolean=} opt_matchCase Case-sensitive? - * @returns {!ol.format.ogc.filter.NotEqualTo} `` operator. - * @api - */ -ol.format.ogc.filter.notEqualTo = function(propertyName, expression, opt_matchCase) { - return new ol.format.ogc.filter.NotEqualTo(propertyName, expression, opt_matchCase); -}; - - -/** - * Creates a `` comparison operator. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @returns {!ol.format.ogc.filter.LessThan} `` operator. - * @api - */ -ol.format.ogc.filter.lessThan = function(propertyName, expression) { - return new ol.format.ogc.filter.LessThan(propertyName, expression); -}; - - -/** - * Creates a `` comparison operator. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @returns {!ol.format.ogc.filter.LessThanOrEqualTo} `` operator. - * @api - */ -ol.format.ogc.filter.lessThanOrEqualTo = function(propertyName, expression) { - return new ol.format.ogc.filter.LessThanOrEqualTo(propertyName, expression); -}; - - -/** - * Creates a `` comparison operator. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @returns {!ol.format.ogc.filter.GreaterThan} `` operator. - * @api - */ -ol.format.ogc.filter.greaterThan = function(propertyName, expression) { - return new ol.format.ogc.filter.GreaterThan(propertyName, expression); -}; - - -/** - * Creates a `` comparison operator. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @returns {!ol.format.ogc.filter.GreaterThanOrEqualTo} `` operator. - * @api - */ -ol.format.ogc.filter.greaterThanOrEqualTo = function(propertyName, expression) { - return new ol.format.ogc.filter.GreaterThanOrEqualTo(propertyName, expression); -}; - - -/** - * Creates a `` comparison operator to test whether a property value - * is null. - * - * @param {!string} propertyName Name of the context property to compare. - * @returns {!ol.format.ogc.filter.IsNull} `` operator. - * @api - */ -ol.format.ogc.filter.isNull = function(propertyName) { - return new ol.format.ogc.filter.IsNull(propertyName); -}; - - -/** - * Creates a `` comparison operator to test whether an expression - * value lies within a range given by a lower and upper bound (inclusive). - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} lowerBoundary The lower bound of the range. - * @param {!number} upperBoundary The upper bound of the range. - * @returns {!ol.format.ogc.filter.IsBetween} `` operator. - * @api - */ -ol.format.ogc.filter.between = function(propertyName, lowerBoundary, upperBoundary) { - return new ol.format.ogc.filter.IsBetween(propertyName, lowerBoundary, upperBoundary); -}; - - -/** - * Represents a `` comparison operator that matches a string property - * value against a text pattern. - * - * @param {!string} propertyName Name of the context property to compare. - * @param {!string} pattern Text pattern. - * @param {string=} opt_wildCard Pattern character which matches any sequence of - * zero or more string characters. Default is '*'. - * @param {string=} opt_singleChar pattern character which matches any single - * string character. Default is '.'. - * @param {string=} opt_escapeChar Escape character which can be used to escape - * the pattern characters. Default is '!'. - * @param {boolean=} opt_matchCase Case-sensitive? - * @returns {!ol.format.ogc.filter.IsLike} `` operator. - * @api - */ -ol.format.ogc.filter.like = function(propertyName, pattern, - opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) { - return new ol.format.ogc.filter.IsLike(propertyName, pattern, - opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase); -}; - - -/** - * @classdesc - * Abstract class; normally only used for creating subclasses and not instantiated in apps. - * Base class for WFS GetFeature filters. - * - * @constructor - * @param {!string} tagName The XML tag name for this filter. - * @struct - * @api - */ -ol.format.ogc.filter.Filter = function(tagName) { - - /** - * @private - * @type {!string} - */ - this.tagName_ = tagName; -}; - -/** - * The XML tag name for a filter. - * @returns {!string} Name. - */ -ol.format.ogc.filter.Filter.prototype.getTagName = function() { - return this.tagName_; -}; - - -// Logical filters - - -/** - * @classdesc - * Abstract class; normally only used for creating subclasses and not instantiated in apps. - * Base class for WFS GetFeature logical filters. - * - * @constructor - * @param {!string} tagName The XML tag name for this filter. - * @extends {ol.format.ogc.filter.Filter} - */ -ol.format.ogc.filter.Logical = function(tagName) { - ol.format.ogc.filter.Filter.call(this, tagName); -}; -ol.inherits(ol.format.ogc.filter.Logical, ol.format.ogc.filter.Filter); - - -/** - * @classdesc - * Abstract class; normally only used for creating subclasses and not instantiated in apps. - * Base class for WFS GetFeature binary logical filters. - * - * @constructor - * @param {!string} tagName The XML tag name for this filter. - * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. - * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. - * @extends {ol.format.ogc.filter.Logical} - */ -ol.format.ogc.filter.LogicalBinary = function(tagName, conditionA, conditionB) { - - ol.format.ogc.filter.Logical.call(this, tagName); - - /** - * @public - * @type {!ol.format.ogc.filter.Filter} - */ - this.conditionA = conditionA; - - /** - * @public - * @type {!ol.format.ogc.filter.Filter} - */ - this.conditionB = conditionB; - -}; -ol.inherits(ol.format.ogc.filter.LogicalBinary, ol.format.ogc.filter.Logical); - - -/** - * @classdesc - * Represents a logical `` operator between two filter conditions. - * - * @constructor - * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. - * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. - * @extends {ol.format.ogc.filter.LogicalBinary} - * @api - */ -ol.format.ogc.filter.And = function(conditionA, conditionB) { - ol.format.ogc.filter.LogicalBinary.call(this, 'And', conditionA, conditionB); -}; -ol.inherits(ol.format.ogc.filter.And, ol.format.ogc.filter.LogicalBinary); - - -/** - * @classdesc - * Represents a logical `` operator between two filter conditions. - * - * @constructor - * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. - * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. - * @extends {ol.format.ogc.filter.LogicalBinary} - * @api - */ -ol.format.ogc.filter.Or = function(conditionA, conditionB) { - ol.format.ogc.filter.LogicalBinary.call(this, 'Or', conditionA, conditionB); -}; -ol.inherits(ol.format.ogc.filter.Or, ol.format.ogc.filter.LogicalBinary); - - -/** - * @classdesc - * Represents a logical `` operator for a filter condition. - * - * @constructor - * @param {!ol.format.ogc.filter.Filter} condition Filter condition. - * @extends {ol.format.ogc.filter.Logical} - * @api - */ -ol.format.ogc.filter.Not = function(condition) { - - ol.format.ogc.filter.Logical.call(this, 'Not'); - - /** - * @public - * @type {!ol.format.ogc.filter.Filter} - */ - this.condition = condition; -}; -ol.inherits(ol.format.ogc.filter.Not, ol.format.ogc.filter.Logical); - - -// Spatial filters - - -/** - * @classdesc - * Represents a `` operator to test whether a geometry-valued property - * intersects a fixed bounding box - * - * @constructor - * @param {!string} geometryName Geometry name to use. - * @param {!ol.Extent} extent Extent. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @extends {ol.format.ogc.filter.Filter} - * @api - */ -ol.format.ogc.filter.Bbox = function(geometryName, extent, opt_srsName) { - - ol.format.ogc.filter.Filter.call(this, 'BBOX'); - - /** - * @public - * @type {!string} - */ - this.geometryName = geometryName; - - /** - * @public - * @type {ol.Extent} - */ - this.extent = extent; - - /** - * @public - * @type {string|undefined} - */ - this.srsName = opt_srsName; -}; -ol.inherits(ol.format.ogc.filter.Bbox, ol.format.ogc.filter.Filter); - - -/** - * @classdesc - * Represents a spatial operator to test whether a geometry-valued property - * relates to a given geometry. - * - * @constructor - * @param {!string} tagName The XML tag name for this filter. - * @param {!string} geometryName Geometry name to use. - * @param {!ol.geom.Geometry} geometry Geometry. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @extends {ol.format.ogc.filter.Filter} - * @api - */ -ol.format.ogc.filter.Spatial = function(tagName, geometryName, geometry, opt_srsName) { - - ol.format.ogc.filter.Filter.call(this, tagName); - - /** - * @public - * @type {!string} - */ - this.geometryName = geometryName || 'the_geom'; - - /** - * @public - * @type {ol.geom.Geometry} - */ - this.geometry = geometry; - - /** - * @public - * @type {string|undefined} - */ - this.srsName = opt_srsName; -}; -ol.inherits(ol.format.ogc.filter.Spatial, ol.format.ogc.filter.Filter); - - -/** - * @classdesc - * Represents a `` operator to test whether a geometry-valued property - * intersects a given geometry. - * - * @constructor - * @param {!string} geometryName Geometry name to use. - * @param {!ol.geom.Geometry} geometry Geometry. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @extends {ol.format.ogc.filter.Spatial} - * @api - */ -ol.format.ogc.filter.Intersects = function(geometryName, geometry, opt_srsName) { - - ol.format.ogc.filter.Spatial.call(this, 'Intersects', geometryName, geometry, opt_srsName); - -}; -ol.inherits(ol.format.ogc.filter.Intersects, ol.format.ogc.filter.Spatial); - - -/** - * @classdesc - * Represents a `` operator to test whether a geometry-valued property - * is within a given geometry. - * - * @constructor - * @param {!string} geometryName Geometry name to use. - * @param {!ol.geom.Geometry} geometry Geometry. - * @param {string=} opt_srsName SRS name. No srsName attribute will be - * set on geometries when this is not provided. - * @extends {ol.format.ogc.filter.Spatial} - * @api - */ -ol.format.ogc.filter.Within = function(geometryName, geometry, opt_srsName) { - - ol.format.ogc.filter.Spatial.call(this, 'Within', geometryName, geometry, opt_srsName); - -}; -ol.inherits(ol.format.ogc.filter.Within, ol.format.ogc.filter.Spatial); - - -// Property comparison filters - - -/** - * @classdesc - * Abstract class; normally only used for creating subclasses and not instantiated in apps. - * Base class for WFS GetFeature property comparison filters. - * - * @constructor - * @param {!string} tagName The XML tag name for this filter. - * @param {!string} propertyName Name of the context property to compare. - * @extends {ol.format.ogc.filter.Filter} - * @api - */ -ol.format.ogc.filter.Comparison = function(tagName, propertyName) { - - ol.format.ogc.filter.Filter.call(this, tagName); - - /** - * @public - * @type {!string} - */ - this.propertyName = propertyName; -}; -ol.inherits(ol.format.ogc.filter.Comparison, ol.format.ogc.filter.Filter); - - -/** - * @classdesc - * Abstract class; normally only used for creating subclasses and not instantiated in apps. - * Base class for WFS GetFeature property binary comparison filters. - * - * @constructor - * @param {!string} tagName The XML tag name for this filter. - * @param {!string} propertyName Name of the context property to compare. - * @param {!(string|number)} expression The value to compare. - * @param {boolean=} opt_matchCase Case-sensitive? - * @extends {ol.format.ogc.filter.Comparison} - * @api - */ -ol.format.ogc.filter.ComparisonBinary = function( - tagName, propertyName, expression, opt_matchCase) { - - ol.format.ogc.filter.Comparison.call(this, tagName, propertyName); - - /** - * @public - * @type {!(string|number)} - */ - this.expression = expression; - - /** - * @public - * @type {boolean|undefined} - */ - this.matchCase = opt_matchCase; -}; -ol.inherits(ol.format.ogc.filter.ComparisonBinary, ol.format.ogc.filter.Comparison); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!(string|number)} expression The value to compare. - * @param {boolean=} opt_matchCase Case-sensitive? - * @extends {ol.format.ogc.filter.ComparisonBinary} - * @api - */ -ol.format.ogc.filter.EqualTo = function(propertyName, expression, opt_matchCase) { - ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase); -}; -ol.inherits(ol.format.ogc.filter.EqualTo, ol.format.ogc.filter.ComparisonBinary); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!(string|number)} expression The value to compare. - * @param {boolean=} opt_matchCase Case-sensitive? - * @extends {ol.format.ogc.filter.ComparisonBinary} - * @api - */ -ol.format.ogc.filter.NotEqualTo = function(propertyName, expression, opt_matchCase) { - ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase); -}; -ol.inherits(ol.format.ogc.filter.NotEqualTo, ol.format.ogc.filter.ComparisonBinary); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @extends {ol.format.ogc.filter.ComparisonBinary} - * @api - */ -ol.format.ogc.filter.LessThan = function(propertyName, expression) { - ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsLessThan', propertyName, expression); -}; -ol.inherits(ol.format.ogc.filter.LessThan, ol.format.ogc.filter.ComparisonBinary); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @extends {ol.format.ogc.filter.ComparisonBinary} - * @api - */ -ol.format.ogc.filter.LessThanOrEqualTo = function(propertyName, expression) { - ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression); -}; -ol.inherits(ol.format.ogc.filter.LessThanOrEqualTo, ol.format.ogc.filter.ComparisonBinary); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @extends {ol.format.ogc.filter.ComparisonBinary} - * @api - */ -ol.format.ogc.filter.GreaterThan = function(propertyName, expression) { - ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsGreaterThan', propertyName, expression); -}; -ol.inherits(ol.format.ogc.filter.GreaterThan, ol.format.ogc.filter.ComparisonBinary); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} expression The value to compare. - * @extends {ol.format.ogc.filter.ComparisonBinary} - * @api - */ -ol.format.ogc.filter.GreaterThanOrEqualTo = function(propertyName, expression) { - ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression); -}; -ol.inherits(ol.format.ogc.filter.GreaterThanOrEqualTo, ol.format.ogc.filter.ComparisonBinary); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @extends {ol.format.ogc.filter.Comparison} - * @api - */ -ol.format.ogc.filter.IsNull = function(propertyName) { - ol.format.ogc.filter.Comparison.call(this, 'PropertyIsNull', propertyName); -}; -ol.inherits(ol.format.ogc.filter.IsNull, ol.format.ogc.filter.Comparison); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!number} lowerBoundary The lower bound of the range. - * @param {!number} upperBoundary The upper bound of the range. - * @extends {ol.format.ogc.filter.Comparison} - * @api - */ -ol.format.ogc.filter.IsBetween = function(propertyName, lowerBoundary, upperBoundary) { - ol.format.ogc.filter.Comparison.call(this, 'PropertyIsBetween', propertyName); - - /** - * @public - * @type {!number} - */ - this.lowerBoundary = lowerBoundary; - - /** - * @public - * @type {!number} - */ - this.upperBoundary = upperBoundary; -}; -ol.inherits(ol.format.ogc.filter.IsBetween, ol.format.ogc.filter.Comparison); - - -/** - * @classdesc - * Represents a `` comparison operator. - * - * @constructor - * @param {!string} propertyName Name of the context property to compare. - * @param {!string} pattern Text pattern. - * @param {string=} opt_wildCard Pattern character which matches any sequence of - * zero or more string characters. Default is '*'. - * @param {string=} opt_singleChar pattern character which matches any single - * string character. Default is '.'. - * @param {string=} opt_escapeChar Escape character which can be used to escape - * the pattern characters. Default is '!'. - * @param {boolean=} opt_matchCase Case-sensitive? - * @extends {ol.format.ogc.filter.Comparison} - * @api - */ -ol.format.ogc.filter.IsLike = function(propertyName, pattern, - opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) { - ol.format.ogc.filter.Comparison.call(this, 'PropertyIsLike', propertyName); - - /** - * @public - * @type {!string} - */ - this.pattern = pattern; - - /** - * @public - * @type {!string} - */ - this.wildCard = (opt_wildCard !== undefined) ? opt_wildCard : '*'; - - /** - * @public - * @type {!string} - */ - this.singleChar = (opt_singleChar !== undefined) ? opt_singleChar : '.'; - - /** - * @public - * @type {!string} - */ - this.escapeChar = (opt_escapeChar !== undefined) ? opt_escapeChar : '!'; - - /** - * @public - * @type {boolean|undefined} - */ - this.matchCase = opt_matchCase; -}; -ol.inherits(ol.format.ogc.filter.IsLike, ol.format.ogc.filter.Comparison); diff --git a/src/ol/format/ogc/filter/and.js b/src/ol/format/ogc/filter/and.js new file mode 100644 index 0000000000..c45b0a0066 --- /dev/null +++ b/src/ol/format/ogc/filter/and.js @@ -0,0 +1,19 @@ +goog.provide('ol.format.ogc.filter.And'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.LogicalBinary'); + +/** + * @classdesc + * Represents a logical `` operator between two filter conditions. + * + * @constructor + * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. + * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. + * @extends {ol.format.ogc.filter.LogicalBinary} + * @api + */ +ol.format.ogc.filter.And = function(conditionA, conditionB) { + ol.format.ogc.filter.LogicalBinary.call(this, 'And', conditionA, conditionB); +}; +ol.inherits(ol.format.ogc.filter.And, ol.format.ogc.filter.LogicalBinary); diff --git a/src/ol/format/ogc/filter/bbox.js b/src/ol/format/ogc/filter/bbox.js new file mode 100644 index 0000000000..5fae3c1610 --- /dev/null +++ b/src/ol/format/ogc/filter/bbox.js @@ -0,0 +1,42 @@ +goog.provide('ol.format.ogc.filter.Bbox'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Filter'); + + +/** + * @classdesc + * Represents a `` operator to test whether a geometry-valued property + * intersects a fixed bounding box + * + * @constructor + * @param {!string} geometryName Geometry name to use. + * @param {!ol.Extent} extent Extent. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @extends {ol.format.ogc.filter.Filter} + * @api + */ +ol.format.ogc.filter.Bbox = function(geometryName, extent, opt_srsName) { + + ol.format.ogc.filter.Filter.call(this, 'BBOX'); + + /** + * @public + * @type {!string} + */ + this.geometryName = geometryName; + + /** + * @public + * @type {ol.Extent} + */ + this.extent = extent; + + /** + * @public + * @type {string|undefined} + */ + this.srsName = opt_srsName; +}; +ol.inherits(ol.format.ogc.filter.Bbox, ol.format.ogc.filter.Filter); diff --git a/src/ol/format/ogc/filter/comparison.js b/src/ol/format/ogc/filter/comparison.js new file mode 100644 index 0000000000..42f24da409 --- /dev/null +++ b/src/ol/format/ogc/filter/comparison.js @@ -0,0 +1,28 @@ +goog.provide('ol.format.ogc.filter.Comparison'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Filter'); + + +/** + * @classdesc + * Abstract class; normally only used for creating subclasses and not instantiated in apps. + * Base class for WFS GetFeature property comparison filters. + * + * @constructor + * @param {!string} tagName The XML tag name for this filter. + * @param {!string} propertyName Name of the context property to compare. + * @extends {ol.format.ogc.filter.Filter} + * @api + */ +ol.format.ogc.filter.Comparison = function(tagName, propertyName) { + + ol.format.ogc.filter.Filter.call(this, tagName); + + /** + * @public + * @type {!string} + */ + this.propertyName = propertyName; +}; +ol.inherits(ol.format.ogc.filter.Comparison, ol.format.ogc.filter.Filter); diff --git a/src/ol/format/ogc/filter/comparisonbinary.js b/src/ol/format/ogc/filter/comparisonbinary.js new file mode 100644 index 0000000000..ffcc7cec33 --- /dev/null +++ b/src/ol/format/ogc/filter/comparisonbinary.js @@ -0,0 +1,37 @@ +goog.provide('ol.format.ogc.filter.ComparisonBinary'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Comparison'); + + +/** + * @classdesc + * Abstract class; normally only used for creating subclasses and not instantiated in apps. + * Base class for WFS GetFeature property binary comparison filters. + * + * @constructor + * @param {!string} tagName The XML tag name for this filter. + * @param {!string} propertyName Name of the context property to compare. + * @param {!(string|number)} expression The value to compare. + * @param {boolean=} opt_matchCase Case-sensitive? + * @extends {ol.format.ogc.filter.Comparison} + * @api + */ +ol.format.ogc.filter.ComparisonBinary = function( + tagName, propertyName, expression, opt_matchCase) { + + ol.format.ogc.filter.Comparison.call(this, tagName, propertyName); + + /** + * @public + * @type {!(string|number)} + */ + this.expression = expression; + + /** + * @public + * @type {boolean|undefined} + */ + this.matchCase = opt_matchCase; +}; +ol.inherits(ol.format.ogc.filter.ComparisonBinary, ol.format.ogc.filter.Comparison); diff --git a/src/ol/format/ogc/filter/equalto.js b/src/ol/format/ogc/filter/equalto.js new file mode 100644 index 0000000000..7cc78dd2c7 --- /dev/null +++ b/src/ol/format/ogc/filter/equalto.js @@ -0,0 +1,21 @@ +goog.provide('ol.format.ogc.filter.EqualTo'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.ComparisonBinary'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!(string|number)} expression The value to compare. + * @param {boolean=} opt_matchCase Case-sensitive? + * @extends {ol.format.ogc.filter.ComparisonBinary} + * @api + */ +ol.format.ogc.filter.EqualTo = function(propertyName, expression, opt_matchCase) { + ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsEqualTo', propertyName, expression, opt_matchCase); +}; +ol.inherits(ol.format.ogc.filter.EqualTo, ol.format.ogc.filter.ComparisonBinary); diff --git a/src/ol/format/ogc/filter/filter.js b/src/ol/format/ogc/filter/filter.js new file mode 100644 index 0000000000..4d91067333 --- /dev/null +++ b/src/ol/format/ogc/filter/filter.js @@ -0,0 +1,31 @@ +goog.provide('ol.format.ogc.filter.Filter'); + +goog.require('ol'); + + +/** + * @classdesc + * Abstract class; normally only used for creating subclasses and not instantiated in apps. + * Base class for WFS GetFeature filters. + * + * @constructor + * @param {!string} tagName The XML tag name for this filter. + * @struct + * @api + */ +ol.format.ogc.filter.Filter = function(tagName) { + + /** + * @private + * @type {!string} + */ + this.tagName_ = tagName; +}; + +/** + * The XML tag name for a filter. + * @returns {!string} Name. + */ +ol.format.ogc.filter.Filter.prototype.getTagName = function() { + return this.tagName_; +}; diff --git a/src/ol/format/ogc/filter/greaterthan.js b/src/ol/format/ogc/filter/greaterthan.js new file mode 100644 index 0000000000..bf6ec9bcb8 --- /dev/null +++ b/src/ol/format/ogc/filter/greaterthan.js @@ -0,0 +1,20 @@ +goog.provide('ol.format.ogc.filter.GreaterThan'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.ComparisonBinary'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @extends {ol.format.ogc.filter.ComparisonBinary} + * @api + */ +ol.format.ogc.filter.GreaterThan = function(propertyName, expression) { + ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsGreaterThan', propertyName, expression); +}; +ol.inherits(ol.format.ogc.filter.GreaterThan, ol.format.ogc.filter.ComparisonBinary); diff --git a/src/ol/format/ogc/filter/greaterthanorequalto.js b/src/ol/format/ogc/filter/greaterthanorequalto.js new file mode 100644 index 0000000000..7b2cf12bda --- /dev/null +++ b/src/ol/format/ogc/filter/greaterthanorequalto.js @@ -0,0 +1,20 @@ +goog.provide('ol.format.ogc.filter.GreaterThanOrEqualTo'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.ComparisonBinary'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @extends {ol.format.ogc.filter.ComparisonBinary} + * @api + */ +ol.format.ogc.filter.GreaterThanOrEqualTo = function(propertyName, expression) { + ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsGreaterThanOrEqualTo', propertyName, expression); +}; +ol.inherits(ol.format.ogc.filter.GreaterThanOrEqualTo, ol.format.ogc.filter.ComparisonBinary); diff --git a/src/ol/format/ogc/filter/index.js b/src/ol/format/ogc/filter/index.js new file mode 100644 index 0000000000..7878652524 --- /dev/null +++ b/src/ol/format/ogc/filter/index.js @@ -0,0 +1,233 @@ +goog.provide('ol.format.ogc.filter'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.And'); +goog.require('ol.format.ogc.filter.Bbox'); +goog.require('ol.format.ogc.filter.EqualTo'); +goog.require('ol.format.ogc.filter.GreaterThan'); +goog.require('ol.format.ogc.filter.GreaterThanOrEqualTo'); +goog.require('ol.format.ogc.filter.Intersects'); +goog.require('ol.format.ogc.filter.IsBetween'); +goog.require('ol.format.ogc.filter.IsLike'); +goog.require('ol.format.ogc.filter.IsNull'); +goog.require('ol.format.ogc.filter.LessThan'); +goog.require('ol.format.ogc.filter.LessThanOrEqualTo'); +goog.require('ol.format.ogc.filter.Not'); +goog.require('ol.format.ogc.filter.NotEqualTo'); +goog.require('ol.format.ogc.filter.Or'); +goog.require('ol.format.ogc.filter.Within'); + + +/** + * Create a logical `` operator between two filter conditions. + * + * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. + * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. + * @returns {!ol.format.ogc.filter.And} `` operator. + * @api + */ +ol.format.ogc.filter.and = function(conditionA, conditionB) { + return new ol.format.ogc.filter.And(conditionA, conditionB); +}; + + +/** + * Create a logical `` operator between two filter conditions. + * + * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. + * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. + * @returns {!ol.format.ogc.filter.Or} `` operator. + * @api + */ +ol.format.ogc.filter.or = function(conditionA, conditionB) { + return new ol.format.ogc.filter.Or(conditionA, conditionB); +}; + + +/** + * Represents a logical `` operator for a filter condition. + * + * @param {!ol.format.ogc.filter.Filter} condition Filter condition. + * @returns {!ol.format.ogc.filter.Not} `` operator. + * @api + */ +ol.format.ogc.filter.not = function(condition) { + return new ol.format.ogc.filter.Not(condition); +}; + + +/** + * Create a `` operator to test whether a geometry-valued property + * intersects a fixed bounding box + * + * @param {!string} geometryName Geometry name to use. + * @param {!ol.Extent} extent Extent. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @returns {!ol.format.ogc.filter.Bbox} `` operator. + * @api + */ +ol.format.ogc.filter.bbox = function(geometryName, extent, opt_srsName) { + return new ol.format.ogc.filter.Bbox(geometryName, extent, opt_srsName); +}; + +/** + * Create a `` operator to test whether a geometry-valued property + * intersects a given geometry. + * + * @param {!string} geometryName Geometry name to use. + * @param {!ol.geom.Geometry} geometry Geometry. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @returns {!ol.format.ogc.filter.Intersects} `` operator. + * @api + */ +ol.format.ogc.filter.intersects = function(geometryName, geometry, opt_srsName) { + return new ol.format.ogc.filter.Intersects(geometryName, geometry, opt_srsName); +}; + +/** + * Create a `` operator to test whether a geometry-valued property + * is within a given geometry. + * + * @param {!string} geometryName Geometry name to use. + * @param {!ol.geom.Geometry} geometry Geometry. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @returns {!ol.format.ogc.filter.Within} `` operator. + * @api + */ +ol.format.ogc.filter.within = function(geometryName, geometry, opt_srsName) { + return new ol.format.ogc.filter.Within(geometryName, geometry, opt_srsName); +}; + + +/** + * Creates a `` comparison operator. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!(string|number)} expression The value to compare. + * @param {boolean=} opt_matchCase Case-sensitive? + * @returns {!ol.format.ogc.filter.EqualTo} `` operator. + * @api + */ +ol.format.ogc.filter.equalTo = function(propertyName, expression, opt_matchCase) { + return new ol.format.ogc.filter.EqualTo(propertyName, expression, opt_matchCase); +}; + + +/** + * Creates a `` comparison operator. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!(string|number)} expression The value to compare. + * @param {boolean=} opt_matchCase Case-sensitive? + * @returns {!ol.format.ogc.filter.NotEqualTo} `` operator. + * @api + */ +ol.format.ogc.filter.notEqualTo = function(propertyName, expression, opt_matchCase) { + return new ol.format.ogc.filter.NotEqualTo(propertyName, expression, opt_matchCase); +}; + + +/** + * Creates a `` comparison operator. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @returns {!ol.format.ogc.filter.LessThan} `` operator. + * @api + */ +ol.format.ogc.filter.lessThan = function(propertyName, expression) { + return new ol.format.ogc.filter.LessThan(propertyName, expression); +}; + + +/** + * Creates a `` comparison operator. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @returns {!ol.format.ogc.filter.LessThanOrEqualTo} `` operator. + * @api + */ +ol.format.ogc.filter.lessThanOrEqualTo = function(propertyName, expression) { + return new ol.format.ogc.filter.LessThanOrEqualTo(propertyName, expression); +}; + + +/** + * Creates a `` comparison operator. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @returns {!ol.format.ogc.filter.GreaterThan} `` operator. + * @api + */ +ol.format.ogc.filter.greaterThan = function(propertyName, expression) { + return new ol.format.ogc.filter.GreaterThan(propertyName, expression); +}; + + +/** + * Creates a `` comparison operator. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @returns {!ol.format.ogc.filter.GreaterThanOrEqualTo} `` operator. + * @api + */ +ol.format.ogc.filter.greaterThanOrEqualTo = function(propertyName, expression) { + return new ol.format.ogc.filter.GreaterThanOrEqualTo(propertyName, expression); +}; + + +/** + * Creates a `` comparison operator to test whether a property value + * is null. + * + * @param {!string} propertyName Name of the context property to compare. + * @returns {!ol.format.ogc.filter.IsNull} `` operator. + * @api + */ +ol.format.ogc.filter.isNull = function(propertyName) { + return new ol.format.ogc.filter.IsNull(propertyName); +}; + + +/** + * Creates a `` comparison operator to test whether an expression + * value lies within a range given by a lower and upper bound (inclusive). + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} lowerBoundary The lower bound of the range. + * @param {!number} upperBoundary The upper bound of the range. + * @returns {!ol.format.ogc.filter.IsBetween} `` operator. + * @api + */ +ol.format.ogc.filter.between = function(propertyName, lowerBoundary, upperBoundary) { + return new ol.format.ogc.filter.IsBetween(propertyName, lowerBoundary, upperBoundary); +}; + + +/** + * Represents a `` comparison operator that matches a string property + * value against a text pattern. + * + * @param {!string} propertyName Name of the context property to compare. + * @param {!string} pattern Text pattern. + * @param {string=} opt_wildCard Pattern character which matches any sequence of + * zero or more string characters. Default is '*'. + * @param {string=} opt_singleChar pattern character which matches any single + * string character. Default is '.'. + * @param {string=} opt_escapeChar Escape character which can be used to escape + * the pattern characters. Default is '!'. + * @param {boolean=} opt_matchCase Case-sensitive? + * @returns {!ol.format.ogc.filter.IsLike} `` operator. + * @api + */ +ol.format.ogc.filter.like = function(propertyName, pattern, + opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) { + return new ol.format.ogc.filter.IsLike(propertyName, pattern, + opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase); +}; diff --git a/src/ol/format/ogc/filter.jsdoc b/src/ol/format/ogc/filter/index.jsdoc similarity index 100% rename from src/ol/format/ogc/filter.jsdoc rename to src/ol/format/ogc/filter/index.jsdoc diff --git a/src/ol/format/ogc/filter/intersects.js b/src/ol/format/ogc/filter/intersects.js new file mode 100644 index 0000000000..3a0b91c230 --- /dev/null +++ b/src/ol/format/ogc/filter/intersects.js @@ -0,0 +1,25 @@ +goog.provide('ol.format.ogc.filter.Intersects'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Spatial'); + + +/** + * @classdesc + * Represents a `` operator to test whether a geometry-valued property + * intersects a given geometry. + * + * @constructor + * @param {!string} geometryName Geometry name to use. + * @param {!ol.geom.Geometry} geometry Geometry. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @extends {ol.format.ogc.filter.Spatial} + * @api + */ +ol.format.ogc.filter.Intersects = function(geometryName, geometry, opt_srsName) { + + ol.format.ogc.filter.Spatial.call(this, 'Intersects', geometryName, geometry, opt_srsName); + +}; +ol.inherits(ol.format.ogc.filter.Intersects, ol.format.ogc.filter.Spatial); diff --git a/src/ol/format/ogc/filter/isbetween.js b/src/ol/format/ogc/filter/isbetween.js new file mode 100644 index 0000000000..bf49ca85b1 --- /dev/null +++ b/src/ol/format/ogc/filter/isbetween.js @@ -0,0 +1,33 @@ +goog.provide('ol.format.ogc.filter.IsBetween'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Comparison'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} lowerBoundary The lower bound of the range. + * @param {!number} upperBoundary The upper bound of the range. + * @extends {ol.format.ogc.filter.Comparison} + * @api + */ +ol.format.ogc.filter.IsBetween = function(propertyName, lowerBoundary, upperBoundary) { + ol.format.ogc.filter.Comparison.call(this, 'PropertyIsBetween', propertyName); + + /** + * @public + * @type {!number} + */ + this.lowerBoundary = lowerBoundary; + + /** + * @public + * @type {!number} + */ + this.upperBoundary = upperBoundary; +}; +ol.inherits(ol.format.ogc.filter.IsBetween, ol.format.ogc.filter.Comparison); diff --git a/src/ol/format/ogc/filter/islike.js b/src/ol/format/ogc/filter/islike.js new file mode 100644 index 0000000000..f136a8b064 --- /dev/null +++ b/src/ol/format/ogc/filter/islike.js @@ -0,0 +1,58 @@ +goog.provide('ol.format.ogc.filter.IsLike'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Comparison'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!string} pattern Text pattern. + * @param {string=} opt_wildCard Pattern character which matches any sequence of + * zero or more string characters. Default is '*'. + * @param {string=} opt_singleChar pattern character which matches any single + * string character. Default is '.'. + * @param {string=} opt_escapeChar Escape character which can be used to escape + * the pattern characters. Default is '!'. + * @param {boolean=} opt_matchCase Case-sensitive? + * @extends {ol.format.ogc.filter.Comparison} + * @api + */ +ol.format.ogc.filter.IsLike = function(propertyName, pattern, + opt_wildCard, opt_singleChar, opt_escapeChar, opt_matchCase) { + ol.format.ogc.filter.Comparison.call(this, 'PropertyIsLike', propertyName); + + /** + * @public + * @type {!string} + */ + this.pattern = pattern; + + /** + * @public + * @type {!string} + */ + this.wildCard = (opt_wildCard !== undefined) ? opt_wildCard : '*'; + + /** + * @public + * @type {!string} + */ + this.singleChar = (opt_singleChar !== undefined) ? opt_singleChar : '.'; + + /** + * @public + * @type {!string} + */ + this.escapeChar = (opt_escapeChar !== undefined) ? opt_escapeChar : '!'; + + /** + * @public + * @type {boolean|undefined} + */ + this.matchCase = opt_matchCase; +}; +ol.inherits(ol.format.ogc.filter.IsLike, ol.format.ogc.filter.Comparison); diff --git a/src/ol/format/ogc/filter/isnull.js b/src/ol/format/ogc/filter/isnull.js new file mode 100644 index 0000000000..9d48fb03a5 --- /dev/null +++ b/src/ol/format/ogc/filter/isnull.js @@ -0,0 +1,19 @@ +goog.provide('ol.format.ogc.filter.IsNull'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Comparison'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @extends {ol.format.ogc.filter.Comparison} + * @api + */ +ol.format.ogc.filter.IsNull = function(propertyName) { + ol.format.ogc.filter.Comparison.call(this, 'PropertyIsNull', propertyName); +}; +ol.inherits(ol.format.ogc.filter.IsNull, ol.format.ogc.filter.Comparison); diff --git a/src/ol/format/ogc/filter/lessthan.js b/src/ol/format/ogc/filter/lessthan.js new file mode 100644 index 0000000000..0d233aa8d2 --- /dev/null +++ b/src/ol/format/ogc/filter/lessthan.js @@ -0,0 +1,20 @@ +goog.provide('ol.format.ogc.filter.LessThan'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.ComparisonBinary'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @extends {ol.format.ogc.filter.ComparisonBinary} + * @api + */ +ol.format.ogc.filter.LessThan = function(propertyName, expression) { + ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsLessThan', propertyName, expression); +}; +ol.inherits(ol.format.ogc.filter.LessThan, ol.format.ogc.filter.ComparisonBinary); diff --git a/src/ol/format/ogc/filter/lessthanorequalto.js b/src/ol/format/ogc/filter/lessthanorequalto.js new file mode 100644 index 0000000000..dd618e242c --- /dev/null +++ b/src/ol/format/ogc/filter/lessthanorequalto.js @@ -0,0 +1,20 @@ +goog.provide('ol.format.ogc.filter.LessThanOrEqualTo'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.ComparisonBinary'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!number} expression The value to compare. + * @extends {ol.format.ogc.filter.ComparisonBinary} + * @api + */ +ol.format.ogc.filter.LessThanOrEqualTo = function(propertyName, expression) { + ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsLessThanOrEqualTo', propertyName, expression); +}; +ol.inherits(ol.format.ogc.filter.LessThanOrEqualTo, ol.format.ogc.filter.ComparisonBinary); diff --git a/src/ol/format/ogc/filter/logical.js b/src/ol/format/ogc/filter/logical.js new file mode 100644 index 0000000000..9a346ac059 --- /dev/null +++ b/src/ol/format/ogc/filter/logical.js @@ -0,0 +1,19 @@ +goog.provide('ol.format.ogc.filter.Logical'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Filter'); + + +/** + * @classdesc + * Abstract class; normally only used for creating subclasses and not instantiated in apps. + * Base class for WFS GetFeature logical filters. + * + * @constructor + * @param {!string} tagName The XML tag name for this filter. + * @extends {ol.format.ogc.filter.Filter} + */ +ol.format.ogc.filter.Logical = function(tagName) { + ol.format.ogc.filter.Filter.call(this, tagName); +}; +ol.inherits(ol.format.ogc.filter.Logical, ol.format.ogc.filter.Filter); diff --git a/src/ol/format/ogc/filter/logicalbinary.js b/src/ol/format/ogc/filter/logicalbinary.js new file mode 100644 index 0000000000..06eae237c5 --- /dev/null +++ b/src/ol/format/ogc/filter/logicalbinary.js @@ -0,0 +1,35 @@ +goog.provide('ol.format.ogc.filter.LogicalBinary'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Logical'); + + +/** + * @classdesc + * Abstract class; normally only used for creating subclasses and not instantiated in apps. + * Base class for WFS GetFeature binary logical filters. + * + * @constructor + * @param {!string} tagName The XML tag name for this filter. + * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. + * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. + * @extends {ol.format.ogc.filter.Logical} + */ +ol.format.ogc.filter.LogicalBinary = function(tagName, conditionA, conditionB) { + + ol.format.ogc.filter.Logical.call(this, tagName); + + /** + * @public + * @type {!ol.format.ogc.filter.Filter} + */ + this.conditionA = conditionA; + + /** + * @public + * @type {!ol.format.ogc.filter.Filter} + */ + this.conditionB = conditionB; + +}; +ol.inherits(ol.format.ogc.filter.LogicalBinary, ol.format.ogc.filter.Logical); diff --git a/src/ol/format/ogc/filter/not.js b/src/ol/format/ogc/filter/not.js new file mode 100644 index 0000000000..2e23622080 --- /dev/null +++ b/src/ol/format/ogc/filter/not.js @@ -0,0 +1,26 @@ +goog.provide('ol.format.ogc.filter.Not'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Logical'); + + +/** + * @classdesc + * Represents a logical `` operator for a filter condition. + * + * @constructor + * @param {!ol.format.ogc.filter.Filter} condition Filter condition. + * @extends {ol.format.ogc.filter.Logical} + * @api + */ +ol.format.ogc.filter.Not = function(condition) { + + ol.format.ogc.filter.Logical.call(this, 'Not'); + + /** + * @public + * @type {!ol.format.ogc.filter.Filter} + */ + this.condition = condition; +}; +ol.inherits(ol.format.ogc.filter.Not, ol.format.ogc.filter.Logical); diff --git a/src/ol/format/ogc/filter/notequalto.js b/src/ol/format/ogc/filter/notequalto.js new file mode 100644 index 0000000000..fb56616f4f --- /dev/null +++ b/src/ol/format/ogc/filter/notequalto.js @@ -0,0 +1,21 @@ +goog.provide('ol.format.ogc.filter.NotEqualTo'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.ComparisonBinary'); + + +/** + * @classdesc + * Represents a `` comparison operator. + * + * @constructor + * @param {!string} propertyName Name of the context property to compare. + * @param {!(string|number)} expression The value to compare. + * @param {boolean=} opt_matchCase Case-sensitive? + * @extends {ol.format.ogc.filter.ComparisonBinary} + * @api + */ +ol.format.ogc.filter.NotEqualTo = function(propertyName, expression, opt_matchCase) { + ol.format.ogc.filter.ComparisonBinary.call(this, 'PropertyIsNotEqualTo', propertyName, expression, opt_matchCase); +}; +ol.inherits(ol.format.ogc.filter.NotEqualTo, ol.format.ogc.filter.ComparisonBinary); diff --git a/src/ol/format/ogc/filter/or.js b/src/ol/format/ogc/filter/or.js new file mode 100644 index 0000000000..c38778581c --- /dev/null +++ b/src/ol/format/ogc/filter/or.js @@ -0,0 +1,20 @@ +goog.provide('ol.format.ogc.filter.Or'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.LogicalBinary'); + + +/** + * @classdesc + * Represents a logical `` operator between two filter conditions. + * + * @constructor + * @param {!ol.format.ogc.filter.Filter} conditionA First filter condition. + * @param {!ol.format.ogc.filter.Filter} conditionB Second filter condition. + * @extends {ol.format.ogc.filter.LogicalBinary} + * @api + */ +ol.format.ogc.filter.Or = function(conditionA, conditionB) { + ol.format.ogc.filter.LogicalBinary.call(this, 'Or', conditionA, conditionB); +}; +ol.inherits(ol.format.ogc.filter.Or, ol.format.ogc.filter.LogicalBinary); diff --git a/src/ol/format/ogc/filter/spatial.js b/src/ol/format/ogc/filter/spatial.js new file mode 100644 index 0000000000..645bd74c08 --- /dev/null +++ b/src/ol/format/ogc/filter/spatial.js @@ -0,0 +1,43 @@ +goog.provide('ol.format.ogc.filter.Spatial'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Filter'); + + +/** + * @classdesc + * Represents a spatial operator to test whether a geometry-valued property + * relates to a given geometry. + * + * @constructor + * @param {!string} tagName The XML tag name for this filter. + * @param {!string} geometryName Geometry name to use. + * @param {!ol.geom.Geometry} geometry Geometry. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @extends {ol.format.ogc.filter.Filter} + * @api + */ +ol.format.ogc.filter.Spatial = function(tagName, geometryName, geometry, opt_srsName) { + + ol.format.ogc.filter.Filter.call(this, tagName); + + /** + * @public + * @type {!string} + */ + this.geometryName = geometryName || 'the_geom'; + + /** + * @public + * @type {ol.geom.Geometry} + */ + this.geometry = geometry; + + /** + * @public + * @type {string|undefined} + */ + this.srsName = opt_srsName; +}; +ol.inherits(ol.format.ogc.filter.Spatial, ol.format.ogc.filter.Filter); diff --git a/src/ol/format/ogc/filter/within.js b/src/ol/format/ogc/filter/within.js new file mode 100644 index 0000000000..4280ca4219 --- /dev/null +++ b/src/ol/format/ogc/filter/within.js @@ -0,0 +1,25 @@ +goog.provide('ol.format.ogc.filter.Within'); + +goog.require('ol'); +goog.require('ol.format.ogc.filter.Spatial'); + + +/** + * @classdesc + * Represents a `` operator to test whether a geometry-valued property + * is within a given geometry. + * + * @constructor + * @param {!string} geometryName Geometry name to use. + * @param {!ol.geom.Geometry} geometry Geometry. + * @param {string=} opt_srsName SRS name. No srsName attribute will be + * set on geometries when this is not provided. + * @extends {ol.format.ogc.filter.Spatial} + * @api + */ +ol.format.ogc.filter.Within = function(geometryName, geometry, opt_srsName) { + + ol.format.ogc.filter.Spatial.call(this, 'Within', geometryName, geometry, opt_srsName); + +}; +ol.inherits(ol.format.ogc.filter.Within, ol.format.ogc.filter.Spatial);