@itwin/core-frontend 4.3.0-dev.31 → 4.3.0-dev.34
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.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/extension/ExtensionRuntime.js +1 -0
- package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
- package/lib/cjs/render/webgl/BranchState.d.ts.map +1 -1
- package/lib/cjs/render/webgl/BranchState.js +10 -2
- package/lib/cjs/render/webgl/BranchState.js.map +1 -1
- package/lib/cjs/render/webgl/Graphic.d.ts.map +1 -1
- package/lib/cjs/render/webgl/Graphic.js +2 -0
- package/lib/cjs/render/webgl/Graphic.js.map +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.d.ts.map +1 -1
- package/lib/cjs/render/webgl/SurfaceGeometry.js +28 -2
- package/lib/cjs/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/cjs/render/webgl/ThematicUniforms.d.ts.map +1 -1
- package/lib/cjs/render/webgl/ThematicUniforms.js +6 -8
- package/lib/cjs/render/webgl/ThematicUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Surface.js +8 -12
- package/lib/cjs/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/Thematic.js +10 -8
- package/lib/cjs/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts +5 -3
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.js +4 -16
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts +27 -12
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +25 -17
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js +6 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +4 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/TileUrlImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/TileUrlImageryProvider.js +2 -1
- package/lib/cjs/tile/map/ImageryProviders/TileUrlImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +4 -2
- package/lib/cjs/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +5 -4
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +16 -2
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js +33 -10
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts +3 -4
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +32 -4
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +5 -0
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +41 -0
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.d.ts +26 -7
- package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js +22 -4
- package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.d.ts +3 -1
- package/lib/cjs/tile/map/WmsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmsCapabilities.js +11 -2
- package/lib/cjs/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts +3 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +11 -2
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/extension/ExtensionRuntime.js +2 -1
- package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
- package/lib/esm/render/webgl/BranchState.d.ts.map +1 -1
- package/lib/esm/render/webgl/BranchState.js +10 -2
- package/lib/esm/render/webgl/BranchState.js.map +1 -1
- package/lib/esm/render/webgl/Graphic.d.ts.map +1 -1
- package/lib/esm/render/webgl/Graphic.js +2 -0
- package/lib/esm/render/webgl/Graphic.js.map +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.d.ts.map +1 -1
- package/lib/esm/render/webgl/SurfaceGeometry.js +29 -3
- package/lib/esm/render/webgl/SurfaceGeometry.js.map +1 -1
- package/lib/esm/render/webgl/ThematicUniforms.d.ts.map +1 -1
- package/lib/esm/render/webgl/ThematicUniforms.js +8 -10
- package/lib/esm/render/webgl/ThematicUniforms.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Surface.js +8 -12
- package/lib/esm/render/webgl/glsl/Surface.js.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/Thematic.js +10 -8
- package/lib/esm/render/webgl/glsl/Thematic.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts +5 -3
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.js +5 -17
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts +27 -12
- package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +25 -17
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js +6 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +4 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/TileUrlImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/TileUrlImageryProvider.js +2 -1
- package/lib/esm/tile/map/ImageryProviders/TileUrlImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +4 -2
- package/lib/esm/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +5 -4
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +16 -2
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js +34 -11
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts +3 -4
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +33 -5
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +5 -0
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +41 -0
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.d.ts +26 -7
- package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.js +22 -4
- package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.d.ts +3 -1
- package/lib/esm/tile/map/WmsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmsCapabilities.js +11 -2
- package/lib/esm/tile/map/WmsCapabilities.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts +3 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +11 -2
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/public/scripts/parse-imdl-worker.js +1 -1
- package/lib/workers/webpack/parse-imdl-worker.js +1 -1
- package/package.json +18 -18
|
@@ -41,21 +41,22 @@ var MapLayerSourceStatus;
|
|
|
41
41
|
* @public
|
|
42
42
|
*/
|
|
43
43
|
class MapLayerSource {
|
|
44
|
-
constructor(formatId = "WMS", name, url, baseMap = false, transparentBackground = true) {
|
|
44
|
+
constructor(formatId = "WMS", name, url, baseMap = false, transparentBackground = true, savedQueryParams) {
|
|
45
45
|
this.baseMap = false;
|
|
46
46
|
this.formatId = formatId;
|
|
47
47
|
this.name = name;
|
|
48
48
|
this.url = url;
|
|
49
49
|
this.baseMap = baseMap;
|
|
50
50
|
this.transparentBackground = transparentBackground;
|
|
51
|
+
this.savedQueryParams = savedQueryParams;
|
|
51
52
|
}
|
|
52
53
|
static fromJSON(json) {
|
|
53
54
|
if (json === undefined)
|
|
54
55
|
return undefined;
|
|
55
|
-
return new MapLayerSource(json.formatId, json.name, json.url, json.baseMap, json.transparentBackground);
|
|
56
|
+
return new MapLayerSource(json.formatId, json.name, json.url, json.baseMap, json.transparentBackground, json.queryParams);
|
|
56
57
|
}
|
|
57
58
|
async validateSource(ignoreCache) {
|
|
58
|
-
return IModelApp_1.IModelApp.mapLayerFormatRegistry.validateSource(
|
|
59
|
+
return IModelApp_1.IModelApp.mapLayerFormatRegistry.validateSource({ source: this, ignoreCache });
|
|
59
60
|
}
|
|
60
61
|
/** @internal*/
|
|
61
62
|
static fromBackgroundMapProps(props) {
|
|
@@ -71,7 +72,7 @@ class MapLayerSource {
|
|
|
71
72
|
return undefined;
|
|
72
73
|
}
|
|
73
74
|
toJSON() {
|
|
74
|
-
return { url: this.url, name: this.name, formatId: this.formatId, transparentBackground: this.transparentBackground };
|
|
75
|
+
return { url: this.url, name: this.name, formatId: this.formatId, transparentBackground: this.transparentBackground, queryParams: this.savedQueryParams };
|
|
75
76
|
}
|
|
76
77
|
toLayerSettings(subLayers) {
|
|
77
78
|
// When MapLayerSetting is created from a MapLayerSource, sub-layers and credentials need to be set separately.
|
|
@@ -79,11 +80,28 @@ class MapLayerSource {
|
|
|
79
80
|
if (this.userName !== undefined || this.password !== undefined) {
|
|
80
81
|
layerSettings?.setCredentials(this.userName, this.password);
|
|
81
82
|
}
|
|
83
|
+
if (this.savedQueryParams) {
|
|
84
|
+
layerSettings.savedQueryParams = { ...this.savedQueryParams };
|
|
85
|
+
}
|
|
86
|
+
if (this.unsavedQueryParams) {
|
|
87
|
+
layerSettings.unsavedQueryParams = { ...this.unsavedQueryParams };
|
|
88
|
+
}
|
|
82
89
|
return layerSettings;
|
|
83
90
|
}
|
|
84
91
|
getCredentials() {
|
|
85
92
|
return this.userName && this.password ? { user: this.userName, password: this.password } : undefined;
|
|
86
93
|
}
|
|
94
|
+
/** Collect all query parameters
|
|
95
|
+
* @beta
|
|
96
|
+
*/
|
|
97
|
+
collectQueryParams() {
|
|
98
|
+
let queryParams = {};
|
|
99
|
+
if (this.savedQueryParams)
|
|
100
|
+
queryParams = { ...this.savedQueryParams };
|
|
101
|
+
if (this.unsavedQueryParams)
|
|
102
|
+
queryParams = { ...queryParams, ...this.unsavedQueryParams };
|
|
103
|
+
return queryParams;
|
|
104
|
+
}
|
|
87
105
|
}
|
|
88
106
|
exports.MapLayerSource = MapLayerSource;
|
|
89
107
|
/** A collection of [[MapLayerSource]] objects.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerSources.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerSources.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqD;AACrD,oDAE4B;AAC5B,wDAA+C;AAC/C,+CAA4C;AAE5C,mDAAyE;AACzE,0CAA2F;AAE3F;;GAEG;AACH,IAAY,oBAkBX;AAlBD,WAAY,oBAAoB;IAC9B,4BAA4B;IAC5B,iEAAK,CAAA;IACL,iEAAiE;IACjE,2FAAkB,CAAA;IAClB,6EAA6E;IAC7E,iFAAa,CAAA;IACb,uDAAuD;IACvD,qFAAe,CAAA;IACf,oEAAoE;IACpE,2EAAU,CAAA;IACV,iEAAiE;IACjE,6EAAW,CAAA;IACX,mDAAmD;IACnD,qGAAuB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c,CAAC,IAAI,IAAI,MAAM,CAAC,GAAG,KAAK,cAAc,CAAC,GAAG,CAAC,CAAC;QACrF,CAAC,CAAC,CAAC;QAEH,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACxD,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAiB,EAAE,CAAiB,EAAE,EAAE,CAAC,IAAA,6BAAc,EAAC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QAC9I,OAAO,eAAe,CAAC,SAAS,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,iBAAiB,CAAC,IAAY;QAC1C,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE;YAC9B,OAAO,KAAK,CAAC;SACd;QAED,mCAAmC;QACnC,MAAM,kBAAkB,GAAG,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC;QACrE,eAAe,CAAC,SAAS,CAAC,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;YACxF,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,kBAAkB,KAAK,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;CACF;AAjID,0CAiIC","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 MapLayers\r\n */\r\n\r\nimport { compareStrings } from \"@itwin/core-bentley\";\r\nimport {\r\n BackgroundMapProvider, BackgroundMapType, BaseMapLayerSettings, DeprecatedBackgroundMapProps, ImageMapLayerSettings, MapSubLayerProps,\r\n} from \"@itwin/core-common\";\r\nimport { Point2d } from \"@itwin/core-geometry\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { request, RequestBasicCredentials } from \"../../request/Request\";\r\nimport { ArcGisUtilities, MapCartoRectangle, MapLayerSourceValidation } from \"../internal\";\r\n\r\n/** Values for return codes from [[MapLayerSource.validateSource]]\r\n * @public\r\n */\r\nexport enum MapLayerSourceStatus {\r\n /** Layer source is valid */\r\n Valid,\r\n /** Authorization has failed when accessing this layer source. */\r\n InvalidCredentials,\r\n /** Provided format id could not be resolved in [[MapLayerFormatRegistry]] */\r\n InvalidFormat,\r\n /** The tiling schema of the source is not supported */\r\n InvalidTileTree,\r\n /** Could not not connect to remote server using the provided URL.*/\r\n InvalidUrl,\r\n /** Authorization is required to access this map layer source. */\r\n RequireAuth,\r\n /** Map-layer coordinate system is not supported */\r\n InvalidCoordinateSystem,\r\n /** Format is not compatible with the URL provided.\r\n */\r\n IncompatibleFormat,\r\n}\r\n\r\n/** JSON representation of a map layer source.\r\n * @see [ImageryMapLayerFormatId]($common)\r\n * @public\r\n */\r\nexport interface MapLayerSourceProps {\r\n /** Identifies the map layers source. Defaults to 'WMS'. */\r\n formatId?: string;\r\n /** Name */\r\n name: string;\r\n /** URL */\r\n url: string;\r\n /** True to indicate background is transparent. Defaults to 'true'. */\r\n transparentBackground?: boolean;\r\n /** Indicate if this source definition should be used as a base map. Defaults to false. */\r\n baseMap?: boolean;\r\n}\r\n\r\n/** A source for map layers. These may be catalogued for convenient use by users or applications.\r\n * @public\r\n */\r\nexport class MapLayerSource {\r\n public formatId: string;\r\n public name: string;\r\n public url: string;\r\n public baseMap = false;\r\n public transparentBackground?: boolean;\r\n public userName?: string;\r\n public password?: string;\r\n\r\n private constructor(formatId = \"WMS\", name: string, url: string, baseMap = false, transparentBackground = true) {\r\n this.formatId = formatId;\r\n this.name = name;\r\n this.url = url;\r\n this.baseMap = baseMap;\r\n this.transparentBackground = transparentBackground;\r\n }\r\n\r\n public static fromJSON(json: MapLayerSourceProps): MapLayerSource | undefined {\r\n if (json === undefined)\r\n return undefined;\r\n\r\n return new MapLayerSource(json.formatId, json.name, json.url, json.baseMap, json.transparentBackground);\r\n }\r\n\r\n public async validateSource(ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n return IModelApp.mapLayerFormatRegistry.validateSource(this.formatId, this.url, this.userName, this.password, ignoreCache);\r\n }\r\n\r\n /** @internal*/\r\n public static fromBackgroundMapProps(props: DeprecatedBackgroundMapProps) {\r\n const provider = BackgroundMapProvider.fromBackgroundMapProps(props);\r\n const layerSettings = BaseMapLayerSettings.fromProvider(provider);\r\n if (undefined !== layerSettings) {\r\n const source = MapLayerSource.fromJSON(layerSettings);\r\n if (source) {\r\n source.baseMap = true;\r\n return source;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n public toJSON() {\r\n return { url: this.url, name: this.name, formatId: this.formatId, transparentBackground: this.transparentBackground };\r\n }\r\n\r\n public toLayerSettings(subLayers?: MapSubLayerProps[]): ImageMapLayerSettings | undefined {\r\n // When MapLayerSetting is created from a MapLayerSource, sub-layers and credentials need to be set separately.\r\n const layerSettings = ImageMapLayerSettings.fromJSON({ ...this, subLayers });\r\n if (this.userName !== undefined || this.password !== undefined) {\r\n layerSettings?.setCredentials(this.userName, this.password);\r\n }\r\n\r\n return layerSettings;\r\n }\r\n\r\n private getCredentials(): RequestBasicCredentials | undefined {\r\n return this.userName && this.password ? { user: this.userName, password: this.password } : undefined;\r\n }\r\n}\r\n\r\n/** A collection of [[MapLayerSource]] objects.\r\n * @beta\r\n */\r\nexport class MapLayerSources {\r\n private static _instance?: MapLayerSources;\r\n private constructor(private _sources: MapLayerSource[]) { }\r\n\r\n public static getInstance() { return MapLayerSources._instance; }\r\n\r\n public findByName(name: string, baseMap: boolean = false): MapLayerSource | undefined {\r\n const nameTest = name.toLowerCase();\r\n for (const source of this._sources)\r\n if (source.baseMap === baseMap && source.name.toLowerCase().indexOf(nameTest) !== -1)\r\n return source;\r\n\r\n return undefined;\r\n }\r\n public get layers(): MapLayerSource[] {\r\n const layers = new Array<MapLayerSource>();\r\n this._sources.forEach((source) => {\r\n if (!source.baseMap)\r\n layers.push(source);\r\n });\r\n\r\n return layers;\r\n }\r\n public get allSource() { return this._sources; }\r\n public get bases(): MapLayerSource[] {\r\n const layers = new Array<MapLayerSource>();\r\n this._sources.forEach((source) => {\r\n if (source.baseMap)\r\n layers.push(source);\r\n });\r\n\r\n return layers;\r\n }\r\n\r\n private static getBingMapLayerSource(): MapLayerSource[] {\r\n const mapLayerSources: MapLayerSource[] = [];\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"BingProvider\", providerData: { mapType: BackgroundMapType.Street } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"BingProvider\", providerData: { mapType: BackgroundMapType.Aerial } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"BingProvider\", providerData: { mapType: BackgroundMapType.Hybrid } })!);\r\n return mapLayerSources;\r\n }\r\n\r\n private static getMapBoxLayerSource(): MapLayerSource[] {\r\n const mapLayerSources: MapLayerSource[] = [];\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"MapBoxProvider\", providerData: { mapType: BackgroundMapType.Street } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"MapBoxProvider\", providerData: { mapType: BackgroundMapType.Aerial } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"MapBoxProvider\", providerData: { mapType: BackgroundMapType.Hybrid } })!);\r\n return mapLayerSources;\r\n }\r\n\r\n public static async create(iModel?: IModelConnection, queryForPublicSources = false, addMapBoxSources = false): Promise<MapLayerSources> {\r\n if (!queryForPublicSources && MapLayerSources._instance)\r\n return MapLayerSources._instance;\r\n\r\n if (!iModel)\r\n iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\r\n\r\n let sourceRange = MapCartoRectangle.createMaximum();\r\n if (iModel) {\r\n const projectCenter = iModel.projectExtents.localXYZToWorld(.5, .5, .5)!;\r\n const cartoCenter = iModel.spatialToCartographicFromEcef(projectCenter);\r\n const globeRange = MapCartoRectangle.createMaximum();\r\n const nearDelta = Point2d.create(globeRange.xLength() / 100, globeRange.yLength() / 100);\r\n sourceRange = MapCartoRectangle.fromRadians(cartoCenter.longitude - nearDelta.x, cartoCenter.latitude - nearDelta.y, cartoCenter.longitude + nearDelta.x, cartoCenter.latitude + nearDelta.y);\r\n }\r\n\r\n const sources = new Array<MapLayerSource>();\r\n const urlSet = new Set<string>();\r\n const addSource = ((source: MapLayerSource) => {\r\n if (!urlSet.has(source.url)) {\r\n sources.push(source);\r\n urlSet.add(source.url);\r\n }\r\n });\r\n\r\n this.getBingMapLayerSource().forEach((source) => {\r\n addSource(source);\r\n });\r\n\r\n if (addMapBoxSources) {\r\n this.getMapBoxLayerSource().forEach((source) => {\r\n addSource(source);\r\n });\r\n }\r\n\r\n if (queryForPublicSources) {\r\n const sourcesJson = await request(`${IModelApp.publicPath}assets/MapLayerSources.json`, \"json\");\r\n\r\n for (const sourceJson of sourcesJson) {\r\n const source = MapLayerSource.fromJSON(sourceJson);\r\n if (source)\r\n addSource(source);\r\n }\r\n\r\n (await ArcGisUtilities.getSourcesFromQuery(sourceRange)).forEach((queriedSource) => addSource(queriedSource));\r\n }\r\n\r\n sources.sort((a: MapLayerSource, b: MapLayerSource) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));\r\n\r\n const mapLayerSources = new MapLayerSources(sources);\r\n MapLayerSources._instance = mapLayerSources;\r\n\r\n return mapLayerSources;\r\n }\r\n public static async addSourceToMapLayerSources(mapLayerSource?: MapLayerSource): Promise<MapLayerSources | undefined> {\r\n if (!MapLayerSources._instance || !mapLayerSource) {\r\n return undefined;\r\n }\r\n MapLayerSources._instance._sources = MapLayerSources._instance._sources.filter((source) => {\r\n return !(source.name === mapLayerSource.name || source.url === mapLayerSource.url);\r\n });\r\n\r\n MapLayerSources._instance._sources.push(mapLayerSource);\r\n MapLayerSources._instance._sources.sort((a: MapLayerSource, b: MapLayerSource) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));\r\n return MapLayerSources._instance;\r\n }\r\n\r\n public static removeLayerByName(name: string): boolean {\r\n if (!MapLayerSources._instance) {\r\n return false;\r\n }\r\n\r\n // For now we only rely on the name\r\n const lengthBeforeRemove = MapLayerSources._instance._sources.length;\r\n MapLayerSources._instance._sources = MapLayerSources._instance._sources.filter((source) => {\r\n return (source.name !== name);\r\n });\r\n return (lengthBeforeRemove !== MapLayerSources._instance._sources.length);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"MapLayerSources.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerSources.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAqD;AACrD,oDAE4B;AAC5B,wDAA+C;AAC/C,+CAA4C;AAE5C,mDAAyE;AACzE,0CAA2F;AAE3F;;GAEG;AACH,IAAY,oBAkBX;AAlBD,WAAY,oBAAoB;IAC9B,4BAA4B;IAC5B,iEAAK,CAAA;IACL,iEAAiE;IACjE,2FAAkB,CAAA;IAClB,6EAA6E;IAC7E,iFAAa,CAAA;IACb,uDAAuD;IACvD,qFAAe,CAAA;IACf,oEAAoE;IACpE,2EAAU,CAAA;IACV,iEAAiE;IACjE,6EAAW,CAAA;IACX,mDAAmD;IACnD,qGAAuB,CAAA;IACvB;OACG;IACH,2FAAkB,CAAA;AACpB,CAAC,EAlBW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAkB/B;AAwBD;;GAEG;AACH,MAAa,cAAc;IAmBzB,YAAoB,QAAQ,GAAG,KAAK,EAAE,IAAY,EAAE,GAAW,EAAE,OAAO,GAAG,KAAK,EAAE,qBAAqB,GAAG,IA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CAAC,kBAAkB,KAAK,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5E,CAAC;CACF;AAjID,0CAiIC","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 MapLayers\r\n */\r\n\r\nimport { compareStrings } from \"@itwin/core-bentley\";\r\nimport {\r\n BackgroundMapProvider, BackgroundMapType, BaseMapLayerSettings, DeprecatedBackgroundMapProps, ImageMapLayerSettings, MapSubLayerProps,\r\n} from \"@itwin/core-common\";\r\nimport { Point2d } from \"@itwin/core-geometry\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { request, RequestBasicCredentials } from \"../../request/Request\";\r\nimport { ArcGisUtilities, MapCartoRectangle, MapLayerSourceValidation } from \"../internal\";\r\n\r\n/** Values for return codes from [[MapLayerSource.validateSource]]\r\n * @public\r\n */\r\nexport enum MapLayerSourceStatus {\r\n /** Layer source is valid */\r\n Valid,\r\n /** Authorization has failed when accessing this layer source. */\r\n InvalidCredentials,\r\n /** Provided format id could not be resolved in [[MapLayerFormatRegistry]] */\r\n InvalidFormat,\r\n /** The tiling schema of the source is not supported */\r\n InvalidTileTree,\r\n /** Could not not connect to remote server using the provided URL.*/\r\n InvalidUrl,\r\n /** Authorization is required to access this map layer source. */\r\n RequireAuth,\r\n /** Map-layer coordinate system is not supported */\r\n InvalidCoordinateSystem,\r\n /** Format is not compatible with the URL provided.\r\n */\r\n IncompatibleFormat,\r\n}\r\n\r\n/** JSON representation of a map layer source.\r\n * @see [ImageryMapLayerFormatId]($common)\r\n * @public\r\n */\r\nexport interface MapLayerSourceProps {\r\n /** Identifies the map layers source. Defaults to 'WMS'. */\r\n formatId?: string;\r\n /** Name */\r\n name: string;\r\n /** URL of the source's endpoint. */\r\n url: string;\r\n /** True to indicate background is transparent. Defaults to 'true'. */\r\n transparentBackground?: boolean;\r\n /** Indicate if this source definition should be used as a base map. Defaults to false. */\r\n baseMap?: boolean;\r\n\r\n /** List of query parameters that will get appended to the source.\r\n * @beta\r\n */\r\n queryParams?: { [key: string]: string };\r\n}\r\n\r\n/** A source for map layers. These may be catalogued for convenient use by users or applications.\r\n * @public\r\n */\r\nexport class MapLayerSource {\r\n public formatId: string;\r\n public name: string;\r\n public url: string;\r\n public baseMap = false;\r\n public transparentBackground?: boolean;\r\n public userName?: string;\r\n public password?: string;\r\n\r\n /** List of query parameters that will get appended to the source URL that should be be persisted part of the JSON representation.\r\n * @beta\r\n */\r\n public savedQueryParams?: { [key: string]: string };\r\n\r\n /** List of query parameters that will get appended to the source URL that should *not* be be persisted part of the JSON representation.\r\n * @beta\r\n */\r\n public unsavedQueryParams?: { [key: string]: string };\r\n\r\n private constructor(formatId = \"WMS\", name: string, url: string, baseMap = false, transparentBackground = true, savedQueryParams?: { [key: string]: string}) {\r\n this.formatId = formatId;\r\n this.name = name;\r\n this.url = url;\r\n this.baseMap = baseMap;\r\n this.transparentBackground = transparentBackground;\r\n this.savedQueryParams = savedQueryParams;\r\n }\r\n\r\n public static fromJSON(json: MapLayerSourceProps): MapLayerSource | undefined {\r\n if (json === undefined)\r\n return undefined;\r\n\r\n return new MapLayerSource(json.formatId, json.name, json.url, json.baseMap, json.transparentBackground, json.queryParams);\r\n }\r\n\r\n public async validateSource(ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n return IModelApp.mapLayerFormatRegistry.validateSource({source: this, ignoreCache});\r\n }\r\n\r\n /** @internal*/\r\n public static fromBackgroundMapProps(props: DeprecatedBackgroundMapProps) {\r\n const provider = BackgroundMapProvider.fromBackgroundMapProps(props);\r\n const layerSettings = BaseMapLayerSettings.fromProvider(provider);\r\n if (undefined !== layerSettings) {\r\n const source = MapLayerSource.fromJSON(layerSettings);\r\n if (source) {\r\n source.baseMap = true;\r\n return source;\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n public toJSON(): MapLayerSourceProps {\r\n return { url: this.url, name: this.name, formatId: this.formatId, transparentBackground: this.transparentBackground, queryParams: this.savedQueryParams };\r\n }\r\n\r\n public toLayerSettings(subLayers?: MapSubLayerProps[]): ImageMapLayerSettings | undefined {\r\n // When MapLayerSetting is created from a MapLayerSource, sub-layers and credentials need to be set separately.\r\n const layerSettings = ImageMapLayerSettings.fromJSON({ ...this, subLayers });\r\n if (this.userName !== undefined || this.password !== undefined) {\r\n layerSettings?.setCredentials(this.userName, this.password);\r\n }\r\n\r\n if (this.savedQueryParams) {\r\n layerSettings.savedQueryParams = {...this.savedQueryParams};\r\n }\r\n\r\n if (this.unsavedQueryParams) {\r\n layerSettings.unsavedQueryParams = {...this.unsavedQueryParams};\r\n }\r\n return layerSettings;\r\n }\r\n\r\n private getCredentials(): RequestBasicCredentials | undefined {\r\n return this.userName && this.password ? { user: this.userName, password: this.password } : undefined;\r\n }\r\n\r\n /** Collect all query parameters\r\n * @beta\r\n */\r\n public collectQueryParams() {\r\n let queryParams: {[key: string]: string} = {};\r\n\r\n if (this.savedQueryParams)\r\n queryParams = {...this.savedQueryParams};\r\n if (this.unsavedQueryParams)\r\n queryParams = {...queryParams, ...this.unsavedQueryParams};\r\n return queryParams;\r\n }\r\n\r\n}\r\n\r\n/** A collection of [[MapLayerSource]] objects.\r\n * @beta\r\n */\r\nexport class MapLayerSources {\r\n private static _instance?: MapLayerSources;\r\n private constructor(private _sources: MapLayerSource[]) { }\r\n\r\n public static getInstance() { return MapLayerSources._instance; }\r\n\r\n public findByName(name: string, baseMap: boolean = false): MapLayerSource | undefined {\r\n const nameTest = name.toLowerCase();\r\n for (const source of this._sources)\r\n if (source.baseMap === baseMap && source.name.toLowerCase().indexOf(nameTest) !== -1)\r\n return source;\r\n\r\n return undefined;\r\n }\r\n public get layers(): MapLayerSource[] {\r\n const layers = new Array<MapLayerSource>();\r\n this._sources.forEach((source) => {\r\n if (!source.baseMap)\r\n layers.push(source);\r\n });\r\n\r\n return layers;\r\n }\r\n public get allSource() { return this._sources; }\r\n public get bases(): MapLayerSource[] {\r\n const layers = new Array<MapLayerSource>();\r\n this._sources.forEach((source) => {\r\n if (source.baseMap)\r\n layers.push(source);\r\n });\r\n\r\n return layers;\r\n }\r\n\r\n private static getBingMapLayerSource(): MapLayerSource[] {\r\n const mapLayerSources: MapLayerSource[] = [];\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"BingProvider\", providerData: { mapType: BackgroundMapType.Street } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"BingProvider\", providerData: { mapType: BackgroundMapType.Aerial } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"BingProvider\", providerData: { mapType: BackgroundMapType.Hybrid } })!);\r\n return mapLayerSources;\r\n }\r\n\r\n private static getMapBoxLayerSource(): MapLayerSource[] {\r\n const mapLayerSources: MapLayerSource[] = [];\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"MapBoxProvider\", providerData: { mapType: BackgroundMapType.Street } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"MapBoxProvider\", providerData: { mapType: BackgroundMapType.Aerial } })!);\r\n mapLayerSources.push(MapLayerSource.fromBackgroundMapProps({ providerName: \"MapBoxProvider\", providerData: { mapType: BackgroundMapType.Hybrid } })!);\r\n return mapLayerSources;\r\n }\r\n\r\n public static async create(iModel?: IModelConnection, queryForPublicSources = false, addMapBoxSources = false): Promise<MapLayerSources> {\r\n if (!queryForPublicSources && MapLayerSources._instance)\r\n return MapLayerSources._instance;\r\n\r\n if (!iModel)\r\n iModel = IModelApp.viewManager.selectedView ? IModelApp.viewManager.selectedView.iModel : undefined;\r\n\r\n let sourceRange = MapCartoRectangle.createMaximum();\r\n if (iModel) {\r\n const projectCenter = iModel.projectExtents.localXYZToWorld(.5, .5, .5)!;\r\n const cartoCenter = iModel.spatialToCartographicFromEcef(projectCenter);\r\n const globeRange = MapCartoRectangle.createMaximum();\r\n const nearDelta = Point2d.create(globeRange.xLength() / 100, globeRange.yLength() / 100);\r\n sourceRange = MapCartoRectangle.fromRadians(cartoCenter.longitude - nearDelta.x, cartoCenter.latitude - nearDelta.y, cartoCenter.longitude + nearDelta.x, cartoCenter.latitude + nearDelta.y);\r\n }\r\n\r\n const sources = new Array<MapLayerSource>();\r\n const urlSet = new Set<string>();\r\n const addSource = ((source: MapLayerSource) => {\r\n if (!urlSet.has(source.url)) {\r\n sources.push(source);\r\n urlSet.add(source.url);\r\n }\r\n });\r\n\r\n this.getBingMapLayerSource().forEach((source) => {\r\n addSource(source);\r\n });\r\n\r\n if (addMapBoxSources) {\r\n this.getMapBoxLayerSource().forEach((source) => {\r\n addSource(source);\r\n });\r\n }\r\n\r\n if (queryForPublicSources) {\r\n const sourcesJson = await request(`${IModelApp.publicPath}assets/MapLayerSources.json`, \"json\");\r\n\r\n for (const sourceJson of sourcesJson) {\r\n const source = MapLayerSource.fromJSON(sourceJson);\r\n if (source)\r\n addSource(source);\r\n }\r\n\r\n (await ArcGisUtilities.getSourcesFromQuery(sourceRange)).forEach((queriedSource) => addSource(queriedSource));\r\n }\r\n\r\n sources.sort((a: MapLayerSource, b: MapLayerSource) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));\r\n\r\n const mapLayerSources = new MapLayerSources(sources);\r\n MapLayerSources._instance = mapLayerSources;\r\n\r\n return mapLayerSources;\r\n }\r\n public static async addSourceToMapLayerSources(mapLayerSource?: MapLayerSource): Promise<MapLayerSources | undefined> {\r\n if (!MapLayerSources._instance || !mapLayerSource) {\r\n return undefined;\r\n }\r\n MapLayerSources._instance._sources = MapLayerSources._instance._sources.filter((source) => {\r\n return !(source.name === mapLayerSource.name || source.url === mapLayerSource.url);\r\n });\r\n\r\n MapLayerSources._instance._sources.push(mapLayerSource);\r\n MapLayerSources._instance._sources.sort((a: MapLayerSource, b: MapLayerSource) => compareStrings(a.name.toLowerCase(), b.name.toLowerCase()));\r\n return MapLayerSources._instance;\r\n }\r\n\r\n public static removeLayerByName(name: string): boolean {\r\n if (!MapLayerSources._instance) {\r\n return false;\r\n }\r\n\r\n // For now we only rely on the name\r\n const lengthBeforeRemove = MapLayerSources._instance._sources.length;\r\n MapLayerSources._instance._sources = MapLayerSources._instance._sources.filter((source) => {\r\n return (source.name !== name);\r\n });\r\n return (lengthBeforeRemove !== MapLayerSources._instance._sources.length);\r\n }\r\n}\r\n"]}
|
|
@@ -55,7 +55,9 @@ export declare class WmsCapabilities {
|
|
|
55
55
|
get featureInfoSupported(): boolean;
|
|
56
56
|
get featureInfoFormats(): string[] | undefined;
|
|
57
57
|
constructor(_json: any);
|
|
58
|
-
static create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean
|
|
58
|
+
static create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean, queryParams?: {
|
|
59
|
+
[key: string]: string;
|
|
60
|
+
}): Promise<WmsCapabilities | undefined>;
|
|
59
61
|
getSubLayers(visible?: boolean): undefined | MapSubLayerProps[];
|
|
60
62
|
getSubLayersCrs(subLayerNames: string[]): Map<string, string[]> | undefined;
|
|
61
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WmsCapabilities.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/WmsCapabilities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAW,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AAEzF,OAAO,EAAE,iBAAiB,EAAgB,MAAM,aAAa,CAAC;AAuC9D;;GAEG;AACH,yBAAiB,aAAa,CAAC;IAE7B,MAAa,OAAO;QAClB,SAAgB,IAAI,EAAE,MAAM,CAAC;QAC7B,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;QAC/B,SAAgB,QAAQ,CAAC,EA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AAW,UAAU,IAAI,iBAAiB,GAAG,SAAS,CAAmC;IACzF,IAAW,oBAAoB,YAA2E;IAC1G,IAAW,kBAAkB,IAAI,MAAM,EAAE,GAAG,SAAS,CAAuJ;gBACxL,KAAK,EAAE,GAAG;WAQV,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IA6B3K,YAAY,CAAC,OAAO,UAAO,GAAG,SAAS,GAAG,gBAAgB,EAAE;IAI5D,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,SAAS;CAGnF"}
|
|
@@ -183,13 +183,22 @@ class WmsCapabilities {
|
|
|
183
183
|
if (_json.Capability)
|
|
184
184
|
this.layer = new WmsCapability.Layer(_json.Capability.Layer, this);
|
|
185
185
|
}
|
|
186
|
-
static async create(url, credentials, ignoreCache) {
|
|
186
|
+
static async create(url, credentials, ignoreCache, queryParams) {
|
|
187
187
|
if (!ignoreCache) {
|
|
188
188
|
const cached = WmsCapabilities._capabilitiesCache.get(url);
|
|
189
189
|
if (cached !== undefined)
|
|
190
190
|
return cached;
|
|
191
191
|
}
|
|
192
|
-
const
|
|
192
|
+
const tmpUrl = new URL(internal_1.WmsUtilities.getBaseUrl(url));
|
|
193
|
+
tmpUrl.searchParams.append("request", "GetCapabilities");
|
|
194
|
+
tmpUrl.searchParams.append("service", "WMS");
|
|
195
|
+
if (queryParams) {
|
|
196
|
+
Object.keys(queryParams).forEach((paramKey) => {
|
|
197
|
+
if (!tmpUrl.searchParams.has(paramKey))
|
|
198
|
+
tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
const xmlCapabilities = await getXml(tmpUrl.toString(), credentials);
|
|
193
202
|
if (!xmlCapabilities)
|
|
194
203
|
return undefined;
|
|
195
204
|
const capabilities = new WmsCapabilities(new wms_capabilities_1.default().parse(xmlCapabilities));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WmsCapabilities.js","sourceRoot":"","sources":["../../../../src/tile/map/WmsCapabilities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAGH,mDAAyF;AACzF,wEAAmC;AACnC,0CAA8D;AAE9D;;;;GAIG;AACH,KAAK,UAAU,MAAM,CAAC,GAAW,EAAE,WAAqC;IACtE,MAAM,OAAO,GAAmB;QAC9B,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,CAAC;QACb,IAAI,EAAE,WAAW;KAClB,CAAC;IACF,OAAO,IAAA,iBAAO,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AACD,SAAS,kBAAkB,CAAC,IAAS;IACnC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,4BAAiB,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,CAAC,iBAAiB;QACtC,OAAO,kBAAkB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,EAAE;QACrD,OAAO,kBAAkB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;KAC1D;SAAM;QACL,IAAI,KAAK,CAAC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CAAC;IACnE,CAAC;IAEM,eAAe,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;;AA5Cc,kCAAkB,GAAG,IAAI,GAAG,EAAuC,CAAC;AADxE,0CAAe","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 { request, RequestBasicCredentials, RequestOptions } from \"../../request/Request\";\r\nimport WMS from \"wms-capabilities\";\r\nimport { MapCartoRectangle, WmsUtilities } from \"../internal\";\r\n\r\n/**\r\n * fetch XML from HTTP request\r\n * @param url server URL to address the request\r\n * @internal\r\n */\r\nasync function getXml(url: string, credentials?: RequestBasicCredentials): Promise<string> {\r\n const options: RequestOptions = {\r\n timeout: 20000,\r\n retryCount: 2,\r\n auth: credentials,\r\n };\r\n return request(url, \"text\", options);\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 * @internal\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 /** @internal */\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 = 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\n/** @internal */\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 this.version = _json.version;\r\n this.isVersion13 = _json.version !== undefined && 0 === _json.version.indexOf(\"1.3\");\r\n this.service = new WmsCapability.Service(_json.Service);\r\n if (_json.Capability)\r\n this.layer = new WmsCapability.Layer(_json.Capability.Layer, this);\r\n }\r\n\r\n public static async create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean): 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 xmlCapabilities = await getXml(`${WmsUtilities.getBaseUrl(url)}?request=GetCapabilities&service=WMS`, credentials);\r\n\r\n if (!xmlCapabilities)\r\n return undefined;\r\n\r\n const capabilities = new WmsCapabilities(new WMS().parse(xmlCapabilities));\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(subLayerNames) : undefined;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"WmsCapabilities.js","sourceRoot":"","sources":["../../../../src/tile/map/WmsCapabilities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;AAGH,mDAAyF;AACzF,wEAAmC;AACnC,0CAA8D;AAE9D;;;;GAIG;AACH,KAAK,UAAU,MAAM,CAAC,GAAW,EAAE,WAAqC;IACtE,MAAM,OAAO,GAAmB;QAC9B,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,CAAC;QACb,IAAI,EAAE,WAAW;KAClB,CAAC;IACF,OAAO,IAAA,iBAAO,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACvC,CAAC;AACD,SAAS,kBAAkB,CAAC,IAAS;IACnC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,4BAAiB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,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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 { request, RequestBasicCredentials, RequestOptions } from \"../../request/Request\";\r\nimport WMS from \"wms-capabilities\";\r\nimport { MapCartoRectangle, WmsUtilities } from \"../internal\";\r\n\r\n/**\r\n * fetch XML from HTTP request\r\n * @param url server URL to address the request\r\n * @internal\r\n */\r\nasync function getXml(url: string, credentials?: RequestBasicCredentials): Promise<string> {\r\n const options: RequestOptions = {\r\n timeout: 20000,\r\n retryCount: 2,\r\n auth: credentials,\r\n };\r\n return request(url, \"text\", options);\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 * @internal\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 /** @internal */\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 = 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\n/** @internal */\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 this.version = _json.version;\r\n this.isVersion13 = _json.version !== undefined && 0 === _json.version.indexOf(\"1.3\");\r\n this.service = new WmsCapability.Service(_json.Service);\r\n if (_json.Capability)\r\n this.layer = new WmsCapability.Layer(_json.Capability.Layer, this);\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 getXml(tmpUrl.toString(), credentials);\r\n\r\n if (!xmlCapabilities)\r\n return undefined;\r\n\r\n const capabilities = new WmsCapabilities(new WMS().parse(xmlCapabilities));\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(subLayerNames) : undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -118,6 +118,8 @@ export declare class WmtsCapabilities {
|
|
|
118
118
|
readonly operationsMetadata?: WmtsCapability.OperationMetadata;
|
|
119
119
|
constructor(xmlDoc: Document);
|
|
120
120
|
static createFromXml(xmlCapabilities: string): WmtsCapabilities | undefined;
|
|
121
|
-
static create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean
|
|
121
|
+
static create(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean, queryParams?: {
|
|
122
|
+
[key: string]: string;
|
|
123
|
+
}): Promise<WmtsCapabilities | undefined>;
|
|
122
124
|
}
|
|
123
125
|
//# sourceMappingURL=WmtsCapabilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WmtsCapabilities.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/WmtsCapabilities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAW,uBAAuB,EAAkB,MAAM,uBAAuB,CAAC;AACzF,OAAO,EAA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,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,WAAW,CAAC,EAAE,uBAAuB,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAC,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CA2BpL"}
|
|
@@ -426,13 +426,22 @@ class WmtsCapabilities {
|
|
|
426
426
|
const xmlDoc = parser.parseFromString(xmlCapabilities, "text/xml");
|
|
427
427
|
return new WmtsCapabilities(xmlDoc);
|
|
428
428
|
}
|
|
429
|
-
static async create(url, credentials, ignoreCache) {
|
|
429
|
+
static async create(url, credentials, ignoreCache, queryParams) {
|
|
430
430
|
if (!ignoreCache) {
|
|
431
431
|
const cached = WmtsCapabilities._capabilitiesCache.get(url);
|
|
432
432
|
if (cached !== undefined)
|
|
433
433
|
return cached;
|
|
434
434
|
}
|
|
435
|
-
const
|
|
435
|
+
const tmpUrl = new URL(internal_1.WmsUtilities.getBaseUrl(url));
|
|
436
|
+
tmpUrl.searchParams.append("request", "GetCapabilities");
|
|
437
|
+
tmpUrl.searchParams.append("service", "WMTS");
|
|
438
|
+
if (queryParams) {
|
|
439
|
+
Object.keys(queryParams).forEach((paramKey) => {
|
|
440
|
+
if (!tmpUrl.searchParams.has(paramKey))
|
|
441
|
+
tmpUrl.searchParams.append(paramKey, queryParams[paramKey]);
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
const xmlCapabilities = await getXml(tmpUrl.toString(), credentials);
|
|
436
445
|
if (!xmlCapabilities)
|
|
437
446
|
return undefined;
|
|
438
447
|
const capabilities = WmtsCapabilities.createFromXml(xmlCapabilities);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WmtsCapabilities.js","sourceRoot":"","sources":["../../../../src/tile/map/WmtsCapabilities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,wDAAwD;AACxD,mDAAyF;AACzF,0CAA8D,CAAC,qCAAqC;AAEpG,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;IACtC,kDAAkC,CAAA;IAClC,oEAAoD,CAAA;IACpD,wCAAwB,CAAA;IACxB,0EAA0D,CAAA;IAC1D,sDAAsC,CAAA;IACtC,oEAAoD,CAAA;IACpD,wDAAwC,CAAA;IACxC,0CAA0B,CAAA;IAC1B,sDAAsC,CAAA;IACtC,0CAA0B,CAAA;IAC1B,gEAAgD,CAAA;AAElD,CAAC,EA1BI,YAAY,KAAZ,YAAY,QA0BhB;AAED,IAAK,YAoBJ;AApBD,WAAK,YAAY;IACf,mBAAmB;IACnB,mDAAmC,CAAA;IACnC,mCAAmB,CAAA;IACnB,iDAAiC,CAAA;IAEjC,kDAAkC,CAAA;IAClC,oDAAoC,CAAA;IACpC,4DAA4C,CAAA;IAE5C,gDAAgC,CAAA;IAChC,gDAAgC,CAAA;IAChC,8DAA8C,CAAA;IAC9C,8CAA8B,CAAA;IAC9B,sDAAsC,CAAA;IACtC,8DAA8C,CAAA;IAE9C,mDAAmC,CAAA;IACnC,6CAA6B,CAAA;IAC7B,yCAAyB,CAA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,GAAG,EAAE,YAAY,CAAC,CAAC;QAE7D,OAAO,YAAY,CAAC;IACtB,CAAC;;AAtDc,mCAAkB,GAAG,IAAI,GAAG,EAAwC,CAAC;AADzE,4CAAgB","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 { Point2d, Range2d } from \"@itwin/core-geometry\";\r\nimport { request, RequestBasicCredentials, RequestOptions } from \"../../request/Request\";\r\nimport { MapCartoRectangle, WmsUtilities } from \"../internal\"; // WmsUtilities needed for getBaseUrl\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 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\n/** @internal\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 * fetch XML from HTTP request\r\n * @param url server URL to address the request\r\n * @internal\r\n */\r\nasync function getXml(url: string, credentials?: RequestBasicCredentials): Promise<string> {\r\n const options: RequestOptions = {\r\n timeout: 20000,\r\n retryCount: 2,\r\n auth: credentials,\r\n };\r\n return request(url, \"text\", options);\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 * @internal\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 * @internal\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 = 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(\"TileMatrixSetLimits\");\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 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 = 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\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 }\r\n}\r\n/** @internal */\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): 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 xmlCapabilities = await getXml(`${WmsUtilities.getBaseUrl(url)}?request=GetCapabilities&service=WMTS`, 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/tile/map/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AM,CAAC,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;SACJ;QAED,MAAM,eAAe,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,CAAC;QACrE,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;;AAhEc,mCAAkB,GAAG,IAAI,GAAG,EAAwC,CAAC;AADzE,4CAAgB","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 { Point2d, Range2d } from \"@itwin/core-geometry\";\r\nimport { request, RequestBasicCredentials, RequestOptions } from \"../../request/Request\";\r\nimport { MapCartoRectangle, WmsUtilities } from \"../internal\"; // WmsUtilities needed for getBaseUrl\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 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\n/** @internal\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 * fetch XML from HTTP request\r\n * @param url server URL to address the request\r\n * @internal\r\n */\r\nasync function getXml(url: string, credentials?: RequestBasicCredentials): Promise<string> {\r\n const options: RequestOptions = {\r\n timeout: 20000,\r\n retryCount: 2,\r\n auth: credentials,\r\n };\r\n return request(url, \"text\", options);\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 * @internal\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 * @internal\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 = 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(\"TileMatrixSetLimits\");\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 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 = 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\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 }\r\n}\r\n/** @internal */\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 getXml(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"]}
|
|
@@ -20,7 +20,7 @@ ACSDisplayOptions, ACSType, ActivityMessageEndReason, BeButton, BeModifierKeys,
|
|
|
20
20
|
AccuDrawHintBuilder, AccuSnap, ActivityMessageDetails, AuxCoordSystem2dState, AuxCoordSystem3dState, AuxCoordSystemSpatialState, AuxCoordSystemState, BeButtonEvent, BeButtonState, BeTouchEvent, BeWheelEvent, BingElevationProvider, BingLocationProvider, CategorySelectorState, ChangeFlags, Cluster, ContextRealityModelState, DecorateContext, Decorations, DisclosedTileTreeSet, DisplayStyle2dState, DisplayStyle3dState, DisplayStyleState, DrawingModelState, DrawingViewState, EditManipulator, ElementLocateManager, ElementPicker, ElementState, EmphasizeElements, EntityState, EventController, FeatureSymbology, FlashSettings, FrustumAnimator, GeometricModel2dState, GeometricModel3dState, GeometricModelState, GlobeAnimator, GraphicBranch, GraphicBuilder, HiliteSet, HitDetail, HitList, IModelConnection, IconSprites, InputCollector, InteractiveTool, IntersectDetail, LocateOptions, LocateResponse, MarginPercent, Marker, MarkerSet, ModelSelectorState, ModelState, NotificationHandler, NotificationManager, NotifyMessageDetails, OffScreenViewport, OrthographicViewState, PerModelCategoryVisibility, PhysicalModelState, Pixel, PrimitiveTool, RenderClipVolume, RenderContext, RenderGraphic, RenderGraphicOwner, RenderSystem, Scene, ScreenViewport, SectionDrawingModelState, SelectionSet, SheetModelState, SheetViewState, SnapDetail, SpatialLocationModelState, SpatialModelState, SpatialViewState, Sprite, SpriteLocation, TentativePoint, Tile, TileAdmin, TileDrawArgs, TileRequest, TileRequestChannel, TileRequestChannelStatistics, TileRequestChannels, TileTree, TileTreeReference, TileUsageMarker, Tiles, Tool, ToolAdmin, ToolAssistance, ToolSettings, TwoWayViewportFrustumSync, TwoWayViewportSync, ViewClipClearTool, ViewClipDecoration, ViewClipDecorationProvider, ViewClipTool, ViewCreator2d, ViewCreator3d, ViewManager, ViewManip, ViewPose, ViewPose2d, ViewPose3d, ViewRect, ViewState, ViewState2d, ViewState3d, ViewTool, ViewingSpace, Viewport, canvasToImageBuffer, canvasToResizedCanvasWithBars, connectViewportFrusta, connectViewportViews, connectViewports, extractImageSourceDimensions, getCompressedJpegFromCanvas, getImageSourceFormatForMimeType, getImageSourceMimeType, imageBufferToBase64EncodedPng, imageBufferToCanvas, imageBufferToPngDataUrl, imageElementFromImageSource, imageElementFromUrl, queryTerrainElevationOffset, readElementGraphics, readGltfGraphics, synchronizeViewportFrusta, synchronizeViewportViews, } from "../core-frontend";
|
|
21
21
|
import {
|
|
22
22
|
// @public enum(s) from @itwin/core-common
|
|
23
|
-
BackgroundFill, BackgroundMapType, BatchType, BisCodeSpec, BriefcaseIdValue, ChangeOpCode, ChangedValueState, ChangesetType, CommonLoggerCategory, ECSqlSystemProperty, ECSqlValueType, ElementGeometryOpcode, FeatureOverrideType, FillDisplay, FillFlags, FontType, GeoCoordStatus, GeometryClass, GeometryStreamFlags, GeometrySummaryVerbosity, GlobeMode, GridOrientationType, HSVConstants, ImageBufferFormat, ImageSourceFormat, LinePixels, MassPropertiesOperation, MonochromeMode, Npc, PlanarClipMaskMode, PlanarClipMaskPriority, QueryRowFormat, Rank, RenderMode, SectionType, SkyBoxImageType, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, SyncMode, TerrainHeightOriginMode, TextureMapUnits, ThematicDisplayMode, ThematicGradientColorScheme, ThematicGradientMode, TxnAction, TypeOfChange,
|
|
23
|
+
BackgroundFill, BackgroundMapType, BatchType, BisCodeSpec, BriefcaseIdValue, ChangeOpCode, ChangedValueState, ChangesetType, CommonLoggerCategory, ECSqlSystemProperty, ECSqlValueType, ElementGeometryOpcode, FeatureOverrideType, FillDisplay, FillFlags, FontType, GeoCoordStatus, GeometryClass, GeometryStreamFlags, GeometrySummaryVerbosity, GlobeMode, GridOrientationType, HSVConstants, ImageBufferFormat, ImageSourceFormat, LinePixels, MassPropertiesOperation, MonochromeMode, Npc, PlanarClipMaskMode, PlanarClipMaskPriority, QueryRowFormat, Rank, RenderMode, SectionType, SkyBoxImageType, SpatialClassifierInsideDisplay, SpatialClassifierOutsideDisplay, SyncMode, TerrainHeightOriginMode, TextureMapUnits, ThematicDisplayMode, ThematicGradientColorScheme, ThematicGradientMode, ThematicGradientTransparencyMode, TxnAction, TypeOfChange,
|
|
24
24
|
// @public real(s) from @itwin/core-common
|
|
25
25
|
ClipIntersectionStyle, ColorByName, ColorDef, FrustumPlanes, QParams2d, QParams3d, QPoint2d, QPoint2dBuffer, QPoint2dBufferBuilder, QPoint2dList, QPoint3d, QPoint3dBuffer, QPoint3dBufferBuilder, QPoint3dList, Quantization, } from "@itwin/core-common";
|
|
26
26
|
const extensionExports = {
|
|
@@ -206,6 +206,7 @@ const extensionExports = {
|
|
|
206
206
|
ThematicDisplayMode,
|
|
207
207
|
ThematicGradientColorScheme,
|
|
208
208
|
ThematicGradientMode,
|
|
209
|
+
ThematicGradientTransparencyMode,
|
|
209
210
|
Tile,
|
|
210
211
|
TileAdmin,
|
|
211
212
|
TileBoundingBoxes,
|