@itwin/core-frontend 4.0.0-dev.99 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/lib/cjs/AccuSnap.d.ts.map +1 -1
  3. package/lib/cjs/AccuSnap.js +8 -0
  4. package/lib/cjs/AccuSnap.js.map +1 -1
  5. package/lib/cjs/DisplayStyleState.d.ts.map +1 -1
  6. package/lib/cjs/DisplayStyleState.js +2 -1
  7. package/lib/cjs/DisplayStyleState.js.map +1 -1
  8. package/lib/cjs/IModelApp.d.ts +1 -3
  9. package/lib/cjs/IModelApp.d.ts.map +1 -1
  10. package/lib/cjs/IModelApp.js +1 -3
  11. package/lib/cjs/IModelApp.js.map +1 -1
  12. package/lib/cjs/extension/ExtensionRuntime.js +1 -3
  13. package/lib/cjs/extension/ExtensionRuntime.js.map +1 -1
  14. package/lib/cjs/tile/RealityTileTree.js +1 -1
  15. package/lib/cjs/tile/RealityTileTree.js.map +1 -1
  16. package/lib/cjs/tile/TileAdmin.d.ts.map +1 -1
  17. package/lib/cjs/tile/TileAdmin.js +2 -1
  18. package/lib/cjs/tile/TileAdmin.js.map +1 -1
  19. package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
  20. package/lib/cjs/tile/map/ImageryTileTree.js +14 -7
  21. package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
  22. package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
  23. package/lib/cjs/tile/map/MapTile.js +2 -1
  24. package/lib/cjs/tile/map/MapTile.js.map +1 -1
  25. package/lib/esm/AccuSnap.d.ts.map +1 -1
  26. package/lib/esm/AccuSnap.js +8 -0
  27. package/lib/esm/AccuSnap.js.map +1 -1
  28. package/lib/esm/DisplayStyleState.d.ts.map +1 -1
  29. package/lib/esm/DisplayStyleState.js +2 -1
  30. package/lib/esm/DisplayStyleState.js.map +1 -1
  31. package/lib/esm/IModelApp.d.ts +1 -3
  32. package/lib/esm/IModelApp.d.ts.map +1 -1
  33. package/lib/esm/IModelApp.js +1 -3
  34. package/lib/esm/IModelApp.js.map +1 -1
  35. package/lib/esm/extension/ExtensionRuntime.js +1 -3
  36. package/lib/esm/extension/ExtensionRuntime.js.map +1 -1
  37. package/lib/esm/tile/RealityTileTree.js +1 -1
  38. package/lib/esm/tile/RealityTileTree.js.map +1 -1
  39. package/lib/esm/tile/TileAdmin.d.ts.map +1 -1
  40. package/lib/esm/tile/TileAdmin.js +2 -1
  41. package/lib/esm/tile/TileAdmin.js.map +1 -1
  42. package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
  43. package/lib/esm/tile/map/ImageryTileTree.js +14 -7
  44. package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
  45. package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
  46. package/lib/esm/tile/map/MapTile.js +2 -1
  47. package/lib/esm/tile/map/MapTile.js.map +1 -1
  48. package/package.json +18 -18
  49. package/lib/cjs/extension/ExtensionImpl.d.ts +0 -21
  50. package/lib/cjs/extension/ExtensionImpl.d.ts.map +0 -1
  51. package/lib/cjs/extension/ExtensionImpl.js +0 -47
  52. package/lib/cjs/extension/ExtensionImpl.js.map +0 -1
  53. package/lib/esm/extension/ExtensionImpl.d.ts +0 -21
  54. package/lib/esm/extension/ExtensionImpl.d.ts.map +0 -1
  55. package/lib/esm/extension/ExtensionImpl.js +0 -42
  56. package/lib/esm/extension/ExtensionImpl.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ImageryTileTree.js","sourceRoot":"","sources":["../../../../src/tile/map/ImageryTileTree.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkI;AAClI,wDAAiE;AACjE,oDAA0I;AAC1I,+CAA4C;AAK5C,0CAIqB;AAOrB,gBAAgB;AAChB,MAAa,cAAe,SAAQ,sBAAW;IAM7C,YAAY,MAAkB,EAAS,WAA+B,EAAS,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,CAAC;IAED,IAAoB,eAAe;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,YAAY,kBAAkB,CAAC;YAChD,OAAO,SAAS,CAAC;QAEnB,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;IAC5C,CAAC;CACF;AAvBD,oEAuBC","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, MapTileTreeScaleRangeVisibility, 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\r\n private readonly _outOfLodRange: boolean;\r\n\r\n constructor(params: TileParams, public imageryTree: ImageryMapTileTree, public quadId: QuadId, public rectangle: MapCartoRectangle) {\r\n super(params, imageryTree);\r\n\r\n this._outOfLodRange = this.depth < imageryTree.minDepth;\r\n }\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 public override get isOutOfLodRange(): boolean { return this._outOfLodRange;}\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[], highResolutionReplacementTiles: 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 const isSmallerThanDrape = (this.rectangle.xLength() / this.maximumSize) < drapePixelSize;\r\n if ( (this.isLeaf ) // Include leaves so tiles get stretched past max LOD levels. (Only for base imagery layer)\r\n || isSmallerThanDrape\r\n || this._anyChildNotFound) {\r\n if (this.isOutOfLodRange ) {\r\n drapeTiles.push(this);\r\n this.setIsReady();\r\n } else if (this.isLeaf && !isSmallerThanDrape && !this._anyChildNotFound) {\r\n // These tiles are selected because we are beyond the max LOD of the tile tree,\r\n // might be used to display \"stretched\" tiles instead of having blank.\r\n highResolutionReplacementTiles.push(this);\r\n } else {\r\n drapeTiles.push(this);\r\n }\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, highResolutionReplacementTiles, 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\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 = imageryTree.imageryLoader.maximumScreenSize;\r\n const tile = new ImageryMapTile({ parent: this, isLeaf: childrenAreLeaves, contentId: quadId.contentId, range, maximumSize}, imageryTree, quadId, rectangle);\r\n children.push(tile);\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/** Object that holds various state values for an ImageryTileTree\r\n * @internal */\r\nexport class ImageryTileTreeState {\r\n private _scaleRangeVis: MapTileTreeScaleRangeVisibility;\r\n\r\n constructor() {\r\n this._scaleRangeVis = MapTileTreeScaleRangeVisibility.Unknown;\r\n }\r\n\r\n /** Get the scale range visibility of the imagery tile tree.\r\n * @returns the scale range visibility of the imagery tile tree.\r\n */\r\n public getScaleRangeVisibility() {return this._scaleRangeVis;}\r\n\r\n /** Makes a deep copy of the current object.\r\n */\r\n public clone() {\r\n const clone = new ImageryTileTreeState();\r\n clone._scaleRangeVis = this._scaleRangeVis;\r\n return clone;\r\n }\r\n\r\n /** Reset the scale range visibility of imagery tile tree (i.e. unknown)\r\n */\r\n public reset() {\r\n this._scaleRangeVis = MapTileTreeScaleRangeVisibility.Unknown;\r\n }\r\n\r\n /** Sets the scale range visibility of the current imagery tile tree.\r\n * The state will be derived based on the previous visibility values:\r\n * Initial state: 'Unknown'\r\n * The first call will set the state to either: 'Visible' or 'Hidden'.\r\n * If subsequent visibility values are not consistent with the first visibility state, the state become 'Partial',\r\n * meaning the imagery tree currently contains a mixed of tiles being in range and out of range.\r\n */\r\n public setScaleRangeVisibility(visible: boolean) {\r\n if (this._scaleRangeVis === MapTileTreeScaleRangeVisibility.Unknown) {\r\n this._scaleRangeVis = (visible ? MapTileTreeScaleRangeVisibility.Visible : MapTileTreeScaleRangeVisibility.Hidden);\r\n } else if ((visible && this._scaleRangeVis === MapTileTreeScaleRangeVisibility.Hidden) || (!visible && this._scaleRangeVis === MapTileTreeScaleRangeVisibility.Visible)) {\r\n this._scaleRangeVis = MapTileTreeScaleRangeVisibility.Partial;\r\n }\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 addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void {\r\n this._imageryLoader.addLogoCards(cards, vp);\r\n }\r\n\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 {\r\n assert(false);\r\n return false;\r\n }\r\n public override get viewFlagOverrides(): ViewFlagOverrides {\r\n assert(false);\r\n return {};\r\n }\r\n public override get isContentUnbounded(): boolean {\r\n assert(false);\r\n return true;\r\n }\r\n protected override _selectTiles(_args: TileDrawArgs): Tile[] {\r\n assert(false);\r\n return [];\r\n }\r\n public override draw(_args: TileDrawArgs): void { assert(false); }\r\n\r\n private static _scratchDrapeRectangle = MapCartoRectangle.createZero();\r\n private static _drapeIntersectionScale = 1.0 - 1.0E-5;\r\n\r\n public selectCartoDrapeTiles(drapeTiles: ImageryMapTile[], highResolutionReplacementTiles: 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, highResolutionReplacementTiles, 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 addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void {\r\n this._imageryProvider.addLogoCards(cards, vp);\r\n }\r\n\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> {\r\n assert(false);\r\n return undefined;\r\n }\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.getNext();\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\r\n public override resetTreeOwner() {\r\n return this.iModel.tiles.resetTileTreeOwner({ settings: this._layerSettings }, imageryTreeSupplier);\r\n }\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,sDAAkI;AAClI,wDAAiE;AACjE,oDAA0I;AAC1I,+CAA4C;AAK5C,0CAIqB;AAOrB,gBAAgB;AAChB,MAAa,cAAe,SAAQ,sBAAW;IAM7C,YAAY,MAAkB,EAAS,WAA+B,EAAS,MAAc,EAAS,SAA4B;QAChI,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QADU,gBAAW,GAAX,WAAW,CAAoB;QAAS,WAAM,GAAN,MAAM,CAAQ;QAAS,cAAS,GAAT,SAAS,CAAmB;QAJ1H,uBAAkB,GAAG,CAAC,CAAC;QAO7B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,QAAQ,CAAC;IAC1D,CAAC;IAED,IAAW,OAAO,KAAK,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9C,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,WAAW,CAAC,YA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,eAAe;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,YAAY,kBAAkB,CAAC;YAChD,OAAO,SAAS,CAAC;QAEnB,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC;IAC5C,CAAC;CACF;AAvBD,oEAuBC","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, MapTileTreeScaleRangeVisibility, 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\r\n private readonly _outOfLodRange: boolean;\r\n\r\n constructor(params: TileParams, public imageryTree: ImageryMapTileTree, public quadId: QuadId, public rectangle: MapCartoRectangle) {\r\n super(params, imageryTree);\r\n\r\n this._outOfLodRange = this.depth < imageryTree.minDepth;\r\n }\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 public override get isOutOfLodRange(): boolean { return this._outOfLodRange;}\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[], highResolutionReplacementTiles: 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 const isSmallerThanDrape = (this.rectangle.xLength() / this.maximumSize) < drapePixelSize;\r\n if ( (this.isLeaf ) // Include leaves so tiles get stretched past max LOD levels. (Only for base imagery layer)\r\n || isSmallerThanDrape\r\n || this._anyChildNotFound) {\r\n if (this.isOutOfLodRange ) {\r\n drapeTiles.push(this);\r\n this.setIsReady();\r\n } else if (this.isLeaf && !isSmallerThanDrape && !this._anyChildNotFound) {\r\n // These tiles are selected because we are beyond the max LOD of the tile tree,\r\n // might be used to display \"stretched\" tiles instead of having blank.\r\n highResolutionReplacementTiles.push(this);\r\n } else {\r\n drapeTiles.push(this);\r\n }\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, highResolutionReplacementTiles, 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\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 = imageryTree.imageryLoader.maximumScreenSize;\r\n const tile = new ImageryMapTile({ parent: this, isLeaf: childrenAreLeaves, contentId: quadId.contentId, range, maximumSize}, imageryTree, quadId, rectangle);\r\n children.push(tile);\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/** Object that holds various state values for an ImageryTileTree\r\n * @internal */\r\nexport class ImageryTileTreeState {\r\n private _scaleRangeVis: MapTileTreeScaleRangeVisibility;\r\n\r\n constructor() {\r\n this._scaleRangeVis = MapTileTreeScaleRangeVisibility.Unknown;\r\n }\r\n\r\n /** Get the scale range visibility of the imagery tile tree.\r\n * @returns the scale range visibility of the imagery tile tree.\r\n */\r\n public getScaleRangeVisibility() {return this._scaleRangeVis;}\r\n\r\n /** Makes a deep copy of the current object.\r\n */\r\n public clone() {\r\n const clone = new ImageryTileTreeState();\r\n clone._scaleRangeVis = this._scaleRangeVis;\r\n return clone;\r\n }\r\n\r\n /** Reset the scale range visibility of imagery tile tree (i.e. unknown)\r\n */\r\n public reset() {\r\n this._scaleRangeVis = MapTileTreeScaleRangeVisibility.Unknown;\r\n }\r\n\r\n /** Sets the scale range visibility of the current imagery tile tree.\r\n * The state will be derived based on the previous visibility values:\r\n * Initial state: 'Unknown'\r\n * The first call will set the state to either: 'Visible' or 'Hidden'.\r\n * If subsequent visibility values are not consistent with the first visibility state, the state become 'Partial',\r\n * meaning the imagery tree currently contains a mixed of tiles being in range and out of range.\r\n */\r\n public setScaleRangeVisibility(visible: boolean) {\r\n if (this._scaleRangeVis === MapTileTreeScaleRangeVisibility.Unknown) {\r\n this._scaleRangeVis = (visible ? MapTileTreeScaleRangeVisibility.Visible : MapTileTreeScaleRangeVisibility.Hidden);\r\n } else if ((visible && this._scaleRangeVis === MapTileTreeScaleRangeVisibility.Hidden) || (!visible && this._scaleRangeVis === MapTileTreeScaleRangeVisibility.Visible)) {\r\n this._scaleRangeVis = MapTileTreeScaleRangeVisibility.Partial;\r\n }\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 addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void {\r\n this._imageryLoader.addLogoCards(cards, vp);\r\n }\r\n\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 {\r\n assert(false);\r\n return false;\r\n }\r\n public override get viewFlagOverrides(): ViewFlagOverrides {\r\n assert(false);\r\n return {};\r\n }\r\n public override get isContentUnbounded(): boolean {\r\n assert(false);\r\n return true;\r\n }\r\n protected override _selectTiles(_args: TileDrawArgs): Tile[] {\r\n assert(false);\r\n return [];\r\n }\r\n public override draw(_args: TileDrawArgs): void { assert(false); }\r\n\r\n private static _scratchDrapeRectangle = MapCartoRectangle.createZero();\r\n private static _drapeIntersectionScale = 1.0 - 1.0E-5;\r\n\r\n public selectCartoDrapeTiles(drapeTiles: ImageryMapTile[], highResolutionReplacementTiles: 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, highResolutionReplacementTiles, 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 addLogoCards(cards: HTMLTableElement, vp: ScreenViewport): void {\r\n this._imageryProvider.addLogoCards(cards, vp);\r\n }\r\n\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> {\r\n assert(false);\r\n return undefined;\r\n }\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.formatId, rhs.settings.formatId);\r\n if (0 === cmp) {\r\n 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 = compareStrings(lhs.settings.subLayers[i].name, rhs.settings.subLayers[i].name);\r\n if (0 === cmp) {\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 }\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.getNext();\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\r\n public override resetTreeOwner() {\r\n return this.iModel.tiles.resetTileTreeOwner({ settings: this._layerSettings }, imageryTreeSupplier);\r\n }\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 +1 @@
1
- {"version":3,"file":"MapTile.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapTile.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAe,QAAQ,EAAgD,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxH,OAAO,EAAiE,UAAU,EAAgC,cAAc,EAAqC,OAAO,EAAc,OAAO,EAAW,OAAO,EAAE,KAAK,EAAE,SAAS,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAExR,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE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AC,MAAM,CAAC,oBAAoB,CAAqB;IACxD,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAqB;IAEzD,gBAAgB;IACT,gBAAgB,IAAI,cAAc,EAAE,GAAG,SAAS;IA8CvD,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAwB;IAE7D,OAAO,CAAC,mBAAmB;IAmB3B,gBAAgB;IACA,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAsB7D,gBAAgB;IACA,UAAU,IAAI,IAAI;IAIlC,gBAAgB;IACA,eAAe;CAMhC;AAED,gBAAgB;AAChB,qBAAa,gBAAiB,SAAQ,OAAO;IAC3C,IAAoB,WAAW,YAAmB;IAClD,IAAoB,OAAO,YAAoB;IAC/C,IAAoB,YAAY,IAAI,WAAW,CAK9C;IAED,OAAO,CAAC,kBAAkB;IAiB1B,IAAoB,cAAc,sCAQjC;IAED,IAAoB,SAAS,IAAI,OAAO,CAAwC;IAChF,IAAoB,QAAQ,IAAI,OAAO,CAAuC;IAC9E,IAAoB,UAAU,IAAI,OAAO,CAAyC;IAClF,IAAoB,OAAO,IAAI,OAAO,CAAqI;IAE3J,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;CAInD"}
@@ -554,7 +554,8 @@ class MapTile extends internal_1.RealityTile {
554
554
  }
555
555
  /** @internal */
556
556
  minimumVisibleFactor() {
557
- return 0.25;
557
+ // if minimumVisibleFactor is more than 0, it stops parents from loading when children are not ready, to fill in gaps
558
+ return 0.0;
558
559
  }
559
560
  /** @internal */
560
561
  getDrapeTextures() {
@@ -1 +1 @@
1
- {"version":3,"file":"MapTile.js","sourceRoot":"","sources":["../../../../src/tile/map/MapTile.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,oDAAwH;AACxH,wDAAwR;AACxR,+CAA4C;AAE5C,sEAAmE;AACnE,sFAAmF;AAGnF,4DAAgG;AAEhG,0CAGqB;AAErB,gBAAgB;AA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AC,SAAS,CAAC,CAAC,CAAC;IAChF,IAAoB,QAAQ,KAAc,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,IAAoB,UAAU,KAAc,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF,IAAoB,OAAO,KAAc,OAAO,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,KAAK,yBAAc,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAE3J,QAAQ,CAAC,IAAkB;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;CACF;AA9CD,4CA8CC","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, dispose } from \"@itwin/core-bentley\";\r\nimport { ColorByName, ColorDef, FrustumPlanes, GlobeMode, PackedFeatureTable, RenderTexture } from \"@itwin/core-common\";\r\nimport { AxisOrder, BilinearPatch, ClipPlane, ClipPrimitive, ClipShape, ClipVector, Constant, ConvexClipPlaneSet, EllipsoidPatch, LongitudeLatitudeNumber, Matrix3d, Point3d, PolygonOps, Range1d, Range2d, Range3d, Ray3d, Transform, Vector2d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { GraphicBuilder } from \"../../render/GraphicBuilder\";\r\nimport { RealityMeshParams } from \"../../render/RealityMeshParams\";\r\nimport { upsampleRealityMeshParams } from \"../../render/UpsampleRealityMeshParams\";\r\nimport { RenderGraphic } from \"../../render/RenderGraphic\";\r\nimport { RenderMemory } from \"../../render/RenderMemory\";\r\nimport { RenderSystem, RenderTerrainGeometry, TerrainTexture } from \"../../render/RenderSystem\";\r\nimport { ViewingSpace } from \"../../ViewingSpace\";\r\nimport {\r\n ImageryMapTile, MapCartoRectangle, MapTileLoader, MapTileTree, QuadId, RealityTile, RealityTileParams, Tile, TileContent, TileDrawArgs, TileGraphicType,\r\n TileLoadStatus, TileTreeLoadStatus, TraversalSelectionContext,\r\n} from \"../internal\";\r\n\r\n/** @internal */\r\nexport class PlanarTilePatch {\r\n constructor(public corners: Point3d[], public normal: Vector3d, private _chordHeight: number) {\r\n }\r\n\r\n public getRangeCorners(heightRange: Range1d, result: Point3d[]): Point3d[] {\r\n let index = 0;\r\n for (const corner of this.corners)\r\n corner.plusScaled(this.normal, heightRange.low - this._chordHeight, result[index++]);\r\n\r\n for (const corner of this.corners)\r\n corner.plusScaled(this.normal, heightRange.high + this._chordHeight, result[index++]);\r\n\r\n return result;\r\n }\r\n public getClipShape(): Point3d[] {\r\n return [this.corners[0], this.corners[1], this.corners[3], this.corners[2]];\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type TilePatch = PlanarTilePatch | EllipsoidPatch;\r\n\r\n/** Projects points within the rectangular region of a [[MapTile]] into 3d space.\r\n * @see [[MapTile.getProjection]] to obtain the projection for a [[MapTile]].\r\n * @public\r\n */\r\nexport abstract class MapTileProjection {\r\n /** The extents of the volume of space associated with the projected [[MapTile]]. */\r\n public abstract get localRange(): Range3d;\r\n /** @alpha */\r\n public abstract get transformFromLocal(): Transform;\r\n\r\n /** Given parametric coordinates in [0, 1] within the tile's rectangular region, and an elevation above the Earth,\r\n * compute the 3d position in space.\r\n */\r\n public abstract getPoint(u: number, v: number, height: number, result?: Point3d): Point3d;\r\n\r\n /** @alpha */\r\n public get ellipsoidPatch(): EllipsoidPatch | undefined { return undefined; }\r\n\r\n /** @alpha */\r\n public getGlobalPoint(u: number, v: number, z: number, result?: Point3d): Point3d {\r\n const point = this.getPoint(u, v, z, result);\r\n return this.transformFromLocal.multiplyPoint3d(point, point);\r\n }\r\n}\r\n\r\n/** @alpha */\r\nclass EllipsoidProjection extends MapTileProjection {\r\n public transformFromLocal = Transform.createIdentity();\r\n public localRange: Range3d;\r\n constructor(private _patch: EllipsoidPatch, heightRange?: Range1d) {\r\n super();\r\n this.localRange = _patch.range();\r\n this.localRange.expandInPlace(heightRange ? (heightRange.high - heightRange.low) : 0);\r\n }\r\n private static _scratchAngles = LongitudeLatitudeNumber.createZero();\r\n private static _scratchRay = Ray3d.createZero();\r\n public getPoint(u: number, v: number, height: number, result?: Point3d): Point3d {\r\n const angles = this._patch.uvFractionToAngles(u, v, height, EllipsoidProjection._scratchAngles);\r\n const ray = this._patch.anglesToUnitNormalRay(angles, EllipsoidProjection._scratchRay);\r\n return Point3d.createFrom(ray!.origin, result);\r\n }\r\n public override get ellipsoidPatch() { return this._patch; }\r\n}\r\n\r\n/** @alpha */\r\nclass PlanarProjection extends MapTileProjection {\r\n private _bilinearPatch: BilinearPatch;\r\n public transformFromLocal: Transform;\r\n public localRange: Range3d;\r\n constructor(patch: PlanarTilePatch, heightRange?: Range1d) {\r\n super();\r\n this.transformFromLocal = Transform.createOriginAndMatrix(patch.corners[0], Matrix3d.createRigidHeadsUp(patch.normal, AxisOrder.ZYX));\r\n const planeCorners = this.transformFromLocal.multiplyInversePoint3dArray([patch.corners[0], patch.corners[1], patch.corners[2], patch.corners[3]])!;\r\n this.localRange = Range3d.createArray(planeCorners);\r\n this.localRange.low.z += heightRange ? heightRange.low : 0;\r\n this.localRange.high.z += heightRange ? heightRange.high : 0;\r\n this._bilinearPatch = new BilinearPatch(planeCorners[0], planeCorners[1], planeCorners[2], planeCorners[3]);\r\n }\r\n public getPoint(u: number, v: number, z: number, result?: Point3d): Point3d {\r\n result = this._bilinearPatch.uvFractionToPoint(u, v, result);\r\n result.z += z;\r\n return result;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface TerrainTileContent extends TileContent {\r\n terrain?: {\r\n renderGeometry?: RenderTerrainGeometry;\r\n /** Used on leaves to support up-sampling. */\r\n mesh?: RealityMeshParams;\r\n };\r\n}\r\n\r\nconst scratchNormal = Vector3d.create();\r\nconst scratchViewZ = Vector3d.create();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchClipPlanes = [ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint), ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint), ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint), ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint)];\r\nconst scratchCorners = [Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero()];\r\n\r\n/** A [[Tile]] belonging to a [[MapTileTree]] representing a rectangular region of a map of the Earth.\r\n * @public\r\n */\r\nexport class MapTile extends RealityTile {\r\n private static _maxParentHeightDepth = 4;\r\n private _imageryTiles?: ImageryMapTile[];\r\n private _hiddenTiles?: ImageryMapTile[];\r\n private _highResolutionReplacementTiles?: ImageryMapTile[];\r\n /** @internal */\r\n public everLoaded = false; // If the tile is only required for availability metadata, load it once and then allow it to be unloaded.\r\n /** @internal */\r\n protected _heightRange: Range1d | undefined;\r\n /** @internal */\r\n protected _renderGeometry?: RenderTerrainGeometry;\r\n /** @internal */\r\n protected _mesh?: RealityMeshParams; // Primitive retained on leaves only for upsampling.\r\n /** @internal */\r\n public override get isReady(): boolean {\r\n return super.isReady && this.baseImageryIsReady;\r\n }\r\n\r\n /** @internal */\r\n public override get hasGraphics(): boolean {\r\n return this._renderGeometry !== undefined;\r\n }\r\n\r\n /** @internal */\r\n public get renderGeometry() { return this._renderGeometry; }\r\n /** @internal */\r\n public get mesh() { return this._mesh; }\r\n /** @internal */\r\n public get loadableTerrainTile() { return this.loadableTile as MapTile; }\r\n /** @internal */\r\n public get isPlanar(): boolean { return this._patch instanceof PlanarTilePatch; }\r\n /** @internal */\r\n public get imageryTiles(): ImageryMapTile[] | undefined { return this._imageryTiles; }\r\n /** List of selected tiles but are currently in hidden state (i.e. scale range visibility)\r\n * @internal\r\n */\r\n public get hiddenImageryTiles(): ImageryMapTile[] | undefined { return this._hiddenTiles; }\r\n\r\n /** List of leafs tiles that have been selected as a replacement for missing high resolution tiles.\r\n * When this list is non-empty this means we are past the maximum LOD available of the tile tree.\r\n * By using those tiles, you are likely to get a display where tiles looks pixelated..\r\n * in some cases this is preferred to have no tile at all.\r\n * @internal\r\n */\r\n public get highResolutionReplacementTiles(): ImageryMapTile[] | undefined { return this._highResolutionReplacementTiles; }\r\n\r\n /** The [[MapTileTree]] to which this tile belongs. */\r\n public readonly mapTree: MapTileTree;\r\n /** Uniquely identifies this tile within its [[mapTree]]. */\r\n public readonly quadId: QuadId;\r\n private _patch: TilePatch;\r\n /** The area of the surface of the Earth that this tile represents. */\r\n public readonly rectangle: MapCartoRectangle;\r\n /** @internal */\r\n protected _cornerRays?: Ray3d[];\r\n\r\n /** @internal */\r\n constructor(params: RealityTileParams, mapTree: MapTileTree, quadId: QuadId, patch: TilePatch, rectangle: MapCartoRectangle, heightRange: Range1d | undefined, cornerRays: Ray3d[] | undefined) {\r\n super(params, mapTree);\r\n this.mapTree = mapTree;\r\n this.quadId = quadId;\r\n this._patch = patch;\r\n this.rectangle = rectangle;\r\n this._cornerRays = cornerRays;\r\n this._heightRange = heightRange?.clone();\r\n }\r\n\r\n /** @internal */\r\n public getRangeCorners(result: Point3d[]): Point3d[] {\r\n return this._patch instanceof PlanarTilePatch ? this._patch.getRangeCorners(this.heightRange!, result) : this.range.corners(result);\r\n }\r\n\r\n /** @internal */\r\n public override getSizeProjectionCorners(): Point3d[] | undefined {\r\n // Use only the first 4 corners -- On terrain tiles the height is initially exagerated to world height range which can cause excessive tile loading.\r\n const rangeCorners = this.getRangeCorners(scratchCorners);\r\n return rangeCorners.slice(0, 4);\r\n }\r\n\r\n /** @internal */\r\n public override markUsed(args: TileDrawArgs) {\r\n super.markUsed(args);\r\n if (this._imageryTiles)\r\n for (const imageryTile of this._imageryTiles)\r\n imageryTile.markUsed(args);\r\n }\r\n\r\n /** @internal */\r\n public override get graphicType() {\r\n if (this.mapTree.isOverlay)\r\n return TileGraphicType.Overlay;\r\n\r\n return (this.mapTree.useDepthBuffer || this._forceDepthBuffer) ? TileGraphicType.Scene : TileGraphicType.BackgroundMap;\r\n }\r\n\r\n /** @internal */\r\n public get mapLoader() { return this.realityRoot.loader as MapTileLoader; }\r\n /** @internal */\r\n public get isUpsampled() { return false; }\r\n\r\n /** @internal */\r\n public tileFromQuadId(quadId: QuadId): MapTile | undefined {\r\n if (0 === quadId.compare(this.quadId))\r\n return this;\r\n\r\n assert(quadId.level > this.quadId.level);\r\n if (quadId.level <= this.quadId.level)\r\n return undefined;\r\n\r\n if (this.children) {\r\n const shift = quadId.level - this.quadId.level - 1;\r\n const childRow = quadId.row >> shift;\r\n const childColumn = quadId.column >> shift;\r\n for (const child of this.children) {\r\n const mapChild = child as MapTile;\r\n const childQuadId = mapChild.quadId;\r\n if (childQuadId.row === childRow && childQuadId.column === childColumn)\r\n return mapChild.tileFromQuadId(quadId);\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n private get _forceDepthBuffer() {\r\n // For large ellipsoidal globe tile force the depth buffer on to avoid anomalies at horizon.\r\n return this.mapTree.globeMode === GlobeMode.Ellipsoid && this.depth < 8;\r\n }\r\n\r\n /** @internal */\r\n public override addBoundingGraphic(builder: GraphicBuilder, color: ColorDef) {\r\n if (!this.isDisplayable)\r\n return;\r\n\r\n const heightRange = (this.heightRange === undefined) ? Range1d.createXX(-1, 1) : this.heightRange;\r\n const lows = [], highs = [], reorder = [0, 1, 3, 2, 0];\r\n const cornerRays = this._cornerRays!;\r\n if (this._patch instanceof PlanarTilePatch) {\r\n const normal = this._patch.normal;\r\n for (let i = 0; i < 5; i++) {\r\n const corner = this._patch.corners[reorder[i]];\r\n lows.push(corner.plusScaled(normal, heightRange.low));\r\n highs.push(corner.plusScaled(normal, heightRange.high));\r\n }\r\n } else {\r\n for (let i = 0; i < 5; i++) {\r\n const cornerRay = cornerRays[reorder[i]];\r\n lows.push(cornerRay.origin.plusScaled(cornerRay.direction, heightRange.low));\r\n highs.push(cornerRay.origin.plusScaled(cornerRay.direction, heightRange.high));\r\n }\r\n }\r\n\r\n builder.setSymbology(color, color, 1);\r\n builder.addLineString(lows);\r\n builder.addLineString(highs);\r\n for (let i = 0; i < 4; i++)\r\n builder.addLineString([lows[i], highs[i]]);\r\n\r\n const inColor = ColorDef.create(ColorByName.cornflowerBlue);\r\n const outColor = ColorDef.create(ColorByName.chartreuse);\r\n const transitionColor = ColorDef.create(ColorByName.aquamarine);\r\n\r\n const inPoints = [], outPoints = [], transitionPoints = [];\r\n\r\n for (const point of highs)\r\n if (this.mapTree.cartesianRange.containsPoint(point))\r\n inPoints.push(point);\r\n else if (this.mapTree.cartesianRange.distanceToPoint(point) < this.mapTree.cartesianTransitionDistance)\r\n transitionPoints.push(point);\r\n else\r\n outPoints.push(point);\r\n\r\n builder.setSymbology(inColor, inColor, 15);\r\n builder.addPointString(inPoints);\r\n builder.setSymbology(outColor, outColor, 15);\r\n builder.addPointString(outPoints);\r\n builder.setSymbology(transitionColor, transitionColor, 31);\r\n builder.addPointString(transitionPoints);\r\n }\r\n\r\n /** @internal */\r\n public override getContentClip(): ClipVector | undefined {\r\n const points = this.getClipShape();\r\n if (points.length < 3)\r\n return undefined;\r\n if (this.mapTree.globeMode === GlobeMode.Ellipsoid) {\r\n const normal = PolygonOps.areaNormal(points);\r\n const globeOrigin = this.mapTree.globeOrigin;\r\n const globeNormal = Vector3d.createStartEnd(globeOrigin, points[0]);\r\n const negate = normal.dotProduct(globeNormal) < 0;\r\n const clipPlanes = [];\r\n for (let i = 0; i < 4; i++) {\r\n const point = points[i];\r\n const clipNormal = globeOrigin.crossProductToPoints(point, points[(i + 1) % 4], scratchNormal);\r\n if (negate)\r\n clipNormal.negate(clipNormal);\r\n\r\n const clipPlane = ClipPlane.createNormalAndPoint(clipNormal, point, false, false, scratchClipPlanes[i]);\r\n if (clipPlane !== undefined) // Undefined at pole tiles...\r\n clipPlanes.push(clipPlane);\r\n }\r\n\r\n const planeSet = ConvexClipPlaneSet.createPlanes(clipPlanes);\r\n const clipPrimitive = ClipPrimitive.createCapture(planeSet);\r\n\r\n return ClipVector.createCapture([clipPrimitive]);\r\n } else {\r\n return ClipVector.createCapture([ClipShape.createShape(points)!]);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override setNotFound(): void {\r\n super.setNotFound();\r\n\r\n // For map tiles assume that an unfound tile implies descendants and siblings will also be unfound.\r\n if (undefined !== this.parent)\r\n this.parent.setLeaf();\r\n }\r\n\r\n /** @internal */\r\n public getGraphic(_system: RenderSystem, _texture: RenderTexture): RenderGraphic | undefined {\r\n return undefined;\r\n }\r\n\r\n /** For globe tiles displaying less then depth 2 appears distorted\r\n * @internal\r\n */\r\n public override get isDisplayable() {\r\n return this.mapTree.globeMode === GlobeMode.Ellipsoid ? (this.depth >= MapTileTree.minDisplayableDepth) : super.isDisplayable;\r\n }\r\n\r\n /** @internal */\r\n public override isOccluded(viewingSpace: ViewingSpace): boolean {\r\n if (undefined === this._cornerRays || this.mapTree.globeMode !== GlobeMode.Ellipsoid)\r\n return false;\r\n\r\n if (viewingSpace.eyePoint !== undefined) {\r\n if (!this.mapTree.pointAboveEllipsoid(viewingSpace.eyePoint))\r\n return false;\r\n\r\n for (const cornerNormal of this._cornerRays) {\r\n const eyeNormal = Vector3d.createStartEnd(viewingSpace.eyePoint, cornerNormal.origin, scratchNormal);\r\n eyeNormal.normalizeInPlace();\r\n if (eyeNormal.dotProduct(cornerNormal.direction) < .01)\r\n return false;\r\n }\r\n } else {\r\n const viewZ = viewingSpace.rotation.getRow(2, scratchViewZ);\r\n for (const cornerNormal of this._cornerRays)\r\n if (cornerNormal.direction.dotProduct(viewZ) > 0)\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n protected override _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n const mapTree = this.mapTree;\r\n const childLevel = this.quadId.level + 1;\r\n const rowCount = mapTree.sourceTilingScheme.getNumberOfYChildrenAtLevel(childLevel);\r\n const columnCount = mapTree.sourceTilingScheme.getNumberOfXChildrenAtLevel(childLevel);\r\n\r\n const resolveChildren = (children: Tile[]) => {\r\n const childrenRange = Range3d.createNull();\r\n for (const child of children)\r\n childrenRange.extendRange(child.range);\r\n\r\n if (!this.range.containsRange(childrenRange))\r\n this.range.extendRange(childrenRange);\r\n\r\n resolve(children);\r\n };\r\n\r\n if (mapTree.doCreateGlobeChildren(this)) {\r\n this.createGlobeChildren(columnCount, rowCount, resolveChildren);\r\n return;\r\n }\r\n\r\n const resolvePlanarChildren = (childCorners: Point3d[][]) => {\r\n const level = this.quadId.level + 1;\r\n const column = this.quadId.column * 2;\r\n const row = this.quadId.row * 2;\r\n const children = [];\r\n const childrenAreLeaves = (this.depth + 1) === mapTree.loader.maxDepth;\r\n const globeMode = this.mapTree.globeMode;\r\n for (let j = 0; j < rowCount; j++) {\r\n for (let i = 0; i < columnCount; i++) {\r\n const quadId = new QuadId(level, column + i, row + j);\r\n const corners = childCorners[j * columnCount + i];\r\n const rectangle = mapTree.getTileRectangle(quadId);\r\n const normal = PolygonOps.areaNormal([corners[0], corners[1], corners[3], corners[2]]);\r\n normal.normalizeInPlace();\r\n\r\n const heightRange = this.mapTree.getChildHeightRange(quadId, rectangle, this);\r\n const diagonal = Math.max(corners[0].distance(corners[3]), corners[1].distance(corners[2])) / 2.0;\r\n const chordHeight = globeMode === GlobeMode.Ellipsoid ? Math.sqrt(diagonal * diagonal + Constant.earthRadiusWGS84.equator * Constant.earthRadiusWGS84.equator) - Constant.earthRadiusWGS84.equator : 0.0;\r\n const rangeCorners = MapTile.computeRangeCorners(corners, normal, chordHeight, undefined, heightRange);\r\n const range = Range3d.createArray(rangeCorners);\r\n const child = this.mapTree.createPlanarChild({ contentId: quadId.contentId, maximumSize: 512, range, parent: this, isLeaf: childrenAreLeaves }, quadId, corners, normal, rectangle, chordHeight, heightRange);\r\n if (child)\r\n children.push(child);\r\n }\r\n }\r\n\r\n resolveChildren(children);\r\n };\r\n\r\n mapTree.getPlanarChildCorners(this, columnCount, rowCount, resolvePlanarChildren);\r\n }\r\n\r\n private createGlobeChildren(columnCount: number, rowCount: number, resolve: (children: MapTile[]) => void) {\r\n const level = this.quadId.level + 1;\r\n const column = this.quadId.column * 2;\r\n const row = this.quadId.row * 2;\r\n const mapTree = this.mapTree;\r\n const children = [];\r\n\r\n for (let j = 0; j < rowCount; j++) {\r\n for (let i = 0; i < columnCount; i++) {\r\n const quadId = new QuadId(level, column + i, row + j);\r\n const angleSweep = quadId.getAngleSweep(mapTree.sourceTilingScheme);\r\n const ellipsoidPatch = EllipsoidPatch.createCapture(this.mapTree.earthEllipsoid, angleSweep.longitude, angleSweep.latitude);\r\n const range = ellipsoidPatch.range();\r\n const rectangle = mapTree.getTileRectangle(quadId);\r\n const heightRange = this.mapTree.getChildHeightRange(quadId, rectangle, this);\r\n if (undefined !== heightRange)\r\n range.expandInPlace(heightRange.high - heightRange.low);\r\n\r\n children.push(this.mapTree.createGlobeChild({ contentId: quadId.contentId, maximumSize: 512, range, parent: this, isLeaf: false }, quadId, range.corners(), rectangle, ellipsoidPatch, heightRange));\r\n }\r\n }\r\n\r\n resolve(children);\r\n return children;\r\n }\r\n\r\n /** @internal */\r\n public static computeRangeCorners(corners: Point3d[], normal: Vector3d, chordHeight: number, result?: Point3d[], heightRange?: Range1d) {\r\n if (result === undefined) {\r\n result = [];\r\n for (let i = 0; i < 8; i++)\r\n result.push(Point3d.create());\r\n }\r\n\r\n let index = 0;\r\n assert(corners.length === 4);\r\n const deltaLow = normal.scale(- chordHeight + (heightRange ? heightRange.low : 0));\r\n const deltaHigh = normal.scale(chordHeight + (heightRange ? heightRange.high : 0));\r\n\r\n for (const corner of corners)\r\n corner.plus(deltaLow, result[index++]);\r\n\r\n for (const corner of corners)\r\n corner.plus(deltaHigh, result[index++]);\r\n\r\n return result;\r\n }\r\n\r\n /** @internal */\r\n public override isRegionCulled(args: TileDrawArgs): boolean {\r\n return this.isContentCulled(args);\r\n }\r\n\r\n /** @internal */\r\n public override isContentCulled(args: TileDrawArgs): boolean {\r\n return FrustumPlanes.Containment.Outside === args.frustumPlanes.computeContainment(this.getRangeCorners(scratchCorners));\r\n }\r\n\r\n /** @internal */\r\n public clearLayers() {\r\n this.clearImageryTiles();\r\n this._graphic = undefined;\r\n if (this.children)\r\n for (const child of this.children)\r\n (child as MapTile).clearLayers();\r\n }\r\n\r\n private clearImageryTiles() {\r\n if (this._imageryTiles) {\r\n this._imageryTiles.forEach((tile) => tile.releaseMapTileUsage());\r\n this._imageryTiles = undefined;\r\n }\r\n if (this._hiddenTiles) {\r\n this._hiddenTiles = undefined;\r\n }\r\n if (this._highResolutionReplacementTiles) {\r\n this._highResolutionReplacementTiles = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override produceGraphics(): RenderGraphic | undefined {\r\n if (undefined !== this._graphic && this.imageryIsReady)\r\n return this._graphic;\r\n\r\n const geometry = this.renderGeometry;\r\n if (undefined === geometry)\r\n return undefined;\r\n\r\n const textures = this.getDrapeTextures();\r\n const { baseColor, baseTransparent, layerClassifiers } = this.mapTree;\r\n const graphic = IModelApp.renderSystem.createRealityMeshGraphic({ realityMesh: geometry, projection: this.getProjection(), tileRectangle: this.rectangle, featureTable: PackedFeatureTable.pack(this.mapLoader.featureTable), tileId: this.contentId, baseColor, baseTransparent, textures, layerClassifiers }, true);\r\n\r\n // If there are no layer classifiers then we can save this graphic for re-use. If layer classifiers exist they are regenerated based on view and we must collate them with the imagery.\r\n if (this.imageryIsReady && 0 === this.mapTree.layerClassifiers.size)\r\n this._graphic = graphic;\r\n\r\n return graphic;\r\n }\r\n\r\n /** @internal */\r\n public getClipShape(): Point3d[] {\r\n return (this._patch instanceof PlanarTilePatch) ? this._patch.getClipShape() : [this._cornerRays![0].origin, this._cornerRays![1].origin, this._cornerRays![3].origin, this._cornerRays![2].origin];\r\n }\r\n\r\n /** @internal */\r\n protected override _collectStatistics(stats: RenderMemory.Statistics): void {\r\n super._collectStatistics(stats);\r\n\r\n this._renderGeometry?.collectStatistics(stats);\r\n if (this._mesh) {\r\n stats.addTerrain(this._mesh.indices.byteLength\r\n + this._mesh.positions.points.byteLength\r\n + this._mesh.uvs.points.byteLength\r\n + (this._mesh.normals ? this._mesh.normals.byteLength : 0)\r\n );\r\n }\r\n }\r\n\r\n /** Height range is along with the tile corners to detect if tile intersects view frustum.\r\n * Range will be single value fo ron-terrain tiles -- if terrain tile is not loaded it will\r\n * inherit height from ancestors.\r\n * @internal\r\n */\r\n public get heightRange(): Range1d | undefined {\r\n if (undefined !== this._heightRange)\r\n return this._heightRange;\r\n\r\n for (let parent = this.parent; undefined !== parent; parent = parent.parent) {\r\n const mapParent = parent as MapTile;\r\n if (undefined !== mapParent._heightRange)\r\n return mapParent._heightRange;\r\n }\r\n\r\n assert(false);\r\n return Range1d.createNull();\r\n }\r\n\r\n /** @internal */\r\n public get mapTilingScheme() {\r\n return this.mapTree.sourceTilingScheme;\r\n }\r\n\r\n /** Adjust the minimum and maximum elevations of the terrain within this tile. */\r\n public adjustHeights(minHeight: number, maxHeight: number) {\r\n if (undefined === this._heightRange)\r\n this._heightRange = Range1d.createXX(minHeight, maxHeight);\r\n else {\r\n this._heightRange.low = Math.max(this.heightRange!.low, minHeight);\r\n this._heightRange.high = Math.min(this.heightRange!.high, maxHeight);\r\n }\r\n\r\n if (this.rangeCorners && this._patch instanceof PlanarTilePatch)\r\n this._patch.getRangeCorners(this.heightRange!, this.rangeCorners);\r\n }\r\n\r\n /** Obtain a [[MapTileProjection]] to project positions within this tile's area into 3d space. */\r\n public getProjection(heightRange?: Range1d): MapTileProjection {\r\n return this._patch instanceof PlanarTilePatch ? new PlanarProjection(this._patch, heightRange) : new EllipsoidProjection(this._patch, heightRange);\r\n }\r\n\r\n /** @internal */\r\n public get baseImageryIsReady(): boolean {\r\n if (undefined !== this.mapTree.baseColor || 0 === this.mapTree.layerImageryTrees.length)\r\n return true;\r\n\r\n if (undefined === this._imageryTiles)\r\n return false;\r\n\r\n const baseTreeId = this.mapTree.layerImageryTrees[0].tree.modelId;\r\n return this._imageryTiles.every((imageryTile) => imageryTile.imageryTree.modelId !== baseTreeId || imageryTile.isReady);\r\n }\r\n\r\n /** @internal */\r\n public get imageryIsReady(): boolean {\r\n if (undefined === this._imageryTiles)\r\n return 0 === this.mapTree.layerImageryTrees.length;\r\n\r\n return this._imageryTiles.every((tile) => tile.isReady);\r\n }\r\n\r\n /** Select secondary (imagery) tiles\r\n * @internal\r\n */\r\n public override selectSecondaryTiles(args: TileDrawArgs, context: TraversalSelectionContext) {\r\n if (0 === this.mapTree.layerImageryTrees.length || this.imageryIsReady)\r\n return;\r\n\r\n this.clearImageryTiles();\r\n this._imageryTiles = new Array<ImageryMapTile>();\r\n this._hiddenTiles = new Array<ImageryMapTile>();\r\n this._highResolutionReplacementTiles = new Array<ImageryMapTile>();\r\n for (const layerImageryTree of this.mapTree.layerImageryTrees) {\r\n let tmpTiles = new Array<ImageryMapTile>();\r\n const tmpLeafTiles = new Array<ImageryMapTile>();\r\n if (TileTreeLoadStatus.Loaded !== layerImageryTree.tree.selectCartoDrapeTiles(tmpTiles, tmpLeafTiles, this, args,)) {\r\n this._imageryTiles = undefined;\r\n return;\r\n }\r\n\r\n // When the base layer is zoomed-in beyond it's max resolution,\r\n // we display leaf tiles and stretched them if needed.\r\n // We don't want the same behavior non-base layers, in the case,\r\n // the layer will simply disappear past its max resolution.\r\n // Note: Replacement leaf tiles are kept as a mean to determine which\r\n // imagery tree has reached it's maximum zoom level.\r\n if (layerImageryTree.baseImageryLayer) {\r\n tmpTiles = [...tmpTiles, ...tmpLeafTiles];\r\n } else {\r\n this._highResolutionReplacementTiles = [...this._highResolutionReplacementTiles, ...tmpLeafTiles];\r\n }\r\n\r\n // MapTileTree might include a non-visible imagery tree, we need to check for that.\r\n if (layerImageryTree.settings.visible && !layerImageryTree.settings.allSubLayersInvisible) {\r\n for (const imageryTile of tmpTiles) {\r\n imageryTile.markMapTileUsage();\r\n if (imageryTile.isReady)\r\n args.markReady(imageryTile);\r\n else\r\n context.missing.push(imageryTile);\r\n this._imageryTiles.push(imageryTile);\r\n }\r\n } else {\r\n // Even though those selected imagery tile are not visible,\r\n // we keep track of them for scale range reporting.\r\n for (const imageryTile of tmpTiles) {\r\n this._hiddenTiles.push(imageryTile);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _scratchRectangle1 = MapCartoRectangle.createZero();\r\n private static _scratchRectangle2 = MapCartoRectangle.createZero();\r\n\r\n /** The height range for terrain tiles is not known until the tiles are unloaded. We use \"ApproximateTerrainHeight\" for first 6 levels but below\r\n * that the tiles inherit height range from parents. This is problematic as tiles with large height range will be unnecessarily selected as\r\n * they apparently intersect view frustum. To avoid this force loading of terrain tiles if they exceed \"_maxParentHightDepth\".\r\n * @internal\r\n */\r\n protected override forceSelectRealityTile(): boolean {\r\n let parentHeightDepth = 0;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n for (let parent: MapTile = this; parent !== undefined && parent._heightRange === undefined; parent = parent.parent as MapTile)\r\n parentHeightDepth++;\r\n\r\n return parentHeightDepth > MapTile._maxParentHeightDepth;\r\n }\r\n\r\n /** @internal */\r\n protected override minimumVisibleFactor(): number {\r\n return 0.25;\r\n }\r\n\r\n private static _scratchThisDiagonal = Vector2d.create();\r\n private static _scratchDrapeDiagonal = Vector2d.create();\r\n\r\n /** @internal */\r\n public getDrapeTextures(): TerrainTexture[] | undefined {\r\n if (undefined === this._imageryTiles)\r\n return undefined;\r\n\r\n const drapeTextures: TerrainTexture[] = [];\r\n const thisRectangle = this.loadableTerrainTile.rectangle;\r\n const thisDiagonal = thisRectangle.diagonal(MapTile._scratchThisDiagonal);\r\n const bordersNorthPole = this.quadId.bordersNorthPole(this.mapTree.sourceTilingScheme);\r\n const bordersSouthPole = this.quadId.bordersSouthPole(this.mapTree.sourceTilingScheme);\r\n for (const imageryTile of this._imageryTiles) {\r\n if (imageryTile.texture) {\r\n drapeTextures.push(this.computeDrapeTexture(thisRectangle, thisDiagonal, imageryTile, imageryTile.rectangle));\r\n\r\n if ((bordersNorthPole && imageryTile.quadId.bordersNorthPole(imageryTile.tilingScheme) && imageryTile.rectangle.high.y < thisRectangle.high.y) ||\r\n (bordersSouthPole && imageryTile.quadId.bordersSouthPole(imageryTile.tilingScheme) && imageryTile.rectangle.low.y > thisRectangle.low.y)) {\r\n // Add separate texture stretching last sliver of tile imagery to cover pole.\r\n const sliverRectangle = imageryTile.rectangle.clone(MapTile._scratchRectangle1);\r\n const clipRectangle = thisRectangle.clone(MapTile._scratchRectangle2);\r\n const sliverHeight = sliverRectangle.high.y - sliverRectangle.low.y;\r\n\r\n if (bordersSouthPole) {\r\n clipRectangle.high.y = sliverRectangle.low.y;\r\n sliverRectangle.low.y = thisRectangle.low.y;\r\n sliverRectangle.high.y += 1 / sliverHeight;\r\n } else {\r\n clipRectangle.low.y = sliverRectangle.high.y;\r\n sliverRectangle.high.y = thisRectangle.high.y;\r\n sliverRectangle.low.y -= 1 / sliverHeight;\r\n }\r\n\r\n drapeTextures.push(this.computeDrapeTexture(thisRectangle, thisDiagonal, imageryTile, sliverRectangle, clipRectangle));\r\n }\r\n } else {\r\n for (let parent = imageryTile.parent; undefined !== parent; parent = parent.parent) {\r\n const mapTile = parent as ImageryMapTile;\r\n if (mapTile.texture) {\r\n drapeTextures.push(this.computeDrapeTexture(thisRectangle, thisDiagonal, mapTile, mapTile.rectangle, imageryTile.rectangle));\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return drapeTextures.length > 0 ? drapeTextures : undefined;\r\n }\r\n\r\n private static _scratchIntersectRange = Range2d.createNull();\r\n\r\n private computeDrapeTexture(thisRectangle: Range2d, thisDiagonal: Vector2d, imageryTile: ImageryMapTile, drapeRectangle: Range2d, clipRectangle?: Range2d): TerrainTexture {\r\n assert(imageryTile.texture !== undefined);\r\n\r\n // Compute transformation from the terrain tile texture coordinates (0-1) to the drape tile texture coordinates.\r\n const drapeDiagonal = drapeRectangle.diagonal(MapTile._scratchDrapeDiagonal);\r\n const translate = Vector2d.create((thisRectangle.low.x - drapeRectangle.low.x) / drapeDiagonal.x, (thisRectangle.low.y - drapeRectangle.low.y) / drapeDiagonal.y);\r\n const scale = Vector2d.create(thisDiagonal.x / drapeDiagonal.x, thisDiagonal.y / drapeDiagonal.y);\r\n const featureIndex = this.mapLoader.getFeatureIndex(imageryTile.imageryTree.modelId);\r\n let clipRect;\r\n if (undefined !== clipRectangle) {\r\n const intersect = clipRectangle.intersect(drapeRectangle, MapTile._scratchIntersectRange);\r\n assert(!intersect.isNull);\r\n clipRect = Range2d.createXYXY((intersect.low.x - drapeRectangle.low.x) / drapeDiagonal.x, (intersect.low.y - drapeRectangle.low.y) / drapeDiagonal.y, (intersect.high.x - drapeRectangle.low.x) / drapeDiagonal.x, (intersect.high.y - drapeRectangle.low.y) / drapeDiagonal.y);\r\n }\r\n\r\n const imageryModelId = imageryTile.tree.modelId;\r\n return new TerrainTexture(imageryTile.texture, featureIndex, scale, translate, drapeRectangle, this.mapTree.getLayerIndex(imageryModelId), this.mapTree.getLayerTransparency(imageryModelId), clipRect);\r\n }\r\n\r\n /** @internal */\r\n public override setContent(content: TerrainTileContent): void {\r\n this._mesh = content.terrain?.mesh;\r\n if (this.mapTree.produceGeometry) {\r\n const iModelTransform = this.mapTree.iModelTransform;\r\n const geometryTransform = content.terrain?.renderGeometry?.transform;\r\n const transform = geometryTransform ? iModelTransform.multiplyTransformTransform(geometryTransform) : iModelTransform;\r\n const polyface = content.terrain?.mesh ? RealityMeshParams.toPolyface(content.terrain.mesh, { transform }) : undefined;\r\n this._geometry = polyface ? { polyfaces: [polyface] } : undefined;\r\n\r\n } else {\r\n dispose(this._renderGeometry);\r\n this._renderGeometry = content.terrain?.renderGeometry;\r\n }\r\n\r\n this.everLoaded = true;\r\n\r\n if (undefined !== content.contentRange)\r\n this._contentRange = content.contentRange;\r\n\r\n this.setIsReady();\r\n }\r\n\r\n /** @internal */\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 /** @internal */\r\n public override disposeContents() {\r\n super.disposeContents();\r\n this._renderGeometry = dispose(this._renderGeometry);\r\n this.clearImageryTiles();\r\n // Note - don't dispose of mesh - these should only ever exist on terrain leaf tile and are required by children. Let garbage collector handle them.\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class UpsampledMapTile extends MapTile {\r\n public override get isUpsampled() { return true; }\r\n public override get isEmpty() { return false; }\r\n public override get loadableTile(): RealityTile {\r\n let parent = this.parent as MapTile;\r\n for (; parent && parent.isUpsampled; parent = parent.parent as MapTile)\r\n ;\r\n return parent;\r\n }\r\n\r\n private upsampleFromParent() {\r\n const parent = this.loadableTerrainTile;\r\n const parentMesh = parent.mesh;\r\n if (undefined === parentMesh) {\r\n return undefined;\r\n }\r\n const thisId = this.quadId, parentId = parent.quadId;\r\n const levelDelta = thisId.level - parentId.level;\r\n const thisColumn = thisId.column - (parentId.column << levelDelta);\r\n const thisRow = thisId.row - (parentId.row << levelDelta);\r\n const scale = 1.0 / (1 << levelDelta);\r\n const parentParameterRange = Range2d.createXYXY(scale * thisColumn, scale * thisRow, scale * (thisColumn + 1), scale * (thisRow + 1));\r\n const upsample = upsampleRealityMeshParams(parentMesh, parentParameterRange);\r\n this.adjustHeights(upsample.heightRange.low, upsample.heightRange.high);\r\n return upsample;\r\n }\r\n\r\n public override get renderGeometry() {\r\n if (undefined === this._renderGeometry) {\r\n const upsample = this.upsampleFromParent();\r\n const projection = this.loadableTerrainTile.getProjection(this.heightRange);\r\n if (upsample)\r\n this._renderGeometry = IModelApp.renderSystem.createTerrainMesh(upsample.mesh, projection.transformFromLocal, true);\r\n }\r\n return this._renderGeometry;\r\n }\r\n\r\n public override get isLoading(): boolean { return this.loadableTile.isLoading; }\r\n public override get isQueued(): boolean { return this.loadableTile.isQueued; }\r\n public override get isNotFound(): boolean { return this.loadableTile.isNotFound; }\r\n public override get isReady(): boolean { return (this._renderGeometry !== undefined || this.loadableTile.loadStatus === TileLoadStatus.Ready) && this.baseImageryIsReady; }\r\n\r\n public override markUsed(args: TileDrawArgs): void {\r\n args.markUsed(this);\r\n args.markUsed(this.loadableTile);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"MapTile.js","sourceRoot":"","sources":["../../../../src/tile/map/MapTile.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,oDAAwH;AACxH,wDAAwR;AACxR,+CAA4C;AAE5C,sEAAmE;AACnE,sFAAmF;AAGnF,4DAAgG;AAEhG,0CAGqB;AAErB,gBAAgB;AAChB,MAAa,eAAe;IAC1B,YAAmB,OAAkB,EAAS,MAAgB,EAAU,YAAoB;QAAzE,YAAO,GAAP,OAAO,CAAW;QAAS,WAAM,GAAN,MAAM,CAAU;QAAU,iBAAY,GAAZ,YAAY,CAAQ;IAC5F,CAAC;IAEM,eAAe,CAAC,WAAoB,EAAE,MAAiB;QAC5D,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAC/B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAEvF,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO;YAC/B,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAExF,OAAO,MAAM,CAAC;IAChB,CAA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C,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxE,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAoB,cAAc;QAChC,IAAI,SAAS,KAAK,IAAI,CAAC,eAAe,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC5E,IAAI,QAAQ;gBACV,IAAI,CAAC,eAAe,GAAG,qBAAS,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;SACvH;QACD,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAoB,SAAS,KAAc,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IAChF,IAAoB,QAAQ,KAAc,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,IAAoB,UAAU,KAAc,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;IAClF,IAAoB,OAAO,KAAc,OAAO,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,KAAK,yBAAc,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAE3J,QAAQ,CAAC,IAAkB;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACnC,CAAC;CACF;AA9CD,4CA8CC","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, dispose } from \"@itwin/core-bentley\";\r\nimport { ColorByName, ColorDef, FrustumPlanes, GlobeMode, PackedFeatureTable, RenderTexture } from \"@itwin/core-common\";\r\nimport { AxisOrder, BilinearPatch, ClipPlane, ClipPrimitive, ClipShape, ClipVector, Constant, ConvexClipPlaneSet, EllipsoidPatch, LongitudeLatitudeNumber, Matrix3d, Point3d, PolygonOps, Range1d, Range2d, Range3d, Ray3d, Transform, Vector2d, Vector3d } from \"@itwin/core-geometry\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { GraphicBuilder } from \"../../render/GraphicBuilder\";\r\nimport { RealityMeshParams } from \"../../render/RealityMeshParams\";\r\nimport { upsampleRealityMeshParams } from \"../../render/UpsampleRealityMeshParams\";\r\nimport { RenderGraphic } from \"../../render/RenderGraphic\";\r\nimport { RenderMemory } from \"../../render/RenderMemory\";\r\nimport { RenderSystem, RenderTerrainGeometry, TerrainTexture } from \"../../render/RenderSystem\";\r\nimport { ViewingSpace } from \"../../ViewingSpace\";\r\nimport {\r\n ImageryMapTile, MapCartoRectangle, MapTileLoader, MapTileTree, QuadId, RealityTile, RealityTileParams, Tile, TileContent, TileDrawArgs, TileGraphicType,\r\n TileLoadStatus, TileTreeLoadStatus, TraversalSelectionContext,\r\n} from \"../internal\";\r\n\r\n/** @internal */\r\nexport class PlanarTilePatch {\r\n constructor(public corners: Point3d[], public normal: Vector3d, private _chordHeight: number) {\r\n }\r\n\r\n public getRangeCorners(heightRange: Range1d, result: Point3d[]): Point3d[] {\r\n let index = 0;\r\n for (const corner of this.corners)\r\n corner.plusScaled(this.normal, heightRange.low - this._chordHeight, result[index++]);\r\n\r\n for (const corner of this.corners)\r\n corner.plusScaled(this.normal, heightRange.high + this._chordHeight, result[index++]);\r\n\r\n return result;\r\n }\r\n public getClipShape(): Point3d[] {\r\n return [this.corners[0], this.corners[1], this.corners[3], this.corners[2]];\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport type TilePatch = PlanarTilePatch | EllipsoidPatch;\r\n\r\n/** Projects points within the rectangular region of a [[MapTile]] into 3d space.\r\n * @see [[MapTile.getProjection]] to obtain the projection for a [[MapTile]].\r\n * @public\r\n */\r\nexport abstract class MapTileProjection {\r\n /** The extents of the volume of space associated with the projected [[MapTile]]. */\r\n public abstract get localRange(): Range3d;\r\n /** @alpha */\r\n public abstract get transformFromLocal(): Transform;\r\n\r\n /** Given parametric coordinates in [0, 1] within the tile's rectangular region, and an elevation above the Earth,\r\n * compute the 3d position in space.\r\n */\r\n public abstract getPoint(u: number, v: number, height: number, result?: Point3d): Point3d;\r\n\r\n /** @alpha */\r\n public get ellipsoidPatch(): EllipsoidPatch | undefined { return undefined; }\r\n\r\n /** @alpha */\r\n public getGlobalPoint(u: number, v: number, z: number, result?: Point3d): Point3d {\r\n const point = this.getPoint(u, v, z, result);\r\n return this.transformFromLocal.multiplyPoint3d(point, point);\r\n }\r\n}\r\n\r\n/** @alpha */\r\nclass EllipsoidProjection extends MapTileProjection {\r\n public transformFromLocal = Transform.createIdentity();\r\n public localRange: Range3d;\r\n constructor(private _patch: EllipsoidPatch, heightRange?: Range1d) {\r\n super();\r\n this.localRange = _patch.range();\r\n this.localRange.expandInPlace(heightRange ? (heightRange.high - heightRange.low) : 0);\r\n }\r\n private static _scratchAngles = LongitudeLatitudeNumber.createZero();\r\n private static _scratchRay = Ray3d.createZero();\r\n public getPoint(u: number, v: number, height: number, result?: Point3d): Point3d {\r\n const angles = this._patch.uvFractionToAngles(u, v, height, EllipsoidProjection._scratchAngles);\r\n const ray = this._patch.anglesToUnitNormalRay(angles, EllipsoidProjection._scratchRay);\r\n return Point3d.createFrom(ray!.origin, result);\r\n }\r\n public override get ellipsoidPatch() { return this._patch; }\r\n}\r\n\r\n/** @alpha */\r\nclass PlanarProjection extends MapTileProjection {\r\n private _bilinearPatch: BilinearPatch;\r\n public transformFromLocal: Transform;\r\n public localRange: Range3d;\r\n constructor(patch: PlanarTilePatch, heightRange?: Range1d) {\r\n super();\r\n this.transformFromLocal = Transform.createOriginAndMatrix(patch.corners[0], Matrix3d.createRigidHeadsUp(patch.normal, AxisOrder.ZYX));\r\n const planeCorners = this.transformFromLocal.multiplyInversePoint3dArray([patch.corners[0], patch.corners[1], patch.corners[2], patch.corners[3]])!;\r\n this.localRange = Range3d.createArray(planeCorners);\r\n this.localRange.low.z += heightRange ? heightRange.low : 0;\r\n this.localRange.high.z += heightRange ? heightRange.high : 0;\r\n this._bilinearPatch = new BilinearPatch(planeCorners[0], planeCorners[1], planeCorners[2], planeCorners[3]);\r\n }\r\n public getPoint(u: number, v: number, z: number, result?: Point3d): Point3d {\r\n result = this._bilinearPatch.uvFractionToPoint(u, v, result);\r\n result.z += z;\r\n return result;\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport interface TerrainTileContent extends TileContent {\r\n terrain?: {\r\n renderGeometry?: RenderTerrainGeometry;\r\n /** Used on leaves to support up-sampling. */\r\n mesh?: RealityMeshParams;\r\n };\r\n}\r\n\r\nconst scratchNormal = Vector3d.create();\r\nconst scratchViewZ = Vector3d.create();\r\nconst scratchPoint = Point3d.create();\r\nconst scratchClipPlanes = [ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint), ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint), ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint), ClipPlane.createNormalAndPoint(scratchNormal, scratchPoint)];\r\nconst scratchCorners = [Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero(), Point3d.createZero()];\r\n\r\n/** A [[Tile]] belonging to a [[MapTileTree]] representing a rectangular region of a map of the Earth.\r\n * @public\r\n */\r\nexport class MapTile extends RealityTile {\r\n private static _maxParentHeightDepth = 4;\r\n private _imageryTiles?: ImageryMapTile[];\r\n private _hiddenTiles?: ImageryMapTile[];\r\n private _highResolutionReplacementTiles?: ImageryMapTile[];\r\n /** @internal */\r\n public everLoaded = false; // If the tile is only required for availability metadata, load it once and then allow it to be unloaded.\r\n /** @internal */\r\n protected _heightRange: Range1d | undefined;\r\n /** @internal */\r\n protected _renderGeometry?: RenderTerrainGeometry;\r\n /** @internal */\r\n protected _mesh?: RealityMeshParams; // Primitive retained on leaves only for upsampling.\r\n /** @internal */\r\n public override get isReady(): boolean {\r\n return super.isReady && this.baseImageryIsReady;\r\n }\r\n\r\n /** @internal */\r\n public override get hasGraphics(): boolean {\r\n return this._renderGeometry !== undefined;\r\n }\r\n\r\n /** @internal */\r\n public get renderGeometry() { return this._renderGeometry; }\r\n /** @internal */\r\n public get mesh() { return this._mesh; }\r\n /** @internal */\r\n public get loadableTerrainTile() { return this.loadableTile as MapTile; }\r\n /** @internal */\r\n public get isPlanar(): boolean { return this._patch instanceof PlanarTilePatch; }\r\n /** @internal */\r\n public get imageryTiles(): ImageryMapTile[] | undefined { return this._imageryTiles; }\r\n /** List of selected tiles but are currently in hidden state (i.e. scale range visibility)\r\n * @internal\r\n */\r\n public get hiddenImageryTiles(): ImageryMapTile[] | undefined { return this._hiddenTiles; }\r\n\r\n /** List of leafs tiles that have been selected as a replacement for missing high resolution tiles.\r\n * When this list is non-empty this means we are past the maximum LOD available of the tile tree.\r\n * By using those tiles, you are likely to get a display where tiles looks pixelated..\r\n * in some cases this is preferred to have no tile at all.\r\n * @internal\r\n */\r\n public get highResolutionReplacementTiles(): ImageryMapTile[] | undefined { return this._highResolutionReplacementTiles; }\r\n\r\n /** The [[MapTileTree]] to which this tile belongs. */\r\n public readonly mapTree: MapTileTree;\r\n /** Uniquely identifies this tile within its [[mapTree]]. */\r\n public readonly quadId: QuadId;\r\n private _patch: TilePatch;\r\n /** The area of the surface of the Earth that this tile represents. */\r\n public readonly rectangle: MapCartoRectangle;\r\n /** @internal */\r\n protected _cornerRays?: Ray3d[];\r\n\r\n /** @internal */\r\n constructor(params: RealityTileParams, mapTree: MapTileTree, quadId: QuadId, patch: TilePatch, rectangle: MapCartoRectangle, heightRange: Range1d | undefined, cornerRays: Ray3d[] | undefined) {\r\n super(params, mapTree);\r\n this.mapTree = mapTree;\r\n this.quadId = quadId;\r\n this._patch = patch;\r\n this.rectangle = rectangle;\r\n this._cornerRays = cornerRays;\r\n this._heightRange = heightRange?.clone();\r\n }\r\n\r\n /** @internal */\r\n public getRangeCorners(result: Point3d[]): Point3d[] {\r\n return this._patch instanceof PlanarTilePatch ? this._patch.getRangeCorners(this.heightRange!, result) : this.range.corners(result);\r\n }\r\n\r\n /** @internal */\r\n public override getSizeProjectionCorners(): Point3d[] | undefined {\r\n // Use only the first 4 corners -- On terrain tiles the height is initially exagerated to world height range which can cause excessive tile loading.\r\n const rangeCorners = this.getRangeCorners(scratchCorners);\r\n return rangeCorners.slice(0, 4);\r\n }\r\n\r\n /** @internal */\r\n public override markUsed(args: TileDrawArgs) {\r\n super.markUsed(args);\r\n if (this._imageryTiles)\r\n for (const imageryTile of this._imageryTiles)\r\n imageryTile.markUsed(args);\r\n }\r\n\r\n /** @internal */\r\n public override get graphicType() {\r\n if (this.mapTree.isOverlay)\r\n return TileGraphicType.Overlay;\r\n\r\n return (this.mapTree.useDepthBuffer || this._forceDepthBuffer) ? TileGraphicType.Scene : TileGraphicType.BackgroundMap;\r\n }\r\n\r\n /** @internal */\r\n public get mapLoader() { return this.realityRoot.loader as MapTileLoader; }\r\n /** @internal */\r\n public get isUpsampled() { return false; }\r\n\r\n /** @internal */\r\n public tileFromQuadId(quadId: QuadId): MapTile | undefined {\r\n if (0 === quadId.compare(this.quadId))\r\n return this;\r\n\r\n assert(quadId.level > this.quadId.level);\r\n if (quadId.level <= this.quadId.level)\r\n return undefined;\r\n\r\n if (this.children) {\r\n const shift = quadId.level - this.quadId.level - 1;\r\n const childRow = quadId.row >> shift;\r\n const childColumn = quadId.column >> shift;\r\n for (const child of this.children) {\r\n const mapChild = child as MapTile;\r\n const childQuadId = mapChild.quadId;\r\n if (childQuadId.row === childRow && childQuadId.column === childColumn)\r\n return mapChild.tileFromQuadId(quadId);\r\n }\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n private get _forceDepthBuffer() {\r\n // For large ellipsoidal globe tile force the depth buffer on to avoid anomalies at horizon.\r\n return this.mapTree.globeMode === GlobeMode.Ellipsoid && this.depth < 8;\r\n }\r\n\r\n /** @internal */\r\n public override addBoundingGraphic(builder: GraphicBuilder, color: ColorDef) {\r\n if (!this.isDisplayable)\r\n return;\r\n\r\n const heightRange = (this.heightRange === undefined) ? Range1d.createXX(-1, 1) : this.heightRange;\r\n const lows = [], highs = [], reorder = [0, 1, 3, 2, 0];\r\n const cornerRays = this._cornerRays!;\r\n if (this._patch instanceof PlanarTilePatch) {\r\n const normal = this._patch.normal;\r\n for (let i = 0; i < 5; i++) {\r\n const corner = this._patch.corners[reorder[i]];\r\n lows.push(corner.plusScaled(normal, heightRange.low));\r\n highs.push(corner.plusScaled(normal, heightRange.high));\r\n }\r\n } else {\r\n for (let i = 0; i < 5; i++) {\r\n const cornerRay = cornerRays[reorder[i]];\r\n lows.push(cornerRay.origin.plusScaled(cornerRay.direction, heightRange.low));\r\n highs.push(cornerRay.origin.plusScaled(cornerRay.direction, heightRange.high));\r\n }\r\n }\r\n\r\n builder.setSymbology(color, color, 1);\r\n builder.addLineString(lows);\r\n builder.addLineString(highs);\r\n for (let i = 0; i < 4; i++)\r\n builder.addLineString([lows[i], highs[i]]);\r\n\r\n const inColor = ColorDef.create(ColorByName.cornflowerBlue);\r\n const outColor = ColorDef.create(ColorByName.chartreuse);\r\n const transitionColor = ColorDef.create(ColorByName.aquamarine);\r\n\r\n const inPoints = [], outPoints = [], transitionPoints = [];\r\n\r\n for (const point of highs)\r\n if (this.mapTree.cartesianRange.containsPoint(point))\r\n inPoints.push(point);\r\n else if (this.mapTree.cartesianRange.distanceToPoint(point) < this.mapTree.cartesianTransitionDistance)\r\n transitionPoints.push(point);\r\n else\r\n outPoints.push(point);\r\n\r\n builder.setSymbology(inColor, inColor, 15);\r\n builder.addPointString(inPoints);\r\n builder.setSymbology(outColor, outColor, 15);\r\n builder.addPointString(outPoints);\r\n builder.setSymbology(transitionColor, transitionColor, 31);\r\n builder.addPointString(transitionPoints);\r\n }\r\n\r\n /** @internal */\r\n public override getContentClip(): ClipVector | undefined {\r\n const points = this.getClipShape();\r\n if (points.length < 3)\r\n return undefined;\r\n if (this.mapTree.globeMode === GlobeMode.Ellipsoid) {\r\n const normal = PolygonOps.areaNormal(points);\r\n const globeOrigin = this.mapTree.globeOrigin;\r\n const globeNormal = Vector3d.createStartEnd(globeOrigin, points[0]);\r\n const negate = normal.dotProduct(globeNormal) < 0;\r\n const clipPlanes = [];\r\n for (let i = 0; i < 4; i++) {\r\n const point = points[i];\r\n const clipNormal = globeOrigin.crossProductToPoints(point, points[(i + 1) % 4], scratchNormal);\r\n if (negate)\r\n clipNormal.negate(clipNormal);\r\n\r\n const clipPlane = ClipPlane.createNormalAndPoint(clipNormal, point, false, false, scratchClipPlanes[i]);\r\n if (clipPlane !== undefined) // Undefined at pole tiles...\r\n clipPlanes.push(clipPlane);\r\n }\r\n\r\n const planeSet = ConvexClipPlaneSet.createPlanes(clipPlanes);\r\n const clipPrimitive = ClipPrimitive.createCapture(planeSet);\r\n\r\n return ClipVector.createCapture([clipPrimitive]);\r\n } else {\r\n return ClipVector.createCapture([ClipShape.createShape(points)!]);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override setNotFound(): void {\r\n super.setNotFound();\r\n\r\n // For map tiles assume that an unfound tile implies descendants and siblings will also be unfound.\r\n if (undefined !== this.parent)\r\n this.parent.setLeaf();\r\n }\r\n\r\n /** @internal */\r\n public getGraphic(_system: RenderSystem, _texture: RenderTexture): RenderGraphic | undefined {\r\n return undefined;\r\n }\r\n\r\n /** For globe tiles displaying less then depth 2 appears distorted\r\n * @internal\r\n */\r\n public override get isDisplayable() {\r\n return this.mapTree.globeMode === GlobeMode.Ellipsoid ? (this.depth >= MapTileTree.minDisplayableDepth) : super.isDisplayable;\r\n }\r\n\r\n /** @internal */\r\n public override isOccluded(viewingSpace: ViewingSpace): boolean {\r\n if (undefined === this._cornerRays || this.mapTree.globeMode !== GlobeMode.Ellipsoid)\r\n return false;\r\n\r\n if (viewingSpace.eyePoint !== undefined) {\r\n if (!this.mapTree.pointAboveEllipsoid(viewingSpace.eyePoint))\r\n return false;\r\n\r\n for (const cornerNormal of this._cornerRays) {\r\n const eyeNormal = Vector3d.createStartEnd(viewingSpace.eyePoint, cornerNormal.origin, scratchNormal);\r\n eyeNormal.normalizeInPlace();\r\n if (eyeNormal.dotProduct(cornerNormal.direction) < .01)\r\n return false;\r\n }\r\n } else {\r\n const viewZ = viewingSpace.rotation.getRow(2, scratchViewZ);\r\n for (const cornerNormal of this._cornerRays)\r\n if (cornerNormal.direction.dotProduct(viewZ) > 0)\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n protected override _loadChildren(resolve: (children: Tile[] | undefined) => void, _reject: (error: Error) => void): void {\r\n const mapTree = this.mapTree;\r\n const childLevel = this.quadId.level + 1;\r\n const rowCount = mapTree.sourceTilingScheme.getNumberOfYChildrenAtLevel(childLevel);\r\n const columnCount = mapTree.sourceTilingScheme.getNumberOfXChildrenAtLevel(childLevel);\r\n\r\n const resolveChildren = (children: Tile[]) => {\r\n const childrenRange = Range3d.createNull();\r\n for (const child of children)\r\n childrenRange.extendRange(child.range);\r\n\r\n if (!this.range.containsRange(childrenRange))\r\n this.range.extendRange(childrenRange);\r\n\r\n resolve(children);\r\n };\r\n\r\n if (mapTree.doCreateGlobeChildren(this)) {\r\n this.createGlobeChildren(columnCount, rowCount, resolveChildren);\r\n return;\r\n }\r\n\r\n const resolvePlanarChildren = (childCorners: Point3d[][]) => {\r\n const level = this.quadId.level + 1;\r\n const column = this.quadId.column * 2;\r\n const row = this.quadId.row * 2;\r\n const children = [];\r\n const childrenAreLeaves = (this.depth + 1) === mapTree.loader.maxDepth;\r\n const globeMode = this.mapTree.globeMode;\r\n for (let j = 0; j < rowCount; j++) {\r\n for (let i = 0; i < columnCount; i++) {\r\n const quadId = new QuadId(level, column + i, row + j);\r\n const corners = childCorners[j * columnCount + i];\r\n const rectangle = mapTree.getTileRectangle(quadId);\r\n const normal = PolygonOps.areaNormal([corners[0], corners[1], corners[3], corners[2]]);\r\n normal.normalizeInPlace();\r\n\r\n const heightRange = this.mapTree.getChildHeightRange(quadId, rectangle, this);\r\n const diagonal = Math.max(corners[0].distance(corners[3]), corners[1].distance(corners[2])) / 2.0;\r\n const chordHeight = globeMode === GlobeMode.Ellipsoid ? Math.sqrt(diagonal * diagonal + Constant.earthRadiusWGS84.equator * Constant.earthRadiusWGS84.equator) - Constant.earthRadiusWGS84.equator : 0.0;\r\n const rangeCorners = MapTile.computeRangeCorners(corners, normal, chordHeight, undefined, heightRange);\r\n const range = Range3d.createArray(rangeCorners);\r\n const child = this.mapTree.createPlanarChild({ contentId: quadId.contentId, maximumSize: 512, range, parent: this, isLeaf: childrenAreLeaves }, quadId, corners, normal, rectangle, chordHeight, heightRange);\r\n if (child)\r\n children.push(child);\r\n }\r\n }\r\n\r\n resolveChildren(children);\r\n };\r\n\r\n mapTree.getPlanarChildCorners(this, columnCount, rowCount, resolvePlanarChildren);\r\n }\r\n\r\n private createGlobeChildren(columnCount: number, rowCount: number, resolve: (children: MapTile[]) => void) {\r\n const level = this.quadId.level + 1;\r\n const column = this.quadId.column * 2;\r\n const row = this.quadId.row * 2;\r\n const mapTree = this.mapTree;\r\n const children = [];\r\n\r\n for (let j = 0; j < rowCount; j++) {\r\n for (let i = 0; i < columnCount; i++) {\r\n const quadId = new QuadId(level, column + i, row + j);\r\n const angleSweep = quadId.getAngleSweep(mapTree.sourceTilingScheme);\r\n const ellipsoidPatch = EllipsoidPatch.createCapture(this.mapTree.earthEllipsoid, angleSweep.longitude, angleSweep.latitude);\r\n const range = ellipsoidPatch.range();\r\n const rectangle = mapTree.getTileRectangle(quadId);\r\n const heightRange = this.mapTree.getChildHeightRange(quadId, rectangle, this);\r\n if (undefined !== heightRange)\r\n range.expandInPlace(heightRange.high - heightRange.low);\r\n\r\n children.push(this.mapTree.createGlobeChild({ contentId: quadId.contentId, maximumSize: 512, range, parent: this, isLeaf: false }, quadId, range.corners(), rectangle, ellipsoidPatch, heightRange));\r\n }\r\n }\r\n\r\n resolve(children);\r\n return children;\r\n }\r\n\r\n /** @internal */\r\n public static computeRangeCorners(corners: Point3d[], normal: Vector3d, chordHeight: number, result?: Point3d[], heightRange?: Range1d) {\r\n if (result === undefined) {\r\n result = [];\r\n for (let i = 0; i < 8; i++)\r\n result.push(Point3d.create());\r\n }\r\n\r\n let index = 0;\r\n assert(corners.length === 4);\r\n const deltaLow = normal.scale(- chordHeight + (heightRange ? heightRange.low : 0));\r\n const deltaHigh = normal.scale(chordHeight + (heightRange ? heightRange.high : 0));\r\n\r\n for (const corner of corners)\r\n corner.plus(deltaLow, result[index++]);\r\n\r\n for (const corner of corners)\r\n corner.plus(deltaHigh, result[index++]);\r\n\r\n return result;\r\n }\r\n\r\n /** @internal */\r\n public override isRegionCulled(args: TileDrawArgs): boolean {\r\n return this.isContentCulled(args);\r\n }\r\n\r\n /** @internal */\r\n public override isContentCulled(args: TileDrawArgs): boolean {\r\n return FrustumPlanes.Containment.Outside === args.frustumPlanes.computeContainment(this.getRangeCorners(scratchCorners));\r\n }\r\n\r\n /** @internal */\r\n public clearLayers() {\r\n this.clearImageryTiles();\r\n this._graphic = undefined;\r\n if (this.children)\r\n for (const child of this.children)\r\n (child as MapTile).clearLayers();\r\n }\r\n\r\n private clearImageryTiles() {\r\n if (this._imageryTiles) {\r\n this._imageryTiles.forEach((tile) => tile.releaseMapTileUsage());\r\n this._imageryTiles = undefined;\r\n }\r\n if (this._hiddenTiles) {\r\n this._hiddenTiles = undefined;\r\n }\r\n if (this._highResolutionReplacementTiles) {\r\n this._highResolutionReplacementTiles = undefined;\r\n }\r\n }\r\n\r\n /** @internal */\r\n public override produceGraphics(): RenderGraphic | undefined {\r\n if (undefined !== this._graphic && this.imageryIsReady)\r\n return this._graphic;\r\n\r\n const geometry = this.renderGeometry;\r\n if (undefined === geometry)\r\n return undefined;\r\n\r\n const textures = this.getDrapeTextures();\r\n const { baseColor, baseTransparent, layerClassifiers } = this.mapTree;\r\n const graphic = IModelApp.renderSystem.createRealityMeshGraphic({ realityMesh: geometry, projection: this.getProjection(), tileRectangle: this.rectangle, featureTable: PackedFeatureTable.pack(this.mapLoader.featureTable), tileId: this.contentId, baseColor, baseTransparent, textures, layerClassifiers }, true);\r\n\r\n // If there are no layer classifiers then we can save this graphic for re-use. If layer classifiers exist they are regenerated based on view and we must collate them with the imagery.\r\n if (this.imageryIsReady && 0 === this.mapTree.layerClassifiers.size)\r\n this._graphic = graphic;\r\n\r\n return graphic;\r\n }\r\n\r\n /** @internal */\r\n public getClipShape(): Point3d[] {\r\n return (this._patch instanceof PlanarTilePatch) ? this._patch.getClipShape() : [this._cornerRays![0].origin, this._cornerRays![1].origin, this._cornerRays![3].origin, this._cornerRays![2].origin];\r\n }\r\n\r\n /** @internal */\r\n protected override _collectStatistics(stats: RenderMemory.Statistics): void {\r\n super._collectStatistics(stats);\r\n\r\n this._renderGeometry?.collectStatistics(stats);\r\n if (this._mesh) {\r\n stats.addTerrain(this._mesh.indices.byteLength\r\n + this._mesh.positions.points.byteLength\r\n + this._mesh.uvs.points.byteLength\r\n + (this._mesh.normals ? this._mesh.normals.byteLength : 0)\r\n );\r\n }\r\n }\r\n\r\n /** Height range is along with the tile corners to detect if tile intersects view frustum.\r\n * Range will be single value fo ron-terrain tiles -- if terrain tile is not loaded it will\r\n * inherit height from ancestors.\r\n * @internal\r\n */\r\n public get heightRange(): Range1d | undefined {\r\n if (undefined !== this._heightRange)\r\n return this._heightRange;\r\n\r\n for (let parent = this.parent; undefined !== parent; parent = parent.parent) {\r\n const mapParent = parent as MapTile;\r\n if (undefined !== mapParent._heightRange)\r\n return mapParent._heightRange;\r\n }\r\n\r\n assert(false);\r\n return Range1d.createNull();\r\n }\r\n\r\n /** @internal */\r\n public get mapTilingScheme() {\r\n return this.mapTree.sourceTilingScheme;\r\n }\r\n\r\n /** Adjust the minimum and maximum elevations of the terrain within this tile. */\r\n public adjustHeights(minHeight: number, maxHeight: number) {\r\n if (undefined === this._heightRange)\r\n this._heightRange = Range1d.createXX(minHeight, maxHeight);\r\n else {\r\n this._heightRange.low = Math.max(this.heightRange!.low, minHeight);\r\n this._heightRange.high = Math.min(this.heightRange!.high, maxHeight);\r\n }\r\n\r\n if (this.rangeCorners && this._patch instanceof PlanarTilePatch)\r\n this._patch.getRangeCorners(this.heightRange!, this.rangeCorners);\r\n }\r\n\r\n /** Obtain a [[MapTileProjection]] to project positions within this tile's area into 3d space. */\r\n public getProjection(heightRange?: Range1d): MapTileProjection {\r\n return this._patch instanceof PlanarTilePatch ? new PlanarProjection(this._patch, heightRange) : new EllipsoidProjection(this._patch, heightRange);\r\n }\r\n\r\n /** @internal */\r\n public get baseImageryIsReady(): boolean {\r\n if (undefined !== this.mapTree.baseColor || 0 === this.mapTree.layerImageryTrees.length)\r\n return true;\r\n\r\n if (undefined === this._imageryTiles)\r\n return false;\r\n\r\n const baseTreeId = this.mapTree.layerImageryTrees[0].tree.modelId;\r\n return this._imageryTiles.every((imageryTile) => imageryTile.imageryTree.modelId !== baseTreeId || imageryTile.isReady);\r\n }\r\n\r\n /** @internal */\r\n public get imageryIsReady(): boolean {\r\n if (undefined === this._imageryTiles)\r\n return 0 === this.mapTree.layerImageryTrees.length;\r\n\r\n return this._imageryTiles.every((tile) => tile.isReady);\r\n }\r\n\r\n /** Select secondary (imagery) tiles\r\n * @internal\r\n */\r\n public override selectSecondaryTiles(args: TileDrawArgs, context: TraversalSelectionContext) {\r\n if (0 === this.mapTree.layerImageryTrees.length || this.imageryIsReady)\r\n return;\r\n\r\n this.clearImageryTiles();\r\n this._imageryTiles = new Array<ImageryMapTile>();\r\n this._hiddenTiles = new Array<ImageryMapTile>();\r\n this._highResolutionReplacementTiles = new Array<ImageryMapTile>();\r\n for (const layerImageryTree of this.mapTree.layerImageryTrees) {\r\n let tmpTiles = new Array<ImageryMapTile>();\r\n const tmpLeafTiles = new Array<ImageryMapTile>();\r\n if (TileTreeLoadStatus.Loaded !== layerImageryTree.tree.selectCartoDrapeTiles(tmpTiles, tmpLeafTiles, this, args,)) {\r\n this._imageryTiles = undefined;\r\n return;\r\n }\r\n\r\n // When the base layer is zoomed-in beyond it's max resolution,\r\n // we display leaf tiles and stretched them if needed.\r\n // We don't want the same behavior non-base layers, in the case,\r\n // the layer will simply disappear past its max resolution.\r\n // Note: Replacement leaf tiles are kept as a mean to determine which\r\n // imagery tree has reached it's maximum zoom level.\r\n if (layerImageryTree.baseImageryLayer) {\r\n tmpTiles = [...tmpTiles, ...tmpLeafTiles];\r\n } else {\r\n this._highResolutionReplacementTiles = [...this._highResolutionReplacementTiles, ...tmpLeafTiles];\r\n }\r\n\r\n // MapTileTree might include a non-visible imagery tree, we need to check for that.\r\n if (layerImageryTree.settings.visible && !layerImageryTree.settings.allSubLayersInvisible) {\r\n for (const imageryTile of tmpTiles) {\r\n imageryTile.markMapTileUsage();\r\n if (imageryTile.isReady)\r\n args.markReady(imageryTile);\r\n else\r\n context.missing.push(imageryTile);\r\n this._imageryTiles.push(imageryTile);\r\n }\r\n } else {\r\n // Even though those selected imagery tile are not visible,\r\n // we keep track of them for scale range reporting.\r\n for (const imageryTile of tmpTiles) {\r\n this._hiddenTiles.push(imageryTile);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private static _scratchRectangle1 = MapCartoRectangle.createZero();\r\n private static _scratchRectangle2 = MapCartoRectangle.createZero();\r\n\r\n /** The height range for terrain tiles is not known until the tiles are unloaded. We use \"ApproximateTerrainHeight\" for first 6 levels but below\r\n * that the tiles inherit height range from parents. This is problematic as tiles with large height range will be unnecessarily selected as\r\n * they apparently intersect view frustum. To avoid this force loading of terrain tiles if they exceed \"_maxParentHightDepth\".\r\n * @internal\r\n */\r\n protected override forceSelectRealityTile(): boolean {\r\n let parentHeightDepth = 0;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-this-alias\r\n for (let parent: MapTile = this; parent !== undefined && parent._heightRange === undefined; parent = parent.parent as MapTile)\r\n parentHeightDepth++;\r\n\r\n return parentHeightDepth > MapTile._maxParentHeightDepth;\r\n }\r\n\r\n /** @internal */\r\n protected override minimumVisibleFactor(): number {\r\n // if minimumVisibleFactor is more than 0, it stops parents from loading when children are not ready, to fill in gaps\r\n return 0.0;\r\n }\r\n\r\n private static _scratchThisDiagonal = Vector2d.create();\r\n private static _scratchDrapeDiagonal = Vector2d.create();\r\n\r\n /** @internal */\r\n public getDrapeTextures(): TerrainTexture[] | undefined {\r\n if (undefined === this._imageryTiles)\r\n return undefined;\r\n\r\n const drapeTextures: TerrainTexture[] = [];\r\n const thisRectangle = this.loadableTerrainTile.rectangle;\r\n const thisDiagonal = thisRectangle.diagonal(MapTile._scratchThisDiagonal);\r\n const bordersNorthPole = this.quadId.bordersNorthPole(this.mapTree.sourceTilingScheme);\r\n const bordersSouthPole = this.quadId.bordersSouthPole(this.mapTree.sourceTilingScheme);\r\n for (const imageryTile of this._imageryTiles) {\r\n if (imageryTile.texture) {\r\n drapeTextures.push(this.computeDrapeTexture(thisRectangle, thisDiagonal, imageryTile, imageryTile.rectangle));\r\n\r\n if ((bordersNorthPole && imageryTile.quadId.bordersNorthPole(imageryTile.tilingScheme) && imageryTile.rectangle.high.y < thisRectangle.high.y) ||\r\n (bordersSouthPole && imageryTile.quadId.bordersSouthPole(imageryTile.tilingScheme) && imageryTile.rectangle.low.y > thisRectangle.low.y)) {\r\n // Add separate texture stretching last sliver of tile imagery to cover pole.\r\n const sliverRectangle = imageryTile.rectangle.clone(MapTile._scratchRectangle1);\r\n const clipRectangle = thisRectangle.clone(MapTile._scratchRectangle2);\r\n const sliverHeight = sliverRectangle.high.y - sliverRectangle.low.y;\r\n\r\n if (bordersSouthPole) {\r\n clipRectangle.high.y = sliverRectangle.low.y;\r\n sliverRectangle.low.y = thisRectangle.low.y;\r\n sliverRectangle.high.y += 1 / sliverHeight;\r\n } else {\r\n clipRectangle.low.y = sliverRectangle.high.y;\r\n sliverRectangle.high.y = thisRectangle.high.y;\r\n sliverRectangle.low.y -= 1 / sliverHeight;\r\n }\r\n\r\n drapeTextures.push(this.computeDrapeTexture(thisRectangle, thisDiagonal, imageryTile, sliverRectangle, clipRectangle));\r\n }\r\n } else {\r\n for (let parent = imageryTile.parent; undefined !== parent; parent = parent.parent) {\r\n const mapTile = parent as ImageryMapTile;\r\n if (mapTile.texture) {\r\n drapeTextures.push(this.computeDrapeTexture(thisRectangle, thisDiagonal, mapTile, mapTile.rectangle, imageryTile.rectangle));\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return drapeTextures.length > 0 ? drapeTextures : undefined;\r\n }\r\n\r\n private static _scratchIntersectRange = Range2d.createNull();\r\n\r\n private computeDrapeTexture(thisRectangle: Range2d, thisDiagonal: Vector2d, imageryTile: ImageryMapTile, drapeRectangle: Range2d, clipRectangle?: Range2d): TerrainTexture {\r\n assert(imageryTile.texture !== undefined);\r\n\r\n // Compute transformation from the terrain tile texture coordinates (0-1) to the drape tile texture coordinates.\r\n const drapeDiagonal = drapeRectangle.diagonal(MapTile._scratchDrapeDiagonal);\r\n const translate = Vector2d.create((thisRectangle.low.x - drapeRectangle.low.x) / drapeDiagonal.x, (thisRectangle.low.y - drapeRectangle.low.y) / drapeDiagonal.y);\r\n const scale = Vector2d.create(thisDiagonal.x / drapeDiagonal.x, thisDiagonal.y / drapeDiagonal.y);\r\n const featureIndex = this.mapLoader.getFeatureIndex(imageryTile.imageryTree.modelId);\r\n let clipRect;\r\n if (undefined !== clipRectangle) {\r\n const intersect = clipRectangle.intersect(drapeRectangle, MapTile._scratchIntersectRange);\r\n assert(!intersect.isNull);\r\n clipRect = Range2d.createXYXY((intersect.low.x - drapeRectangle.low.x) / drapeDiagonal.x, (intersect.low.y - drapeRectangle.low.y) / drapeDiagonal.y, (intersect.high.x - drapeRectangle.low.x) / drapeDiagonal.x, (intersect.high.y - drapeRectangle.low.y) / drapeDiagonal.y);\r\n }\r\n\r\n const imageryModelId = imageryTile.tree.modelId;\r\n return new TerrainTexture(imageryTile.texture, featureIndex, scale, translate, drapeRectangle, this.mapTree.getLayerIndex(imageryModelId), this.mapTree.getLayerTransparency(imageryModelId), clipRect);\r\n }\r\n\r\n /** @internal */\r\n public override setContent(content: TerrainTileContent): void {\r\n this._mesh = content.terrain?.mesh;\r\n if (this.mapTree.produceGeometry) {\r\n const iModelTransform = this.mapTree.iModelTransform;\r\n const geometryTransform = content.terrain?.renderGeometry?.transform;\r\n const transform = geometryTransform ? iModelTransform.multiplyTransformTransform(geometryTransform) : iModelTransform;\r\n const polyface = content.terrain?.mesh ? RealityMeshParams.toPolyface(content.terrain.mesh, { transform }) : undefined;\r\n this._geometry = polyface ? { polyfaces: [polyface] } : undefined;\r\n\r\n } else {\r\n dispose(this._renderGeometry);\r\n this._renderGeometry = content.terrain?.renderGeometry;\r\n }\r\n\r\n this.everLoaded = true;\r\n\r\n if (undefined !== content.contentRange)\r\n this._contentRange = content.contentRange;\r\n\r\n this.setIsReady();\r\n }\r\n\r\n /** @internal */\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 /** @internal */\r\n public override disposeContents() {\r\n super.disposeContents();\r\n this._renderGeometry = dispose(this._renderGeometry);\r\n this.clearImageryTiles();\r\n // Note - don't dispose of mesh - these should only ever exist on terrain leaf tile and are required by children. Let garbage collector handle them.\r\n }\r\n}\r\n\r\n/** @internal */\r\nexport class UpsampledMapTile extends MapTile {\r\n public override get isUpsampled() { return true; }\r\n public override get isEmpty() { return false; }\r\n public override get loadableTile(): RealityTile {\r\n let parent = this.parent as MapTile;\r\n for (; parent && parent.isUpsampled; parent = parent.parent as MapTile)\r\n ;\r\n return parent;\r\n }\r\n\r\n private upsampleFromParent() {\r\n const parent = this.loadableTerrainTile;\r\n const parentMesh = parent.mesh;\r\n if (undefined === parentMesh) {\r\n return undefined;\r\n }\r\n const thisId = this.quadId, parentId = parent.quadId;\r\n const levelDelta = thisId.level - parentId.level;\r\n const thisColumn = thisId.column - (parentId.column << levelDelta);\r\n const thisRow = thisId.row - (parentId.row << levelDelta);\r\n const scale = 1.0 / (1 << levelDelta);\r\n const parentParameterRange = Range2d.createXYXY(scale * thisColumn, scale * thisRow, scale * (thisColumn + 1), scale * (thisRow + 1));\r\n const upsample = upsampleRealityMeshParams(parentMesh, parentParameterRange);\r\n this.adjustHeights(upsample.heightRange.low, upsample.heightRange.high);\r\n return upsample;\r\n }\r\n\r\n public override get renderGeometry() {\r\n if (undefined === this._renderGeometry) {\r\n const upsample = this.upsampleFromParent();\r\n const projection = this.loadableTerrainTile.getProjection(this.heightRange);\r\n if (upsample)\r\n this._renderGeometry = IModelApp.renderSystem.createTerrainMesh(upsample.mesh, projection.transformFromLocal, true);\r\n }\r\n return this._renderGeometry;\r\n }\r\n\r\n public override get isLoading(): boolean { return this.loadableTile.isLoading; }\r\n public override get isQueued(): boolean { return this.loadableTile.isQueued; }\r\n public override get isNotFound(): boolean { return this.loadableTile.isNotFound; }\r\n public override get isReady(): boolean { return (this._renderGeometry !== undefined || this.loadableTile.loadStatus === TileLoadStatus.Ready) && this.baseImageryIsReady; }\r\n\r\n public override markUsed(args: TileDrawArgs): void {\r\n args.markUsed(this);\r\n args.markUsed(this.loadableTile);\r\n }\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AccuSnap.d.ts","sourceRoot":"","sources":["../../src/AccuSnap.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAQ,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAA8E,OAAO,EAAY,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE5I,OAAO,EAAwB,aAAa,EAAoC,cAAc,EA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c,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAS7C;;OAEG;IACI,YAAY,CAAC,KAAK,EAAE,OAAO;IAQlC;;OAEG;IACI,WAAW,IAAI,IAAI;IAO1B;;;;;OAKG;IACU,UAAU;CAOxB;AAED,gBAAgB;AAChB,qBAAa,mBAAmB;IAC9B,WAAkB,KAAK,IAAI,OAAO,CAA2E;WAE/F,cAAc,CAAC,UAAU,GAAE,OAAc,GAAG,UAAU,GAAG,SAAS;WAWlE,eAAe,IAAI,OAAO;WAU1B,cAAc,IAAI,cAAc,GAAG,SAAS;CAI3D;AAED,cAAc;AACd,yBAAiB,QAAQ,CAAC;IACxB,MAAa,SAAS;QACb,OAAO,UAAS;QAChB,MAAM,UAAS;QACf,SAAS,SAAK;QACd,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;QAM/B,KAAK,IAAI,SAAS;KAK1B;IAED,MAAa,QAAQ;QACZ,iBAAiB,SAAO;QACxB,YAAY,SAAO;QACnB,cAAc,SAAO;QACrB,cAAc,UAAQ;QACtB,UAAU,UAAQ;QAClB,OAAO,UAAQ;QACf,YAAY,aAA8B;KAClD;CACF"}
@@ -784,9 +784,13 @@ export class AccuSnap {
784
784
  this.aSnapHits.removeCurrentHit();
785
785
  hit = await this.getAccuSnapDetail(this.aSnapHits, out);
786
786
  }
787
+ if (!this._doSnapping)
788
+ hit = undefined; // Snap no longer requested...
787
789
  }
788
790
  else if (this.isLocateEnabled) {
789
791
  hit = await this.findLocatableHit(ev, false, out); // get next AccuSnap path (or undefined)
792
+ if (!this.isLocateEnabled)
793
+ hit = undefined; // Hit no longer requested...
790
794
  }
791
795
  // set the current hit
792
796
  if (hit || this.currHit)
@@ -807,9 +811,13 @@ export class AccuSnap {
807
811
  if (this._doSnapping) {
808
812
  out.snapStatus = this.findHits(ev);
809
813
  hit = (SnapStatus.Success !== out.snapStatus) ? undefined : await this.getAccuSnapDetail(this.aSnapHits, out);
814
+ if (!this._doSnapping)
815
+ hit = undefined; // Snap no longer requested...
810
816
  }
811
817
  else if (this.isLocateEnabled) {
812
818
  hit = await this.findLocatableHit(ev, true, out);
819
+ if (!this.isLocateEnabled)
820
+ hit = undefined; // Hit no longer requested...
813
821
  }
814
822
  }
815
823
  // set the current hit and display the sprite (based on snap's KeypointType)