From c6650285f549dd95fe814ebcb4b62540abe80006 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 17 Dec 2017 02:09:04 -0700 Subject: [PATCH] Rename _ol_format_WFS_ to WFS --- examples/vector-wfs-getfeature.js | 4 +- src/ol/format/WFS.js | 294 +++++++++++++++--------------- test/spec/ol/format/wfs.test.js | 96 +++++----- 3 files changed, 197 insertions(+), 197 deletions(-) diff --git a/examples/vector-wfs-getfeature.js b/examples/vector-wfs-getfeature.js index cc83d821da..88ed061556 100644 --- a/examples/vector-wfs-getfeature.js +++ b/examples/vector-wfs-getfeature.js @@ -1,7 +1,7 @@ import _ol_Map_ from '../src/ol/Map.js'; import _ol_View_ from '../src/ol/View.js'; import _ol_format_filter_ from '../src/ol/format/filter.js'; -import _ol_format_WFS_ from '../src/ol/format/WFS.js'; +import WFS from '../src/ol/format/WFS.js'; import GeoJSON from '../src/ol/format/GeoJSON.js'; import _ol_layer_Tile_ from '../src/ol/layer/Tile.js'; import _ol_layer_Vector_ from '../src/ol/layer/Vector.js'; @@ -40,7 +40,7 @@ var map = new _ol_Map_({ }); // generate a GetFeature request -var featureRequest = new _ol_format_WFS_().writeGetFeature({ +var featureRequest = new WFS().writeGetFeature({ srsName: 'EPSG:3857', featureNS: 'http://openstreemap.org', featurePrefix: 'osm', diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 80fac7eb23..4c2cc7ba2a 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -27,7 +27,7 @@ import _ol_xml_ from '../xml.js'; * @extends {ol.format.XMLFeature} * @api */ -var _ol_format_WFS_ = function(opt_options) { +var WFS = function(opt_options) { var options = opt_options ? opt_options : {}; /** @@ -55,54 +55,54 @@ var _ol_format_WFS_ = function(opt_options) { */ this.schemaLocation_ = options.schemaLocation ? options.schemaLocation : - _ol_format_WFS_.SCHEMA_LOCATIONS[_ol_format_WFS_.DEFAULT_VERSION]; + WFS.SCHEMA_LOCATIONS[WFS.DEFAULT_VERSION]; _ol_format_XMLFeature_.call(this); }; -inherits(_ol_format_WFS_, _ol_format_XMLFeature_); +inherits(WFS, _ol_format_XMLFeature_); /** * @const * @type {string} */ -_ol_format_WFS_.FEATURE_PREFIX = 'feature'; +WFS.FEATURE_PREFIX = 'feature'; /** * @const * @type {string} */ -_ol_format_WFS_.XMLNS = 'http://www.w3.org/2000/xmlns/'; +WFS.XMLNS = 'http://www.w3.org/2000/xmlns/'; /** * @const * @type {string} */ -_ol_format_WFS_.OGCNS = 'http://www.opengis.net/ogc'; +WFS.OGCNS = 'http://www.opengis.net/ogc'; /** * @const * @type {string} */ -_ol_format_WFS_.WFSNS = 'http://www.opengis.net/wfs'; +WFS.WFSNS = 'http://www.opengis.net/wfs'; /** * @const * @type {string} */ -_ol_format_WFS_.FESNS = 'http://www.opengis.net/fes'; +WFS.FESNS = 'http://www.opengis.net/fes'; /** * @const * @type {Object.} */ -_ol_format_WFS_.SCHEMA_LOCATIONS = { +WFS.SCHEMA_LOCATIONS = { '1.1.0': 'http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd', '1.0.0': 'http://www.opengis.net/wfs ' + @@ -114,13 +114,13 @@ _ol_format_WFS_.SCHEMA_LOCATIONS = { * @const * @type {string} */ -_ol_format_WFS_.DEFAULT_VERSION = '1.1.0'; +WFS.DEFAULT_VERSION = '1.1.0'; /** * @return {Array.|string|undefined} featureType */ -_ol_format_WFS_.prototype.getFeatureType = function() { +WFS.prototype.getFeatureType = function() { return this.featureType_; }; @@ -128,7 +128,7 @@ _ol_format_WFS_.prototype.getFeatureType = function() { /** * @param {Array.|string|undefined} featureType Feature type(s) to parse. */ -_ol_format_WFS_.prototype.setFeatureType = function(featureType) { +WFS.prototype.setFeatureType = function(featureType) { this.featureType_ = featureType; }; @@ -142,13 +142,13 @@ _ol_format_WFS_.prototype.setFeatureType = function(featureType) { * @return {Array.} Features. * @api */ -_ol_format_WFS_.prototype.readFeatures; +WFS.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) { +WFS.prototype.readFeaturesFromNode = function(node, opt_options) { var context = /** @type {ol.XmlNodeStackItem} */ ({ 'featureType': this.featureType_, 'featureNS': this.featureNS_ @@ -176,7 +176,7 @@ _ol_format_WFS_.prototype.readFeaturesFromNode = function(node, opt_options) { * @return {ol.WFSTransactionResponse|undefined} Transaction response. * @api */ -_ol_format_WFS_.prototype.readTransactionResponse = function(source) { +WFS.prototype.readTransactionResponse = function(source) { if (_ol_xml_.isDocument(source)) { return this.readTransactionResponseFromDocument( /** @type {Document} */ (source)); @@ -199,7 +199,7 @@ _ol_format_WFS_.prototype.readTransactionResponse = function(source) { * FeatureCollection metadata. * @api */ -_ol_format_WFS_.prototype.readFeatureCollectionMetadata = function(source) { +WFS.prototype.readFeatureCollectionMetadata = function(source) { if (_ol_xml_.isDocument(source)) { return this.readFeatureCollectionMetadataFromDocument( /** @type {Document} */ (source)); @@ -220,7 +220,7 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadata = function(source) { * @return {ol.WFSFeatureCollectionMetadata|undefined} * FeatureCollection metadata. */ -_ol_format_WFS_.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { +WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readFeatureCollectionMetadataFromNode(n); @@ -235,7 +235,7 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadataFromDocument = function(d * @type {Object.>} * @private */ -_ol_format_WFS_.FEATURE_COLLECTION_PARSERS_ = { +WFS.FEATURE_COLLECTION_PARSERS_ = { 'http://www.opengis.net/gml': { 'boundedBy': _ol_xml_.makeObjectPropertySetter( GMLBase.prototype.readGeometryElement, 'bounds') @@ -248,14 +248,14 @@ _ol_format_WFS_.FEATURE_COLLECTION_PARSERS_ = { * @return {ol.WFSFeatureCollectionMetadata|undefined} * FeatureCollection metadata. */ -_ol_format_WFS_.prototype.readFeatureCollectionMetadataFromNode = function(node) { +WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) { var result = {}; var value = _ol_format_XSD_.readNonNegativeIntegerString( node.getAttribute('numberOfFeatures')); result['numberOfFeatures'] = value; return _ol_xml_.pushParseAndPop( /** @type {ol.WFSFeatureCollectionMetadata} */ (result), - _ol_format_WFS_.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_); + WFS.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_); }; @@ -264,7 +264,7 @@ _ol_format_WFS_.prototype.readFeatureCollectionMetadataFromNode = function(node) * @type {Object.>} * @private */ -_ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_ = { +WFS.TRANSACTION_SUMMARY_PARSERS_ = { 'http://www.opengis.net/wfs': { 'totalInserted': _ol_xml_.makeObjectPropertySetter( _ol_format_XSD_.readNonNegativeInteger), @@ -282,9 +282,9 @@ _ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_ = { * @return {Object|undefined} Transaction Summary. * @private */ -_ol_format_WFS_.readTransactionSummary_ = function(node, objectStack) { +WFS.readTransactionSummary_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - {}, _ol_format_WFS_.TRANSACTION_SUMMARY_PARSERS_, node, objectStack); + {}, WFS.TRANSACTION_SUMMARY_PARSERS_, node, objectStack); }; @@ -293,7 +293,7 @@ _ol_format_WFS_.readTransactionSummary_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.OGC_FID_PARSERS_ = { +WFS.OGC_FID_PARSERS_ = { 'http://www.opengis.net/ogc': { 'FeatureId': _ol_xml_.makeArrayPusher(function(node, objectStack) { return node.getAttribute('fid'); @@ -307,8 +307,8 @@ _ol_format_WFS_.OGC_FID_PARSERS_ = { * @param {Array.<*>} objectStack Object stack. * @private */ -_ol_format_WFS_.fidParser_ = function(node, objectStack) { - _ol_xml_.parseNode(_ol_format_WFS_.OGC_FID_PARSERS_, node, objectStack); +WFS.fidParser_ = function(node, objectStack) { + _ol_xml_.parseNode(WFS.OGC_FID_PARSERS_, node, objectStack); }; @@ -317,9 +317,9 @@ _ol_format_WFS_.fidParser_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.INSERT_RESULTS_PARSERS_ = { +WFS.INSERT_RESULTS_PARSERS_ = { 'http://www.opengis.net/wfs': { - 'Feature': _ol_format_WFS_.fidParser_ + 'Feature': WFS.fidParser_ } }; @@ -330,9 +330,9 @@ _ol_format_WFS_.INSERT_RESULTS_PARSERS_ = { * @return {Array.|undefined} Insert results. * @private */ -_ol_format_WFS_.readInsertResults_ = function(node, objectStack) { +WFS.readInsertResults_ = function(node, objectStack) { return _ol_xml_.pushParseAndPop( - [], _ol_format_WFS_.INSERT_RESULTS_PARSERS_, node, objectStack); + [], WFS.INSERT_RESULTS_PARSERS_, node, objectStack); }; @@ -341,12 +341,12 @@ _ol_format_WFS_.readInsertResults_ = function(node, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_ = { +WFS.TRANSACTION_RESPONSE_PARSERS_ = { 'http://www.opengis.net/wfs': { 'TransactionSummary': _ol_xml_.makeObjectPropertySetter( - _ol_format_WFS_.readTransactionSummary_, 'transactionSummary'), + WFS.readTransactionSummary_, 'transactionSummary'), 'InsertResults': _ol_xml_.makeObjectPropertySetter( - _ol_format_WFS_.readInsertResults_, 'insertIds') + WFS.readInsertResults_, 'insertIds') } }; @@ -355,7 +355,7 @@ _ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_ = { * @param {Document} doc Document. * @return {ol.WFSTransactionResponse|undefined} Transaction response. */ -_ol_format_WFS_.prototype.readTransactionResponseFromDocument = function(doc) { +WFS.prototype.readTransactionResponseFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readTransactionResponseFromNode(n); @@ -369,10 +369,10 @@ _ol_format_WFS_.prototype.readTransactionResponseFromDocument = function(doc) { * @param {Node} node Node. * @return {ol.WFSTransactionResponse|undefined} Transaction response. */ -_ol_format_WFS_.prototype.readTransactionResponseFromNode = function(node) { +WFS.prototype.readTransactionResponseFromNode = function(node) { return _ol_xml_.pushParseAndPop( /** @type {ol.WFSTransactionResponse} */({}), - _ol_format_WFS_.TRANSACTION_RESPONSE_PARSERS_, node, []); + WFS.TRANSACTION_RESPONSE_PARSERS_, node, []); }; @@ -380,7 +380,7 @@ _ol_format_WFS_.prototype.readTransactionResponseFromNode = function(node) { * @type {Object.>} * @private */ -_ol_format_WFS_.QUERY_SERIALIZERS_ = { +WFS.QUERY_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { 'PropertyName': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) } @@ -393,7 +393,7 @@ _ol_format_WFS_.QUERY_SERIALIZERS_ = { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) { +WFS.writeFeature_ = function(node, feature, objectStack) { var context = objectStack[objectStack.length - 1]; var featureType = context['featureType']; var featureNS = context['featureNS']; @@ -414,9 +414,9 @@ _ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeOgcFidFilter_ = function(node, fid, objectStack) { - var filter = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); - var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'FeatureId'); +WFS.writeOgcFidFilter_ = function(node, fid, objectStack) { + var filter = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter'); + var child = _ol_xml_.createElementNS(WFS.OGCNS, 'FeatureId'); filter.appendChild(child); child.setAttribute('fid', fid); node.appendChild(filter); @@ -429,9 +429,9 @@ _ol_format_WFS_.writeOgcFidFilter_ = function(node, fid, objectStack) { * @returns {string} The value of the typeName property. * @private */ -_ol_format_WFS_.getTypeName_ = function(featurePrefix, featureType) { +WFS.getTypeName_ = function(featurePrefix, featureType) { featurePrefix = featurePrefix ? featurePrefix : - _ol_format_WFS_.FEATURE_PREFIX; + WFS.FEATURE_PREFIX; var prefix = featurePrefix + ':'; // The featureType already contains the prefix. if (featureType.indexOf(prefix) === 0) { @@ -448,19 +448,19 @@ _ol_format_WFS_.getTypeName_ = function(featurePrefix, featureType) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeDelete_ = function(node, feature, objectStack) { +WFS.writeDelete_ = function(node, feature, objectStack) { var context = objectStack[objectStack.length - 1]; _ol_asserts_.assert(feature.getId() !== undefined, 26); // Features must have an id set var featureType = context['featureType']; var featurePrefix = context['featurePrefix']; var featureNS = context['featureNS']; - var typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); + var typeName = WFS.getTypeName_(featurePrefix, featureType); node.setAttribute('typeName', typeName); - _ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, + _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); var fid = feature.getId(); if (fid !== undefined) { - _ol_format_WFS_.writeOgcFidFilter_(node, fid, objectStack); + WFS.writeOgcFidFilter_(node, fid, objectStack); } }; @@ -471,16 +471,16 @@ _ol_format_WFS_.writeDelete_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { +WFS.writeUpdate_ = function(node, feature, objectStack) { var context = objectStack[objectStack.length - 1]; _ol_asserts_.assert(feature.getId() !== undefined, 27); // Features must have an id set var featureType = context['featureType']; var featurePrefix = context['featurePrefix']; var featureNS = context['featureNS']; - var typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); + var typeName = WFS.getTypeName_(featurePrefix, featureType); var geometryName = feature.getGeometryName(); node.setAttribute('typeName', typeName); - _ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, + _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); var fid = feature.getId(); if (fid !== undefined) { @@ -499,10 +499,10 @@ _ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ( {'gmlVersion': context['gmlVersion'], node: node, 'hasZ': context['hasZ'], 'srsName': context['srsName']}), - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Property'), values, objectStack); - _ol_format_WFS_.writeOgcFidFilter_(node, fid, objectStack); + WFS.writeOgcFidFilter_(node, fid, objectStack); } }; @@ -513,14 +513,14 @@ _ol_format_WFS_.writeUpdate_ = function(node, feature, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeProperty_ = function(node, pair, objectStack) { - var name = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Name'); +WFS.writeProperty_ = function(node, pair, objectStack) { + var name = _ol_xml_.createElementNS(WFS.WFSNS, 'Name'); var context = objectStack[objectStack.length - 1]; var gmlVersion = context['gmlVersion']; node.appendChild(name); _ol_format_XSD_.writeStringTextNode(name, pair.name); if (pair.value !== undefined && pair.value !== null) { - var value = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Value'); + var value = _ol_xml_.createElementNS(WFS.WFSNS, 'Value'); node.appendChild(value); if (pair.value instanceof Geometry) { if (gmlVersion === 2) { @@ -544,7 +544,7 @@ _ol_format_WFS_.writeProperty_ = function(node, pair, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) { +WFS.writeNative_ = function(node, nativeElement, objectStack) { if (nativeElement.vendorId) { node.setAttribute('vendorId', nativeElement.vendorId); } @@ -561,13 +561,13 @@ _ol_format_WFS_.writeNative_ = function(node, nativeElement, objectStack) { * @type {Object.>} * @private */ -_ol_format_WFS_.TRANSACTION_SERIALIZERS_ = { +WFS.TRANSACTION_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { - 'Insert': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeFeature_), - 'Update': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeUpdate_), - 'Delete': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeDelete_), - 'Property': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeProperty_), - 'Native': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeNative_) + 'Insert': _ol_xml_.makeChildAppender(WFS.writeFeature_), + 'Update': _ol_xml_.makeChildAppender(WFS.writeUpdate_), + 'Delete': _ol_xml_.makeChildAppender(WFS.writeDelete_), + 'Property': _ol_xml_.makeChildAppender(WFS.writeProperty_), + 'Native': _ol_xml_.makeChildAppender(WFS.writeNative_) } }; @@ -578,7 +578,7 @@ _ol_format_WFS_.TRANSACTION_SERIALIZERS_ = { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { +WFS.writeQuery_ = function(node, featureType, objectStack) { var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var featurePrefix = context['featurePrefix']; var featureNS = context['featureNS']; @@ -587,7 +587,7 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { var typeName; // If feature prefix is not defined, we must not use the default prefix. if (featurePrefix) { - typeName = _ol_format_WFS_.getTypeName_(featurePrefix, featureType); + typeName = WFS.getTypeName_(featurePrefix, featureType); } else { typeName = featureType; } @@ -596,20 +596,20 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { node.setAttribute('srsName', srsName); } if (featureNS) { - _ol_xml_.setAttributeNS(node, _ol_format_WFS_.XMLNS, 'xmlns:' + featurePrefix, + _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); } var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); item.node = node; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.QUERY_SERIALIZERS_, + WFS.QUERY_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('PropertyName'), propertyNames, objectStack); var filter = context['filter']; if (filter) { - var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); + var child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter'); node.appendChild(child); - _ol_format_WFS_.writeFilterCondition_(child, filter, objectStack); + WFS.writeFilterCondition_(child, filter, objectStack); } }; @@ -620,11 +620,11 @@ _ol_format_WFS_.writeQuery_ = function(node, featureType, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeFilterCondition_ = function(node, filter, objectStack) { +WFS.writeFilterCondition_ = function(node, filter, objectStack) { /** @type {ol.XmlNodeStackItem} */ var item = {node: node}; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory(filter.getTagName()), [filter], objectStack); }; @@ -636,11 +636,11 @@ _ol_format_WFS_.writeFilterCondition_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeBboxFilter_ = function(node, filter, objectStack) { +WFS.writeBboxFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); + WFS.writeOgcPropertyName_(node, filter.geometryName); GML3.prototype.writeGeometryElement(node, filter.extent, objectStack); }; @@ -651,11 +651,11 @@ _ol_format_WFS_.writeBboxFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeContainsFilter_ = function(node, filter, objectStack) { +WFS.writeContainsFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); + WFS.writeOgcPropertyName_(node, filter.geometryName); GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack); }; @@ -666,11 +666,11 @@ _ol_format_WFS_.writeContainsFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIntersectsFilter_ = function(node, filter, objectStack) { +WFS.writeIntersectsFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); + WFS.writeOgcPropertyName_(node, filter.geometryName); GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack); }; @@ -681,11 +681,11 @@ _ol_format_WFS_.writeIntersectsFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeWithinFilter_ = function(node, filter, objectStack) { +WFS.writeWithinFilter_ = function(node, filter, objectStack) { var context = objectStack[objectStack.length - 1]; context['srsName'] = filter.srsName; - _ol_format_WFS_.writeOgcPropertyName_(node, filter.geometryName); + WFS.writeOgcPropertyName_(node, filter.geometryName); GML3.prototype.writeGeometryElement(node, filter.geometry, objectStack); }; @@ -696,9 +696,9 @@ _ol_format_WFS_.writeWithinFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeDuringFilter_ = function(node, filter, objectStack) { +WFS.writeDuringFilter_ = function(node, filter, objectStack) { - var valueReference = _ol_xml_.createElementNS(_ol_format_WFS_.FESNS, 'ValueReference'); + var valueReference = _ol_xml_.createElementNS(WFS.FESNS, 'ValueReference'); _ol_format_XSD_.writeStringTextNode(valueReference, filter.propertyName); node.appendChild(valueReference); @@ -708,11 +708,11 @@ _ol_format_WFS_.writeDuringFilter_ = function(node, filter, objectStack) { var begin = _ol_xml_.createElementNS(GMLBase.GMLNS, 'begin'); timePeriod.appendChild(begin); - _ol_format_WFS_.writeTimeInstant_(begin, filter.begin); + WFS.writeTimeInstant_(begin, filter.begin); var end = _ol_xml_.createElementNS(GMLBase.GMLNS, 'end'); timePeriod.appendChild(end); - _ol_format_WFS_.writeTimeInstant_(end, filter.end); + WFS.writeTimeInstant_(end, filter.end); }; @@ -722,14 +722,14 @@ _ol_format_WFS_.writeDuringFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeLogicalFilter_ = function(node, filter, objectStack) { +WFS.writeLogicalFilter_ = function(node, filter, objectStack) { /** @type {ol.XmlNodeStackItem} */ var item = {node: node}; var conditions = filter.conditions; for (var i = 0, ii = conditions.length; i < ii; ++i) { var condition = conditions[i]; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory(condition.getTagName()), [condition], objectStack); } @@ -742,12 +742,12 @@ _ol_format_WFS_.writeLogicalFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeNotFilter_ = function(node, filter, objectStack) { +WFS.writeNotFilter_ = function(node, filter, objectStack) { /** @type {ol.XmlNodeStackItem} */ var item = {node: node}; var condition = filter.condition; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory(condition.getTagName()), [condition], objectStack); }; @@ -759,12 +759,12 @@ _ol_format_WFS_.writeNotFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeComparisonFilter_ = function(node, filter, objectStack) { +WFS.writeComparisonFilter_ = function(node, filter, objectStack) { if (filter.matchCase !== undefined) { node.setAttribute('matchCase', filter.matchCase.toString()); } - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); - _ol_format_WFS_.writeOgcLiteral_(node, '' + filter.expression); + WFS.writeOgcPropertyName_(node, filter.propertyName); + WFS.writeOgcLiteral_(node, '' + filter.expression); }; @@ -774,8 +774,8 @@ _ol_format_WFS_.writeComparisonFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIsNullFilter_ = function(node, filter, objectStack) { - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); +WFS.writeIsNullFilter_ = function(node, filter, objectStack) { + WFS.writeOgcPropertyName_(node, filter.propertyName); }; @@ -785,16 +785,16 @@ _ol_format_WFS_.writeIsNullFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIsBetweenFilter_ = function(node, filter, objectStack) { - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); +WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) { + WFS.writeOgcPropertyName_(node, filter.propertyName); - var lowerBoundary = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'LowerBoundary'); + var lowerBoundary = _ol_xml_.createElementNS(WFS.OGCNS, 'LowerBoundary'); node.appendChild(lowerBoundary); - _ol_format_WFS_.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary); + WFS.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary); - var upperBoundary = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'UpperBoundary'); + var upperBoundary = _ol_xml_.createElementNS(WFS.OGCNS, 'UpperBoundary'); node.appendChild(upperBoundary); - _ol_format_WFS_.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary); + WFS.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary); }; @@ -804,15 +804,15 @@ _ol_format_WFS_.writeIsBetweenFilter_ = function(node, filter, objectStack) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeIsLikeFilter_ = function(node, filter, objectStack) { +WFS.writeIsLikeFilter_ = function(node, filter, objectStack) { node.setAttribute('wildCard', filter.wildCard); node.setAttribute('singleChar', filter.singleChar); node.setAttribute('escapeChar', filter.escapeChar); if (filter.matchCase !== undefined) { node.setAttribute('matchCase', filter.matchCase.toString()); } - _ol_format_WFS_.writeOgcPropertyName_(node, filter.propertyName); - _ol_format_WFS_.writeOgcLiteral_(node, '' + filter.pattern); + WFS.writeOgcPropertyName_(node, filter.propertyName); + WFS.writeOgcLiteral_(node, '' + filter.pattern); }; @@ -822,8 +822,8 @@ _ol_format_WFS_.writeIsLikeFilter_ = function(node, filter, objectStack) { * @param {string} value Value. * @private */ -_ol_format_WFS_.writeOgcExpression_ = function(tagName, node, value) { - var property = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, tagName); +WFS.writeOgcExpression_ = function(tagName, node, value) { + var property = _ol_xml_.createElementNS(WFS.OGCNS, tagName); _ol_format_XSD_.writeStringTextNode(property, value); node.appendChild(property); }; @@ -834,8 +834,8 @@ _ol_format_WFS_.writeOgcExpression_ = function(tagName, node, value) { * @param {string} value PropertyName value. * @private */ -_ol_format_WFS_.writeOgcPropertyName_ = function(node, value) { - _ol_format_WFS_.writeOgcExpression_('PropertyName', node, value); +WFS.writeOgcPropertyName_ = function(node, value) { + WFS.writeOgcExpression_('PropertyName', node, value); }; @@ -844,8 +844,8 @@ _ol_format_WFS_.writeOgcPropertyName_ = function(node, value) { * @param {string} value PropertyName value. * @private */ -_ol_format_WFS_.writeOgcLiteral_ = function(node, value) { - _ol_format_WFS_.writeOgcExpression_('Literal', node, value); +WFS.writeOgcLiteral_ = function(node, value) { + WFS.writeOgcExpression_('Literal', node, value); }; @@ -854,7 +854,7 @@ _ol_format_WFS_.writeOgcLiteral_ = function(node, value) { * @param {string} time PropertyName value. * @private */ -_ol_format_WFS_.writeTimeInstant_ = function(node, time) { +WFS.writeTimeInstant_ = function(node, time) { var timeInstant = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimeInstant'); node.appendChild(timeInstant); @@ -868,28 +868,28 @@ _ol_format_WFS_.writeTimeInstant_ = function(node, time) { * @type {Object.>} * @private */ -_ol_format_WFS_.GETFEATURE_SERIALIZERS_ = { +WFS.GETFEATURE_SERIALIZERS_ = { 'http://www.opengis.net/wfs': { - 'Query': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeQuery_) + 'Query': _ol_xml_.makeChildAppender(WFS.writeQuery_) }, 'http://www.opengis.net/ogc': { - 'During': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeDuringFilter_), - 'And': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeLogicalFilter_), - 'Or': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeLogicalFilter_), - 'Not': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeNotFilter_), - 'BBOX': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeBboxFilter_), - 'Contains': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeContainsFilter_), - 'Intersects': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIntersectsFilter_), - 'Within': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeWithinFilter_), - 'PropertyIsEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsLessThan': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeComparisonFilter_), - 'PropertyIsNull': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsNullFilter_), - 'PropertyIsBetween': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsBetweenFilter_), - 'PropertyIsLike': _ol_xml_.makeChildAppender(_ol_format_WFS_.writeIsLikeFilter_) + 'During': _ol_xml_.makeChildAppender(WFS.writeDuringFilter_), + 'And': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_), + 'Or': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_), + 'Not': _ol_xml_.makeChildAppender(WFS.writeNotFilter_), + 'BBOX': _ol_xml_.makeChildAppender(WFS.writeBboxFilter_), + 'Contains': _ol_xml_.makeChildAppender(WFS.writeContainsFilter_), + 'Intersects': _ol_xml_.makeChildAppender(WFS.writeIntersectsFilter_), + 'Within': _ol_xml_.makeChildAppender(WFS.writeWithinFilter_), + 'PropertyIsEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsLessThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_), + 'PropertyIsNull': _ol_xml_.makeChildAppender(WFS.writeIsNullFilter_), + 'PropertyIsBetween': _ol_xml_.makeChildAppender(WFS.writeIsBetweenFilter_), + 'PropertyIsLike': _ol_xml_.makeChildAppender(WFS.writeIsLikeFilter_) } }; @@ -901,9 +901,9 @@ _ol_format_WFS_.GETFEATURE_SERIALIZERS_ = { * @return {Node} Result. * @api */ -_ol_format_WFS_.writeFilter = function(filter) { - var child = _ol_xml_.createElementNS(_ol_format_WFS_.OGCNS, 'Filter'); - _ol_format_WFS_.writeFilterCondition_(child, filter, []); +WFS.writeFilter = function(filter) { + var child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter'); + WFS.writeFilterCondition_(child, filter, []); return child; }; @@ -914,12 +914,12 @@ _ol_format_WFS_.writeFilter = function(filter) { * @param {Array.<*>} objectStack Node stack. * @private */ -_ol_format_WFS_.writeGetFeature_ = function(node, featureTypes, objectStack) { +WFS.writeGetFeature_ = function(node, featureTypes, objectStack) { var context = /** @type {Object} */ (objectStack[objectStack.length - 1]); var item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); item.node = node; _ol_xml_.pushSerializeAndPop(item, - _ol_format_WFS_.GETFEATURE_SERIALIZERS_, + WFS.GETFEATURE_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Query'), featureTypes, objectStack); }; @@ -932,8 +932,8 @@ _ol_format_WFS_.writeGetFeature_ = function(node, featureTypes, objectStack) { * @return {Node} Result. * @api */ -_ol_format_WFS_.prototype.writeGetFeature = function(options) { - var node = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'GetFeature'); +WFS.prototype.writeGetFeature = function(options) { + var node = _ol_xml_.createElementNS(WFS.WFSNS, 'GetFeature'); node.setAttribute('service', 'WFS'); node.setAttribute('version', '1.1.0'); var filter; @@ -984,7 +984,7 @@ _ol_format_WFS_.prototype.writeGetFeature = function(options) { }; _ol_asserts_.assert(Array.isArray(options.featureTypes), 11); // `options.featureTypes` should be an Array - _ol_format_WFS_.writeGetFeature_(node, /** @type {!Array.} */ (options.featureTypes), [context]); + WFS.writeGetFeature_(node, /** @type {!Array.} */ (options.featureTypes), [context]); return node; }; @@ -999,12 +999,12 @@ _ol_format_WFS_.prototype.writeGetFeature = function(options) { * @return {Node} Result. * @api */ -_ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, +WFS.prototype.writeTransaction = function(inserts, updates, deletes, options) { var objectStack = []; - var node = _ol_xml_.createElementNS(_ol_format_WFS_.WFSNS, 'Transaction'); + var node = _ol_xml_.createElementNS(WFS.WFSNS, 'Transaction'); var version = options.version ? - options.version : _ol_format_WFS_.DEFAULT_VERSION; + options.version : WFS.DEFAULT_VERSION; var gmlVersion = version === '1.0.0' ? 2 : 3; node.setAttribute('service', 'WFS'); node.setAttribute('version', version); @@ -1017,17 +1017,17 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, node.setAttribute('handle', options.handle); } } - var schemaLocation = _ol_format_WFS_.SCHEMA_LOCATIONS[version]; + var schemaLocation = WFS.SCHEMA_LOCATIONS[version]; _ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance', 'xsi:schemaLocation', schemaLocation); - var featurePrefix = options.featurePrefix ? options.featurePrefix : _ol_format_WFS_.FEATURE_PREFIX; + var featurePrefix = options.featurePrefix ? options.featurePrefix : WFS.FEATURE_PREFIX; if (inserts) { obj = {node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; _ol_obj_.assign(obj, baseObj); _ol_xml_.pushSerializeAndPop(obj, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Insert'), inserts, objectStack); } @@ -1037,7 +1037,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; _ol_obj_.assign(obj, baseObj); _ol_xml_.pushSerializeAndPop(obj, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Update'), updates, objectStack); } @@ -1045,7 +1045,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, _ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'srsName': options.srsName}, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Delete'), deletes, objectStack); } @@ -1053,7 +1053,7 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, _ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'srsName': options.srsName}, - _ol_format_WFS_.TRANSACTION_SERIALIZERS_, + WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Native'), options.nativeElements, objectStack); } @@ -1069,13 +1069,13 @@ _ol_format_WFS_.prototype.writeTransaction = function(inserts, updates, deletes, * @return {?ol.proj.Projection} Projection. * @api */ -_ol_format_WFS_.prototype.readProjection; +WFS.prototype.readProjection; /** * @inheritDoc */ -_ol_format_WFS_.prototype.readProjectionFromDocument = function(doc) { +WFS.prototype.readProjectionFromDocument = function(doc) { for (var n = doc.firstChild; n; n = n.nextSibling) { if (n.nodeType == Node.ELEMENT_NODE) { return this.readProjectionFromNode(n); @@ -1088,7 +1088,7 @@ _ol_format_WFS_.prototype.readProjectionFromDocument = function(doc) { /** * @inheritDoc */ -_ol_format_WFS_.prototype.readProjectionFromNode = function(node) { +WFS.prototype.readProjectionFromNode = function(node) { if (node.firstElementChild && node.firstElementChild.firstElementChild) { node = node.firstElementChild.firstElementChild; @@ -1105,4 +1105,4 @@ _ol_format_WFS_.prototype.readProjectionFromNode = function(node) { return null; }; -export default _ol_format_WFS_; +export default WFS; diff --git a/test/spec/ol/format/wfs.test.js b/test/spec/ol/format/wfs.test.js index a54d8616ad..431c02ee08 100644 --- a/test/spec/ol/format/wfs.test.js +++ b/test/spec/ol/format/wfs.test.js @@ -1,6 +1,6 @@ import _ol_Feature_ from '../../../../src/ol/Feature.js'; import GML2 from '../../../../src/ol/format/GML2.js'; -import _ol_format_WFS_ from '../../../../src/ol/format/WFS.js'; +import WFS from '../../../../src/ol/format/WFS.js'; import _ol_format_filter_ from '../../../../src/ol/format/filter.js'; import LineString from '../../../../src/ol/geom/LineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; @@ -16,7 +16,7 @@ describe('ol.format.WFS', function() { describe('featureType', function() { it('#getFeatureType #setFeatureType', function() { - var format = new _ol_format_WFS_({ + var format = new WFS({ featureNS: 'http://www.openplans.org/topp', featureType: ['foo', 'bar'] }); @@ -41,7 +41,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(data) { try { xml = data; - features = new _ol_format_WFS_(config).readFeatures(xml); + features = new WFS(config).readFeatures(xml); } catch (e) { done(e); } @@ -67,7 +67,7 @@ describe('ol.format.WFS', function() { }); it('transforms and creates a polygon for Illinois', function() { - features = new _ol_format_WFS_(config).readFeatures(xml, { + features = new WFS(config).readFeatures(xml, { featureProjection: 'EPSG:3857' }); feature = features[0]; @@ -97,7 +97,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) { try { xml = data; - features = new _ol_format_WFS_(config).readFeatures(xml); + features = new WFS(config).readFeatures(xml); } catch (e) { done(e); } @@ -138,7 +138,7 @@ describe('ol.format.WFS', function() { }); }); it('returns an empty array of features when none exist', function() { - var result = new _ol_format_WFS_().readFeatures(xml); + var result = new WFS().readFeatures(xml); expect(result).to.have.length(0); }); }); @@ -149,7 +149,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml', function(xml) { try { - response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml); + response = new WFS().readFeatureCollectionMetadata(xml); } catch (e) { done(e); } @@ -172,7 +172,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/boundedBy.xml', function(xml) { try { - response = new _ol_format_WFS_().readFeatureCollectionMetadata(xml); + response = new WFS().readFeatureCollectionMetadata(xml); } catch (e) { done(e); } @@ -191,7 +191,7 @@ describe('ol.format.WFS', function() { afterLoadText('spec/ol/format/wfs/TransactionResponse.xml', function(xml) { try { - response = new _ol_format_WFS_().readTransactionResponse(xml); + response = new WFS().readTransactionResponse(xml); } catch (e) { done(e); } @@ -226,7 +226,7 @@ describe('ol.format.WFS', function() { ' STATE_ABBR' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ resultType: 'hits', featureTypes: ['states'], featureNS: 'http://www.openplans.org/topp', @@ -251,7 +251,7 @@ describe('ol.format.WFS', function() { ' xmlns:topp="http://www.openplans.org/topp">' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ count: 10, startIndex: 20, srsName: 'urn:ogc:def:crs:EPSG::4326', @@ -278,7 +278,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -301,7 +301,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -329,7 +329,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -371,7 +371,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -403,7 +403,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -424,7 +424,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -446,7 +446,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -468,7 +468,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -492,7 +492,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -528,7 +528,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'urn:ogc:def:crs:EPSG::4326', featureNS: 'http://www.openplans.org/topp', featurePrefix: 'topp', @@ -562,7 +562,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['area'], filter: _ol_format_filter_.contains( @@ -599,7 +599,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['area'], filter: _ol_format_filter_.intersects( @@ -636,7 +636,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['area'], filter: _ol_format_filter_.within( @@ -676,7 +676,7 @@ describe('ol.format.WFS', function() { ' ' + ''; - var serialized = new _ol_format_WFS_().writeGetFeature({ + var serialized = new WFS().writeGetFeature({ srsName: 'EPSG:4326', featureTypes: ['states'], filter: _ol_format_filter_.during('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z') @@ -695,7 +695,7 @@ describe('ol.format.WFS', function() { 'service="WFS" version="1.1.0" handle="handle_t" ' + 'xsi:schemaLocation="http://www.opengis.net/wfs ' + 'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>'; - var serialized = new _ol_format_WFS_().writeTransaction(null, null, null, + var serialized = new WFS().writeTransaction(null, null, null, {handle: 'handle_t'}); expect(serialized).to.xmleql(_ol_xml_.parse(text)); }); @@ -711,7 +711,7 @@ describe('ol.format.WFS', function() { }); }); it('creates the correct srsName', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiLineString([[ [-5178372.1885436, 1992365.7775042], @@ -742,7 +742,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct update', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -763,7 +763,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct update if geometry name is alias', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(new MultiLineString([[ [-12279454, 6741885], [-12064207, 6732101], @@ -787,7 +787,7 @@ describe('ol.format.WFS', function() { describe('when writing out a Transaction request', function() { it('creates the correct update with default featurePrefix', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -810,7 +810,7 @@ describe('ol.format.WFS', function() { describe('when writing out a Transaction request', function() { it('does not create an update if no fid', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -843,7 +843,7 @@ describe('ol.format.WFS', function() { }); it('handles multiple geometries', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var updateFeature = new _ol_Feature_(); updateFeature.setGeometryName('the_geom'); updateFeature.setGeometry(new MultiLineString([[ @@ -878,7 +878,7 @@ describe('ol.format.WFS', function() { }); it('creates the correct transaction body', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', @@ -921,7 +921,7 @@ describe('ol.format.WFS', function() { }); it('handles writing out Native', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var serialized = format.writeTransaction(null, null, null, { nativeElements: [{ vendorId: 'ORACLE', @@ -948,7 +948,7 @@ describe('ol.format.WFS', function() { }); it('handles the WFS version', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new LineString([[1.1, 2], [3, 4.2]]), foo: 'bar', @@ -992,7 +992,7 @@ describe('ol.format.WFS', function() { }); it('do not add feature prefix twice', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiPoint([[1, 2]]), foo: 'bar', @@ -1035,7 +1035,7 @@ describe('ol.format.WFS', function() { }); it('handles 3D in WFS 1.0.0', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]), foo: 'bar', @@ -1077,7 +1077,7 @@ describe('ol.format.WFS', function() { }); it('handles 3D in WFS 1.1.0', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var insertFeature = new _ol_Feature_({ the_geom: new MultiPoint([[1, 2, 3]]), foo: 'bar', @@ -1117,7 +1117,7 @@ describe('ol.format.WFS', function() { }); it('handles writing multiple Query elements', function() { - var format = new _ol_format_WFS_(); + var format = new WFS(); var serialized = format.writeGetFeature({ featureNS: 'http://www.openplans.org/topp', featureTypes: ['states', 'cities'], @@ -1137,7 +1137,7 @@ describe('ol.format.WFS', function() { 'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureType': 'Historische_Messtischblaetter_WFS' }; - features = new _ol_format_WFS_(config).readFeatures(xml); + features = new WFS(config).readFeatures(xml); } catch (e) { done(e); } @@ -1165,7 +1165,7 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { - features = new _ol_format_WFS_({ + features = new WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_polygon', 'planet_osm_line'] }).readFeatures(xml); @@ -1188,11 +1188,11 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { - lineFeatures = new _ol_format_WFS_({ + lineFeatures = new WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_line'] }).readFeatures(xml); - polygonFeatures = new _ol_format_WFS_({ + polygonFeatures = new WFS({ featureNS: 'http://localhost:8080/official', featureType: ['planet_osm_polygon'] }).readFeatures(xml); @@ -1216,7 +1216,7 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) { try { - features = new _ol_format_WFS_().readFeatures(xml); + features = new WFS().readFeatures(xml); } catch (e) { done(e); } @@ -1236,7 +1236,7 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) { try { - features = new _ol_format_WFS_().readFeatures(xml); + features = new WFS().readFeatures(xml); } catch (e) { done(e); } @@ -1259,11 +1259,11 @@ describe('ol.format.WFS', function() { before(function(done) { afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) { try { - busFeatures = new _ol_format_WFS_({ + busFeatures = new WFS({ featureNS: 'http://mapserver.gis.umn.edu/mapserver', featureType: ['bus_stop'] }).readFeatures(xml); - infoFeatures = new _ol_format_WFS_({ + infoFeatures = new WFS({ featureNS: 'http://mapserver.gis.umn.edu/mapserver', featureType: ['information'] }).readFeatures(xml); @@ -1296,7 +1296,7 @@ describe('ol.format.WFS', function() { ' ' + ' ' + ''; - var serialized = _ol_format_WFS_.writeFilter( + var serialized = WFS.writeFilter( _ol_format_filter_.and( _ol_format_filter_.like('name', 'Mississippi*'), _ol_format_filter_.equalTo('waterway', 'riverbank')