@itwin/core-frontend 3.1.0-dev.32 → 3.1.0-dev.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/CategorySelectorState.js +1 -1
- package/lib/cjs/CategorySelectorState.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +3 -1
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +23 -1
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/cjs/quantity-formatting/QuantityFormatter.js +11 -2
- package/lib/cjs/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/cjs/tile/TileTreeReference.d.ts +5 -1
- package/lib/cjs/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/cjs/tile/TileTreeReference.js +4 -0
- package/lib/cjs/tile/TileTreeReference.js.map +1 -1
- package/lib/cjs/tile/internal.d.ts +1 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +1 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +3 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +44 -11
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +2 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +3 -0
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapFeatureInfo.d.ts +26 -0
- package/lib/cjs/tile/map/MapFeatureInfo.d.ts.map +1 -0
- package/lib/cjs/tile/map/MapFeatureInfo.js +19 -0
- package/lib/cjs/tile/map/MapFeatureInfo.js.map +1 -0
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +2 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +4 -0
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.d.ts +3 -1
- package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +67 -10
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/CategorySelectorState.js +1 -1
- package/lib/esm/CategorySelectorState.js.map +1 -1
- package/lib/esm/Viewport.d.ts +3 -1
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +23 -1
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.d.ts.map +1 -1
- package/lib/esm/quantity-formatting/QuantityFormatter.js +12 -3
- package/lib/esm/quantity-formatting/QuantityFormatter.js.map +1 -1
- package/lib/esm/tile/TileTreeReference.d.ts +5 -1
- package/lib/esm/tile/TileTreeReference.d.ts.map +1 -1
- package/lib/esm/tile/TileTreeReference.js +4 -0
- package/lib/esm/tile/TileTreeReference.js.map +1 -1
- package/lib/esm/tile/internal.d.ts +1 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +1 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +3 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +45 -12
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +2 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +3 -0
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapFeatureInfo.d.ts +26 -0
- package/lib/esm/tile/map/MapFeatureInfo.d.ts.map +1 -0
- package/lib/esm/tile/map/MapFeatureInfo.js +15 -0
- package/lib/esm/tile/map/MapFeatureInfo.js.map +1 -0
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +2 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +4 -0
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.d.ts +3 -1
- package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +67 -10
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/package.json +20 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileTreeReference.js","sourceRoot":"","sources":["../../../src/tile/TileTreeReference.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAqB,OAAO,EAAa,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAA6E,sBAAsB,EAAqB,MAAM,oBAAoB,CAAC;AAO1J,OAAO,EAC4C,YAAY,EAAmC,kBAAkB,GACnH,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAN,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,KAAf,eAAe,QAO1B;AAED;;;;;;;;;GASG;AACH,MAAM,OAAgB,iBAAiB,CAAC,sCAAsC;IAI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gBAAgB;IACT,gBAAgB,CAAC,eAAwB,IAAU,CAAC;IAE3D,6GAA6G;IAC7G,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,iKAAiK;IACjK,IAAW,QAAQ,KAAc,OAAO,KAAK,CAAC,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAW,sBAAsB,KAAa,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC;IAE1F,iGAAiG;IAC1F,YAAY,CAAC,MAAwB,EAAE,GAAmB,IAAU,CAAC;IAE5E;;;;OAIG;IACO,4BAA4B;QACpC,OAAO,SAAS,CAAC;IACnB,CAAC;IAOD;;OAEG;IACO,oBAAoB,CAAC,SAAgC;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YACjC,KAAK,kBAAkB,CAAC,MAAM;gBAC5B,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM;YACR,KAAK,kBAAkB,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","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, 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 */\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 */\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 /** 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 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 /** @internal */\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,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAqB,OAAO,EAAa,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAA6E,sBAAsB,EAAqB,MAAM,oBAAoB,CAAC;AAO1J,OAAO,EACiE,YAAY,EAAmC,kBAAkB,GACxI,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAN,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,KAAf,eAAe,QAO1B;AAED;;;;;;;;;GASG;AACH,MAAM,OAAgB,iBAAiB,CAAC,sCAAsC;IAI5E;;;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,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CAAC,IAAI,EAAE,CAAC;QACnC,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE;YACjC,KAAK,kBAAkB,CAAC,MAAM;gBAC5B,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;gBACpC,MAAM;YACR,KAAK,kBAAkB,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","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, 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 */\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 */\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 /** 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): 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 /** @internal */\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"]}
|
|
@@ -38,6 +38,7 @@ export * from "./map/ArcGISTileMap";
|
|
|
38
38
|
export * from "./map/MapLayerAuthentication";
|
|
39
39
|
export * from "./map/ArcGisTokenGenerator";
|
|
40
40
|
export * from "./map/ArcGisTokenManager";
|
|
41
|
+
export * from "./map/MapFeatureInfo";
|
|
41
42
|
export * from "./map/MapLayerFormatRegistry";
|
|
42
43
|
export * from "./map/ArcGisUtilities";
|
|
43
44
|
export * from "./map/WmsUtilities";
|
|
@@ -1 +1 @@
|
|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AC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC"}
|
package/lib/esm/tile/internal.js
CHANGED
|
@@ -51,6 +51,7 @@ export * from "./map/ArcGISTileMap";
|
|
|
51
51
|
export * from "./map/MapLayerAuthentication";
|
|
52
52
|
export * from "./map/ArcGisTokenGenerator";
|
|
53
53
|
export * from "./map/ArcGisTokenManager";
|
|
54
|
+
export * from "./map/MapFeatureInfo";
|
|
54
55
|
export * from "./map/MapLayerFormatRegistry";
|
|
55
56
|
export * from "./map/ArcGisUtilities";
|
|
56
57
|
export * from "./map/WmsUtilities";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;;;GAQG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,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c,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/* The order of exports below is based on dependencies between the types in each file.\r\n * For example, IModelTileTree derives from TileTree, so TileTree must be exported first.\r\n * No file inside core-frontend should import from *any* file in /tile/ *except* for this one.\r\n * e.g.:\r\n * import { TileTree } from \"./tile/TileTree\"; // NO...\r\n * import { TileTree } from \"./tile/internal\"; // YES!\r\n * Failure to follow either of these two guidelines is very likely to produce difficult-to-debug run-time errors due\r\n * to circular dependencies.\r\n */\r\n\r\nexport * from \"./ViewFlagOverrides\";\r\nexport * from \"./map/MapCartoRectangle\";\r\nexport * from \"./map/QuadId\";\r\nexport * from \"./DisclosedTileTreeSet\";\r\nexport * from \"./Tile\";\r\nexport * from \"./LRUTileList\";\r\nexport * from \"./RealityTile\";\r\nexport * from \"./TileParams\";\r\nexport * from \"./TileContent\";\r\nexport * from \"./TileDrawArgs\";\r\nexport * from \"./RealityTileDrawArgs\";\r\nexport * from \"./GraphicsCollector\";\r\nexport * from \"./BatchedTileIdMap\";\r\nexport * from \"./TileTreeParams\";\r\nexport * from \"./TileTree\";\r\nexport * from \"./RealityTileTree\";\r\nexport * from \"./TileTreeSupplier\";\r\nexport * from \"./TileTreeOwner\";\r\nexport * from \"./TileTreeReference\";\r\nexport * from \"./TileGeometryCollector\";\r\nexport * from \"./TiledGraphicsProvider\";\r\nexport * from \"./TileAdmin\";\r\nexport * from \"./TileRequest\";\r\nexport * from \"./TileRequestChannel\";\r\nexport * from \"./IModelTileRequestChannels\";\r\nexport * from \"./TileRequestChannels\";\r\nexport * from \"./TileUsageMarker\";\r\nexport * from \"./TileUser\";\r\nexport * from \"./TileUserSet\";\r\nexport * from \"./GltfReader\";\r\nexport * from \"./I3dmReader\";\r\nexport * from \"./B3dmReader\";\r\nexport * from \"./ImdlReader\";\r\nexport * from \"./map/ArcGISTileMap\";\r\nexport * from \"./map/MapLayerAuthentication\";\r\nexport * from \"./map/ArcGisTokenGenerator\";\r\nexport * from \"./map/ArcGisTokenManager\";\r\nexport * from \"./map/MapLayerFormatRegistry\";\r\nexport * from \"./map/ArcGisUtilities\";\r\nexport * from \"./map/WmsUtilities\";\r\nexport * from \"./map/WmsCapabilities\";\r\nexport * from \"./map/WmtsCapabilities\";\r\nexport * from \"./map/MapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/ArcGISMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/AzureMapsLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/BingImageryProvider\";\r\nexport * from \"./map/ImageryProviders/MapBoxLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/TileUrlImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmsMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmtsMapLayerImageryProvider\";\r\nexport * from \"./map/MapLayerImageryFormats\";\r\nexport * from \"./map/MapLayerTileTreeReference\";\r\nexport * from \"./map/MapTileTree\";\r\nexport * from \"./map/TerrainMeshProvider\";\r\nexport * from \"./map/CesiumTerrainProvider\";\r\nexport * from \"./map/EllipsoidTerrainProvider\";\r\nexport * from \"./map/MapTile\";\r\nexport * from \"./RealityTileLoader\";\r\nexport * from \"./map/MapTileLoader\";\r\nexport * from \"./map/BingElevation\";\r\nexport * from \"./map/MapTilingScheme\";\r\nexport * from \"./map/MapTileAvailability\";\r\nexport * from \"./PntsReader\";\r\nexport * from \"./RealityModelTileTree\";\r\nexport * from \"./IModelTile\";\r\nexport * from \"./DynamicIModelTile\";\r\nexport * from \"./IModelTileTree\";\r\nexport * from \"./PrimaryTileTree\";\r\nexport * from \"./ClassifierTileTree\";\r\nexport * from \"./OrbitGtTileTree\";\r\nexport * from \"./map/ImageryTileTree\";\r\nexport * from \"./map/MapLayerSources\";\r\nexport * from \"./map/MapTiledGraphicsProvider\";\r\nexport * from \"./CesiumAssetProvider\";\r\nexport * from \"./ContextShareProvider\";\r\nexport * from \"./ThreeDTileFormatInterpreter\";\r\nexport * from \"./OPCFormatInterpreter\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH;;;;;;;;GAQG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAA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,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/* The order of exports below is based on dependencies between the types in each file.\r\n * For example, IModelTileTree derives from TileTree, so TileTree must be exported first.\r\n * No file inside core-frontend should import from *any* file in /tile/ *except* for this one.\r\n * e.g.:\r\n * import { TileTree } from \"./tile/TileTree\"; // NO...\r\n * import { TileTree } from \"./tile/internal\"; // YES!\r\n * Failure to follow either of these two guidelines is very likely to produce difficult-to-debug run-time errors due\r\n * to circular dependencies.\r\n */\r\n\r\nexport * from \"./ViewFlagOverrides\";\r\nexport * from \"./map/MapCartoRectangle\";\r\nexport * from \"./map/QuadId\";\r\nexport * from \"./DisclosedTileTreeSet\";\r\nexport * from \"./Tile\";\r\nexport * from \"./LRUTileList\";\r\nexport * from \"./RealityTile\";\r\nexport * from \"./TileParams\";\r\nexport * from \"./TileContent\";\r\nexport * from \"./TileDrawArgs\";\r\nexport * from \"./RealityTileDrawArgs\";\r\nexport * from \"./GraphicsCollector\";\r\nexport * from \"./BatchedTileIdMap\";\r\nexport * from \"./TileTreeParams\";\r\nexport * from \"./TileTree\";\r\nexport * from \"./RealityTileTree\";\r\nexport * from \"./TileTreeSupplier\";\r\nexport * from \"./TileTreeOwner\";\r\nexport * from \"./TileTreeReference\";\r\nexport * from \"./TileGeometryCollector\";\r\nexport * from \"./TiledGraphicsProvider\";\r\nexport * from \"./TileAdmin\";\r\nexport * from \"./TileRequest\";\r\nexport * from \"./TileRequestChannel\";\r\nexport * from \"./IModelTileRequestChannels\";\r\nexport * from \"./TileRequestChannels\";\r\nexport * from \"./TileUsageMarker\";\r\nexport * from \"./TileUser\";\r\nexport * from \"./TileUserSet\";\r\nexport * from \"./GltfReader\";\r\nexport * from \"./I3dmReader\";\r\nexport * from \"./B3dmReader\";\r\nexport * from \"./ImdlReader\";\r\nexport * from \"./map/ArcGISTileMap\";\r\nexport * from \"./map/MapLayerAuthentication\";\r\nexport * from \"./map/ArcGisTokenGenerator\";\r\nexport * from \"./map/ArcGisTokenManager\";\r\nexport * from \"./map/MapFeatureInfo\";\r\nexport * from \"./map/MapLayerFormatRegistry\";\r\nexport * from \"./map/ArcGisUtilities\";\r\nexport * from \"./map/WmsUtilities\";\r\nexport * from \"./map/WmsCapabilities\";\r\nexport * from \"./map/WmtsCapabilities\";\r\nexport * from \"./map/MapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/ArcGISMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/AzureMapsLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/BingImageryProvider\";\r\nexport * from \"./map/ImageryProviders/MapBoxLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/TileUrlImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmsMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmtsMapLayerImageryProvider\";\r\nexport * from \"./map/MapLayerImageryFormats\";\r\nexport * from \"./map/MapLayerTileTreeReference\";\r\nexport * from \"./map/MapTileTree\";\r\nexport * from \"./map/TerrainMeshProvider\";\r\nexport * from \"./map/CesiumTerrainProvider\";\r\nexport * from \"./map/EllipsoidTerrainProvider\";\r\nexport * from \"./map/MapTile\";\r\nexport * from \"./RealityTileLoader\";\r\nexport * from \"./map/MapTileLoader\";\r\nexport * from \"./map/BingElevation\";\r\nexport * from \"./map/MapTilingScheme\";\r\nexport * from \"./map/MapTileAvailability\";\r\nexport * from \"./PntsReader\";\r\nexport * from \"./RealityModelTileTree\";\r\nexport * from \"./IModelTile\";\r\nexport * from \"./DynamicIModelTile\";\r\nexport * from \"./IModelTileTree\";\r\nexport * from \"./PrimaryTileTree\";\r\nexport * from \"./ClassifierTileTree\";\r\nexport * from \"./OrbitGtTileTree\";\r\nexport * from \"./map/ImageryTileTree\";\r\nexport * from \"./map/MapLayerSources\";\r\nexport * from \"./map/MapTiledGraphicsProvider\";\r\nexport * from \"./CesiumAssetProvider\";\r\nexport * from \"./ContextShareProvider\";\r\nexport * from \"./ThreeDTileFormatInterpreter\";\r\nexport * from \"./OPCFormatInterpreter\";\r\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @module Tiles
|
|
3
3
|
*/
|
|
4
4
|
import { Cartographic, ImageMapLayerSettings, ImageSource } from "@itwin/core-common";
|
|
5
|
-
import { ImageryMapTile, ImageryMapTileTree, MapLayerImageryProvider, QuadId } from "../../internal";
|
|
5
|
+
import { ImageryMapTile, ImageryMapTileTree, MapLayerFeatureInfo, MapLayerImageryProvider, QuadId } from "../../internal";
|
|
6
6
|
/** @internal */
|
|
7
7
|
export declare class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
8
8
|
private _maxDepthFromLod;
|
|
@@ -26,7 +26,9 @@ export declare class ArcGISMapLayerImageryProvider extends MapLayerImageryProvid
|
|
|
26
26
|
private isEpsg3857Compatible;
|
|
27
27
|
initialize(): Promise<void>;
|
|
28
28
|
getLogo(): HTMLTableRowElement;
|
|
29
|
+
private getIdentifyData;
|
|
29
30
|
getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void>;
|
|
31
|
+
getFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, _tree: ImageryMapTileTree): Promise<void>;
|
|
30
32
|
protected getLayerString(prefix?: string): string;
|
|
31
33
|
constructUrl(row: number, column: number, zoomLevel: number): Promise<string>;
|
|
32
34
|
private appendSecurityToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGISMapLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AAGjH,OAAO,EACuF,cAAc,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ArcGISMapLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAA6B,MAAM,oBAAoB,CAAC;AAGjH,OAAO,EACuF,cAAc,EAAE,kBAAkB,EAE9H,mBAAmB,EACnB,uBAAuB,EAAyD,MAAM,EACvF,MAAM,gBAAgB,CAAC;AAGxB,gBAAgB;AAChB,qBAAa,6BAA8B,SAAQ,uBAAuB;IACxE,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,cAAc,CAAe;IACrC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,QAAQ,CAA0B;IACnC,WAAW,EAAE,GAAG,CAAC;gBACZ,QAAQ,EAAE,qBAAqB;IAI3C,cAAuB,mBAAmB,YAAoB;IAE9D,IAAoB,gBAAgB,WAAsE;IAC1G,IAAoB,gBAAgB,WAAyF;IAEtH,YAAY,CAAC,SAAS,EAAE,GAAG;;;;YAKpB,SAAS;IAUD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;cAqD7F,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI;IAoBxG,OAAO,CAAC,oBAAoB;IAQN,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IA6CjC,OAAO;YAMT,eAAe;IAkCP,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB1G,cAAc,CAAC,YAAY,EAAE,mBAAmB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCzJ,SAAS,CAAC,cAAc,CAAC,MAAM,SAAS,GAAG,MAAM;IAMpC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAY5E,mBAAmB;CAgBlC"}
|
|
@@ -9,9 +9,8 @@ import { getJson, request } from "../../../request/Request";
|
|
|
9
9
|
import { IModelStatus, ServerError } from "@itwin/core-common";
|
|
10
10
|
import { IModelApp } from "../../../IModelApp";
|
|
11
11
|
import { NotifyMessageDetails, OutputMessagePriority } from "../../../NotificationManager";
|
|
12
|
-
import { ArcGisErrorCode, ArcGISTileMap, ArcGisTokenClientType, ArcGisTokenManager, ArcGisUtilities, MapCartoRectangle, MapLayerImageryProvider, MapLayerImageryProviderStatus, } from "../../internal";
|
|
13
|
-
|
|
14
|
-
let doToolTips = true;
|
|
12
|
+
import { ArcGisErrorCode, ArcGISTileMap, ArcGisTokenClientType, ArcGisTokenManager, ArcGisUtilities, MapCartoRectangle, MapFeatureInfoRecord, MapLayerImageryProvider, MapLayerImageryProviderStatus, } from "../../internal";
|
|
13
|
+
import { PropertyValueFormat, StandardTypeNames } from "@itwin/appui-abstract";
|
|
15
14
|
/** @internal */
|
|
16
15
|
export class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
17
16
|
constructor(settings) {
|
|
@@ -150,18 +149,14 @@ export class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
|
150
149
|
getLogo() {
|
|
151
150
|
return IModelApp.makeLogoCard({ heading: "ArcGIS", notice: this._copyrightText });
|
|
152
151
|
}
|
|
153
|
-
|
|
152
|
+
// Translates the provided Cartographic into a EPSG:3857 point, and retrieve information.
|
|
153
|
+
// tolerance is in pixels
|
|
154
|
+
async getIdentifyData(quadId, carto, tolerance) {
|
|
154
155
|
var _a, _b, _c, _d;
|
|
155
|
-
await super.getToolTip(strings, quadId, carto, tree);
|
|
156
|
-
if (!doToolTips)
|
|
157
|
-
return;
|
|
158
|
-
if (!this._querySupported)
|
|
159
|
-
return;
|
|
160
|
-
const stringSet = new Set();
|
|
161
156
|
const bboxString = this.getEPSG3857ExtentString(quadId.row, quadId.column, quadId.level);
|
|
162
157
|
const x = this.getEPSG3857X(carto.longitudeDegrees);
|
|
163
158
|
const y = this.getEPSG3857Y(carto.latitudeDegrees);
|
|
164
|
-
const tmpUrl = `${this._settings.url}/identify?f=json&tolerance
|
|
159
|
+
const tmpUrl = `${this._settings.url}/identify?f=json&tolerance=${tolerance}&returnGeometry=false&sr=3857&imageDisplay=${this.tileSize},${this.tileSize},96&layers=${this.getLayerString("visible")}&geometry=${x},${y}&geometryType=esriGeometryPoint&mapExtent=${bboxString}`;
|
|
165
160
|
const url = await this.appendSecurityToken(tmpUrl);
|
|
166
161
|
let json = await getJson(url);
|
|
167
162
|
if (((_a = json === null || json === void 0 ? void 0 : json.error) === null || _a === void 0 ? void 0 : _a.code) === ArcGisErrorCode.TokenRequired || ((_b = json === null || json === void 0 ? void 0 : json.error) === null || _b === void 0 ? void 0 : _b.code) === ArcGisErrorCode.InvalidToken) {
|
|
@@ -180,9 +175,18 @@ export class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
|
180
175
|
const msg = IModelApp.localization.getLocalizedString("iModelJs:MapLayers.Messages.FetchTooltipTokenError", { layerName: this._settings.name });
|
|
181
176
|
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));
|
|
182
177
|
}
|
|
183
|
-
return;
|
|
178
|
+
return undefined;
|
|
184
179
|
}
|
|
185
180
|
}
|
|
181
|
+
return json;
|
|
182
|
+
}
|
|
183
|
+
// Makes an identify request to ESRI MapService server, and return it as a list of formatted strings
|
|
184
|
+
async getToolTip(strings, quadId, carto, tree) {
|
|
185
|
+
await super.getToolTip(strings, quadId, carto, tree);
|
|
186
|
+
if (!this._querySupported)
|
|
187
|
+
return;
|
|
188
|
+
const stringSet = new Set();
|
|
189
|
+
const json = await this.getIdentifyData(quadId, carto, 1);
|
|
186
190
|
if (json && Array.isArray(json.results)) {
|
|
187
191
|
for (const result of json.results) {
|
|
188
192
|
if (result.attributes !== undefined && result.attributes[result.displayFieldName] !== undefined) {
|
|
@@ -195,6 +199,35 @@ export class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {
|
|
|
195
199
|
}
|
|
196
200
|
}
|
|
197
201
|
}
|
|
202
|
+
// Makes an identify request to ESRI MapService , and return it as a list MapLayerFeatureInfo object
|
|
203
|
+
async getFeatureInfo(featureInfos, quadId, carto, _tree) {
|
|
204
|
+
var _a, _b;
|
|
205
|
+
if (!this._querySupported)
|
|
206
|
+
return;
|
|
207
|
+
const json = await this.getIdentifyData(quadId, carto, 5);
|
|
208
|
+
if (json && Array.isArray(json.results)) {
|
|
209
|
+
const layerInfo = { layerName: this._settings.name };
|
|
210
|
+
for (const result of json.results) {
|
|
211
|
+
const subLayerInfo = {
|
|
212
|
+
subLayerName: (_a = result.layerName) !== null && _a !== void 0 ? _a : "",
|
|
213
|
+
displayFieldName: result.displayFieldName,
|
|
214
|
+
records: [],
|
|
215
|
+
};
|
|
216
|
+
for (const [key, value] of Object.entries(result.attributes)) {
|
|
217
|
+
// Convert everything to string for now
|
|
218
|
+
const strValue = String(value);
|
|
219
|
+
(_b = subLayerInfo.records) === null || _b === void 0 ? void 0 : _b.push(new MapFeatureInfoRecord({ valueFormat: PropertyValueFormat.Primitive, value: strValue, displayValue: strValue }, { name: key, displayLabel: key, typename: StandardTypeNames.String }));
|
|
220
|
+
}
|
|
221
|
+
if (layerInfo.info === undefined) {
|
|
222
|
+
layerInfo.info = [];
|
|
223
|
+
}
|
|
224
|
+
if (!(layerInfo.info instanceof HTMLElement)) {
|
|
225
|
+
layerInfo.info.push(subLayerInfo);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
featureInfos.push(layerInfo);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
198
231
|
getLayerString(prefix = "show") {
|
|
199
232
|
const layers = new Array();
|
|
200
233
|
this._settings.subLayers.forEach((subLayer) => { if (this._settings.isSubLayerVisible(subLayer))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGISMapLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAA4B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAoD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;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E,MAAM,EAAE,qBAAqB,CAAC,OAAO;iBACtC,CAAC,CAAC;gBACL,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;oBACd,UAAU,GAAG,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC;aACxC;YAAC,MAAM;aACP;SACF;QACD,OAAO,GAAG,GAAG,GAAG,UAAU,EAAE,CAAC;IAC/B,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 Tiles\r\n */\r\n\r\nimport { getJson, request, RequestOptions, Response } from \"../../../request/Request\";\r\nimport { Cartographic, ImageMapLayerSettings, ImageSource, IModelStatus, ServerError } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../../../NotificationManager\";\r\nimport {\r\n ArcGisErrorCode, ArcGISTileMap, ArcGisTokenClientType, ArcGisTokenManager, ArcGisUtilities, ImageryMapTile, ImageryMapTileTree, MapCartoRectangle,\r\n MapLayerImageryProvider, MapLayerImageryProviderStatus, QuadId,\r\n} from \"../../internal\";\r\n\r\n// eslint-disable-next-line prefer-const\r\nlet doToolTips = true;\r\n\r\n/** @internal */\r\nexport class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {\r\n private _maxDepthFromLod = 0;\r\n private _minDepthFromLod = 0;\r\n private _copyrightText = \"Copyright\";\r\n private _querySupported = false;\r\n private _tileMapSupported = false;\r\n private _tileMap: ArcGISTileMap|undefined;\r\n public serviceJson: any;\r\n constructor(settings: ImageMapLayerSettings) {\r\n super(settings, false);\r\n }\r\n\r\n protected override get _filterByCartoRange() { return false; } // Can't trust footprint ranges (USGS Hydro)\r\n\r\n public override get minimumZoomLevel() { return Math.max(super.minimumZoomLevel, this._minDepthFromLod); }\r\n public override get maximumZoomLevel() { return this._maxDepthFromLod > 0 ? this._maxDepthFromLod : super.maximumZoomLevel; }\r\n\r\n public uintToString(uintArray: any) {\r\n return Buffer.from(uintArray).toJSON();\r\n\r\n }\r\n\r\n private async fetchTile(row: number, column: number, zoomLevel: number): Promise<Response | undefined> {\r\n const tileRequestOptions: RequestOptions = { method: \"GET\", responseType: \"arraybuffer\" };\r\n tileRequestOptions.auth = this.getRequestAuthorization();\r\n const tileUrl: string = await this.constructUrl(row, column, zoomLevel);\r\n if (tileUrl.length === 0)\r\n return undefined;\r\n\r\n return request(tileUrl, tileRequestOptions);\r\n }\r\n\r\n public override async loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined> {\r\n\r\n if ((this.status === MapLayerImageryProviderStatus.RequireAuth)) {\r\n return undefined;\r\n }\r\n\r\n try {\r\n let tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n\r\n // Check the content type from the response, it might contain an authentication error that need to be reported.\r\n // Skip if the layer state was already invalid\r\n if (ArcGisUtilities.hasTokenError(tileResponse)) {\r\n\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (tileResponse && ArcGisUtilities.hasTokenError(tileResponse)) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n this.onStatusChanged.raiseEvent(this);\r\n\r\n // Only report error to end-user if we were previously able to fetch tiles\r\n // and then encountered an error, otherwise I assume an error was already reported\r\n // through the source validation process.\r\n if (this._hasSuccessfullyFetchedTile) {\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.LoadTileTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n }\r\n\r\n if (!this._hasSuccessfullyFetchedTile) {\r\n this._hasSuccessfullyFetchedTile = true;\r\n }\r\n return this.getImageFromTileResponse(tileResponse, zoomLevel);\r\n } catch (error) {\r\n return undefined;\r\n }\r\n }\r\n protected override _generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void) {\r\n const childIds = this.getPotentialChildIds(tile);\r\n if (!this._tileMap || tile.quadId.level < Math.max(4, this.minimumZoomLevel-1)) {\r\n resolveChildren(childIds);\r\n return;\r\n }\r\n\r\n if (this._tileMap) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._tileMap.getChildrenAvailability(childIds).then((availability) => {\r\n const availableChildIds = new Array<QuadId>();\r\n for (let i = 0; i < availability.length; i++)\r\n if (availability[i])\r\n availableChildIds.push(childIds[i]);\r\n\r\n resolveChildren (availableChildIds);\r\n });\r\n }\r\n }\r\n\r\n private 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 public override async initialize(): Promise<void> {\r\n const json = await ArcGisUtilities.getServiceJson(this._settings.url, this.getRequestAuthorization());\r\n if (json === undefined)\r\n throw new ServerError(IModelStatus.ValidationFailed, \"\");\r\n\r\n if (json !== undefined) {\r\n this.serviceJson = json;\r\n if (json.capabilities) {\r\n\r\n this._querySupported = json.capabilities.indexOf(\"Query\") >= 0;\r\n this._tileMapSupported = json.capabilities.indexOf(\"Tilemap\") >= 0;\r\n }\r\n if (json.copyrightText) this._copyrightText = json.copyrightText;\r\n if (false !== (this._usesCachedTiles = json.tileInfo !== undefined && this.isEpsg3857Compatible(json.tileInfo))) {\r\n if (json.maxScale !== undefined && json.maxScale !== 0 && Array.isArray(json.tileInfo.lods)) {\r\n for (; this._maxDepthFromLod < json.tileInfo.lods.length && json.tileInfo.lods[this._maxDepthFromLod].scale > json.maxScale; this._maxDepthFromLod++)\r\n ;\r\n }\r\n }\r\n\r\n // Create tile map object only if we are going to request tiles from this server and it support tilemap requests.\r\n if (this._usesCachedTiles && this._tileMapSupported) {\r\n this._tileMap = new ArcGISTileMap(this._settings.url, json.tileInfo?.lods?.length);\r\n }\r\n\r\n const footprintJson = await ArcGisUtilities.getFootprintJson(this._settings.url, this.getRequestAuthorization());\r\n if (undefined !== footprintJson && undefined !== footprintJson.featureCollection && Array.isArray(footprintJson.featureCollection.layers)) {\r\n for (const layer of footprintJson.featureCollection.layers) {\r\n if (layer.layerDefinition && layer.layerDefinition.extent) {\r\n this.cartoRange = MapCartoRectangle.createFromDegrees(layer.layerDefinition.extent.xmin, layer.layerDefinition.extent.ymin, layer.layerDefinition.extent.xmax, layer.layerDefinition.extent.ymax);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Read minLOD if available\r\n if (json.minLOD !== undefined) {\r\n const minLod = parseInt(json.minLOD, 10);\r\n if (!Number.isNaN(minLod)) {\r\n this._minDepthFromLod = minLod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public override getLogo() {\r\n return IModelApp.makeLogoCard({ heading: \"ArcGIS\", notice: this._copyrightText });\r\n }\r\n\r\n public override async getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> {\r\n await super.getToolTip(strings, quadId, carto, tree);\r\n if (!doToolTips)\r\n return;\r\n\r\n if (!this._querySupported)\r\n return;\r\n\r\n const stringSet = new Set<string>();\r\n const bboxString = this.getEPSG3857ExtentString(quadId.row, quadId.column, quadId.level);\r\n const x = this.getEPSG3857X(carto.longitudeDegrees);\r\n const y = this.getEPSG3857Y(carto.latitudeDegrees);\r\n const tmpUrl = `${this._settings.url}/identify?f=json&tolerance=1&returnGeometry=false&sr=3857&imageDisplay=${this.tileSize},${this.tileSize},96&layers=${this.getLayerString(\"visible\")}&geometry=${x},${y}&geometryType=esriGeometryPoint&mapExtent=${bboxString}`;\r\n const url = await this.appendSecurityToken(tmpUrl);\r\n\r\n let json = await getJson(url);\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n json = await getJson(url);\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.FetchTooltipTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n\r\n return;\r\n }\r\n }\r\n\r\n if (json && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n if (result.attributes !== undefined && result.attributes[result.displayFieldName] !== undefined) {\r\n const thisString = `${result.displayFieldName}: ${result.attributes[result.displayFieldName]}`;\r\n if (!stringSet.has(thisString)) {\r\n strings.push(thisString);\r\n stringSet.add(thisString);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n protected getLayerString(prefix = \"show\"): string {\r\n const layers = new Array<string>();\r\n this._settings.subLayers.forEach((subLayer) => { if (this._settings.isSubLayerVisible(subLayer)) layers.push(subLayer.idString); });\r\n return `${prefix}: ${layers.join(\",\")} `;\r\n }\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n let tmpUrl;\r\n if (this._usesCachedTiles) {\r\n tmpUrl = `${this._settings.url}/tile/${zoomLevel}/${row}/${column} `;\r\n } else {\r\n const bboxString = `${this.getEPSG3857ExtentString(row, column, zoomLevel)}&bboxSR=3857`;\r\n tmpUrl = `${this._settings.url}/export?bbox=${bboxString}&size=${this.tileSize},${this.tileSize}&layers=${this.getLayerString()}&format=png&transparent=${this.transparentBackgroundString}&f=image&sr=3857&imagesr=3857`;\r\n }\r\n return this.appendSecurityToken(tmpUrl);\r\n }\r\n\r\n // construct the Url from the desired Tile\r\n private async appendSecurityToken(url: string): Promise<string> {\r\n // Append security token if required\r\n let tokenParam = \"\";\r\n if (this._settings.userName && this._settings.password) {\r\n try {\r\n const token = await ArcGisTokenManager.getToken(this._settings.url, this._settings.userName, this._settings.password,\r\n {\r\n client: ArcGisTokenClientType.referer,\r\n });\r\n if (token?.token)\r\n tokenParam = `&token=${token.token}`;\r\n } catch {\r\n }\r\n }\r\n return `${url}${tokenParam}`;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ArcGISMapLayerImageryProvider.js","sourceRoot":"","sources":["../../../../../src/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,EAA4B,MAAM,0BAA0B,CAAC;AACtF,OAAO,EAAoD,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EACL,eAAe,EAAE,aAAa,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAsC,iBAAiB,EAC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C,GAAW;QAC3C,oCAAoC;QACpC,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;YACtD,IAAI;gBACF,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAClH;oBACE,MAAM,EAAE,qBAAqB,CAAC,OAAO;iBACtC,CAAC,CAAC;gBACL,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;oBACd,UAAU,GAAG,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC;aACxC;YAAC,MAAM;aACP;SACF;QACD,OAAO,GAAG,GAAG,GAAG,UAAU,EAAE,CAAC;IAC/B,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 Tiles\r\n */\r\n\r\nimport { getJson, request, RequestOptions, Response } from \"../../../request/Request\";\r\nimport { Cartographic, ImageMapLayerSettings, ImageSource, IModelStatus, ServerError } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../../IModelApp\";\r\nimport { NotifyMessageDetails, OutputMessagePriority } from \"../../../NotificationManager\";\r\nimport {\r\n ArcGisErrorCode, ArcGISTileMap, ArcGisTokenClientType, ArcGisTokenManager, ArcGisUtilities, ImageryMapTile, ImageryMapTileTree, MapCartoRectangle,\r\n MapFeatureInfoRecord,\r\n MapLayerFeatureInfo,\r\n MapLayerImageryProvider, MapLayerImageryProviderStatus, MapSubLayerFeatureInfo, QuadId,\r\n} from \"../../internal\";\r\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\r\n\r\n/** @internal */\r\nexport class ArcGISMapLayerImageryProvider extends MapLayerImageryProvider {\r\n private _maxDepthFromLod = 0;\r\n private _minDepthFromLod = 0;\r\n private _copyrightText = \"Copyright\";\r\n private _querySupported = false;\r\n private _tileMapSupported = false;\r\n private _tileMap: ArcGISTileMap|undefined;\r\n public serviceJson: any;\r\n constructor(settings: ImageMapLayerSettings) {\r\n super(settings, false);\r\n }\r\n\r\n protected override get _filterByCartoRange() { return false; } // Can't trust footprint ranges (USGS Hydro)\r\n\r\n public override get minimumZoomLevel() { return Math.max(super.minimumZoomLevel, this._minDepthFromLod); }\r\n public override get maximumZoomLevel() { return this._maxDepthFromLod > 0 ? this._maxDepthFromLod : super.maximumZoomLevel; }\r\n\r\n public uintToString(uintArray: any) {\r\n return Buffer.from(uintArray).toJSON();\r\n\r\n }\r\n\r\n private async fetchTile(row: number, column: number, zoomLevel: number): Promise<Response | undefined> {\r\n const tileRequestOptions: RequestOptions = { method: \"GET\", responseType: \"arraybuffer\" };\r\n tileRequestOptions.auth = this.getRequestAuthorization();\r\n const tileUrl: string = await this.constructUrl(row, column, zoomLevel);\r\n if (tileUrl.length === 0)\r\n return undefined;\r\n\r\n return request(tileUrl, tileRequestOptions);\r\n }\r\n\r\n public override async loadTile(row: number, column: number, zoomLevel: number): Promise<ImageSource | undefined> {\r\n\r\n if ((this.status === MapLayerImageryProviderStatus.RequireAuth)) {\r\n return undefined;\r\n }\r\n\r\n try {\r\n let tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n\r\n // Check the content type from the response, it might contain an authentication error that need to be reported.\r\n // Skip if the layer state was already invalid\r\n if (ArcGisUtilities.hasTokenError(tileResponse)) {\r\n\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n tileResponse = await this.fetchTile(row, column, zoomLevel);\r\n if (tileResponse === undefined)\r\n return undefined;\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (tileResponse && ArcGisUtilities.hasTokenError(tileResponse)) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n this.onStatusChanged.raiseEvent(this);\r\n\r\n // Only report error to end-user if we were previously able to fetch tiles\r\n // and then encountered an error, otherwise I assume an error was already reported\r\n // through the source validation process.\r\n if (this._hasSuccessfullyFetchedTile) {\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.LoadTileTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n }\r\n\r\n if (!this._hasSuccessfullyFetchedTile) {\r\n this._hasSuccessfullyFetchedTile = true;\r\n }\r\n return this.getImageFromTileResponse(tileResponse, zoomLevel);\r\n } catch (error) {\r\n return undefined;\r\n }\r\n }\r\n protected override _generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void) {\r\n const childIds = this.getPotentialChildIds(tile);\r\n if (!this._tileMap || tile.quadId.level < Math.max(4, this.minimumZoomLevel-1)) {\r\n resolveChildren(childIds);\r\n return;\r\n }\r\n\r\n if (this._tileMap) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this._tileMap.getChildrenAvailability(childIds).then((availability) => {\r\n const availableChildIds = new Array<QuadId>();\r\n for (let i = 0; i < availability.length; i++)\r\n if (availability[i])\r\n availableChildIds.push(childIds[i]);\r\n\r\n resolveChildren (availableChildIds);\r\n });\r\n }\r\n }\r\n\r\n private 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 public override async initialize(): Promise<void> {\r\n const json = await ArcGisUtilities.getServiceJson(this._settings.url, this.getRequestAuthorization());\r\n if (json === undefined)\r\n throw new ServerError(IModelStatus.ValidationFailed, \"\");\r\n\r\n if (json !== undefined) {\r\n this.serviceJson = json;\r\n if (json.capabilities) {\r\n\r\n this._querySupported = json.capabilities.indexOf(\"Query\") >= 0;\r\n this._tileMapSupported = json.capabilities.indexOf(\"Tilemap\") >= 0;\r\n }\r\n if (json.copyrightText) this._copyrightText = json.copyrightText;\r\n if (false !== (this._usesCachedTiles = json.tileInfo !== undefined && this.isEpsg3857Compatible(json.tileInfo))) {\r\n if (json.maxScale !== undefined && json.maxScale !== 0 && Array.isArray(json.tileInfo.lods)) {\r\n for (; this._maxDepthFromLod < json.tileInfo.lods.length && json.tileInfo.lods[this._maxDepthFromLod].scale > json.maxScale; this._maxDepthFromLod++)\r\n ;\r\n }\r\n }\r\n\r\n // Create tile map object only if we are going to request tiles from this server and it support tilemap requests.\r\n if (this._usesCachedTiles && this._tileMapSupported) {\r\n this._tileMap = new ArcGISTileMap(this._settings.url, json.tileInfo?.lods?.length);\r\n }\r\n\r\n const footprintJson = await ArcGisUtilities.getFootprintJson(this._settings.url, this.getRequestAuthorization());\r\n if (undefined !== footprintJson && undefined !== footprintJson.featureCollection && Array.isArray(footprintJson.featureCollection.layers)) {\r\n for (const layer of footprintJson.featureCollection.layers) {\r\n if (layer.layerDefinition && layer.layerDefinition.extent) {\r\n this.cartoRange = MapCartoRectangle.createFromDegrees(layer.layerDefinition.extent.xmin, layer.layerDefinition.extent.ymin, layer.layerDefinition.extent.xmax, layer.layerDefinition.extent.ymax);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Read minLOD if available\r\n if (json.minLOD !== undefined) {\r\n const minLod = parseInt(json.minLOD, 10);\r\n if (!Number.isNaN(minLod)) {\r\n this._minDepthFromLod = minLod;\r\n }\r\n }\r\n }\r\n }\r\n\r\n public override getLogo() {\r\n return IModelApp.makeLogoCard({ heading: \"ArcGIS\", notice: this._copyrightText });\r\n }\r\n\r\n // Translates the provided Cartographic into a EPSG:3857 point, and retrieve information.\r\n // tolerance is in pixels\r\n private async getIdentifyData(quadId: QuadId, carto: Cartographic, tolerance: number): Promise<any> {\r\n const bboxString = this.getEPSG3857ExtentString(quadId.row, quadId.column, quadId.level);\r\n const x = this.getEPSG3857X(carto.longitudeDegrees);\r\n const y = this.getEPSG3857Y(carto.latitudeDegrees);\r\n const tmpUrl = `${this._settings.url}/identify?f=json&tolerance=${tolerance}&returnGeometry=false&sr=3857&imageDisplay=${this.tileSize},${this.tileSize},96&layers=${this.getLayerString(\"visible\")}&geometry=${x},${y}&geometryType=esriGeometryPoint&mapExtent=${bboxString}`;\r\n const url = await this.appendSecurityToken(tmpUrl);\r\n\r\n let json = await getJson(url);\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Token might have expired, make a second attempt by forcing new token.\r\n if (this._settings.userName && this._settings.userName.length > 0) {\r\n ArcGisTokenManager.invalidateToken(this._settings.url, this._settings.userName);\r\n json = await getJson(url);\r\n }\r\n\r\n // OK at this point, if response still contain a token error, we assume end-user will\r\n // have to provide credentials again. Change the layer status so we\r\n // don't make additional invalid requests..\r\n if (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken) {\r\n // Check again layer status, it might have change during await.\r\n if (this.status === MapLayerImageryProviderStatus.Valid) {\r\n this.status = MapLayerImageryProviderStatus.RequireAuth;\r\n const msg = IModelApp.localization.getLocalizedString(\"iModelJs:MapLayers.Messages.FetchTooltipTokenError\", { layerName: this._settings.name });\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Warning, msg));\r\n }\r\n\r\n return undefined;\r\n }\r\n }\r\n\r\n return json;\r\n }\r\n\r\n // Makes an identify request to ESRI MapService server, and return it as a list of formatted strings\r\n public override async getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> {\r\n await super.getToolTip(strings, quadId, carto, tree);\r\n\r\n if (!this._querySupported)\r\n return;\r\n\r\n const stringSet = new Set<string>();\r\n const json = await this.getIdentifyData(quadId, carto, 1);\r\n\r\n if (json && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n if (result.attributes !== undefined && result.attributes[result.displayFieldName] !== undefined) {\r\n const thisString = `${result.displayFieldName}: ${result.attributes[result.displayFieldName]}`;\r\n if (!stringSet.has(thisString)) {\r\n strings.push(thisString);\r\n stringSet.add(thisString);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Makes an identify request to ESRI MapService , and return it as a list MapLayerFeatureInfo object\r\n public override async getFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, _tree: ImageryMapTileTree): Promise<void> {\r\n if (!this._querySupported)\r\n return;\r\n\r\n const json = await this.getIdentifyData(quadId, carto,5 );\r\n if (json && Array.isArray(json.results)) {\r\n const layerInfo: MapLayerFeatureInfo = {layerName: this._settings.name};\r\n\r\n for (const result of json.results) {\r\n\r\n const subLayerInfo: MapSubLayerFeatureInfo = {\r\n subLayerName: result.layerName ?? \"\",\r\n displayFieldName: result.displayFieldName,\r\n records : [],\r\n };\r\n for (const [key, value] of Object.entries(result.attributes)) {\r\n // Convert everything to string for now\r\n const strValue = String(value);\r\n subLayerInfo.records?.push(new MapFeatureInfoRecord (\r\n {valueFormat:PropertyValueFormat.Primitive, value:strValue, displayValue: strValue},\r\n {name: key, displayLabel: key, typename:StandardTypeNames.String}\r\n ));\r\n }\r\n\r\n if (layerInfo.info === undefined) {\r\n layerInfo.info = [];\r\n }\r\n\r\n if (!(layerInfo.info instanceof HTMLElement)) {\r\n layerInfo.info.push(subLayerInfo);\r\n }\r\n\r\n }\r\n\r\n featureInfos.push(layerInfo);\r\n }\r\n }\r\n\r\n protected getLayerString(prefix = \"show\"): string {\r\n const layers = new Array<string>();\r\n this._settings.subLayers.forEach((subLayer) => { if (this._settings.isSubLayerVisible(subLayer)) layers.push(subLayer.idString); });\r\n return `${prefix}: ${layers.join(\",\")} `;\r\n }\r\n // construct the Url from the desired Tile\r\n public async constructUrl(row: number, column: number, zoomLevel: number): Promise<string> {\r\n let tmpUrl;\r\n if (this._usesCachedTiles) {\r\n tmpUrl = `${this._settings.url}/tile/${zoomLevel}/${row}/${column} `;\r\n } else {\r\n const bboxString = `${this.getEPSG3857ExtentString(row, column, zoomLevel)}&bboxSR=3857`;\r\n tmpUrl = `${this._settings.url}/export?bbox=${bboxString}&size=${this.tileSize},${this.tileSize}&layers=${this.getLayerString()}&format=png&transparent=${this.transparentBackgroundString}&f=image&sr=3857&imagesr=3857`;\r\n }\r\n return this.appendSecurityToken(tmpUrl);\r\n }\r\n\r\n // construct the Url from the desired Tile\r\n private async appendSecurityToken(url: string): Promise<string> {\r\n // Append security token if required\r\n let tokenParam = \"\";\r\n if (this._settings.userName && this._settings.password) {\r\n try {\r\n const token = await ArcGisTokenManager.getToken(this._settings.url, this._settings.userName, this._settings.password,\r\n {\r\n client: ArcGisTokenClientType.referer,\r\n });\r\n if (token?.token)\r\n tokenParam = `&token=${token.token}`;\r\n } catch {\r\n }\r\n }\r\n return `${url}${tokenParam}`;\r\n }\r\n}\r\n"]}
|
|
@@ -6,7 +6,7 @@ import { IModelConnection } from "../../IModelConnection";
|
|
|
6
6
|
import { RenderMemory } from "../../render/RenderMemory";
|
|
7
7
|
import { RenderSystem } from "../../render/RenderSystem";
|
|
8
8
|
import { ScreenViewport } from "../../Viewport";
|
|
9
|
-
import { MapCartoRectangle, MapLayerImageryProvider, MapLayerTileTreeReference, MapTile, MapTilingScheme, QuadId, RealityTile, RealityTileLoader, RealityTileTree, RealityTileTreeParams, Tile, TileContent, TileDrawArgs, TileLoadPriority, TileParams, TileRequest, TileTreeLoadStatus, TileTreeOwner } from "../internal";
|
|
9
|
+
import { MapCartoRectangle, MapLayerFeatureInfo, MapLayerImageryProvider, MapLayerTileTreeReference, MapTile, MapTilingScheme, QuadId, RealityTile, RealityTileLoader, RealityTileTree, RealityTileTreeParams, Tile, TileContent, TileDrawArgs, TileLoadPriority, TileParams, TileRequest, TileTreeLoadStatus, TileTreeOwner } from "../internal";
|
|
10
10
|
/** @internal */
|
|
11
11
|
export interface ImageryTileContent extends TileContent {
|
|
12
12
|
imageryTexture?: RenderTexture;
|
|
@@ -65,6 +65,7 @@ declare class ImageryTileLoader extends RealityTileLoader {
|
|
|
65
65
|
get maximumScreenSize(): number;
|
|
66
66
|
get imageryProvider(): MapLayerImageryProvider;
|
|
67
67
|
getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void>;
|
|
68
|
+
getMapFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void>;
|
|
68
69
|
generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void): void;
|
|
69
70
|
/** Load this tile's children, possibly asynchronously. Pass them to `resolve`, or an error to `reject`. */
|
|
70
71
|
loadChildren(_tile: RealityTile): Promise<Tile[] | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageryTileTree.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/ImageryTileTree.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,YAAY,EAAsC,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE1I,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,E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G,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC;IAK/F,iBAAiB,CAAC,KAAK,EAAE,IAAI;IAKd,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAYtH,gBAAgB;CAU/B;AAwDD;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,yBAAyB;gBACtD,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB;IAIhG,IAAoB,YAAY,YAAoB;IAEpD,gDAAgD;IAChD,IAAW,SAAS,IAAI,aAAa,CAEpC;IACD,IAAoB,eAAe,IAAI,uBAAuB,GAAG,SAAS,CAMzE;CACF"}
|
|
@@ -154,6 +154,9 @@ class ImageryTileLoader extends RealityTileLoader {
|
|
|
154
154
|
get maximumScreenSize() { return this._imageryProvider.maximumScreenSize; }
|
|
155
155
|
get imageryProvider() { return this._imageryProvider; }
|
|
156
156
|
async getToolTip(strings, quadId, carto, tree) { await this._imageryProvider.getToolTip(strings, quadId, carto, tree); }
|
|
157
|
+
async getMapFeatureInfo(featureInfos, quadId, carto, tree) {
|
|
158
|
+
await this._imageryProvider.getFeatureInfo(featureInfos, quadId, carto, tree);
|
|
159
|
+
}
|
|
157
160
|
generateChildIds(tile, resolveChildren) { return this._imageryProvider.generateChildIds(tile, resolveChildren); }
|
|
158
161
|
/** Load this tile's children, possibly asynchronously. Pass them to `resolve`, or an error to `reject`. */
|
|
159
162
|
async loadChildren(_tile) { assert(false); return undefined; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageryTileTree.js","sourceRoot":"","sources":["../../../../src/tile/map/ImageryTileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,yBAAyB,EAAE,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OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;IAC5C,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 Tiles\r\n */\r\n\r\nimport { assert, compareBooleans, compareNumbers, compareStrings, compareStringsOrUndefined, dispose } from \"@itwin/core-bentley\";\r\nimport { Angle, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { Cartographic, ImageMapLayerSettings, ImageSource, MapLayerSettings, RenderTexture, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { RenderMemory } from \"../../render/RenderMemory\";\r\nimport { RenderSystem } from \"../../render/RenderSystem\";\r\nimport { ScreenViewport } from \"../../Viewport\";\r\nimport {\r\n MapCartoRectangle, MapLayerImageryProvider, MapLayerTileTreeReference, MapTile, MapTilingScheme, QuadId, RealityTile, RealityTileLoader, RealityTileTree,\r\n RealityTileTreeParams, Tile, TileContent, TileDrawArgs, TileLoadPriority, TileParams, TileRequest, TileTree, TileTreeLoadStatus, TileTreeOwner,\r\n TileTreeSupplier,\r\n} from \"../internal\";\r\n\r\n/** @internal */\r\nexport interface ImageryTileContent extends TileContent {\r\n imageryTexture?: RenderTexture;\r\n}\r\n\r\n/** @internal */\r\nexport class ImageryMapTile extends RealityTile {\r\n private _texture?: RenderTexture;\r\n private _mapTileUsageCount = 0;\r\n constructor(params: TileParams, public imageryTree: ImageryMapTileTree, public quadId: QuadId, public rectangle: MapCartoRectangle) {\r\n super(params, imageryTree);\r\n }\r\n public get texture() { return this._texture; }\r\n public get tilingScheme() { return this.imageryTree.tilingScheme; }\r\n public override get isDisplayable() { return (this.depth > 1) && super.isDisplayable; }\r\n\r\n public override setContent(content: ImageryTileContent): void {\r\n this._texture = content.imageryTexture; // No dispose - textures may be shared by terrain tiles so let garbage collector dispose them.\r\n if (undefined === content.imageryTexture)\r\n (this.parent! as ImageryMapTile).setLeaf(); // Avoid traversing bing branches after no graphics is found.\r\n\r\n this.setIsReady();\r\n }\r\n\r\n public selectCartoDrapeTiles(drapeTiles: ImageryMapTile[], rectangleToDrape: MapCartoRectangle, drapePixelSize: number, args: TileDrawArgs): TileTreeLoadStatus {\r\n // Base draping overlap on width rather than height so that tiling schemes with multiple root nodes overlay correctly.\r\n if (this.isLeaf || (this.rectangle.xLength() / this.maximumSize) < drapePixelSize || this._anyChildNotFound) {\r\n if (this.isDisplayable && !this.isNotFound)\r\n drapeTiles.push(this);\r\n return TileTreeLoadStatus.Loaded;\r\n }\r\n\r\n let status = this.loadChildren();\r\n if (TileTreeLoadStatus.Loading === status) {\r\n args.markChildrenLoading();\r\n } else if (TileTreeLoadStatus.Loaded === status) {\r\n if (undefined !== this.children) {\r\n for (const child of this.children) {\r\n const mapChild = child as ImageryMapTile;\r\n if (mapChild.rectangle.intersectsRange(rectangleToDrape))\r\n status = mapChild.selectCartoDrapeTiles(drapeTiles, rectangleToDrape, drapePixelSize, args);\r\n if (TileTreeLoadStatus.Loaded !== status)\r\n break;\r\n }\r\n }\r\n }\r\n return status;\r\n }\r\n public markMapTileUsage() {\r\n this._mapTileUsageCount++;\r\n }\r\n public releaseMapTileUsage() {\r\n assert(!this._texture || this._mapTileUsageCount > 0);\r\n if (this._mapTileUsageCount)\r\n this._mapTileUsageCount--;\r\n }\r\n\r\n /** @internal */\r\n public override setLeaf(): void {\r\n // Don't potentially re-request the children later.\r\n this.disposeChildren();\r\n this._isLeaf = true;\r\n this._childrenLoadStatus = TileTreeLoadStatus.Loaded;\r\n }\r\n\r\n protected override _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n\r\n const imageryTree = this.imageryTree;\r\n const resolveChildren = (childIds: QuadId[]) => {\r\n const children = new Array<Tile>();\r\n const childrenAreLeaves = (this.depth + 1) === imageryTree.maxDepth;\r\n // If children depth is lower than min LOD, mark them as disabled.\r\n // This is important: if those tiles are requested and the server refuse to serve them,\r\n // they will be marked as not found and their descendant will never be displayed.\r\n const childrenAreDisabled = (this.depth + 1) < imageryTree.minDepth;\r\n\r\n childIds.forEach((quadId) => {\r\n const rectangle = imageryTree.tilingScheme.tileXYToRectangle(quadId.column, quadId.row, quadId.level);\r\n const range = Range3d.createXYZXYZ(rectangle.low.x, rectangle.low.x, 0, rectangle.high.x, rectangle.high.y, 0);\r\n const maximumSize = (childrenAreDisabled ? 0 : imageryTree.imageryLoader.maximumScreenSize);\r\n children.push(new ImageryMapTile({ parent: this, isLeaf: childrenAreLeaves, contentId: quadId.contentId, range, maximumSize }, imageryTree, quadId, rectangle));\r\n });\r\n\r\n resolve(children);\r\n };\r\n\r\n imageryTree.imageryLoader.generateChildIds(this, resolveChildren);\r\n }\r\n\r\n protected override _collectStatistics(stats: RenderMemory.Statistics): void {\r\n super._collectStatistics(stats);\r\n if (this._texture)\r\n stats.addTexture(this._texture.bytesUsed);\r\n }\r\n\r\n public override freeMemory(): void {\r\n // ###TODO MapTiles and ImageryMapTiles share resources and don't currently interact well with TileAdmin.freeMemory(). Opt out for now.\r\n }\r\n\r\n public override disposeContents() {\r\n if (0 === this._mapTileUsageCount) {\r\n super.disposeContents();\r\n this.disposeTexture();\r\n }\r\n }\r\n\r\n private disposeTexture(): void {\r\n this._texture = dispose(this._texture);\r\n }\r\n public override dispose() {\r\n this._mapTileUsageCount = 0;\r\n super.dispose();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class ImageryMapTileTree extends RealityTileTree {\r\n constructor(params: RealityTileTreeParams, private _imageryLoader: ImageryTileLoader) {\r\n super(params);\r\n const rootQuadId = new QuadId(_imageryLoader.imageryProvider.tilingScheme.rootLevel, 0, 0);\r\n this._rootTile = new ImageryMapTile(params.rootTile, this, rootQuadId, this.getTileRectangle(rootQuadId));\r\n }\r\n public get tilingScheme(): MapTilingScheme { return this._imageryLoader.imageryProvider.tilingScheme; }\r\n public getLogo(vp: ScreenViewport): HTMLTableRowElement | undefined { return this._imageryLoader.getLogo(vp); }\r\n public getTileRectangle(quadId: QuadId): MapCartoRectangle {\r\n return this.tilingScheme.tileXYToRectangle(quadId.column, quadId.row, quadId.level);\r\n }\r\n public get imageryLoader(): ImageryTileLoader { return this._imageryLoader; }\r\n public override get is3d(): boolean { assert(false); return false; }\r\n public override get viewFlagOverrides(): ViewFlagOverrides { assert(false); return {}; }\r\n public override get isContentUnbounded(): boolean { assert(false); return true; }\r\n protected override _selectTiles(_args: TileDrawArgs): Tile[] { assert(false); return []; }\r\n public override draw(_args: TileDrawArgs): void { assert(false); }\r\n\r\n private static _scratchDrapeRectangle = new MapCartoRectangle();\r\n private static _drapeIntersectionScale = 1.0 - 1.0E-5;\r\n\r\n public selectCartoDrapeTiles(drapeTiles: ImageryMapTile[], tileToDrape: MapTile, args: TileDrawArgs): TileTreeLoadStatus {\r\n const drapeRectangle = tileToDrape.rectangle.clone(ImageryMapTileTree._scratchDrapeRectangle);\r\n // Base draping overlap on width rather than height so that tiling schemes with multiple root nodes overlay correctly.\r\n const drapePixelSize = 1.05 * tileToDrape.rectangle.xLength() / tileToDrape.maximumSize;\r\n drapeRectangle.scaleAboutCenterInPlace(ImageryMapTileTree._drapeIntersectionScale); // Contract slightly to avoid draping adjacent or slivers.\r\n return (this.rootTile as ImageryMapTile).selectCartoDrapeTiles(drapeTiles, drapeRectangle, drapePixelSize, args);\r\n }\r\n public cartoRectangleFromQuadId(quadId: QuadId): MapCartoRectangle { return this.tilingScheme.tileXYToRectangle(quadId.column, quadId.row, quadId.level); }\r\n}\r\n\r\nclass ImageryTileLoader extends RealityTileLoader {\r\n constructor(private _imageryProvider: MapLayerImageryProvider, private _iModel: IModelConnection) {\r\n super();\r\n }\r\n public override computeTilePriority(tile: Tile): number {\r\n return 25 * (this._imageryProvider.usesCachedTiles ? 2 : 1) - tile.depth; // Always cached first then descending by depth (high resolution/front first)\r\n } // Prioritized fast, cached tiles first.\r\n\r\n public get maxDepth(): number { return this._imageryProvider.maximumZoomLevel; }\r\n public get minDepth(): number { return this._imageryProvider.minimumZoomLevel; }\r\n public get priority(): TileLoadPriority { return TileLoadPriority.Map; }\r\n public getLogo(vp: ScreenViewport): HTMLTableRowElement | undefined { return this._imageryProvider.getLogo(vp); }\r\n public get maximumScreenSize(): number { return this._imageryProvider.maximumScreenSize; }\r\n public get imageryProvider(): MapLayerImageryProvider { return this._imageryProvider; }\r\n public async getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> { await this._imageryProvider.getToolTip(strings, quadId, carto, tree); }\r\n public generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void) { return this._imageryProvider.generateChildIds(tile, resolveChildren); }\r\n\r\n /** Load this tile's children, possibly asynchronously. Pass them to `resolve`, or an error to `reject`. */\r\n public async loadChildren(_tile: RealityTile): Promise<Tile[] | undefined> { assert(false); return undefined; }\r\n public async requestTileContent(tile: Tile, _isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n const quadId = QuadId.createFromContentId(tile.contentId);\r\n return this._imageryProvider.loadTile(quadId.row, quadId.column, quadId.level);\r\n }\r\n\r\n public getRequestChannel(_tile: Tile) {\r\n // ###TODO use hostname from url - but so many layers to go through to get that...\r\n return IModelApp.tileAdmin.channels.getForHttp(\"itwinjs-imagery\");\r\n }\r\n\r\n public override async loadTileContent(tile: Tile, data: TileRequest.ResponseData, system: RenderSystem): Promise<ImageryTileContent> {\r\n assert(data instanceof ImageSource);\r\n assert(tile instanceof ImageryMapTile);\r\n const content: ImageryTileContent = {};\r\n const texture = await this.loadTextureImage(data, system);\r\n if (undefined === texture)\r\n return content;\r\n\r\n content.imageryTexture = texture;\r\n return content;\r\n }\r\n\r\n private async loadTextureImage(source: ImageSource, system: RenderSystem): Promise<RenderTexture | undefined> {\r\n try {\r\n return await system.createTextureFromSource({\r\n type: RenderTexture.Type.FilteredTileSection,\r\n source,\r\n });\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n}\r\n\r\ninterface ImageryMapLayerTreeId {\r\n settings: ImageMapLayerSettings;\r\n}\r\n\r\n/** Supplies a TileTree that can load and draw tiles based on our imagery provider.\r\n * The TileTree is uniquely identified by its imagery type.\r\n */\r\nclass ImageryMapLayerTreeSupplier implements TileTreeSupplier {\r\n /** Return a numeric value indicating how two tree IDs are ordered relative to one another.\r\n * This allows the ID to serve as a lookup key to find the corresponding TileTree.\r\n */\r\n public compareTileTreeIds(lhs: ImageryMapLayerTreeId, rhs: ImageryMapLayerTreeId): number {\r\n let cmp = compareStrings(lhs.settings.url, rhs.settings.url);\r\n if (0 === cmp) {\r\n cmp = compareStringsOrUndefined(lhs.settings.userName, rhs.settings.userName);\r\n if (0 === cmp) {\r\n cmp = compareStringsOrUndefined(lhs.settings.password, rhs.settings.password);\r\n if (0 === cmp) {\r\n cmp = compareBooleans(lhs.settings.transparentBackground, rhs.settings.transparentBackground);\r\n if (0 === cmp) {\r\n cmp = compareNumbers(lhs.settings.subLayers.length, rhs.settings.subLayers.length);\r\n if (0 === cmp) {\r\n for (let i = 0; i < lhs.settings.subLayers.length && 0 === cmp; i++)\r\n cmp = compareBooleans(lhs.settings.subLayers[i].visible, rhs.settings.subLayers[i].visible);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n /** The first time a tree of a particular imagery type is requested, this function creates it. */\r\n public async createTileTree(id: ImageryMapLayerTreeId, iModel: IModelConnection): Promise<TileTree | undefined> {\r\n const imageryProvider = IModelApp.mapLayerFormatRegistry.createImageryProvider(id.settings);\r\n if (undefined === imageryProvider)\r\n return undefined;\r\n\r\n await imageryProvider.initialize();\r\n const modelId = iModel.transientIds.next;\r\n const tilingScheme = imageryProvider.tilingScheme;\r\n const rootLevel = (1 === tilingScheme.numberOfLevelZeroTilesX && 1 === tilingScheme.numberOfLevelZeroTilesY) ? 0 : -1;\r\n const rootTileId = new QuadId(rootLevel, 0, 0).contentId;\r\n const rootRange = Range3d.createXYZXYZ(-Angle.piRadians, -Angle.piOver2Radians, 0, Angle.piRadians, Angle.piOver2Radians, 0);\r\n const rootTileProps = { contentId: rootTileId, range: rootRange, maximumSize: 0 };\r\n const loader = new ImageryTileLoader(imageryProvider, iModel);\r\n const treeProps = { rootTile: rootTileProps, id: modelId, modelId, iModel, location: Transform.createIdentity(), priority: TileLoadPriority.Map, loader, gcsConverterAvailable: false };\r\n return new ImageryMapTileTree(treeProps, loader);\r\n }\r\n}\r\n\r\nconst imageryTreeSupplier = new ImageryMapLayerTreeSupplier();\r\n\r\n/** A reference to one of our tile trees. The specific TileTree drawn may change when the desired imagery type or target iModel changes.\r\n * @internal\r\n */\r\nexport class ImageryMapLayerTreeReference extends MapLayerTileTreeReference {\r\n public constructor(layerSettings: MapLayerSettings, layerIndex: number, iModel: IModelConnection) {\r\n super(layerSettings, layerIndex, iModel);\r\n }\r\n\r\n public override get castsShadows() { return false; }\r\n\r\n /** Return the owner of the TileTree to draw. */\r\n public get treeOwner(): TileTreeOwner {\r\n return this.iModel.tiles.getTileTreeOwner({ settings: this._layerSettings }, imageryTreeSupplier);\r\n }\r\n public override get imageryProvider(): MapLayerImageryProvider | undefined {\r\n const tree = this.treeOwner.load();\r\n if (!tree || !(tree instanceof ImageryMapTileTree))\r\n return undefined;\r\n\r\n return tree.imageryLoader.imageryProvider;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ImageryTileTree.js","sourceRoot":"","sources":["../../../../src/tile/map/ImageryTileTree.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,yBAAyB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAClI,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjE,O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IAAI,IAAI,CAAC,CAAC,IAAI,YAAY,kBAAkB,CAAC;YAChD,OAAO,SAAS,CAAC;QAEnB,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;IAC5C,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 Tiles\r\n */\r\n\r\nimport { assert, compareBooleans, compareNumbers, compareStrings, compareStringsOrUndefined, dispose } from \"@itwin/core-bentley\";\r\nimport { Angle, Range3d, Transform } from \"@itwin/core-geometry\";\r\nimport { Cartographic, ImageMapLayerSettings, ImageSource, MapLayerSettings, RenderTexture, ViewFlagOverrides } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { RenderMemory } from \"../../render/RenderMemory\";\r\nimport { RenderSystem } from \"../../render/RenderSystem\";\r\nimport { ScreenViewport } from \"../../Viewport\";\r\nimport {\r\n MapCartoRectangle, MapLayerFeatureInfo, MapLayerImageryProvider, MapLayerTileTreeReference, MapTile, MapTilingScheme, QuadId, RealityTile, RealityTileLoader, RealityTileTree,\r\n RealityTileTreeParams, Tile, TileContent, TileDrawArgs, TileLoadPriority, TileParams, TileRequest, TileTree, TileTreeLoadStatus, TileTreeOwner,\r\n TileTreeSupplier,\r\n} from \"../internal\";\r\n\r\n/** @internal */\r\nexport interface ImageryTileContent extends TileContent {\r\n imageryTexture?: RenderTexture;\r\n}\r\n\r\n/** @internal */\r\nexport class ImageryMapTile extends RealityTile {\r\n private _texture?: RenderTexture;\r\n private _mapTileUsageCount = 0;\r\n constructor(params: TileParams, public imageryTree: ImageryMapTileTree, public quadId: QuadId, public rectangle: MapCartoRectangle) {\r\n super(params, imageryTree);\r\n }\r\n public get texture() { return this._texture; }\r\n public get tilingScheme() { return this.imageryTree.tilingScheme; }\r\n public override get isDisplayable() { return (this.depth > 1) && super.isDisplayable; }\r\n\r\n public override setContent(content: ImageryTileContent): void {\r\n this._texture = content.imageryTexture; // No dispose - textures may be shared by terrain tiles so let garbage collector dispose them.\r\n if (undefined === content.imageryTexture)\r\n (this.parent! as ImageryMapTile).setLeaf(); // Avoid traversing bing branches after no graphics is found.\r\n\r\n this.setIsReady();\r\n }\r\n\r\n public selectCartoDrapeTiles(drapeTiles: ImageryMapTile[], rectangleToDrape: MapCartoRectangle, drapePixelSize: number, args: TileDrawArgs): TileTreeLoadStatus {\r\n // Base draping overlap on width rather than height so that tiling schemes with multiple root nodes overlay correctly.\r\n if (this.isLeaf || (this.rectangle.xLength() / this.maximumSize) < drapePixelSize || this._anyChildNotFound) {\r\n if (this.isDisplayable && !this.isNotFound)\r\n drapeTiles.push(this);\r\n return TileTreeLoadStatus.Loaded;\r\n }\r\n\r\n let status = this.loadChildren();\r\n if (TileTreeLoadStatus.Loading === status) {\r\n args.markChildrenLoading();\r\n } else if (TileTreeLoadStatus.Loaded === status) {\r\n if (undefined !== this.children) {\r\n for (const child of this.children) {\r\n const mapChild = child as ImageryMapTile;\r\n if (mapChild.rectangle.intersectsRange(rectangleToDrape))\r\n status = mapChild.selectCartoDrapeTiles(drapeTiles, rectangleToDrape, drapePixelSize, args);\r\n if (TileTreeLoadStatus.Loaded !== status)\r\n break;\r\n }\r\n }\r\n }\r\n return status;\r\n }\r\n public markMapTileUsage() {\r\n this._mapTileUsageCount++;\r\n }\r\n public releaseMapTileUsage() {\r\n assert(!this._texture || this._mapTileUsageCount > 0);\r\n if (this._mapTileUsageCount)\r\n this._mapTileUsageCount--;\r\n }\r\n\r\n /** @internal */\r\n public override setLeaf(): void {\r\n // Don't potentially re-request the children later.\r\n this.disposeChildren();\r\n this._isLeaf = true;\r\n this._childrenLoadStatus = TileTreeLoadStatus.Loaded;\r\n }\r\n\r\n protected override _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n\r\n const imageryTree = this.imageryTree;\r\n const resolveChildren = (childIds: QuadId[]) => {\r\n const children = new Array<Tile>();\r\n const childrenAreLeaves = (this.depth + 1) === imageryTree.maxDepth;\r\n // If children depth is lower than min LOD, mark them as disabled.\r\n // This is important: if those tiles are requested and the server refuse to serve them,\r\n // they will be marked as not found and their descendant will never be displayed.\r\n const childrenAreDisabled = (this.depth + 1) < imageryTree.minDepth;\r\n\r\n childIds.forEach((quadId) => {\r\n const rectangle = imageryTree.tilingScheme.tileXYToRectangle(quadId.column, quadId.row, quadId.level);\r\n const range = Range3d.createXYZXYZ(rectangle.low.x, rectangle.low.x, 0, rectangle.high.x, rectangle.high.y, 0);\r\n const maximumSize = (childrenAreDisabled ? 0 : imageryTree.imageryLoader.maximumScreenSize);\r\n children.push(new ImageryMapTile({ parent: this, isLeaf: childrenAreLeaves, contentId: quadId.contentId, range, maximumSize }, imageryTree, quadId, rectangle));\r\n });\r\n\r\n resolve(children);\r\n };\r\n\r\n imageryTree.imageryLoader.generateChildIds(this, resolveChildren);\r\n }\r\n\r\n protected override _collectStatistics(stats: RenderMemory.Statistics): void {\r\n super._collectStatistics(stats);\r\n if (this._texture)\r\n stats.addTexture(this._texture.bytesUsed);\r\n }\r\n\r\n public override freeMemory(): void {\r\n // ###TODO MapTiles and ImageryMapTiles share resources and don't currently interact well with TileAdmin.freeMemory(). Opt out for now.\r\n }\r\n\r\n public override disposeContents() {\r\n if (0 === this._mapTileUsageCount) {\r\n super.disposeContents();\r\n this.disposeTexture();\r\n }\r\n }\r\n\r\n private disposeTexture(): void {\r\n this._texture = dispose(this._texture);\r\n }\r\n public override dispose() {\r\n this._mapTileUsageCount = 0;\r\n super.dispose();\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class ImageryMapTileTree extends RealityTileTree {\r\n constructor(params: RealityTileTreeParams, private _imageryLoader: ImageryTileLoader) {\r\n super(params);\r\n const rootQuadId = new QuadId(_imageryLoader.imageryProvider.tilingScheme.rootLevel, 0, 0);\r\n this._rootTile = new ImageryMapTile(params.rootTile, this, rootQuadId, this.getTileRectangle(rootQuadId));\r\n }\r\n public get tilingScheme(): MapTilingScheme { return this._imageryLoader.imageryProvider.tilingScheme; }\r\n public getLogo(vp: ScreenViewport): HTMLTableRowElement | undefined { return this._imageryLoader.getLogo(vp); }\r\n public getTileRectangle(quadId: QuadId): MapCartoRectangle {\r\n return this.tilingScheme.tileXYToRectangle(quadId.column, quadId.row, quadId.level);\r\n }\r\n public get imageryLoader(): ImageryTileLoader { return this._imageryLoader; }\r\n public override get is3d(): boolean { assert(false); return false; }\r\n public override get viewFlagOverrides(): ViewFlagOverrides { assert(false); return {}; }\r\n public override get isContentUnbounded(): boolean { assert(false); return true; }\r\n protected override _selectTiles(_args: TileDrawArgs): Tile[] { assert(false); return []; }\r\n public override draw(_args: TileDrawArgs): void { assert(false); }\r\n\r\n private static _scratchDrapeRectangle = new MapCartoRectangle();\r\n private static _drapeIntersectionScale = 1.0 - 1.0E-5;\r\n\r\n public selectCartoDrapeTiles(drapeTiles: ImageryMapTile[], tileToDrape: MapTile, args: TileDrawArgs): TileTreeLoadStatus {\r\n const drapeRectangle = tileToDrape.rectangle.clone(ImageryMapTileTree._scratchDrapeRectangle);\r\n // Base draping overlap on width rather than height so that tiling schemes with multiple root nodes overlay correctly.\r\n const drapePixelSize = 1.05 * tileToDrape.rectangle.xLength() / tileToDrape.maximumSize;\r\n drapeRectangle.scaleAboutCenterInPlace(ImageryMapTileTree._drapeIntersectionScale); // Contract slightly to avoid draping adjacent or slivers.\r\n return (this.rootTile as ImageryMapTile).selectCartoDrapeTiles(drapeTiles, drapeRectangle, drapePixelSize, args);\r\n }\r\n public cartoRectangleFromQuadId(quadId: QuadId): MapCartoRectangle { return this.tilingScheme.tileXYToRectangle(quadId.column, quadId.row, quadId.level); }\r\n}\r\n\r\nclass ImageryTileLoader extends RealityTileLoader {\r\n constructor(private _imageryProvider: MapLayerImageryProvider, private _iModel: IModelConnection) {\r\n super();\r\n }\r\n public override computeTilePriority(tile: Tile): number {\r\n return 25 * (this._imageryProvider.usesCachedTiles ? 2 : 1) - tile.depth; // Always cached first then descending by depth (high resolution/front first)\r\n } // Prioritized fast, cached tiles first.\r\n\r\n public get maxDepth(): number { return this._imageryProvider.maximumZoomLevel; }\r\n public get minDepth(): number { return this._imageryProvider.minimumZoomLevel; }\r\n public get priority(): TileLoadPriority { return TileLoadPriority.Map; }\r\n public getLogo(vp: ScreenViewport): HTMLTableRowElement | undefined { return this._imageryProvider.getLogo(vp); }\r\n public get maximumScreenSize(): number { return this._imageryProvider.maximumScreenSize; }\r\n public get imageryProvider(): MapLayerImageryProvider { return this._imageryProvider; }\r\n public async getToolTip(strings: string[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> { await this._imageryProvider.getToolTip(strings, quadId, carto, tree); }\r\n\r\n public async getMapFeatureInfo(featureInfos: MapLayerFeatureInfo[], quadId: QuadId, carto: Cartographic, tree: ImageryMapTileTree): Promise<void> {\r\n await this._imageryProvider.getFeatureInfo(featureInfos, quadId, carto, tree);\r\n }\r\n\r\n public generateChildIds(tile: ImageryMapTile, resolveChildren: (childIds: QuadId[]) => void) { return this._imageryProvider.generateChildIds(tile, resolveChildren); }\r\n\r\n /** Load this tile's children, possibly asynchronously. Pass them to `resolve`, or an error to `reject`. */\r\n public async loadChildren(_tile: RealityTile): Promise<Tile[] | undefined> { assert(false); return undefined; }\r\n public async requestTileContent(tile: Tile, _isCanceled: () => boolean): Promise<TileRequest.Response> {\r\n const quadId = QuadId.createFromContentId(tile.contentId);\r\n return this._imageryProvider.loadTile(quadId.row, quadId.column, quadId.level);\r\n }\r\n\r\n public getRequestChannel(_tile: Tile) {\r\n // ###TODO use hostname from url - but so many layers to go through to get that...\r\n return IModelApp.tileAdmin.channels.getForHttp(\"itwinjs-imagery\");\r\n }\r\n\r\n public override async loadTileContent(tile: Tile, data: TileRequest.ResponseData, system: RenderSystem): Promise<ImageryTileContent> {\r\n assert(data instanceof ImageSource);\r\n assert(tile instanceof ImageryMapTile);\r\n const content: ImageryTileContent = {};\r\n const texture = await this.loadTextureImage(data, system);\r\n if (undefined === texture)\r\n return content;\r\n\r\n content.imageryTexture = texture;\r\n return content;\r\n }\r\n\r\n private async loadTextureImage(source: ImageSource, system: RenderSystem): Promise<RenderTexture | undefined> {\r\n try {\r\n return await system.createTextureFromSource({\r\n type: RenderTexture.Type.FilteredTileSection,\r\n source,\r\n });\r\n } catch {\r\n return undefined;\r\n }\r\n }\r\n}\r\n\r\ninterface ImageryMapLayerTreeId {\r\n settings: ImageMapLayerSettings;\r\n}\r\n\r\n/** Supplies a TileTree that can load and draw tiles based on our imagery provider.\r\n * The TileTree is uniquely identified by its imagery type.\r\n */\r\nclass ImageryMapLayerTreeSupplier implements TileTreeSupplier {\r\n /** Return a numeric value indicating how two tree IDs are ordered relative to one another.\r\n * This allows the ID to serve as a lookup key to find the corresponding TileTree.\r\n */\r\n public compareTileTreeIds(lhs: ImageryMapLayerTreeId, rhs: ImageryMapLayerTreeId): number {\r\n let cmp = compareStrings(lhs.settings.url, rhs.settings.url);\r\n if (0 === cmp) {\r\n cmp = compareStringsOrUndefined(lhs.settings.userName, rhs.settings.userName);\r\n if (0 === cmp) {\r\n cmp = compareStringsOrUndefined(lhs.settings.password, rhs.settings.password);\r\n if (0 === cmp) {\r\n cmp = compareBooleans(lhs.settings.transparentBackground, rhs.settings.transparentBackground);\r\n if (0 === cmp) {\r\n cmp = compareNumbers(lhs.settings.subLayers.length, rhs.settings.subLayers.length);\r\n if (0 === cmp) {\r\n for (let i = 0; i < lhs.settings.subLayers.length && 0 === cmp; i++)\r\n cmp = compareBooleans(lhs.settings.subLayers[i].visible, rhs.settings.subLayers[i].visible);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return cmp;\r\n }\r\n\r\n /** The first time a tree of a particular imagery type is requested, this function creates it. */\r\n public async createTileTree(id: ImageryMapLayerTreeId, iModel: IModelConnection): Promise<TileTree | undefined> {\r\n const imageryProvider = IModelApp.mapLayerFormatRegistry.createImageryProvider(id.settings);\r\n if (undefined === imageryProvider)\r\n return undefined;\r\n\r\n await imageryProvider.initialize();\r\n const modelId = iModel.transientIds.next;\r\n const tilingScheme = imageryProvider.tilingScheme;\r\n const rootLevel = (1 === tilingScheme.numberOfLevelZeroTilesX && 1 === tilingScheme.numberOfLevelZeroTilesY) ? 0 : -1;\r\n const rootTileId = new QuadId(rootLevel, 0, 0).contentId;\r\n const rootRange = Range3d.createXYZXYZ(-Angle.piRadians, -Angle.piOver2Radians, 0, Angle.piRadians, Angle.piOver2Radians, 0);\r\n const rootTileProps = { contentId: rootTileId, range: rootRange, maximumSize: 0 };\r\n const loader = new ImageryTileLoader(imageryProvider, iModel);\r\n const treeProps = { rootTile: rootTileProps, id: modelId, modelId, iModel, location: Transform.createIdentity(), priority: TileLoadPriority.Map, loader, gcsConverterAvailable: false };\r\n return new ImageryMapTileTree(treeProps, loader);\r\n }\r\n}\r\n\r\nconst imageryTreeSupplier = new ImageryMapLayerTreeSupplier();\r\n\r\n/** A reference to one of our tile trees. The specific TileTree drawn may change when the desired imagery type or target iModel changes.\r\n * @internal\r\n */\r\nexport class ImageryMapLayerTreeReference extends MapLayerTileTreeReference {\r\n public constructor(layerSettings: MapLayerSettings, layerIndex: number, iModel: IModelConnection) {\r\n super(layerSettings, layerIndex, iModel);\r\n }\r\n\r\n public override get castsShadows() { return false; }\r\n\r\n /** Return the owner of the TileTree to draw. */\r\n public get treeOwner(): TileTreeOwner {\r\n return this.iModel.tiles.getTileTreeOwner({ settings: this._layerSettings }, imageryTreeSupplier);\r\n }\r\n public override get imageryProvider(): MapLayerImageryProvider | undefined {\r\n const tree = this.treeOwner.load();\r\n if (!tree || !(tree instanceof ImageryMapTileTree))\r\n return undefined;\r\n\r\n return tree.imageryLoader.imageryProvider;\r\n }\r\n}\r\n"]}
|