@itwin/core-frontend 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/lib/cjs/DisplayStyleState.d.ts +68 -17
  3. package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
  4. package/lib/cjs/DisplayStyleState.js +66 -20
  5. package/lib/cjs/DisplayStyleState.js.map +1 -1
  6. package/lib/cjs/extension/ExtensionAdmin.d.ts +5 -2
  7. package/lib/cjs/extension/ExtensionAdmin.d.ts.map +1 -1
  8. package/lib/cjs/extension/ExtensionAdmin.js +24 -6
  9. package/lib/cjs/extension/ExtensionAdmin.js.map +1 -1
  10. package/lib/cjs/extension/providers/ExtensionServiceClient.d.ts +8 -6
  11. package/lib/cjs/extension/providers/ExtensionServiceClient.d.ts.map +1 -1
  12. package/lib/cjs/extension/providers/ExtensionServiceClient.js +13 -6
  13. package/lib/cjs/extension/providers/ExtensionServiceClient.js.map +1 -1
  14. package/lib/cjs/extension/providers/RemoteExtensionProvider.d.ts +0 -2
  15. package/lib/cjs/extension/providers/RemoteExtensionProvider.d.ts.map +1 -1
  16. package/lib/cjs/extension/providers/RemoteExtensionProvider.js +9 -22
  17. package/lib/cjs/extension/providers/RemoteExtensionProvider.js.map +1 -1
  18. package/lib/cjs/extension/providers/ServiceExtensionProvider.d.ts +4 -6
  19. package/lib/cjs/extension/providers/ServiceExtensionProvider.d.ts.map +1 -1
  20. package/lib/cjs/extension/providers/ServiceExtensionProvider.js +11 -22
  21. package/lib/cjs/extension/providers/ServiceExtensionProvider.js.map +1 -1
  22. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  23. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +46 -2
  24. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  25. package/lib/cjs/tile/map/MapCartoRectangle.d.ts +1 -0
  26. package/lib/cjs/tile/map/MapCartoRectangle.d.ts.map +1 -1
  27. package/lib/cjs/tile/map/MapCartoRectangle.js +1 -0
  28. package/lib/cjs/tile/map/MapCartoRectangle.js.map +1 -1
  29. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +2 -1
  30. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  31. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  32. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +2 -0
  33. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  34. package/lib/cjs/tile/map/MapLayerImageryProvider.js +23 -9
  35. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  36. package/lib/cjs/tile/map/MapLayerSources.d.ts +14 -9
  37. package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
  38. package/lib/cjs/tile/map/MapLayerSources.js +14 -6
  39. package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
  40. package/lib/esm/DisplayStyleState.d.ts +68 -17
  41. package/lib/esm/DisplayStyleState.d.ts.map +1 -1
  42. package/lib/esm/DisplayStyleState.js +66 -20
  43. package/lib/esm/DisplayStyleState.js.map +1 -1
  44. package/lib/esm/extension/ExtensionAdmin.d.ts +5 -2
  45. package/lib/esm/extension/ExtensionAdmin.d.ts.map +1 -1
  46. package/lib/esm/extension/ExtensionAdmin.js +24 -6
  47. package/lib/esm/extension/ExtensionAdmin.js.map +1 -1
  48. package/lib/esm/extension/providers/ExtensionServiceClient.d.ts +8 -6
  49. package/lib/esm/extension/providers/ExtensionServiceClient.d.ts.map +1 -1
  50. package/lib/esm/extension/providers/ExtensionServiceClient.js +13 -6
  51. package/lib/esm/extension/providers/ExtensionServiceClient.js.map +1 -1
  52. package/lib/esm/extension/providers/RemoteExtensionProvider.d.ts +0 -2
  53. package/lib/esm/extension/providers/RemoteExtensionProvider.d.ts.map +1 -1
  54. package/lib/esm/extension/providers/RemoteExtensionProvider.js +9 -22
  55. package/lib/esm/extension/providers/RemoteExtensionProvider.js.map +1 -1
  56. package/lib/esm/extension/providers/ServiceExtensionProvider.d.ts +4 -6
  57. package/lib/esm/extension/providers/ServiceExtensionProvider.d.ts.map +1 -1
  58. package/lib/esm/extension/providers/ServiceExtensionProvider.js +11 -22
  59. package/lib/esm/extension/providers/ServiceExtensionProvider.js.map +1 -1
  60. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  61. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +46 -2
  62. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  63. package/lib/esm/tile/map/MapCartoRectangle.d.ts +1 -0
  64. package/lib/esm/tile/map/MapCartoRectangle.d.ts.map +1 -1
  65. package/lib/esm/tile/map/MapCartoRectangle.js +1 -0
  66. package/lib/esm/tile/map/MapCartoRectangle.js.map +1 -1
  67. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +2 -1
  68. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  69. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  70. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +2 -0
  71. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  72. package/lib/esm/tile/map/MapLayerImageryProvider.js +24 -10
  73. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  74. package/lib/esm/tile/map/MapLayerSources.d.ts +14 -9
  75. package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
  76. package/lib/esm/tile/map/MapLayerSources.js +14 -6
  77. package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
  78. package/package.json +20 -20
@@ -11,38 +11,46 @@ import { Point2d } from "@itwin/core-geometry";
11
11
  import { IModelApp } from "../../IModelApp";
12
12
  import { getJson } from "../../request/Request";
13
13
  import { ArcGisUtilities, MapCartoRectangle } from "../internal";
14
- /** @beta */
14
+ /**
15
+ * Values for return codes from [[MapLayerSource.validateSource]]
16
+ * @public
17
+ */
15
18
  export var MapLayerSourceStatus;
16
19
  (function (MapLayerSourceStatus) {
20
+ /** Layer source is valid */
17
21
  MapLayerSourceStatus[MapLayerSourceStatus["Valid"] = 0] = "Valid";
22
+ /** Authorization has failed when accessing this layer source. */
18
23
  MapLayerSourceStatus[MapLayerSourceStatus["InvalidCredentials"] = 1] = "InvalidCredentials";
24
+ /** Provided format id could not be resolved in [[MapLayerFormatRegistry]] */
19
25
  MapLayerSourceStatus[MapLayerSourceStatus["InvalidFormat"] = 2] = "InvalidFormat";
26
+ /** The tiling schema of the source is not supported */
20
27
  MapLayerSourceStatus[MapLayerSourceStatus["InvalidTileTree"] = 3] = "InvalidTileTree";
28
+ /** Could not not connect to remote server using the provided URL.*/
21
29
  MapLayerSourceStatus[MapLayerSourceStatus["InvalidUrl"] = 4] = "InvalidUrl";
30
+ /** Authorization is required to access this map layer source. */
22
31
  MapLayerSourceStatus[MapLayerSourceStatus["RequireAuth"] = 5] = "RequireAuth";
23
32
  })(MapLayerSourceStatus || (MapLayerSourceStatus = {}));
24
33
  /** A source for map layers. These may be catalogued for convenient use by users or applications.
25
- * @internal
34
+ * @public
26
35
  */
27
36
  export class MapLayerSource {
28
- constructor(formatId = "WMS", name, url, baseMap = false, transparentBackground = true, userName, password) {
37
+ constructor(formatId = "WMS", name, url, baseMap = false, transparentBackground = true) {
29
38
  this.baseMap = false;
30
39
  this.formatId = formatId;
31
40
  this.name = name;
32
41
  this.url = url;
33
42
  this.baseMap = baseMap;
34
43
  this.transparentBackground = transparentBackground;
35
- this.userName = userName;
36
- this.password = password;
37
44
  }
38
45
  static fromJSON(json) {
39
46
  if (json === undefined)
40
47
  return undefined;
41
- return new MapLayerSource(json.formatId, json.name, json.url, json.baseMap, json.transparentBackground, json.userName, json.password);
48
+ return new MapLayerSource(json.formatId, json.name, json.url, json.baseMap, json.transparentBackground);
42
49
  }
43
50
  async validateSource(ignoreCache) {
44
51
  return IModelApp.mapLayerFormatRegistry.validateSource(this.formatId, this.url, this.getCredentials(), ignoreCache);
45
52
  }
53
+ /** @internal*/
46
54
  static fromBackgroundMapProps(props) {
47
55
  const provider = BackgroundMapProvider.fromBackgroundMapProps(props);
48
56
  const layerSettings = BaseMapLayerSettings.fromProvider(provider);
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerSources.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerSources.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EACL,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAgC,qBAAqB,GACpH,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,OAAO,EAA2B,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAA4B,MAAM,aAAa,CAAC;AAE3F,YAAY;AACZ,MAAM,CAAN,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,iEAAK,CAAA;IACL,2FAAkB,CAAA;IAClB,iFAAa,CAAA;IACb,qFAAe,CAAA;IACf,2EAAU,CAAA;IACV,6EAAW,CAAA;AACb,CAAC,EAPW,oBAAoB,KAApB,oBAAoB,QAO/B;AAwBD;;GAEG;AACH,MAAM,OAAO,cAAc;IASzB,YAAoB,QAAQ,GAAG,KAAK,EAAE,IAAY,EAAE,GAAW,EAAE,OAAO,GAAG,KAAK,EAAE,qBAAqB,GAAG,IAAI,EAAE,QAAiB,EAAE,QAAiB;QAL7I,YAAO,GAAG,KAAK,CAAC;QAMrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,I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B,EAAE,CAAiB,EAAE,EAAE,CAAC,cAAc,CAAC,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","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 { getJson, RequestBasicCredentials } from \"../../request/Request\";\r\nimport { ArcGisUtilities, MapCartoRectangle, MapLayerSourceValidation } from \"../internal\";\r\n\r\n/** @beta */\r\nexport enum MapLayerSourceStatus {\r\n Valid,\r\n InvalidCredentials,\r\n InvalidFormat,\r\n InvalidTileTree,\r\n InvalidUrl,\r\n RequireAuth,\r\n}\r\n\r\n/** JSON representation of a map layer source.\r\n * @internal\r\n */\r\ninterface 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 /** Is a base layer. Defaults to 'false'. */\r\n isBase?: boolean;\r\n /** Indicate if this source definition should be used as a base map. Defaults to false. */\r\n baseMap?: boolean;\r\n /** UserName */\r\n userName?: string;\r\n /** Password */\r\n password?: 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 * @internal\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, userName?: string, password?: 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.userName = userName;\r\n this.password = password;\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.userName, json.password);\r\n }\r\n\r\n public async validateSource(ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n return IModelApp.mapLayerFormatRegistry.validateSource(this.formatId, this.url, this.getCredentials(), ignoreCache);\r\n }\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 * @internal\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) => { if (!source.baseMap) layers.push(source); });\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) => { if (source.baseMap) layers.push(source); });\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.create();\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.create();\r\n const nearDelta = Point2d.create(globeRange.xLength() / 100, globeRange.yLength() / 100);\r\n sourceRange = MapCartoRectangle.create(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 getJson(`${IModelApp.publicPath}assets/MapLayerSources.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":"MapLayerS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S,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","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 { getJson, RequestBasicCredentials } from \"../../request/Request\";\r\nimport { ArcGisUtilities, MapCartoRectangle, MapLayerSourceValidation } from \"../internal\";\r\n\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}\r\n\r\n/** JSON representation of a map layer source.\r\n * * @see [ImageryMapLayerFormatId]($common)\r\n * @public\r\n */\r\ninterface 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.getCredentials(), 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 * @internal\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) => { if (!source.baseMap) layers.push(source); });\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) => { if (source.baseMap) layers.push(source); });\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.create();\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.create();\r\n const nearDelta = Point2d.create(globeRange.xLength() / 100, globeRange.yLength() / 100);\r\n sourceRange = MapCartoRectangle.create(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 getJson(`${IModelApp.publicPath}assets/MapLayerSources.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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/core-frontend",
3
- "version": "3.2.2",
3
+ "version": "3.2.3",
4
4
  "description": "iTwin.js frontend components",
5
5
  "main": "lib/cjs/core-frontend.js",
6
6
  "module": "lib/esm/core-frontend.js",
@@ -22,29 +22,29 @@
22
22
  "url": "http://www.bentley.com"
23
23
  },
24
24
  "peerDependencies": {
25
- "@itwin/appui-abstract": "^3.2.2",
26
- "@itwin/core-bentley": "^3.2.2",
27
- "@itwin/core-common": "^3.2.2",
28
- "@itwin/core-geometry": "^3.2.2",
29
- "@itwin/core-orbitgt": "^3.2.2",
30
- "@itwin/core-quantity": "^3.2.2",
31
- "@itwin/webgl-compatibility": "^3.2.2"
25
+ "@itwin/appui-abstract": "^3.2.3",
26
+ "@itwin/core-bentley": "^3.2.3",
27
+ "@itwin/core-common": "^3.2.3",
28
+ "@itwin/core-geometry": "^3.2.3",
29
+ "@itwin/core-orbitgt": "^3.2.3",
30
+ "@itwin/core-quantity": "^3.2.3",
31
+ "@itwin/webgl-compatibility": "^3.2.3"
32
32
  },
33
33
  "//devDependencies": [
34
34
  "NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
35
35
  "NOTE: All tools used by scripts in this package must be listed as devDependencies"
36
36
  ],
37
37
  "devDependencies": {
38
- "@itwin/appui-abstract": "3.2.2",
39
- "@itwin/build-tools": "3.2.2",
40
- "@itwin/core-bentley": "3.2.2",
41
- "@itwin/core-common": "3.2.2",
42
- "@itwin/core-geometry": "3.2.2",
43
- "@itwin/core-orbitgt": "3.2.2",
44
- "@itwin/core-quantity": "3.2.2",
45
- "@itwin/certa": "3.2.2",
46
- "@itwin/eslint-plugin": "3.2.2",
47
- "@itwin/webgl-compatibility": "3.2.2",
38
+ "@itwin/appui-abstract": "3.2.3",
39
+ "@itwin/build-tools": "3.2.3",
40
+ "@itwin/core-bentley": "3.2.3",
41
+ "@itwin/core-common": "3.2.3",
42
+ "@itwin/core-geometry": "3.2.3",
43
+ "@itwin/core-orbitgt": "3.2.3",
44
+ "@itwin/core-quantity": "3.2.3",
45
+ "@itwin/certa": "3.2.3",
46
+ "@itwin/eslint-plugin": "3.2.3",
47
+ "@itwin/webgl-compatibility": "3.2.3",
48
48
  "@types/chai": "^4.1.4",
49
49
  "@types/chai-as-promised": "^7",
50
50
  "@types/deep-assign": "^0.1.0",
@@ -73,8 +73,8 @@
73
73
  "NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"
74
74
  ],
75
75
  "dependencies": {
76
- "@itwin/core-i18n": "3.2.2",
77
- "@itwin/core-telemetry": "3.2.2",
76
+ "@itwin/core-i18n": "3.2.3",
77
+ "@itwin/core-telemetry": "3.2.3",
78
78
  "@loaders.gl/core": "^3.1.6",
79
79
  "@loaders.gl/draco": "^3.1.6",
80
80
  "deep-assign": "^2.0.0",