Rename _ol_source_ImageWMS_ to ImageWMS
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js';
|
import ImageWMS from '../src/ol/source/ImageWMS.js';
|
||||||
|
|
||||||
|
|
||||||
var wmsSource = new _ol_source_ImageWMS_({
|
var wmsSource = new ImageWMS({
|
||||||
url: 'https://ahocevar.com/geoserver/wms',
|
url: 'https://ahocevar.com/geoserver/wms',
|
||||||
params: {'LAYERS': 'ne:ne'},
|
params: {'LAYERS': 'ne:ne'},
|
||||||
serverType: 'geoserver',
|
serverType: 'geoserver',
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Map from '../src/ol/Map.js';
|
import Map from '../src/ol/Map.js';
|
||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js';
|
import ImageWMS from '../src/ol/source/ImageWMS.js';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +77,7 @@ Progress.prototype.hide = function() {
|
|||||||
|
|
||||||
var progress = new Progress(document.getElementById('progress'));
|
var progress = new Progress(document.getElementById('progress'));
|
||||||
|
|
||||||
var source = new _ol_source_ImageWMS_({
|
var source = new ImageWMS({
|
||||||
url: 'https://ahocevar.com/geoserver/wms',
|
url: 'https://ahocevar.com/geoserver/wms',
|
||||||
params: {'LAYERS': 'topp:states'},
|
params: {'LAYERS': 'topp:states'},
|
||||||
serverType: 'geoserver'
|
serverType: 'geoserver'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import ScaleLine from '../src/ol/control/ScaleLine.js';
|
|||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import {fromLonLat} from '../src/ol/proj.js';
|
import {fromLonLat} from '../src/ol/proj.js';
|
||||||
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
|
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
|
||||||
import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js';
|
import ImageWMS from '../src/ol/source/ImageWMS.js';
|
||||||
import {register} from '../src/ol/proj/proj4.js';
|
import {register} from '../src/ol/proj/proj4.js';
|
||||||
import proj4 from 'proj4';
|
import proj4 from 'proj4';
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ var extent = [420000, 30000, 900000, 350000];
|
|||||||
var layers = [
|
var layers = [
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
extent: extent,
|
extent: extent,
|
||||||
source: new _ol_source_ImageWMS_({
|
source: new ImageWMS({
|
||||||
url: 'https://wms.geo.admin.ch/',
|
url: 'https://wms.geo.admin.ch/',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
||||||
@@ -52,7 +52,7 @@ var layers = [
|
|||||||
}),
|
}),
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
extent: extent,
|
extent: extent,
|
||||||
source: new _ol_source_ImageWMS_({
|
source: new ImageWMS({
|
||||||
url: 'https://wms.geo.admin.ch/',
|
url: 'https://wms.geo.admin.ch/',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Map from '../src/ol/Map.js';
|
|||||||
import View from '../src/ol/View.js';
|
import View from '../src/ol/View.js';
|
||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js';
|
import ImageWMS from '../src/ol/source/ImageWMS.js';
|
||||||
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
import _ol_source_OSM_ from '../src/ol/source/OSM.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ var layers = [
|
|||||||
}),
|
}),
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
extent: [-13884991, 2870341, -7455066, 6338219],
|
extent: [-13884991, 2870341, -7455066, 6338219],
|
||||||
source: new _ol_source_ImageWMS_({
|
source: new ImageWMS({
|
||||||
url: 'https://ahocevar.com/geoserver/wms',
|
url: 'https://ahocevar.com/geoserver/wms',
|
||||||
params: {'LAYERS': 'topp:states'},
|
params: {'LAYERS': 'topp:states'},
|
||||||
ratio: 1,
|
ratio: 1,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import View from '../src/ol/View.js';
|
|||||||
import ImageLayer from '../src/ol/layer/Image.js';
|
import ImageLayer from '../src/ol/layer/Image.js';
|
||||||
import TileLayer from '../src/ol/layer/Tile.js';
|
import TileLayer from '../src/ol/layer/Tile.js';
|
||||||
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
|
import _ol_proj_Projection_ from '../src/ol/proj/Projection.js';
|
||||||
import _ol_source_ImageWMS_ from '../src/ol/source/ImageWMS.js';
|
import ImageWMS from '../src/ol/source/ImageWMS.js';
|
||||||
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
|
import _ol_source_TileWMS_ from '../src/ol/source/TileWMS.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ var layers = [
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
new ImageLayer({
|
new ImageLayer({
|
||||||
source: new _ol_source_ImageWMS_({
|
source: new ImageWMS({
|
||||||
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
attributions: '© <a href="http://www.geo.admin.ch/internet/geoportal/' +
|
||||||
'en/home.html">National parks / geo.admin.ch</a>',
|
'en/home.html">National parks / geo.admin.ch</a>',
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import _ol_uri_ from '../uri.js';
|
|||||||
* @param {olx.source.ImageWMSOptions=} opt_options Options.
|
* @param {olx.source.ImageWMSOptions=} opt_options Options.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
var _ol_source_ImageWMS_ = function(opt_options) {
|
var ImageWMS = function(opt_options) {
|
||||||
|
|
||||||
var options = opt_options || {};
|
var options = opt_options || {};
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ var _ol_source_ImageWMS_ = function(opt_options) {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inherits(_ol_source_ImageWMS_, ImageSource);
|
inherits(ImageWMS, ImageSource);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +116,7 @@ inherits(_ol_source_ImageWMS_, ImageSource);
|
|||||||
* @type {ol.Size}
|
* @type {ol.Size}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101];
|
ImageWMS.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,7 +133,7 @@ _ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_ = [101, 101];
|
|||||||
* @return {string|undefined} GetFeatureInfo URL.
|
* @return {string|undefined} GetFeatureInfo URL.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
|
ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projection, params) {
|
||||||
if (this.url_ === undefined) {
|
if (this.url_ === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol
|
|||||||
}
|
}
|
||||||
|
|
||||||
var extent = getForViewAndSize(coordinate, resolution, 0,
|
var extent = getForViewAndSize(coordinate, resolution, 0,
|
||||||
_ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_);
|
ImageWMS.GETFEATUREINFO_IMAGE_SIZE_);
|
||||||
|
|
||||||
var baseParams = {
|
var baseParams = {
|
||||||
'SERVICE': 'WMS',
|
'SERVICE': 'WMS',
|
||||||
@@ -164,7 +164,7 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol
|
|||||||
baseParams[this.v13_ ? 'J' : 'Y'] = y;
|
baseParams[this.v13_ ? 'J' : 'Y'] = y;
|
||||||
|
|
||||||
return this.getRequestUrl_(
|
return this.getRequestUrl_(
|
||||||
extent, _ol_source_ImageWMS_.GETFEATUREINFO_IMAGE_SIZE_,
|
extent, ImageWMS.GETFEATUREINFO_IMAGE_SIZE_,
|
||||||
1, sourceProjectionObj || projectionObj, baseParams);
|
1, sourceProjectionObj || projectionObj, baseParams);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ _ol_source_ImageWMS_.prototype.getGetFeatureInfoUrl = function(coordinate, resol
|
|||||||
* @return {Object} Params.
|
* @return {Object} Params.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.getParams = function() {
|
ImageWMS.prototype.getParams = function() {
|
||||||
return this.params_;
|
return this.params_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ _ol_source_ImageWMS_.prototype.getParams = function() {
|
|||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {
|
ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, projection) {
|
||||||
|
|
||||||
if (this.url_ === undefined) {
|
if (this.url_ === undefined) {
|
||||||
return null;
|
return null;
|
||||||
@@ -249,7 +249,7 @@ _ol_source_ImageWMS_.prototype.getImageInternal = function(extent, resolution, p
|
|||||||
* @return {ol.ImageLoadFunctionType} The image load function.
|
* @return {ol.ImageLoadFunctionType} The image load function.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.getImageLoadFunction = function() {
|
ImageWMS.prototype.getImageLoadFunction = function() {
|
||||||
return this.imageLoadFunction_;
|
return this.imageLoadFunction_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ _ol_source_ImageWMS_.prototype.getImageLoadFunction = function() {
|
|||||||
* @return {string} Request URL.
|
* @return {string} Request URL.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) {
|
ImageWMS.prototype.getRequestUrl_ = function(extent, size, pixelRatio, projection, params) {
|
||||||
|
|
||||||
assert(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()`
|
assert(this.url_ !== undefined, 9); // `url` must be configured or set using `#setUrl()`
|
||||||
|
|
||||||
@@ -317,7 +317,7 @@ _ol_source_ImageWMS_.prototype.getRequestUrl_ = function(extent, size, pixelRati
|
|||||||
* @return {string|undefined} URL.
|
* @return {string|undefined} URL.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.getUrl = function() {
|
ImageWMS.prototype.getUrl = function() {
|
||||||
return this.url_;
|
return this.url_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ _ol_source_ImageWMS_.prototype.getUrl = function() {
|
|||||||
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
* @param {ol.ImageLoadFunctionType} imageLoadFunction Image load function.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.setImageLoadFunction = function(
|
ImageWMS.prototype.setImageLoadFunction = function(
|
||||||
imageLoadFunction) {
|
imageLoadFunction) {
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
this.imageLoadFunction_ = imageLoadFunction;
|
this.imageLoadFunction_ = imageLoadFunction;
|
||||||
@@ -340,7 +340,7 @@ _ol_source_ImageWMS_.prototype.setImageLoadFunction = function(
|
|||||||
* @param {string|undefined} url URL.
|
* @param {string|undefined} url URL.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.setUrl = function(url) {
|
ImageWMS.prototype.setUrl = function(url) {
|
||||||
if (url != this.url_) {
|
if (url != this.url_) {
|
||||||
this.url_ = url;
|
this.url_ = url;
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
@@ -354,7 +354,7 @@ _ol_source_ImageWMS_.prototype.setUrl = function(url) {
|
|||||||
* @param {Object} params Params.
|
* @param {Object} params Params.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.updateParams = function(params) {
|
ImageWMS.prototype.updateParams = function(params) {
|
||||||
_ol_obj_.assign(this.params_, params);
|
_ol_obj_.assign(this.params_, params);
|
||||||
this.updateV13_();
|
this.updateV13_();
|
||||||
this.image_ = null;
|
this.image_ = null;
|
||||||
@@ -365,8 +365,8 @@ _ol_source_ImageWMS_.prototype.updateParams = function(params) {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_ol_source_ImageWMS_.prototype.updateV13_ = function() {
|
ImageWMS.prototype.updateV13_ = function() {
|
||||||
var version = this.params_['VERSION'] || DEFAULT_WMS_VERSION;
|
var version = this.params_['VERSION'] || DEFAULT_WMS_VERSION;
|
||||||
this.v13_ = _ol_string_.compareVersions(version, '1.3') >= 0;
|
this.v13_ = _ol_string_.compareVersions(version, '1.3') >= 0;
|
||||||
};
|
};
|
||||||
export default _ol_source_ImageWMS_;
|
export default ImageWMS;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import _ol_source_ImageWMS_ from '../../../../src/ol/source/ImageWMS.js';
|
import ImageWMS from '../../../../src/ol/source/ImageWMS.js';
|
||||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||||
|
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('returns the expected image URL', function() {
|
it('returns the expected image URL', function() {
|
||||||
options.ratio = 1.5;
|
options.ratio = 1.5;
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection);
|
var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
var queryData = uri.searchParams;
|
var queryData = uri.searchParams;
|
||||||
@@ -44,7 +44,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
it('uses correct WIDTH and HEIGHT for HiDPI devices', function() {
|
it('uses correct WIDTH and HEIGHT for HiDPI devices', function() {
|
||||||
pixelRatio = 2;
|
pixelRatio = 2;
|
||||||
options.serverType = 'geoserver';
|
options.serverType = 'geoserver';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
var queryData = uri.searchParams;
|
var queryData = uri.searchParams;
|
||||||
@@ -56,7 +56,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('requests integer WIDTH and HEIGHT', function() {
|
it('requests integer WIDTH and HEIGHT', function() {
|
||||||
options.ratio = 1.5;
|
options.ratio = 1.5;
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection);
|
var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
var queryData = uri.searchParams;
|
var queryData = uri.searchParams;
|
||||||
@@ -67,7 +67,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('sets WIDTH and HEIGHT to match the aspect ratio of BBOX', function() {
|
it('sets WIDTH and HEIGHT to match the aspect ratio of BBOX', function() {
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
expect(uri.protocol).to.be('http:');
|
expect(uri.protocol).to.be('http:');
|
||||||
@@ -91,7 +91,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('sets the SRS query value instead of CRS if version < 1.3', function() {
|
it('sets the SRS query value instead of CRS if version < 1.3', function() {
|
||||||
options.params.VERSION = '1.2';
|
options.params.VERSION = '1.2';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
var queryData = uri.searchParams;
|
var queryData = uri.searchParams;
|
||||||
@@ -102,7 +102,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
it('allows various parameters to be overridden', function() {
|
it('allows various parameters to be overridden', function() {
|
||||||
options.params.FORMAT = 'image/jpeg';
|
options.params.FORMAT = 'image/jpeg';
|
||||||
options.params.TRANSPARENT = false;
|
options.params.TRANSPARENT = false;
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
var queryData = uri.searchParams;
|
var queryData = uri.searchParams;
|
||||||
@@ -112,7 +112,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('does not add a STYLES= option if one is specified', function() {
|
it('does not add a STYLES= option if one is specified', function() {
|
||||||
options.params.STYLES = 'foo';
|
options.params.STYLES = 'foo';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
var queryData = uri.searchParams;
|
var queryData = uri.searchParams;
|
||||||
@@ -120,7 +120,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('changes the BBOX order for EN axis orientations', function() {
|
it('changes the BBOX order for EN axis orientations', function() {
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
projection = getProjection('CRS:84');
|
projection = getProjection('CRS:84');
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
@@ -130,7 +130,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('uses EN BBOX order if version < 1.3', function() {
|
it('uses EN BBOX order if version < 1.3', function() {
|
||||||
options.params.VERSION = '1.1.0';
|
options.params.VERSION = '1.1.0';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image =
|
var image =
|
||||||
source.getImage(extent, resolution, pixelRatio, projection);
|
source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
@@ -140,7 +140,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('sets MAP_RESOLUTION when the server is MapServer', function() {
|
it('sets MAP_RESOLUTION when the server is MapServer', function() {
|
||||||
options.serverType = 'mapserver';
|
options.serverType = 'mapserver';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
pixelRatio = 2;
|
pixelRatio = 2;
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
@@ -150,7 +150,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
|
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
|
||||||
options.serverType = 'geoserver';
|
options.serverType = 'geoserver';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
pixelRatio = 2;
|
pixelRatio = 2;
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
@@ -160,7 +160,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('extends FORMAT_OPTIONS if it is already present', function() {
|
it('extends FORMAT_OPTIONS if it is already present', function() {
|
||||||
options.serverType = 'geoserver';
|
options.serverType = 'geoserver';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
options.params.FORMAT_OPTIONS = 'param1:value1';
|
options.params.FORMAT_OPTIONS = 'param1:value1';
|
||||||
pixelRatio = 2;
|
pixelRatio = 2;
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
@@ -172,7 +172,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
|
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
|
||||||
function() {
|
function() {
|
||||||
options.serverType = 'geoserver';
|
options.serverType = 'geoserver';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
pixelRatio = 1.325;
|
pixelRatio = 1.325;
|
||||||
var image =
|
var image =
|
||||||
source.getImage(extent, resolution, pixelRatio, projection);
|
source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
@@ -183,7 +183,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('sets DPI when the server is QGIS', function() {
|
it('sets DPI when the server is QGIS', function() {
|
||||||
options.serverType = 'qgis';
|
options.serverType = 'qgis';
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
pixelRatio = 2;
|
pixelRatio = 2;
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var uri = new URL(image.src_);
|
var uri = new URL(image.src_);
|
||||||
@@ -194,7 +194,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
it('creates an image with a custom imageLoadFunction', function() {
|
it('creates an image with a custom imageLoadFunction', function() {
|
||||||
var imageLoadFunction = sinon.spy();
|
var imageLoadFunction = sinon.spy();
|
||||||
options.imageLoadFunction = imageLoadFunction;
|
options.imageLoadFunction = imageLoadFunction;
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
var image = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
image.load();
|
image.load();
|
||||||
expect(imageLoadFunction).to.be.called();
|
expect(imageLoadFunction).to.be.called();
|
||||||
@@ -203,7 +203,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('returns same image for consecutive calls with same args', function() {
|
it('returns same image for consecutive calls with same args', function() {
|
||||||
var extent = [10.01, 20, 30.01, 40];
|
var extent = [10.01, 20, 30.01, 40];
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var image1 = source.getImage(extent, resolution, pixelRatio, projection);
|
var image1 = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
var image2 = source.getImage(extent, resolution, pixelRatio, projection);
|
var image2 = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
expect(image1).to.equal(image2);
|
expect(image1).to.equal(image2);
|
||||||
@@ -211,7 +211,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('returns same image for calls with similar extents', function() {
|
it('returns same image for calls with similar extents', function() {
|
||||||
options.ratio = 1.5;
|
options.ratio = 1.5;
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var extent = [10.01, 20, 30.01, 40];
|
var extent = [10.01, 20, 30.01, 40];
|
||||||
var image1 = source.getImage(extent, resolution, pixelRatio, projection);
|
var image1 = source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
extent = [10.01, 20.1, 30.01, 40.1];
|
extent = [10.01, 20.1, 30.01, 40.1];
|
||||||
@@ -221,7 +221,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
|
|
||||||
it('calculates correct image size with ratio', function() {
|
it('calculates correct image size with ratio', function() {
|
||||||
options.ratio = 1.5;
|
options.ratio = 1.5;
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var extent = [10, 5, 30, 45];
|
var extent = [10, 5, 30, 45];
|
||||||
source.getImage(extent, resolution, pixelRatio, projection);
|
source.getImage(extent, resolution, pixelRatio, projection);
|
||||||
expect(source.imageSize_).to.eql([300, 600]);
|
expect(source.imageSize_).to.eql([300, 600]);
|
||||||
@@ -232,7 +232,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
describe('#getGetFeatureInfoUrl', function() {
|
describe('#getGetFeatureInfoUrl', function() {
|
||||||
|
|
||||||
it('returns the expected GetFeatureInfo URL', function() {
|
it('returns the expected GetFeatureInfo URL', function() {
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var url = source.getGetFeatureInfoUrl(
|
var url = source.getGetFeatureInfoUrl(
|
||||||
[20, 30], resolution, projection,
|
[20, 30], resolution, projection,
|
||||||
{INFO_FORMAT: 'text/plain'});
|
{INFO_FORMAT: 'text/plain'});
|
||||||
@@ -260,7 +260,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('returns the expected GetFeatureInfo URL when source\'s projection is different from the parameter', function() {
|
it('returns the expected GetFeatureInfo URL when source\'s projection is different from the parameter', function() {
|
||||||
var source = new _ol_source_ImageWMS_(optionsReproj);
|
var source = new ImageWMS(optionsReproj);
|
||||||
var url = source.getGetFeatureInfoUrl(
|
var url = source.getGetFeatureInfoUrl(
|
||||||
[20, 30], resolution, projection,
|
[20, 30], resolution, projection,
|
||||||
{INFO_FORMAT: 'text/plain'});
|
{INFO_FORMAT: 'text/plain'});
|
||||||
@@ -288,7 +288,7 @@ describe('ol.source.ImageWMS', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('sets the QUERY_LAYERS param as expected', function() {
|
it('sets the QUERY_LAYERS param as expected', function() {
|
||||||
var source = new _ol_source_ImageWMS_(options);
|
var source = new ImageWMS(options);
|
||||||
var url = source.getGetFeatureInfoUrl(
|
var url = source.getGetFeatureInfoUrl(
|
||||||
[20, 30], resolution, projection,
|
[20, 30], resolution, projection,
|
||||||
{INFO_FORMAT: 'text/plain', QUERY_LAYERS: 'foo,bar'});
|
{INFO_FORMAT: 'text/plain', QUERY_LAYERS: 'foo,bar'});
|
||||||
|
|||||||
Reference in New Issue
Block a user