Skip to content

Commit

Permalink
refacto(source): deprecate source.heightMapWidth for source.width
Browse files Browse the repository at this point in the history
  • Loading branch information
zarov committed Dec 14, 2018
1 parent caf22c2 commit ca920c6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/cubic_planar.html
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
version: '1.3.0',
name: 'MNT2012_Altitude_10m_CC46',
projection: 'EPSG:3946',
heightMapWidth: 256,
width: 256,
format: 'image/jpeg',
url: 'https://download.data.grandlyon.com/wms/grandlyon',
});
Expand Down
2 changes: 1 addition & 1 deletion examples/layers/JSONLayers/Region.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"transparent" : true,
"featureInfoMimeType" : "",
"dateTime" : "",
"heightMapWidth" : 256,
"width" : 256,
"waterMask" : false,
"updateStrategy": {
"type": 0,
Expand Down
2 changes: 1 addition & 1 deletion examples/planar.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
url: 'https://download.data.grandlyon.com/wms/grandlyon',
name: 'MNT2012_Altitude_10m_CC46',
projection: 'EPSG:3946',
heightMapWidth: 256,
width: 256,
format: 'image/jpeg',
});

Expand Down
2 changes: 1 addition & 1 deletion examples/planar_vector.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
url: 'https://download.data.grandlyon.com/wms/grandlyon',
name: 'MNT2012_Altitude_10m_CC46',
projection: 'EPSG:3946',
heightMapWidth: 256,
width: 256,
format: 'image/jpeg',
});

Expand Down
18 changes: 14 additions & 4 deletions src/Source/WMSSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import URLBuilder from 'Provider/URLBuilder';
* Default value is '1.3.0'.
* @property {string} style - The style to query on the WMS server. Default
* value is 'normal'.
* @property {number} heightMapWidth - The size of the image to fetch, in pixel.
* Default value is 256.
* @property {number} width - The width of the image to fetch, in pixel.
* Default value is the height if set or 256.
* @property {number} height - The height of the image to fetch, in pixel.
* Default value is the width if set or 256.
* @property {string} axisOrder - The order of the axis, that helps building the
* BBOX to put in the url requesting a resource. Default value is 'wsen', other
* value can be 'swne'.
Expand Down Expand Up @@ -84,7 +86,15 @@ class WMSSource extends Source {
this.zoom = source.zoom || { min: 0, max: 21 };
this.format = this.format || 'image/png';
this.style = source.style || '';
this.width = source.heightMapWidth || 256;

// TODO: remove in 2.7.0
if (source.heightMapWidth) {
console.warn('source.heightMapWidth is deprecated, please use source.width instead.');
source.width = source.width || source.heightMapWidth;
}

this.width = source.width || source.height || 256;
this.height = source.height || source.width || 256;
this.version = source.version || '1.3.0';
this.transparent = source.transparent || false;

Expand All @@ -109,7 +119,7 @@ class WMSSource extends Source {
this.format}&TRANSPARENT=${
this.transparent}&BBOX=%bbox&${
crsPropName}=${
this.projection}&WIDTH=${this.width}&HEIGHT=${this.width}`;
this.projection}&WIDTH=${this.width}&HEIGHT=${this.height}`;
}

urlFromExtent(extent) {
Expand Down

0 comments on commit ca920c6

Please sign in to comment.