Skip to content

Commit

Permalink
fix: move transparent param to requestParam map
Browse files Browse the repository at this point in the history
  • Loading branch information
mholthausen committed Jun 30, 2022
1 parent 041fae9 commit f9d18f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/model/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { FeatureCollection } from 'geojson';
import BaseEntity, { BaseEntityArgs } from './BaseEntity';
import LayerType from './enum/LayerType';

export interface DefaultRequestParams {
transparent?: boolean;
}

export interface DefaultLayerSourceConfig {
url: string;
layerNames: string;
Expand All @@ -10,7 +14,7 @@ export interface DefaultLayerSourceConfig {
tileOrigin?: [number, number];
resolutions?: number[];
attribution?: string;
transparent?: boolean;
requestParams?: DefaultRequestParams;
}

export interface DefaultLayerPropertyConfig {
Expand Down
16 changes: 11 additions & 5 deletions src/parser/SHOGunApplicationUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
attribution,
url,
layerNames,
transparent
requestParams
} = layer.sourceConfig || {};

const {
Expand All @@ -216,7 +216,10 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
attributions: attribution,
params: {
'LAYERS': layerNames,
'TRANSPARENT': transparent !== undefined ? transparent : true
'TRANSPARENT':
requestParams?.transparent !== undefined
? requestParams?.transparent
: true
},
crossOrigin,
imageLoadFunction: this.bearerTokenLoadFunction
Expand All @@ -241,7 +244,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
tileSize = 256,
tileOrigin,
resolutions,
transparent
requestParams
} = layer.sourceConfig || {};

const {
Expand All @@ -266,7 +269,10 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
projection,
params: {
'LAYERS': layerNames,
'TRANSPARENT': transparent !== undefined ? transparent : true
'TRANSPARENT':
requestParams?.transparent !== undefined
? requestParams?.transparent
: true
},
crossOrigin,
tileLoadFunction: this.bearerTokenLoadFunction
Expand Down Expand Up @@ -396,7 +402,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
olLayer.set('propertyConfig', layer.clientConfig?.propertyConfig);
olLayer.set('legendUrl', layer.sourceConfig.legendUrl);
olLayer.set('hoverable', layer.clientConfig?.hoverable);
olLayer.set('transparent', layer.sourceConfig?.transparent);
olLayer.set('transparent', layer.sourceConfig?.requestParams?.transparent);
}

private async bearerTokenLoadFunctionVector(opts: {
Expand Down

0 comments on commit f9d18f8

Please sign in to comment.