@itwin/core-frontend 3.0.0-dev.182 → 3.0.0-dev.183
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/BackgroundMapGeometry.d.ts +1 -1
- package/lib/cjs/BackgroundMapGeometry.d.ts.map +1 -1
- package/lib/cjs/BackgroundMapGeometry.js +2 -2
- package/lib/cjs/BackgroundMapGeometry.js.map +1 -1
- package/lib/cjs/RealityDataSource.js +3 -1
- package/lib/cjs/RealityDataSource.js.map +1 -1
- package/lib/cjs/ViewingSpace.js +1 -1
- package/lib/cjs/ViewingSpace.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +4 -0
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +4 -0
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/render/webgl/BranchUniforms.d.ts.map +1 -1
- package/lib/cjs/render/webgl/BranchUniforms.js +8 -5
- package/lib/cjs/render/webgl/BranchUniforms.js.map +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js +1 -1
- package/lib/cjs/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/cjs/tile/internal.d.ts +1 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +1 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/ArcGisUtilities.js +7 -2
- package/lib/cjs/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerAuthentication.d.ts +20 -0
- package/lib/cjs/tile/map/MapLayerAuthentication.d.ts.map +1 -0
- package/lib/cjs/tile/map/MapLayerAuthentication.js +18 -0
- package/lib/cjs/tile/map/MapLayerAuthentication.js.map +1 -0
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +5 -2
- package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js +3 -1
- package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +4 -2
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.d.ts +3 -1
- package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerSources.js +3 -1
- package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
- package/lib/esm/BackgroundMapGeometry.d.ts +1 -1
- package/lib/esm/BackgroundMapGeometry.d.ts.map +1 -1
- package/lib/esm/BackgroundMapGeometry.js +2 -2
- package/lib/esm/BackgroundMapGeometry.js.map +1 -1
- package/lib/esm/RealityDataSource.js +3 -1
- package/lib/esm/RealityDataSource.js.map +1 -1
- package/lib/esm/ViewingSpace.js +1 -1
- package/lib/esm/ViewingSpace.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +4 -0
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +4 -0
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/render/webgl/BranchUniforms.d.ts.map +1 -1
- package/lib/esm/render/webgl/BranchUniforms.js +8 -5
- package/lib/esm/render/webgl/BranchUniforms.js.map +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js +1 -1
- package/lib/esm/render/webgl/SolarShadowMap.js.map +1 -1
- package/lib/esm/tile/internal.d.ts +1 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +1 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.d.ts.map +1 -1
- package/lib/esm/tile/map/ArcGisUtilities.js +8 -3
- package/lib/esm/tile/map/ArcGisUtilities.js.map +1 -1
- package/lib/esm/tile/map/MapLayerAuthentication.d.ts +20 -0
- package/lib/esm/tile/map/MapLayerAuthentication.d.ts.map +1 -0
- package/lib/esm/tile/map/MapLayerAuthentication.js +15 -0
- package/lib/esm/tile/map/MapLayerAuthentication.js.map +1 -0
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +5 -2
- package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js +3 -1
- package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +5 -3
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.d.ts +3 -1
- package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerSources.js +3 -1
- package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolarShadowMap.js","sourceRoot":"","sources":["../../../../src/render/webgl/SolarShadowMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAsD;AACtD,wDAAuK;AACvK,oDAE4B;AAC5B,oEAAwD;AACxD,kDAA4F;AAK5F,6CAA0C;AAC1C,qDAAgD;AAEhD,+CAA4C;AAC5C,6BAA0B;AAC1B,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AAC,mBAAmB;QAC1G,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AAxSD,wCAwSC","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\r\n/** @packageDocumentation\r\n * @module WebGL\r\n */\r\n\r\nimport { assert, dispose } from \"@itwin/core-bentley\";\r\nimport { ClipUtilities, ConvexClipPlaneSet, Geometry, GrowableXYZArray, Map4d, Matrix3d, Matrix4d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport {\r\n Frustum, FrustumPlanes, RenderMode, RenderTexture, SolarShadowSettings, TextureTransparency, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { RenderType } from \"@itwin/webgl-compatibility\";\r\nimport { Tile, TileDrawArgs, TileTreeReference, TileVisibility } from \"../../tile/internal\";\r\nimport { SceneContext } from \"../../ViewContext\";\r\nimport { RenderGraphic } from \"../RenderGraphic\";\r\nimport { RenderMemory } from \"../RenderMemory\";\r\nimport { BranchStack } from \"./BranchStack\";\r\nimport { BatchState } from \"./BatchState\";\r\nimport { EVSMGeometry } from \"./CachedGeometry\";\r\nimport { WebGLDisposable } from \"./Disposable\";\r\nimport { FrameBuffer } from \"./FrameBuffer\";\r\nimport { GL } from \"./GL\";\r\nimport { RenderCommands } from \"./RenderCommands\";\r\nimport { RenderPass, TextureUnit } from \"./RenderFlags\";\r\nimport { RenderState } from \"./RenderState\";\r\nimport { getDrawParams } from \"./ScratchDrawParams\";\r\nimport { System } from \"./System\";\r\nimport { Target } from \"./Target\";\r\nimport { Texture, TextureHandle } from \"./Texture\";\r\n\r\ntype ProcessTiles = (tiles: Tile[]) => void;\r\n\r\nfunction createDrawArgs(sceneContext: SceneContext, solarShadowMap: SolarShadowMap, tree: TileTreeReference, frustumPlanes: FrustumPlanes, processTiles: ProcessTiles): TileDrawArgs | undefined {\r\n class SolarShadowMapDrawArgs extends TileDrawArgs {\r\n private _useViewportMap?: boolean;\r\n private readonly _processTiles: ProcessTiles;\r\n\r\n constructor(private _mapFrustumPlanes: FrustumPlanes, private _shadowMap: SolarShadowMap, args: TileDrawArgs, process: ProcessTiles) {\r\n super(args);\r\n this._processTiles = process;\r\n }\r\n\r\n // The solar shadow projection is parallel - which can cause excessive tile selection if it is along an axis of an unbounded tile\r\n // tree such as the OSM buildings. Rev limit the selection here.\r\n public override get maxRealityTreeSelectionCount(): undefined | number { return 500; }\r\n\r\n public override processSelectedTiles(tiles: Tile[]): void {\r\n this._processTiles(tiles);\r\n }\r\n\r\n public override get frustumPlanes(): FrustumPlanes {\r\n if (true === this._useViewportMap)\r\n return super.frustumPlanes;\r\n else\r\n return this._mapFrustumPlanes;\r\n }\r\n\r\n public override get worldToViewMap(): Map4d {\r\n if (true === this._useViewportMap)\r\n return super.worldToViewMap;\r\n else\r\n return this._shadowMap.worldToViewMap;\r\n }\r\n\r\n public override drawGraphics(): void {\r\n const graphics = this.produceGraphics();\r\n if (graphics)\r\n this._shadowMap.addGraphic(graphics);\r\n }\r\n\r\n public override getPixelSize(tile: Tile): number {\r\n // For tiles that are part of the scene, size them based on the viewport frustum so that shadow map uses same resolution tiles as scene\r\n // - otherwise artifacts like shadow acne may result.\r\n // For tiles that are NOT part of the scene, size them based on the shadow frustum, not the viewport frustum\r\n // - otherwise excessive numbers of excessively detailed may be requested for the shadow map.\r\n if (undefined === this._useViewportMap) {\r\n this._useViewportMap = true;\r\n const vis = tile.computeVisibility(this);\r\n this._useViewportMap = TileVisibility.OutsideFrustum !== vis;\r\n }\r\n\r\n const size = super.getPixelSize(tile);\r\n this._useViewportMap = undefined;\r\n return size;\r\n }\r\n\r\n public static create(context: SceneContext, shadowMap: SolarShadowMap, tileTree: TileTreeReference, planes: FrustumPlanes, process: ProcessTiles) {\r\n const args = tileTree.createDrawArgs(context);\r\n return undefined !== args ? new SolarShadowMapDrawArgs(planes, shadowMap, args, process) : undefined;\r\n }\r\n }\r\n\r\n return SolarShadowMapDrawArgs.create(sceneContext, solarShadowMap, tree, frustumPlanes, processTiles);\r\n}\r\n\r\nconst shadowMapWidth = 4096; // size of original depth buffer map\r\nconst shadowMapHeight = shadowMapWidth; // TBD - Adjust for aspect ratio.\r\nconst evsmWidth = shadowMapWidth / 2; // EVSM buffer is 1/2 size each direction\r\nconst evsmHeight = shadowMapHeight / 2;\r\nconst postProjectionMatrixNpc = Matrix4d.createRowValues(/* Row 1 */ 0, 1, 0, 0, /* Row 1 */ 0, 0, 1, 0, /* Row 3 */ 1, 0, 0, 0, /* Row 4 */ 0, 0, 0, 1);\r\n\r\n// Bundles up the disposable, create-once-and-reuse members of a SolarShadowMap.\r\nclass Bundle implements WebGLDisposable {\r\n private constructor(\r\n public readonly depthTexture: Texture,\r\n public readonly shadowMapTexture: Texture,\r\n public readonly fbo: FrameBuffer,\r\n public readonly fboSM: FrameBuffer,\r\n public readonly evsmGeom: EVSMGeometry,\r\n public readonly renderCommands: RenderCommands) {\r\n }\r\n\r\n public static create(target: Target, stack: BranchStack, batch: BatchState): Bundle | undefined {\r\n const depthTextureHandle = System.instance.createDepthBuffer(shadowMapWidth, shadowMapHeight) as TextureHandle;\r\n if (undefined === depthTextureHandle)\r\n return undefined;\r\n\r\n let pixelDataType = GL.Texture.DataType.Float;\r\n switch (System.instance.capabilities.maxRenderType) {\r\n case RenderType.TextureFloat:\r\n break;\r\n case RenderType.TextureHalfFloat:\r\n if (System.instance.capabilities.isWebGL2) {\r\n pixelDataType = (System.instance.context as WebGL2RenderingContext).HALF_FLOAT;\r\n break;\r\n } else {\r\n const exthf = System.instance.capabilities.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\");\r\n if (undefined !== exthf) {\r\n pixelDataType = exthf.HALF_FLOAT_OES;\r\n break;\r\n }\r\n }\r\n /* falls through */\r\n default:\r\n return undefined;\r\n }\r\n\r\n const colorTextures: TextureHandle[] = [];\r\n\r\n // Check if the system can render to a depth texture without a renderable color texture bound as well.\r\n // If it cannot, add a renderable color texture to the framebuffer.\r\n // MacOS Safari exhibited this behavior, which necessitated this code path.\r\n if (!System.instance.capabilities.canRenderDepthWithoutColor) {\r\n const colTex = TextureHandle.createForAttachment(shadowMapWidth, shadowMapHeight, GL.Texture.Format.Rgba, pixelDataType);\r\n if (undefined === colTex)\r\n return undefined;\r\n colorTextures.push(colTex);\r\n }\r\n\r\n const fbo = FrameBuffer.create(colorTextures, depthTextureHandle);\r\n if (undefined === fbo)\r\n return undefined;\r\n\r\n // shadowMap texture is 1/4 size the depth texture (and averaged down when converting)\r\n const shadowMapTextureHandle = TextureHandle.createForAttachment(evsmWidth, evsmHeight, GL.Texture.Format.Rgba, pixelDataType);\r\n if (undefined === shadowMapTextureHandle)\r\n return undefined;\r\n\r\n const fboSM = FrameBuffer.create([shadowMapTextureHandle]);\r\n if (undefined === fboSM)\r\n return undefined;\r\n\r\n const depthTexture = new Texture({ ownership: \"external\", type: RenderTexture.Type.TileSection, handle: depthTextureHandle, transparency: TextureTransparency.Opaque });\r\n const evsmGeom = EVSMGeometry.createGeometry(depthTexture.texture.getHandle()!, shadowMapWidth, shadowMapHeight);\r\n if (undefined === evsmGeom)\r\n return undefined;\r\n\r\n const shadowMapTexture = new Texture({ type: RenderTexture.Type.Normal, ownership: \"external\", handle: shadowMapTextureHandle, transparency: TextureTransparency.Opaque });\r\n const renderCommands = new RenderCommands(target, stack, batch);\r\n return new Bundle(depthTexture, shadowMapTexture, fbo, fboSM, evsmGeom, renderCommands);\r\n }\r\n\r\n public get isDisposed(): boolean {\r\n return this.depthTexture.isDisposed\r\n && this.shadowMapTexture.isDisposed\r\n && this.fbo.isDisposed\r\n && this.fboSM.isDisposed\r\n && this.evsmGeom.isDisposed;\r\n }\r\n\r\n public dispose(): void {\r\n dispose(this.depthTexture);\r\n dispose(this.shadowMapTexture);\r\n dispose(this.fbo);\r\n dispose(this.fboSM);\r\n dispose(this.evsmGeom);\r\n }\r\n}\r\n\r\n/** Describes the set of parameters which, when they change, require us to recreate the shadow map. */\r\nclass ShadowMapParams {\r\n public readonly direction = new Vector3d();\r\n public readonly viewFrustum = new Frustum();\r\n public settings: SolarShadowSettings;\r\n\r\n public constructor(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings) {\r\n direction.clone(this.direction);\r\n this.viewFrustum.setFrom(viewFrustum);\r\n this.settings = settings;\r\n }\r\n\r\n public update(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings): void {\r\n this.settings = settings;\r\n this.viewFrustum.setFrom(viewFrustum);\r\n direction.clone(this.direction);\r\n }\r\n}\r\n\r\nconst defaultSunDirection = Vector3d.create(-1, -1, -1).normalize()!;\r\nconst scratchFrustum = new Frustum();\r\nconst scratchFrustumPlanes = new FrustumPlanes();\r\n\r\nexport class SolarShadowMap implements RenderMemory.Consumer, WebGLDisposable {\r\n private _bundle?: Bundle;\r\n private _projectionMatrix = Matrix4d.createIdentity();\r\n private _graphics: RenderGraphic[] = [];\r\n private _shadowFrustum = new Frustum();\r\n private _isReady = false;\r\n private _isDrawing = false;\r\n private _enabled = false;\r\n private _params?: ShadowMapParams;\r\n private readonly _scratchRange = Range3d.createNull();\r\n private readonly _scratchTransform = Transform.createIdentity();\r\n\r\n private readonly _scratchViewFlags = new ViewFlags();\r\n private readonly _renderState: RenderState;\r\n private readonly _noZRenderState: RenderState;\r\n private readonly _batchState: BatchState;\r\n private _worldToViewMap = Map4d.createIdentity();\r\n private readonly _target: Target;\r\n\r\n // This exists chiefly for debugging. See ToggleShadowMapTilesTool.\r\n public onGraphicsChanged?: (graphics: RenderGraphic[]) => void;\r\n\r\n private getBundle(target: Target): Bundle | undefined {\r\n if (undefined === this._bundle) {\r\n this._bundle = Bundle.create(target, target.uniforms.branch.stack, this._batchState);\r\n assert(undefined !== this._bundle);\r\n }\r\n\r\n return this._bundle;\r\n }\r\n\r\n public get isReady() { return this._isReady; }\r\n public get isDrawing() { return this._isDrawing; }\r\n public get isEnabled() { return this._enabled; }\r\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\r\n public get depthTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.depthTexture : undefined; }\r\n public get shadowMapTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.shadowMapTexture : undefined; }\r\n public get settings(): SolarShadowSettings | undefined { return undefined !== this._params ? this._params.settings : undefined; }\r\n public get direction(): Vector3d | undefined { return undefined !== this._params ? this._params.direction : undefined; }\r\n public get frustum(): Frustum { return this._shadowFrustum; }\r\n public get worldToViewMap(): Map4d { return this._worldToViewMap; }\r\n public addGraphic(graphic: RenderGraphic) { this._graphics.push(graphic); }\r\n\r\n public constructor(target: Target) {\r\n this._target = target;\r\n this._renderState = new RenderState();\r\n this._renderState.flags.depthMask = true;\r\n this._renderState.flags.blend = false;\r\n this._renderState.flags.depthTest = true;\r\n\r\n this._noZRenderState = new RenderState();\r\n this._noZRenderState.flags.depthMask = false;\r\n\r\n this._batchState = new BatchState(target.uniforms.branch.stack);\r\n }\r\n\r\n public disable() {\r\n this._enabled = this._isReady = false;\r\n this._bundle = dispose(this._bundle);\r\n this.clearGraphics(true);\r\n this._target.uniforms.shadow.update();\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n const bundle = this._bundle;\r\n if (undefined !== bundle)\r\n stats.addShadowMap(bundle.depthTexture.bytesUsed + bundle.shadowMapTexture.bytesUsed);\r\n }\r\n\r\n public get isDisposed(): boolean { return undefined === this._bundle && 0 === this._graphics.length; }\r\n\r\n public dispose() {\r\n this._bundle = dispose(this._bundle);\r\n this.clearGraphics(true);\r\n }\r\n\r\n private clearGraphics(notify: boolean) {\r\n for (const graphic of this._graphics)\r\n graphic.dispose();\r\n\r\n this._graphics.length = 0;\r\n if (notify)\r\n this.notifyGraphicsChanged();\r\n }\r\n\r\n private notifyGraphicsChanged(): void {\r\n if (undefined !== this.onGraphicsChanged)\r\n this.onGraphicsChanged(this._graphics);\r\n }\r\n\r\n public update(context: SceneContext | undefined) {\r\n this._isReady = false;\r\n this.clearGraphics(false);\r\n\r\n if (undefined === context || !context.viewport.view.isSpatialView()) {\r\n this.disable();\r\n this.notifyGraphicsChanged();\r\n return;\r\n }\r\n\r\n const view = context.viewport.view;\r\n const style = view.getDisplayStyle3d();\r\n let sunDirection = style.sunDirection;\r\n if (undefined === sunDirection)\r\n sunDirection = defaultSunDirection;\r\n\r\n const minimumHorizonDirection = -.01;\r\n if (sunDirection.z > minimumHorizonDirection) {\r\n this.notifyGraphicsChanged();\r\n return;\r\n }\r\n\r\n this._enabled = true;\r\n const viewFrustum = context.viewingSpace.getFrustum();\r\n const settings = style.settings.solarShadows;\r\n if (undefined === this._params)\r\n this._params = new ShadowMapParams(viewFrustum, sunDirection, settings);\r\n else\r\n this._params.update(viewFrustum, sunDirection, settings);\r\n\r\n const iModel = view.iModel;\r\n\r\n const worldToMapTransform = Transform.createRefs(Point3d.createZero(), Matrix3d.createRigidHeadsUp(this._params.direction.negate()).inverse()!);\r\n const worldToMap = Matrix4d.createTransform(worldToMapTransform);\r\n const mapToWorld = worldToMap.createInverse()!;\r\n\r\n // Start with entire project.\r\n const shadowRange = worldToMapTransform.multiplyRange(iModel.projectExtents);\r\n\r\n // Limit the map to only displayed models.\r\n const viewTileRange = Range3d.createNull();\r\n view.forEachTileTreeRef((ref) => {\r\n if (ref.castsShadows)\r\n ref.accumulateTransformedRange(viewTileRange, worldToMap, undefined);\r\n });\r\n\r\n if (!viewTileRange.isNull)\r\n viewTileRange.clone(shadowRange);\r\n\r\n // Expand shadow range to include both the shadowers and shadowed portion of background map.\r\n scratchFrustum.initFromRange(shadowRange);\r\n mapToWorld.multiplyPoint3dArrayQuietNormalize(scratchFrustum.points); // This frustum represents the shadwowing geometry. Intersect it with background geometry and expand the range depth to include that intersection.\r\n const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();\r\n if (undefined !== backgroundMapGeometry) {\r\n const backgroundDepthRange = backgroundMapGeometry.getFrustumIntersectionDepthRange(this._shadowFrustum);\r\n if (!backgroundDepthRange.isNull)\r\n shadowRange.low.z = Math.min(shadowRange.low.z, backgroundDepthRange.low);\r\n }\r\n\r\n this._params.viewFrustum.transformBy(worldToMapTransform, scratchFrustum);\r\n scratchFrustumPlanes.init(scratchFrustum);\r\n\r\n const viewIntersectShadowRange = Range3d.createNull();\r\n const viewClipPlanes = ConvexClipPlaneSet.createPlanes(scratchFrustumPlanes.planes!);\r\n ClipUtilities.announceLoopsOfConvexClipPlaneSetIntersectRange(viewClipPlanes, shadowRange, (points: GrowableXYZArray) => {\r\n for (const point of points.getPoint3dArray())\r\n viewIntersectShadowRange.extendPoint(point);\r\n });\r\n if (viewIntersectShadowRange.isNull) {\r\n this.notifyGraphicsChanged();\r\n return;\r\n }\r\n viewIntersectShadowRange.high.z = shadowRange.high.z; // We need to include shadowing geometry that may be outside view (along the solar axis).\r\n\r\n this._shadowFrustum.initFromRange(viewIntersectShadowRange);\r\n mapToWorld.multiplyPoint3dArrayQuietNormalize(this._shadowFrustum.points);\r\n\r\n const tileRange = Range3d.createNull();\r\n scratchFrustumPlanes.init(this._shadowFrustum);\r\n view.forEachTileTreeRef(((ref) => {\r\n if (!ref.castsShadows)\r\n return;\r\n\r\n const drawArgs = createDrawArgs(context, this, ref, scratchFrustumPlanes, (tiles: Tile[]) => {\r\n for (const tile of tiles)\r\n tileRange.extendRange(tileToMapTransform.multiplyRange(tile.range, this._scratchRange));\r\n });\r\n\r\n if (undefined === drawArgs)\r\n return;\r\n\r\n const tileToMapTransform = worldToMapTransform.multiplyTransformTransform(drawArgs.location, this._scratchTransform);\r\n drawArgs.tree.draw(drawArgs);\r\n }));\r\n\r\n if (tileRange.isNull) {\r\n this.clearGraphics(true);\r\n } else if (this._graphics.length > 0) {\r\n // Avoid an uninvertible matrix on empty range...\r\n if (Geometry.isAlmostEqualNumber(shadowRange.low.x, shadowRange.high.x) ||\r\n Geometry.isAlmostEqualNumber(shadowRange.low.y, shadowRange.high.y) ||\r\n Geometry.isAlmostEqualNumber(shadowRange.low.z, shadowRange.high.z)) {\r\n this.clearGraphics(true);\r\n return;\r\n }\r\n\r\n const frustumMap = this._shadowFrustum.toMap4d();\r\n if (undefined === frustumMap) {\r\n this.clearGraphics(true);\r\n assert(false);\r\n return;\r\n }\r\n\r\n this._projectionMatrix = frustumMap.transform0.clone();\r\n\r\n const worldToNpc = postProjectionMatrixNpc.multiplyMatrixMatrix(this._projectionMatrix);\r\n const npcToView = Map4d.createBoxMap(Point3d.create(0, 0, 0), Point3d.create(1, 1, 1), Point3d.create(0, 0, 0), Point3d.create(shadowMapWidth, shadowMapHeight, 1))!;\r\n const npcToWorld = worldToNpc.createInverse();\r\n if (undefined === npcToWorld) {\r\n this.clearGraphics(true);\r\n return;\r\n }\r\n\r\n const worldToNpcMap = Map4d.createRefs(worldToNpc, npcToWorld);\r\n this._worldToViewMap = npcToView.multiplyMapMap(worldToNpcMap);\r\n }\r\n\r\n this._target.uniforms.shadow.update();\r\n this.notifyGraphicsChanged();\r\n }\r\n\r\n public draw(target: Target) {\r\n assert(this.isEnabled);\r\n\r\n if (this.isReady || 0 === this._graphics.length)\r\n return;\r\n\r\n const bundle = this.getBundle(target);\r\n if (undefined === bundle)\r\n return;\r\n\r\n this._isDrawing = true;\r\n\r\n const prevState = System.instance.currentRenderState.clone();\r\n const gl = System.instance.context;\r\n gl.viewport(0, 0, shadowMapWidth, shadowMapHeight);\r\n\r\n // NB: textures and materials are needed because their transparencies affect whether or not a surface casts shadows\r\n const viewFlags = target.currentViewFlags.copy({\r\n renderMode: RenderMode.SmoothShade,\r\n wiremesh: false,\r\n transparency: false,\r\n lighting: false,\r\n shadows: false,\r\n monochrome: false,\r\n ambientOcclusion: false,\r\n visibleEdges: false,\r\n hiddenEdges: false,\r\n });\r\n\r\n System.instance.applyRenderState(this._renderState);\r\n const prevPlan = target.plan;\r\n\r\n target.changeFrustum(this._shadowFrustum, this._shadowFrustum.getFraction(), true);\r\n target.uniforms.branch.changeRenderPlan(viewFlags, target.plan.is3d, target.plan.hline);\r\n\r\n const renderCommands = bundle.renderCommands;\r\n renderCommands.reset(target, target.uniforms.branch.stack, this._batchState);\r\n renderCommands.addGraphics(this._graphics);\r\n\r\n System.instance.frameBufferStack.execute(bundle.fbo, true, false, () => {\r\n System.instance.context.clearDepth(1.0);\r\n System.instance.context.clear(GL.BufferBit.Depth);\r\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaquePlanar), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\r\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaqueGeneral), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\r\n });\r\n\r\n // copy depth buffer to EVSM shadow buffer and average down for AA effect\r\n gl.viewport(0, 0, evsmWidth, evsmHeight);\r\n System.instance.frameBufferStack.execute(bundle.fboSM, true, false, () => {\r\n System.instance.applyRenderState(this._noZRenderState);\r\n const params = getDrawParams(target, bundle.evsmGeom);\r\n target.techniques.draw(params);\r\n });\r\n\r\n // mipmap resulting EVSM texture and set filtering options\r\n System.instance.activateTexture2d(TextureUnit.ShadowMap, bundle.shadowMapTexture.texture.getHandle());\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n const fullFloat = System.instance.capabilities.maxRenderType === RenderType.TextureFloat;\r\n if (fullFloat && System.instance.capabilities.supportsTextureFloatLinear || !fullFloat && System.instance.capabilities.supportsTextureHalfFloatLinear) {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n }\r\n\r\n System.instance.setMaxAnisotropy(undefined);\r\n // target.recordPerformanceMetric(\"Compute EVSM\");\r\n\r\n this._batchState.reset(); // Reset the batch Ids...\r\n target.changeRenderPlan(prevPlan);\r\n\r\n System.instance.applyRenderState(prevState);\r\n System.instance.context.viewport(0, 0, target.viewRect.width, target.viewRect.height); // Restore viewport\r\n this.clearGraphics(false);\r\n this._isDrawing = false;\r\n this._isReady = true;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"SolarShadowMap.js","sourceRoot":"","sources":["../../../../src/render/webgl/SolarShadowMap.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAsD;AACtD,wDAAuK;AACvK,oDAE4B;AAC5B,oEAAwD;AACxD,kDAA4F;AAK5F,6CAA0C;AAC1C,qDAAgD;AAEhD,+CAA4C;AAC5C,6BAA0B;AAC1B,qDAAkD;AAClD,+CAAwD;AACxD,+CAA4C;AAC5C,2DAAoD;AACpD,qCAAkC;AAElC,uCAAmD;AAInD,SAAS,cAAc,CAAC,YAA0B,EAAE,cAA8B,EAAE,IAAuB,EAAE,aAA4B,EAAE,YAA0B;IACnK,MAAM,sBAAuB,SAAQ,uBAAY;QAI/C,YAAoB,iBAAgC,EAAU,UAA0B,EAAE,IAAkB,EAAE,OAAqB;YACjI,KAAK,CAAC,IAAI,CAAC,CAAC;YADM,sBAAiB,GAAjB,iBAAiB,CAAe;YAAU,eAAU,GAAV,UAAU,CAAgB;YAEtF,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAC/B,CAAC;QAED,iIAAiI;QACjI,iEAAiE;QACjE,IAAoB,4BAA4B,KAAyB,OAAO,GAAG,CAAC,CAAC,CAAC;QAEtE,oBAAoB,CAAC,KAAa;YAChD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;QAED,IAAoB,aAAa;YAC/B,IAAI,IAAI,KAAK,IAAI,CAAC,eAAe;gBAC/B,OAAO,KAAK,CAAC,aAAa,CAAC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C,oBAAoB,CAAC,CAAC;YAChF,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;SACnE;QAED,eAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,kDAAkD;QAElD,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAG,yBAAyB;QACrD,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAElC,eAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,eAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;QAC1G,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACvB,CAAC;CACF;AAxSD,wCAwSC","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\r\n/** @packageDocumentation\r\n * @module WebGL\r\n */\r\n\r\nimport { assert, dispose } from \"@itwin/core-bentley\";\r\nimport { ClipUtilities, ConvexClipPlaneSet, Geometry, GrowableXYZArray, Map4d, Matrix3d, Matrix4d, Point3d, Range3d, Transform, Vector3d } from \"@itwin/core-geometry\";\r\nimport {\r\n Frustum, FrustumPlanes, RenderMode, RenderTexture, SolarShadowSettings, TextureTransparency, ViewFlags,\r\n} from \"@itwin/core-common\";\r\nimport { RenderType } from \"@itwin/webgl-compatibility\";\r\nimport { Tile, TileDrawArgs, TileTreeReference, TileVisibility } from \"../../tile/internal\";\r\nimport { SceneContext } from \"../../ViewContext\";\r\nimport { RenderGraphic } from \"../RenderGraphic\";\r\nimport { RenderMemory } from \"../RenderMemory\";\r\nimport { BranchStack } from \"./BranchStack\";\r\nimport { BatchState } from \"./BatchState\";\r\nimport { EVSMGeometry } from \"./CachedGeometry\";\r\nimport { WebGLDisposable } from \"./Disposable\";\r\nimport { FrameBuffer } from \"./FrameBuffer\";\r\nimport { GL } from \"./GL\";\r\nimport { RenderCommands } from \"./RenderCommands\";\r\nimport { RenderPass, TextureUnit } from \"./RenderFlags\";\r\nimport { RenderState } from \"./RenderState\";\r\nimport { getDrawParams } from \"./ScratchDrawParams\";\r\nimport { System } from \"./System\";\r\nimport { Target } from \"./Target\";\r\nimport { Texture, TextureHandle } from \"./Texture\";\r\n\r\ntype ProcessTiles = (tiles: Tile[]) => void;\r\n\r\nfunction createDrawArgs(sceneContext: SceneContext, solarShadowMap: SolarShadowMap, tree: TileTreeReference, frustumPlanes: FrustumPlanes, processTiles: ProcessTiles): TileDrawArgs | undefined {\r\n class SolarShadowMapDrawArgs extends TileDrawArgs {\r\n private _useViewportMap?: boolean;\r\n private readonly _processTiles: ProcessTiles;\r\n\r\n constructor(private _mapFrustumPlanes: FrustumPlanes, private _shadowMap: SolarShadowMap, args: TileDrawArgs, process: ProcessTiles) {\r\n super(args);\r\n this._processTiles = process;\r\n }\r\n\r\n // The solar shadow projection is parallel - which can cause excessive tile selection if it is along an axis of an unbounded tile\r\n // tree such as the OSM buildings. Rev limit the selection here.\r\n public override get maxRealityTreeSelectionCount(): undefined | number { return 500; }\r\n\r\n public override processSelectedTiles(tiles: Tile[]): void {\r\n this._processTiles(tiles);\r\n }\r\n\r\n public override get frustumPlanes(): FrustumPlanes {\r\n if (true === this._useViewportMap)\r\n return super.frustumPlanes;\r\n else\r\n return this._mapFrustumPlanes;\r\n }\r\n\r\n public override get worldToViewMap(): Map4d {\r\n if (true === this._useViewportMap)\r\n return super.worldToViewMap;\r\n else\r\n return this._shadowMap.worldToViewMap;\r\n }\r\n\r\n public override drawGraphics(): void {\r\n const graphics = this.produceGraphics();\r\n if (graphics)\r\n this._shadowMap.addGraphic(graphics);\r\n }\r\n\r\n public override getPixelSize(tile: Tile): number {\r\n // For tiles that are part of the scene, size them based on the viewport frustum so that shadow map uses same resolution tiles as scene\r\n // - otherwise artifacts like shadow acne may result.\r\n // For tiles that are NOT part of the scene, size them based on the shadow frustum, not the viewport frustum\r\n // - otherwise excessive numbers of excessively detailed may be requested for the shadow map.\r\n if (undefined === this._useViewportMap) {\r\n this._useViewportMap = true;\r\n const vis = tile.computeVisibility(this);\r\n this._useViewportMap = TileVisibility.OutsideFrustum !== vis;\r\n }\r\n\r\n const size = super.getPixelSize(tile);\r\n this._useViewportMap = undefined;\r\n return size;\r\n }\r\n\r\n public static create(context: SceneContext, shadowMap: SolarShadowMap, tileTree: TileTreeReference, planes: FrustumPlanes, process: ProcessTiles) {\r\n const args = tileTree.createDrawArgs(context);\r\n return undefined !== args ? new SolarShadowMapDrawArgs(planes, shadowMap, args, process) : undefined;\r\n }\r\n }\r\n\r\n return SolarShadowMapDrawArgs.create(sceneContext, solarShadowMap, tree, frustumPlanes, processTiles);\r\n}\r\n\r\nconst shadowMapWidth = 4096; // size of original depth buffer map\r\nconst shadowMapHeight = shadowMapWidth; // TBD - Adjust for aspect ratio.\r\nconst evsmWidth = shadowMapWidth / 2; // EVSM buffer is 1/2 size each direction\r\nconst evsmHeight = shadowMapHeight / 2;\r\nconst postProjectionMatrixNpc = Matrix4d.createRowValues(/* Row 1 */ 0, 1, 0, 0, /* Row 1 */ 0, 0, 1, 0, /* Row 3 */ 1, 0, 0, 0, /* Row 4 */ 0, 0, 0, 1);\r\n\r\n// Bundles up the disposable, create-once-and-reuse members of a SolarShadowMap.\r\nclass Bundle implements WebGLDisposable {\r\n private constructor(\r\n public readonly depthTexture: Texture,\r\n public readonly shadowMapTexture: Texture,\r\n public readonly fbo: FrameBuffer,\r\n public readonly fboSM: FrameBuffer,\r\n public readonly evsmGeom: EVSMGeometry,\r\n public readonly renderCommands: RenderCommands) {\r\n }\r\n\r\n public static create(target: Target, stack: BranchStack, batch: BatchState): Bundle | undefined {\r\n const depthTextureHandle = System.instance.createDepthBuffer(shadowMapWidth, shadowMapHeight) as TextureHandle;\r\n if (undefined === depthTextureHandle)\r\n return undefined;\r\n\r\n let pixelDataType = GL.Texture.DataType.Float;\r\n switch (System.instance.capabilities.maxRenderType) {\r\n case RenderType.TextureFloat:\r\n break;\r\n case RenderType.TextureHalfFloat:\r\n if (System.instance.capabilities.isWebGL2) {\r\n pixelDataType = (System.instance.context as WebGL2RenderingContext).HALF_FLOAT;\r\n break;\r\n } else {\r\n const exthf = System.instance.capabilities.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\");\r\n if (undefined !== exthf) {\r\n pixelDataType = exthf.HALF_FLOAT_OES;\r\n break;\r\n }\r\n }\r\n /* falls through */\r\n default:\r\n return undefined;\r\n }\r\n\r\n const colorTextures: TextureHandle[] = [];\r\n\r\n // Check if the system can render to a depth texture without a renderable color texture bound as well.\r\n // If it cannot, add a renderable color texture to the framebuffer.\r\n // MacOS Safari exhibited this behavior, which necessitated this code path.\r\n if (!System.instance.capabilities.canRenderDepthWithoutColor) {\r\n const colTex = TextureHandle.createForAttachment(shadowMapWidth, shadowMapHeight, GL.Texture.Format.Rgba, pixelDataType);\r\n if (undefined === colTex)\r\n return undefined;\r\n colorTextures.push(colTex);\r\n }\r\n\r\n const fbo = FrameBuffer.create(colorTextures, depthTextureHandle);\r\n if (undefined === fbo)\r\n return undefined;\r\n\r\n // shadowMap texture is 1/4 size the depth texture (and averaged down when converting)\r\n const shadowMapTextureHandle = TextureHandle.createForAttachment(evsmWidth, evsmHeight, GL.Texture.Format.Rgba, pixelDataType);\r\n if (undefined === shadowMapTextureHandle)\r\n return undefined;\r\n\r\n const fboSM = FrameBuffer.create([shadowMapTextureHandle]);\r\n if (undefined === fboSM)\r\n return undefined;\r\n\r\n const depthTexture = new Texture({ ownership: \"external\", type: RenderTexture.Type.TileSection, handle: depthTextureHandle, transparency: TextureTransparency.Opaque });\r\n const evsmGeom = EVSMGeometry.createGeometry(depthTexture.texture.getHandle()!, shadowMapWidth, shadowMapHeight);\r\n if (undefined === evsmGeom)\r\n return undefined;\r\n\r\n const shadowMapTexture = new Texture({ type: RenderTexture.Type.Normal, ownership: \"external\", handle: shadowMapTextureHandle, transparency: TextureTransparency.Opaque });\r\n const renderCommands = new RenderCommands(target, stack, batch);\r\n return new Bundle(depthTexture, shadowMapTexture, fbo, fboSM, evsmGeom, renderCommands);\r\n }\r\n\r\n public get isDisposed(): boolean {\r\n return this.depthTexture.isDisposed\r\n && this.shadowMapTexture.isDisposed\r\n && this.fbo.isDisposed\r\n && this.fboSM.isDisposed\r\n && this.evsmGeom.isDisposed;\r\n }\r\n\r\n public dispose(): void {\r\n dispose(this.depthTexture);\r\n dispose(this.shadowMapTexture);\r\n dispose(this.fbo);\r\n dispose(this.fboSM);\r\n dispose(this.evsmGeom);\r\n }\r\n}\r\n\r\n/** Describes the set of parameters which, when they change, require us to recreate the shadow map. */\r\nclass ShadowMapParams {\r\n public readonly direction = new Vector3d();\r\n public readonly viewFrustum = new Frustum();\r\n public settings: SolarShadowSettings;\r\n\r\n public constructor(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings) {\r\n direction.clone(this.direction);\r\n this.viewFrustum.setFrom(viewFrustum);\r\n this.settings = settings;\r\n }\r\n\r\n public update(viewFrustum: Frustum, direction: Vector3d, settings: SolarShadowSettings): void {\r\n this.settings = settings;\r\n this.viewFrustum.setFrom(viewFrustum);\r\n direction.clone(this.direction);\r\n }\r\n}\r\n\r\nconst defaultSunDirection = Vector3d.create(-1, -1, -1).normalize()!;\r\nconst scratchFrustum = new Frustum();\r\nconst scratchFrustumPlanes = new FrustumPlanes();\r\n\r\nexport class SolarShadowMap implements RenderMemory.Consumer, WebGLDisposable {\r\n private _bundle?: Bundle;\r\n private _projectionMatrix = Matrix4d.createIdentity();\r\n private _graphics: RenderGraphic[] = [];\r\n private _shadowFrustum = new Frustum();\r\n private _isReady = false;\r\n private _isDrawing = false;\r\n private _enabled = false;\r\n private _params?: ShadowMapParams;\r\n private readonly _scratchRange = Range3d.createNull();\r\n private readonly _scratchTransform = Transform.createIdentity();\r\n\r\n private readonly _scratchViewFlags = new ViewFlags();\r\n private readonly _renderState: RenderState;\r\n private readonly _noZRenderState: RenderState;\r\n private readonly _batchState: BatchState;\r\n private _worldToViewMap = Map4d.createIdentity();\r\n private readonly _target: Target;\r\n\r\n // This exists chiefly for debugging. See ToggleShadowMapTilesTool.\r\n public onGraphicsChanged?: (graphics: RenderGraphic[]) => void;\r\n\r\n private getBundle(target: Target): Bundle | undefined {\r\n if (undefined === this._bundle) {\r\n this._bundle = Bundle.create(target, target.uniforms.branch.stack, this._batchState);\r\n assert(undefined !== this._bundle);\r\n }\r\n\r\n return this._bundle;\r\n }\r\n\r\n public get isReady() { return this._isReady; }\r\n public get isDrawing() { return this._isDrawing; }\r\n public get isEnabled() { return this._enabled; }\r\n public get projectionMatrix(): Matrix4d { return this._projectionMatrix; }\r\n public get depthTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.depthTexture : undefined; }\r\n public get shadowMapTexture(): Texture | undefined { return undefined !== this._bundle ? this._bundle.shadowMapTexture : undefined; }\r\n public get settings(): SolarShadowSettings | undefined { return undefined !== this._params ? this._params.settings : undefined; }\r\n public get direction(): Vector3d | undefined { return undefined !== this._params ? this._params.direction : undefined; }\r\n public get frustum(): Frustum { return this._shadowFrustum; }\r\n public get worldToViewMap(): Map4d { return this._worldToViewMap; }\r\n public addGraphic(graphic: RenderGraphic) { this._graphics.push(graphic); }\r\n\r\n public constructor(target: Target) {\r\n this._target = target;\r\n this._renderState = new RenderState();\r\n this._renderState.flags.depthMask = true;\r\n this._renderState.flags.blend = false;\r\n this._renderState.flags.depthTest = true;\r\n\r\n this._noZRenderState = new RenderState();\r\n this._noZRenderState.flags.depthMask = false;\r\n\r\n this._batchState = new BatchState(target.uniforms.branch.stack);\r\n }\r\n\r\n public disable() {\r\n this._enabled = this._isReady = false;\r\n this._bundle = dispose(this._bundle);\r\n this.clearGraphics(true);\r\n this._target.uniforms.shadow.update();\r\n }\r\n\r\n public collectStatistics(stats: RenderMemory.Statistics): void {\r\n const bundle = this._bundle;\r\n if (undefined !== bundle)\r\n stats.addShadowMap(bundle.depthTexture.bytesUsed + bundle.shadowMapTexture.bytesUsed);\r\n }\r\n\r\n public get isDisposed(): boolean { return undefined === this._bundle && 0 === this._graphics.length; }\r\n\r\n public dispose() {\r\n this._bundle = dispose(this._bundle);\r\n this.clearGraphics(true);\r\n }\r\n\r\n private clearGraphics(notify: boolean) {\r\n for (const graphic of this._graphics)\r\n graphic.dispose();\r\n\r\n this._graphics.length = 0;\r\n if (notify)\r\n this.notifyGraphicsChanged();\r\n }\r\n\r\n private notifyGraphicsChanged(): void {\r\n if (undefined !== this.onGraphicsChanged)\r\n this.onGraphicsChanged(this._graphics);\r\n }\r\n\r\n public update(context: SceneContext | undefined) {\r\n this._isReady = false;\r\n this.clearGraphics(false);\r\n\r\n if (undefined === context || !context.viewport.view.isSpatialView()) {\r\n this.disable();\r\n this.notifyGraphicsChanged();\r\n return;\r\n }\r\n\r\n const view = context.viewport.view;\r\n const style = view.getDisplayStyle3d();\r\n let sunDirection = style.sunDirection;\r\n if (undefined === sunDirection)\r\n sunDirection = defaultSunDirection;\r\n\r\n const minimumHorizonDirection = -.01;\r\n if (sunDirection.z > minimumHorizonDirection) {\r\n this.notifyGraphicsChanged();\r\n return;\r\n }\r\n\r\n this._enabled = true;\r\n const viewFrustum = context.viewingSpace.getFrustum();\r\n const settings = style.settings.solarShadows;\r\n if (undefined === this._params)\r\n this._params = new ShadowMapParams(viewFrustum, sunDirection, settings);\r\n else\r\n this._params.update(viewFrustum, sunDirection, settings);\r\n\r\n const iModel = view.iModel;\r\n\r\n const worldToMapTransform = Transform.createRefs(Point3d.createZero(), Matrix3d.createRigidHeadsUp(this._params.direction.negate()).inverse()!);\r\n const worldToMap = Matrix4d.createTransform(worldToMapTransform);\r\n const mapToWorld = worldToMap.createInverse()!;\r\n\r\n // Start with entire project.\r\n const shadowRange = worldToMapTransform.multiplyRange(iModel.projectExtents);\r\n\r\n // Limit the map to only displayed models.\r\n const viewTileRange = Range3d.createNull();\r\n view.forEachTileTreeRef((ref) => {\r\n if (ref.castsShadows)\r\n ref.accumulateTransformedRange(viewTileRange, worldToMap, undefined);\r\n });\r\n\r\n if (!viewTileRange.isNull)\r\n viewTileRange.clone(shadowRange);\r\n\r\n // Expand shadow range to include both the shadowers and shadowed portion of background map.\r\n scratchFrustum.initFromRange(shadowRange);\r\n mapToWorld.multiplyPoint3dArrayQuietNormalize(scratchFrustum.points); // This frustum represents the shadwowing geometry. Intersect it with background geometry and expand the range depth to include that intersection.\r\n const backgroundMapGeometry = context.viewport.view.displayStyle.getBackgroundMapGeometry();\r\n if (undefined !== backgroundMapGeometry) {\r\n const backgroundDepthRange = backgroundMapGeometry.getFrustumIntersectionDepthRange(this._shadowFrustum, iModel.projectExtents);\r\n if (!backgroundDepthRange.isNull)\r\n shadowRange.low.z = Math.min(shadowRange.low.z, backgroundDepthRange.low);\r\n }\r\n\r\n this._params.viewFrustum.transformBy(worldToMapTransform, scratchFrustum);\r\n scratchFrustumPlanes.init(scratchFrustum);\r\n\r\n const viewIntersectShadowRange = Range3d.createNull();\r\n const viewClipPlanes = ConvexClipPlaneSet.createPlanes(scratchFrustumPlanes.planes!);\r\n ClipUtilities.announceLoopsOfConvexClipPlaneSetIntersectRange(viewClipPlanes, shadowRange, (points: GrowableXYZArray) => {\r\n for (const point of points.getPoint3dArray())\r\n viewIntersectShadowRange.extendPoint(point);\r\n });\r\n if (viewIntersectShadowRange.isNull) {\r\n this.notifyGraphicsChanged();\r\n return;\r\n }\r\n viewIntersectShadowRange.high.z = shadowRange.high.z; // We need to include shadowing geometry that may be outside view (along the solar axis).\r\n\r\n this._shadowFrustum.initFromRange(viewIntersectShadowRange);\r\n mapToWorld.multiplyPoint3dArrayQuietNormalize(this._shadowFrustum.points);\r\n\r\n const tileRange = Range3d.createNull();\r\n scratchFrustumPlanes.init(this._shadowFrustum);\r\n view.forEachTileTreeRef(((ref) => {\r\n if (!ref.castsShadows)\r\n return;\r\n\r\n const drawArgs = createDrawArgs(context, this, ref, scratchFrustumPlanes, (tiles: Tile[]) => {\r\n for (const tile of tiles)\r\n tileRange.extendRange(tileToMapTransform.multiplyRange(tile.range, this._scratchRange));\r\n });\r\n\r\n if (undefined === drawArgs)\r\n return;\r\n\r\n const tileToMapTransform = worldToMapTransform.multiplyTransformTransform(drawArgs.location, this._scratchTransform);\r\n drawArgs.tree.draw(drawArgs);\r\n }));\r\n\r\n if (tileRange.isNull) {\r\n this.clearGraphics(true);\r\n } else if (this._graphics.length > 0) {\r\n // Avoid an uninvertible matrix on empty range...\r\n if (Geometry.isAlmostEqualNumber(shadowRange.low.x, shadowRange.high.x) ||\r\n Geometry.isAlmostEqualNumber(shadowRange.low.y, shadowRange.high.y) ||\r\n Geometry.isAlmostEqualNumber(shadowRange.low.z, shadowRange.high.z)) {\r\n this.clearGraphics(true);\r\n return;\r\n }\r\n\r\n const frustumMap = this._shadowFrustum.toMap4d();\r\n if (undefined === frustumMap) {\r\n this.clearGraphics(true);\r\n assert(false);\r\n return;\r\n }\r\n\r\n this._projectionMatrix = frustumMap.transform0.clone();\r\n\r\n const worldToNpc = postProjectionMatrixNpc.multiplyMatrixMatrix(this._projectionMatrix);\r\n const npcToView = Map4d.createBoxMap(Point3d.create(0, 0, 0), Point3d.create(1, 1, 1), Point3d.create(0, 0, 0), Point3d.create(shadowMapWidth, shadowMapHeight, 1))!;\r\n const npcToWorld = worldToNpc.createInverse();\r\n if (undefined === npcToWorld) {\r\n this.clearGraphics(true);\r\n return;\r\n }\r\n\r\n const worldToNpcMap = Map4d.createRefs(worldToNpc, npcToWorld);\r\n this._worldToViewMap = npcToView.multiplyMapMap(worldToNpcMap);\r\n }\r\n\r\n this._target.uniforms.shadow.update();\r\n this.notifyGraphicsChanged();\r\n }\r\n\r\n public draw(target: Target) {\r\n assert(this.isEnabled);\r\n\r\n if (this.isReady || 0 === this._graphics.length)\r\n return;\r\n\r\n const bundle = this.getBundle(target);\r\n if (undefined === bundle)\r\n return;\r\n\r\n this._isDrawing = true;\r\n\r\n const prevState = System.instance.currentRenderState.clone();\r\n const gl = System.instance.context;\r\n gl.viewport(0, 0, shadowMapWidth, shadowMapHeight);\r\n\r\n // NB: textures and materials are needed because their transparencies affect whether or not a surface casts shadows\r\n const viewFlags = target.currentViewFlags.copy({\r\n renderMode: RenderMode.SmoothShade,\r\n wiremesh: false,\r\n transparency: false,\r\n lighting: false,\r\n shadows: false,\r\n monochrome: false,\r\n ambientOcclusion: false,\r\n visibleEdges: false,\r\n hiddenEdges: false,\r\n });\r\n\r\n System.instance.applyRenderState(this._renderState);\r\n const prevPlan = target.plan;\r\n\r\n target.changeFrustum(this._shadowFrustum, this._shadowFrustum.getFraction(), true);\r\n target.uniforms.branch.changeRenderPlan(viewFlags, target.plan.is3d, target.plan.hline);\r\n\r\n const renderCommands = bundle.renderCommands;\r\n renderCommands.reset(target, target.uniforms.branch.stack, this._batchState);\r\n renderCommands.addGraphics(this._graphics);\r\n\r\n System.instance.frameBufferStack.execute(bundle.fbo, true, false, () => {\r\n System.instance.context.clearDepth(1.0);\r\n System.instance.context.clear(GL.BufferBit.Depth);\r\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaquePlanar), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\r\n target.techniques.execute(target, renderCommands.getCommands(RenderPass.OpaqueGeneral), RenderPass.PlanarClassification); // Draw these with RenderPass.PlanarClassification (rather than Opaque...) so that the pick ordering is avoided.\r\n });\r\n\r\n // copy depth buffer to EVSM shadow buffer and average down for AA effect\r\n gl.viewport(0, 0, evsmWidth, evsmHeight);\r\n System.instance.frameBufferStack.execute(bundle.fboSM, true, false, () => {\r\n System.instance.applyRenderState(this._noZRenderState);\r\n const params = getDrawParams(target, bundle.evsmGeom);\r\n target.techniques.draw(params);\r\n });\r\n\r\n // mipmap resulting EVSM texture and set filtering options\r\n System.instance.activateTexture2d(TextureUnit.ShadowMap, bundle.shadowMapTexture.texture.getHandle());\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n const fullFloat = System.instance.capabilities.maxRenderType === RenderType.TextureFloat;\r\n if (fullFloat && System.instance.capabilities.supportsTextureFloatLinear || !fullFloat && System.instance.capabilities.supportsTextureHalfFloatLinear) {\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\r\n }\r\n\r\n System.instance.setMaxAnisotropy(undefined);\r\n // target.recordPerformanceMetric(\"Compute EVSM\");\r\n\r\n this._batchState.reset(); // Reset the batch Ids...\r\n target.changeRenderPlan(prevPlan);\r\n\r\n System.instance.applyRenderState(prevState);\r\n System.instance.context.viewport(0, 0, target.viewRect.width, target.viewRect.height); // Restore viewport\r\n this.clearGraphics(false);\r\n this._isDrawing = false;\r\n this._isReady = true;\r\n }\r\n}\r\n"]}
|
|
@@ -32,6 +32,7 @@ export * from "./I3dmReader";
|
|
|
32
32
|
export * from "./B3dmReader";
|
|
33
33
|
export * from "./ImdlReader";
|
|
34
34
|
export * from "./map/ArcGISTileMap";
|
|
35
|
+
export * from "./map/MapLayerAuthentication";
|
|
35
36
|
export * from "./map/ArcGisTokenGenerator";
|
|
36
37
|
export * from "./map/ArcGisTokenManager";
|
|
37
38
|
export * from "./map/MapLayerFormatRegistry";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":"AAIA;;GAEG;AAYH,c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AAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
package/lib/cjs/tile/internal.js
CHANGED
|
@@ -57,6 +57,7 @@ __exportStar(require("./I3dmReader"), exports);
|
|
|
57
57
|
__exportStar(require("./B3dmReader"), exports);
|
|
58
58
|
__exportStar(require("./ImdlReader"), exports);
|
|
59
59
|
__exportStar(require("./map/ArcGISTileMap"), exports);
|
|
60
|
+
__exportStar(require("./map/MapLayerAuthentication"), exports);
|
|
60
61
|
__exportStar(require("./map/ArcGisTokenGenerator"), exports);
|
|
61
62
|
__exportStar(require("./map/ArcGisTokenManager"), exports);
|
|
62
63
|
__exportStar(require("./map/MapLayerFormatRegistry"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;AAEH;;;;;;;;GAQG;AAEH,sDAAoC;AACpC,0DAAwC;AACxC,+CAA6B;AAC7B,yDAAuC;AACvC,yCAAuB;AACvB,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B;AAC9B,iDAA+B;AAC/B,wDAAsC;AACtC,sDAAoC;AACpC,qDAAmC;AACnC,mDAAiC;AACjC,6CAA2B;AAC3B,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,sDAAoC;AACpC,0DAAwC;AACxC,8CAA4B;AAC5B,gDAA8B;AAC9B,uDAAqC;AACrC,8DAA4C;AAC5C,wDAAsC;AACtC,oDAAkC;AAClC,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,sDAAoC;AACpC,6DAA2C;AAC3C,2DAAyC;AACzC,+DAA6C;AAC7C,wDAAsC;AACtC,qDAAmC;AACnC,wDAAsC;AACtC,yDAAuC;AACvC,gEAA8C;AAC9C,uFAAqE;AACrE,uFAAqE;AACrE,6EAA2D;AAC3D,oFAAkE;AAClE,gFAA8D;AAC9D,oFAAkE;AAClE,qFAAmE;AACnE,+DAA6C;AAC7C,kEAAgD;AAChD,oDAAkC;AAClC,4DAA0C;AAC1C,8DAA4C;AAC5C,iEAA+C;AAC/C,gDAA8B;AAC9B,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,wDAAsC;AACtC,4DAA0C;AAC1C,+CAA6B;AAC7B,yDAAuC;AACvC,+CAA6B;AAC7B,sDAAoC;AACpC,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,iEAA+C;AAC/C,wDAAsC;AACtC,yDAAuC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/* The order of exports below is based on dependencies between the types in each file.\r\n * For example, IModelTileTree derives from TileTree, so TileTree must be exported first.\r\n * No file inside core-frontend should import from *any* file in /tile/ *except* for this one.\r\n * e.g.:\r\n * import { TileTree } from \"./tile/TileTree\"; // NO...\r\n * import { TileTree } from \"./tile/internal\"; // YES!\r\n * Failure to follow either of these two guidelines is very likely to produce difficult-to-debug run-time errors due\r\n * to circular dependencies.\r\n */\r\n\r\nexport * from \"./ViewFlagOverrides\";\r\nexport * from \"./map/MapCartoRectangle\";\r\nexport * from \"./map/QuadId\";\r\nexport * from \"./DisclosedTileTreeSet\";\r\nexport * from \"./Tile\";\r\nexport * from \"./LRUTileList\";\r\nexport * from \"./RealityTile\";\r\nexport * from \"./TileParams\";\r\nexport * from \"./TileContent\";\r\nexport * from \"./TileDrawArgs\";\r\nexport * from \"./RealityTileDrawArgs\";\r\nexport * from \"./GraphicsCollector\";\r\nexport * from \"./BatchedTileIdMap\";\r\nexport * from \"./TileTreeParams\";\r\nexport * from \"./TileTree\";\r\nexport * from \"./RealityTileTree\";\r\nexport * from \"./TileTreeSupplier\";\r\nexport * from \"./TileTreeOwner\";\r\nexport * from \"./TileTreeReference\";\r\nexport * from \"./TiledGraphicsProvider\";\r\nexport * from \"./TileAdmin\";\r\nexport * from \"./TileRequest\";\r\nexport * from \"./TileRequestChannel\";\r\nexport * from \"./IModelTileRequestChannels\";\r\nexport * from \"./TileRequestChannels\";\r\nexport * from \"./TileUsageMarker\";\r\nexport * from \"./GltfReader\";\r\nexport * from \"./I3dmReader\";\r\nexport * from \"./B3dmReader\";\r\nexport * from \"./ImdlReader\";\r\nexport * from \"./map/ArcGISTileMap\";\r\nexport * from \"./map/ArcGisTokenGenerator\";\r\nexport * from \"./map/ArcGisTokenManager\";\r\nexport * from \"./map/MapLayerFormatRegistry\";\r\nexport * from \"./map/ArcGisUtilities\";\r\nexport * from \"./map/WmsUtilities\";\r\nexport * from \"./map/WmsCapabilities\";\r\nexport * from \"./map/WmtsCapabilities\";\r\nexport * from \"./map/MapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/ArcGISMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/AzureMapsLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/BingImageryProvider\";\r\nexport * from \"./map/ImageryProviders/MapBoxLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/TileUrlImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmsMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmtsMapLayerImageryProvider\";\r\nexport * from \"./map/MapLayerImageryFormats\";\r\nexport * from \"./map/MapLayerTileTreeReference\";\r\nexport * from \"./map/MapTileTree\";\r\nexport * from \"./map/TerrainMeshProvider\";\r\nexport * from \"./map/CesiumTerrainProvider\";\r\nexport * from \"./map/EllipsoidTerrainProvider\";\r\nexport * from \"./map/MapTile\";\r\nexport * from \"./RealityTileLoader\";\r\nexport * from \"./map/MapTileLoader\";\r\nexport * from \"./map/BingElevation\";\r\nexport * from \"./map/MapTilingScheme\";\r\nexport * from \"./map/MapTileAvailability\";\r\nexport * from \"./PntsReader\";\r\nexport * from \"./RealityModelTileTree\";\r\nexport * from \"./IModelTile\";\r\nexport * from \"./DynamicIModelTile\";\r\nexport * from \"./IModelTileTree\";\r\nexport * from \"./PrimaryTileTree\";\r\nexport * from \"./ClassifierTileTree\";\r\nexport * from \"./OrbitGtTileTree\";\r\nexport * from \"./map/ImageryTileTree\";\r\nexport * from \"./map/MapLayerSources\";\r\nexport * from \"./map/MapTiledGraphicsProvider\";\r\nexport * from \"./CesiumAssetProvider\";\r\nexport * from \"./ContextShareProvider\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tile/internal.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;AAEH;;;;;;;;GAQG;AAEH,sDAAoC;AACpC,0DAAwC;AACxC,+CAA6B;AAC7B,yDAAuC;AACvC,yCAAuB;AACvB,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,gDAA8B;AAC9B,iDAA+B;AAC/B,wDAAsC;AACtC,sDAAoC;AACpC,qDAAmC;AACnC,mDAAiC;AACjC,6CAA2B;AAC3B,oDAAkC;AAClC,qDAAmC;AACnC,kDAAgC;AAChC,sDAAoC;AACpC,0DAAwC;AACxC,8CAA4B;AAC5B,gDAA8B;AAC9B,uDAAqC;AACrC,8DAA4C;AAC5C,wDAAsC;AACtC,oDAAkC;AAClC,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,sDAAoC;AACpC,+DAA6C;AAC7C,6DAA2C;AAC3C,2DAAyC;AACzC,+DAA6C;AAC7C,wDAAsC;AACtC,qDAAmC;AACnC,wDAAsC;AACtC,yDAAuC;AACvC,gEAA8C;AAC9C,uFAAqE;AACrE,uFAAqE;AACrE,6EAA2D;AAC3D,oFAAkE;AAClE,gFAA8D;AAC9D,oFAAkE;AAClE,qFAAmE;AACnE,+DAA6C;AAC7C,kEAAgD;AAChD,oDAAkC;AAClC,4DAA0C;AAC1C,8DAA4C;AAC5C,iEAA+C;AAC/C,gDAA8B;AAC9B,sDAAoC;AACpC,sDAAoC;AACpC,sDAAoC;AACpC,wDAAsC;AACtC,4DAA0C;AAC1C,+CAA6B;AAC7B,yDAAuC;AACvC,+CAA6B;AAC7B,sDAAoC;AACpC,mDAAiC;AACjC,oDAAkC;AAClC,uDAAqC;AACrC,oDAAkC;AAClC,wDAAsC;AACtC,wDAAsC;AACtC,iEAA+C;AAC/C,wDAAsC;AACtC,yDAAuC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n\r\n/* The order of exports below is based on dependencies between the types in each file.\r\n * For example, IModelTileTree derives from TileTree, so TileTree must be exported first.\r\n * No file inside core-frontend should import from *any* file in /tile/ *except* for this one.\r\n * e.g.:\r\n * import { TileTree } from \"./tile/TileTree\"; // NO...\r\n * import { TileTree } from \"./tile/internal\"; // YES!\r\n * Failure to follow either of these two guidelines is very likely to produce difficult-to-debug run-time errors due\r\n * to circular dependencies.\r\n */\r\n\r\nexport * from \"./ViewFlagOverrides\";\r\nexport * from \"./map/MapCartoRectangle\";\r\nexport * from \"./map/QuadId\";\r\nexport * from \"./DisclosedTileTreeSet\";\r\nexport * from \"./Tile\";\r\nexport * from \"./LRUTileList\";\r\nexport * from \"./RealityTile\";\r\nexport * from \"./TileParams\";\r\nexport * from \"./TileContent\";\r\nexport * from \"./TileDrawArgs\";\r\nexport * from \"./RealityTileDrawArgs\";\r\nexport * from \"./GraphicsCollector\";\r\nexport * from \"./BatchedTileIdMap\";\r\nexport * from \"./TileTreeParams\";\r\nexport * from \"./TileTree\";\r\nexport * from \"./RealityTileTree\";\r\nexport * from \"./TileTreeSupplier\";\r\nexport * from \"./TileTreeOwner\";\r\nexport * from \"./TileTreeReference\";\r\nexport * from \"./TiledGraphicsProvider\";\r\nexport * from \"./TileAdmin\";\r\nexport * from \"./TileRequest\";\r\nexport * from \"./TileRequestChannel\";\r\nexport * from \"./IModelTileRequestChannels\";\r\nexport * from \"./TileRequestChannels\";\r\nexport * from \"./TileUsageMarker\";\r\nexport * from \"./GltfReader\";\r\nexport * from \"./I3dmReader\";\r\nexport * from \"./B3dmReader\";\r\nexport * from \"./ImdlReader\";\r\nexport * from \"./map/ArcGISTileMap\";\r\nexport * from \"./map/MapLayerAuthentication\";\r\nexport * from \"./map/ArcGisTokenGenerator\";\r\nexport * from \"./map/ArcGisTokenManager\";\r\nexport * from \"./map/MapLayerFormatRegistry\";\r\nexport * from \"./map/ArcGisUtilities\";\r\nexport * from \"./map/WmsUtilities\";\r\nexport * from \"./map/WmsCapabilities\";\r\nexport * from \"./map/WmtsCapabilities\";\r\nexport * from \"./map/MapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/ArcGISMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/AzureMapsLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/BingImageryProvider\";\r\nexport * from \"./map/ImageryProviders/MapBoxLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/TileUrlImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmsMapLayerImageryProvider\";\r\nexport * from \"./map/ImageryProviders/WmtsMapLayerImageryProvider\";\r\nexport * from \"./map/MapLayerImageryFormats\";\r\nexport * from \"./map/MapLayerTileTreeReference\";\r\nexport * from \"./map/MapTileTree\";\r\nexport * from \"./map/TerrainMeshProvider\";\r\nexport * from \"./map/CesiumTerrainProvider\";\r\nexport * from \"./map/EllipsoidTerrainProvider\";\r\nexport * from \"./map/MapTile\";\r\nexport * from \"./RealityTileLoader\";\r\nexport * from \"./map/MapTileLoader\";\r\nexport * from \"./map/BingElevation\";\r\nexport * from \"./map/MapTilingScheme\";\r\nexport * from \"./map/MapTileAvailability\";\r\nexport * from \"./PntsReader\";\r\nexport * from \"./RealityModelTileTree\";\r\nexport * from \"./IModelTile\";\r\nexport * from \"./DynamicIModelTile\";\r\nexport * from \"./IModelTileTree\";\r\nexport * from \"./PrimaryTileTree\";\r\nexport * from \"./ClassifierTileTree\";\r\nexport * from \"./OrbitGtTileTree\";\r\nexport * from \"./map/ImageryTileTree\";\r\nexport * from \"./map/MapLayerSources\";\r\nexport * from \"./map/MapTiledGraphicsProvider\";\r\nexport * from \"./CesiumAssetProvider\";\r\nexport * from \"./ContextShareProvider\";\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisUtilities.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,uBAAuB,EAAkB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EACsC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ArcGisUtilities.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":"AAMA,OAAO,EAAoB,uBAAuB,EAAkB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5G,OAAO,EACsC,iBAAiB,EAAoB,cAAc,EAAwB,wBAAwB,EAC/I,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,gBAAgB;AAChB,oBAAY,eAAe;IACzB,kBAAkB,MAAM;IACxB,YAAY,MAAM;IAClB,aAAa,MAAM;IACnB,YAAY,OAAO;IACnB,cAAc,OAAO;CACtB;AAED,gBAAgB;AAChB,qBAAa,eAAe;WAEZ,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAaxD,OAAO,CAAC,MAAM,CAAC,aAAa;WAMR,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;WAKlD,qBAAqB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;WA0BlD,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;WA0BpF,mBAAmB,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,GAAG,SAAqD,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;WAkBnI,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAiChJ,OAAO,CAAC,MAAM,CAAC,aAAa,CAA0B;WAClC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAoC3H,OAAO,CAAC,MAAM,CAAC,eAAe,CAA0B;WACpC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC;CAoBvG"}
|
|
@@ -112,16 +112,21 @@ class ArcGisUtilities {
|
|
|
112
112
|
return sources;
|
|
113
113
|
}
|
|
114
114
|
static async validateSource(url, credentials, ignoreCache) {
|
|
115
|
+
let authMethod = internal_1.MapLayerAuthType.None;
|
|
115
116
|
const json = await this.getServiceJson(url, credentials, ignoreCache);
|
|
116
117
|
if (json === undefined) {
|
|
117
118
|
return { status: internal_1.MapLayerSourceStatus.InvalidUrl };
|
|
118
119
|
}
|
|
119
120
|
else if (json.error !== undefined) {
|
|
121
|
+
// If we got a 'Token Required' error, lets check what authentification methods this ESRI service offers
|
|
122
|
+
// and return information needed to initiate the authentification process... the end-user
|
|
123
|
+
// will have to provide his credentials before we can fully validate this source.
|
|
120
124
|
if (json.error.code === ArcGisErrorCode.TokenRequired) {
|
|
121
|
-
|
|
125
|
+
authMethod = internal_1.MapLayerAuthType.EsriToken;
|
|
126
|
+
return { status: internal_1.MapLayerSourceStatus.RequireAuth, authInfo: { authMethod, tokenEndpoint: undefined } };
|
|
122
127
|
}
|
|
123
128
|
else if (json.error.code === ArcGisErrorCode.InvalidCredentials)
|
|
124
|
-
return { status: internal_1.MapLayerSourceStatus.InvalidCredentials };
|
|
129
|
+
return { status: internal_1.MapLayerSourceStatus.InvalidCredentials, authInfo: { authMethod: internal_1.MapLayerAuthType.EsriToken } };
|
|
125
130
|
}
|
|
126
131
|
let subLayers;
|
|
127
132
|
if (json.layers) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArcGisUtilities.js","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wDAA6C;AAE7C,wDAA4G;AAC5G,0CAEqB;AAErB;;GAEG;AACH,gBAAgB;AAChB,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,mFAAwB,CAAA;IACxB,uEAAkB,CAAA;IAClB,yEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4EAAqB,CAAA;AACvB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AAED,gBAAgB;AAChB,MAAa,eAAe;IAEnB,MAAM,CAAC,aAAa,CAAC,QAAkB;;QAC5C,IAAI,QAAQ,CAAC,MAAM,KAAI,MAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAY,0CAAE,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA,EAAE;YAClG,IAAI;gBACF,wGAAwG;gBACxG,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,YAAY,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,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AE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,gCAAqB,CAAC,OAAO,EAAE,CAAC,CAAC;gBACxI,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;oBACd,UAAU,GAAG,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC;aACxC;YACD,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAO,EAAC,GAAG,GAAG,uCAAuC,UAAU,EAAE,CAAC,CAAC;YACtF,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,MAAM,EAAE;YACf,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YACpD,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;;AAlLH,0CAmLC;AA1DgB,6BAAa,GAAG,IAAI,GAAG,EAAe,CAAC;AAqCvC,+BAAe,GAAG,IAAI,GAAG,EAAe,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { Angle } from \"@itwin/core-geometry\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { getJson, request, RequestBasicCredentials, RequestOptions, Response } from \"@bentley/itwin-client\";\r\nimport {\r\n ArcGisTokenClientType, ArcGisTokenManager, MapCartoRectangle, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation,\r\n} from \"../internal\";\r\n\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n/** @internal */\r\nexport enum ArcGisErrorCode {\r\n InvalidCredentials = 401,\r\n InvalidToken = 498,\r\n TokenRequired = 499,\r\n UnknownError = 1000,\r\n NoTokenService = 1001,\r\n}\r\n\r\n/** @internal */\r\nexport class ArcGisUtilities {\r\n\r\n public static hasTokenError(response: Response): boolean {\r\n if (response.header && (response.header[\"content-type\"] as string)?.toLowerCase().includes(\"json\")) {\r\n try {\r\n // Tile response returns byte array, so we need to check the response data type and convert accordingly.\r\n const json = ((response.body instanceof ArrayBuffer) ? JSON.parse(Buffer.from(response.body).toString()) : response.body);\r\n return (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken);\r\n } catch (_err) {\r\n return false; // that probably means we failed to convert byte array to JSON\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private static getBBoxString(range?: MapCartoRectangle) {\r\n if (!range)\r\n range = MapCartoRectangle.create();\r\n\r\n return `${range.low.x * Angle.degreesPerRadian},${range.low.y * Angle.degreesPerRadian},${range.high.x * Angle.degreesPerRadian},${range.high.y * Angle.degreesPerRadian}`;\r\n }\r\n public static async getEndpoint(url: string): Promise<any | undefined> {\r\n const capabilities = await getJson(`${url}?f=pjson`);\r\n\r\n return capabilities;\r\n }\r\n public static async getNationalMapSources(): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n const services = await getJson(\"https://viewer.nationalmap.gov/tnmaccess/api/getMapServiceList\");\r\n\r\n if (!Array.isArray(services))\r\n return sources;\r\n\r\n for (const service of services) {\r\n if (service.wmsUrl.length === 0) // Exclude Wfs..\r\n continue;\r\n switch (service.serviceType) {\r\n case \"ArcGIS\":\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url: service.serviceLink, formatId: \"ArcGIS\" })!);\r\n break;\r\n default: {\r\n const wmsIndex = service.wmsUrl.lastIndexOf(\"/wms\");\r\n if (wmsIndex > 0) {\r\n const url = service.wmsUrl.slice(0, wmsIndex + 4);\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url, formatId: \"WMS\" })!);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return sources;\r\n }\r\n public static async getServiceDirectorySources(url: string, baseUrl?: string): Promise<MapLayerSource[]> {\r\n if (undefined === baseUrl)\r\n baseUrl = url;\r\n let sources = new Array<MapLayerSource>();\r\n const json = await getJson(`${url}?f=json`);\r\n if (json !== undefined) {\r\n if (Array.isArray(json.folders)) {\r\n for (const folder of json.folders) {\r\n sources = sources.concat(await ArcGisUtilities.getServiceDirectorySources(`${url}/${folder}`, url));\r\n }\r\n }\r\n if (Array.isArray(json.services)) {\r\n for (const service of json.services) {\r\n let source;\r\n if (service.type === \"MapServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/MapServer`, formatId: \"ArcGIS\" });\r\n else if (service.type === \"ImageServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/ImageServer`, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n public static async getSourcesFromQuery(range?: MapCartoRectangle, url = \"https://usgs.maps.arcgis.com/sharing/rest/search\"): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n for (let start = 1; start > 0;) {\r\n const json = await getJson(`${url}?f=json&q=(group:9d1199a521334e77a7d15abbc29f8144) AND (type:\"Map Service\")&bbox=${ArcGisUtilities.getBBoxString(range)}&sortOrder=desc&start=${start}&num=100`);\r\n if (!json) break;\r\n start = json.nextStart ? json.nextStart : -1;\r\n if (json !== undefined && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n const source = MapLayerSource.fromJSON({ name: result.name ? result.name : result.title, url: result.url, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n\r\n public static async validateSource(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const json = await this.getServiceJson(url, credentials, ignoreCache);\r\n if (json === undefined) {\r\n return { status: MapLayerSourceStatus.InvalidUrl };\r\n } else if (json.error !== undefined) {\r\n if (json.error.code === ArcGisErrorCode.TokenRequired) {\r\n return { status: MapLayerSourceStatus.RequireAuth };\r\n } else if (json.error.code === ArcGisErrorCode.InvalidCredentials)\r\n return { status: MapLayerSourceStatus.InvalidCredentials };\r\n }\r\n\r\n let subLayers;\r\n if (json.layers) {\r\n\r\n subLayers = new Array<MapSubLayerProps>();\r\n\r\n for (const layer of json.layers) {\r\n const parent = layer.parentLayerId < 0 ? undefined : layer.parentLayerId;\r\n const children = Array.isArray(layer.subLayerIds) ? layer.subLayerIds : undefined;\r\n subLayers.push({ name: layer.name, visible: layer.defaultVisibility !== false, id: layer.id, parent, children });\r\n }\r\n }\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n\r\n }\r\n private static _serviceCache = new Map<string, any>();\r\n public static async getServiceJson(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean): Promise<any> {\r\n if (!ignoreCache) {\r\n const cached = ArcGisUtilities._serviceCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n try {\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"json\",\r\n };\r\n let tokenParam = \"\";\r\n if (credentials) {\r\n const token = await ArcGisTokenManager.getToken(url, credentials.user, credentials.password, { client: ArcGisTokenClientType.referer });\r\n if (token?.token) {\r\n tokenParam = `&token=${token.token}`;\r\n } else if (token?.error)\r\n return token; // An error occurred, return immediately\r\n }\r\n const finalUrl = `${url}?f=json${tokenParam}`;\r\n const data = await request(finalUrl, options);\r\n const json = data.body ?? undefined;\r\n\r\n // Cache the response only if it doesn't contain a token error.\r\n if (!ArcGisUtilities.hasTokenError(data)) {\r\n ArcGisUtilities._serviceCache.set(url, json);\r\n }\r\n\r\n return json;\r\n } catch (_error) {\r\n ArcGisUtilities._serviceCache.set(url, undefined);\r\n return undefined;\r\n }\r\n }\r\n\r\n private static _footprintCache = new Map<string, any>();\r\n public static async getFootprintJson(url: string, credentials?: RequestBasicCredentials): Promise<any> {\r\n const cached = ArcGisUtilities._footprintCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n\r\n try {\r\n let tokenParam = \"\";\r\n if (credentials) {\r\n const token = await ArcGisTokenManager.getToken(url, credentials.user, credentials.password, { client: ArcGisTokenClientType.referer });\r\n if (token?.token)\r\n tokenParam = `&token=${token.token}`;\r\n }\r\n const json = await getJson(`${url}?f=json&option=footprints&outSR=4326${tokenParam}`);\r\n ArcGisUtilities._footprintCache.set(url, json);\r\n return json;\r\n } catch (_error) {\r\n ArcGisUtilities._footprintCache.set(url, undefined);\r\n return undefined;\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ArcGisUtilities.js","sourceRoot":"","sources":["../../../../src/tile/map/ArcGisUtilities.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,wDAA6C;AAE7C,wDAA4G;AAC5G,0CAEqB;AAErB;;GAEG;AACH,gBAAgB;AAChB,IAAY,eAMX;AAND,WAAY,eAAe;IACzB,mFAAwB,CAAA;IACxB,uEAAkB,CAAA;IAClB,yEAAmB,CAAA;IACnB,wEAAmB,CAAA;IACnB,4EAAqB,CAAA;AACvB,CAAC,EANW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAM1B;AAED,gBAAgB;AAChB,MAAa,eAAe;IAEnB,MAAM,CAAC,aAAa,CAAC,QAAkB;;QAC5C,IAAI,QAAQ,CAAC,MAAM,KAAI,MAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAY,0CAAE,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA,EAAE;YAClG,IAAI;gBACF,wGAAwG;gBACxG,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,YAAY,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBAC1H,OAAO,CAAC,CAAA,MAAA,IA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UAAU,GAAG,EAAE,CAAC;YACpB,IAAI,WAAW,EAAE;gBACf,MAAM,KAAK,GAAG,MAAM,6BAAkB,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,gCAAqB,CAAC,OAAO,EAAE,CAAC,CAAC;gBACxI,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;oBACd,UAAU,GAAG,UAAU,KAAK,CAAC,KAAK,EAAE,CAAC;aACxC;YACD,MAAM,IAAI,GAAG,MAAM,IAAA,sBAAO,EAAC,GAAG,GAAG,uCAAuC,UAAU,EAAE,CAAC,CAAC;YACtF,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC;SACb;QAAC,OAAO,MAAM,EAAE;YACf,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YACpD,OAAO,SAAS,CAAC;SAClB;IACH,CAAC;;AA1LH,0CA2LC;AA1DgB,6BAAa,GAAG,IAAI,GAAG,EAAe,CAAC;AAqCvC,+BAAe,GAAG,IAAI,GAAG,EAAe,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport { Angle } from \"@itwin/core-geometry\";\r\nimport { MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { getJson, request, RequestBasicCredentials, RequestOptions, Response } from \"@bentley/itwin-client\";\r\nimport {\r\n ArcGisTokenClientType, ArcGisTokenManager, MapCartoRectangle, MapLayerAuthType, MapLayerSource, MapLayerSourceStatus, MapLayerSourceValidation,\r\n} from \"../internal\";\r\n\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\n/** @internal */\r\nexport enum ArcGisErrorCode {\r\n InvalidCredentials = 401,\r\n InvalidToken = 498,\r\n TokenRequired = 499,\r\n UnknownError = 1000,\r\n NoTokenService = 1001,\r\n}\r\n\r\n/** @internal */\r\nexport class ArcGisUtilities {\r\n\r\n public static hasTokenError(response: Response): boolean {\r\n if (response.header && (response.header[\"content-type\"] as string)?.toLowerCase().includes(\"json\")) {\r\n try {\r\n // Tile response returns byte array, so we need to check the response data type and convert accordingly.\r\n const json = ((response.body instanceof ArrayBuffer) ? JSON.parse(Buffer.from(response.body).toString()) : response.body);\r\n return (json?.error?.code === ArcGisErrorCode.TokenRequired || json?.error?.code === ArcGisErrorCode.InvalidToken);\r\n } catch (_err) {\r\n return false; // that probably means we failed to convert byte array to JSON\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n private static getBBoxString(range?: MapCartoRectangle) {\r\n if (!range)\r\n range = MapCartoRectangle.create();\r\n\r\n return `${range.low.x * Angle.degreesPerRadian},${range.low.y * Angle.degreesPerRadian},${range.high.x * Angle.degreesPerRadian},${range.high.y * Angle.degreesPerRadian}`;\r\n }\r\n public static async getEndpoint(url: string): Promise<any | undefined> {\r\n const capabilities = await getJson(`${url}?f=pjson`);\r\n\r\n return capabilities;\r\n }\r\n public static async getNationalMapSources(): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n const services = await getJson(\"https://viewer.nationalmap.gov/tnmaccess/api/getMapServiceList\");\r\n\r\n if (!Array.isArray(services))\r\n return sources;\r\n\r\n for (const service of services) {\r\n if (service.wmsUrl.length === 0) // Exclude Wfs..\r\n continue;\r\n switch (service.serviceType) {\r\n case \"ArcGIS\":\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url: service.serviceLink, formatId: \"ArcGIS\" })!);\r\n break;\r\n default: {\r\n const wmsIndex = service.wmsUrl.lastIndexOf(\"/wms\");\r\n if (wmsIndex > 0) {\r\n const url = service.wmsUrl.slice(0, wmsIndex + 4);\r\n sources.push(MapLayerSource.fromJSON({ name: service.displayName, url, formatId: \"WMS\" })!);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n return sources;\r\n }\r\n public static async getServiceDirectorySources(url: string, baseUrl?: string): Promise<MapLayerSource[]> {\r\n if (undefined === baseUrl)\r\n baseUrl = url;\r\n let sources = new Array<MapLayerSource>();\r\n const json = await getJson(`${url}?f=json`);\r\n if (json !== undefined) {\r\n if (Array.isArray(json.folders)) {\r\n for (const folder of json.folders) {\r\n sources = sources.concat(await ArcGisUtilities.getServiceDirectorySources(`${url}/${folder}`, url));\r\n }\r\n }\r\n if (Array.isArray(json.services)) {\r\n for (const service of json.services) {\r\n let source;\r\n if (service.type === \"MapServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/MapServer`, formatId: \"ArcGIS\" });\r\n else if (service.type === \"ImageServer\")\r\n source = MapLayerSource.fromJSON({ name: service.name, url: `${baseUrl}/${service.name}/ImageServer`, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n public static async getSourcesFromQuery(range?: MapCartoRectangle, url = \"https://usgs.maps.arcgis.com/sharing/rest/search\"): Promise<MapLayerSource[]> {\r\n const sources = new Array<MapLayerSource>();\r\n for (let start = 1; start > 0;) {\r\n const json = await getJson(`${url}?f=json&q=(group:9d1199a521334e77a7d15abbc29f8144) AND (type:\"Map Service\")&bbox=${ArcGisUtilities.getBBoxString(range)}&sortOrder=desc&start=${start}&num=100`);\r\n if (!json) break;\r\n start = json.nextStart ? json.nextStart : -1;\r\n if (json !== undefined && Array.isArray(json.results)) {\r\n for (const result of json.results) {\r\n const source = MapLayerSource.fromJSON({ name: result.name ? result.name : result.title, url: result.url, formatId: \"ArcGIS\" });\r\n if (source)\r\n sources.push(source);\r\n }\r\n }\r\n }\r\n\r\n return sources;\r\n }\r\n\r\n public static async validateSource(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n\r\n let authMethod: MapLayerAuthType = MapLayerAuthType.None;\r\n\r\n const json = await this.getServiceJson(url, credentials, ignoreCache);\r\n if (json === undefined) {\r\n return { status: MapLayerSourceStatus.InvalidUrl };\r\n } else if (json.error !== undefined) {\r\n\r\n // If we got a 'Token Required' error, lets check what authentification methods this ESRI service offers\r\n // and return information needed to initiate the authentification process... the end-user\r\n // will have to provide his credentials before we can fully validate this source.\r\n if (json.error.code === ArcGisErrorCode.TokenRequired) {\r\n authMethod = MapLayerAuthType.EsriToken;\r\n return { status: MapLayerSourceStatus.RequireAuth, authInfo: { authMethod, tokenEndpoint: undefined } };\r\n } else if (json.error.code === ArcGisErrorCode.InvalidCredentials)\r\n return { status: MapLayerSourceStatus.InvalidCredentials, authInfo: { authMethod: MapLayerAuthType.EsriToken } };\r\n }\r\n\r\n let subLayers;\r\n if (json.layers) {\r\n\r\n subLayers = new Array<MapSubLayerProps>();\r\n\r\n for (const layer of json.layers) {\r\n const parent = layer.parentLayerId < 0 ? undefined : layer.parentLayerId;\r\n const children = Array.isArray(layer.subLayerIds) ? layer.subLayerIds : undefined;\r\n subLayers.push({ name: layer.name, visible: layer.defaultVisibility !== false, id: layer.id, parent, children });\r\n }\r\n }\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n }\r\n\r\n private static _serviceCache = new Map<string, any>();\r\n public static async getServiceJson(url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean): Promise<any> {\r\n if (!ignoreCache) {\r\n const cached = ArcGisUtilities._serviceCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n }\r\n\r\n try {\r\n const options: RequestOptions = {\r\n method: \"GET\",\r\n responseType: \"json\",\r\n };\r\n let tokenParam = \"\";\r\n if (credentials) {\r\n const token = await ArcGisTokenManager.getToken(url, credentials.user, credentials.password, { client: ArcGisTokenClientType.referer });\r\n if (token?.token) {\r\n tokenParam = `&token=${token.token}`;\r\n } else if (token?.error)\r\n return token; // An error occurred, return immediately\r\n }\r\n const finalUrl = `${url}?f=json${tokenParam}`;\r\n const data = await request(finalUrl, options);\r\n const json = data.body ?? undefined;\r\n\r\n // Cache the response only if it doesn't contain a token error.\r\n if (!ArcGisUtilities.hasTokenError(data)) {\r\n ArcGisUtilities._serviceCache.set(url, json);\r\n }\r\n\r\n return json;\r\n } catch (_error) {\r\n ArcGisUtilities._serviceCache.set(url, undefined);\r\n return undefined;\r\n }\r\n }\r\n\r\n private static _footprintCache = new Map<string, any>();\r\n public static async getFootprintJson(url: string, credentials?: RequestBasicCredentials): Promise<any> {\r\n const cached = ArcGisUtilities._footprintCache.get(url);\r\n if (cached !== undefined)\r\n return cached;\r\n\r\n try {\r\n let tokenParam = \"\";\r\n if (credentials) {\r\n const token = await ArcGisTokenManager.getToken(url, credentials.user, credentials.password, { client: ArcGisTokenClientType.referer });\r\n if (token?.token)\r\n tokenParam = `&token=${token.token}`;\r\n }\r\n const json = await getJson(`${url}?f=json&option=footprints&outSR=4326${tokenParam}`);\r\n ArcGisUtilities._footprintCache.set(url, json);\r\n return json;\r\n } catch (_error) {\r\n ArcGisUtilities._footprintCache.set(url, undefined);\r\n return undefined;\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module MapLayers
|
|
3
|
+
*/
|
|
4
|
+
/** @beta */
|
|
5
|
+
export declare enum MapLayerAuthType {
|
|
6
|
+
None = 1,
|
|
7
|
+
Basic = 2,
|
|
8
|
+
EsriToken = 3
|
|
9
|
+
}
|
|
10
|
+
/** @internal */
|
|
11
|
+
export interface MapLayerTokenEndpoint {
|
|
12
|
+
getLoginUrl(stateData?: string): string | undefined;
|
|
13
|
+
getUrl(): string;
|
|
14
|
+
}
|
|
15
|
+
/** @internal */
|
|
16
|
+
export interface MapLayerAuthenticationInfo {
|
|
17
|
+
authMethod: MapLayerAuthType;
|
|
18
|
+
tokenEndpoint?: MapLayerTokenEndpoint;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=MapLayerAuthentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapLayerAuthentication.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerAuthentication.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,YAAY;AACZ,oBAAY,gBAAgB;IAC1B,IAAI,IAAI;IACR,KAAK,IAAI;IACT,SAAS,IAAI;CACd;AACD,gBAAgB;AAChB,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAC,SAAS,CAAC;IAClD,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,gBAAgB;AAChB,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module MapLayers
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.MapLayerAuthType = void 0;
|
|
11
|
+
/** @beta */
|
|
12
|
+
var MapLayerAuthType;
|
|
13
|
+
(function (MapLayerAuthType) {
|
|
14
|
+
MapLayerAuthType[MapLayerAuthType["None"] = 1] = "None";
|
|
15
|
+
MapLayerAuthType[MapLayerAuthType["Basic"] = 2] = "Basic";
|
|
16
|
+
MapLayerAuthType[MapLayerAuthType["EsriToken"] = 3] = "EsriToken";
|
|
17
|
+
})(MapLayerAuthType = exports.MapLayerAuthType || (exports.MapLayerAuthType = {}));
|
|
18
|
+
//# sourceMappingURL=MapLayerAuthentication.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapLayerAuthentication.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerAuthentication.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,YAAY;AACZ,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,uDAAQ,CAAA;IACR,yDAAS,CAAA;IACT,iEAAa,CAAA;AACf,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\n\r\n/** @beta */\r\nexport enum MapLayerAuthType {\r\n None = 1,\r\n Basic = 2,\r\n EsriToken = 3\r\n}\r\n/** @internal */\r\nexport interface MapLayerTokenEndpoint {\r\n getLoginUrl(stateData?: string): string|undefined;\r\n getUrl(): string;\r\n}\r\n\r\n/** @internal */\r\nexport interface MapLayerAuthenticationInfo {\r\n authMethod: MapLayerAuthType;\r\n tokenEndpoint?: MapLayerTokenEndpoint;\r\n}\r\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
/** @
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module MapLayers
|
|
3
|
+
*/
|
|
2
4
|
import { MapLayerKey, MapLayerSettings, MapSubLayerProps } from "@itwin/core-common";
|
|
3
5
|
import { IModelConnection } from "../../IModelConnection";
|
|
4
|
-
import { ImageryMapLayerTreeReference, MapLayerImageryProvider, MapLayerSourceStatus, MapLayerTileTreeReference } from "../internal";
|
|
6
|
+
import { ImageryMapLayerTreeReference, MapLayerAuthenticationInfo, MapLayerImageryProvider, MapLayerSourceStatus, MapLayerTileTreeReference } from "../internal";
|
|
5
7
|
import { RequestBasicCredentials } from "@bentley/itwin-client";
|
|
6
8
|
/** @internal */
|
|
7
9
|
export declare class MapLayerFormat {
|
|
@@ -17,6 +19,7 @@ export declare type MapLayerFormatType = typeof MapLayerFormat;
|
|
|
17
19
|
export interface MapLayerSourceValidation {
|
|
18
20
|
status: MapLayerSourceStatus;
|
|
19
21
|
subLayers?: MapSubLayerProps[];
|
|
22
|
+
authInfo?: MapLayerAuthenticationInfo;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
25
|
* Options to be passed to the IModelApp on startup which contain access keys for various layer formats
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerFormatRegistry.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerFormatRegistry.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"MapLayerFormatRegistry.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerFormatRegistry.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAkC,0BAA0B,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACjM,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,gBAAgB;AAChB,qBAAa,cAAc;IACzB,OAAc,QAAQ,EAAE,MAAM,CAAC;WACjB,QAAQ;WACR,qBAAqB,CAAC,SAAS,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,SAAS;WACvF,kBAAkB,CAAC,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,yBAAyB,GAAG,SAAS;WAIrI,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,uBAAuB,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;CACpJ;AAED,gBAAgB;AAChB,oBAAY,kBAAkB,GAAG,OAAO,cAAc,CAAC;AAEvD,gBAAgB;AAChB,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,0BAA0B,CAAC;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAE9B,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB,aAAa,CAAC,EAAE,WAAW,CAAC;IAE5B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;CAC3C;AAED,gBAAgB;AAChB,qBAAa,sBAAsB;IACjC,OAAO,CAAC,cAAc,CAAkB;gBAC5B,IAAI,CAAC,EAAE,eAAe;IAIlC,OAAO,CAAC,QAAQ,CAAyC;IAClD,QAAQ,CAAC,WAAW,EAAE,kBAAkB;IAM/C,IAAW,aAAa,IAAI,eAAe,CAE1C;IACM,yBAAyB,CAAC,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,4BAA4B,GAAG,SAAS;IAIlJ,qBAAqB,CAAC,aAAa,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,SAAS;IASrF,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAI5J"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module MapLayers
|
|
8
|
+
*/
|
|
7
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
10
|
exports.MapLayerFormatRegistry = exports.MapLayerFormat = void 0;
|
|
9
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerFormatRegistry.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerFormatRegistry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F
|
|
1
|
+
{"version":3,"file":"MapLayerFormatRegistry.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerFormatRegistry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAA6C;AAE7C,+CAA4C;AAE5C,0CAAiM;AAGjM,gBAAgB;AAChB,MAAa,cAAc;IAElB,MAAM,CAAC,QAAQ,KAAK,qBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,CAAC,qBAAqB,CAAC,SAA2B,IAAyC,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACjH,MAAM,CAAC,kBAAkB,CAAC,cAAgC,EAAE,WAAmB,EAAE,OAAyB;QAC/G,IAAA,qBAAM,EAAC,KAAK,CAAC,CAAC;QACd,OAAO,SAAS,CAAC;IACnB,CAAC;IACM,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,IAAY,EAAE,YAAsC,EAAE,YAAsB,IAAuC,OAAO,EAAE,MAAM,EAAE,+BAAoB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;CACvM;AATD,wCASC;AA0BD,gBAAgB;AAChB,MAAa,sBAAsB;IAEjC,YAAY,IAAsB;QAI1B,aAAQ,GAAG,IAAI,GAAG,EAA8B,CAAC;QAHvD,IAAI,CAAC,cAAc,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAA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,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAC1F,CAAC;IACM,KAAK,CAAC,cAAc,CAAC,QAAgB,EAAE,GAAW,EAAE,WAAqC,EAAE,WAAqB;QACrH,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,+BAAoB,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IACxI,CAAC;CACF;AAjCD,wDAiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\n\r\nimport { assert } from \"@itwin/core-bentley\";\r\nimport { MapLayerKey, MapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { ImageryMapLayerTreeReference, internalMapLayerImageryFormats, MapLayerAuthenticationInfo, MapLayerImageryProvider, MapLayerSourceStatus, MapLayerTileTreeReference } from \"../internal\";\r\nimport { RequestBasicCredentials } from \"@bentley/itwin-client\";\r\n\r\n/** @internal */\r\nexport class MapLayerFormat {\r\n public static formatId: string;\r\n public static register() { IModelApp.mapLayerFormatRegistry.register(this); }\r\n public static createImageryProvider(_settings: MapLayerSettings): MapLayerImageryProvider | undefined { assert(false); }\r\n public static createMapLayerTree(_layerSettings: MapLayerSettings, _layerIndex: number, _iModel: IModelConnection): MapLayerTileTreeReference | undefined {\r\n assert(false);\r\n return undefined;\r\n }\r\n public static async validateSource(_url: string, _credentials?: RequestBasicCredentials, _ignoreCache?: boolean): Promise<MapLayerSourceValidation> { return { status: MapLayerSourceStatus.Valid }; }\r\n}\r\n\r\n/** @internal */\r\nexport type MapLayerFormatType = typeof MapLayerFormat;\r\n\r\n/** @internal */\r\nexport interface MapLayerSourceValidation {\r\n status: MapLayerSourceStatus;\r\n subLayers?: MapSubLayerProps[];\r\n authInfo?: MapLayerAuthenticationInfo;\r\n}\r\n\r\n/**\r\n * Options to be passed to the IModelApp on startup which contain access keys for various layer formats\r\n * @beta\r\n */\r\nexport interface MapLayerOptions {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n AzureMaps?: MapLayerKey;\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n MapBoxImagery?: MapLayerKey;\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n BingMaps?: MapLayerKey;\r\n [format: string]: MapLayerKey | undefined;\r\n}\r\n\r\n/** @internal */\r\nexport class MapLayerFormatRegistry {\r\n private _configOptions: MapLayerOptions;\r\n constructor(opts?: MapLayerOptions) {\r\n this._configOptions = opts ?? {};\r\n internalMapLayerImageryFormats.forEach((format) => this.register(format));\r\n }\r\n private _formats = new Map<string, MapLayerFormatType>();\r\n public register(formatClass: MapLayerFormatType) {\r\n if (formatClass.formatId.length === 0)\r\n return; // must be an abstract class, ignore it\r\n\r\n this._formats.set(formatClass.formatId, formatClass);\r\n }\r\n public get configOptions(): MapLayerOptions {\r\n return this._configOptions;\r\n }\r\n public createImageryMapLayerTree(layerSettings: MapLayerSettings, layerIndex: number, iModel: IModelConnection): ImageryMapLayerTreeReference | undefined {\r\n const format = this._formats.get(layerSettings.formatId);\r\n return format !== undefined ? (format.createMapLayerTree(layerSettings, layerIndex, iModel) as ImageryMapLayerTreeReference) : undefined;\r\n }\r\n public createImageryProvider(layerSettings: MapLayerSettings): MapLayerImageryProvider | undefined {\r\n const format = this._formats.get(layerSettings.formatId);\r\n if (this._configOptions[layerSettings.formatId] !== undefined) {\r\n const keyValuePair = this._configOptions[layerSettings.formatId]!;\r\n const key: MapLayerKey = { key: keyValuePair.key, value: keyValuePair.value };\r\n layerSettings = layerSettings.clone({ accessKey: key });\r\n }\r\n return (format === undefined) ? undefined : format.createImageryProvider(layerSettings);\r\n }\r\n public async validateSource(formatId: string, url: string, credentials?: RequestBasicCredentials, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const format = this._formats.get(formatId);\r\n return (format === undefined) ? { status: MapLayerSourceStatus.InvalidFormat } : format.validateSource(url, credentials, ignoreCache);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapLayerImageryFormats.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryFormats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,
|
|
1
|
+
{"version":3,"file":"MapLayerImageryFormats.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryFormats.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAoB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EASL,cAAc,EACd,uBAAuB,EAEvB,wBAAwB,EACxB,yBAAyB,EAO1B,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;WAChC,kBAAkB,CAAC,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,yBAAyB,GAAG,SAAS;CAGhK;AAED,cAAM,iBAAkB,SAAQ,qBAAqB;IACnD,OAAuB,QAAQ,SAAS;WAEjB,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,uBAAuB,GAAG,SAAS;WAGhF,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,uBAAuB,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAyD1J;AAiGD,gBAAgB;AAChB,eAAO,MAAM,8BAA8B,8BAA2K,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
|
-
* @module
|
|
7
|
+
* @module MapLayers
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.internalMapLayerImageryFormats = exports.ImageryMapLayerFormat = void 0;
|
|
@@ -67,10 +67,12 @@ class WmsMapLayerFormat extends ImageryMapLayerFormat {
|
|
|
67
67
|
}
|
|
68
68
|
catch (err) {
|
|
69
69
|
let status = internal_1.MapLayerSourceStatus.InvalidUrl;
|
|
70
|
+
let authInfo;
|
|
70
71
|
if ((err === null || err === void 0 ? void 0 : err.status) === 401) {
|
|
71
72
|
status = (credentials ? internal_1.MapLayerSourceStatus.InvalidCredentials : internal_1.MapLayerSourceStatus.RequireAuth);
|
|
73
|
+
authInfo = { authMethod: internal_1.MapLayerAuthType.Basic };
|
|
72
74
|
}
|
|
73
|
-
return { status };
|
|
75
|
+
return { status, authInfo };
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
}
|