diff --git a/projects/hslayers/src/assets/locales/cs.json b/projects/hslayers/src/assets/locales/cs.json index 9f83a96643..e13692231d 100644 --- a/projects/hslayers/src/assets/locales/cs.json +++ b/projects/hslayers/src/assets/locales/cs.json @@ -314,7 +314,9 @@ "on": "zapnuto", "off": "vypnuto", "Tile": "Dlaždice", - "done": "Hotovo" + "done": "Hotovo", + "group": "skupina", + "separateLayers": "samostatné vrstvy" }, "COMPOSITIONS": { "addByAddress": "Přidat kompozici z adresy", @@ -1033,4 +1035,4 @@ "waypointLayer": "Vrstva s body trasy", "waypoints": "Body trasy" } -} +} \ No newline at end of file diff --git a/projects/hslayers/src/assets/locales/en.json b/projects/hslayers/src/assets/locales/en.json index f79390c324..90a54218ed 100644 --- a/projects/hslayers/src/assets/locales/en.json +++ b/projects/hslayers/src/assets/locales/en.json @@ -314,7 +314,9 @@ "on": "on", "off": "off", "Tile": "Tile", - "done": "Done" + "done": "Done", + "group": "group", + "separateLayers": "separate layers" }, "COMPOSITIONS": { "addByAddress": "Add composition by address", @@ -1033,4 +1035,4 @@ "waypointLayer": "Waypoint layer", "waypoints": "Waypoints" } -} +} \ No newline at end of file diff --git a/projects/hslayers/src/assets/locales/sk.json b/projects/hslayers/src/assets/locales/sk.json index ae0b1742d2..69ff2fa3db 100644 --- a/projects/hslayers/src/assets/locales/sk.json +++ b/projects/hslayers/src/assets/locales/sk.json @@ -314,7 +314,9 @@ "on": "zapnuté", "off": "vypnuté", "Tile": "Dlaždica", - "done": "Hotovo" + "done": "Hotovo", + "group": "skupina", + "separateLayers": "samostatné vrstvy" }, "COMPOSITIONS": { "addByAddress": "Pridať kompozíciu z adresy", @@ -1033,4 +1035,4 @@ "top": "Hore", "us inch": "Palec (US)" } -} +} \ No newline at end of file diff --git a/projects/hslayers/src/components/add-data/common/common.service.ts b/projects/hslayers/src/components/add-data/common/common.service.ts index 07820667fa..01ba90c9f1 100644 --- a/projects/hslayers/src/components/add-data/common/common.service.ts +++ b/projects/hslayers/src/components/add-data/common/common.service.ts @@ -124,20 +124,23 @@ export class HsAddDataCommonService { } /** - * Constructs body of LAYER parameter for getMap request + * Constructs body of LAYER parameter for getMap request for grouped layer e.g. + * for a basemap or thematic layer with property group set to true * @param layerOrLayers - layer object or layers received from capabilities. If no layer is provided * merge all checked layer ids into one string * @param property - layer property - * @returns */ - createBasemapName(layerOrLayers: any | Array, property: string): string { + getGroupedLayerNames( + layerOrLayers: any | Array, + property: string, + ): string { const baseNameParts = []; if (Array.isArray(layerOrLayers)) { for (const layer of layerOrLayers) { if (layer.checked) { baseNameParts.push(layer[property]); } else if (layer.Layer) { - const nested = this.createBasemapName(layer.Layer, property); + const nested = this.getGroupedLayerNames(layer.Layer, property); nested.length > 0 ? baseNameParts.push(nested) : null; } } diff --git a/projects/hslayers/src/components/add-data/common/url/details/details.component.html b/projects/hslayers/src/components/add-data/common/url/details/details.component.html index 13408ba1c1..92c1ce5acc 100644 --- a/projects/hslayers/src/components/add-data/common/url/details/details.component.html +++ b/projects/hslayers/src/components/add-data/common/url/details/details.component.html @@ -1,27 +1,40 @@
-
{{'COMMON.title' | translateHs }}
-
- {{'COMMON.addAs' | translateHs }} -
- - +
+ {{'COMMON.addAs' | translateHs }} +
+
+ + +
+
+ + +
+
- @@ -92,7 +105,6 @@ -
diff --git a/projects/hslayers/src/components/add-data/common/url/details/details.component.ts b/projects/hslayers/src/components/add-data/common/url/details/details.component.ts index c1097cdb2b..7ca07c4b68 100644 --- a/projects/hslayers/src/components/add-data/common/url/details/details.component.ts +++ b/projects/hslayers/src/components/add-data/common/url/details/details.component.ts @@ -7,6 +7,11 @@ import {HsUrlTypeServiceModel} from '../../../url/models/url-type-service.model' @Component({ selector: 'hs-url-details', templateUrl: './details.component.html', + styles: ` + .hs-add-url-wms-addas button{ + min-width: 5rem + } +`, }) export class HsUrlDetailsComponent implements AfterContentInit { @Input() injectedService: HsUrlTypeServiceModel; @@ -18,6 +23,9 @@ export class HsUrlDetailsComponent implements AfterContentInit { constructor(public hsAddDataCommonService: HsAddDataCommonService) {} ngAfterContentInit(): void { this.data = this.injectedService.data; + if (this.type == 'wms') { + this.data.group = true; + } this.getDimensionValues = this.hsAddDataCommonService.getDimensionValues; } @@ -26,4 +34,9 @@ export class HsUrlDetailsComponent implements AfterContentInit { this.data.srs, ); } + + setBase(state: boolean) { + this.data.base = state; + this.data.group = state || this.data.group; + } } diff --git a/projects/hslayers/src/components/add-data/url/types/data-object.type.ts b/projects/hslayers/src/components/add-data/url/types/data-object.type.ts index dab2c376d3..51cabd2c6e 100644 --- a/projects/hslayers/src/components/add-data/url/types/data-object.type.ts +++ b/projects/hslayers/src/components/add-data/url/types/data-object.type.ts @@ -5,6 +5,11 @@ export type UrlDataObject = { add_all?: boolean; add_under?: Layer; base?: boolean; + /** + * Used with WMS to control whether each checked layer should be added as a separate layer + * or only one layer grouping all the checked + */ + group?: boolean; bbox?: string; caps?: any; description?: string; diff --git a/projects/hslayers/src/components/add-data/url/wms/wms.service.ts b/projects/hslayers/src/components/add-data/url/wms/wms.service.ts index 778b066897..4940d9534b 100644 --- a/projects/hslayers/src/components/add-data/url/wms/wms.service.ts +++ b/projects/hslayers/src/components/add-data/url/wms/wms.service.ts @@ -363,7 +363,7 @@ export class HsUrlWmsService implements HsUrlTypeServiceModel { this.data.visible = checkedOnly ? this.data.layers.filter((l) => l.checked === true).length <= 10 : false; - if (this.data.base) { + if (this.data.base || this.data.group) { const newLayer = this.getLayer( {}, { @@ -432,12 +432,13 @@ export class HsUrlWmsService implements HsUrlTypeServiceModel { attributions, projection: this.data.srs, params: { - LAYERS: this.data.base - ? this.hsAddDataCommonService.createBasemapName( - this.data.layers, - 'Name', - ) - : layer.Name, + LAYERS: + this.data.base || this.data.group + ? this.hsAddDataCommonService.getGroupedLayerNames( + this.data.layers, + 'Name', + ) + : layer.Name, INFO_FORMAT: layer.queryable ? options.queryFormat : undefined, FORMAT: options.imageFormat, VERSION: this.data.version, diff --git a/projects/hslayers/src/components/layermanager/layermanager-metadata.service.ts b/projects/hslayers/src/components/layermanager/layermanager-metadata.service.ts index 9acda8d8e3..7dc5c07a4f 100644 --- a/projects/hslayers/src/components/layermanager/layermanager-metadata.service.ts +++ b/projects/hslayers/src/components/layermanager/layermanager-metadata.service.ts @@ -332,7 +332,7 @@ export class HsLayerManagerMetadataService { * Helper used in to get usable extent from layers capabilities object */ private getCapsExtent(layerObj: any, layerCaps: HsWmsLayer): Extent { - // Extent of selected layer or service in case its missing + // Extent of selected layer or service in case it's missing let extent = (layerObj.EX_GeographicBoundingBox || layerObj.BoundingBox) ?? (layerCaps.EX_GeographicBoundingBox || layerCaps.BoundingBox);