@itwin/core-frontend 5.15.0 → 5.16.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts +5 -2
  3. package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
  4. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js +6 -0
  5. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  6. package/lib/cjs/core-frontend.d.ts +1 -1
  7. package/lib/cjs/core-frontend.d.ts.map +1 -1
  8. package/lib/cjs/core-frontend.js +3 -2
  9. package/lib/cjs/core-frontend.js.map +1 -1
  10. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.d.ts +2 -0
  11. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.d.ts.map +1 -1
  12. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.js +13 -4
  13. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.js.map +1 -1
  14. package/lib/cjs/internal/cross-package.d.ts +1 -1
  15. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  16. package/lib/cjs/internal/cross-package.js +4 -1
  17. package/lib/cjs/internal/cross-package.js.map +1 -1
  18. package/lib/cjs/internal/tile/RealityTileLoader.d.ts +1 -1
  19. package/lib/cjs/internal/tile/RealityTileLoader.d.ts.map +1 -1
  20. package/lib/cjs/internal/tile/RealityTileLoader.js +5 -3
  21. package/lib/cjs/internal/tile/RealityTileLoader.js.map +1 -1
  22. package/lib/cjs/internal/tile/map/ArcGisUtilities.d.ts +15 -2
  23. package/lib/cjs/internal/tile/map/ArcGisUtilities.d.ts.map +1 -1
  24. package/lib/cjs/internal/tile/map/ArcGisUtilities.js +54 -29
  25. package/lib/cjs/internal/tile/map/ArcGisUtilities.js.map +1 -1
  26. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts +14 -0
  27. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  28. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js +91 -45
  29. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  30. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  31. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +5 -4
  32. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  33. package/lib/cjs/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
  34. package/lib/cjs/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +8 -2
  35. package/lib/cjs/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
  36. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  37. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +8 -2
  38. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  39. package/lib/cjs/internal/tile/map/MapLayerFetch.d.ts +57 -0
  40. package/lib/cjs/internal/tile/map/MapLayerFetch.d.ts.map +1 -0
  41. package/lib/cjs/internal/tile/map/MapLayerFetch.js +95 -0
  42. package/lib/cjs/internal/tile/map/MapLayerFetch.js.map +1 -0
  43. package/lib/cjs/internal/tile/map/UrlUtils.js +1 -1
  44. package/lib/cjs/internal/tile/map/UrlUtils.js.map +1 -1
  45. package/lib/cjs/internal/tile/map/WmsCapabilities.d.ts +2 -5
  46. package/lib/cjs/internal/tile/map/WmsCapabilities.d.ts.map +1 -1
  47. package/lib/cjs/internal/tile/map/WmsCapabilities.js +16 -9
  48. package/lib/cjs/internal/tile/map/WmsCapabilities.js.map +1 -1
  49. package/lib/cjs/internal/tile/map/WmsUtilities.d.ts +29 -1
  50. package/lib/cjs/internal/tile/map/WmsUtilities.d.ts.map +1 -1
  51. package/lib/cjs/internal/tile/map/WmsUtilities.js +43 -11
  52. package/lib/cjs/internal/tile/map/WmsUtilities.js.map +1 -1
  53. package/lib/cjs/internal/tile/map/WmtsCapabilities.d.ts +2 -5
  54. package/lib/cjs/internal/tile/map/WmtsCapabilities.d.ts.map +1 -1
  55. package/lib/cjs/internal/tile/map/WmtsCapabilities.js +16 -9
  56. package/lib/cjs/internal/tile/map/WmtsCapabilities.js.map +1 -1
  57. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  58. package/lib/cjs/tile/GltfReader.js +3 -1
  59. package/lib/cjs/tile/GltfReader.js.map +1 -1
  60. package/lib/cjs/tile/internal.d.ts +2 -0
  61. package/lib/cjs/tile/internal.d.ts.map +1 -1
  62. package/lib/cjs/tile/internal.js +2 -0
  63. package/lib/cjs/tile/internal.js.map +1 -1
  64. package/lib/cjs/tile/map/MapLayerFetchHandler.d.ts +94 -0
  65. package/lib/cjs/tile/map/MapLayerFetchHandler.d.ts.map +1 -0
  66. package/lib/cjs/tile/map/MapLayerFetchHandler.js +10 -0
  67. package/lib/cjs/tile/map/MapLayerFetchHandler.js.map +1 -0
  68. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +27 -1
  69. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  70. package/lib/cjs/tile/map/MapLayerFormatRegistry.js +42 -1
  71. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  72. package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
  73. package/lib/cjs/tile/map/MapLayerImageryFormats.js +20 -4
  74. package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
  75. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +28 -16
  76. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  77. package/lib/cjs/tile/map/MapLayerImageryProvider.js +134 -66
  78. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  79. package/lib/cjs/tile/map/MapLayerSources.d.ts +19 -4
  80. package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
  81. package/lib/cjs/tile/map/MapLayerSources.js +28 -11
  82. package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
  83. package/lib/cjs/tools/ToolAdmin.d.ts +11 -4
  84. package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
  85. package/lib/cjs/tools/ToolAdmin.js +28 -3
  86. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  87. package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts +5 -2
  88. package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
  89. package/lib/esm/RealityDataSourceTilesetUrlImpl.js +6 -0
  90. package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  91. package/lib/esm/core-frontend.d.ts +1 -1
  92. package/lib/esm/core-frontend.d.ts.map +1 -1
  93. package/lib/esm/core-frontend.js +1 -1
  94. package/lib/esm/core-frontend.js.map +1 -1
  95. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.d.ts +2 -0
  96. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.d.ts.map +1 -1
  97. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.js +13 -4
  98. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.js.map +1 -1
  99. package/lib/esm/internal/cross-package.d.ts +1 -1
  100. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  101. package/lib/esm/internal/cross-package.js +1 -1
  102. package/lib/esm/internal/cross-package.js.map +1 -1
  103. package/lib/esm/internal/tile/RealityTileLoader.d.ts +1 -1
  104. package/lib/esm/internal/tile/RealityTileLoader.d.ts.map +1 -1
  105. package/lib/esm/internal/tile/RealityTileLoader.js +5 -3
  106. package/lib/esm/internal/tile/RealityTileLoader.js.map +1 -1
  107. package/lib/esm/internal/tile/map/ArcGisUtilities.d.ts +15 -2
  108. package/lib/esm/internal/tile/map/ArcGisUtilities.d.ts.map +1 -1
  109. package/lib/esm/internal/tile/map/ArcGisUtilities.js +55 -30
  110. package/lib/esm/internal/tile/map/ArcGisUtilities.js.map +1 -1
  111. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts +14 -0
  112. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  113. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js +92 -46
  114. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  115. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  116. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +5 -4
  117. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  118. package/lib/esm/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
  119. package/lib/esm/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +9 -3
  120. package/lib/esm/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
  121. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  122. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +9 -3
  123. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  124. package/lib/esm/internal/tile/map/MapLayerFetch.d.ts +57 -0
  125. package/lib/esm/internal/tile/map/MapLayerFetch.d.ts.map +1 -0
  126. package/lib/esm/internal/tile/map/MapLayerFetch.js +91 -0
  127. package/lib/esm/internal/tile/map/MapLayerFetch.js.map +1 -0
  128. package/lib/esm/internal/tile/map/UrlUtils.js +1 -1
  129. package/lib/esm/internal/tile/map/UrlUtils.js.map +1 -1
  130. package/lib/esm/internal/tile/map/WmsCapabilities.d.ts +2 -5
  131. package/lib/esm/internal/tile/map/WmsCapabilities.d.ts.map +1 -1
  132. package/lib/esm/internal/tile/map/WmsCapabilities.js +16 -9
  133. package/lib/esm/internal/tile/map/WmsCapabilities.js.map +1 -1
  134. package/lib/esm/internal/tile/map/WmsUtilities.d.ts +29 -1
  135. package/lib/esm/internal/tile/map/WmsUtilities.d.ts.map +1 -1
  136. package/lib/esm/internal/tile/map/WmsUtilities.js +44 -12
  137. package/lib/esm/internal/tile/map/WmsUtilities.js.map +1 -1
  138. package/lib/esm/internal/tile/map/WmtsCapabilities.d.ts +2 -5
  139. package/lib/esm/internal/tile/map/WmtsCapabilities.d.ts.map +1 -1
  140. package/lib/esm/internal/tile/map/WmtsCapabilities.js +16 -9
  141. package/lib/esm/internal/tile/map/WmtsCapabilities.js.map +1 -1
  142. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  143. package/lib/esm/tile/GltfReader.js +3 -1
  144. package/lib/esm/tile/GltfReader.js.map +1 -1
  145. package/lib/esm/tile/internal.d.ts +2 -0
  146. package/lib/esm/tile/internal.d.ts.map +1 -1
  147. package/lib/esm/tile/internal.js +2 -0
  148. package/lib/esm/tile/internal.js.map +1 -1
  149. package/lib/esm/tile/map/MapLayerFetchHandler.d.ts +94 -0
  150. package/lib/esm/tile/map/MapLayerFetchHandler.d.ts.map +1 -0
  151. package/lib/esm/tile/map/MapLayerFetchHandler.js +9 -0
  152. package/lib/esm/tile/map/MapLayerFetchHandler.js.map +1 -0
  153. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +27 -1
  154. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  155. package/lib/esm/tile/map/MapLayerFormatRegistry.js +40 -0
  156. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  157. package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
  158. package/lib/esm/tile/map/MapLayerImageryFormats.js +21 -5
  159. package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
  160. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +28 -16
  161. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  162. package/lib/esm/tile/map/MapLayerImageryProvider.js +136 -68
  163. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  164. package/lib/esm/tile/map/MapLayerSources.d.ts +19 -4
  165. package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
  166. package/lib/esm/tile/map/MapLayerSources.js +28 -11
  167. package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
  168. package/lib/esm/tools/ToolAdmin.d.ts +11 -4
  169. package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
  170. package/lib/esm/tools/ToolAdmin.js +30 -5
  171. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  172. package/package.json +21 -21
@@ -1 +1 @@
1
- {"version":3,"file":"WmsCapabilities.js","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmsCapabilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAIH,OAAO,GAAG,MAAM,kBAAkB,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzE,SAAS,kBAAkB,CAAC,IAAS;IACnC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACpI,CAAC;AAED,SAAS,aAAa,CAAC,IAAS;IAC9B,IAAI,SAAS,KAAK,IAAI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Ae,CAAC,aAAuB;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { RequestBasicCredentials } from \"../../../request/Request\";\r\nimport WMS from \"wms-capabilities\";\r\nimport { MapCartoRectangle, WmsUtilities } from \"../../../tile/internal\";\r\n\r\nfunction rangeFromJSONArray(json: any): MapCartoRectangle | undefined {\r\n return (Array.isArray(json) && json.length === 4) ? MapCartoRectangle.fromDegrees(json[0], json[1], json[2], json[3]) : undefined;\r\n}\r\n\r\nfunction rangeFromJSON(json: any): MapCartoRectangle | undefined {\r\n if (undefined !== json.LatLonBoundingBox)\r\n return rangeFromJSONArray(json.LatLonBoundingBox);\r\n else if (Array.isArray(json.EX_GeographicBoundingBox)) {\r\n return rangeFromJSONArray(json.EX_GeographicBoundingBox);\r\n } else {\r\n if (Array.isArray(json.BoundingBox))\r\n for (const boundingBox of json.BoundingBox) {\r\n if (boundingBox.crs === \"CRS:84\" || boundingBox.crs === \"EPSG:4326\") {\r\n return rangeFromJSONArray(boundingBox.extent);\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction initArray<T>(input: any): undefined | T[] {\r\n return Array.isArray(input) ? input.slice() : undefined;\r\n}\r\n\r\n/** Encapsulation of the capabilities for an WMS server\r\n */\r\nexport namespace WmsCapability {\r\n\r\n export class Service {\r\n public readonly name: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly onlineResource?: string;\r\n public readonly contactInformation?: string;\r\n public readonly accessConstraints?: string;\r\n\r\n constructor(json: any) {\r\n this.name = json.Name ? json.Name : \"\";\r\n this.title = json.Title;\r\n this.abstract = json.Abstract;\r\n this.onlineResource = json.OnlineResource;\r\n this.contactInformation = json.ContactInformation;\r\n this.accessConstraints = json.AccessConstraints;\r\n }\r\n }\r\n\r\n export class Layer {\r\n public readonly queryable: boolean;\r\n public readonly title?: string;\r\n public readonly srs?: string[];\r\n public readonly cartoRange?: MapCartoRectangle;\r\n public readonly subLayers = new Array<SubLayer>();\r\n private static readonly PREFIX_SEPARATOR = \":\";\r\n\r\n constructor(json: any, capabilities: WmsCapabilities) {\r\n this.queryable = json.queryable;\r\n this.title = json.title;\r\n this.srs = initArray<string>(capabilities.isVersion13 ? json.CRS : json.SRS);\r\n this.cartoRange = rangeFromJSON(json);\r\n this.subLayers.push(new SubLayer(json, capabilities));\r\n }\r\n public getSubLayers(visible = true): MapSubLayerProps[] {\r\n const subLayers = new Array<MapSubLayerProps>();\r\n let index = 1;\r\n let childrenFound = false;\r\n const pushSubLayer = ((subLayer: SubLayer, parent?: number) => {\r\n let children;\r\n const id = index++;\r\n if (subLayer.children) {\r\n childrenFound = false;\r\n children = new Array<number>();\r\n subLayer.children.forEach((child) => {\r\n children.push(index);\r\n pushSubLayer(child, id);\r\n });\r\n }\r\n subLayers.push({ name: subLayer.name, title: subLayer.title, visible, parent, children, id });\r\n });\r\n this.subLayers.forEach((subLayer) => pushSubLayer(subLayer));\r\n\r\n if (!childrenFound) {\r\n const prefixed = new Map<string, MapSubLayerProps[]>();\r\n subLayers.forEach((subLayer) => {\r\n if (subLayer.name && subLayer.name.indexOf(Layer.PREFIX_SEPARATOR) > 0) {\r\n const prefix = subLayer.name.slice(0, subLayer.name.indexOf(Layer.PREFIX_SEPARATOR));\r\n const found = prefixed.get(prefix);\r\n if (found)\r\n found.push(subLayer);\r\n else\r\n prefixed.set(prefix, [subLayer]);\r\n }\r\n });\r\n if (prefixed.size > 1) {\r\n // Preserve the root node if any.\r\n const rootNode = (this.subLayers.length === 1 && this.subLayers[0].children && this.subLayers[0].children.length > 1) ? subLayers.find((curSubLayer) => this.subLayers[0].name === curSubLayer.name)?.id : undefined;\r\n prefixed.forEach((children, parent) => {\r\n children.forEach((child) => {\r\n child.parent = index;\r\n // Remove the prefix from the title if present.\r\n if (child.title && child.title.indexOf(parent + Layer.PREFIX_SEPARATOR) === 0)\r\n child.title = child.title.slice(parent.length + Layer.PREFIX_SEPARATOR.length);\r\n });\r\n subLayers.push({ name: \"\", title: parent, parent: rootNode, id: index++, children: children.map((child) => child.id as number), visible });\r\n });\r\n }\r\n }\r\n\r\n return subLayers;\r\n }\r\n\r\n public getSubLayersCrs(layerNameFilter: string[]): Map<string, string[]> {\r\n const subLayerCrs = new Map<string, string[]>();\r\n\r\n const processSubLayer = ((subLayer: SubLayer) => {\r\n if (layerNameFilter.includes(subLayer.name)) {\r\n subLayerCrs.set(subLayer.name, subLayer.crs);\r\n }\r\n if (subLayer.children) {\r\n subLayer.children.forEach((child) => {\r\n processSubLayer(child);\r\n });\r\n }\r\n });\r\n\r\n this.subLayers.forEach((subLayer) => processSubLayer(subLayer));\r\n return subLayerCrs;\r\n }\r\n }\r\n\r\n export class SubLayer {\r\n public readonly name: string;\r\n public readonly title: string;\r\n public readonly crs: string[];\r\n public readonly ownCrs: string[]; // CRS specific to this layer (ie. not including inherited CRS)\r\n public readonly cartoRange?: MapCartoRectangle;\r\n public readonly children?: SubLayer[];\r\n public readonly queryable: boolean;\r\n public constructor(_json: any, capabilities: WmsCapabilities, public readonly parent?: SubLayer) {\r\n\r\n const getParentCrs = (parentLayer: SubLayer, crsSet: Set<string>) => {\r\n parentLayer.crs.forEach((parentCrs) => crsSet.add(parentCrs));\r\n if (parentLayer.parent) {\r\n getParentCrs(parentLayer.parent, crsSet);\r\n }\r\n };\r\n\r\n this.name = _json.Name ? _json.Name : \"\";\r\n this.title = _json.Title;\r\n this.queryable = _json.queryable ? true : false;\r\n this.cartoRange = rangeFromJSON(_json);\r\n this.ownCrs = initArray<string>(capabilities.isVersion13 ? _json.CRS : _json.SRS) ?? [];\r\n const crs = new Set<string>(this.ownCrs);\r\n if (parent) {\r\n getParentCrs(parent, crs);\r\n }\r\n this.crs = [...crs];\r\n\r\n if (Array.isArray(_json.Layer)) {\r\n this.children = new Array<SubLayer>();\r\n for (const childLayer of _json.Layer) {\r\n this.children.push(new SubLayer(childLayer, capabilities, this));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport class WmsCapabilities {\r\n private static _capabilitiesCache = new Map<string, WmsCapabilities | undefined>();\r\n public readonly service: WmsCapability.Service;\r\n public readonly version?: string;\r\n public readonly isVersion13: boolean;\r\n public readonly layer?: WmsCapability.Layer;\r\n public get json() { return this._json; }\r\n public get maxLevel(): number { return this.layer ? this.layer.subLayers.length : - 1; }\r\n public get cartoRange(): MapCartoRectangle | undefined { return this.layer?.cartoRange; }\r\n public get featureInfoSupported() { return undefined !== this._json.Capability?.Request?.GetFeatureInfo; }\r\n public get featureInfoFormats(): string[] | undefined { return Array.isArray(this._json.Capability?.Request?.GetFeatureInfo?.Format) ? this._json.Capability?.Request?.GetFeatureInfo?.Format : undefined; }\r\n constructor(private _json: any) {\r\n if (!_json || typeof _json !== \"object\" || (_json.Service === undefined && _json.Capability === undefined))\r\n throw new Error(\"Invalid WMS GetCapabilities response\");\r\n\r\n this.version = typeof _json.version === \"string\" ? _json.version : undefined;\r\n this.isVersion13 = this.version !== undefined && this.version.startsWith(\"1.3\");\r\n this.service = new WmsCapability.Service(_json.Service ?? {});\r\n if (_json.Capability?.Layer)\r\n this.layer = new WmsCapability.Layer(_json.Capability.Layer, this);\r\n }\r\n\r\n /** Parse a GetCapabilities XML response, returning undefined if it is not a valid WMS capabilities document. */\r\n private static tryParse(xmlCapabilities: string): WmsCapabilities | undefined {\r\n // Validate the document is actually rooted at a WMS capabilities element before parsing:\r\n // wms-capabilities happily parses any root and recognizes direct Service/Capability children.\r\n // WMS 1.3.0 uses WMS_Capabilities; WMS 1.0.0-1.1.1 uses WMT_MS_Capabilities.\r\n const doc = new DOMParser().parseFromString(xmlCapabilities, \"text/xml\");\r\n const rootName = doc.documentElement?.localName;\r\n if (rootName !== \"WMS_Capabilities\" && rootName !== \"WMT_MS_Capabilities\")\r\n return undefined; // Not a WMS GetCapabilities document\r\n if (doc.getElementsByTagName(\"parsererror\").length > 0)\r\n return undefined; // XML parse error (browsers embed a parsererror element)\r\n\r\n try {\r\n return new WmsCapabilities(new WMS(undefined, DOMParser).parse(xmlCapabilities));\r\n } catch {\r\n return undefined; // Degenerate capabilities document\r\n }\r\n }\r\n\r\n public static async create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean, queryParams?: {[key: string]: string}): Promise<WmsCapabilities | undefined> {\r\n if (!ignoreCache) {\r\n const cached = WmsCapabilities._capabilitiesCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n const tmpUrl = new URL(WmsUtilities.getBaseUrl(url));\r\n tmpUrl.searchParams.append(\"request\", \"GetCapabilities\");\r\n tmpUrl.searchParams.append(\"service\", \"WMS\");\r\n if (queryParams) {\r\n Object.keys(queryParams).forEach((paramKey) => {\r\n if (!tmpUrl.searchParams.has(paramKey))\r\n tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);\r\n });\r\n }\r\n const xmlCapabilities = await WmsUtilities.fetchXml(tmpUrl.toString(), credentials);\r\n\r\n if (!xmlCapabilities)\r\n return undefined;\r\n\r\n const capabilities = WmsCapabilities.tryParse(xmlCapabilities);\r\n if (capabilities === undefined)\r\n return undefined;\r\n\r\n if (!credentials) {\r\n // Avoid caching protected data\r\n WmsCapabilities._capabilitiesCache.set(url, capabilities);\r\n }\r\n\r\n return capabilities;\r\n }\r\n public getSubLayers(visible = true): undefined | MapSubLayerProps[] {\r\n return this.layer ? this.layer.getSubLayers(visible) : undefined;\r\n }\r\n\r\n public getSubLayersCrs(subLayerNames: string[]): Map<string, string[]> | undefined {\r\n return this.layer ? this.layer.getSubLayersCrs(subLayerN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,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport WMS from \"wms-capabilities\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { MapCartoRectangle, WmsCapabilitiesCreateOptions, WmsUtilities } from \"../../../tile/internal\";\r\n\r\nfunction rangeFromJSONArray(json: any): MapCartoRectangle | undefined {\r\n return (Array.isArray(json) && json.length === 4) ? MapCartoRectangle.fromDegrees(json[0], json[1], json[2], json[3]) : undefined;\r\n}\r\n\r\nfunction rangeFromJSON(json: any): MapCartoRectangle | undefined {\r\n if (undefined !== json.LatLonBoundingBox)\r\n return rangeFromJSONArray(json.LatLonBoundingBox);\r\n else if (Array.isArray(json.EX_GeographicBoundingBox)) {\r\n return rangeFromJSONArray(json.EX_GeographicBoundingBox);\r\n } else {\r\n if (Array.isArray(json.BoundingBox))\r\n for (const boundingBox of json.BoundingBox) {\r\n if (boundingBox.crs === \"CRS:84\" || boundingBox.crs === \"EPSG:4326\") {\r\n return rangeFromJSONArray(boundingBox.extent);\r\n }\r\n }\r\n return undefined;\r\n }\r\n}\r\n\r\nfunction initArray<T>(input: any): undefined | T[] {\r\n return Array.isArray(input) ? input.slice() : undefined;\r\n}\r\n\r\n/** Encapsulation of the capabilities for an WMS server\r\n */\r\nexport namespace WmsCapability {\r\n\r\n export class Service {\r\n public readonly name: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly onlineResource?: string;\r\n public readonly contactInformation?: string;\r\n public readonly accessConstraints?: string;\r\n\r\n constructor(json: any) {\r\n this.name = json.Name ? json.Name : \"\";\r\n this.title = json.Title;\r\n this.abstract = json.Abstract;\r\n this.onlineResource = json.OnlineResource;\r\n this.contactInformation = json.ContactInformation;\r\n this.accessConstraints = json.AccessConstraints;\r\n }\r\n }\r\n\r\n export class Layer {\r\n public readonly queryable: boolean;\r\n public readonly title?: string;\r\n public readonly srs?: string[];\r\n public readonly cartoRange?: MapCartoRectangle;\r\n public readonly subLayers = new Array<SubLayer>();\r\n private static readonly PREFIX_SEPARATOR = \":\";\r\n\r\n constructor(json: any, capabilities: WmsCapabilities) {\r\n this.queryable = json.queryable;\r\n this.title = json.title;\r\n this.srs = initArray<string>(capabilities.isVersion13 ? json.CRS : json.SRS);\r\n this.cartoRange = rangeFromJSON(json);\r\n this.subLayers.push(new SubLayer(json, capabilities));\r\n }\r\n public getSubLayers(visible = true): MapSubLayerProps[] {\r\n const subLayers = new Array<MapSubLayerProps>();\r\n let index = 1;\r\n let childrenFound = false;\r\n const pushSubLayer = ((subLayer: SubLayer, parent?: number) => {\r\n let children;\r\n const id = index++;\r\n if (subLayer.children) {\r\n childrenFound = false;\r\n children = new Array<number>();\r\n subLayer.children.forEach((child) => {\r\n children.push(index);\r\n pushSubLayer(child, id);\r\n });\r\n }\r\n subLayers.push({ name: subLayer.name, title: subLayer.title, visible, parent, children, id });\r\n });\r\n this.subLayers.forEach((subLayer) => pushSubLayer(subLayer));\r\n\r\n if (!childrenFound) {\r\n const prefixed = new Map<string, MapSubLayerProps[]>();\r\n subLayers.forEach((subLayer) => {\r\n if (subLayer.name && subLayer.name.indexOf(Layer.PREFIX_SEPARATOR) > 0) {\r\n const prefix = subLayer.name.slice(0, subLayer.name.indexOf(Layer.PREFIX_SEPARATOR));\r\n const found = prefixed.get(prefix);\r\n if (found)\r\n found.push(subLayer);\r\n else\r\n prefixed.set(prefix, [subLayer]);\r\n }\r\n });\r\n if (prefixed.size > 1) {\r\n // Preserve the root node if any.\r\n const rootNode = (this.subLayers.length === 1 && this.subLayers[0].children && this.subLayers[0].children.length > 1) ? subLayers.find((curSubLayer) => this.subLayers[0].name === curSubLayer.name)?.id : undefined;\r\n prefixed.forEach((children, parent) => {\r\n children.forEach((child) => {\r\n child.parent = index;\r\n // Remove the prefix from the title if present.\r\n if (child.title && child.title.indexOf(parent + Layer.PREFIX_SEPARATOR) === 0)\r\n child.title = child.title.slice(parent.length + Layer.PREFIX_SEPARATOR.length);\r\n });\r\n subLayers.push({ name: \"\", title: parent, parent: rootNode, id: index++, children: children.map((child) => child.id as number), visible });\r\n });\r\n }\r\n }\r\n\r\n return subLayers;\r\n }\r\n\r\n public getSubLayersCrs(layerNameFilter: string[]): Map<string, string[]> {\r\n const subLayerCrs = new Map<string, string[]>();\r\n\r\n const processSubLayer = ((subLayer: SubLayer) => {\r\n if (layerNameFilter.includes(subLayer.name)) {\r\n subLayerCrs.set(subLayer.name, subLayer.crs);\r\n }\r\n if (subLayer.children) {\r\n subLayer.children.forEach((child) => {\r\n processSubLayer(child);\r\n });\r\n }\r\n });\r\n\r\n this.subLayers.forEach((subLayer) => processSubLayer(subLayer));\r\n return subLayerCrs;\r\n }\r\n }\r\n\r\n export class SubLayer {\r\n public readonly name: string;\r\n public readonly title: string;\r\n public readonly crs: string[];\r\n public readonly ownCrs: string[]; // CRS specific to this layer (ie. not including inherited CRS)\r\n public readonly cartoRange?: MapCartoRectangle;\r\n public readonly children?: SubLayer[];\r\n public readonly queryable: boolean;\r\n public constructor(_json: any, capabilities: WmsCapabilities, public readonly parent?: SubLayer) {\r\n\r\n const getParentCrs = (parentLayer: SubLayer, crsSet: Set<string>) => {\r\n parentLayer.crs.forEach((parentCrs) => crsSet.add(parentCrs));\r\n if (parentLayer.parent) {\r\n getParentCrs(parentLayer.parent, crsSet);\r\n }\r\n };\r\n\r\n this.name = _json.Name ? _json.Name : \"\";\r\n this.title = _json.Title;\r\n this.queryable = _json.queryable ? true : false;\r\n this.cartoRange = rangeFromJSON(_json);\r\n this.ownCrs = initArray<string>(capabilities.isVersion13 ? _json.CRS : _json.SRS) ?? [];\r\n const crs = new Set<string>(this.ownCrs);\r\n if (parent) {\r\n getParentCrs(parent, crs);\r\n }\r\n this.crs = [...crs];\r\n\r\n if (Array.isArray(_json.Layer)) {\r\n this.children = new Array<SubLayer>();\r\n for (const childLayer of _json.Layer) {\r\n this.children.push(new SubLayer(childLayer, capabilities, this));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport class WmsCapabilities {\r\n private static _capabilitiesCache = new Map<string, WmsCapabilities | undefined>();\r\n public readonly service: WmsCapability.Service;\r\n public readonly version?: string;\r\n public readonly isVersion13: boolean;\r\n public readonly layer?: WmsCapability.Layer;\r\n public get json() { return this._json; }\r\n public get maxLevel(): number { return this.layer ? this.layer.subLayers.length : - 1; }\r\n public get cartoRange(): MapCartoRectangle | undefined { return this.layer?.cartoRange; }\r\n public get featureInfoSupported() { return undefined !== this._json.Capability?.Request?.GetFeatureInfo; }\r\n public get featureInfoFormats(): string[] | undefined { return Array.isArray(this._json.Capability?.Request?.GetFeatureInfo?.Format) ? this._json.Capability?.Request?.GetFeatureInfo?.Format : undefined; }\r\n constructor(private _json: any) {\r\n if (!_json || typeof _json !== \"object\" || (_json.Service === undefined && _json.Capability === undefined))\r\n throw new Error(\"Invalid WMS GetCapabilities response\");\r\n\r\n this.version = typeof _json.version === \"string\" ? _json.version : undefined;\r\n this.isVersion13 = this.version !== undefined && this.version.startsWith(\"1.3\");\r\n this.service = new WmsCapability.Service(_json.Service ?? {});\r\n if (_json.Capability?.Layer)\r\n this.layer = new WmsCapability.Layer(_json.Capability.Layer, this);\r\n }\r\n\r\n /** Parse a GetCapabilities XML response, returning undefined if it is not a valid WMS capabilities document. */\r\n private static tryParse(xmlCapabilities: string): WmsCapabilities | undefined {\r\n // Validate the document is actually rooted at a WMS capabilities element before parsing:\r\n // wms-capabilities happily parses any root and recognizes direct Service/Capability children.\r\n // WMS 1.3.0 uses WMS_Capabilities; WMS 1.0.0-1.1.1 uses WMT_MS_Capabilities.\r\n const doc = new DOMParser().parseFromString(xmlCapabilities, \"text/xml\");\r\n const rootName = doc.documentElement?.localName;\r\n if (rootName !== \"WMS_Capabilities\" && rootName !== \"WMT_MS_Capabilities\")\r\n return undefined; // Not a WMS GetCapabilities document\r\n if (doc.getElementsByTagName(\"parsererror\").length > 0)\r\n return undefined; // XML parse error (browsers embed a parsererror element)\r\n\r\n try {\r\n return new WmsCapabilities(new WMS(undefined, DOMParser).parse(xmlCapabilities));\r\n } catch {\r\n return undefined; // Degenerate capabilities document\r\n }\r\n }\r\n\r\n public static async create(url: string, options?: WmsCapabilitiesCreateOptions): Promise<WmsCapabilities | undefined> {\r\n const { credentials, ignoreCache, queryParams, formatId, layerUrl, layerProperties } = options ?? {};\r\n const tmpUrl = new URL(WmsUtilities.getBaseUrl(url));\r\n tmpUrl.searchParams.append(\"request\", \"GetCapabilities\");\r\n tmpUrl.searchParams.append(\"service\", \"WMS\");\r\n if (queryParams) {\r\n Object.keys(queryParams).forEach((paramKey) => {\r\n if (!tmpUrl.searchParams.has(paramKey))\r\n tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);\r\n });\r\n }\r\n const cacheKey = tmpUrl.toString();\r\n // The cache never contains credentialed results (see the write below), so a credentialed request\r\n // must not be served a cached public document either; responses customized by the fetch handler\r\n // must not be shared with or served from differently-customized requests.\r\n const hasFetchHandler = (IModelApp.mapLayerFormatRegistry?.mapLayerFetchHandlers.length ?? 0) > 0;\r\n if (!ignoreCache && !hasFetchHandler && !credentials) {\r\n const cached = WmsCapabilities._capabilitiesCache.get(cacheKey);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n const xmlCapabilities = await WmsUtilities.fetchXml(tmpUrl.toString(), { credentials, formatId: formatId ?? \"WMS\", layerUrl: layerUrl ?? url, layerProperties });\r\n\r\n if (!xmlCapabilities)\r\n return undefined;\r\n\r\n const capabilities = WmsCapabilities.tryParse(xmlCapabilities);\r\n if (capabilities === undefined)\r\n return undefined;\r\n\r\n if (!credentials && !hasFetchHandler) {\r\n // Avoid caching protected data\r\n WmsCapabilities._capabilitiesCache.set(cacheKey, capabilities);\r\n }\r\n\r\n return capabilities;\r\n }\r\n public getSubLayers(visible = true): undefined | MapSubLayerProps[] {\r\n return this.layer ? this.layer.getSubLayers(visible) : undefined;\r\n }\r\n\r\n public getSubLayersCrs(subLayerNames: string[]): Map<string, string[]> | undefined {\r\n return this.layer ? this.layer.getSubLayersCrs(subLayerNames) : undefined;\r\n }\r\n}\r\n"]}
@@ -1,7 +1,31 @@
1
1
  import { RequestBasicCredentials } from "../../../request/Request";
2
+ import type { MapLayerProviderProperties } from "@itwin/core-common";
2
3
  /** @packageDocumentation
3
4
  * @module Tiles
4
5
  */
6
+ /** Options for a capabilities/XML request routed through the registered [[MapLayerFetchHandler]]s, if any.
7
+ * @internal
8
+ */
9
+ export interface WmsFetchOptions {
10
+ credentials?: RequestBasicCredentials;
11
+ /** The id of the map-layer format the request is made for, passed to the handler as [[MapLayerRequest.formatId]]. */
12
+ formatId?: string;
13
+ /** The map-layer source URL, passed to the handler as [[MapLayerRequest.layerUrl]]. Defaults to the request URL,
14
+ * which callers should avoid: capabilities request URLs differ from the layer's. */
15
+ layerUrl?: string;
16
+ /** The layer's provider-specific settings properties, passed to the handler as [[MapLayerRequest.layerProperties]]. */
17
+ layerProperties?: MapLayerProviderProperties;
18
+ }
19
+ /** Options for [[WmsCapabilities.create]] and [[WmtsCapabilities.create]].
20
+ * @internal
21
+ */
22
+ export interface WmsCapabilitiesCreateOptions extends WmsFetchOptions {
23
+ ignoreCache?: boolean;
24
+ /** Custom query parameters appended to the GetCapabilities request. */
25
+ queryParams?: {
26
+ [key: string]: string;
27
+ };
28
+ }
5
29
  /** @internal */
6
30
  export declare class WmsUtilities {
7
31
  static getBaseUrl(url: string): string;
@@ -9,6 +33,10 @@ export declare class WmsUtilities {
9
33
  * fetch XML from HTTP request
10
34
  * @param url server URL to address the request
11
35
  */
12
- static fetchXml(url: string, credentials?: RequestBasicCredentials): Promise<string>;
36
+ static fetchXml(url: string, options?: WmsFetchOptions): Promise<string>;
37
+ /** Legacy (no injected credentials) challenge handling: basic-auth/untrusted-origin classification and the SSO retry.
38
+ * `credentialsWithheld` is true when basic credentials exist but were not attached because the origin is untrusted.
39
+ */
40
+ private static handleLegacyChallenges;
13
41
  }
14
42
  //# sourceMappingURL=WmsUtilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WmsUtilities.d.ts","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmsUtilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAItF;;GAEG;AAEH,gBAAgB;AAChB,qBAAa,YAAY;WACT,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAK7C;;;KAGC;WACmB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,MAAM,CAAC;CAuClG"}
1
+ {"version":3,"file":"WmsUtilities.d.ts","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmsUtilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEtF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAKrE;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,qHAAqH;IACrH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;wFACoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uHAAuH;IACvH,eAAe,CAAC,EAAE,0BAA0B,CAAC;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,eAAe;IACnE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,WAAW,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,gBAAgB;AAChB,qBAAa,YAAY;WACT,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAK7C;;;KAGC;WACmB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAmDrF;;OAEG;mBACkB,sBAAsB;CAuB5C"}
@@ -5,10 +5,7 @@
5
5
  import { IModelApp } from "../../../IModelApp";
6
6
  import { HttpResponseError } from "../../../request/Request";
7
7
  import { headersIncludeAuthMethod, setBasicAuthorization } from "../../../request/utils";
8
- import { MapLayerUntrustedOriginError } from "../../../tile/internal";
9
- /** @packageDocumentation
10
- * @module Tiles
11
- */
8
+ import { credentialedFetchRedirect, fetchMapLayerRequest, MapLayerUntrustedOriginError, } from "../../../tile/internal";
12
9
  /** @internal */
13
10
  export class WmsUtilities {
14
11
  static getBaseUrl(url) {
@@ -19,21 +16,58 @@ export class WmsUtilities {
19
16
  * fetch XML from HTTP request
20
17
  * @param url server URL to address the request
21
18
  */
22
- static async fetchXml(url, credentials) {
19
+ static async fetchXml(url, options) {
20
+ const { credentials, formatId, layerUrl, layerProperties } = options ?? {};
23
21
  let headers;
24
- if (credentials && credentials.user && credentials.password) {
22
+ const hasCredentials = !!(credentials && credentials.user && credentials.password);
23
+ if (hasCredentials) {
25
24
  // Basic credentials are considered settings-derived credentials for this source. When the registry is
26
25
  // enforcing trusted origins, the source URL itself is the only implicitly trusted origin for basic auth;
27
26
  // opaque/custom-protocol URLs have no network origin and must therefore be treated as untrusted.
28
- const allowBasicAuth = !IModelApp.mapLayerFormatRegistry.restrictCredentialsToTrustedOrigins
27
+ // Optional chaining: some callers run before IModelApp startup.
28
+ const allowBasicAuth = !IModelApp.mapLayerFormatRegistry?.restrictCredentialsToTrustedOrigins
29
29
  || IModelApp.mapLayerFormatRegistry.isCredentialsSharingAllowed(url, url);
30
30
  if (allowBasicAuth) {
31
31
  headers = new Headers();
32
32
  setBasicAuthorization(headers, credentials);
33
33
  }
34
34
  }
35
- let response = await fetch(url, { method: "GET", headers });
36
- if (!headers && credentials && credentials.user && credentials.password && (response.status === 401 || response.status === 403)) {
35
+ const credentialsWithheld = hasCredentials && headers === undefined;
36
+ // Route the request through the registered fetch handler (if any). Handler failures — including
37
+ // MapLayerAuthenticationFailedError — propagate so callers can transition to RequireAuth.
38
+ const { response, managedByHandler } = await fetchMapLayerRequest({
39
+ url,
40
+ formatId: formatId ?? "",
41
+ layerUrl: layerUrl ?? url,
42
+ layerProperties,
43
+ headers,
44
+ send: async (request, credentialed) => {
45
+ const rsp = await fetch(request.url, {
46
+ method: "GET",
47
+ headers: request.headers,
48
+ // Sends the handler modified may carry injected secrets: same redirect policy as credentialed ones.
49
+ redirect: credentialed ? credentialedFetchRedirect() : undefined,
50
+ });
51
+ // A send the handler modified never falls back to the legacy basic-auth / NTLM-SSO handling:
52
+ // the handler is the authentication authority for it.
53
+ return credentialed ? rsp : WmsUtilities.handleLegacyChallenges(rsp, request.url, credentials, credentialsWithheld);
54
+ },
55
+ });
56
+ if (response.status !== 200) {
57
+ // A status in a response managed by the fetch handler is not an authentication failure (it would have
58
+ // thrown MapLayerAuthenticationFailedError): report it without a status so callers do not classify it.
59
+ if (managedByHandler)
60
+ throw new Error(`Map-layer fetch handler returned status ${response.status} for '${url}'`);
61
+ throw new HttpResponseError(response.status, await response.text());
62
+ }
63
+ return response.text();
64
+ }
65
+ /** Legacy (no injected credentials) challenge handling: basic-auth/untrusted-origin classification and the SSO retry.
66
+ * `credentialsWithheld` is true when basic credentials exist but were not attached because the origin is untrusted.
67
+ */
68
+ static async handleLegacyChallenges(firstResponse, url, credentials, credentialsWithheld) {
69
+ let response = firstResponse;
70
+ if (credentialsWithheld && (response.status === 401 || response.status === 403)) {
37
71
  throw new MapLayerUntrustedOriginError(url);
38
72
  }
39
73
  if (!credentials && response.status === 401 && headersIncludeAuthMethod(response.headers, ["ntlm", "negotiate"])) {
@@ -49,9 +83,7 @@ export class WmsUtilities {
49
83
  redirect: IModelApp.mapLayerFormatRegistry.restrictCredentialsToTrustedOrigins ? "error" : undefined,
50
84
  });
51
85
  }
52
- if (response.status !== 200)
53
- throw new HttpResponseError(response.status, await response.text());
54
- return response.text();
86
+ return response;
55
87
  }
56
88
  }
57
89
  //# sourceMappingURL=WmsUtilities.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WmsUtilities.js","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmsUtilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE;;GAEG;AAEH,gBAAgB;AAChB,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,UAAU,CAAC,GAAW;QAClC,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvD,CAAC;IAED;;;KAGC;IACM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAW,EAAE,WAAqC;QAE7E,IAAI,OAA0B,CAAC;QAC/B,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;YAC5D,sGAAsG;YACtG,yGAAyG;YACzG,iGAAiG;YACjG,MAAM,cAAc,GAAG,CAAC,SAAS,CAAC,sBAAsB,CAAC,mCAAmC;mBACvF,SAAS,CAAC,sBAAsB,CAAC,2BAA2B,CAAC,GAAG,EAAE,GAAG,CAAC,C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IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { HttpResponseError, RequestBasicCredentials } from \"../../../request/Request\";\r\nimport { headersIncludeAuthMethod, setBasicAuthorization } from \"../../../request/utils\";\r\nimport { MapLayerUntrustedOriginError } from \"../../../tile/internal\";\r\n\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/** @internal */\r\nexport class WmsUtilities {\r\n public static getBaseUrl(url: string): string {\r\n const lastIndex = url.lastIndexOf(\"?\");\r\n return lastIndex > 0 ? url.slice(0, lastIndex) : url;\r\n }\r\n\r\n /**\r\n * fetch XML from HTTP request\r\n * @param url server URL to address the request\r\n */\r\n public static async fetchXml(url: string, credentials?: RequestBasicCredentials): Promise<string> {\r\n\r\n let headers: Headers|undefined;\r\n if (credentials && credentials.user && credentials.password) {\r\n // Basic credentials are considered settings-derived credentials for this source. When the registry is\r\n // enforcing trusted origins, the source URL itself is the only implicitly trusted origin for basic auth;\r\n // opaque/custom-protocol URLs have no network origin and must therefore be treated as untrusted.\r\n const allowBasicAuth = !IModelApp.mapLayerFormatRegistry.restrictCredentialsToTrustedOrigins\r\n || IModelApp.mapLayerFormatRegistry.isCredentialsSharingAllowed(url, url);\r\n if (allowBasicAuth) {\r\n headers = new Headers();\r\n setBasicAuthorization(headers, credentials);\r\n }\r\n }\r\n\r\n let response = await fetch(url, { method: \"GET\", headers });\r\n if (!headers && credentials && credentials.user && credentials.password && (response.status === 401 || response.status === 403)) {\r\n throw new MapLayerUntrustedOriginError(url);\r\n }\r\n if (!credentials && response.status === 401 && headersIncludeAuthMethod(response.headers, [\"ntlm\", \"negotiate\"])) {\r\n // fetch follows redirects transparently, so trust decisions target the final (post-redirect) URL.\r\n const challengedUrl = response.url || url;\r\n if (!IModelApp.mapLayerFormatRegistry.isSsoAllowed(challengedUrl))\r\n throw new MapLayerUntrustedOriginError(challengedUrl);\r\n\r\n IModelApp.mapLayerFormatRegistry.logUntrustedOriginUse(challengedUrl);\r\n\r\n // We got a http 401 challenge, lets try SSO (i.e. Windows Authentication).\r\n response = await fetch(challengedUrl, {\r\n method: \"GET\",\r\n credentials: \"include\",\r\n redirect: IModelApp.mapLayerFormatRegistry.restrictCredentialsToTrustedOrigins ? \"error\" : undefined,\r\n });\r\n }\r\n\r\n if (response.status !== 200)\r\n throw new HttpResponseError(response.status, await response.text());\r\n return response.text();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"WmsUtilities.js","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmsUtilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EACL,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,GAC9E,MAAM,wBAAwB,CAAC;AA6BhC,gBAAgB;AAChB,MAAM,OAAO,YAAY;IAChB,MAAM,CAAC,UAAU,CAAC,GAAW;QAClC,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvC,OAAO,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACvD,CAAC;IAED;;;KAGC;IACM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GA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AC,CAAC;YAExD,SAAS,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;YAEtE,2EAA2E;YAC3E,QAAQ,GAAG,MAAM,KAAK,CAAC,aAAa,EAAE;gBACpC,MAAM,EAAE,KAAK;gBACb,WAAW,EAAE,SAAS;gBACtB,QAAQ,EAAE,SAAS,CAAC,sBAAsB,CAAC,mCAAmC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;aACrG,CAAC,CAAC;QACL,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { HttpResponseError, RequestBasicCredentials } from \"../../../request/Request\";\r\nimport { headersIncludeAuthMethod, setBasicAuthorization } from \"../../../request/utils\";\r\nimport type { MapLayerProviderProperties } from \"@itwin/core-common\";\r\nimport {\r\n credentialedFetchRedirect, fetchMapLayerRequest, MapLayerUntrustedOriginError,\r\n} from \"../../../tile/internal\";\r\n\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/** Options for a capabilities/XML request routed through the registered [[MapLayerFetchHandler]]s, if any.\r\n * @internal\r\n */\r\nexport interface WmsFetchOptions {\r\n credentials?: RequestBasicCredentials;\r\n /** The id of the map-layer format the request is made for, passed to the handler as [[MapLayerRequest.formatId]]. */\r\n formatId?: string;\r\n /** The map-layer source URL, passed to the handler as [[MapLayerRequest.layerUrl]]. Defaults to the request URL,\r\n * which callers should avoid: capabilities request URLs differ from the layer's. */\r\n layerUrl?: string;\r\n /** The layer's provider-specific settings properties, passed to the handler as [[MapLayerRequest.layerProperties]]. */\r\n layerProperties?: MapLayerProviderProperties;\r\n}\r\n\r\n/** Options for [[WmsCapabilities.create]] and [[WmtsCapabilities.create]].\r\n * @internal\r\n */\r\nexport interface WmsCapabilitiesCreateOptions extends WmsFetchOptions {\r\n ignoreCache?: boolean;\r\n /** Custom query parameters appended to the GetCapabilities request. */\r\n queryParams?: { [key: string]: string };\r\n}\r\n\r\n/** @internal */\r\nexport class WmsUtilities {\r\n public static getBaseUrl(url: string): string {\r\n const lastIndex = url.lastIndexOf(\"?\");\r\n return lastIndex > 0 ? url.slice(0, lastIndex) : url;\r\n }\r\n\r\n /**\r\n * fetch XML from HTTP request\r\n * @param url server URL to address the request\r\n */\r\n public static async fetchXml(url: string, options?: WmsFetchOptions): Promise<string> {\r\n const { credentials, formatId, layerUrl, layerProperties } = options ?? {};\r\n\r\n let headers: Headers|undefined;\r\n const hasCredentials = !!(credentials && credentials.user && credentials.password);\r\n if (hasCredentials) {\r\n // Basic credentials are considered settings-derived credentials for this source. When the registry is\r\n // enforcing trusted origins, the source URL itself is the only implicitly trusted origin for basic auth;\r\n // opaque/custom-protocol URLs have no network origin and must therefore be treated as untrusted.\r\n // Optional chaining: some callers run before IModelApp startup.\r\n const allowBasicAuth = !IModelApp.mapLayerFormatRegistry?.restrictCredentialsToTrustedOrigins\r\n || IModelApp.mapLayerFormatRegistry.isCredentialsSharingAllowed(url, url);\r\n if (allowBasicAuth) {\r\n headers = new Headers();\r\n setBasicAuthorization(headers, credentials);\r\n }\r\n }\r\n const credentialsWithheld = hasCredentials && headers === undefined;\r\n\r\n // Route the request through the registered fetch handler (if any). Handler failures — including\r\n // MapLayerAuthenticationFailedError — propagate so callers can transition to RequireAuth.\r\n const { response, managedByHandler } = await fetchMapLayerRequest({\r\n url,\r\n formatId: formatId ?? \"\",\r\n layerUrl: layerUrl ?? url,\r\n layerProperties,\r\n headers,\r\n send: async (request, credentialed) => {\r\n const rsp = await fetch(request.url, {\r\n method: \"GET\",\r\n headers: request.headers,\r\n // Sends the handler modified may carry injected secrets: same redirect policy as credentialed ones.\r\n redirect: credentialed ? credentialedFetchRedirect() : undefined,\r\n });\r\n\r\n // A send the handler modified never falls back to the legacy basic-auth / NTLM-SSO handling:\r\n // the handler is the authentication authority for it.\r\n return credentialed ? rsp : WmsUtilities.handleLegacyChallenges(rsp, request.url, credentials, credentialsWithheld);\r\n },\r\n });\r\n\r\n if (response.status !== 200) {\r\n // A status in a response managed by the fetch handler is not an authentication failure (it would have\r\n // thrown MapLayerAuthenticationFailedError): report it without a status so callers do not classify it.\r\n if (managedByHandler)\r\n throw new Error(`Map-layer fetch handler returned status ${response.status} for '${url}'`);\r\n throw new HttpResponseError(response.status, await response.text());\r\n }\r\n return response.text();\r\n }\r\n\r\n /** Legacy (no injected credentials) challenge handling: basic-auth/untrusted-origin classification and the SSO retry.\r\n * `credentialsWithheld` is true when basic credentials exist but were not attached because the origin is untrusted.\r\n */\r\n private static async handleLegacyChallenges(firstResponse: Response, url: string, credentials: RequestBasicCredentials | undefined, credentialsWithheld: boolean): Promise<Response> {\r\n let response = firstResponse;\r\n if (credentialsWithheld && (response.status === 401 || response.status === 403)) {\r\n throw new MapLayerUntrustedOriginError(url);\r\n }\r\n if (!credentials && response.status === 401 && headersIncludeAuthMethod(response.headers, [\"ntlm\", \"negotiate\"])) {\r\n // fetch follows redirects transparently, so trust decisions target the final (post-redirect) URL.\r\n const challengedUrl = response.url || url;\r\n if (!IModelApp.mapLayerFormatRegistry.isSsoAllowed(challengedUrl))\r\n throw new MapLayerUntrustedOriginError(challengedUrl);\r\n\r\n IModelApp.mapLayerFormatRegistry.logUntrustedOriginUse(challengedUrl);\r\n\r\n // We got a http 401 challenge, lets try SSO (i.e. Windows Authentication).\r\n response = await fetch(challengedUrl, {\r\n method: \"GET\",\r\n credentials: \"include\",\r\n redirect: IModelApp.mapLayerFormatRegistry.restrictCredentialsToTrustedOrigins ? \"error\" : undefined,\r\n });\r\n }\r\n\r\n return response;\r\n }\r\n}\r\n"]}
@@ -2,8 +2,7 @@
2
2
  * @module Views
3
3
  */
4
4
  import { Point2d, Range2d } from "@itwin/core-geometry";
5
- import { RequestBasicCredentials } from "../../../request/Request";
6
- import { MapCartoRectangle } from "../../../tile/internal";
5
+ import { MapCartoRectangle, WmsCapabilitiesCreateOptions } from "../../../tile/internal";
7
6
  export declare enum WmtsConstants {
8
7
  GOOGLEMAPS_LEVEL0_SCALE_DENOM = 559082264.0287178,
9
8
  GOOGLEMAPS_COMPATIBLE_WELLKNOWNNAME = "googlemapscompatible"
@@ -121,8 +120,6 @@ export declare class WmtsCapabilities {
121
120
  readonly operationsMetadata?: WmtsCapability.OperationMetadata;
122
121
  constructor(xmlDoc: Document);
123
122
  static createFromXml(xmlCapabilities: string): WmtsCapabilities | undefined;
124
- static create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean, queryParams?: {
125
- [key: string]: string;
126
- }): Promise<WmtsCapabilities | undefined>;
123
+ static create(url: string, options?: WmsCapabilitiesCreateOptions): Promise<WmtsCapabilities | undefined>;
127
124
  }
128
125
  //# sourceMappingURL=WmtsCapabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WmtsCapabilities.d.ts","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmtsCapabilities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAgB,MAAM,wBAAwB,CAAC;AAqDzE,oBAAY,aAAa;IACvB,6BAA6B,oBAAoB;IACjD,mCAAmC,yBAAyB;CAC7D;AAiBD;GACG;AACH,yBAAiB,cAAc,CAAC;IAC9B,MAAa,qBAAqB;QAChC,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClC,SAAgB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3C,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;QAC9B,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrC,SAAgB,kBAAkB,CAAC,E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AAC;IACjC,SAAgB,qBAAqB,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC;IAC7E,SAAgB,QAAQ,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC;IAEnD,SAAgB,kBAAkB,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC;gBAE1D,MAAM,EAAE,QAAQ;WAwBd,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;WAM9D,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAgCvH"}
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { expectDefined } from "@itwin/core-bentley";
9
9
  import { Point2d, Range2d } from "@itwin/core-geometry";
10
+ import { IModelApp } from "../../../IModelApp";
10
11
  import { MapCartoRectangle, WmsUtilities } from "../../../tile/internal";
11
12
  var OwsConstants;
12
13
  (function (OwsConstants) {
@@ -473,12 +474,8 @@ export class WmtsCapabilities {
473
474
  const xmlDoc = parser.parseFromString(xmlCapabilities, "text/xml");
474
475
  return new WmtsCapabilities(xmlDoc);
475
476
  }
476
- static async create(url, credentials, ignoreCache, queryParams) {
477
- if (!ignoreCache) {
478
- const cached = WmtsCapabilities._capabilitiesCache.get(url);
479
- if (cached !== undefined)
480
- return cached;
481
- }
477
+ static async create(url, options) {
478
+ const { credentials, ignoreCache, queryParams, formatId, layerUrl, layerProperties } = options ?? {};
482
479
  const tmpUrl = new URL(WmsUtilities.getBaseUrl(url));
483
480
  tmpUrl.searchParams.append("request", "GetCapabilities");
484
481
  tmpUrl.searchParams.append("service", "WMTS");
@@ -488,12 +485,22 @@ export class WmtsCapabilities {
488
485
  tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);
489
486
  });
490
487
  }
491
- const xmlCapabilities = await WmsUtilities.fetchXml(tmpUrl.toString(), credentials);
488
+ const cacheKey = tmpUrl.toString();
489
+ // The cache never contains credentialed results (see the write below), so a credentialed request
490
+ // must not be served a cached public document either; responses customized by the fetch handler
491
+ // must not be shared with or served from differently-customized requests.
492
+ const hasFetchHandler = (IModelApp.mapLayerFormatRegistry?.mapLayerFetchHandlers.length ?? 0) > 0;
493
+ if (!ignoreCache && !hasFetchHandler && !credentials) {
494
+ const cached = WmtsCapabilities._capabilitiesCache.get(cacheKey);
495
+ if (cached !== undefined)
496
+ return cached;
497
+ }
498
+ const xmlCapabilities = await WmsUtilities.fetchXml(tmpUrl.toString(), { credentials, formatId: formatId ?? "WMTS", layerUrl: layerUrl ?? url, layerProperties });
492
499
  if (!xmlCapabilities)
493
500
  return undefined;
494
501
  const capabilities = WmtsCapabilities.createFromXml(xmlCapabilities);
495
- if (capabilities)
496
- WmtsCapabilities._capabilitiesCache.set(url, capabilities);
502
+ if (capabilities && !credentials && !hasFetchHandler)
503
+ WmtsCapabilities._capabilitiesCache.set(cacheKey, capabilities);
497
504
  return capabilities;
498
505
  }
499
506
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WmtsCapabilities.js","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmtsCapabilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzE,IAAK,YA0BJ;AA1BD,WAAK,YAAY;IACf,gDAAgC,CAAA;IAChC,kEAAkD,CAAA;IAClD,0DAA0C,CAAA;IAC1C,sDAAsC,CAAA;IACtC,oDAAoC,CAAA;IACpC,sCAAsB,CAAA;IACtB,wCAAwB,CAAA;IACxB,sCAAsB,CAAA;IACtB,wCAAwB,CAAA;IACxB,oDAAoC,CAAA;IACpC,gDAAgC,CAAA;IAChC,8CAA8B,CAAA;IAC9B,sDAAsC,CAAA;I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pC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,CAAC;QACpF,IAAI,CAAC,eAAe;YAClB,OAAO,SAAS,CAAC;QAEnB,MAAM,YAAY,GAAG,gBAAgB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACrE,IAAI,YAAY;YACd,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAE7D,OAAO,YAAY,CAAC;IACtB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { expectDefined } from \"@itwin/core-bentley\";\r\nimport { Point2d, Range2d } from \"@itwin/core-geometry\";\r\nimport { RequestBasicCredentials } from \"../../../request/Request\";\r\nimport { MapCartoRectangle, WmsUtilities } from \"../../../tile/internal\";\r\n\r\nenum OwsConstants {\r\n ABSTRACT_XMLTAG = \"ows:Abstract\",\r\n ACCESSCONSTRAINTS_XMLTAG = \"ows:AccessConstraints\",\r\n ALLOWEDVALUES_XMLTAG = \"ows:AllowedValues\",\r\n BOUNDINGBOX_XMLTAG = \"ows:BoundingBox\",\r\n CONSTRAINT_XMLTAG = \"ows:Constraint\",\r\n DCP_XMLTAG = \"ows:DCP\",\r\n FEES_XMLTAG = \"ows:Fees\",\r\n GET_XMLTAG = \"ows:Get\",\r\n HTTP_XMLTAG = \"ows:HTTP\",\r\n IDENTIFIER_XMLTAG = \"ows:Identifier\",\r\n KEYWORDS_XMLTAG = \"ows:Keywords\",\r\n KEYWORD_XMLTAG = \"ows:Keyword\",\r\n LOWERCORNER_XMLTAG = \"ows:LowerCorner\",\r\n OPERATION_XMLTAG = \"ows:Operation\",\r\n OPERATIONSMETADATA_XMLTAG = \"ows:OperationsMetadata\",\r\n POST_XMLTAG = \"ows:Post\",\r\n SERVICEIDENTIFICATION_XMLTAG = \"ows:ServiceIdentification\",\r\n SERVICETYPE_XMLTAG = \"ows:ServiceType\",\r\n SERVICETYPEVERSION_XMLTAG = \"ows:ServiceTypeVersion\",\r\n SUPPORTEDCRS_XMLTAG = \"ows:SupportedCRS\",\r\n TITLE_XMLTAG = \"ows:Title\",\r\n UPPERCORNER_XMLTAG = \"ows:UpperCorner\",\r\n VALUE_XMLTAG = \"ows:Value\",\r\n WGS84BOUNDINGBOX_XMLTAG = \"ows:WGS84BoundingBox\"\r\n\r\n}\r\n\r\nenum XmlConstants {\r\n // Operations names\r\n GETCAPABILITIES = \"GetCapabilities\",\r\n GETTILE = \"GetTile\",\r\n GETFEATUREINFO = \"GetFeatureInfo\",\r\n\r\n MATRIXWIDTH_XMLTAG = \"MatrixWidth\",\r\n MATRIXHEIGHT_XMLTAG = \"MatrixHeight\",\r\n SCALEDENOMINATOR_XMLTAG = \"ScaleDenominator\",\r\n\r\n TILEHEIGHT_XMLTAG = \"TileHeight\",\r\n TILEMATRIX_XMLTAG = \"TileMatrix\",\r\n TILEMATRIXSETLINK_XMLTAG = \"TileMatrixSetLink\",\r\n RESOURCEURL_XMLTAG = \"ResourceURL\",\r\n TILEWIDTH_XMLTAG = \"TileWidth\",\r\n TOPLEFTCORNER_XMLTAG = \"TopLeftCorner\",\r\n WELLKNOWNSCALESET_XMLTAG = \"WellKnownScaleSet\",\r\n\r\n CONSTRAINT_NAME_FILTER = \"Encoding\",\r\n STYLE_ISDEFAULT = \"IsDefault\",\r\n XLINK_HREF = \"xlink:href\",\r\n}\r\n\r\nexport enum WmtsConstants {\r\n GOOGLEMAPS_LEVEL0_SCALE_DENOM = 559082264.0287178,\r\n GOOGLEMAPS_COMPATIBLE_WELLKNOWNNAME = \"googlemapscompatible\",\r\n}\r\n\r\n/**\r\n * Utility function to extract an element' text content\r\n * @return An element's text content, default to provided defaultTest value if no text is available.\r\n * @param url server URL to address the request\r\n */\r\nconst getElementTextContent = (elem: Element, qualifiedName: string, defaultText?: string) => {\r\n\r\n const tmpElem = elem.getElementsByTagName(qualifiedName);\r\n if (tmpElem.length > 0) {\r\n return tmpElem[0].textContent ?? defaultText;\r\n } else\r\n return defaultText;\r\n\r\n};\r\n\r\n/** Encapsulation of the capabilities for an WMTS server\r\n */\r\nexport namespace WmtsCapability {\r\n export class ServiceIdentification {\r\n public readonly abstract?: string;\r\n public readonly accessConstraints?: string;\r\n public readonly fees?: string;\r\n public readonly serviceType?: string;\r\n public readonly serviceTypeVersion?: string;\r\n public readonly title?: string;\r\n public readonly keywords?: string[];\r\n\r\n constructor(elem: Element) {\r\n this.abstract = getElementTextContent(elem, OwsConstants.ABSTRACT_XMLTAG);\r\n this.serviceType = getElementTextContent(elem, OwsConstants.SERVICETYPE_XMLTAG);\r\n this.serviceTypeVersion = getElementTextContent(elem, OwsConstants.SERVICETYPEVERSION_XMLTAG);\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n\r\n const keywords = elem.getElementsByTagName(OwsConstants.KEYWORDS_XMLTAG);\r\n if (keywords.length > 0) {\r\n const keyword = keywords[0].getElementsByTagName(OwsConstants.KEYWORD_XMLTAG);\r\n this.keywords = [];\r\n for (const keyworkElem of keyword) {\r\n const keyWordText = keyworkElem.textContent;\r\n if (keyWordText)\r\n this.keywords.push(keyWordText);\r\n }\r\n }\r\n\r\n this.accessConstraints = getElementTextContent(elem, OwsConstants.ACCESSCONSTRAINTS_XMLTAG);\r\n\r\n this.fees = getElementTextContent(elem, OwsConstants.FEES_XMLTAG);\r\n }\r\n }\r\n\r\n export class OperationMetadata {\r\n private _getCapabilities?: Operation;\r\n public get getCapabilities(): Operation | undefined { return this._getCapabilities; }\r\n\r\n private _getFeatureInfo?: Operation;\r\n public get getFeatureInfo(): Operation | undefined { return this._getFeatureInfo; }\r\n\r\n private _getTile?: Operation;\r\n public get getTile(): Operation | undefined { return this._getTile; }\r\n\r\n private readOperation(op: Element) {\r\n const nameAttr = op.attributes.getNamedItem(\"name\");\r\n if (!nameAttr)\r\n return;\r\n\r\n if (nameAttr.textContent === XmlConstants.GETCAPABILITIES) {\r\n this._getCapabilities = new Operation(op);\r\n } else if (nameAttr.textContent === XmlConstants.GETTILE) {\r\n this._getTile = new Operation(op);\r\n } else if (nameAttr.textContent === XmlConstants.GETFEATUREINFO) {\r\n this._getFeatureInfo = new Operation(op);\r\n }\r\n }\r\n\r\n constructor(elem: Element) {\r\n const operation = elem.getElementsByTagName(OwsConstants.OPERATION_XMLTAG);\r\n if (operation.length > 0) {\r\n for (const op of operation) {\r\n this.readOperation(op);\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class HttpDcp {\r\n public readonly url?: string;\r\n public readonly constraintName?: string;\r\n\r\n // For simplicity of use we create a 'static' encoding property instead of having\r\n // a generic constraint data model.\r\n // We make sure the constraint name is 'encoding' related.\r\n public readonly encoding?: string;\r\n\r\n constructor(elem: Element) {\r\n const url = elem.getAttribute(XmlConstants.XLINK_HREF);\r\n if (url)\r\n this.url = url ?? \"\";\r\n\r\n const constraint = elem.getElementsByTagName(OwsConstants.CONSTRAINT_XMLTAG);\r\n if (constraint.length > 0) {\r\n this.constraintName = constraint[0].getAttribute(\"name\") ?? \"\";\r\n if (this.constraintName?.endsWith(XmlConstants.CONSTRAINT_NAME_FILTER)) {\r\n const allowedValues = constraint[0].getElementsByTagName(OwsConstants.ALLOWEDVALUES_XMLTAG);\r\n if (allowedValues.length > 0) {\r\n this.encoding = getElementTextContent(allowedValues[0], OwsConstants.VALUE_XMLTAG);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class Operation {\r\n public readonly name?: string;\r\n private _getDcpHttp?: HttpDcp[];\r\n public get getDcpHttp(): HttpDcp[] | undefined { return this._getDcpHttp; }\r\n private _postDcpHttp?: HttpDcp[];\r\n public get postDcpHttp(): HttpDcp[] | undefined { return this._postDcpHttp; }\r\n\r\n constructor(elem: Element) {\r\n const name = elem.getAttribute(\"name\");\r\n if (name)\r\n this.name = name;\r\n\r\n const dcp = elem.getElementsByTagName(OwsConstants.DCP_XMLTAG);\r\n if (!dcp || dcp.length === 0)\r\n return;\r\n\r\n const dcpHttp = dcp[0].getElementsByTagName(OwsConstants.HTTP_XMLTAG);\r\n if (!dcpHttp || dcpHttp.length === 0)\r\n return;\r\n\r\n const get = dcpHttp[0].getElementsByTagName(OwsConstants.GET_XMLTAG);\r\n if (get.length > 0) {\r\n this._getDcpHttp = [];\r\n\r\n for (const getItem of get) {\r\n this._getDcpHttp?.push(new HttpDcp(getItem));\r\n }\r\n }\r\n\r\n const post = dcpHttp[0].getElementsByTagName(OwsConstants.POST_XMLTAG);\r\n if (post.length > 0) {\r\n this._postDcpHttp = [];\r\n\r\n for (const postItem of post) {\r\n this._postDcpHttp?.push(new HttpDcp(postItem));\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class Contents {\r\n public readonly layers: Layer[] = [];\r\n public readonly tileMatrixSets: TileMatrixSet[] = [];\r\n\r\n constructor(elem: Element) {\r\n // Layers\r\n const layer = elem.getElementsByTagName(\"Layer\");\r\n if (layer) {\r\n for (const layerElem of layer)\r\n this.layers.push(new Layer(layerElem));\r\n }\r\n\r\n // TileMatrixSet\r\n const tms = elem.querySelectorAll(\"Contents > TileMatrixSet\");\r\n if (tms) {\r\n for (const tmsElem of tms)\r\n this.tileMatrixSets.push(new TileMatrixSet(tmsElem));\r\n }\r\n\r\n }\r\n\r\n public getGoogleMapsCompatibleTileMatrixSet(): TileMatrixSet[] {\r\n const googleMapsTms: TileMatrixSet[] = [];\r\n this.tileMatrixSets.forEach((tms) => {\r\n if (tms.wellKnownScaleSet?.toLowerCase().includes(WmtsConstants.GOOGLEMAPS_COMPATIBLE_WELLKNOWNNAME))\r\n googleMapsTms.push(tms);\r\n\r\n // In case wellKnownScaleSet was not been set properly, infer from scaleDenominator\r\n // Note: some servers are quite inaccurate in their scale values, hence I used a delta value of 1.\r\n else if (tms.tileMatrix.length > 0\r\n && Math.abs(tms.tileMatrix[0].scaleDenominator - WmtsConstants.GOOGLEMAPS_LEVEL0_SCALE_DENOM) < 1\r\n && (tms.supportedCrs.includes(\"3857\") || tms.supportedCrs.includes(\"900913\"))\r\n )\r\n googleMapsTms.push(tms);\r\n });\r\n return googleMapsTms;\r\n }\r\n\r\n public getEpsg4326CompatibleTileMatrixSet(): TileMatrixSet[] {\r\n return this.tileMatrixSets.filter((tms) => tms.supportedCrs.includes(\"4326\"));\r\n }\r\n }\r\n\r\n export class Style {\r\n public readonly isDefault: boolean = false;\r\n public readonly title?: string;\r\n public readonly identifier?: string;\r\n // TODO: LegendURL\r\n\r\n constructor(elem: Element) {\r\n if (!elem)\r\n return;\r\n\r\n const isDefault = elem.getAttribute(\"isDefault\");\r\n if (isDefault)\r\n this.isDefault = isDefault.toLowerCase() === \"true\";\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG);\r\n }\r\n }\r\n\r\n export class BoundingBox {\r\n public readonly crs?: string;\r\n public readonly range?: Range2d;\r\n\r\n constructor(elem: Element) {\r\n this.crs = elem.getAttribute(\"crs\") ?? undefined;\r\n\r\n const lowerCorner = getElementTextContent(elem, OwsConstants.LOWERCORNER_XMLTAG);\r\n const upperCorner = getElementTextContent(elem, OwsConstants.UPPERCORNER_XMLTAG);\r\n if (lowerCorner && upperCorner) {\r\n const lowerCornerArray = lowerCorner?.split(\" \").map((x: string) => +x);\r\n const upperCornerArray = upperCorner?.split(\" \").map((x: string) => +x);\r\n if (lowerCornerArray && lowerCornerArray.length === 2 && upperCornerArray && upperCornerArray.length === 2)\r\n this.range = Range2d.createXYXY(lowerCornerArray[0], lowerCornerArray[1], upperCornerArray[0], upperCornerArray[1]);\r\n }\r\n }\r\n }\r\n\r\n export class TileMatrixSetLimits {\r\n public limits?: Range2d;\r\n public tileMatrix?: string;\r\n\r\n constructor(elem: Element) {\r\n\r\n this.tileMatrix = getElementTextContent(elem, \"TileMatrix\");\r\n\r\n const minTileRow = getElementTextContent(elem, \"MinTileRow\");\r\n const maxTileRow = getElementTextContent(elem, \"MaxTileRow\");\r\n const minTileCol = getElementTextContent(elem, \"MinTileCol\");\r\n const maxTileCol = getElementTextContent(elem, \"MaxTileCol\");\r\n\r\n if (minTileRow !== undefined && maxTileRow !== undefined && minTileCol !== undefined && maxTileCol)\r\n this.limits = Range2d.createXYXY(Number(minTileCol), Number(minTileRow), Number(maxTileCol), Number(maxTileRow));\r\n }\r\n }\r\n\r\n export class TileMatrixSetLink {\r\n public readonly tileMatrixSet: string;\r\n public readonly tileMatrixSetLimits = new Array<TileMatrixSetLimits>();\r\n\r\n constructor(elem: Element) {\r\n\r\n this.tileMatrixSet = expectDefined(getElementTextContent(elem, \"TileMatrixSet\", \"\"));\r\n\r\n const tileMatrixLimitsRoot = elem.getElementsByTagName(\"TileMatrixSetLimits\");\r\n if (tileMatrixLimitsRoot.length > 0) {\r\n const tileMatrixLimits = tileMatrixLimitsRoot[0].getElementsByTagName(\"TileMatrixLimits\");\r\n for (const tmsl of tileMatrixLimits) {\r\n this.tileMatrixSetLimits.push(new TileMatrixSetLimits(tmsl));\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class ResourceURL {\r\n public readonly format: string;\r\n public readonly resourceType: string\r\n public readonly template: string;\r\n\r\n constructor(elem: Element) {\r\n this.format = elem.getAttribute(\"format\") ?? \"\";\r\n this.resourceType = elem.getAttribute(\"resourceType\") ?? \"\";\r\n this.template = elem.getAttribute(\"template\") ?? \"\";\r\n }\r\n }\r\n\r\n export class TileMatrixSet {\r\n public readonly identifier: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly supportedCrs: string;\r\n public readonly wellKnownScaleSet: string;\r\n public readonly tileMatrix: TileMatrix[] = [];\r\n\r\n constructor(elem: Element) {\r\n const identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG);\r\n if (identifier)\r\n this.identifier = identifier;\r\n else\r\n throw new Error(\"No Identifier found.\");\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.abstract = getElementTextContent(elem, OwsConstants.ABSTRACT_XMLTAG);\r\n\r\n const supportedCrs = getElementTextContent(elem, OwsConstants.SUPPORTEDCRS_XMLTAG);\r\n if (supportedCrs)\r\n this.supportedCrs = supportedCrs;\r\n else\r\n throw new Error(\"No supported CRS found.\");\r\n\r\n this.wellKnownScaleSet = expectDefined(getElementTextContent(elem, XmlConstants.WELLKNOWNSCALESET_XMLTAG, \"\"));\r\n\r\n // TileMatrix:\r\n // TileMatrix is mandatory on TileMatrixSet, if it doesn't exists, something is OFF with the capability.\r\n const tileMatrix = elem.getElementsByTagName(XmlConstants.TILEMATRIX_XMLTAG);\r\n if (tileMatrix.length === 0)\r\n throw new Error(\"No matrix set link found for WMTS layer\");\r\n\r\n for (const tm of tileMatrix) {\r\n this.tileMatrix.push(new TileMatrix(tm));\r\n }\r\n }\r\n }\r\n\r\n export class TileMatrix {\r\n public readonly identifier: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly scaleDenominator: number;\r\n public readonly topLeftCorner: Point2d;\r\n public readonly tileWidth: number;\r\n public readonly tileHeight: number;\r\n public readonly matrixWidth: number;\r\n public readonly matrixHeight: number;\r\n\r\n constructor(elem: Element) {\r\n const identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG, \"\");\r\n if (identifier)\r\n this.identifier = identifier;\r\n else\r\n throw new Error(\"No Identifier found.\");\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.abstract = getElementTextContent(elem, OwsConstants.ABSTRACT_XMLTAG);\r\n\r\n // Scale denominator\r\n const scaleDenom = getElementTextContent(elem, XmlConstants.SCALEDENOMINATOR_XMLTAG, \"\");\r\n if (!scaleDenom)\r\n throw new Error(\"No scale denominator found on TileMatrix.\");\r\n this.scaleDenominator = +scaleDenom;\r\n\r\n // Top left corner\r\n const topLeftCorner = getElementTextContent(elem, XmlConstants.TOPLEFTCORNER_XMLTAG, \"\")?.split(\" \").map((x: string) => +x);\r\n if (topLeftCorner?.length !== 2)\r\n throw new Error(\"No TopLeftCorner found on TileMatrix.\");\r\n this.topLeftCorner = Point2d.create(topLeftCorner[0], topLeftCorner[1]);\r\n\r\n // Tile Width\r\n const tileWidth = getElementTextContent(elem, XmlConstants.TILEWIDTH_XMLTAG);\r\n if (!tileWidth)\r\n throw new Error(\"No tile width found on TileMatrix.\");\r\n this.tileWidth = +tileWidth;\r\n\r\n // Tile Height\r\n const tileHeight = getElementTextContent(elem, XmlConstants.TILEHEIGHT_XMLTAG);\r\n if (!tileHeight)\r\n throw new Error(\"No tile height found on TileMatrix.\");\r\n this.tileHeight = +tileHeight;\r\n\r\n // Matrix Width\r\n const matrixWidth = getElementTextContent(elem, XmlConstants.MATRIXWIDTH_XMLTAG);\r\n if (!matrixWidth)\r\n throw new Error(\"No tile width found on TileMatrix.\");\r\n this.matrixWidth = +matrixWidth;\r\n\r\n // Matrix Height\r\n const matrixHeight = getElementTextContent(elem, XmlConstants.MATRIXHEIGHT_XMLTAG);\r\n if (!matrixHeight)\r\n throw new Error(\"No tile height found on TileMatrix.\");\r\n this.matrixHeight = +matrixHeight;\r\n }\r\n }\r\n\r\n export class Layer {\r\n public readonly identifier: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly format?: string;\r\n public readonly wsg84BoundingBox?: MapCartoRectangle;\r\n public readonly boundingBox?: BoundingBox;\r\n public readonly styles: Style[] = [];\r\n public readonly tileMatrixSetLinks: TileMatrixSetLink[] = [];\r\n public readonly resourceUrls: ResourceURL[] = [];\r\n\r\n constructor(elem: Element) {\r\n\r\n const identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG, \"\");\r\n if (identifier)\r\n this.identifier = identifier;\r\n else\r\n throw new Error(\"No Identifier found.\");\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.format = getElementTextContent(elem, \"Format\");\r\n\r\n // BoundingBox\r\n const boundingBox = elem.getElementsByTagName(OwsConstants.BOUNDINGBOX_XMLTAG);\r\n if (boundingBox.length > 0)\r\n this.boundingBox = new BoundingBox(boundingBox[0]);\r\n\r\n let lowerCornerArray: number[] | undefined, upperCornerArray: number[] | undefined;\r\n const bbox = elem.getElementsByTagName(OwsConstants.WGS84BOUNDINGBOX_XMLTAG);\r\n if (bbox.length > 0) {\r\n lowerCornerArray = getElementTextContent(bbox[0], OwsConstants.LOWERCORNER_XMLTAG)?.split(\" \").map((x: string) => +x);\r\n upperCornerArray = getElementTextContent(bbox[0], OwsConstants.UPPERCORNER_XMLTAG)?.split(\" \").map((x: string) => +x);\r\n }\r\n\r\n if (lowerCornerArray?.length === 2 && upperCornerArray?.length === 2)\r\n this.wsg84BoundingBox = MapCartoRectangle.fromDegrees(lowerCornerArray[0], lowerCornerArray[1], upperCornerArray[0], upperCornerArray[1]);\r\n\r\n // If we could not initialized WSG84 bounding box, attempt to initialized it from Bounding Box\r\n if (!this.wsg84BoundingBox && (this.boundingBox?.crs?.includes(\"EPSG:4326\") || this.boundingBox?.crs?.includes(\"CRS:84\"))) {\r\n const range = this.boundingBox.range;\r\n if (range)\r\n this.wsg84BoundingBox = MapCartoRectangle.fromDegrees(range.low.x, range.low.y, range.high.x, range.high.y);\r\n else\r\n this.wsg84BoundingBox = MapCartoRectangle.createMaximum();\r\n }\r\n\r\n // Style\r\n const style = elem.getElementsByTagName(\"Style\");\r\n if (style.length > 0) {\r\n for (const styleElem of style)\r\n this.styles.push(new Style(styleElem));\r\n }\r\n\r\n // TileMatrixSetLink\r\n // TileMatrixSetLink is mandatory on Layer, if it doesn't exists, something is OFF with the capability.\r\n const tileMatrixSetLink = elem.getElementsByTagName(XmlConstants.TILEMATRIXSETLINK_XMLTAG);\r\n\r\n if (tileMatrixSetLink.length === 0)\r\n throw new Error(\"No matrix set link found for WMTS layer\");\r\n\r\n for (const tmsl of tileMatrixSetLink)\r\n this.tileMatrixSetLinks.push(new TileMatrixSetLink(tmsl));\r\n\r\n // ResourceURL are optional. It can be repeated for different resource types.\r\n const resourceUrls = elem.getElementsByTagName(XmlConstants.RESOURCEURL_XMLTAG);\r\n\r\n for (const url of resourceUrls)\r\n this.resourceUrls.push(new ResourceURL(url));\r\n }\r\n }\r\n}\r\n\r\nexport class WmtsCapabilities {\r\n private static _capabilitiesCache = new Map<string, WmtsCapabilities | undefined>();\r\n\r\n public readonly version?: string;\r\n public readonly serviceIdentification?: WmtsCapability.ServiceIdentification;\r\n public readonly contents?: WmtsCapability.Contents;\r\n\r\n public readonly operationsMetadata?: WmtsCapability.OperationMetadata;\r\n\r\n constructor(xmlDoc: Document) {\r\n\r\n const capabilities = xmlDoc.getElementsByTagName(\"Capabilities\");\r\n if (capabilities.length !== 0) {\r\n const capability = capabilities[0];\r\n this.version = capability.getAttribute(\"version\") ?? undefined;\r\n\r\n // Service Identification\r\n const serviceIdentification = capability.getElementsByTagName(OwsConstants.SERVICEIDENTIFICATION_XMLTAG);\r\n if (serviceIdentification.length > 0)\r\n this.serviceIdentification = new WmtsCapability.ServiceIdentification(serviceIdentification[0]);\r\n\r\n // Operations metadata\r\n const operationsMetadata = capability.getElementsByTagName(OwsConstants.OPERATIONSMETADATA_XMLTAG);\r\n if (operationsMetadata.length > 0)\r\n this.operationsMetadata = new WmtsCapability.OperationMetadata(operationsMetadata[0]);\r\n\r\n // Contents\r\n const content = capability.getElementsByTagName(\"Contents\");\r\n if (content.length > 0)\r\n this.contents = new WmtsCapability.Contents(content[0]);\r\n }\r\n }\r\n\r\n public static createFromXml(xmlCapabilities: string): WmtsCapabilities | undefined {\r\n const parser = new DOMParser();\r\n const xmlDoc = parser.parseFromString(xmlCapabilities, \"text/xml\");\r\n return new WmtsCapabilities(xmlDoc);\r\n }\r\n\r\n public static async create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean, queryParams?: {[key: string]: string}): Promise<WmtsCapabilities | undefined> {\r\n if (!ignoreCache) {\r\n const cached = WmtsCapabilities._capabilitiesCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n const tmpUrl = new URL(WmsUtilities.getBaseUrl(url));\r\n tmpUrl.searchParams.append(\"request\", \"GetCapabilities\");\r\n tmpUrl.searchParams.append(\"service\", \"WMTS\");\r\n if (queryParams) {\r\n Object.keys(queryParams).forEach((paramKey) => {\r\n if (!tmpUrl.searchParams.has(paramKey))\r\n tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);\r\n });\r\n }\r\n\r\n const xmlCapabilities = await WmsUtilities.fetchXml(tmpUrl.toString(), credentials);\r\n if (!xmlCapabilities)\r\n return undefined;\r\n\r\n const capabilities = WmtsCapabilities.createFromXml(xmlCapabilities);\r\n if (capabilities)\r\n WmtsCapabilities._capabilitiesCache.set(url, capabilities);\r\n\r\n return capabilities;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"WmtsCapabilities.js","sourceRoot":"","sources":["../../../../../src/internal/tile/map/WmtsCapabilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAgC,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEvG,IAAK,YA0BJ;AA1BD,WAAK,YAAY;IACf,gDAAgC,CAAA;IAChC,kEAAkD,CAAA;IAClD,0DAA0C,CAAA;IAC1C,sDAAsC,CAAA;IACtC,oDAAoC,CAAA;IACp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gBAC5C,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC;oBACpC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;QACnC,iGAAiG;QACjG,gGAAgG;QAChG,0EAA0E;QAC1E,MAAM,eAAe,GAAG,CAAC,SAAS,CAAC,sBAAsB,EAAE,qBAAqB,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QAClG,IAAI,CAAC,WAAW,IAAI,CAAC,eAAe,IAAI,CAAC,WAAW,EAAE,CAAC;YACrD,MAAM,MAAM,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACjE,IAAI,MAAM,KAAK,SAAS;gBACtB,OAAO,MAAM,CAAC;QAClB,CAAC;QAED,MAAM,eAAe,GAAG,MAAM,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,IAAI,MAAM,EAAE,QAAQ,EAAE,QAAQ,IAAI,GAAG,EAAE,eAAe,EAAE,CAAC,CAAC;QAClK,IAAI,CAAC,eAAe;YAClB,OAAO,SAAS,CAAC;QAEnB,MAAM,YAAY,GAAG,gBAAgB,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACrE,IAAI,YAAY,IAAI,CAAC,WAAW,IAAI,CAAC,eAAe;YAClD,gBAAgB,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAElE,OAAO,YAAY,CAAC;IACtB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Views\r\n */\r\n\r\nimport { expectDefined } from \"@itwin/core-bentley\";\r\nimport { Point2d, Range2d } from \"@itwin/core-geometry\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { MapCartoRectangle, WmsCapabilitiesCreateOptions, WmsUtilities } from \"../../../tile/internal\";\r\n\r\nenum OwsConstants {\r\n ABSTRACT_XMLTAG = \"ows:Abstract\",\r\n ACCESSCONSTRAINTS_XMLTAG = \"ows:AccessConstraints\",\r\n ALLOWEDVALUES_XMLTAG = \"ows:AllowedValues\",\r\n BOUNDINGBOX_XMLTAG = \"ows:BoundingBox\",\r\n CONSTRAINT_XMLTAG = \"ows:Constraint\",\r\n DCP_XMLTAG = \"ows:DCP\",\r\n FEES_XMLTAG = \"ows:Fees\",\r\n GET_XMLTAG = \"ows:Get\",\r\n HTTP_XMLTAG = \"ows:HTTP\",\r\n IDENTIFIER_XMLTAG = \"ows:Identifier\",\r\n KEYWORDS_XMLTAG = \"ows:Keywords\",\r\n KEYWORD_XMLTAG = \"ows:Keyword\",\r\n LOWERCORNER_XMLTAG = \"ows:LowerCorner\",\r\n OPERATION_XMLTAG = \"ows:Operation\",\r\n OPERATIONSMETADATA_XMLTAG = \"ows:OperationsMetadata\",\r\n POST_XMLTAG = \"ows:Post\",\r\n SERVICEIDENTIFICATION_XMLTAG = \"ows:ServiceIdentification\",\r\n SERVICETYPE_XMLTAG = \"ows:ServiceType\",\r\n SERVICETYPEVERSION_XMLTAG = \"ows:ServiceTypeVersion\",\r\n SUPPORTEDCRS_XMLTAG = \"ows:SupportedCRS\",\r\n TITLE_XMLTAG = \"ows:Title\",\r\n UPPERCORNER_XMLTAG = \"ows:UpperCorner\",\r\n VALUE_XMLTAG = \"ows:Value\",\r\n WGS84BOUNDINGBOX_XMLTAG = \"ows:WGS84BoundingBox\"\r\n\r\n}\r\n\r\nenum XmlConstants {\r\n // Operations names\r\n GETCAPABILITIES = \"GetCapabilities\",\r\n GETTILE = \"GetTile\",\r\n GETFEATUREINFO = \"GetFeatureInfo\",\r\n\r\n MATRIXWIDTH_XMLTAG = \"MatrixWidth\",\r\n MATRIXHEIGHT_XMLTAG = \"MatrixHeight\",\r\n SCALEDENOMINATOR_XMLTAG = \"ScaleDenominator\",\r\n\r\n TILEHEIGHT_XMLTAG = \"TileHeight\",\r\n TILEMATRIX_XMLTAG = \"TileMatrix\",\r\n TILEMATRIXSETLINK_XMLTAG = \"TileMatrixSetLink\",\r\n RESOURCEURL_XMLTAG = \"ResourceURL\",\r\n TILEWIDTH_XMLTAG = \"TileWidth\",\r\n TOPLEFTCORNER_XMLTAG = \"TopLeftCorner\",\r\n WELLKNOWNSCALESET_XMLTAG = \"WellKnownScaleSet\",\r\n\r\n CONSTRAINT_NAME_FILTER = \"Encoding\",\r\n STYLE_ISDEFAULT = \"IsDefault\",\r\n XLINK_HREF = \"xlink:href\",\r\n}\r\n\r\nexport enum WmtsConstants {\r\n GOOGLEMAPS_LEVEL0_SCALE_DENOM = 559082264.0287178,\r\n GOOGLEMAPS_COMPATIBLE_WELLKNOWNNAME = \"googlemapscompatible\",\r\n}\r\n\r\n/**\r\n * Utility function to extract an element' text content\r\n * @return An element's text content, default to provided defaultTest value if no text is available.\r\n * @param url server URL to address the request\r\n */\r\nconst getElementTextContent = (elem: Element, qualifiedName: string, defaultText?: string) => {\r\n\r\n const tmpElem = elem.getElementsByTagName(qualifiedName);\r\n if (tmpElem.length > 0) {\r\n return tmpElem[0].textContent ?? defaultText;\r\n } else\r\n return defaultText;\r\n\r\n};\r\n\r\n/** Encapsulation of the capabilities for an WMTS server\r\n */\r\nexport namespace WmtsCapability {\r\n export class ServiceIdentification {\r\n public readonly abstract?: string;\r\n public readonly accessConstraints?: string;\r\n public readonly fees?: string;\r\n public readonly serviceType?: string;\r\n public readonly serviceTypeVersion?: string;\r\n public readonly title?: string;\r\n public readonly keywords?: string[];\r\n\r\n constructor(elem: Element) {\r\n this.abstract = getElementTextContent(elem, OwsConstants.ABSTRACT_XMLTAG);\r\n this.serviceType = getElementTextContent(elem, OwsConstants.SERVICETYPE_XMLTAG);\r\n this.serviceTypeVersion = getElementTextContent(elem, OwsConstants.SERVICETYPEVERSION_XMLTAG);\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n\r\n const keywords = elem.getElementsByTagName(OwsConstants.KEYWORDS_XMLTAG);\r\n if (keywords.length > 0) {\r\n const keyword = keywords[0].getElementsByTagName(OwsConstants.KEYWORD_XMLTAG);\r\n this.keywords = [];\r\n for (const keyworkElem of keyword) {\r\n const keyWordText = keyworkElem.textContent;\r\n if (keyWordText)\r\n this.keywords.push(keyWordText);\r\n }\r\n }\r\n\r\n this.accessConstraints = getElementTextContent(elem, OwsConstants.ACCESSCONSTRAINTS_XMLTAG);\r\n\r\n this.fees = getElementTextContent(elem, OwsConstants.FEES_XMLTAG);\r\n }\r\n }\r\n\r\n export class OperationMetadata {\r\n private _getCapabilities?: Operation;\r\n public get getCapabilities(): Operation | undefined { return this._getCapabilities; }\r\n\r\n private _getFeatureInfo?: Operation;\r\n public get getFeatureInfo(): Operation | undefined { return this._getFeatureInfo; }\r\n\r\n private _getTile?: Operation;\r\n public get getTile(): Operation | undefined { return this._getTile; }\r\n\r\n private readOperation(op: Element) {\r\n const nameAttr = op.attributes.getNamedItem(\"name\");\r\n if (!nameAttr)\r\n return;\r\n\r\n if (nameAttr.textContent === XmlConstants.GETCAPABILITIES) {\r\n this._getCapabilities = new Operation(op);\r\n } else if (nameAttr.textContent === XmlConstants.GETTILE) {\r\n this._getTile = new Operation(op);\r\n } else if (nameAttr.textContent === XmlConstants.GETFEATUREINFO) {\r\n this._getFeatureInfo = new Operation(op);\r\n }\r\n }\r\n\r\n constructor(elem: Element) {\r\n const operation = elem.getElementsByTagName(OwsConstants.OPERATION_XMLTAG);\r\n if (operation.length > 0) {\r\n for (const op of operation) {\r\n this.readOperation(op);\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class HttpDcp {\r\n public readonly url?: string;\r\n public readonly constraintName?: string;\r\n\r\n // For simplicity of use we create a 'static' encoding property instead of having\r\n // a generic constraint data model.\r\n // We make sure the constraint name is 'encoding' related.\r\n public readonly encoding?: string;\r\n\r\n constructor(elem: Element) {\r\n const url = elem.getAttribute(XmlConstants.XLINK_HREF);\r\n if (url)\r\n this.url = url ?? \"\";\r\n\r\n const constraint = elem.getElementsByTagName(OwsConstants.CONSTRAINT_XMLTAG);\r\n if (constraint.length > 0) {\r\n this.constraintName = constraint[0].getAttribute(\"name\") ?? \"\";\r\n if (this.constraintName?.endsWith(XmlConstants.CONSTRAINT_NAME_FILTER)) {\r\n const allowedValues = constraint[0].getElementsByTagName(OwsConstants.ALLOWEDVALUES_XMLTAG);\r\n if (allowedValues.length > 0) {\r\n this.encoding = getElementTextContent(allowedValues[0], OwsConstants.VALUE_XMLTAG);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class Operation {\r\n public readonly name?: string;\r\n private _getDcpHttp?: HttpDcp[];\r\n public get getDcpHttp(): HttpDcp[] | undefined { return this._getDcpHttp; }\r\n private _postDcpHttp?: HttpDcp[];\r\n public get postDcpHttp(): HttpDcp[] | undefined { return this._postDcpHttp; }\r\n\r\n constructor(elem: Element) {\r\n const name = elem.getAttribute(\"name\");\r\n if (name)\r\n this.name = name;\r\n\r\n const dcp = elem.getElementsByTagName(OwsConstants.DCP_XMLTAG);\r\n if (!dcp || dcp.length === 0)\r\n return;\r\n\r\n const dcpHttp = dcp[0].getElementsByTagName(OwsConstants.HTTP_XMLTAG);\r\n if (!dcpHttp || dcpHttp.length === 0)\r\n return;\r\n\r\n const get = dcpHttp[0].getElementsByTagName(OwsConstants.GET_XMLTAG);\r\n if (get.length > 0) {\r\n this._getDcpHttp = [];\r\n\r\n for (const getItem of get) {\r\n this._getDcpHttp?.push(new HttpDcp(getItem));\r\n }\r\n }\r\n\r\n const post = dcpHttp[0].getElementsByTagName(OwsConstants.POST_XMLTAG);\r\n if (post.length > 0) {\r\n this._postDcpHttp = [];\r\n\r\n for (const postItem of post) {\r\n this._postDcpHttp?.push(new HttpDcp(postItem));\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class Contents {\r\n public readonly layers: Layer[] = [];\r\n public readonly tileMatrixSets: TileMatrixSet[] = [];\r\n\r\n constructor(elem: Element) {\r\n // Layers\r\n const layer = elem.getElementsByTagName(\"Layer\");\r\n if (layer) {\r\n for (const layerElem of layer)\r\n this.layers.push(new Layer(layerElem));\r\n }\r\n\r\n // TileMatrixSet\r\n const tms = elem.querySelectorAll(\"Contents > TileMatrixSet\");\r\n if (tms) {\r\n for (const tmsElem of tms)\r\n this.tileMatrixSets.push(new TileMatrixSet(tmsElem));\r\n }\r\n\r\n }\r\n\r\n public getGoogleMapsCompatibleTileMatrixSet(): TileMatrixSet[] {\r\n const googleMapsTms: TileMatrixSet[] = [];\r\n this.tileMatrixSets.forEach((tms) => {\r\n if (tms.wellKnownScaleSet?.toLowerCase().includes(WmtsConstants.GOOGLEMAPS_COMPATIBLE_WELLKNOWNNAME))\r\n googleMapsTms.push(tms);\r\n\r\n // In case wellKnownScaleSet was not been set properly, infer from scaleDenominator\r\n // Note: some servers are quite inaccurate in their scale values, hence I used a delta value of 1.\r\n else if (tms.tileMatrix.length > 0\r\n && Math.abs(tms.tileMatrix[0].scaleDenominator - WmtsConstants.GOOGLEMAPS_LEVEL0_SCALE_DENOM) < 1\r\n && (tms.supportedCrs.includes(\"3857\") || tms.supportedCrs.includes(\"900913\"))\r\n )\r\n googleMapsTms.push(tms);\r\n });\r\n return googleMapsTms;\r\n }\r\n\r\n public getEpsg4326CompatibleTileMatrixSet(): TileMatrixSet[] {\r\n return this.tileMatrixSets.filter((tms) => tms.supportedCrs.includes(\"4326\"));\r\n }\r\n }\r\n\r\n export class Style {\r\n public readonly isDefault: boolean = false;\r\n public readonly title?: string;\r\n public readonly identifier?: string;\r\n // TODO: LegendURL\r\n\r\n constructor(elem: Element) {\r\n if (!elem)\r\n return;\r\n\r\n const isDefault = elem.getAttribute(\"isDefault\");\r\n if (isDefault)\r\n this.isDefault = isDefault.toLowerCase() === \"true\";\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG);\r\n }\r\n }\r\n\r\n export class BoundingBox {\r\n public readonly crs?: string;\r\n public readonly range?: Range2d;\r\n\r\n constructor(elem: Element) {\r\n this.crs = elem.getAttribute(\"crs\") ?? undefined;\r\n\r\n const lowerCorner = getElementTextContent(elem, OwsConstants.LOWERCORNER_XMLTAG);\r\n const upperCorner = getElementTextContent(elem, OwsConstants.UPPERCORNER_XMLTAG);\r\n if (lowerCorner && upperCorner) {\r\n const lowerCornerArray = lowerCorner?.split(\" \").map((x: string) => +x);\r\n const upperCornerArray = upperCorner?.split(\" \").map((x: string) => +x);\r\n if (lowerCornerArray && lowerCornerArray.length === 2 && upperCornerArray && upperCornerArray.length === 2)\r\n this.range = Range2d.createXYXY(lowerCornerArray[0], lowerCornerArray[1], upperCornerArray[0], upperCornerArray[1]);\r\n }\r\n }\r\n }\r\n\r\n export class TileMatrixSetLimits {\r\n public limits?: Range2d;\r\n public tileMatrix?: string;\r\n\r\n constructor(elem: Element) {\r\n\r\n this.tileMatrix = getElementTextContent(elem, \"TileMatrix\");\r\n\r\n const minTileRow = getElementTextContent(elem, \"MinTileRow\");\r\n const maxTileRow = getElementTextContent(elem, \"MaxTileRow\");\r\n const minTileCol = getElementTextContent(elem, \"MinTileCol\");\r\n const maxTileCol = getElementTextContent(elem, \"MaxTileCol\");\r\n\r\n if (minTileRow !== undefined && maxTileRow !== undefined && minTileCol !== undefined && maxTileCol)\r\n this.limits = Range2d.createXYXY(Number(minTileCol), Number(minTileRow), Number(maxTileCol), Number(maxTileRow));\r\n }\r\n }\r\n\r\n export class TileMatrixSetLink {\r\n public readonly tileMatrixSet: string;\r\n public readonly tileMatrixSetLimits = new Array<TileMatrixSetLimits>();\r\n\r\n constructor(elem: Element) {\r\n\r\n this.tileMatrixSet = expectDefined(getElementTextContent(elem, \"TileMatrixSet\", \"\"));\r\n\r\n const tileMatrixLimitsRoot = elem.getElementsByTagName(\"TileMatrixSetLimits\");\r\n if (tileMatrixLimitsRoot.length > 0) {\r\n const tileMatrixLimits = tileMatrixLimitsRoot[0].getElementsByTagName(\"TileMatrixLimits\");\r\n for (const tmsl of tileMatrixLimits) {\r\n this.tileMatrixSetLimits.push(new TileMatrixSetLimits(tmsl));\r\n }\r\n }\r\n }\r\n }\r\n\r\n export class ResourceURL {\r\n public readonly format: string;\r\n public readonly resourceType: string\r\n public readonly template: string;\r\n\r\n constructor(elem: Element) {\r\n this.format = elem.getAttribute(\"format\") ?? \"\";\r\n this.resourceType = elem.getAttribute(\"resourceType\") ?? \"\";\r\n this.template = elem.getAttribute(\"template\") ?? \"\";\r\n }\r\n }\r\n\r\n export class TileMatrixSet {\r\n public readonly identifier: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly supportedCrs: string;\r\n public readonly wellKnownScaleSet: string;\r\n public readonly tileMatrix: TileMatrix[] = [];\r\n\r\n constructor(elem: Element) {\r\n const identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG);\r\n if (identifier)\r\n this.identifier = identifier;\r\n else\r\n throw new Error(\"No Identifier found.\");\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.abstract = getElementTextContent(elem, OwsConstants.ABSTRACT_XMLTAG);\r\n\r\n const supportedCrs = getElementTextContent(elem, OwsConstants.SUPPORTEDCRS_XMLTAG);\r\n if (supportedCrs)\r\n this.supportedCrs = supportedCrs;\r\n else\r\n throw new Error(\"No supported CRS found.\");\r\n\r\n this.wellKnownScaleSet = expectDefined(getElementTextContent(elem, XmlConstants.WELLKNOWNSCALESET_XMLTAG, \"\"));\r\n\r\n // TileMatrix:\r\n // TileMatrix is mandatory on TileMatrixSet, if it doesn't exists, something is OFF with the capability.\r\n const tileMatrix = elem.getElementsByTagName(XmlConstants.TILEMATRIX_XMLTAG);\r\n if (tileMatrix.length === 0)\r\n throw new Error(\"No matrix set link found for WMTS layer\");\r\n\r\n for (const tm of tileMatrix) {\r\n this.tileMatrix.push(new TileMatrix(tm));\r\n }\r\n }\r\n }\r\n\r\n export class TileMatrix {\r\n public readonly identifier: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly scaleDenominator: number;\r\n public readonly topLeftCorner: Point2d;\r\n public readonly tileWidth: number;\r\n public readonly tileHeight: number;\r\n public readonly matrixWidth: number;\r\n public readonly matrixHeight: number;\r\n\r\n constructor(elem: Element) {\r\n const identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG, \"\");\r\n if (identifier)\r\n this.identifier = identifier;\r\n else\r\n throw new Error(\"No Identifier found.\");\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.abstract = getElementTextContent(elem, OwsConstants.ABSTRACT_XMLTAG);\r\n\r\n // Scale denominator\r\n const scaleDenom = getElementTextContent(elem, XmlConstants.SCALEDENOMINATOR_XMLTAG, \"\");\r\n if (!scaleDenom)\r\n throw new Error(\"No scale denominator found on TileMatrix.\");\r\n this.scaleDenominator = +scaleDenom;\r\n\r\n // Top left corner\r\n const topLeftCorner = getElementTextContent(elem, XmlConstants.TOPLEFTCORNER_XMLTAG, \"\")?.split(\" \").map((x: string) => +x);\r\n if (topLeftCorner?.length !== 2)\r\n throw new Error(\"No TopLeftCorner found on TileMatrix.\");\r\n this.topLeftCorner = Point2d.create(topLeftCorner[0], topLeftCorner[1]);\r\n\r\n // Tile Width\r\n const tileWidth = getElementTextContent(elem, XmlConstants.TILEWIDTH_XMLTAG);\r\n if (!tileWidth)\r\n throw new Error(\"No tile width found on TileMatrix.\");\r\n this.tileWidth = +tileWidth;\r\n\r\n // Tile Height\r\n const tileHeight = getElementTextContent(elem, XmlConstants.TILEHEIGHT_XMLTAG);\r\n if (!tileHeight)\r\n throw new Error(\"No tile height found on TileMatrix.\");\r\n this.tileHeight = +tileHeight;\r\n\r\n // Matrix Width\r\n const matrixWidth = getElementTextContent(elem, XmlConstants.MATRIXWIDTH_XMLTAG);\r\n if (!matrixWidth)\r\n throw new Error(\"No tile width found on TileMatrix.\");\r\n this.matrixWidth = +matrixWidth;\r\n\r\n // Matrix Height\r\n const matrixHeight = getElementTextContent(elem, XmlConstants.MATRIXHEIGHT_XMLTAG);\r\n if (!matrixHeight)\r\n throw new Error(\"No tile height found on TileMatrix.\");\r\n this.matrixHeight = +matrixHeight;\r\n }\r\n }\r\n\r\n export class Layer {\r\n public readonly identifier: string;\r\n public readonly title?: string;\r\n public readonly abstract?: string;\r\n public readonly format?: string;\r\n public readonly wsg84BoundingBox?: MapCartoRectangle;\r\n public readonly boundingBox?: BoundingBox;\r\n public readonly styles: Style[] = [];\r\n public readonly tileMatrixSetLinks: TileMatrixSetLink[] = [];\r\n public readonly resourceUrls: ResourceURL[] = [];\r\n\r\n constructor(elem: Element) {\r\n\r\n const identifier = getElementTextContent(elem, OwsConstants.IDENTIFIER_XMLTAG, \"\");\r\n if (identifier)\r\n this.identifier = identifier;\r\n else\r\n throw new Error(\"No Identifier found.\");\r\n\r\n this.title = getElementTextContent(elem, OwsConstants.TITLE_XMLTAG);\r\n this.format = getElementTextContent(elem, \"Format\");\r\n\r\n // BoundingBox\r\n const boundingBox = elem.getElementsByTagName(OwsConstants.BOUNDINGBOX_XMLTAG);\r\n if (boundingBox.length > 0)\r\n this.boundingBox = new BoundingBox(boundingBox[0]);\r\n\r\n let lowerCornerArray: number[] | undefined, upperCornerArray: number[] | undefined;\r\n const bbox = elem.getElementsByTagName(OwsConstants.WGS84BOUNDINGBOX_XMLTAG);\r\n if (bbox.length > 0) {\r\n lowerCornerArray = getElementTextContent(bbox[0], OwsConstants.LOWERCORNER_XMLTAG)?.split(\" \").map((x: string) => +x);\r\n upperCornerArray = getElementTextContent(bbox[0], OwsConstants.UPPERCORNER_XMLTAG)?.split(\" \").map((x: string) => +x);\r\n }\r\n\r\n if (lowerCornerArray?.length === 2 && upperCornerArray?.length === 2)\r\n this.wsg84BoundingBox = MapCartoRectangle.fromDegrees(lowerCornerArray[0], lowerCornerArray[1], upperCornerArray[0], upperCornerArray[1]);\r\n\r\n // If we could not initialized WSG84 bounding box, attempt to initialized it from Bounding Box\r\n if (!this.wsg84BoundingBox && (this.boundingBox?.crs?.includes(\"EPSG:4326\") || this.boundingBox?.crs?.includes(\"CRS:84\"))) {\r\n const range = this.boundingBox.range;\r\n if (range)\r\n this.wsg84BoundingBox = MapCartoRectangle.fromDegrees(range.low.x, range.low.y, range.high.x, range.high.y);\r\n else\r\n this.wsg84BoundingBox = MapCartoRectangle.createMaximum();\r\n }\r\n\r\n // Style\r\n const style = elem.getElementsByTagName(\"Style\");\r\n if (style.length > 0) {\r\n for (const styleElem of style)\r\n this.styles.push(new Style(styleElem));\r\n }\r\n\r\n // TileMatrixSetLink\r\n // TileMatrixSetLink is mandatory on Layer, if it doesn't exists, something is OFF with the capability.\r\n const tileMatrixSetLink = elem.getElementsByTagName(XmlConstants.TILEMATRIXSETLINK_XMLTAG);\r\n\r\n if (tileMatrixSetLink.length === 0)\r\n throw new Error(\"No matrix set link found for WMTS layer\");\r\n\r\n for (const tmsl of tileMatrixSetLink)\r\n this.tileMatrixSetLinks.push(new TileMatrixSetLink(tmsl));\r\n\r\n // ResourceURL are optional. It can be repeated for different resource types.\r\n const resourceUrls = elem.getElementsByTagName(XmlConstants.RESOURCEURL_XMLTAG);\r\n\r\n for (const url of resourceUrls)\r\n this.resourceUrls.push(new ResourceURL(url));\r\n }\r\n }\r\n}\r\n\r\nexport class WmtsCapabilities {\r\n private static _capabilitiesCache = new Map<string, WmtsCapabilities | undefined>();\r\n\r\n public readonly version?: string;\r\n public readonly serviceIdentification?: WmtsCapability.ServiceIdentification;\r\n public readonly contents?: WmtsCapability.Contents;\r\n\r\n public readonly operationsMetadata?: WmtsCapability.OperationMetadata;\r\n\r\n constructor(xmlDoc: Document) {\r\n\r\n const capabilities = xmlDoc.getElementsByTagName(\"Capabilities\");\r\n if (capabilities.length !== 0) {\r\n const capability = capabilities[0];\r\n this.version = capability.getAttribute(\"version\") ?? undefined;\r\n\r\n // Service Identification\r\n const serviceIdentification = capability.getElementsByTagName(OwsConstants.SERVICEIDENTIFICATION_XMLTAG);\r\n if (serviceIdentification.length > 0)\r\n this.serviceIdentification = new WmtsCapability.ServiceIdentification(serviceIdentification[0]);\r\n\r\n // Operations metadata\r\n const operationsMetadata = capability.getElementsByTagName(OwsConstants.OPERATIONSMETADATA_XMLTAG);\r\n if (operationsMetadata.length > 0)\r\n this.operationsMetadata = new WmtsCapability.OperationMetadata(operationsMetadata[0]);\r\n\r\n // Contents\r\n const content = capability.getElementsByTagName(\"Contents\");\r\n if (content.length > 0)\r\n this.contents = new WmtsCapability.Contents(content[0]);\r\n }\r\n }\r\n\r\n public static createFromXml(xmlCapabilities: string): WmtsCapabilities | undefined {\r\n const parser = new DOMParser();\r\n const xmlDoc = parser.parseFromString(xmlCapabilities, \"text/xml\");\r\n return new WmtsCapabilities(xmlDoc);\r\n }\r\n\r\n public static async create(url: string, options?: WmsCapabilitiesCreateOptions): Promise<WmtsCapabilities | undefined> {\r\n const { credentials, ignoreCache, queryParams, formatId, layerUrl, layerProperties } = options ?? {};\r\n const tmpUrl = new URL(WmsUtilities.getBaseUrl(url));\r\n tmpUrl.searchParams.append(\"request\", \"GetCapabilities\");\r\n tmpUrl.searchParams.append(\"service\", \"WMTS\");\r\n if (queryParams) {\r\n Object.keys(queryParams).forEach((paramKey) => {\r\n if (!tmpUrl.searchParams.has(paramKey))\r\n tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);\r\n });\r\n }\r\n const cacheKey = tmpUrl.toString();\r\n // The cache never contains credentialed results (see the write below), so a credentialed request\r\n // must not be served a cached public document either; responses customized by the fetch handler\r\n // must not be shared with or served from differently-customized requests.\r\n const hasFetchHandler = (IModelApp.mapLayerFormatRegistry?.mapLayerFetchHandlers.length ?? 0) > 0;\r\n if (!ignoreCache && !hasFetchHandler && !credentials) {\r\n const cached = WmtsCapabilities._capabilitiesCache.get(cacheKey);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n const xmlCapabilities = await WmsUtilities.fetchXml(tmpUrl.toString(), { credentials, formatId: formatId ?? \"WMTS\", layerUrl: layerUrl ?? url, layerProperties });\r\n if (!xmlCapabilities)\r\n return undefined;\r\n\r\n const capabilities = WmtsCapabilities.createFromXml(xmlCapabilities);\r\n if (capabilities && !credentials && !hasFetchHandler)\r\n WmtsCapabilities._capabilitiesCache.set(cacheKey, capabilities);\r\n\r\n return capabilities;\r\n }\r\n}\r\n"]}