Rename _ol_format_WMSCapabilities_ to WMSCapabilities
This commit is contained in:
@@ -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) {
|
fetch('data/wmsgetfeatureinfo/osm-restaurant-hotel.xml').then(function(response) {
|
||||||
return response.text();
|
return response.text();
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
|
|
||||||
// this is the standard way to read the features
|
// 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();
|
document.getElementById('all').innerText = allFeatures.length.toString();
|
||||||
|
|
||||||
// when specifying the 'layers' options, only the features of those
|
// when specifying the 'layers' options, only the features of those
|
||||||
// layers are returned by the format
|
// layers are returned by the format
|
||||||
var hotelFeatures = new _ol_format_WMSGetFeatureInfo_({
|
var hotelFeatures = new WMSGetFeatureInfo({
|
||||||
layers: ['hotel']
|
layers: ['hotel']
|
||||||
}).readFeatures(response);
|
}).readFeatures(response);
|
||||||
document.getElementById('hotel').innerText = hotelFeatures.length.toString();
|
document.getElementById('hotel').innerText = hotelFeatures.length.toString();
|
||||||
|
|
||||||
var restaurantFeatures = new _ol_format_WMSGetFeatureInfo_({
|
var restaurantFeatures = new WMSGetFeatureInfo({
|
||||||
layers: ['restaurant']
|
layers: ['restaurant']
|
||||||
}).readFeatures(response);
|
}).readFeatures(response);
|
||||||
document.getElementById('restaurant').innerText = restaurantFeatures.length.toString();
|
document.getElementById('restaurant').innerText = restaurantFeatures.length.toString();
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import _ol_xml_ from '../xml.js';
|
|||||||
* @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
|
* @param {olx.format.WMSGetFeatureInfoOptions=} opt_options Options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_format_WMSGetFeatureInfo_ = function(opt_options) {
|
var WMSGetFeatureInfo = function(opt_options) {
|
||||||
|
|
||||||
var options = opt_options ? opt_options : {};
|
var options = opt_options ? opt_options : {};
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ var _ol_format_WMSGetFeatureInfo_ = function(opt_options) {
|
|||||||
_ol_format_XMLFeature_.call(this);
|
_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}
|
* @type {string}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature';
|
WMSGetFeatureInfo.featureIdentifier_ = '_feature';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,13 +61,13 @@ _ol_format_WMSGetFeatureInfo_.featureIdentifier_ = '_feature';
|
|||||||
* @type {string}
|
* @type {string}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.layerIdentifier_ = '_layer';
|
WMSGetFeatureInfo.layerIdentifier_ = '_layer';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array.<string>} layers
|
* @return {Array.<string>} layers
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() {
|
WMSGetFeatureInfo.prototype.getLayers = function() {
|
||||||
return this.layers_;
|
return this.layers_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.getLayers = function() {
|
|||||||
/**
|
/**
|
||||||
* @param {Array.<string>} layers Layers to parse.
|
* @param {Array.<string>} layers Layers to parse.
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) {
|
WMSGetFeatureInfo.prototype.setLayers = function(layers) {
|
||||||
this.layers_ = layers;
|
this.layers_ = layers;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.setLayers = function(layers) {
|
|||||||
* @return {Array.<ol.Feature>} Features.
|
* @return {Array.<ol.Feature>} Features.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectStack) {
|
WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
|
||||||
node.setAttribute('namespaceURI', this.featureNS_);
|
node.setAttribute('namespaceURI', this.featureNS_);
|
||||||
var localName = node.localName;
|
var localName = node.localName;
|
||||||
/** @type {Array.<ol.Feature>} */
|
/** @type {Array.<ol.Feature>} */
|
||||||
@@ -102,7 +102,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta
|
|||||||
}
|
}
|
||||||
var context = objectStack[0];
|
var context = objectStack[0];
|
||||||
|
|
||||||
var toRemove = _ol_format_WMSGetFeatureInfo_.layerIdentifier_;
|
var toRemove = WMSGetFeatureInfo.layerIdentifier_;
|
||||||
var layerName = layer.localName.replace(toRemove, '');
|
var layerName = layer.localName.replace(toRemove, '');
|
||||||
|
|
||||||
if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) {
|
if (this.layers_ && !_ol_array_.includes(this.layers_, layerName)) {
|
||||||
@@ -110,7 +110,7 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta
|
|||||||
}
|
}
|
||||||
|
|
||||||
var featureType = layerName +
|
var featureType = layerName +
|
||||||
_ol_format_WMSGetFeatureInfo_.featureIdentifier_;
|
WMSGetFeatureInfo.featureIdentifier_;
|
||||||
|
|
||||||
context['featureType'] = featureType;
|
context['featureType'] = featureType;
|
||||||
context['featureNS'] = this.featureNS_;
|
context['featureNS'] = this.featureNS_;
|
||||||
@@ -149,13 +149,13 @@ _ol_format_WMSGetFeatureInfo_.prototype.readFeatures_ = function(node, objectSta
|
|||||||
* @return {Array.<ol.Feature>} Features.
|
* @return {Array.<ol.Feature>} Features.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.readFeatures;
|
WMSGetFeatureInfo.prototype.readFeatures;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.readFeaturesFromNode = function(node, opt_options) {
|
WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||||
var options = {};
|
var options = {};
|
||||||
if (opt_options) {
|
if (opt_options) {
|
||||||
_ol_obj_.assign(options, this.getReadOptions(node, 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.
|
* Not implemented.
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.writeFeatureNode = function(feature, opt_options) {};
|
WMSGetFeatureInfo.prototype.writeFeatureNode = function(feature, opt_options) {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not implemented.
|
* Not implemented.
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.writeFeaturesNode = function(features, opt_options) {};
|
WMSGetFeatureInfo.prototype.writeFeaturesNode = function(features, opt_options) {};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Not implemented.
|
* Not implemented.
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_format_WMSGetFeatureInfo_.prototype.writeGeometryNode = function(geometry, opt_options) {};
|
WMSGetFeatureInfo.prototype.writeGeometryNode = function(geometry, opt_options) {};
|
||||||
export default _ol_format_WMSGetFeatureInfo_;
|
export default WMSGetFeatureInfo;
|
||||||
|
|||||||
@@ -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('ol.format.WMSCapabilities', function() {
|
||||||
|
|
||||||
describe('when parsing ogcsample.xml', function() {
|
describe('when parsing ogcsample.xml', function() {
|
||||||
|
|
||||||
var parser = new _ol_format_WMSCapabilities_();
|
var parser = new WMSCapabilities();
|
||||||
var capabilities;
|
var capabilities;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) {
|
afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) {
|
||||||
|
|||||||
Reference in New Issue
Block a user