From 7c7fb625d0e1eb64b8b7e671cc93d84ffda64e28 Mon Sep 17 00:00:00 2001 From: Landry Breuil Date: Tue, 3 Oct 2023 13:54:24 +0200 Subject: [PATCH] add support to open OGC:COG links in the external viewer --- .../metadataactions/RelatedResourcesService.js | 11 ++++++++++- web-ui/src/main/resources/catalog/js/CatController.js | 1 + web-ui/src/main/resources/catalog/style/gn_icons.less | 1 + .../main/resources/catalog/views/default/module.js | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js b/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js index 888176dabe9..19a1a71ad9e 100644 --- a/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js +++ b/web-ui/src/main/resources/catalog/components/metadataactions/RelatedResourcesService.js @@ -79,7 +79,7 @@ return r.mimeType; } else if (r.protocol && r.protocol.indexOf("WWW:DOWNLOAD:") >= 0) { return r.protocol.replace("WWW:DOWNLOAD:", ""); - } else if (mainType.match(/W([MCF]|MT)S.*|3DTILES|ESRI:REST/) != null) { + } else if (mainType.match(/W([MCF]|MT)S.*|3DTILES|COG|ESRI:REST/) != null) { return mainType.replace("SERVICE", ""); } else if (mainType.match(/KML|GPX/) != null) { return mainType; @@ -128,6 +128,8 @@ gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap; var add3dTilesToMap = gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap; + var addCogeoToMap = + gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap; var addEsriRestToMap = gnViewerSettings.resultviewFns && gnViewerSettings.resultviewFns.addMdLayerToMap; @@ -286,6 +288,11 @@ label: "addToMap", action: add3dTilesToMap }, + COG: { + iconClass: "fa-globe", + label: "addToMap", + action: addCogeoToMap + }, TMS: { iconClass: "fa-globe", label: "addToMap", @@ -517,6 +524,8 @@ return "WMTS"; } else if (protocolOrType.match(/3dtiles/i)) { return "3DTILES"; + } else if (protocolOrType.match(/cog/i)) { + return "COG"; } else if (protocolOrType.match(/tms/i)) { return "TMS"; } else if (protocolOrType.match(/wfs/i)) { diff --git a/web-ui/src/main/resources/catalog/js/CatController.js b/web-ui/src/main/resources/catalog/js/CatController.js index fa8ac889a80..418509c2eb0 100644 --- a/web-ui/src/main/resources/catalog/js/CatController.js +++ b/web-ui/src/main/resources/catalog/js/CatController.js @@ -1311,6 +1311,7 @@ layers: [ "OGC:WMS", "OGC:3DTILES", + "OGC:COG", "OGC:WMTS", "OGC:WMS-1.1.1-http-get-map", "OGC:WMS-1.3.0-http-get-map", diff --git a/web-ui/src/main/resources/catalog/style/gn_icons.less b/web-ui/src/main/resources/catalog/style/gn_icons.less index a254a3dcf5c..9425c45040f 100644 --- a/web-ui/src/main/resources/catalog/style/gn_icons.less +++ b/web-ui/src/main/resources/catalog/style/gn_icons.less @@ -295,6 +295,7 @@ .gn-icontype-wcs, .gn-icontype-atom, .gn-icontype-3dtiles, +.gn-icontype-cog, .gn-icontype-esri-rest, .gn-icontype-wfs { background-color: @btn-success-bg !important; diff --git a/web-ui/src/main/resources/catalog/views/default/module.js b/web-ui/src/main/resources/catalog/views/default/module.js index 43c3fefb526..c11ddb8184b 100644 --- a/web-ui/src/main/resources/catalog/views/default/module.js +++ b/web-ui/src/main/resources/catalog/views/default/module.js @@ -362,6 +362,8 @@ ? "esrirest" : link.protocol == "OGC:3DTILES" ? "3dtiles" + : link.protocol == "OGC:COG" + ? "cog" : "wms", url: $filter("gnLocalized")(link.url) || link.url };