diff --git a/examples/getfeatureinfo-layers.js b/examples/getfeatureinfo-layers.js index 67458d5c72..c93c6103a3 100644 --- a/examples/getfeatureinfo-layers.js +++ b/examples/getfeatureinfo-layers.js @@ -1,21 +1,21 @@ -import _ol_format_WMSGetFeatureInfo_ from '../src/ol/format/WMSGetFeatureInfo.js'; +import WMSGetFeatureInfo from '../src/ol/format/WMSGetFeatureInfo.js'; fetch('data/wmsgetfeatureinfo/osm-restaurant-hotel.xml').then(function(response) { return response.text(); }).then(function(response) { // this is the standard way to read the features - var allFeatures = new _ol_format_WMSGetFeatureInfo_().readFeatures(response); + var allFeatures = new WMSGetFeatureInfo().readFeatures(response); document.getElementById('all').innerText = allFeatures.length.toString(); // when specifying the 'layers' options, only the features of those // layers are returned by the format - var hotelFeatures = new _ol_format_WMSGetFeatureInfo_({ + var hotelFeatures = new WMSGetFeatureInfo({ layers: ['hotel'] }).readFeatures(response); document.getElementById('hotel').innerText = hotelFeatures.length.toString(); - var restaurantFeatures = new _ol_format_WMSGetFeatureInfo_({ + var restaurantFeatures = new WMSGetFeatureInfo({ layers: ['restaurant'] }).readFeatures(response); document.getElementById('restaurant').innerText = restaurantFeatures.length.toString(); diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index 2329f8b154..21fa75b9e6 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -18,7 +18,7 @@ import _ol_xml_ from '../xml.js'; * @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options. * @api */ -var _ol_format_WMSGetFeatureInfo_ = function(opt_options) { +var WMSGetFeatureInfo = function(opt_options) { var options = opt_options ? opt_options : {}; @@ -45,7 +45,7 @@ var _ol_format_WMSGetFeatureInfo_ = function(opt_options) { _ol_format_XMLFeature_.call(this); }; -inherits(_ol_format_WMSGetFeatureInfo_, _ol_format_XMLFeature_); +inherits(WMSGetFeatureInfo, _ol_format_XMLFeature_); /** @@ -53,7 +53,7 @@ inherits(_ol_format_WMSGetFeatureInfo_, _ol_format_XMLFeature_); * @type {string} * @private */ -_ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature'; +WMSGetFeatureInfo.featureIdentifier_ = '_feature'; /** @@ -61,13 +61,13 @@ _ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature'; * @type {string} * @private */ -_ol_format_WMSGetFeatureInfo_.layerIdentifier_ = '_layer'; +WMSGetFeatureInfo.layerIdentifier_ = '_layer'; /** * @return {Array.} layers */ -_ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() { +WMSGetFeatureInfo.prototype.getLayers = function() { return this.layers_; }; @@ -75,7 +75,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() { /** * @param {Array.} layers Layers to parse. */ -_ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) { +WMSGetFeatureInfo.prototype.setLayers = function(layers) { this.layers_ = layers; }; @@ -86,7 +86,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) { * @return {Array.} Features. * @private */ -_ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectStack) { +WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) { node.setAttribute('namespaceURI', this.featureNS_); var localName = node.localName; /** @type {Array.} */ @@ -102,7 +102,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta } var context = objectStack[0]; - var toRemove = _ol_format_WMSGetFeatureInfo_.layerIdentifier_; + var toRemove = WMSGetFeatureInfo.layerIdentifier_; var layerName = layer.localName.replace(toRemove, ''); if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) { @@ -110,7 +110,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta } var featureType = layerName + - _ol_format_WMSGetFeatureInfo_.featureIdentifier_; + WMSGetFeatureInfo.featureIdentifier_; context['featureType'] = featureType; context['featureNS'] = this.featureNS_; @@ -149,13 +149,13 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta * @return {Array.} Features. * @api */ -_ol_format_WMSGetFeatureInfo_.prototype.readFeatures; +WMSGetFeatureInfo.prototype.readFeatures; /** * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, opt_options) { +WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) { var options = {}; if (opt_options) { _ol_obj_.assign(options, this.getReadOptions(node, opt_options)); @@ -168,19 +168,19 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, op * Not implemented. * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.writeFeatureNode = function(feature, opt_options) {}; +WMSGetFeatureInfo.prototype.writeFeatureNode = function(feature, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.writeFeaturesNode = function(features, opt_options) {}; +WMSGetFeatureInfo.prototype.writeFeaturesNode = function(features, opt_options) {}; /** * Not implemented. * @inheritDoc */ -_ol_format_WMSGetFeatureInfo_.prototype.writeGeometryNode = function(geometry, opt_options) {}; -export default _ol_format_WMSGetFeatureInfo_; +WMSGetFeatureInfo.prototype.writeGeometryNode = function(geometry, opt_options) {}; +export default WMSGetFeatureInfo; diff --git a/test/spec/ol/format/wmscapabilities.test.js b/test/spec/ol/format/wmscapabilities.test.js index 2f9f01989d..5fdd0f054d 100644 --- a/test/spec/ol/format/wmscapabilities.test.js +++ b/test/spec/ol/format/wmscapabilities.test.js @@ -1,10 +1,10 @@ -import _ol_format_WMSCapabilities_ from '../../../../src/ol/format/WMSCapabilities.js'; +import WMSCapabilities from '../../../../src/ol/format/WMSCapabilities.js'; describe('ol.format.WMSCapabilities', function() { describe('when parsing ogcsample.xml', function() { - var parser = new _ol_format_WMSCapabilities_(); + var parser = new WMSCapabilities(); var capabilities; before(function(done) { afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) {