Skip to content

Commit

Permalink
feat: optionally keep client config
Browse files Browse the repository at this point in the history
  • Loading branch information
hwbllmnn committed Jun 15, 2023
1 parent d50d8d4 commit 57731de
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/parser/SHOGunApplicationUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
return view;
}

async parseLayerTree(application: T, projection?: OlProjectionLike) {
async parseLayerTree(application: T, projection?: OlProjectionLike, keepClientConfig = false) {
const layerTree = application.layerTree;

if (!layerTree) {
Expand Down Expand Up @@ -135,7 +135,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
this.mergeApplicationLayerConfigs(layers, application);

if (layerTree.children) {
const nodes = await this.parseNodes(layerTree.children, layers, projection);
const nodes = await this.parseNodes(layerTree.children, layers, projection, keepClientConfig);

const tree = new OlLayerGroup({
layers: nodes.reverse(),
Expand Down Expand Up @@ -167,7 +167,7 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
return layerIds;
}

async parseNodes(nodes: DefaultLayerTree[], layers: S[], projection?: OlProjectionLike) {
async parseNodes(nodes: DefaultLayerTree[], layers: S[], projection?: OlProjectionLike, keepClientConfig = false) {
const collection: OlLayerBase[] = [];

for (const node of nodes) {
Expand All @@ -186,6 +186,9 @@ class SHOGunApplicationUtil<T extends Application, S extends Layer> {
if (node.title) {
olLayer.set('name', node.title);
}
if (keepClientConfig) {
olLayer.set('clientConfig', layerNode.clientConfig);
}
collection.push(olLayer);
}
}
Expand Down

0 comments on commit 57731de

Please sign in to comment.