Skip to content

Commit

Permalink
Fixes geosolutions-it#2703: openalayers WMTS layers ignore initial vi…
Browse files Browse the repository at this point in the history
…sibility
  • Loading branch information
mbarto committed Mar 6, 2018
1 parent 9043050 commit 6287c6f
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
50 changes: 50 additions & 0 deletions web/client/components/map/openlayers/__tests__/Layer-test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,56 @@ describe('Openlayers layer', () => {
expect(layer.layer.getSource().getParams()['ms2-authkey']).toBe("########-####-$$$$-####-###########");
});

it('test wmts initial visibility false', () => {
const options = {
type: 'wmts',
visibility: false,
name: 'nurc:Arc_Sample',
group: 'Meteo',
format: 'image/png',
tileMatrixSet: [
{
'TileMatrix': [],
'ows:Identifier': 'EPSG:900913',
'ows:SupportedCRS': 'urn:ogc:def:crs:EPSG::900913'
}
],
url: 'http://sample.server/geoserver/gwc/service/wmts'
};

const layer = ReactDOM.render(<OpenlayersLayer
type="wmts"
options={options}
map={map}
/>, document.getElementById("container"));
expect(layer.layer.getVisible()).toBe(false);
});

it('test wmts initial visibility true', () => {
const options = {
type: 'wmts',
visibility: true,
name: 'nurc:Arc_Sample',
group: 'Meteo',
format: 'image/png',
tileMatrixSet: [
{
'TileMatrix': [],
'ows:Identifier': 'EPSG:900913',
'ows:SupportedCRS': 'urn:ogc:def:crs:EPSG::900913'
}
],
url: 'http://sample.server/geoserver/gwc/service/wmts'
};

const layer = ReactDOM.render(<OpenlayersLayer
type="wmts"
options={options}
map={map}
/>, document.getElementById("container"));
expect(layer.layer.getVisible()).toBe(true);
});

it('test wmts security token', () => {
const options = {
type: 'wmts',
Expand Down
1 change: 1 addition & 0 deletions web/client/components/map/openlayers/plugins/WMTSLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const createLayer = options => {
opacity: options.opacity !== undefined ? options.opacity : 1,
zIndex: options.zIndex,
extent: extent,
visible: options.visibility !== false,
source: new ol.source.WMTS(assign({
urls: urls.map(u => u + queryParametersString),
layer: options.name,
Expand Down

0 comments on commit 6287c6f

Please sign in to comment.