@itwin/core-frontend 4.3.0-dev.4 → 4.3.0-dev.6

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 (72) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/lib/cjs/tile/TileTreeReference.d.ts +2 -1
  3. package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
  4. package/lib/cjs/tile/TileTreeReference.js +2 -1
  5. package/lib/cjs/tile/TileTreeReference.js.map +1 -1
  6. package/lib/cjs/tile/map/ArcGisUtilities.d.ts +34 -19
  7. package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
  8. package/lib/cjs/tile/map/ArcGisUtilities.js +31 -17
  9. package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
  10. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -2
  11. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  12. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +3 -3
  13. package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  14. package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts +2 -2
  15. package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  16. package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +3 -3
  17. package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  18. package/lib/cjs/tile/map/ImageryTileTree.d.ts +12 -2
  19. package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
  20. package/lib/cjs/tile/map/ImageryTileTree.js +10 -3
  21. package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
  22. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +32 -13
  23. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  24. package/lib/cjs/tile/map/MapLayerFormatRegistry.js +35 -14
  25. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  26. package/lib/cjs/tile/map/MapLayerImageryFormats.js +1 -1
  27. package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
  28. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +73 -15
  29. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  30. package/lib/cjs/tile/map/MapLayerImageryProvider.js +77 -26
  31. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  32. package/lib/cjs/tile/map/MapLayerTileTreeReference.d.ts +27 -2
  33. package/lib/cjs/tile/map/MapLayerTileTreeReference.d.ts.map +1 -1
  34. package/lib/cjs/tile/map/MapLayerTileTreeReference.js +30 -2
  35. package/lib/cjs/tile/map/MapLayerTileTreeReference.js.map +1 -1
  36. package/lib/esm/tile/TileTreeReference.d.ts +2 -1
  37. package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
  38. package/lib/esm/tile/TileTreeReference.js +2 -1
  39. package/lib/esm/tile/TileTreeReference.js.map +1 -1
  40. package/lib/esm/tile/map/ArcGisUtilities.d.ts +34 -19
  41. package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
  42. package/lib/esm/tile/map/ArcGisUtilities.js +31 -17
  43. package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
  44. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -2
  45. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  46. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +3 -3
  47. package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  48. package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts +2 -2
  49. package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  50. package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +3 -3
  51. package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  52. package/lib/esm/tile/map/ImageryTileTree.d.ts +12 -2
  53. package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
  54. package/lib/esm/tile/map/ImageryTileTree.js +10 -3
  55. package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
  56. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +32 -13
  57. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  58. package/lib/esm/tile/map/MapLayerFormatRegistry.js +35 -14
  59. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  60. package/lib/esm/tile/map/MapLayerImageryFormats.js +1 -1
  61. package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
  62. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +73 -15
  63. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  64. package/lib/esm/tile/map/MapLayerImageryProvider.js +77 -26
  65. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  66. package/lib/esm/tile/map/MapLayerTileTreeReference.d.ts +27 -2
  67. package/lib/esm/tile/map/MapLayerTileTreeReference.d.ts.map +1 -1
  68. package/lib/esm/tile/map/MapLayerTileTreeReference.js +30 -2
  69. package/lib/esm/tile/map/MapLayerTileTreeReference.js.map +1 -1
  70. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  71. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  72. package/package.json +18 -18
package/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log - @itwin/core-frontend
2
2
 
3
- This log was last generated on Fri, 06 Oct 2023 04:02:58 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 10 Oct 2023 20:02:00 GMT and should not be manually modified.
4
+
5
+ ## 4.1.9
6
+ Tue, 10 Oct 2023 18:48:12 GMT
7
+
8
+ _Version update only_
4
9
 
5
10
  ## 4.1.8
6
11
  Fri, 06 Oct 2023 04:00:18 GMT
@@ -150,6 +155,11 @@ Mon, 22 May 2023 15:34:14 GMT
150
155
  - add physics-based Atmospheric scattering shader
151
156
  - Localize tooltips for view clip decorations.
152
157
 
158
+ ## 3.7.15
159
+ Tue, 10 Oct 2023 19:58:35 GMT
160
+
161
+ _Version update only_
162
+
153
163
  ## 3.7.14
154
164
  Fri, 29 Sep 2023 16:57:16 GMT
155
165
 
@@ -37,7 +37,8 @@ export declare abstract class TileTreeReference {
37
37
  /** The owner of the currently-referenced [[TileTree]]. Do not store a direct reference to it, because it may change or become disposed at any time. */
38
38
  abstract get treeOwner(): TileTreeOwner;
39
39
  /** Force a new tree owner / tile tree to be created for the current tile tree reference
40
- /* @internal */
40
+ * @internal
41
+ */
41
42
  resetTreeOwner(): void;
42
43
  /** Disclose *all* TileTrees use by this reference. This may include things like map tiles used for draping on terrain.
43
44
  * Override this and call super if you have such auxiliary trees.
@@ -1 +1 @@
1
- {"version":3,"file":"TileTreeReference.d.ts","sourceRoot":"","sources":["../../../src/tile/TileTreeReference.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,aAAa,EAAE,UAAU,EAA0B,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC1J,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MA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,GAAG,gBAAgB,GAAG,SAAS;IAIrE,iIAAiI;IACjI,SAAS,CAAC,oBAAoB,CAAC,IAAI,EAAE,QAAQ,GAAG,iBAAiB;IAIjE,gEAAgE;IAChE,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,gBAAgB,CAAC,SAAS,GAAG,SAAS;IAIxF,4EAA4E;IAC5E,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,yBAAyB,GAAG,SAAS;IAIvF,yEAAyE;IACzE,SAAS,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,GAAG,UAAU,CAAC,QAAQ,GAAG,SAAS;IAO1E,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,aAAa;IASjG,gBAAgB;IACT,gBAAgB,CAAC,eAAe,EAAE,OAAO,GAAG,IAAI;IAEvD,6GAA6G;IAC7G,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED,iKAAiK;IACjK,IAAW,QAAQ,IAAI,OAAO,CAAkB;IAEhD;;;OAGG;IACH,IAAW,sBAAsB,IAAI,MAAM,CAA+C;IAE1F,iGAAiG;IAC1F,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI;IAExE;;;;OAIG;IACH,SAAS,CAAC,4BAA4B,IAAI,yBAAyB,GAAG,SAAS;IAI/E;;OAEG;IACI,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAExE;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,SAAS,EAAE,qBAAqB,GAAG,IAAI;IAatE;;;;;OAKG;IACI,2BAA2B,IAAI,yBAAyB,GAAG,SAAS;CAQ5E"}
@@ -38,7 +38,8 @@ var TileGraphicType;
38
38
  */
39
39
  class TileTreeReference /* implements RenderMemory.Consumer */ {
40
40
  /** Force a new tree owner / tile tree to be created for the current tile tree reference
41
- /* @internal */
41
+ * @internal
42
+ */
42
43
  resetTreeOwner() { }
43
44
  /** Disclose *all* TileTrees use by this reference. This may include things like map tiles used for draping on terrain.
44
45
  * Override this and call super if you have such auxiliary trees.
@@ -1 +1 @@
1
- {"version":3,"file":"TileTreeReference.js","sourceRoot":"","sources":["../../../src/tile/TileTreeReference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,wDAA6E;AAC7E,oDAA0J;AAO1J,yCAEoB;AAEpB;;;GAGG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,wDAAwD;IACxD,uEAAiB,CAAA;IACjB,2CAA2C;IAC3C,uDAAS,CAAA;IACT,+CAA+C;IAC/C,2DAAW,CAAA;AACb,CAAC,EAPW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAO1B;AAED;;;;;;;;;;GAUG;AACH,MAAsB,iBAAiB,CAAC,sCAAsC;IAI5E;mBACe;IACR,cAAc,KAAI,CAAC;IAE1B;;;OAGG;IACI,iBAAiB,CAAC,KAA2B;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QACrC,IAAI,SAAS,KAAK,IAAI;YACpB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,qFAAqF;IAC9E,UAAU,CAAC,OAAqB;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAC1C,IAAI,SAAS,KAAK,IAAI;YACpB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IAED,0IAA0I;IACnI,IAAI,CAAC,IAAkB;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,sDAAsD;IAC/C,KAAK,CAAC,UAAU,CAAC,IAAe,IAA+C,OAAO,SAAS,CAAC,CAAC,CAAC;IAEzG;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S,CAAC,IAAI,EAAE,CAAC;QACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YACjC,KAAK,6BAAkB,CAAC,MAAM;gBAC5B,IAAA,qBAAM,EAAC,SAAS,KAAK,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM;YACR,KAAK,6BAAkB,CAAC,OAAO;gBAC7B,SAAS,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM;SACT;IACH,CAAC;IAED;;;;;OAKG;IACI,2BAA2B;QAChC,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC5B,0KAA0K;YAC1K,OAAO,IAAiC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC7C,CAAC;CACF;AA9OD,8CA8OC","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 Tiles\r\n */\r\n\r\nimport { assert, BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Range1d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, FeatureAppearanceProvider, FrustumPlanes, HiddenLine, PlanarClipMaskPriority, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { HitDetail } from \"../HitDetail\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderMemory } from \"../render/RenderMemory\";\r\nimport { DecorateContext, SceneContext } from \"../ViewContext\";\r\nimport { ScreenViewport } from \"../Viewport\";\r\nimport {\r\n DisclosedTileTreeSet, GeometryTileTreeReference, MapFeatureInfoOptions, MapLayerFeatureInfo, TileDrawArgs, TileGeometryCollector, TileTree, TileTreeLoadStatus, TileTreeOwner,\r\n} from \"./internal\";\r\n\r\n/** Describes the type of graphics produced by a [[TileTreeReference]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TileGraphicType {\r\n /** Rendered behind all other geometry without depth. */\r\n BackgroundMap = 0,\r\n /** Rendered with normal scene graphics. */\r\n Scene = 1,\r\n /** Rendered in front of all other geometry. */\r\n Overlay = 2,\r\n}\r\n\r\n/** A reference to a [[TileTree]] suitable for drawing within a [[Viewport]]. The reference does not *own* its tile tree - it merely refers to it by\r\n * way of the tree's [[TileTreeOwner]].\r\n * The specific [[TileTree]] referenced by this object may change based on the current state of the Viewport in which it is drawn - for example,\r\n * as a result of changing the RenderMode, or animation settings, or classification settings, etc.\r\n * A reference to a TileTree is typically associated with a [[ViewState]], a [[DisplayStyleState]], or a [[Viewport]].\r\n * Multiple TileTreeReferences can refer to the same TileTree with different parameters and logic - for example, the same background map tiles can be displayed in two viewports with\r\n * differing levels of transparency.\r\n * @see [[TiledGraphicsProvider]] to supply custom [[TileTreeReference]]s to be drawn within a [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class TileTreeReference /* implements RenderMemory.Consumer */ {\r\n /** The owner of the currently-referenced [[TileTree]]. Do not store a direct reference to it, because it may change or become disposed at any time. */\r\n public abstract get treeOwner(): TileTreeOwner;\r\n\r\n /** Force a new tree owner / tile tree to be created for the current tile tree reference\r\n /* @internal */\r\n public resetTreeOwner() {}\r\n\r\n /** Disclose *all* TileTrees use by this reference. This may include things like map tiles used for draping on terrain.\r\n * Override this and call super if you have such auxiliary trees.\r\n * @note Any tree *NOT* disclosed becomes a candidate for *purging* (being unloaded from memory along with all of its tiles and graphics).\r\n */\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree)\r\n trees.add(tree);\r\n }\r\n\r\n /** Adds this reference's graphics to the scene. By default this invokes [[draw]]. */\r\n public addToScene(context: SceneContext): void {\r\n const args = this.createDrawArgs(context);\r\n if (undefined !== args)\r\n this.draw(args);\r\n }\r\n\r\n /** Adds this reference's graphics to the scene. By default this invokes [[TileTree.draw]] on the referenced TileTree, if it is loaded. */\r\n public draw(args: TileDrawArgs): void {\r\n args.tree.draw(args);\r\n }\r\n\r\n /** Optionally return a tooltip describing the hit. */\r\n public async getToolTip(_hit: HitDetail): Promise<HTMLElement | string | undefined> { return undefined; }\r\n\r\n /** Optionally return a MapLayerFeatureInfo object describing the hit.].\r\n * @alpha\r\n */\r\n public async getMapFeatureInfo(_hit: HitDetail, _options?: MapFeatureInfoOptions): Promise<MapLayerFeatureInfo[] | undefined> { return undefined; }\r\n\r\n /** Optionally add any decorations specific to this reference. For example, map tile trees may add a logo image and/or copyright attributions.\r\n * @note This is currently only invoked for background maps and TiledGraphicsProviders - others have no decorations, but if they did implement this it would not be called.\r\n */\r\n public decorate(_context: DecorateContext): void { }\r\n\r\n /** Unions this reference's range with the supplied range to help compute a volume in world space for fitting a viewport to its contents.\r\n * Override this function if a reference's range should not be included in the fit range, or a range different from its tile tree's range should be used.\r\n */\r\n public unionFitRange(union: Range3d): void {\r\n const contentRange = this.computeWorldContentRange();\r\n if (!contentRange.isNull)\r\n union.extendRange(contentRange);\r\n }\r\n\r\n /** Record graphics memory consumed by this tile tree reference. */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree)\r\n tree.collectStatistics(stats);\r\n }\r\n\r\n /** Return true if the tile tree is fully loaded and ready to draw.\r\n * The default implementation returns true if the tile tree loading process completed (whether it resulted in success or failure).\r\n * @note Do *not* override this property - override [[_isLoadingComplete]] instead..\r\n * @public\r\n */\r\n public get isLoadingComplete(): boolean {\r\n switch (this.treeOwner.loadStatus) {\r\n case TileTreeLoadStatus.NotLoaded:\r\n case TileTreeLoadStatus.Loading:\r\n return false;\r\n case TileTreeLoadStatus.NotFound:\r\n return true; // we tried, and failed, to load.\r\n case TileTreeLoadStatus.Loaded:\r\n return this._isLoadingComplete;\r\n }\r\n }\r\n\r\n /** Override if additional asynchronous loading is required after the tile tree is successfully loaded, to indicate when that loading has completed.\r\n * @public\r\n */\r\n protected get _isLoadingComplete(): boolean {\r\n return true;\r\n }\r\n\r\n /** Create context for drawing the tile tree, if it is ready for drawing.\r\n * TileTreeReferences can override individual portions of the context, e.g. apply their own transform.\r\n * Returns undefined if, e.g., the tile tree is not yet loaded.\r\n */\r\n public createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const tree = this.treeOwner.load();\r\n if (undefined === tree)\r\n return undefined;\r\n\r\n return new TileDrawArgs({\r\n context,\r\n tree,\r\n now: BeTimePoint.now(),\r\n location: this.computeTransform(tree),\r\n viewFlagOverrides: this.getViewFlagOverrides(tree),\r\n clipVolume: this.getClipVolume(tree),\r\n parentsAndChildrenExclusive: tree.parentsAndChildrenExclusive,\r\n symbologyOverrides: this.getSymbologyOverrides(tree),\r\n appearanceProvider: this.getAppearanceProvider(tree),\r\n hiddenLineSettings: this.getHiddenLineSettings(tree),\r\n animationTransformNodeId: this.getAnimationTransformNodeId(tree),\r\n });\r\n }\r\n\r\n /** @internal */\r\n protected getAnimationTransformNodeId(_tree: TileTree): number | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Supply transform from this tile tree reference's location to iModel coordinate space.\r\n * @returns undefined if the TileTree is not yet loaded.\r\n */\r\n public getLocation(): Transform | undefined {\r\n const tree = this.treeOwner.load();\r\n return undefined !== tree ? this.computeTransform(tree) : undefined;\r\n }\r\n\r\n /** Compute a transform from this tile tree reference's coordinate space to the [[IModelConnection]]'s coordinate space. */\r\n protected computeTransform(tree: TileTree): Transform {\r\n return tree.iModelTransform.clone();\r\n }\r\n\r\n /** Compute the range of this tile tree's contents in world coordinates.\r\n * @returns The content range in world coodinates, or a null range if the tile tree is not loaded or has a null content range.\r\n */\r\n public computeWorldContentRange(): ElementAlignedBox3d {\r\n const range = new Range3d();\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree && !tree.rootTile.contentRange.isNull)\r\n this.computeTransform(tree).multiplyRange(tree.rootTile.contentRange, range);\r\n\r\n return range;\r\n }\r\n\r\n /** Return the clip volume applied to this reference's tile tree, if any. */\r\n protected getClipVolume(tree: TileTree): RenderClipVolume | undefined {\r\n return tree.clipVolume;\r\n }\r\n\r\n /** Supply overrides that should be applied to the [[ViewState]]'s [ViewFlags]($common) when drawing this tile tree reference. */\r\n protected getViewFlagOverrides(tree: TileTree): ViewFlagOverrides {\r\n return tree.viewFlagOverrides;\r\n }\r\n\r\n /** Return overrides that *replace* any defined for the view. */\r\n protected getSymbologyOverrides(_tree: TileTree): FeatureSymbology.Overrides | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Return a provider that can supplement the view's symbology overrides. */\r\n protected getAppearanceProvider(_tree: TileTree): FeatureAppearanceProvider | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Return hidden line settings to replace those defined for the view. */\r\n protected getHiddenLineSettings(_tree: TileTree): HiddenLine.Settings | undefined {\r\n return undefined;\r\n }\r\n\r\n /* Extend range to include transformed range of this tile tree.\r\n * @internal\r\n */\r\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, frustumPlanes?: FrustumPlanes) {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined === tree)\r\n return;\r\n\r\n const location = this.computeTransform(tree);\r\n tree.accumulateTransformedRange(range, matrix, location, frustumPlanes);\r\n }\r\n\r\n /** @internal */\r\n public getTerrainHeight(_terrainHeights: Range1d): void { }\r\n\r\n /** Return whether the geometry exposed by this tile tree reference should cast shadows on other geometry. */\r\n public get castsShadows(): boolean {\r\n return true;\r\n }\r\n\r\n /** Return whether this reference has global coverage. Mapping data is global and some non-primary models such as the OSM building layer have global coverage */\r\n public get isGlobal(): boolean { return false; }\r\n\r\n /** Return the clip mask priority for this model - models will be clipped by any other viewed model with a higher proirity.\r\n * BIM models have highest prioirty and are never clipped.\r\n * @alpha\r\n */\r\n public get planarclipMaskPriority(): number { return PlanarClipMaskPriority.DesignModel; }\r\n\r\n /** Add attribution logo cards for the tile tree source logo cards to the viewport's logo div. */\r\n public addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void { }\r\n\r\n /** Create a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]].\r\n * Return `undefined` if geometry collection is not supported.\r\n * @see [[createGeometryTreeReference]].\r\n * @beta\r\n */\r\n protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined {\r\n return undefined;\r\n }\r\n\r\n /** If defined, supplies the implementation of [[GeometryTileTreeReference.collectTileGeometry]].\r\n * @beta\r\n */\r\n public collectTileGeometry?: (collector: TileGeometryCollector) => void;\r\n\r\n /** A function that can be assigned to [[collectTileGeometry]] to enable geometry collection for references to tile trees that support geometry collection.\r\n * @beta\r\n */\r\n protected _collectTileGeometry(collector: TileGeometryCollector): void {\r\n const tree = this.treeOwner.load();\r\n switch (this.treeOwner.loadStatus) {\r\n case TileTreeLoadStatus.Loaded:\r\n assert(undefined !== tree);\r\n tree.collectTileGeometry(collector);\r\n break;\r\n case TileTreeLoadStatus.Loading:\r\n collector.markLoading();\r\n break;\r\n }\r\n }\r\n\r\n /** Obtain a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]], or\r\n * undefined if geometry collection is not supported.\r\n * Currently, only terrain and reality model tiles support geometry collection.\r\n * @note Do not override this method - override [[_createGeometryTreeReference]] instead.\r\n * @beta\r\n */\r\n public createGeometryTreeReference(): GeometryTileTreeReference | undefined {\r\n if (this.collectTileGeometry) {\r\n // Unclear why compiler doesn't detect that `this` satisfies the GeometryTileTreeReference interface...it must be looking only at the types, not this particular instance.\r\n return this as GeometryTileTreeReference;\r\n }\r\n\r\n return this._createGeometryTreeReference();\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"TileTreeReference.js","sourceRoot":"","sources":["../../../src/tile/TileTreeReference.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA0D;AAC1D,w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AAE,CAAC;gBACxB,MAAM;SACT;IACH,CAAC;IAED;;;;;OAKG;IACI,2BAA2B;QAChC,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC5B,0KAA0K;YAC1K,OAAO,IAAiC,CAAC;SAC1C;QAED,OAAO,IAAI,CAAC,4BAA4B,EAAE,CAAC;IAC7C,CAAC;CACF;AA/OD,8CA+OC","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 Tiles\r\n */\r\n\r\nimport { assert, BeTimePoint } from \"@itwin/core-bentley\";\r\nimport { Matrix4d, Range1d, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { ElementAlignedBox3d, FeatureAppearanceProvider, FrustumPlanes, HiddenLine, PlanarClipMaskPriority, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { HitDetail } from \"../HitDetail\";\r\nimport { FeatureSymbology } from \"../render/FeatureSymbology\";\r\nimport { RenderClipVolume } from \"../render/RenderClipVolume\";\r\nimport { RenderMemory } from \"../render/RenderMemory\";\r\nimport { DecorateContext, SceneContext } from \"../ViewContext\";\r\nimport { ScreenViewport } from \"../Viewport\";\r\nimport {\r\n DisclosedTileTreeSet, GeometryTileTreeReference, MapFeatureInfoOptions, MapLayerFeatureInfo, TileDrawArgs, TileGeometryCollector, TileTree, TileTreeLoadStatus, TileTreeOwner,\r\n} from \"./internal\";\r\n\r\n/** Describes the type of graphics produced by a [[TileTreeReference]].\r\n * @public\r\n * @extensions\r\n */\r\nexport enum TileGraphicType {\r\n /** Rendered behind all other geometry without depth. */\r\n BackgroundMap = 0,\r\n /** Rendered with normal scene graphics. */\r\n Scene = 1,\r\n /** Rendered in front of all other geometry. */\r\n Overlay = 2,\r\n}\r\n\r\n/** A reference to a [[TileTree]] suitable for drawing within a [[Viewport]]. The reference does not *own* its tile tree - it merely refers to it by\r\n * way of the tree's [[TileTreeOwner]].\r\n * The specific [[TileTree]] referenced by this object may change based on the current state of the Viewport in which it is drawn - for example,\r\n * as a result of changing the RenderMode, or animation settings, or classification settings, etc.\r\n * A reference to a TileTree is typically associated with a [[ViewState]], a [[DisplayStyleState]], or a [[Viewport]].\r\n * Multiple TileTreeReferences can refer to the same TileTree with different parameters and logic - for example, the same background map tiles can be displayed in two viewports with\r\n * differing levels of transparency.\r\n * @see [[TiledGraphicsProvider]] to supply custom [[TileTreeReference]]s to be drawn within a [[Viewport]].\r\n * @public\r\n * @extensions\r\n */\r\nexport abstract class TileTreeReference /* implements RenderMemory.Consumer */ {\r\n /** The owner of the currently-referenced [[TileTree]]. Do not store a direct reference to it, because it may change or become disposed at any time. */\r\n public abstract get treeOwner(): TileTreeOwner;\r\n\r\n /** Force a new tree owner / tile tree to be created for the current tile tree reference\r\n * @internal\r\n */\r\n public resetTreeOwner() {}\r\n\r\n /** Disclose *all* TileTrees use by this reference. This may include things like map tiles used for draping on terrain.\r\n * Override this and call super if you have such auxiliary trees.\r\n * @note Any tree *NOT* disclosed becomes a candidate for *purging* (being unloaded from memory along with all of its tiles and graphics).\r\n */\r\n public discloseTileTrees(trees: DisclosedTileTreeSet): void {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree)\r\n trees.add(tree);\r\n }\r\n\r\n /** Adds this reference's graphics to the scene. By default this invokes [[draw]]. */\r\n public addToScene(context: SceneContext): void {\r\n const args = this.createDrawArgs(context);\r\n if (undefined !== args)\r\n this.draw(args);\r\n }\r\n\r\n /** Adds this reference's graphics to the scene. By default this invokes [[TileTree.draw]] on the referenced TileTree, if it is loaded. */\r\n public draw(args: TileDrawArgs): void {\r\n args.tree.draw(args);\r\n }\r\n\r\n /** Optionally return a tooltip describing the hit. */\r\n public async getToolTip(_hit: HitDetail): Promise<HTMLElement | string | undefined> { return undefined; }\r\n\r\n /** Optionally return a MapLayerFeatureInfo object describing the hit.].\r\n * @alpha\r\n */\r\n public async getMapFeatureInfo(_hit: HitDetail, _options?: MapFeatureInfoOptions): Promise<MapLayerFeatureInfo[] | undefined> { return undefined; }\r\n\r\n /** Optionally add any decorations specific to this reference. For example, map tile trees may add a logo image and/or copyright attributions.\r\n * @note This is currently only invoked for background maps and TiledGraphicsProviders - others have no decorations, but if they did implement this it would not be called.\r\n */\r\n public decorate(_context: DecorateContext): void { }\r\n\r\n /** Unions this reference's range with the supplied range to help compute a volume in world space for fitting a viewport to its contents.\r\n * Override this function if a reference's range should not be included in the fit range, or a range different from its tile tree's range should be used.\r\n */\r\n public unionFitRange(union: Range3d): void {\r\n const contentRange = this.computeWorldContentRange();\r\n if (!contentRange.isNull)\r\n union.extendRange(contentRange);\r\n }\r\n\r\n /** Record graphics memory consumed by this tile tree reference. */\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree)\r\n tree.collectStatistics(stats);\r\n }\r\n\r\n /** Return true if the tile tree is fully loaded and ready to draw.\r\n * The default implementation returns true if the tile tree loading process completed (whether it resulted in success or failure).\r\n * @note Do *not* override this property - override [[_isLoadingComplete]] instead..\r\n * @public\r\n */\r\n public get isLoadingComplete(): boolean {\r\n switch (this.treeOwner.loadStatus) {\r\n case TileTreeLoadStatus.NotLoaded:\r\n case TileTreeLoadStatus.Loading:\r\n return false;\r\n case TileTreeLoadStatus.NotFound:\r\n return true; // we tried, and failed, to load.\r\n case TileTreeLoadStatus.Loaded:\r\n return this._isLoadingComplete;\r\n }\r\n }\r\n\r\n /** Override if additional asynchronous loading is required after the tile tree is successfully loaded, to indicate when that loading has completed.\r\n * @public\r\n */\r\n protected get _isLoadingComplete(): boolean {\r\n return true;\r\n }\r\n\r\n /** Create context for drawing the tile tree, if it is ready for drawing.\r\n * TileTreeReferences can override individual portions of the context, e.g. apply their own transform.\r\n * Returns undefined if, e.g., the tile tree is not yet loaded.\r\n */\r\n public createDrawArgs(context: SceneContext): TileDrawArgs | undefined {\r\n const tree = this.treeOwner.load();\r\n if (undefined === tree)\r\n return undefined;\r\n\r\n return new TileDrawArgs({\r\n context,\r\n tree,\r\n now: BeTimePoint.now(),\r\n location: this.computeTransform(tree),\r\n viewFlagOverrides: this.getViewFlagOverrides(tree),\r\n clipVolume: this.getClipVolume(tree),\r\n parentsAndChildrenExclusive: tree.parentsAndChildrenExclusive,\r\n symbologyOverrides: this.getSymbologyOverrides(tree),\r\n appearanceProvider: this.getAppearanceProvider(tree),\r\n hiddenLineSettings: this.getHiddenLineSettings(tree),\r\n animationTransformNodeId: this.getAnimationTransformNodeId(tree),\r\n });\r\n }\r\n\r\n /** @internal */\r\n protected getAnimationTransformNodeId(_tree: TileTree): number | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Supply transform from this tile tree reference's location to iModel coordinate space.\r\n * @returns undefined if the TileTree is not yet loaded.\r\n */\r\n public getLocation(): Transform | undefined {\r\n const tree = this.treeOwner.load();\r\n return undefined !== tree ? this.computeTransform(tree) : undefined;\r\n }\r\n\r\n /** Compute a transform from this tile tree reference's coordinate space to the [[IModelConnection]]'s coordinate space. */\r\n protected computeTransform(tree: TileTree): Transform {\r\n return tree.iModelTransform.clone();\r\n }\r\n\r\n /** Compute the range of this tile tree's contents in world coordinates.\r\n * @returns The content range in world coodinates, or a null range if the tile tree is not loaded or has a null content range.\r\n */\r\n public computeWorldContentRange(): ElementAlignedBox3d {\r\n const range = new Range3d();\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined !== tree && !tree.rootTile.contentRange.isNull)\r\n this.computeTransform(tree).multiplyRange(tree.rootTile.contentRange, range);\r\n\r\n return range;\r\n }\r\n\r\n /** Return the clip volume applied to this reference's tile tree, if any. */\r\n protected getClipVolume(tree: TileTree): RenderClipVolume | undefined {\r\n return tree.clipVolume;\r\n }\r\n\r\n /** Supply overrides that should be applied to the [[ViewState]]'s [ViewFlags]($common) when drawing this tile tree reference. */\r\n protected getViewFlagOverrides(tree: TileTree): ViewFlagOverrides {\r\n return tree.viewFlagOverrides;\r\n }\r\n\r\n /** Return overrides that *replace* any defined for the view. */\r\n protected getSymbologyOverrides(_tree: TileTree): FeatureSymbology.Overrides | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Return a provider that can supplement the view's symbology overrides. */\r\n protected getAppearanceProvider(_tree: TileTree): FeatureAppearanceProvider | undefined {\r\n return undefined;\r\n }\r\n\r\n /** Return hidden line settings to replace those defined for the view. */\r\n protected getHiddenLineSettings(_tree: TileTree): HiddenLine.Settings | undefined {\r\n return undefined;\r\n }\r\n\r\n /* Extend range to include transformed range of this tile tree.\r\n * @internal\r\n */\r\n public accumulateTransformedRange(range: Range3d, matrix: Matrix4d, frustumPlanes?: FrustumPlanes) {\r\n const tree = this.treeOwner.tileTree;\r\n if (undefined === tree)\r\n return;\r\n\r\n const location = this.computeTransform(tree);\r\n tree.accumulateTransformedRange(range, matrix, location, frustumPlanes);\r\n }\r\n\r\n /** @internal */\r\n public getTerrainHeight(_terrainHeights: Range1d): void { }\r\n\r\n /** Return whether the geometry exposed by this tile tree reference should cast shadows on other geometry. */\r\n public get castsShadows(): boolean {\r\n return true;\r\n }\r\n\r\n /** Return whether this reference has global coverage. Mapping data is global and some non-primary models such as the OSM building layer have global coverage */\r\n public get isGlobal(): boolean { return false; }\r\n\r\n /** Return the clip mask priority for this model - models will be clipped by any other viewed model with a higher proirity.\r\n * BIM models have highest prioirty and are never clipped.\r\n * @alpha\r\n */\r\n public get planarclipMaskPriority(): number { return PlanarClipMaskPriority.DesignModel; }\r\n\r\n /** Add attribution logo cards for the tile tree source logo cards to the viewport's logo div. */\r\n public addLogoCards(_cards: HTMLTableElement, _vp: ScreenViewport): void { }\r\n\r\n /** Create a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]].\r\n * Return `undefined` if geometry collection is not supported.\r\n * @see [[createGeometryTreeReference]].\r\n * @beta\r\n */\r\n protected _createGeometryTreeReference(): GeometryTileTreeReference | undefined {\r\n return undefined;\r\n }\r\n\r\n /** If defined, supplies the implementation of [[GeometryTileTreeReference.collectTileGeometry]].\r\n * @beta\r\n */\r\n public collectTileGeometry?: (collector: TileGeometryCollector) => void;\r\n\r\n /** A function that can be assigned to [[collectTileGeometry]] to enable geometry collection for references to tile trees that support geometry collection.\r\n * @beta\r\n */\r\n protected _collectTileGeometry(collector: TileGeometryCollector): void {\r\n const tree = this.treeOwner.load();\r\n switch (this.treeOwner.loadStatus) {\r\n case TileTreeLoadStatus.Loaded:\r\n assert(undefined !== tree);\r\n tree.collectTileGeometry(collector);\r\n break;\r\n case TileTreeLoadStatus.Loading:\r\n collector.markLoading();\r\n break;\r\n }\r\n }\r\n\r\n /** Obtain a tile tree reference equivalent to this one that also supplies an implementation of [[GeometryTileTreeReference.collectTileGeometry]], or\r\n * undefined if geometry collection is not supported.\r\n * Currently, only terrain and reality model tiles support geometry collection.\r\n * @note Do not override this method - override [[_createGeometryTreeReference]] instead.\r\n * @beta\r\n */\r\n public createGeometryTreeReference(): GeometryTileTreeReference | undefined {\r\n if (this.collectTileGeometry) {\r\n // Unclear why compiler doesn't detect that `this` satisfies the GeometryTileTreeReference interface...it must be looking only at the types, not this particular instance.\r\n return this as GeometryTileTreeReference;\r\n }\r\n\r\n return this._createGeometryTreeReference();\r\n }\r\n}\r\n"]}
@@ -2,7 +2,10 @@ import { MapCartoRectangle, MapLayerAccessClient, MapLayerAccessToken, MapLayerA
2
2
  /** @packageDocumentation
3
3
  * @module Tiles
4
4
  */
5
- /** @internal */
5
+ /**
6
+ * Class representing an ArcGIS error code.
7
+ * @internal
8
+ */
6
9
  export declare enum ArcGisErrorCode {
7
10
  InvalidCredentials = 401,
8
11
  InvalidToken = 498,
@@ -10,27 +13,37 @@ export declare enum ArcGisErrorCode {
10
13
  UnknownError = 1000,
11
14
  NoTokenService = 1001
12
15
  }
13
- /** Class representing an ArcGIS service metadata.
16
+ /**
17
+ * Class representing an ArcGIS service metadata.
14
18
  * @internal
15
- * */
19
+ */
16
20
  export interface ArcGISServiceMetadata {
17
21
  /** JSON content from the service */
18
22
  content: any;
19
23
  /** Indicates if an access token is required to access the service */
20
24
  accessTokenRequired: boolean;
21
25
  }
22
- /** @internal */
26
+ /**
27
+ * Class containing utilities relating to ArcGIS services and coordinate systems.
28
+ * @internal
29
+ */
23
30
  export declare class ArcGisUtilities {
24
31
  private static getBBoxString;
25
32
  static getNationalMapSources(): Promise<MapLayerSource[]>;
26
33
  static getServiceDirectorySources(url: string, baseUrl?: string): Promise<MapLayerSource[]>;
34
+ /**
35
+ * Get map layer sources from an ArcGIS query.
36
+ * @param range Range for the query.
37
+ * @param url URL for the query.
38
+ * @returns List of map layer sources.
39
+ */
27
40
  static getSourcesFromQuery(range?: MapCartoRectangle, url?: string): Promise<MapLayerSource[]>;
28
41
  /**
29
- * Parse the URL to check if it represent a valid ArcGIS service
42
+ * Parse the URL to check if it represents a valid ArcGIS service
30
43
  * @param url URL to validate.
31
44
  * @param serviceType Service type to validate (i.e FeatureServer, MapServer)
32
45
  * @return Validation Status.
33
- */
46
+ */
34
47
  static validateUrl(url: string, serviceType: string): MapLayerSourceStatus;
35
48
  /**
36
49
  * Attempt to access an ArcGIS service, and validate its service metadata.
@@ -39,25 +52,28 @@ export declare class ArcGisUtilities {
39
52
  * @param capabilitiesFilter List of capabilities 'keyword' that needs to be advertised in the service's metadata
40
53
  * in order to be valid. For example: 'Map', 'Query', etc
41
54
  * @param userName Username to use for legacy token based security.
42
- * @param password Username to use for legacy token based security.
55
+ * @param password Password to use for legacy token based security.
43
56
  * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)
44
57
  * @return Validation Status. If successful, a list of available sub-layers will also be returned.
45
- */
58
+ */
46
59
  static validateSource(url: string, formatId: string, capabilitiesFilter: string[], userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation>;
47
- /**
48
- * Validate MapService tiling metadata and checks if the tile tree is 'Google Maps' compatible.
49
- */
60
+ /** Validate MapService tiling metadata and checks if the tile tree is 'Google Maps' compatible. */
50
61
  static isEpsg3857Compatible(tileInfo: any): boolean;
51
62
  private static _serviceCache;
52
63
  /**
53
- * Fetch an ArcGIS service metadata, and returns its JSON representation.
64
+ * Fetches an ArcGIS service metadata, and returns its JSON representation.
54
65
  * If an access client has been configured for the specified formatId,
55
66
  * it will be used to apply required security token.
56
67
  * By default, response for each URL are cached.
57
- */
68
+ * @param url URL of the ArcGIS service
69
+ * @param formatId Format ID of the service
70
+ * @param userName Username to use for legacy token based security
71
+ * @param password Password to use for legacy token based security
72
+ * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)
73
+ * @param requireToken Flag to indicate if a token is required
74
+ */
58
75
  static getServiceJson(url: string, formatId: string, userName?: string, password?: string, ignoreCache?: boolean, requireToken?: boolean): Promise<ArcGISServiceMetadata | undefined>;
59
- /** Read a response from ArcGIS server and check for error code in the response.
60
- */
76
+ /** Read a response from ArcGIS server and check for error code in the response. */
61
77
  static checkForResponseErrorCode(response: Response): Promise<number | undefined>;
62
78
  static appendSecurityToken(url: URL, accessClient: MapLayerAccessClient, accessTokenParams: MapLayerAccessTokenParams): Promise<MapLayerAccessToken | undefined>;
63
79
  /**
@@ -69,8 +85,7 @@ export declare class ArcGisUtilities {
69
85
  * @param latitude Latitude in degrees to use to compute scales (i.e 0 for Equator)
70
86
  * @param tileSize Size of a tile in pixels (i.e 256)
71
87
  * @param screenDpi Monitor resolution in dots per inch (i.e. typically 96dpi is used by Google Maps)
72
- *
73
- * @returns An array containing resolution and scale values for each requested zoom level
88
+ * @returns An array containing resolution and scale values for each requested zoom level
74
89
  */
75
90
  static computeZoomLevelsScales(startZoom?: number, endZoom?: number, latitude?: number, tileSize?: number, screenDpi?: number): {
76
91
  zoom: number;
@@ -78,12 +93,12 @@ export declare class ArcGisUtilities {
78
93
  scale: number;
79
94
  }[];
80
95
  /**
81
- * Match the provided minScale,maxScale values to corresponding wgs84 zoom levels
96
+ * Match the provided minScale, maxScale values to corresponding wgs84 zoom levels
82
97
  * @param defaultMaxLod Value of the last LOD (i.e 22)
83
98
  * @param tileSize Size of a tile in pixels (i.e 256)
84
99
  * @param minScale Minimum scale value that needs to be matched to a LOD level
85
100
  * @param maxScale Maximum scale value that needs to be matched to a LOD level
86
- * @returns minLod: LOD value matching minScale, maxLod: LOD value matching maxScale
101
+ * @returns minLod: LOD value matching minScale, maxLod: LOD value matching maxScale
87
102
  */
88
103
  static getZoomLevelsScales(defaultMaxLod: number, tileSize: number, minScale?: number, maxScale?: number, tolerance?: number): {
89
104
  minLod?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGisUtilities.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,cAAc,EAAE,oBAAoB,EAAE,wBAAwB,EAAC,MAAM,aAAa,CAAC;AAGrL;;GAEG;AACH,gBAAgB;AAChB,oBAAY,eAAe;IACzB,kBAAkB,MAAM;IACxB,YAAY,MAAM;IAClB,aAAa,MAAM;IACnB,YAAY,OAAO;IACnB,cAAc,OAAO;CACtB;AAED;;KAEK;AACL,MAAM,WAAW,qBAAqB;IACpC,oCAAoC;IACpC,OAAO,EAAE,GAAG,CAAC;IAEb,qEAAqE;IACrE,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,gBAAgB;AAChB,qBAAa,eAAe;IAE1B,OAAO,CAAC,MAAM,CAAC,aAAa;WAOR,qBAAqB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;WA2BlD,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;WA2BpF,mBAAmB,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAqD,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAqBvJ;;;;;MAKE;WACY,WAAW,CAAC,GAAG,EAAE,MA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
12
12
  * @module Tiles
13
13
  */
14
- /** @internal */
14
+ /**
15
+ * Class representing an ArcGIS error code.
16
+ * @internal
17
+ */
15
18
  var ArcGisErrorCode;
16
19
  (function (ArcGisErrorCode) {
17
20
  ArcGisErrorCode[ArcGisErrorCode["InvalidCredentials"] = 401] = "InvalidCredentials";
@@ -20,7 +23,10 @@ var ArcGisErrorCode;
20
23
  ArcGisErrorCode[ArcGisErrorCode["UnknownError"] = 1000] = "UnknownError";
21
24
  ArcGisErrorCode[ArcGisErrorCode["NoTokenService"] = 1001] = "NoTokenService";
22
25
  })(ArcGisErrorCode = exports.ArcGisErrorCode || (exports.ArcGisErrorCode = {}));
23
- /** @internal */
26
+ /**
27
+ * Class containing utilities relating to ArcGIS services and coordinate systems.
28
+ * @internal
29
+ */
24
30
  class ArcGisUtilities {
25
31
  static getBBoxString(range) {
26
32
  if (!range)
@@ -78,6 +84,12 @@ class ArcGisUtilities {
78
84
  }
79
85
  return sources;
80
86
  }
87
+ /**
88
+ * Get map layer sources from an ArcGIS query.
89
+ * @param range Range for the query.
90
+ * @param url URL for the query.
91
+ * @returns List of map layer sources.
92
+ */
81
93
  static async getSourcesFromQuery(range, url = "https://usgs.maps.arcgis.com/sharing/rest/search") {
82
94
  const sources = new Array();
83
95
  for (let start = 1; start > 0;) {
@@ -97,11 +109,11 @@ class ArcGisUtilities {
97
109
  return sources;
98
110
  }
99
111
  /**
100
- * Parse the URL to check if it represent a valid ArcGIS service
112
+ * Parse the URL to check if it represents a valid ArcGIS service
101
113
  * @param url URL to validate.
102
114
  * @param serviceType Service type to validate (i.e FeatureServer, MapServer)
103
115
  * @return Validation Status.
104
- */
116
+ */
105
117
  static validateUrl(url, serviceType) {
106
118
  const urlObj = new URL(url.toLowerCase());
107
119
  if (urlObj.pathname.includes("/rest/services/")) {
@@ -124,10 +136,10 @@ class ArcGisUtilities {
124
136
  * @param capabilitiesFilter List of capabilities 'keyword' that needs to be advertised in the service's metadata
125
137
  * in order to be valid. For example: 'Map', 'Query', etc
126
138
  * @param userName Username to use for legacy token based security.
127
- * @param password Username to use for legacy token based security.
139
+ * @param password Password to use for legacy token based security.
128
140
  * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)
129
141
  * @return Validation Status. If successful, a list of available sub-layers will also be returned.
130
- */
142
+ */
131
143
  static async validateSource(url, formatId, capabilitiesFilter, userName, password, ignoreCache) {
132
144
  const metadata = await this.getServiceJson(url, formatId, userName, password, ignoreCache);
133
145
  const json = metadata?.content;
@@ -171,9 +183,7 @@ class ArcGisUtilities {
171
183
  }
172
184
  return { status: internal_1.MapLayerSourceStatus.Valid, subLayers };
173
185
  }
174
- /**
175
- * Validate MapService tiling metadata and checks if the tile tree is 'Google Maps' compatible.
176
- */
186
+ /** Validate MapService tiling metadata and checks if the tile tree is 'Google Maps' compatible. */
177
187
  static isEpsg3857Compatible(tileInfo) {
178
188
  if (tileInfo.spatialReference?.latestWkid !== 3857 || !Array.isArray(tileInfo.lods))
179
189
  return false;
@@ -181,11 +191,17 @@ class ArcGisUtilities {
181
191
  return zeroLod.level === 0 && Math.abs(zeroLod.resolution - 156543.03392800014) < .001;
182
192
  }
183
193
  /**
184
- * Fetch an ArcGIS service metadata, and returns its JSON representation.
194
+ * Fetches an ArcGIS service metadata, and returns its JSON representation.
185
195
  * If an access client has been configured for the specified formatId,
186
196
  * it will be used to apply required security token.
187
197
  * By default, response for each URL are cached.
188
- */
198
+ * @param url URL of the ArcGIS service
199
+ * @param formatId Format ID of the service
200
+ * @param userName Username to use for legacy token based security
201
+ * @param password Password to use for legacy token based security
202
+ * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)
203
+ * @param requireToken Flag to indicate if a token is required
204
+ */
189
205
  static async getServiceJson(url, formatId, userName, password, ignoreCache, requireToken) {
190
206
  if (!ignoreCache) {
191
207
  const cached = ArcGisUtilities._serviceCache.get(url);
@@ -232,8 +248,7 @@ class ArcGisUtilities {
232
248
  return undefined;
233
249
  }
234
250
  }
235
- /** Read a response from ArcGIS server and check for error code in the response.
236
- */
251
+ /** Read a response from ArcGIS server and check for error code in the response. */
237
252
  static async checkForResponseErrorCode(response) {
238
253
  const tmpResponse = response;
239
254
  if (response.headers && tmpResponse.headers.get("content-type")?.toLowerCase().includes("json")) {
@@ -274,8 +289,7 @@ class ArcGisUtilities {
274
289
  * @param latitude Latitude in degrees to use to compute scales (i.e 0 for Equator)
275
290
  * @param tileSize Size of a tile in pixels (i.e 256)
276
291
  * @param screenDpi Monitor resolution in dots per inch (i.e. typically 96dpi is used by Google Maps)
277
- *
278
- * @returns An array containing resolution and scale values for each requested zoom level
292
+ * @returns An array containing resolution and scale values for each requested zoom level
279
293
  */
280
294
  static computeZoomLevelsScales(startZoom = 0, endZoom = 20, latitude = 0, tileSize = 256, screenDpi = 96) {
281
295
  // Note: There is probably a more direct way to compute this, but I prefer to go for a simple and well documented approach.
@@ -294,12 +308,12 @@ class ArcGisUtilities {
294
308
  return results;
295
309
  }
296
310
  /**
297
- * Match the provided minScale,maxScale values to corresponding wgs84 zoom levels
311
+ * Match the provided minScale, maxScale values to corresponding wgs84 zoom levels
298
312
  * @param defaultMaxLod Value of the last LOD (i.e 22)
299
313
  * @param tileSize Size of a tile in pixels (i.e 256)
300
314
  * @param minScale Minimum scale value that needs to be matched to a LOD level
301
315
  * @param maxScale Maximum scale value that needs to be matched to a LOD level
302
- * @returns minLod: LOD value matching minScale, maxLod: LOD value matching maxScale
316
+ * @returns minLod: LOD value matching minScale, maxLod: LOD value matching maxScale
303
317
  */
304
318
  static getZoomLevelsScales(defaultMaxLod, tileSize, minScale, maxScale, tolerance = 0) {
305
319
  let minLod, maxLod;
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGisUtilities.js","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wDAAuD;AAEvD,0CAAqL;AACrL,+CAA4C;AAE5C;;GAEG;AACH,gBAAgB;AAChB,IAAY,eAMX;AAND,W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GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE;oBAC/I,CAAC;aAEJ;YAED,IAAI,QAAQ,EAAE;gBACZ,MAAM,GAAG,aAAa,CAAC;gBACvB,iFAAiF;gBACjF,OAAO,MAAM,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE;oBAC9H,CAAC;aACJ;SACF;QACD,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC;IAC1B,CAAC;;AAjKc,6BAAa,GAAG,IAAI,GAAG,EAA2C,CAAC;AA/KvE,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\nimport { Angle, Constant } from \"@itwin/core-geometry\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { MapCartoRectangle, MapLayerAccessClient, MapLayerAccessToken, MapLayerAccessTokenParams, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation} from \"../internal\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\n\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n/** @internal */\r\nexport enum ArcGisErrorCode {\r\n InvalidCredentials = 401,\r\n InvalidToken = 498,\r\n TokenRequired = 499,\r\n UnknownError = 1000,\r\n NoTokenService = 1001,\r\n}\r\n\r\n/** Class representing an ArcGIS service metadata.\r\n * @internal\r\n * */\r\nexport interface ArcGISServiceMetadata {\r\n /** JSON content from the service */\r\n content: any;\r\n\r\n /** Indicates if an access token is required to access the service */\r\n accessTokenRequired: boolean;\r\n}\r\n\r\n/** @internal */\r\nexport class ArcGisUtilities {\r\n\r\n private static getBBoxString(range?: MapCartoRectangle) {\r\n if (!range)\r\n range = MapCartoRectangle.createMaximum();\r\n\r\n return `${range.low.x * Angle.degreesPerRadian},${range.low.y * Angle.degreesPerRadian},${range.high.x * Angle.degreesPerRadian},${range.high.y * Angle.degreesPerRadian}`;\r\n }\r\n\r\n public static async getNationalMapSources(): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n const response = await fetch(\"https://viewer.nationalmap.gov/tnmaccess/api/getMapServiceList\", { method: \"GET\" });\r\n const services = await response.json();\r\n\r\n if (!Array.isArray(services))\r\n return sources;\r\n\r\n for (const service of services) {\r\n if (service.wmsUrl.length === 0) // Exclude Wfs..\r\n continue;\r\n switch (service.serviceType) {\r\n case \"ArcGIS\":\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url: service.serviceLink, formatId: \"ArcGIS\" })!);\r\n break;\r\n default: {\r\n const wmsIndex = service.wmsUrl.lastIndexOf(\"/wms\");\r\n if (wmsIndex > 0) {\r\n const url = service.wmsUrl.slice(0, wmsIndex + 4);\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url, formatId: \"WMS\" })!);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return sources;\r\n }\r\n public static async getServiceDirectorySources(url: string, baseUrl?: string): Promise<MapLayerSource[]> {\r\n if (undefined === baseUrl)\r\n baseUrl = url;\r\n let sources = new Array<MapLayerSource>();\r\n const response = await fetch(`${url}?f=json`, { method: \"GET\" });\r\n const json = await response.json();\r\n if (json !== undefined) {\r\n if (Array.isArray(json.folders)) {\r\n for (const folder of json.folders) {\r\n sources = sources.concat(await ArcGisUtilities.getServiceDirectorySources(`${url}/${folder}`, url));\r\n }\r\n }\r\n if (Array.isArray(json.services)) {\r\n for (const service of json.services) {\r\n let source;\r\n if (service.type === \"MapServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/MapServer`, formatId: \"ArcGIS\" });\r\n else if (service.type === \"ImageServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/ImageServer`, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n public static async getSourcesFromQuery(range?: MapCartoRectangle, url = \"https://usgs.maps.arcgis.com/sharing/rest/search\"): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n for (let start = 1; start > 0;) {\r\n const response = await fetch(`${url}?f=json&q=(group:9d1199a521334e77a7d15abbc29f8144) AND (type:\"Map Service\")&bbox=${ArcGisUtilities.getBBoxString(range)}&sortOrder=desc&start=${start}&num=100`, { method: \"GET\" });\r\n const json = await response.json();\r\n if (!json)\r\n break;\r\n\r\n start = json.nextStart ? json.nextStart : -1;\r\n if (json !== undefined && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n const source = MapLayerSource.fromJSON({ name: result.name ? result.name : result.title, url: result.url, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n\r\n /**\r\n * Parse the URL to check if it represent a valid ArcGIS service\r\n * @param url URL to validate.\r\n * @param serviceType Service type to validate (i.e FeatureServer, MapServer)\r\n * @return Validation Status.\r\n */\r\n public static validateUrl(url: string, serviceType: string): MapLayerSourceStatus {\r\n const urlObj = new URL(url.toLowerCase());\r\n if (urlObj.pathname.includes(\"/rest/services/\")) {\r\n // This seem to be an ArcGIS URL, lets check the service type\r\n if (urlObj.pathname.endsWith(`${serviceType.toLowerCase()}`)) {\r\n return MapLayerSourceStatus.Valid;\r\n } else {\r\n return MapLayerSourceStatus.IncompatibleFormat;\r\n }\r\n } else {\r\n return MapLayerSourceStatus.InvalidUrl;\r\n }\r\n }\r\n\r\n /**\r\n * Attempt to access an ArcGIS service, and validate its service metadata.\r\n * @param url URL of the source to validate.\r\n * @param formatId Format Id of the source.\r\n * @param capabilitiesFilter List of capabilities 'keyword' that needs to be advertised in the service's metadata\r\n * in order to be valid. For example: 'Map', 'Query', etc\r\n * @param userName Username to use for legacy token based security.\r\n * @param password Username to use for legacy token based security.\r\n * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)\r\n * @return Validation Status. If successful, a list of available sub-layers will also be returned.\r\n */\r\n public static async validateSource(url: string, formatId: string, capabilitiesFilter: string[], userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const metadata = await this.getServiceJson(url, formatId, userName, password, ignoreCache);\r\n const json = metadata?.content;\r\n if (json === undefined) {\r\n return { status: MapLayerSourceStatus.InvalidUrl };\r\n } else if (json.error !== undefined) {\r\n\r\n // If we got a 'Token Required' error, lets check what authentification methods this ESRI service offers\r\n // and return information needed to initiate the authentification process... the end-user\r\n // will have to provide his credentials before we can fully validate this source.\r\n if (json.error.code === ArcGisErrorCode.TokenRequired) {\r\n return { status: MapLayerSourceStatus.RequireAuth};\r\n } else if (json.error.code === ArcGisErrorCode.InvalidCredentials)\r\n return { status: MapLayerSourceStatus.InvalidCredentials};\r\n }\r\n\r\n // Check this service support the expected queries\r\n let hasCapabilities = false;\r\n let capsArray: string[] = [];\r\n if (json.capabilities && typeof json.capabilities === \"string\" ) {\r\n const capabilities: string = json.capabilities;\r\n capsArray = capabilities.split(\",\").map((entry) => entry.toLowerCase());\r\n\r\n const filtered = capsArray.filter((element, _index, _array) => capabilitiesFilter.includes(element));\r\n hasCapabilities = (filtered.length === capabilitiesFilter.length);\r\n }\r\n if (!hasCapabilities) {\r\n return { status: MapLayerSourceStatus.InvalidFormat};\r\n }\r\n\r\n // Only EPSG:3857 is supported with pre-rendered tiles.\r\n if (json.tileInfo && capsArray.includes(\"tilesonly\") && !ArcGisUtilities.isEpsg3857Compatible(json.tileInfo)) {\r\n return { status: MapLayerSourceStatus.InvalidCoordinateSystem};\r\n }\r\n\r\n let subLayers;\r\n if (json.layers) {\r\n\r\n subLayers = new Array<MapSubLayerProps>();\r\n\r\n for (const layer of json.layers) {\r\n const parent = layer.parentLayerId < 0 ? undefined : layer.parentLayerId;\r\n const children = Array.isArray(layer.subLayerIds) ? layer.subLayerIds : undefined;\r\n subLayers.push({ name: layer.name, visible: layer.defaultVisibility !== false, id: layer.id, parent, children });\r\n }\r\n }\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n }\r\n\r\n /**\r\n * Validate MapService tiling metadata and checks if the tile tree is 'Google Maps' compatible.\r\n */\r\n public static isEpsg3857Compatible(tileInfo: any) {\r\n if (tileInfo.spatialReference?.latestWkid !== 3857 || !Array.isArray(tileInfo.lods))\r\n return false;\r\n\r\n const zeroLod = tileInfo.lods[0];\r\n return zeroLod.level === 0 && Math.abs(zeroLod.resolution - 156543.03392800014) < .001;\r\n }\r\n\r\n private static _serviceCache = new Map<string, ArcGISServiceMetadata|undefined>();\r\n\r\n /**\r\n * Fetch an ArcGIS service metadata, and returns its JSON representation.\r\n * If an access client has been configured for the specified formatId,\r\n * it will be used to apply required security token.\r\n * By default, response for each URL are cached.\r\n */\r\n public static async getServiceJson(url: string, formatId: string, userName?: string, password?: string, ignoreCache?: boolean, requireToken?: boolean): Promise<ArcGISServiceMetadata|undefined> {\r\n if (!ignoreCache) {\r\n const cached = ArcGisUtilities._serviceCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n let accessTokenRequired = false;\r\n try {\r\n let tmpUrl = new URL(url);\r\n tmpUrl.searchParams.append(\"f\", \"json\");\r\n\r\n // In some cases, caller might already know token is required, so append it immediately\r\n if (requireToken) {\r\n const accessClient = IModelApp.mapLayerFormatRegistry.getAccessClient(formatId);\r\n if (accessClient) {\r\n accessTokenRequired = true;\r\n await ArcGisUtilities.appendSecurityToken(tmpUrl, accessClient, {mapLayerUrl: new URL(url), userName, password});\r\n }\r\n }\r\n let response = await fetch(tmpUrl.toString(), { method: \"GET\" });\r\n\r\n // Append security token when corresponding error code is returned by ArcGIS service\r\n let errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n if (!accessTokenRequired\r\n && errorCode !== undefined\r\n && errorCode === ArcGisErrorCode.TokenRequired ) {\r\n accessTokenRequired = true;\r\n // If token required\r\n const accessClient = IModelApp.mapLayerFormatRegistry.getAccessClient(formatId);\r\n if (accessClient) {\r\n tmpUrl = new URL(url);\r\n tmpUrl.searchParams.append(\"f\", \"json\");\r\n await ArcGisUtilities.appendSecurityToken(tmpUrl, accessClient, {mapLayerUrl: new URL(url), userName, password});\r\n response = await fetch(tmpUrl.toString(), { method: \"GET\" });\r\n errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n }\r\n }\r\n\r\n const json = await response.json();\r\n const info = {content: json, accessTokenRequired};\r\n // Cache the response only if it doesn't contain any error.\r\n ArcGisUtilities._serviceCache.set(url, (errorCode === undefined ? info : undefined));\r\n return info; // Always return json, even though it contains an error code.\r\n\r\n } catch (_error) {\r\n ArcGisUtilities._serviceCache.set(url, undefined);\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Read a response from ArcGIS server and check for error code in the response.\r\n */\r\n public static async checkForResponseErrorCode(response: Response) {\r\n const tmpResponse = response;\r\n if (response.headers && tmpResponse.headers.get(\"content-type\")?.toLowerCase().includes(\"json\")) {\r\n\r\n try {\r\n // Note:\r\n // Since response stream can only be read once (i.e. calls to .json() method)\r\n // we have to clone the response object in order to check for potential error code,\r\n // but still keep the response stream as unread.\r\n const clonedResponse = tmpResponse.clone();\r\n const json = await clonedResponse.json();\r\n if (json?.error?.code !== undefined)\r\n return json?.error?.code as number;\r\n } catch { }\r\n\r\n }\r\n return undefined;\r\n }\r\n\r\n // return the appended access token if available.\r\n public static async appendSecurityToken(url: URL, accessClient: MapLayerAccessClient, accessTokenParams: MapLayerAccessTokenParams): Promise<MapLayerAccessToken|undefined> {\r\n\r\n // Append security token if available\r\n let accessToken: MapLayerAccessToken|undefined;\r\n try {\r\n accessToken = await accessClient.getAccessToken(accessTokenParams);\r\n } catch {}\r\n\r\n if (accessToken?.token) {\r\n url.searchParams.append(\"token\", accessToken.token);\r\n return accessToken;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute scale, resolution values for requested zoom levels (WSG 84)\r\n * Use a scale of 96 dpi for Google Maps scales\r\n * Based on this article: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale\r\n * @param startZoom Zoom level where scales begins to be computed\r\n * @param endZoom Zoom level where scales ends to be computed\r\n * @param latitude Latitude in degrees to use to compute scales (i.e 0 for Equator)\r\n * @param tileSize Size of a tile in pixels (i.e 256)\r\n * @param screenDpi Monitor resolution in dots per inch (i.e. typically 96dpi is used by Google Maps)\r\n *\r\n * @returns An array containing resolution and scale values for each requested zoom level\r\n */\r\n public static computeZoomLevelsScales(startZoom: number = 0, endZoom: number = 20, latitude: number = 0, tileSize: number = 256, screenDpi = 96): {zoom: number, resolution: number, scale: number}[] {\r\n // Note: There is probably a more direct way to compute this, but I prefer to go for a simple and well documented approach.\r\n if (startZoom <0 || endZoom < startZoom || tileSize < 0 || screenDpi < 1 || latitude < -90 || latitude > 90)\r\n return [];\r\n\r\n const inchPerMeter = 1 / 0.0254;\r\n const results: {zoom: number, resolution: number, scale: number}[] = [];\r\n const equatorLength = Constant.earthRadiusWGS84.equator * 2 * Math.PI;\r\n const zoom0Resolution = equatorLength / tileSize; // in meters per pixel\r\n\r\n const cosLatitude = Math.cos(latitude);\r\n for (let zoom = startZoom; zoom<= endZoom; zoom++) {\r\n const resolution = zoom0Resolution * cosLatitude / Math.pow(2, zoom);\r\n const scale = screenDpi * inchPerMeter * resolution;\r\n results.push({zoom, resolution, scale});\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Match the provided minScale,maxScale values to corresponding wgs84 zoom levels\r\n * @param defaultMaxLod Value of the last LOD (i.e 22)\r\n * @param tileSize Size of a tile in pixels (i.e 256)\r\n * @param minScale Minimum scale value that needs to be matched to a LOD level\r\n * @param maxScale Maximum scale value that needs to be matched to a LOD level\r\n * @returns minLod: LOD value matching minScale, maxLod: LOD value matching maxScale\r\n */\r\n public static getZoomLevelsScales( defaultMaxLod: number, tileSize: number, minScale?: number, maxScale?: number, tolerance: number = 0): {minLod?: number, maxLod?: number} {\r\n\r\n let minLod: number|undefined, maxLod: number|undefined;\r\n\r\n const zoomScales = ArcGisUtilities.computeZoomLevelsScales(0, defaultMaxLod, 0 /* latitude 0 = Equator*/, tileSize);\r\n\r\n if (zoomScales.length > 0) {\r\n\r\n if (minScale) {\r\n minLod = 0;\r\n // We are looking for the largest scale value with a scale value smaller than minScale\r\n for (; minLod < zoomScales.length && (zoomScales[minLod].scale > minScale && Math.abs(zoomScales[minLod].scale - minScale) > tolerance); minLod++)\r\n ;\r\n\r\n }\r\n\r\n if (maxScale) {\r\n maxLod = defaultMaxLod;\r\n // We are looking for the smallest scale value with a value greater than maxScale\r\n for (; maxLod >= 0 && zoomScales[maxLod].scale < maxScale && Math.abs(zoomScales[maxLod].scale - maxScale) > tolerance; maxLod--)\r\n ;\r\n }\r\n }\r\n return {minLod, maxLod};\r\n }\r\n\r\n}\r\n"]}
1
+ {"version":3,"file":"ArcGisUtilities.js","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wDAAuD;AAEvD,0CAAqL;AACrL,+CAA4C;AAE5C;;GAEG;AAEH;;;GAGG;AACH,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,mFAAwB,CAAA;IACxB,uEAAkB,CAAA;IAClB,yEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4EAAqB,CAAA;AACvB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AAcD;;;GAGG;AACH,MAAa,eAAe;IAElB,MAAM,CAAC,aAAa,CAAC,KAAyB;Q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BAC/I,CAAC;aAEJ;YAED,IAAI,QAAQ,EAAE;gBACZ,MAAM,GAAG,aAAa,CAAC;gBACvB,iFAAiF;gBACjF,OAAO,MAAM,IAAI,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,QAAQ,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE;oBAC9H,CAAC;aACJ;SACF;QACD,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC;IAC1B,CAAC;;AArKc,6BAAa,GAAG,IAAI,GAAG,EAA2C,CAAC;AArLvE,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\nimport { Angle, Constant } from \"@itwin/core-geometry\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { MapCartoRectangle, MapLayerAccessClient, MapLayerAccessToken, MapLayerAccessTokenParams, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation} from \"../internal\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\n\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/**\r\n * Class representing an ArcGIS error code.\r\n * @internal\r\n */\r\nexport enum ArcGisErrorCode {\r\n InvalidCredentials = 401,\r\n InvalidToken = 498,\r\n TokenRequired = 499,\r\n UnknownError = 1000,\r\n NoTokenService = 1001,\r\n}\r\n\r\n/**\r\n * Class representing an ArcGIS service metadata.\r\n * @internal\r\n */\r\nexport interface ArcGISServiceMetadata {\r\n /** JSON content from the service */\r\n content: any;\r\n\r\n /** Indicates if an access token is required to access the service */\r\n accessTokenRequired: boolean;\r\n}\r\n\r\n/**\r\n * Class containing utilities relating to ArcGIS services and coordinate systems.\r\n * @internal\r\n */\r\nexport class ArcGisUtilities {\r\n\r\n private static getBBoxString(range?: MapCartoRectangle) {\r\n if (!range)\r\n range = MapCartoRectangle.createMaximum();\r\n\r\n return `${range.low.x * Angle.degreesPerRadian},${range.low.y * Angle.degreesPerRadian},${range.high.x * Angle.degreesPerRadian},${range.high.y * Angle.degreesPerRadian}`;\r\n }\r\n\r\n public static async getNationalMapSources(): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n const response = await fetch(\"https://viewer.nationalmap.gov/tnmaccess/api/getMapServiceList\", { method: \"GET\" });\r\n const services = await response.json();\r\n\r\n if (!Array.isArray(services))\r\n return sources;\r\n\r\n for (const service of services) {\r\n if (service.wmsUrl.length === 0) // Exclude Wfs..\r\n continue;\r\n switch (service.serviceType) {\r\n case \"ArcGIS\":\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url: service.serviceLink, formatId: \"ArcGIS\" })!);\r\n break;\r\n default: {\r\n const wmsIndex = service.wmsUrl.lastIndexOf(\"/wms\");\r\n if (wmsIndex > 0) {\r\n const url = service.wmsUrl.slice(0, wmsIndex + 4);\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url, formatId: \"WMS\" })!);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return sources;\r\n }\r\n\r\n public static async getServiceDirectorySources(url: string, baseUrl?: string): Promise<MapLayerSource[]> {\r\n if (undefined === baseUrl)\r\n baseUrl = url;\r\n let sources = new Array<MapLayerSource>();\r\n const response = await fetch(`${url}?f=json`, { method: \"GET\" });\r\n const json = await response.json();\r\n if (json !== undefined) {\r\n if (Array.isArray(json.folders)) {\r\n for (const folder of json.folders) {\r\n sources = sources.concat(await ArcGisUtilities.getServiceDirectorySources(`${url}/${folder}`, url));\r\n }\r\n }\r\n if (Array.isArray(json.services)) {\r\n for (const service of json.services) {\r\n let source;\r\n if (service.type === \"MapServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/MapServer`, formatId: \"ArcGIS\" });\r\n else if (service.type === \"ImageServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/ImageServer`, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n\r\n /**\r\n * Get map layer sources from an ArcGIS query.\r\n * @param range Range for the query.\r\n * @param url URL for the query.\r\n * @returns List of map layer sources.\r\n */\r\n public static async getSourcesFromQuery(range?: MapCartoRectangle, url = \"https://usgs.maps.arcgis.com/sharing/rest/search\"): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n for (let start = 1; start > 0;) {\r\n const response = await fetch(`${url}?f=json&q=(group:9d1199a521334e77a7d15abbc29f8144) AND (type:\"Map Service\")&bbox=${ArcGisUtilities.getBBoxString(range)}&sortOrder=desc&start=${start}&num=100`, { method: \"GET\" });\r\n const json = await response.json();\r\n if (!json)\r\n break;\r\n\r\n start = json.nextStart ? json.nextStart : -1;\r\n if (json !== undefined && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n const source = MapLayerSource.fromJSON({ name: result.name ? result.name : result.title, url: result.url, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n\r\n /**\r\n * Parse the URL to check if it represents a valid ArcGIS service\r\n * @param url URL to validate.\r\n * @param serviceType Service type to validate (i.e FeatureServer, MapServer)\r\n * @return Validation Status.\r\n */\r\n public static validateUrl(url: string, serviceType: string): MapLayerSourceStatus {\r\n const urlObj = new URL(url.toLowerCase());\r\n if (urlObj.pathname.includes(\"/rest/services/\")) {\r\n // This seem to be an ArcGIS URL, lets check the service type\r\n if (urlObj.pathname.endsWith(`${serviceType.toLowerCase()}`)) {\r\n return MapLayerSourceStatus.Valid;\r\n } else {\r\n return MapLayerSourceStatus.IncompatibleFormat;\r\n }\r\n } else {\r\n return MapLayerSourceStatus.InvalidUrl;\r\n }\r\n }\r\n\r\n /**\r\n * Attempt to access an ArcGIS service, and validate its service metadata.\r\n * @param url URL of the source to validate.\r\n * @param formatId Format Id of the source.\r\n * @param capabilitiesFilter List of capabilities 'keyword' that needs to be advertised in the service's metadata\r\n * in order to be valid. For example: 'Map', 'Query', etc\r\n * @param userName Username to use for legacy token based security.\r\n * @param password Password to use for legacy token based security.\r\n * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)\r\n * @return Validation Status. If successful, a list of available sub-layers will also be returned.\r\n */\r\n public static async validateSource(url: string, formatId: string, capabilitiesFilter: string[], userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const metadata = await this.getServiceJson(url, formatId, userName, password, ignoreCache);\r\n const json = metadata?.content;\r\n if (json === undefined) {\r\n return { status: MapLayerSourceStatus.InvalidUrl };\r\n } else if (json.error !== undefined) {\r\n\r\n // If we got a 'Token Required' error, lets check what authentification methods this ESRI service offers\r\n // and return information needed to initiate the authentification process... the end-user\r\n // will have to provide his credentials before we can fully validate this source.\r\n if (json.error.code === ArcGisErrorCode.TokenRequired) {\r\n return { status: MapLayerSourceStatus.RequireAuth};\r\n } else if (json.error.code === ArcGisErrorCode.InvalidCredentials)\r\n return { status: MapLayerSourceStatus.InvalidCredentials};\r\n }\r\n\r\n // Check this service support the expected queries\r\n let hasCapabilities = false;\r\n let capsArray: string[] = [];\r\n if (json.capabilities && typeof json.capabilities === \"string\" ) {\r\n const capabilities: string = json.capabilities;\r\n capsArray = capabilities.split(\",\").map((entry) => entry.toLowerCase());\r\n\r\n const filtered = capsArray.filter((element, _index, _array) => capabilitiesFilter.includes(element));\r\n hasCapabilities = (filtered.length === capabilitiesFilter.length);\r\n }\r\n if (!hasCapabilities) {\r\n return { status: MapLayerSourceStatus.InvalidFormat};\r\n }\r\n\r\n // Only EPSG:3857 is supported with pre-rendered tiles.\r\n if (json.tileInfo && capsArray.includes(\"tilesonly\") && !ArcGisUtilities.isEpsg3857Compatible(json.tileInfo)) {\r\n return { status: MapLayerSourceStatus.InvalidCoordinateSystem};\r\n }\r\n\r\n let subLayers;\r\n if (json.layers) {\r\n\r\n subLayers = new Array<MapSubLayerProps>();\r\n\r\n for (const layer of json.layers) {\r\n const parent = layer.parentLayerId < 0 ? undefined : layer.parentLayerId;\r\n const children = Array.isArray(layer.subLayerIds) ? layer.subLayerIds : undefined;\r\n subLayers.push({ name: layer.name, visible: layer.defaultVisibility !== false, id: layer.id, parent, children });\r\n }\r\n }\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n }\r\n\r\n /** Validate MapService tiling metadata and checks if the tile tree is 'Google Maps' compatible. */\r\n public static isEpsg3857Compatible(tileInfo: any) {\r\n if (tileInfo.spatialReference?.latestWkid !== 3857 || !Array.isArray(tileInfo.lods))\r\n return false;\r\n\r\n const zeroLod = tileInfo.lods[0];\r\n return zeroLod.level === 0 && Math.abs(zeroLod.resolution - 156543.03392800014) < .001;\r\n }\r\n\r\n private static _serviceCache = new Map<string, ArcGISServiceMetadata|undefined>();\r\n\r\n /**\r\n * Fetches an ArcGIS service metadata, and returns its JSON representation.\r\n * If an access client has been configured for the specified formatId,\r\n * it will be used to apply required security token.\r\n * By default, response for each URL are cached.\r\n * @param url URL of the ArcGIS service\r\n * @param formatId Format ID of the service\r\n * @param userName Username to use for legacy token based security\r\n * @param password Password to use for legacy token based security\r\n * @param ignoreCache Flag to skip cache lookup (i.e. force a new server request)\r\n * @param requireToken Flag to indicate if a token is required\r\n */\r\n public static async getServiceJson(url: string, formatId: string, userName?: string, password?: string, ignoreCache?: boolean, requireToken?: boolean): Promise<ArcGISServiceMetadata|undefined> {\r\n if (!ignoreCache) {\r\n const cached = ArcGisUtilities._serviceCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n let accessTokenRequired = false;\r\n try {\r\n let tmpUrl = new URL(url);\r\n tmpUrl.searchParams.append(\"f\", \"json\");\r\n\r\n // In some cases, caller might already know token is required, so append it immediately\r\n if (requireToken) {\r\n const accessClient = IModelApp.mapLayerFormatRegistry.getAccessClient(formatId);\r\n if (accessClient) {\r\n accessTokenRequired = true;\r\n await ArcGisUtilities.appendSecurityToken(tmpUrl, accessClient, {mapLayerUrl: new URL(url), userName, password});\r\n }\r\n }\r\n let response = await fetch(tmpUrl.toString(), { method: \"GET\" });\r\n\r\n // Append security token when corresponding error code is returned by ArcGIS service\r\n let errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n if (!accessTokenRequired\r\n && errorCode !== undefined\r\n && errorCode === ArcGisErrorCode.TokenRequired ) {\r\n accessTokenRequired = true;\r\n // If token required\r\n const accessClient = IModelApp.mapLayerFormatRegistry.getAccessClient(formatId);\r\n if (accessClient) {\r\n tmpUrl = new URL(url);\r\n tmpUrl.searchParams.append(\"f\", \"json\");\r\n await ArcGisUtilities.appendSecurityToken(tmpUrl, accessClient, {mapLayerUrl: new URL(url), userName, password});\r\n response = await fetch(tmpUrl.toString(), { method: \"GET\" });\r\n errorCode = await ArcGisUtilities.checkForResponseErrorCode(response);\r\n }\r\n }\r\n\r\n const json = await response.json();\r\n const info = {content: json, accessTokenRequired};\r\n // Cache the response only if it doesn't contain any error.\r\n ArcGisUtilities._serviceCache.set(url, (errorCode === undefined ? info : undefined));\r\n return info; // Always return json, even though it contains an error code.\r\n\r\n } catch (_error) {\r\n ArcGisUtilities._serviceCache.set(url, undefined);\r\n return undefined;\r\n }\r\n }\r\n\r\n /** Read a response from ArcGIS server and check for error code in the response. */\r\n public static async checkForResponseErrorCode(response: Response) {\r\n const tmpResponse = response;\r\n if (response.headers && tmpResponse.headers.get(\"content-type\")?.toLowerCase().includes(\"json\")) {\r\n\r\n try {\r\n // Note:\r\n // Since response stream can only be read once (i.e. calls to .json() method)\r\n // we have to clone the response object in order to check for potential error code,\r\n // but still keep the response stream as unread.\r\n const clonedResponse = tmpResponse.clone();\r\n const json = await clonedResponse.json();\r\n if (json?.error?.code !== undefined)\r\n return json?.error?.code as number;\r\n } catch { }\r\n\r\n }\r\n return undefined;\r\n }\r\n\r\n // return the appended access token if available.\r\n public static async appendSecurityToken(url: URL, accessClient: MapLayerAccessClient, accessTokenParams: MapLayerAccessTokenParams): Promise<MapLayerAccessToken|undefined> {\r\n\r\n // Append security token if available\r\n let accessToken: MapLayerAccessToken|undefined;\r\n try {\r\n accessToken = await accessClient.getAccessToken(accessTokenParams);\r\n } catch {}\r\n\r\n if (accessToken?.token) {\r\n url.searchParams.append(\"token\", accessToken.token);\r\n return accessToken;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Compute scale, resolution values for requested zoom levels (WSG 84)\r\n * Use a scale of 96 dpi for Google Maps scales\r\n * Based on this article: https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Resolution_and_Scale\r\n * @param startZoom Zoom level where scales begins to be computed\r\n * @param endZoom Zoom level where scales ends to be computed\r\n * @param latitude Latitude in degrees to use to compute scales (i.e 0 for Equator)\r\n * @param tileSize Size of a tile in pixels (i.e 256)\r\n * @param screenDpi Monitor resolution in dots per inch (i.e. typically 96dpi is used by Google Maps)\r\n * @returns An array containing resolution and scale values for each requested zoom level\r\n */\r\n public static computeZoomLevelsScales(startZoom: number = 0, endZoom: number = 20, latitude: number = 0, tileSize: number = 256, screenDpi = 96): {zoom: number, resolution: number, scale: number}[] {\r\n // Note: There is probably a more direct way to compute this, but I prefer to go for a simple and well documented approach.\r\n if (startZoom <0 || endZoom < startZoom || tileSize < 0 || screenDpi < 1 || latitude < -90 || latitude > 90)\r\n return [];\r\n\r\n const inchPerMeter = 1 / 0.0254;\r\n const results: {zoom: number, resolution: number, scale: number}[] = [];\r\n const equatorLength = Constant.earthRadiusWGS84.equator * 2 * Math.PI;\r\n const zoom0Resolution = equatorLength / tileSize; // in meters per pixel\r\n\r\n const cosLatitude = Math.cos(latitude);\r\n for (let zoom = startZoom; zoom<= endZoom; zoom++) {\r\n const resolution = zoom0Resolution * cosLatitude / Math.pow(2, zoom);\r\n const scale = screenDpi * inchPerMeter * resolution;\r\n results.push({zoom, resolution, scale});\r\n }\r\n\r\n return results;\r\n }\r\n\r\n /**\r\n * Match the provided minScale, maxScale values to corresponding wgs84 zoom levels\r\n * @param defaultMaxLod Value of the last LOD (i.e 22)\r\n * @param tileSize Size of a tile in pixels (i.e 256)\r\n * @param minScale Minimum scale value that needs to be matched to a LOD level\r\n * @param maxScale Maximum scale value that needs to be matched to a LOD level\r\n * @returns minLod: LOD value matching minScale, maxLod: LOD value matching maxScale\r\n */\r\n public static getZoomLevelsScales( defaultMaxLod: number, tileSize: number, minScale?: number, maxScale?: number, tolerance: number = 0): {minLod?: number, maxLod?: number} {\r\n\r\n let minLod: number|undefined, maxLod: number|undefined;\r\n\r\n const zoomScales = ArcGisUtilities.computeZoomLevelsScales(0, defaultMaxLod, 0 /* latitude 0 = Equator*/, tileSize);\r\n\r\n if (zoomScales.length > 0) {\r\n\r\n if (minScale) {\r\n minLod = 0;\r\n // We are looking for the largest scale value with a scale value smaller than minScale\r\n for (; minLod < zoomScales.length && (zoomScales[minLod].scale > minScale && Math.abs(zoomScales[minLod].scale - minScale) > tolerance); minLod++)\r\n ;\r\n\r\n }\r\n\r\n if (maxScale) {\r\n maxLod = defaultMaxLod;\r\n // We are looking for the smallest scale value with a value greater than maxScale\r\n for (; maxLod >= 0 && zoomScales[maxLod].scale < maxScale && Math.abs(zoomScales[maxLod].scale - maxScale) > tolerance; maxLod--)\r\n ;\r\n }\r\n }\r\n return {minLod, maxLod};\r\n }\r\n\r\n}\r\n"]}
@@ -2,7 +2,7 @@
2
2
  * @module Tiles
3
3
  */
4
4
  import { Cartographic, ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
5
- import { ArcGISImageryProvider, ImageryMapTile, ImageryMapTileTree, MapFeatureInfoOptions, MapLayerFeatureInfo, QuadId } from "../../internal";
5
+ import { ArcGISImageryProvider, ImageryMapTileTree, MapFeatureInfoOptions, MapLayerFeatureInfo, QuadId } from "../../internal";
6
6
  import { Range2dProps, XYProps } from "@itwin/core-geometry";
7
7
  import { HitDetail } from "../../../HitDetail";
8
8
  /** @internal */
@@ -77,7 +77,7 @@ export declare class ArcGISMapLayerImageryProvider extends ArcGISImageryProvider
77
77
  };
78
78
  private fetchTile;
79
79
  loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined>;
80
- protected _generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void): void;
80
+ protected _generateChildIds(quadId: QuadId, resolveChildren: (childIds: QuadId[]) => void): void;
81
81
  initialize(): Promise<void>;
82
82
  addLogoCards(cards: HTMLTableElement): void;
83
83
  private getIdentifyData;
@@ -1 +1 @@
1
- {"version":3,"file":"ArcGISMapLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AAEjH,OAAO,EAC8D,qBAAqB,EAExF,cAAc,EAAE,kBAAkB,EAAqB,qBAAqB,EAAmB,mBAAmB,EAC3D,MAAM,EAC9D,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAoB,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAI/C,gBAAgB;AAChB,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,gBAAgB;AAChB,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,KAAK,GAAC,SAAS,GAAC,KAAK,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,6BAA6B;IAC5C,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;IAElB,mFAAmF;IACnF,YAAY,EAAE,mBAAmB,CAA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MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAU3F"}
@@ -96,9 +96,9 @@ class ArcGISMapLayerImageryProvider extends internal_1.ArcGISImageryProvider {
96
96
  return undefined;
97
97
  }
98
98
  }
99
- _generateChildIds(tile, resolveChildren) {
100
- const childIds = this.getPotentialChildIds(tile);
101
- if (tile.quadId.level < Math.max(1, this.minimumZoomLevel - 1)) {
99
+ _generateChildIds(quadId, resolveChildren) {
100
+ const childIds = this.getPotentialChildIds(quadId);
101
+ if (quadId.level < Math.max(1, this.minimumZoomLevel - 1)) {
102
102
  resolveChildren(childIds);
103
103
  return;
104
104
  }