Skip to content

Commit

Permalink
feat: configurable transparent parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mholthausen committed Jun 30, 2022
1 parent 8e2d56b commit 66a97d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/model/Layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export interface DefaultLayerSourceConfig {
tileOrigin?: [number, number];
resolutions?: number[];
attribution?: string;
transparent?: boolean;
}

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

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

const {
Expand All @@ -264,7 +266,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
projection,
params: {
'LAYERS': layerNames,
'TRANSPARENT': true
'TRANSPARENT': transparent !== undefined ? transparent : true
},
crossOrigin,
tileLoadFunction: this.bearerTokenLoadFunction
Expand Down Expand Up @@ -394,6 +396,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);
}

private async bearerTokenLoadFunctionVector(opts: {
Expand Down

0 comments on commit 66a97d8

Please sign in to comment.