Rename _ol_format_WFS_ to WFS

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