@itwin/core-frontend 5.2.0-dev.8 → 5.3.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/lib/cjs/IModelApp.d.ts.map +1 -1
  3. package/lib/cjs/IModelApp.js +3 -0
  4. package/lib/cjs/IModelApp.js.map +1 -1
  5. package/lib/cjs/PlanarClipMaskState.d.ts +3 -0
  6. package/lib/cjs/PlanarClipMaskState.d.ts.map +1 -1
  7. package/lib/cjs/PlanarClipMaskState.js +5 -1
  8. package/lib/cjs/PlanarClipMaskState.js.map +1 -1
  9. package/lib/cjs/RealityDataSource.d.ts.map +1 -1
  10. package/lib/cjs/RealityDataSource.js +5 -1
  11. package/lib/cjs/RealityDataSource.js.map +1 -1
  12. package/lib/cjs/ViewContext.d.ts +10 -1
  13. package/lib/cjs/ViewContext.d.ts.map +1 -1
  14. package/lib/cjs/ViewContext.js +12 -1
  15. package/lib/cjs/ViewContext.js.map +1 -1
  16. package/lib/cjs/internal/GoogleMapsDecorator.js +6 -6
  17. package/lib/cjs/internal/GoogleMapsDecorator.js.map +1 -1
  18. package/lib/cjs/internal/cross-package.d.ts +1 -1
  19. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  20. package/lib/cjs/internal/cross-package.js +2 -1
  21. package/lib/cjs/internal/cross-package.js.map +1 -1
  22. package/lib/cjs/internal/render/webgl/BackgroundMapDrape.js +1 -1
  23. package/lib/cjs/internal/render/webgl/BackgroundMapDrape.js.map +1 -1
  24. package/lib/cjs/internal/render/webgl/BatchUniforms.d.ts +4 -1
  25. package/lib/cjs/internal/render/webgl/BatchUniforms.d.ts.map +1 -1
  26. package/lib/cjs/internal/render/webgl/BatchUniforms.js +15 -4
  27. package/lib/cjs/internal/render/webgl/BatchUniforms.js.map +1 -1
  28. package/lib/cjs/internal/render/webgl/FeatureOverrides.d.ts +3 -3
  29. package/lib/cjs/internal/render/webgl/FeatureOverrides.d.ts.map +1 -1
  30. package/lib/cjs/internal/render/webgl/FeatureOverrides.js +10 -10
  31. package/lib/cjs/internal/render/webgl/FeatureOverrides.js.map +1 -1
  32. package/lib/cjs/internal/render/webgl/Graphic.d.ts +3 -3
  33. package/lib/cjs/internal/render/webgl/Graphic.d.ts.map +1 -1
  34. package/lib/cjs/internal/render/webgl/Graphic.js +7 -7
  35. package/lib/cjs/internal/render/webgl/Graphic.js.map +1 -1
  36. package/lib/cjs/internal/render/webgl/PlanarClassifier.d.ts +1 -0
  37. package/lib/cjs/internal/render/webgl/PlanarClassifier.d.ts.map +1 -1
  38. package/lib/cjs/internal/render/webgl/PlanarClassifier.js +20 -4
  39. package/lib/cjs/internal/render/webgl/PlanarClassifier.js.map +1 -1
  40. package/lib/cjs/internal/render/webgl/RenderCommands.d.ts +2 -1
  41. package/lib/cjs/internal/render/webgl/RenderCommands.d.ts.map +1 -1
  42. package/lib/cjs/internal/render/webgl/RenderCommands.js +3 -1
  43. package/lib/cjs/internal/render/webgl/RenderCommands.js.map +1 -1
  44. package/lib/cjs/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
  45. package/lib/cjs/internal/render/webgl/SceneCompositor.js +4 -1
  46. package/lib/cjs/internal/render/webgl/SceneCompositor.js.map +1 -1
  47. package/lib/cjs/internal/render/webgl/Target.js +2 -2
  48. package/lib/cjs/internal/render/webgl/Target.js.map +1 -1
  49. package/lib/cjs/internal/render/webgl/VisibleTileFeatures.js +1 -1
  50. package/lib/cjs/internal/render/webgl/VisibleTileFeatures.js.map +1 -1
  51. package/lib/cjs/internal/render/webgl/glsl/PlanarClassification.js +2 -2
  52. package/lib/cjs/internal/render/webgl/glsl/PlanarClassification.js.map +1 -1
  53. package/lib/cjs/internal/render/webgl/glsl/Surface.js +15 -15
  54. package/lib/cjs/internal/render/webgl/glsl/Surface.js.map +1 -1
  55. package/lib/cjs/internal/tile/PrimaryTileTree.d.ts +2 -0
  56. package/lib/cjs/internal/tile/PrimaryTileTree.d.ts.map +1 -1
  57. package/lib/cjs/internal/tile/PrimaryTileTree.js +17 -12
  58. package/lib/cjs/internal/tile/PrimaryTileTree.js.map +1 -1
  59. package/lib/cjs/internal/tile/map/MapTileAvailability.js +1 -1
  60. package/lib/cjs/internal/tile/map/MapTileAvailability.js.map +1 -1
  61. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  62. package/lib/cjs/tile/GltfReader.js +15 -1
  63. package/lib/cjs/tile/GltfReader.js.map +1 -1
  64. package/lib/cjs/tools/ToolAdmin.d.ts +5 -0
  65. package/lib/cjs/tools/ToolAdmin.d.ts.map +1 -1
  66. package/lib/cjs/tools/ToolAdmin.js +9 -0
  67. package/lib/cjs/tools/ToolAdmin.js.map +1 -1
  68. package/lib/cjs/workers/ImdlParser/webpack.config.js +8 -0
  69. package/lib/esm/IModelApp.d.ts.map +1 -1
  70. package/lib/esm/IModelApp.js +3 -0
  71. package/lib/esm/IModelApp.js.map +1 -1
  72. package/lib/esm/PlanarClipMaskState.d.ts +3 -0
  73. package/lib/esm/PlanarClipMaskState.d.ts.map +1 -1
  74. package/lib/esm/PlanarClipMaskState.js +5 -1
  75. package/lib/esm/PlanarClipMaskState.js.map +1 -1
  76. package/lib/esm/RealityDataSource.d.ts.map +1 -1
  77. package/lib/esm/RealityDataSource.js +5 -1
  78. package/lib/esm/RealityDataSource.js.map +1 -1
  79. package/lib/esm/ViewContext.d.ts +10 -1
  80. package/lib/esm/ViewContext.d.ts.map +1 -1
  81. package/lib/esm/ViewContext.js +12 -1
  82. package/lib/esm/ViewContext.js.map +1 -1
  83. package/lib/esm/internal/GoogleMapsDecorator.js +6 -6
  84. package/lib/esm/internal/GoogleMapsDecorator.js.map +1 -1
  85. package/lib/esm/internal/cross-package.d.ts +1 -1
  86. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  87. package/lib/esm/internal/cross-package.js +1 -1
  88. package/lib/esm/internal/cross-package.js.map +1 -1
  89. package/lib/esm/internal/render/webgl/BackgroundMapDrape.js +1 -1
  90. package/lib/esm/internal/render/webgl/BackgroundMapDrape.js.map +1 -1
  91. package/lib/esm/internal/render/webgl/BatchUniforms.d.ts +4 -1
  92. package/lib/esm/internal/render/webgl/BatchUniforms.d.ts.map +1 -1
  93. package/lib/esm/internal/render/webgl/BatchUniforms.js +15 -4
  94. package/lib/esm/internal/render/webgl/BatchUniforms.js.map +1 -1
  95. package/lib/esm/internal/render/webgl/FeatureOverrides.d.ts +3 -3
  96. package/lib/esm/internal/render/webgl/FeatureOverrides.d.ts.map +1 -1
  97. package/lib/esm/internal/render/webgl/FeatureOverrides.js +10 -10
  98. package/lib/esm/internal/render/webgl/FeatureOverrides.js.map +1 -1
  99. package/lib/esm/internal/render/webgl/Graphic.d.ts +3 -3
  100. package/lib/esm/internal/render/webgl/Graphic.d.ts.map +1 -1
  101. package/lib/esm/internal/render/webgl/Graphic.js +7 -7
  102. package/lib/esm/internal/render/webgl/Graphic.js.map +1 -1
  103. package/lib/esm/internal/render/webgl/PlanarClassifier.d.ts +1 -0
  104. package/lib/esm/internal/render/webgl/PlanarClassifier.d.ts.map +1 -1
  105. package/lib/esm/internal/render/webgl/PlanarClassifier.js +20 -4
  106. package/lib/esm/internal/render/webgl/PlanarClassifier.js.map +1 -1
  107. package/lib/esm/internal/render/webgl/RenderCommands.d.ts +2 -1
  108. package/lib/esm/internal/render/webgl/RenderCommands.d.ts.map +1 -1
  109. package/lib/esm/internal/render/webgl/RenderCommands.js +3 -1
  110. package/lib/esm/internal/render/webgl/RenderCommands.js.map +1 -1
  111. package/lib/esm/internal/render/webgl/SceneCompositor.d.ts.map +1 -1
  112. package/lib/esm/internal/render/webgl/SceneCompositor.js +4 -1
  113. package/lib/esm/internal/render/webgl/SceneCompositor.js.map +1 -1
  114. package/lib/esm/internal/render/webgl/Target.js +2 -2
  115. package/lib/esm/internal/render/webgl/Target.js.map +1 -1
  116. package/lib/esm/internal/render/webgl/VisibleTileFeatures.js +1 -1
  117. package/lib/esm/internal/render/webgl/VisibleTileFeatures.js.map +1 -1
  118. package/lib/esm/internal/render/webgl/glsl/PlanarClassification.js +2 -2
  119. package/lib/esm/internal/render/webgl/glsl/PlanarClassification.js.map +1 -1
  120. package/lib/esm/internal/render/webgl/glsl/Surface.js +15 -15
  121. package/lib/esm/internal/render/webgl/glsl/Surface.js.map +1 -1
  122. package/lib/esm/internal/tile/PrimaryTileTree.d.ts +2 -0
  123. package/lib/esm/internal/tile/PrimaryTileTree.d.ts.map +1 -1
  124. package/lib/esm/internal/tile/PrimaryTileTree.js +16 -12
  125. package/lib/esm/internal/tile/PrimaryTileTree.js.map +1 -1
  126. package/lib/esm/internal/tile/map/MapTileAvailability.js +1 -1
  127. package/lib/esm/internal/tile/map/MapTileAvailability.js.map +1 -1
  128. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  129. package/lib/esm/tile/GltfReader.js +16 -2
  130. package/lib/esm/tile/GltfReader.js.map +1 -1
  131. package/lib/esm/tools/ToolAdmin.d.ts +5 -0
  132. package/lib/esm/tools/ToolAdmin.d.ts.map +1 -1
  133. package/lib/esm/tools/ToolAdmin.js +9 -0
  134. package/lib/esm/tools/ToolAdmin.js.map +1 -1
  135. package/lib/esm/workers/ImdlParser/webpack.config.js +8 -0
  136. package/lib/public/images/GoogleMaps_Logo_Gray.svg +50 -0
  137. package/lib/public/images/GoogleMaps_Logo_WithDarkOutline.svg +78 -0
  138. package/lib/public/images/GoogleMaps_Logo_WithLightOutline.svg +78 -0
  139. package/lib/public/locales/en/iModelJs.json +1 -1
  140. package/lib/public/scripts/draco_decoder.wasm +0 -0
  141. package/lib/public/scripts/draco_encoder.js +52 -0
  142. package/lib/public/scripts/draco_wasm_wrapper.js +117 -0
  143. package/lib/public/scripts/parse-imdl-worker.js +1 -1
  144. package/lib/workers/webpack/parse-imdl-worker.js +1 -1
  145. package/package.json +25 -23
  146. package/lib/public/images/google_on_non_white.png +0 -0
  147. package/lib/public/images/google_on_non_white_hdpi.png +0 -0
  148. package/lib/public/images/google_on_white.png +0 -0
  149. package/lib/public/images/google_on_white_hdpi.png +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":";;;AA0XA,kDAEC;AA5XD;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA0H;AAC1H,oDAA6J;AAE7J,4EAAyE;AACzE,8CAAkG;AAClG,uFAAoF;AACpF,2FAAwF;AACxF,+FAA4F;AAC5F,sGAAmG;AACnG,2CAAwC;AACxC,wEAAoF;AAIpF,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AAElE;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,2BAAY;IAChD,YAAmB,WAA8B,EAAE,OAAe,EAAE,WAA6B;QAC/F,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;CACF;AAJD,4CAIC;AAkGD;;GAEG;AACH,IAAiB,iBAAiB,CAuFjC;AAvFD,WAAiB,iBAAiB;IAChC;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,aAAmC,EAAE,WAA+B;QACvH,IAAI,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,+BAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,iCAAsB,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,iCAAmB,CAAC,cAAc,CAAC;YACpD,IAAI,iBAAiB,GAAyB,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAG,iCAAsB,CAAC,aAAa,EAAE,CAAC,CAAC,uBAAuB;YACtI,6DAA6D;YAC7D,MAAM,WAAW,GAAG,iCAAsB,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;YACtE,IAAI,WAAW,EAAE,CAAC;gBAChB,iBAAiB,GAAG,iBAAiB,CAAC,uBAAuB,C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AC,eAAe,CAAC,KAAuB,EAAE,EAAkB;QACtE,MAAM,YAAY,GAAG,IAAA,mCAAa,EAAC,EAAE,CAAC,CAAC;QAEvC,yDAAyD;QACzD,IAAI,YAAY,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC1B,oCAAoC;YACpC,iGAAiG;YACjG,MAAM,gBAAgB,GAAG,CAAC,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAEjF,IAAI,YAAY,GAAG,2BAA2B,CAAC;YAC/C,YAAY,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC5E,YAAY,IAAI,OAAO,CAAC;YAExB,KAAK,CAAC,WAAW,CAAC,qBAAS,CAAC,YAAY,CAAC;gBACvC,OAAO,EAAE,GAAG,qBAAS,CAAC,UAAU,iCAAiC;gBACjE,OAAO,EAAE,gCAAgC;gBACzC,MAAM,EAAE,YAAY;aACrB,CAAC,CAAC,CAAC;QACN,CAAC;IACH,CAAC;CACF;AA9DD,sDA8DC;AAED;;GAEG;AACH,SAAgB,mBAAmB;IACjC,OAAO,kDAAkD,CAAC;AAC5D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\nimport { BentleyError, BentleyStatus, GuidString, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\nimport { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from \"@itwin/core-common\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from \"./tile/internal\";\nimport { RealityDataSourceTilesetUrlImpl } from \"./RealityDataSourceTilesetUrlImpl\";\nimport { RealityDataSourceContextShareImpl } from \"./RealityDataSourceContextShareImpl\";\nimport { RealityDataSourceCesiumIonAssetImpl } from \"./RealityDataSourceCesiumIonAssetImpl\";\nimport { RealityDataSourceGoogle3dTilesImpl } from \"./internal/RealityDataSourceGoogle3dTilesImpl\";\nimport { IModelApp } from \"./IModelApp\";\nimport { getCopyrights, GoogleMapsDecorator } from \"./internal/GoogleMapsDecorator\";\nimport { DecorateContext } from \"./ViewContext\";\nimport { ScreenViewport } from \"./Viewport\";\n\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\n\n/**\n * Reality Data Operation error\n * @alpha\n */\nexport class RealityDataError extends BentleyError {\n public constructor(errorNumber: RealityDataStatus, message: string, getMetaData?: LoggingMetaData) {\n super(errorNumber, message, getMetaData);\n }\n}\n\n/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`\n * @alpha\n */\nexport interface SpatialLocationAndExtents {\n /** location of the point at the center of the reaity data */\n location: Cartographic | EcefLocation;\n /** extents of the volume around location */\n worldRange: Range3d;\n /** true if this reality data is geolocated\n * A reality data is geolocated when we can compute a valid position relative to the earth surface.\n * Note that some reality data contains custom coordinate system without any information on the relative position on earth.\n * These reality data will have a location and worldRange but will be identified by the isGeoLocated set to false.\n */\n isGeolocated: boolean;\n}\n\n/** This interface provides information to identify the product and engine that create this reality data\n * @alpha\n */\nexport interface PublisherProductInfo {\n /** product that create this reality data */\n product: string;\n /** engine that create this reality data */\n engine: string;\n /** the version of the engine that create this reality data */\n version: string;\n}\n\n/** This interface provide methods used to access a reality data from a reality data provider\n * @beta\n */\nexport interface RealityDataSource {\n readonly key: RealityDataSourceKey;\n readonly isContextShare: boolean;\n readonly realityDataId: string | undefined;\n /** Metatdata on the reality data source */\n readonly realityData: RealityData | undefined;\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\n readonly realityDataType: string | undefined;\n /** This method returns the URL to obtain the Reality Data properties.\n * @param iTwinId id of associated iTwin project\n * @returns string containing the URL to reality data.\n */\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\n /** If true, the geometricError property of the tiles will be used to compute screen-space error.\n * @alpha\n */\n readonly usesGeometricError?: boolean;\n /** If [[usesGeometricError]] is `true`, optionally specifies the maximum error, in pixels, to permit for a tile before requiring refinement of that tile.\n * Default: 16\n * @alpha\n */\n readonly maximumScreenSpaceError?: number;\n /** Given the URL of a tile's content, return the type of that content.\n * \"tileset\" indicates the content points to a JSON tileset describing the structure of the tile tree below the tile.\n * \"tile\" indicates the content points to a binary representation of the tile's graphics.\n * @alpha\n */\n getTileContentType(url: string): \"tile\" | \"tileset\";\n\n /** Gets a reality data root document json\n * @returns tile data json\n * @internal\n */\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\n /** Gets tile content\n * @param name name or path of tile\n * @returns array buffer of tile content\n * @internal\n */\n getTileContent(name: string): Promise<any>;\n /** Gets a tileset's app data json\n * @param name name or path of tile\n * @returns app data json object\n * @internal\n */\n getTileJson(name: string): Promise<any>;\n /** Gets spatial location and extents of this reality data source.\n * Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)\n * @returns spatial location and extents\n * @throws [[RealityDataError]] if source is invalid or cannot be read\n * @alpha\n */\n getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;\n /** Gets information to identify the product and engine that create this reality data\n * Will return undefined if cannot be resolved\n * @returns information to identify the product and engine that create this reality data\n * @alpha\n */\n getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;\n /** Optional, gets the tileset url associated with the reality data source\n * @returns tileset url\n * @internal\n */\n getTilesetUrl?(): string | undefined;\n}\n/** Utility functions for RealityDataSource\n * @beta\n */\nexport namespace RealityDataSource {\n /** Create a RealityDataSourceKey from a tilesetUrl.\n * @param tilesetUrl the reality data attachment url\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\n */\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\n const provider = RealityDataProvider.CesiumIonAsset;\n let cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId }; // default OSM building\n // Parse URL to extract possible asset id and key if provided\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(tilesetUrl);\n if (cesiumAsset) {\n cesiumIonAssetKey = RealityDataSource.createCesiumIonAssetKey(cesiumAsset.id, cesiumAsset.key);\n }\n return cesiumIonAssetKey;\n }\n\n // Try to extract realityDataId from URL and if not possible, use the url as the key\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\n const provider = inputProvider ? inputProvider : info.provider;\n format = inputFormat ? inputFormat : info.format;\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\n return contextShareKey;\n }\n\n // default to tileSetUrl\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\n return urlKey;\n }\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\n const format = inputFormat ? inputFormat : info.format;\n const provider = inputProvider ? inputProvider : info.provider;\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\n return contextShareKey;\n }\n /** @alpha - OrbitGtBlobProps is alpha */\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\n } else if (orbitGtBlob.rdsUrl) {\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\n }\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\n return { provider, format, id };\n }\n /** @alpha - OrbitGtBlobProps is alpha */\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\n return undefined;\n const splitIds = rdSourceKey.id.split(\":\");\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\n const sasToken = rdSourceKey.id.substring(sasTokenIndex + 2);\n const orbitGtBlob: OrbitGtBlobProps = {\n accountName: splitIds[0],\n containerName: splitIds[1],\n blobFileName: splitIds[2],\n sasToken,\n };\n return orbitGtBlob;\n }\n /** @internal - Is used by \"fdt attach cesium asset\" keyin*/\n export function createCesiumIonAssetKey(osmAssetId: number, requestKey: string): RealityDataSourceKey {\n const id = getCesiumAssetUrl(osmAssetId,requestKey);\n return {provider: RealityDataProvider.CesiumIonAsset, format: RealityDataFormat.ThreeDTile, id};\n }\n /** Return an instance of a RealityDataSource from a source key.\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\n * @alpha\n */\n export async function fromKey(key: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\n const provider = IModelApp.realityDataSourceProviders.find(key.provider);\n if (!provider) {\n Logger.logWarning(loggerCategory, `RealityDataSourceProvider \"${key.provider}\" is not registered`);\n return undefined;\n }\n\n return provider.createRealityDataSource(key, iTwinId);\n }\n}\n\n/** A named supplier of [RealityDataSource]]s.\n * The provider's name is stored in a [RealityDataSourceKey]($common). When the [[RealityDataSource]] is requested from the key,\n * the provider is looked up in [[IModelApp.realityDataSourceProviders]] by its name and, if found, its [[createRealityDataSource]] method\n * is invoked to produce the reality data source.\n * @beta\n */\n\nexport interface RealityDataSourceProvider {\n /** Produce a RealityDataSource for the specified `key`.\n * @param key Identifies the reality data source.\n * @param iTwinId A default iTwinId to use.\n * @returns the requested reality data source, or `undefined` if it could not be produced.\n */\n createRealityDataSource(key: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined>;\n /** Optionally add any decorations specific to this reality data source provider.\n * For example, the Google Photorealistic 3D Tiles reality data source provider will add the Google logo.\n */\n decorate?(_context: DecorateContext): void;\n /** Optionally add attribution logo cards to the viewport's logo div. */\n addAttributions?(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;\n /** Enables cached decorations for this provider. @see [[ViewportDecorator.useCachedDecorations]] */\n useCachedDecorations?: true | undefined;\n}\n\n/** A registry of [[RealityDataSourceProvider]]s identified by their unique names. The registry can be accessed via [[IModelApp.realityDataSourceProviders]].\n * It includes a handful of built-in providers for sources like Cesium ION, ContextShare, OrbitGT, and arbitrary public-accessible URLs.\n * Any number of additional providers can be registered. They should typically be registered just after [[IModelApp.startup]].\n * @beta\n */\nexport class RealityDataSourceProviderRegistry {\n private readonly _providers = new Map<string, RealityDataSourceProvider>();\n\n /** @internal */\n public constructor() {\n this.register(RealityDataProvider.CesiumIonAsset, {\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceCesiumIonAssetImpl.createFromKey(key, iTwinId),\n });\n this.register(RealityDataProvider.TilesetUrl, {\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceTilesetUrlImpl.createFromKey(key, iTwinId),\n });\n this.register(RealityDataProvider.ContextShare, {\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceContextShareImpl.createFromKey(key, iTwinId),\n });\n this.register(RealityDataProvider.OrbitGtBlob, {\n // ###TODO separate TilesetUrlImpl\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceTilesetUrlImpl.createFromKey(key, iTwinId),\n });\n }\n\n /** Register `provider` to produce [[RealityDataSource]]s for the specified provider `name`. */\n public register(name: string, provider: RealityDataSourceProvider): void {\n this._providers.set(name, provider);\n }\n\n /** Look up the provider registered by the specified `name`. */\n public find(name: string): RealityDataSourceProvider | undefined {\n return this._providers.get(name);\n }\n}\n\n/**\n * Options for creating a Google Photorealistic 3D Tiles reality data source provider.\n * The caller must provide either an API key or a function that returns an auth token.\n * @beta\n */\nexport type Google3dTilesProviderOptions = {\n /** Google Map Tiles API Key used to access Google 3D Tiles. */\n apiKey: string;\n getAuthToken?: never;\n /** If true, the data attributions/copyrights from the Google 3D Tiles will be displayed on screen. The Google Maps logo will always be displayed. Defaults to `true`. */\n showCreditsOnScreen?: boolean\n} | {\n apiKey?: never;\n /** Function that returns an OAuth token for authenticating with Google 3D Tiles. This token is expected to not contain the \"Bearer\" prefix. */\n getAuthToken: () => Promise<string>;\n /** If true, the data attributions/copyrights from the Google 3D Tiles will be displayed on screen. The Google Maps logo will always be displayed. Defaults to `true`. */\n showCreditsOnScreen?: boolean;\n};\n\n/**\n * Will provide Google Photorealistic 3D Tiles (in 3dTile format).\n * A valid API key or getAuthToken fuction must be supplied when creating this provider.\n * To use this provider, you must register it with [[IModelApp.realityDataSourceProviders]].\n * Example usage:\n * ```ts\n * [[include:GooglePhotorealistic3dTiles_providerApiKey]]\n * ```\n * @see [Google Photorealistic 3D Tiles]($docs/learning/frontend/GooglePhotorealistic3dTiles.md)\n * @beta\n */\nexport class Google3dTilesProvider implements RealityDataSourceProvider {\n /** Google Map Tiles API Key used to access Google 3D Tiles. */\n private _apiKey?: string;\n /** Function that returns an OAuth token for authenticating with Google 3D Tiles. This token is expected to not contain the \"Bearer\" prefix. */\n private _getAuthToken?: () => Promise<string | undefined>;\n /** Decorator for Google Maps logos. */\n private _decorator: GoogleMapsDecorator;\n /** Enables cached decorations for this provider. @see [[ViewportDecorator.useCachedDecorations]] */\n public readonly useCachedDecorations = true;\n\n public async createRealityDataSource(key: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\n if (!this._apiKey && !this._getAuthToken) {\n Logger.logError(loggerCategory, \"Either an API key or getAuthToken function are required to create a Google3dTilesProvider.\");\n return undefined;\n }\n return RealityDataSourceGoogle3dTilesImpl.createFromKey(key, iTwinId, this._apiKey, this._getAuthToken);\n }\n\n public constructor(options: Google3dTilesProviderOptions) {\n this._apiKey = options.apiKey;\n this._getAuthToken = options.getAuthToken;\n this._decorator = new GoogleMapsDecorator(options.showCreditsOnScreen ?? true);\n }\n\n /**\n * Initialize the Google 3D Tiles reality data source provider by activating its decorator, which consists of loading the correct Google Maps logo.\n * @returns `true` if the decorator was successfully activated, otherwise `false`.\n */\n public async initialize(): Promise<boolean> {\n const isActivated = await this._decorator.activate(\"satellite\");\n if (!isActivated) {\n const msg = \"Failed to activate decorator\";\n Logger.logError(loggerCategory, msg);\n throw new BentleyError(BentleyStatus.ERROR, msg);\n }\n return isActivated;\n }\n\n public decorate(_context: DecorateContext): void {\n this._decorator.decorate(_context);\n }\n\n public async addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void> {\n const copyrightMap = getCopyrights(vp);\n\n // Only add another logo card if the tiles have copyright\n if (copyrightMap.size > 0) {\n // Order by most occurances to least\n // See https://developers.google.com/maps/documentation/tile/create-renderer#display-attributions\n const sortedCopyrights = [...copyrightMap.entries()].sort((a, b) => b[1] - a[1]);\n\n let copyrightMsg = \"Data provided by:<br><ul>\";\n copyrightMsg += sortedCopyrights.map(([key]) => `<li>${key}</li>`).join(\"\");\n copyrightMsg += \"</ul>\";\n\n cards.appendChild(IModelApp.makeLogoCard({\n iconSrc: `${IModelApp.publicPath}images/google_on_white_hdpi.png`,\n heading: \"Google Photorealistic 3D Tiles\",\n notice: copyrightMsg\n }));\n }\n }\n}\n\n/** Returns the URL used for retrieving Google Photorealistic 3D Tiles.\n * @beta\n */\nexport function getGoogle3dTilesUrl() {\n return \"https://tile.googleapis.com/v1/3dtiles/root.json\";\n}\n"]}
1
+ {"version":3,"file":"RealityDataSource.js","sourceRoot":"","sources":["../../src/RealityDataSource.ts"],"names":[],"mappings":";;;AA+XA,kDAEC;AAjYD;;;+FAG+F;AAC/F;;GAEG;AACH,sDAA0H;AAC1H,oDAA6J;AAE7J,4EAAyE;AACzE,8CAAkG;AAClG,uFAAoF;AACpF,2FAAwF;AACxF,+FAA4F;AAC5F,sGAAmG;AACnG,2CAAwC;AACxC,wEAAoF;AAIpF,MAAM,cAAc,GAAW,+CAAsB,CAAC,WAAW,CAAC;AAElE;;;GAGG;AACH,MAAa,gBAAiB,SAAQ,2BAAY;IAChD,YAAmB,WAA8B,EAAE,OAAe,EAAE,WAA6B;QAC/F,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;IAC3C,CAAC;CACF;AAJD,4CAIC;AAkGD;;GAEG;AACH,IAAiB,iBAAiB,CAuFjC;AAvFD,WAAiB,iBAAiB;IAChC;;;;;OAKG;IACH,SAAgB,gBAAgB,CAAC,UAAkB,EAAE,aAAmC,EAAE,WAA+B;QACvH,IAAI,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,+BAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAC/E,IAAI,iCAAsB,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;YACrD,MAAM,QAAQ,GAAG,iCAAmB,CA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,EAAE,YAAY;aACrB,CAAC,CAAC,CAAC;QACN,CAAC;IACH,CAAC;CACF;AAnED,sDAmEC;AAED;;GAEG;AACH,SAAgB,mBAAmB;IACjC,OAAO,kDAAkD,CAAC;AAC5D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Tiles\n */\nimport { BentleyError, BentleyStatus, GuidString, Logger, LoggingMetaData, RealityDataStatus } from \"@itwin/core-bentley\";\nimport { Cartographic, EcefLocation, OrbitGtBlobProps, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey } from \"@itwin/core-common\";\nimport { Range3d } from \"@itwin/core-geometry\";\nimport { FrontendLoggerCategory } from \"./common/FrontendLoggerCategory\";\nimport { CesiumIonAssetProvider, ContextShareProvider, getCesiumAssetUrl } from \"./tile/internal\";\nimport { RealityDataSourceTilesetUrlImpl } from \"./RealityDataSourceTilesetUrlImpl\";\nimport { RealityDataSourceContextShareImpl } from \"./RealityDataSourceContextShareImpl\";\nimport { RealityDataSourceCesiumIonAssetImpl } from \"./RealityDataSourceCesiumIonAssetImpl\";\nimport { RealityDataSourceGoogle3dTilesImpl } from \"./internal/RealityDataSourceGoogle3dTilesImpl\";\nimport { IModelApp } from \"./IModelApp\";\nimport { getCopyrights, GoogleMapsDecorator } from \"./internal/GoogleMapsDecorator\";\nimport { DecorateContext } from \"./ViewContext\";\nimport { ScreenViewport } from \"./Viewport\";\n\nconst loggerCategory: string = FrontendLoggerCategory.RealityData;\n\n/**\n * Reality Data Operation error\n * @alpha\n */\nexport class RealityDataError extends BentleyError {\n public constructor(errorNumber: RealityDataStatus, message: string, getMetaData?: LoggingMetaData) {\n super(errorNumber, message, getMetaData);\n }\n}\n\n/** This interface provide spatial location and volume of interest, in meters, centered around `spatial location`\n * @alpha\n */\nexport interface SpatialLocationAndExtents {\n /** location of the point at the center of the reaity data */\n location: Cartographic | EcefLocation;\n /** extents of the volume around location */\n worldRange: Range3d;\n /** true if this reality data is geolocated\n * A reality data is geolocated when we can compute a valid position relative to the earth surface.\n * Note that some reality data contains custom coordinate system without any information on the relative position on earth.\n * These reality data will have a location and worldRange but will be identified by the isGeoLocated set to false.\n */\n isGeolocated: boolean;\n}\n\n/** This interface provides information to identify the product and engine that create this reality data\n * @alpha\n */\nexport interface PublisherProductInfo {\n /** product that create this reality data */\n product: string;\n /** engine that create this reality data */\n engine: string;\n /** the version of the engine that create this reality data */\n version: string;\n}\n\n/** This interface provide methods used to access a reality data from a reality data provider\n * @beta\n */\nexport interface RealityDataSource {\n readonly key: RealityDataSourceKey;\n readonly isContextShare: boolean;\n readonly realityDataId: string | undefined;\n /** Metatdata on the reality data source */\n readonly realityData: RealityData | undefined;\n /** The reality data type (e.g.: \"RealityMesh3DTiles\", OPC, Terrain3DTiles, Cesium3DTiles, ... )*/\n readonly realityDataType: string | undefined;\n /** This method returns the URL to obtain the Reality Data properties.\n * @param iTwinId id of associated iTwin project\n * @returns string containing the URL to reality data.\n */\n getServiceUrl(iTwinId: GuidString | undefined): Promise<string | undefined>;\n /** If true, the geometricError property of the tiles will be used to compute screen-space error.\n * @alpha\n */\n readonly usesGeometricError?: boolean;\n /** If [[usesGeometricError]] is `true`, optionally specifies the maximum error, in pixels, to permit for a tile before requiring refinement of that tile.\n * Default: 16\n * @alpha\n */\n readonly maximumScreenSpaceError?: number;\n /** Given the URL of a tile's content, return the type of that content.\n * \"tileset\" indicates the content points to a JSON tileset describing the structure of the tile tree below the tile.\n * \"tile\" indicates the content points to a binary representation of the tile's graphics.\n * @alpha\n */\n getTileContentType(url: string): \"tile\" | \"tileset\";\n\n /** Gets a reality data root document json\n * @returns tile data json\n * @internal\n */\n getRootDocument(iTwinId: GuidString | undefined): Promise<any>;\n /** Gets tile content\n * @param name name or path of tile\n * @returns array buffer of tile content\n * @internal\n */\n getTileContent(name: string): Promise<any>;\n /** Gets a tileset's app data json\n * @param name name or path of tile\n * @returns app data json object\n * @internal\n */\n getTileJson(name: string): Promise<any>;\n /** Gets spatial location and extents of this reality data source.\n * Will return undefined if cannot be resolved or is unbounded (cover entire earth eg: Open Street Map Building from Ion Asset)\n * @returns spatial location and extents\n * @throws [[RealityDataError]] if source is invalid or cannot be read\n * @alpha\n */\n getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;\n /** Gets information to identify the product and engine that create this reality data\n * Will return undefined if cannot be resolved\n * @returns information to identify the product and engine that create this reality data\n * @alpha\n */\n getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;\n /** Optional, gets the tileset url associated with the reality data source\n * @returns tileset url\n * @internal\n */\n getTilesetUrl?(): string | undefined;\n}\n/** Utility functions for RealityDataSource\n * @beta\n */\nexport namespace RealityDataSource {\n /** Create a RealityDataSourceKey from a tilesetUrl.\n * @param tilesetUrl the reality data attachment url\n * @param inputProvider identify the RealityDataProvider if known, otherwise function will try to extract it from the tilesetUrl\n * @param inputFormat identify the RealityDataFormat if known, otherwise function will try to extract it from the tilesetUrl\n * @returns the RealityDataSourceKey that uniquely identify a reality data for a provider\n */\n export function createKeyFromUrl(tilesetUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\n let format = inputFormat ? inputFormat : RealityDataFormat.fromUrl(tilesetUrl);\n if (CesiumIonAssetProvider.isProviderUrl(tilesetUrl)) {\n const provider = RealityDataProvider.CesiumIonAsset;\n let cesiumIonAssetKey: RealityDataSourceKey = { provider, format, id: CesiumIonAssetProvider.osmBuildingId }; // default OSM building\n // Parse URL to extract possible asset id and key if provided\n const cesiumAsset = CesiumIonAssetProvider.parseCesiumUrl(tilesetUrl);\n if (cesiumAsset) {\n cesiumIonAssetKey = RealityDataSource.createCesiumIonAssetKey(cesiumAsset.id, cesiumAsset.key);\n }\n return cesiumIonAssetKey;\n }\n\n // Try to extract realityDataId from URL and if not possible, use the url as the key\n if (ContextShareProvider.isProviderUrl(tilesetUrl)) {\n const info = ContextShareProvider.getInfoFromUrl(tilesetUrl);\n const provider = inputProvider ? inputProvider : info.provider;\n format = inputFormat ? inputFormat : info.format;\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id, iTwinId: info.iTwinId };\n return contextShareKey;\n }\n\n // default to tileSetUrl\n const provider2 = inputProvider ? inputProvider : RealityDataProvider.TilesetUrl;\n const urlKey: RealityDataSourceKey = { provider: provider2, format, id: tilesetUrl };\n return urlKey;\n }\n /** @alpha - was used for a very specific case of point cloud (opc) attachment that should not be made public */\n export function createKeyFromBlobUrl(blobUrl: string, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\n const info = ContextShareProvider.getInfoFromBlobUrl(blobUrl);\n const format = inputFormat ? inputFormat : info.format;\n const provider = inputProvider ? inputProvider : info.provider;\n const contextShareKey: RealityDataSourceKey = { provider, format, id: info.id };\n return contextShareKey;\n }\n /** @alpha - OrbitGtBlobProps is alpha */\n export function createKeyFromOrbitGtBlobProps(orbitGtBlob: OrbitGtBlobProps, inputProvider?: RealityDataProvider, inputFormat?: RealityDataFormat): RealityDataSourceKey {\n const format = inputFormat ? inputFormat : RealityDataFormat.OPC;\n if (orbitGtBlob.blobFileName && orbitGtBlob.blobFileName.toLowerCase().startsWith(\"http\")) {\n return RealityDataSource.createKeyFromBlobUrl(orbitGtBlob.blobFileName, inputProvider, format);\n } else if (orbitGtBlob.rdsUrl) {\n return RealityDataSource.createKeyFromUrl(orbitGtBlob.rdsUrl, inputProvider, format);\n }\n const provider = inputProvider ? inputProvider : RealityDataProvider.OrbitGtBlob;\n const id = `${orbitGtBlob.accountName}:${orbitGtBlob.containerName}:${orbitGtBlob.blobFileName}:?${orbitGtBlob.sasToken}`;\n return { provider, format, id };\n }\n /** @alpha - OrbitGtBlobProps is alpha */\n export function createOrbitGtBlobPropsFromKey(rdSourceKey: RealityDataSourceKey): OrbitGtBlobProps | undefined {\n if (rdSourceKey.provider !== RealityDataProvider.OrbitGtBlob)\n return undefined;\n const splitIds = rdSourceKey.id.split(\":\");\n const sasTokenIndex = rdSourceKey.id.indexOf(\":?\");\n const sasToken = rdSourceKey.id.substring(sasTokenIndex + 2);\n const orbitGtBlob: OrbitGtBlobProps = {\n accountName: splitIds[0],\n containerName: splitIds[1],\n blobFileName: splitIds[2],\n sasToken,\n };\n return orbitGtBlob;\n }\n /** @internal - Is used by \"fdt attach cesium asset\" keyin*/\n export function createCesiumIonAssetKey(osmAssetId: number, requestKey: string): RealityDataSourceKey {\n const id = getCesiumAssetUrl(osmAssetId,requestKey);\n return {provider: RealityDataProvider.CesiumIonAsset, format: RealityDataFormat.ThreeDTile, id};\n }\n /** Return an instance of a RealityDataSource from a source key.\n * There will aways be only one reality data RealityDataSource for a corresponding reality data source key.\n * @alpha\n */\n export async function fromKey(key: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\n const provider = IModelApp.realityDataSourceProviders.find(key.provider);\n if (!provider) {\n Logger.logWarning(loggerCategory, `RealityDataSourceProvider \"${key.provider}\" is not registered`);\n return undefined;\n }\n\n return provider.createRealityDataSource(key, iTwinId);\n }\n}\n\n/** A named supplier of [RealityDataSource]]s.\n * The provider's name is stored in a [RealityDataSourceKey]($common). When the [[RealityDataSource]] is requested from the key,\n * the provider is looked up in [[IModelApp.realityDataSourceProviders]] by its name and, if found, its [[createRealityDataSource]] method\n * is invoked to produce the reality data source.\n * @beta\n */\n\nexport interface RealityDataSourceProvider {\n /** Produce a RealityDataSource for the specified `key`.\n * @param key Identifies the reality data source.\n * @param iTwinId A default iTwinId to use.\n * @returns the requested reality data source, or `undefined` if it could not be produced.\n */\n createRealityDataSource(key: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined>;\n /** Optionally add any decorations specific to this reality data source provider.\n * For example, the Google Photorealistic 3D Tiles reality data source provider will add the Google logo.\n */\n decorate?(_context: DecorateContext): void;\n /** Optionally add attribution logo cards to the viewport's logo div. */\n addAttributions?(cards: HTMLTableElement, vp: ScreenViewport): Promise<void>;\n /** Enables cached decorations for this provider. @see [[ViewportDecorator.useCachedDecorations]] */\n useCachedDecorations?: true | undefined;\n}\n\n/** A registry of [[RealityDataSourceProvider]]s identified by their unique names. The registry can be accessed via [[IModelApp.realityDataSourceProviders]].\n * It includes a handful of built-in providers for sources like Cesium ION, ContextShare, OrbitGT, and arbitrary public-accessible URLs.\n * Any number of additional providers can be registered. They should typically be registered just after [[IModelApp.startup]].\n * @beta\n */\nexport class RealityDataSourceProviderRegistry {\n private readonly _providers = new Map<string, RealityDataSourceProvider>();\n\n /** @internal */\n public constructor() {\n this.register(RealityDataProvider.CesiumIonAsset, {\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceCesiumIonAssetImpl.createFromKey(key, iTwinId),\n });\n this.register(RealityDataProvider.TilesetUrl, {\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceTilesetUrlImpl.createFromKey(key, iTwinId),\n });\n this.register(RealityDataProvider.ContextShare, {\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceContextShareImpl.createFromKey(key, iTwinId),\n });\n this.register(RealityDataProvider.OrbitGtBlob, {\n // ###TODO separate TilesetUrlImpl\n createRealityDataSource: async (key, iTwinId) => RealityDataSourceTilesetUrlImpl.createFromKey(key, iTwinId),\n });\n }\n\n /** Register `provider` to produce [[RealityDataSource]]s for the specified provider `name`. */\n public register(name: string, provider: RealityDataSourceProvider): void {\n this._providers.set(name, provider);\n }\n\n /** Look up the provider registered by the specified `name`. */\n public find(name: string): RealityDataSourceProvider | undefined {\n return this._providers.get(name);\n }\n}\n\n/**\n * Options for creating a Google Photorealistic 3D Tiles reality data source provider.\n * The caller must provide either an API key or a function that returns an auth token.\n * @beta\n */\nexport type Google3dTilesProviderOptions = {\n /** Google Map Tiles API Key used to access Google 3D Tiles. */\n apiKey: string;\n getAuthToken?: never;\n /** If true, the data attributions/copyrights from the Google 3D Tiles will be displayed on screen. The Google Maps logo will always be displayed. Defaults to `true`. */\n showCreditsOnScreen?: boolean\n} | {\n apiKey?: never;\n /** Function that returns an OAuth token for authenticating with Google 3D Tiles. This token is expected to not contain the \"Bearer\" prefix. */\n getAuthToken: () => Promise<string>;\n /** If true, the data attributions/copyrights from the Google 3D Tiles will be displayed on screen. The Google Maps logo will always be displayed. Defaults to `true`. */\n showCreditsOnScreen?: boolean;\n};\n\n/**\n * Will provide Google Photorealistic 3D Tiles (in 3dTile format).\n * A valid API key or getAuthToken fuction must be supplied when creating this provider.\n * To use this provider, you must register it with [[IModelApp.realityDataSourceProviders]].\n * Example usage:\n * ```ts\n * [[include:GooglePhotorealistic3dTiles_providerApiKey]]\n * ```\n * @see [Google Photorealistic 3D Tiles]($docs/learning/frontend/GooglePhotorealistic3dTiles.md)\n * @beta\n */\nexport class Google3dTilesProvider implements RealityDataSourceProvider {\n /** Google Map Tiles API Key used to access Google 3D Tiles. */\n private _apiKey?: string;\n /** Function that returns an OAuth token for authenticating with Google 3D Tiles. This token is expected to not contain the \"Bearer\" prefix. */\n private _getAuthToken?: () => Promise<string | undefined>;\n /** Decorator for Google Maps logos. */\n private _decorator: GoogleMapsDecorator;\n /** Enables cached decorations for this provider. @see [[ViewportDecorator.useCachedDecorations]] */\n public readonly useCachedDecorations = true;\n\n public async createRealityDataSource(key: RealityDataSourceKey, iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\n if (!this._apiKey && !this._getAuthToken) {\n Logger.logError(loggerCategory, \"Either an API key or getAuthToken function are required to create a Google3dTilesProvider.\");\n return undefined;\n }\n return RealityDataSourceGoogle3dTilesImpl.createFromKey(key, iTwinId, this._apiKey, this._getAuthToken);\n }\n\n public constructor(options: Google3dTilesProviderOptions) {\n this._apiKey = options.apiKey;\n this._getAuthToken = options.getAuthToken;\n this._decorator = new GoogleMapsDecorator(options.showCreditsOnScreen ?? true);\n }\n\n /**\n * Initialize the Google 3D Tiles reality data source provider by activating its decorator, which consists of loading the correct Google Maps logo.\n * @returns `true` if the decorator was successfully activated, otherwise `false`.\n */\n public async initialize(): Promise<boolean> {\n const isActivated = await this._decorator.activate(\"satellite\");\n if (!isActivated) {\n const msg = \"Failed to activate decorator\";\n Logger.logError(loggerCategory, msg);\n throw new BentleyError(BentleyStatus.ERROR, msg);\n }\n return isActivated;\n }\n\n public decorate(_context: DecorateContext): void {\n this._decorator.decorate(_context);\n }\n\n public async addAttributions(cards: HTMLTableElement, vp: ScreenViewport): Promise<void> {\n const copyrightMap = getCopyrights(vp);\n\n // Only add another logo card if the tiles have copyright\n if (copyrightMap.size > 0) {\n // Order by most occurances to least\n // See https://developers.google.com/maps/documentation/tile/create-renderer#display-attributions\n const sortedCopyrights = [...copyrightMap.entries()].sort((a, b) => b[1] - a[1]);\n\n let copyrightMsg = \"Data provided by:<br><ul>\";\n copyrightMsg += sortedCopyrights.map(([key]) => `<li>${key}</li>`).join(\"\");\n copyrightMsg += \"</ul>\";\n\n const iconSrc = document.createElement(\"img\");\n iconSrc.src = `${IModelApp.publicPath}images/GoogleMaps_Logo_Gray.svg`;\n iconSrc.style.padding = \"10px 10px 5px 10px\";\n\n cards.appendChild(IModelApp.makeLogoCard({\n iconSrc,\n iconWidth: 98,\n heading: \"Google Photorealistic 3D Tiles\",\n notice: copyrightMsg\n }));\n }\n }\n}\n\n/** Returns the URL used for retrieving Google Photorealistic 3D Tiles.\n * @beta\n */\nexport function getGoogle3dTilesUrl() {\n return \"https://tile.googleapis.com/v1/3dtiles/root.json\";\n}\n"]}
@@ -71,8 +71,17 @@ export declare class RenderContext {
71
71
  export declare class DynamicsContext extends RenderContext {
72
72
  private _foreground?;
73
73
  private _overlay?;
74
- /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]]. */
74
+ /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]].
75
+ * These graphics are drawn as [[GraphicType.Scene]].
76
+ * @see [[addOverlay]] to add a graphic to be drawn as an overlay instead.
77
+ */
75
78
  addGraphic(graphic: RenderGraphic): void;
79
+ /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]].
80
+ * These graphics are drawn as part of the viewport's scene as described by [[GraphicType.Scene]], except
81
+ * that they always draw on top of other graphics as with [[GraphicType.WorldOverlay]].
82
+ * @see [[addGraphic]] to add an ordinary scene graphic instead.
83
+ */
84
+ addOverlay(graphic: RenderGraphic): void;
76
85
  /** @internal */
77
86
  add(graphic: RenderGraphic, isOverlay: boolean): void;
78
87
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"ViewContext.d.ts","sourceRoot":"","sources":["../../src/ViewContext.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAU,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAoB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAe,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,YAAY,EAAG,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC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AAG,SAAS,GAAG,kBAAkB,GAAG,SAAS;IAoBpI,gBAAgB;IACT,uBAAuB,CAAC,OAAO,EAAE,UAAU;IAIlD,gBAAgB;IACT,eAAe,CAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;IASrE,+DAA+D;IAC/D,IAAW,QAAQ,oBAAoC;IACvD,2EAA2E;IAC3E,IAAW,kBAAkB,oBAAoC;IACjE,gFAAgF;IAChF,IAAW,eAAe,oBAAiC;IAC3D,gBAAgB;IAChB,IAAW,iBAAiB,wCAA2C;IACvE,gBAAgB;IAChB,IAAW,aAAa,oCAAuC;IAE/D,gBAAgB;IACT,mBAAmB,CAAC,UAAU,EAAE,uBAAuB,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;CAG3F"}
@@ -86,10 +86,21 @@ exports.RenderContext = RenderContext;
86
86
  class DynamicsContext extends RenderContext {
87
87
  _foreground;
88
88
  _overlay;
89
- /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]]. */
89
+ /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]].
90
+ * These graphics are drawn as [[GraphicType.Scene]].
91
+ * @see [[addOverlay]] to add a graphic to be drawn as an overlay instead.
92
+ */
90
93
  addGraphic(graphic) {
91
94
  this.add(graphic, false);
92
95
  }
96
+ /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]].
97
+ * These graphics are drawn as part of the viewport's scene as described by [[GraphicType.Scene]], except
98
+ * that they always draw on top of other graphics as with [[GraphicType.WorldOverlay]].
99
+ * @see [[addGraphic]] to add an ordinary scene graphic instead.
100
+ */
101
+ addOverlay(graphic) {
102
+ this.add(graphic, true);
103
+ }
93
104
  /** @internal */
94
105
  add(graphic, isOverlay) {
95
106
  const key = isOverlay ? "_overlay" : "_foreground";
@@ -1 +1 @@
1
- {"version":3,"file":"ViewContext.js","sourceRoot":"","sources":["../../src/ViewContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;A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U,EAAE,OAAO,EAAE,CAAC;IACxD,CAAC;CACF;AAxID,oCAwIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport {\n Matrix3d, Point2d,\n Point3d, Range1d, Transform, XAndY,\n} from \"@itwin/core-geometry\";\nimport { Frustum, FrustumPlanes, ViewFlags } from \"@itwin/core-common\";\nimport { CachedDecoration, DecorationsCache } from \"./DecorationsCache\";\nimport { IModelApp } from \"./IModelApp\";\nimport { PlanarClipMaskState } from \"./PlanarClipMaskState\";\nimport { CanvasDecoration } from \"./render/CanvasDecoration\";\nimport { Decorations } from \"./render/Decorations\";\nimport { GraphicBranch, GraphicBranchOptions } from \"./render/GraphicBranch\";\nimport { GraphicBuilder, ViewportGraphicBuilderOptions } from \"./render/GraphicBuilder\";\nimport { GraphicList, RenderGraphic } from \"./render/RenderGraphic\";\nimport { RenderPlanarClassifier } from \"./internal/render/RenderPlanarClassifier\";\nimport { RenderSystem, } from \"./render/RenderSystem\";\nimport { RenderTarget } from \"./render/RenderTarget\";\nimport { Scene } from \"./render/Scene\";\nimport { SpatialClassifierTileTreeReference, Tile, TileGraphicType, TileLoadStatus, TileTreeReference } from \"./tile/internal\";\nimport { ViewingSpace } from \"./ViewingSpace\";\nimport { ELEMENT_MARKED_FOR_REMOVAL, ScreenViewport, Viewport, ViewportDecorator } from \"./Viewport\";\nimport { ActiveSpatialClassifier } from \"./SpatialClassifiersState\";\nimport { GraphicType } from \"./common/render/GraphicType\";\nimport { RenderTextureDrape } from \"./internal/render/RenderTextureDrape\";\n\n/** Provides context for producing [[RenderGraphic]]s for drawing within a [[Viewport]].\n * @public\n * @extensions\n */\nexport class RenderContext {\n /** ViewFlags extracted from the context's [[Viewport]]. */\n public readonly viewFlags: ViewFlags;\n private readonly _viewport: Viewport;\n /** Frustum extracted from the context's [[Viewport]]. */\n public readonly frustum: Frustum;\n /** Frustum planes extracted from the context's [[Viewport]]. */\n public readonly frustumPlanes: FrustumPlanes;\n\n constructor(vp: Viewport, frustum?: Frustum) {\n this._viewport = vp;\n this.viewFlags = vp.viewFlags;\n this.frustum = frustum ? frustum : vp.getFrustum();\n this.frustumPlanes = FrustumPlanes.fromFrustum(this.frustum);\n }\n\n /** Given a point in world coordinates, determine approximately how many pixels it occupies on screen based on this context's frustum. */\n public getPixelSizeAtPoint(inPoint?: Point3d): number {\n return this.viewport.viewingSpace.getPixelSizeAtPoint(inPoint);\n }\n\n /** The [[Viewport]] associated with this context. */\n public get viewport(): Viewport {\n return this._viewport;\n }\n\n /** The [[RenderSystem]] being used to produce graphics for this context. */\n public get renderSystem(): RenderSystem {\n return this.target.renderSystem;\n }\n\n /** @internal */\n public get target(): RenderTarget { return this.viewport.target; }\n\n /** @internal */\n protected _createGraphicBuilder(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this.target.createGraphicBuilder({ ...options, viewport: this.viewport });\n }\n\n /** Create a builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\n * @returns A builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\n */\n public createSceneGraphicBuilder(transform?: Transform): GraphicBuilder {\n return this._createGraphicBuilder({ type: GraphicType.Scene, placement: transform });\n }\n\n /** Create a graphic from a [[GraphicBranch]]. */\n public createGraphicBranch(branch: GraphicBranch, location: Transform, opts?: GraphicBranchOptions): RenderGraphic {\n return this.target.renderSystem.createGraphicBranch(branch, location, opts);\n }\n\n /** Create a [[RenderGraphic]] which groups a set of graphics into a node in a scene graph, applying to each a transform and optional clip volume and symbology overrides.\n * @param branch Contains the group of graphics and the symbology overrides.\n * @param location the local-to-world transform applied to the grouped graphics.\n * @returns A RenderGraphic suitable for drawing the scene graph node within this context's [[Viewport]].\n * @see [[RenderSystem.createBranch]]\n */\n public createBranch(branch: GraphicBranch, location: Transform): RenderGraphic { return this.createGraphicBranch(branch, location); }\n\n /** Given the size of a logical pixel in meters, convert it to the size of a physical pixel in meters, if [[RenderSystem.dpiAwareLOD]] is `true`.\n * Used when computing LOD for graphics.\n * @internal\n */\n public adjustPixelSizeForLOD(cssPixelSize: number): number {\n return this.viewport.target.adjustPixelSizeForLOD(cssPixelSize);\n }\n}\n\n/** Provides context for an [[InteractiveTool]] to display decorations representing its current state.\n * @see [[InteractiveTool.onDynamicFrame]]\n * @public\n */\nexport class DynamicsContext extends RenderContext {\n private _foreground?: GraphicList;\n private _overlay?: GraphicList;\n\n /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]]. */\n public addGraphic(graphic: RenderGraphic): void {\n this.add(graphic, false);\n }\n\n /** @internal */\n public add(graphic: RenderGraphic, isOverlay: boolean) {\n const key = isOverlay ? \"_overlay\" : \"_foreground\";\n const list = this[key] ?? (this[key] = []);\n list.push(graphic);\n }\n\n /** @internal */\n public changeDynamics(): void {\n this.viewport.changeDynamics(this._foreground, this._overlay);\n }\n\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\n * @param options Options describing how to create the builder.\n * @returns A builder that produces a [[RenderGraphic]].\n */\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this._createGraphicBuilder(options);\n }\n}\n\n/** Arguments supplied to [[DecorateContext.create]].\n * @public\n */\nexport interface DecorateContextCreateArgs {\n /** The viewport to be decorated. */\n viewport: ScreenViewport;\n /** The set of decoration graphics to be populated by the context. */\n output: Decorations;\n /** Optional cache. If omitted, one will be created.\n * @internal\n */\n cache?: DecorationsCache;\n}\n\n/** Provides context for a [[ViewportDecorator]] to add [[Decorations]] to be rendered within a [[Viewport]].\n * @public\n * @extensions\n */\nexport class DecorateContext extends RenderContext {\n private readonly _decorations: Decorations;\n private readonly _cache: DecorationsCache;\n private _curCacheableDecorator?: ViewportDecorator;\n\n /** The [[ScreenViewport]] in which this context's [[Decorations]] will be drawn. */\n public override get viewport(): ScreenViewport {\n return super.viewport as ScreenViewport;\n }\n\n /** @internal */\n constructor(vp: ScreenViewport, decorations: Decorations, cache: DecorationsCache) {\n super(vp);\n this._decorations = decorations;\n this._cache = cache;\n }\n\n /** Create a new DecorateContext.\n * @param args Describes the inputs to the context.\n * @note Typically the [[ScreenViewport]] takes care of creating the context for you.\n * @public\n */\n public static create(args: DecorateContextCreateArgs): DecorateContext {\n return new DecorateContext(args.viewport, args.output, args.cache ?? new DecorationsCache());\n }\n\n /** Create a builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\n * @param type The type of builder to create.\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\n * @param id If the decoration is to be pickable, a unique identifier to associate with the resultant [[RenderGraphic]].\n * @returns A builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\n * @see [[IModelConnection.transientIds]] for obtaining an ID for a pickable decoration.\n * @see [[createGraphic]] for more options.\n */\n public createGraphicBuilder(type: GraphicType, transform?: Transform, id?: Id64String): GraphicBuilder {\n return this.createGraphic({ type, placement: transform, pickable: undefined !== id ? { id } : undefined });\n }\n\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\n * @param options Options describing how to create the builder.\n * @returns A builder that produces a [[RenderGraphic]].\n */\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this._createGraphicBuilder(options);\n }\n\n /** @internal */\n public addFromDecorator(decorator: ViewportDecorator): void {\n assert(undefined === this._curCacheableDecorator);\n try {\n if (decorator.useCachedDecorations) {\n const cached = this._cache.get(decorator);\n if (cached) {\n this.restoreCache(cached);\n return;\n }\n\n this._curCacheableDecorator = decorator;\n }\n\n decorator.decorate(this);\n } finally {\n this._curCacheableDecorator = undefined;\n }\n }\n\n /** Restores decorations onto this context from the specified array of cached decorations. */\n private restoreCache(cachedDecorations: CachedDecoration[]) {\n cachedDecorations.forEach((cachedDecoration) => {\n switch (cachedDecoration.type) {\n case \"graphic\":\n this.addDecoration(cachedDecoration.graphicType, cachedDecoration.graphicOwner);\n break;\n case \"canvas\":\n this.addCanvasDecoration(cachedDecoration.canvasDecoration, cachedDecoration.atFront);\n break;\n case \"html\":\n this.addHtmlDecoration(cachedDecoration.htmlElement);\n break;\n }\n });\n }\n\n private _appendToCache(decoration: CachedDecoration) {\n assert(undefined !== this._curCacheableDecorator);\n this._cache.add(this._curCacheableDecorator, decoration);\n }\n\n /** Calls [[GraphicBuilder.finish]] on the supplied builder to obtain a [[RenderGraphic]], then adds the graphic to the appropriate list of\n * [[Decorations]].\n * @param builder The builder from which to extract the graphic.\n * @note The builder should not be used after calling this method.\n */\n public addDecorationFromBuilder(builder: GraphicBuilder) {\n this.addDecoration(builder.type, builder.finish());\n }\n\n /** Adds a graphic to the set of [[Decorations]] to be drawn in this context's [[ScreenViewport]].\n * @param The type of the graphic, which determines to which list of decorations it is added.\n * @param decoration The decoration graphic to add.\n * @note The type must match the type with which the [[RenderGraphic]]'s [[GraphicBuilder]] was constructed.\n * @see [[DecorateContext.addDecorationFromBuilder]] for a more convenient API.\n */\n public addDecoration(type: GraphicType, decoration: RenderGraphic) {\n if (this._curCacheableDecorator) {\n const graphicOwner = this.target.renderSystem.createGraphicOwner(decoration);\n this._appendToCache({ type: \"graphic\", graphicOwner, graphicType: type });\n decoration = graphicOwner;\n }\n\n switch (type) {\n case GraphicType.Scene:\n if (undefined === this._decorations.normal)\n this._decorations.normal = [];\n this._decorations.normal.push(decoration);\n break;\n\n case GraphicType.WorldDecoration:\n if (!this._decorations.world)\n this._decorations.world = [];\n this._decorations.world.push(decoration);\n break;\n\n case GraphicType.WorldOverlay:\n if (!this._decorations.worldOverlay)\n this._decorations.worldOverlay = [];\n this._decorations.worldOverlay.push(decoration);\n break;\n\n case GraphicType.ViewOverlay:\n if (!this._decorations.viewOverlay)\n this._decorations.viewOverlay = [];\n this._decorations.viewOverlay.push(decoration);\n break;\n\n case GraphicType.ViewBackground:\n this.setViewBackground(decoration);\n break;\n }\n }\n\n /** Add a [[CanvasDecoration]] to be drawn in this context's [[ScreenViewport]]. */\n public addCanvasDecoration(decoration: CanvasDecoration, atFront = false) {\n if (this._curCacheableDecorator)\n this._appendToCache({ type: \"canvas\", canvasDecoration: decoration, atFront });\n\n if (undefined === this._decorations.canvasDecorations)\n this._decorations.canvasDecorations = [];\n\n const list = this._decorations.canvasDecorations;\n if (0 === list.length || true === atFront)\n list.push(decoration);\n else\n list.unshift(decoration);\n }\n\n /** Add an HTMLElement to be drawn as a decoration in this context's [[ScreenViewport]]. */\n public addHtmlDecoration(decoration: HTMLElement) {\n if (this._curCacheableDecorator)\n this._appendToCache({ type: \"html\", htmlElement: decoration });\n\n // an element decoration being added might already be on the decorationDiv, just marked for removal\n if (decoration[ELEMENT_MARKED_FOR_REMOVAL]) {\n decoration[ELEMENT_MARKED_FOR_REMOVAL] = false;\n } else if (decoration.parentElement !== this.viewport.decorationDiv) {\n this.viewport.decorationDiv.appendChild(decoration);\n }\n }\n\n /** @internal */\n public drawStandardGrid(gridOrigin: Point3d, rMatrix: Matrix3d, spacing: XAndY, gridsPerRef: number, _isoGrid: boolean = false, _fixedRepetitions?: Point2d): void {\n const vp = this.viewport;\n\n if (vp.viewingGlobe)\n return;\n\n const color = vp.getContrastToBackgroundColor();\n const planarGrid = this.viewport.target.renderSystem.createPlanarGrid(vp.getFrustum(), { origin: gridOrigin, rMatrix, spacing, gridsPerRef, color });\n if (planarGrid) {\n this.addDecoration(GraphicType.WorldDecoration, planarGrid);\n }\n }\n\n /** Display skyBox graphic that encompasses entire scene and rotates with camera.\n * @see [[RenderSystem.createSkyBox]].\n */\n public setSkyBox(graphic: RenderGraphic) {\n this._decorations.skyBox = graphic;\n }\n\n /** Set the graphic to be displayed behind all other geometry as the background of this context's [[ScreenViewport]]. */\n public setViewBackground(graphic: RenderGraphic) {\n this._decorations.viewBackground = graphic;\n }\n}\n\n/** Context used to create the scene to be drawn in a [[Viewport]]. The scene consists of a set of [[RenderGraphic]]s produced by the\n * [[TileTree]]s visible within the viewport. Creating the scene may result in the enqueueing of requests for [[Tile]] content which\n * should be displayed in the viewport but are not yet loaded.\n * @public\n */\nexport class SceneContext extends RenderContext {\n private _missingChildTiles = false;\n /** The graphics comprising the scene. */\n public readonly scene = new Scene();\n\n /** @internal */\n public readonly missingTiles = new Set<Tile>();\n\n /** @internal */\n public markChildrenLoading(): void {\n this._missingChildTiles = true;\n }\n\n /** @internal */\n public get hasMissingTiles(): boolean {\n return this._missingChildTiles || this.missingTiles.size > 0;\n }\n\n private _viewingSpace?: ViewingSpace;\n private _graphicType: TileGraphicType = TileGraphicType.Scene;\n\n public constructor(vp: Viewport, frustum?: Frustum) {\n super(vp, frustum);\n }\n\n /** The viewed volume containing the scene. */\n public get viewingSpace(): ViewingSpace {\n return undefined !== this._viewingSpace ? this._viewingSpace : this.viewport.viewingSpace;\n }\n\n /** @internal */\n public get graphicType() { return this._graphicType; }\n\n /** Add the specified graphic to the scene. */\n public outputGraphic(graphic: RenderGraphic): void {\n switch (this._graphicType) {\n case TileGraphicType.BackgroundMap:\n this.backgroundGraphics.push(graphic);\n break;\n case TileGraphicType.Overlay:\n this.overlayGraphics.push(graphic);\n break;\n default:\n this.graphics.push(graphic);\n break;\n }\n }\n\n /** Indicate that the specified tile is desired for the scene but is not yet ready. A request to load its contents will later be enqueued. */\n public insertMissingTile(tile: Tile): void {\n switch (tile.loadStatus) {\n case TileLoadStatus.NotLoaded:\n case TileLoadStatus.Queued:\n case TileLoadStatus.Loading:\n this.missingTiles.add(tile);\n break;\n }\n }\n\n /** @internal */\n public requestMissingTiles(): void {\n IModelApp.tileAdmin.requestTiles(this.viewport, this.missingTiles);\n }\n\n /** @internal */\n public addPlanarClassifier(classifiedModelId: Id64String, classifierTree?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState): RenderPlanarClassifier | undefined {\n // Target may have the classifier from a previous frame; if not we must create one.\n let classifier = this.viewport.target.getPlanarClassifier(classifiedModelId);\n if (undefined === classifier)\n classifier = this.viewport.target.createPlanarClassifier(classifierTree?.activeClassifier);\n\n // Either way, we need to collect the graphics to draw for this frame, and record that we did so.\n if (undefined !== classifier) {\n this.planarClassifiers.set(classifiedModelId, classifier);\n classifier.setSource(classifierTree, planarClipMask);\n }\n\n return classifier;\n }\n\n /** @internal */\n public getPlanarClassifierForModel(modelId: Id64String) {\n return this.planarClassifiers.get(modelId);\n }\n\n /** @internal */\n public addBackgroundDrapedModel(drapedTreeRef: TileTreeReference, _heightRange: Range1d | undefined): RenderTextureDrape | undefined {\n const drapedTree = drapedTreeRef.treeOwner.tileTree;\n if (undefined === drapedTree)\n return undefined;\n\n const id = drapedTree.modelId;\n let drape = this.getTextureDrapeForModel(id);\n if (undefined !== drape)\n return drape;\n\n drape = this.viewport.target.getTextureDrape(id);\n if (undefined === drape && this.viewport.backgroundDrapeMap)\n drape = this.viewport.target.renderSystem.createBackgroundMapDrape(drapedTreeRef, this.viewport.backgroundDrapeMap);\n\n if (undefined !== drape)\n this.textureDrapes.set(id, drape);\n\n return drape;\n }\n\n /** @internal */\n public getTextureDrapeForModel(modelId: Id64String) {\n return this.textureDrapes.get(modelId);\n }\n\n /** @internal */\n public withGraphicType(type: TileGraphicType, func: () => void): void {\n const prevType = this._graphicType;\n this._graphicType = type;\n\n func();\n\n this._graphicType = prevType;\n }\n\n /** The graphics in the scene that will be drawn with depth. */\n public get graphics() { return this.scene.foreground; }\n /** The graphics that will be drawn behind everything else in the scene. */\n public get backgroundGraphics() { return this.scene.background; }\n /** The graphics that will be drawn in front of everything else in the scene. */\n public get overlayGraphics() { return this.scene.overlay; }\n /** @internal */\n public get planarClassifiers() { return this.scene.planarClassifiers; }\n /** @internal */\n public get textureDrapes() { return this.scene.textureDrapes; }\n\n /** @internal */\n public setVolumeClassifier(classifier: ActiveSpatialClassifier, modelId: Id64String): void {\n this.scene.volumeClassifier = { classifier, modelId };\n }\n}\n"]}
1
+ {"version":3,"file":"ViewContext.js","sourceRoot":"","sources":["../../src/ViewContext.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAyD;AAKzD,oDAAuE;AACvE,yDAAwE;AACxE,2CAAwC;AAUxC,0CAAuC;AACvC,8CAA+H;AAE/H,yCAAqG;AAErG,6DAA0D;AAG1D;;;GAGG;AACH,MAAa,aAAa;IACxB,2DAA2D;IAC3C,SAAS,CAAY;IACpB,SAAS,CAAW;IACrC,yDAAyD;IACzC,OAAO,CAAU;IACjC,gEAAgE;IAChD,aAAa,CAAgB;IAE7C,YAAY,EAAY,EAAE,OAAiB;QACzC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,2BAAa,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,yIAAyI;IAClI,mBAAmB,CAAC,OAAiB;QAC1C,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,qDAAqD;IACrD,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,4EAA4E;IAC5E,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;IAClC,CAAC;IAED,gBAAgB;IAChB,IAAW,MAAM,KAAmB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAElE,gBAAgB;IACN,qBAAqB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AAgB;IAChB,IAAW,iBAAiB,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACvE,gBAAgB;IAChB,IAAW,aAAa,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAE/D,gBAAgB;IACT,mBAAmB,CAAC,UAAmC,EAAE,OAAmB;QACjF,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;IACxD,CAAC;CACF;AAxID,oCAwIC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Rendering\n */\n\nimport { assert, Id64String } from \"@itwin/core-bentley\";\nimport {\n Matrix3d, Point2d,\n Point3d, Range1d, Transform, XAndY,\n} from \"@itwin/core-geometry\";\nimport { Frustum, FrustumPlanes, ViewFlags } from \"@itwin/core-common\";\nimport { CachedDecoration, DecorationsCache } from \"./DecorationsCache\";\nimport { IModelApp } from \"./IModelApp\";\nimport { PlanarClipMaskState } from \"./PlanarClipMaskState\";\nimport { CanvasDecoration } from \"./render/CanvasDecoration\";\nimport { Decorations } from \"./render/Decorations\";\nimport { GraphicBranch, GraphicBranchOptions } from \"./render/GraphicBranch\";\nimport { GraphicBuilder, ViewportGraphicBuilderOptions } from \"./render/GraphicBuilder\";\nimport { GraphicList, RenderGraphic } from \"./render/RenderGraphic\";\nimport { RenderPlanarClassifier } from \"./internal/render/RenderPlanarClassifier\";\nimport { RenderSystem, } from \"./render/RenderSystem\";\nimport { RenderTarget } from \"./render/RenderTarget\";\nimport { Scene } from \"./render/Scene\";\nimport { SpatialClassifierTileTreeReference, Tile, TileGraphicType, TileLoadStatus, TileTreeReference } from \"./tile/internal\";\nimport { ViewingSpace } from \"./ViewingSpace\";\nimport { ELEMENT_MARKED_FOR_REMOVAL, ScreenViewport, Viewport, ViewportDecorator } from \"./Viewport\";\nimport { ActiveSpatialClassifier } from \"./SpatialClassifiersState\";\nimport { GraphicType } from \"./common/render/GraphicType\";\nimport { RenderTextureDrape } from \"./internal/render/RenderTextureDrape\";\n\n/** Provides context for producing [[RenderGraphic]]s for drawing within a [[Viewport]].\n * @public\n * @extensions\n */\nexport class RenderContext {\n /** ViewFlags extracted from the context's [[Viewport]]. */\n public readonly viewFlags: ViewFlags;\n private readonly _viewport: Viewport;\n /** Frustum extracted from the context's [[Viewport]]. */\n public readonly frustum: Frustum;\n /** Frustum planes extracted from the context's [[Viewport]]. */\n public readonly frustumPlanes: FrustumPlanes;\n\n constructor(vp: Viewport, frustum?: Frustum) {\n this._viewport = vp;\n this.viewFlags = vp.viewFlags;\n this.frustum = frustum ? frustum : vp.getFrustum();\n this.frustumPlanes = FrustumPlanes.fromFrustum(this.frustum);\n }\n\n /** Given a point in world coordinates, determine approximately how many pixels it occupies on screen based on this context's frustum. */\n public getPixelSizeAtPoint(inPoint?: Point3d): number {\n return this.viewport.viewingSpace.getPixelSizeAtPoint(inPoint);\n }\n\n /** The [[Viewport]] associated with this context. */\n public get viewport(): Viewport {\n return this._viewport;\n }\n\n /** The [[RenderSystem]] being used to produce graphics for this context. */\n public get renderSystem(): RenderSystem {\n return this.target.renderSystem;\n }\n\n /** @internal */\n public get target(): RenderTarget { return this.viewport.target; }\n\n /** @internal */\n protected _createGraphicBuilder(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this.target.createGraphicBuilder({ ...options, viewport: this.viewport });\n }\n\n /** Create a builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\n * @returns A builder for creating a [[GraphicType.Scene]] [[RenderGraphic]] for rendering within this context's [[Viewport]].\n */\n public createSceneGraphicBuilder(transform?: Transform): GraphicBuilder {\n return this._createGraphicBuilder({ type: GraphicType.Scene, placement: transform });\n }\n\n /** Create a graphic from a [[GraphicBranch]]. */\n public createGraphicBranch(branch: GraphicBranch, location: Transform, opts?: GraphicBranchOptions): RenderGraphic {\n return this.target.renderSystem.createGraphicBranch(branch, location, opts);\n }\n\n /** Create a [[RenderGraphic]] which groups a set of graphics into a node in a scene graph, applying to each a transform and optional clip volume and symbology overrides.\n * @param branch Contains the group of graphics and the symbology overrides.\n * @param location the local-to-world transform applied to the grouped graphics.\n * @returns A RenderGraphic suitable for drawing the scene graph node within this context's [[Viewport]].\n * @see [[RenderSystem.createBranch]]\n */\n public createBranch(branch: GraphicBranch, location: Transform): RenderGraphic { return this.createGraphicBranch(branch, location); }\n\n /** Given the size of a logical pixel in meters, convert it to the size of a physical pixel in meters, if [[RenderSystem.dpiAwareLOD]] is `true`.\n * Used when computing LOD for graphics.\n * @internal\n */\n public adjustPixelSizeForLOD(cssPixelSize: number): number {\n return this.viewport.target.adjustPixelSizeForLOD(cssPixelSize);\n }\n}\n\n/** Provides context for an [[InteractiveTool]] to display decorations representing its current state.\n * @see [[InteractiveTool.onDynamicFrame]]\n * @public\n */\nexport class DynamicsContext extends RenderContext {\n private _foreground?: GraphicList;\n private _overlay?: GraphicList;\n\n /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]].\n * These graphics are drawn as [[GraphicType.Scene]].\n * @see [[addOverlay]] to add a graphic to be drawn as an overlay instead.\n */\n public addGraphic(graphic: RenderGraphic): void {\n this.add(graphic, false);\n }\n\n /** Add a graphic to the list of dynamic graphics to be drawn in this context's [[Viewport]].\n * These graphics are drawn as part of the viewport's scene as described by [[GraphicType.Scene]], except\n * that they always draw on top of other graphics as with [[GraphicType.WorldOverlay]].\n * @see [[addGraphic]] to add an ordinary scene graphic instead.\n */\n public addOverlay(graphic: RenderGraphic): void {\n this.add(graphic, true);\n }\n\n /** @internal */\n public add(graphic: RenderGraphic, isOverlay: boolean) {\n const key = isOverlay ? \"_overlay\" : \"_foreground\";\n const list = this[key] ?? (this[key] = []);\n list.push(graphic);\n }\n\n /** @internal */\n public changeDynamics(): void {\n this.viewport.changeDynamics(this._foreground, this._overlay);\n }\n\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\n * @param options Options describing how to create the builder.\n * @returns A builder that produces a [[RenderGraphic]].\n */\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this._createGraphicBuilder(options);\n }\n}\n\n/** Arguments supplied to [[DecorateContext.create]].\n * @public\n */\nexport interface DecorateContextCreateArgs {\n /** The viewport to be decorated. */\n viewport: ScreenViewport;\n /** The set of decoration graphics to be populated by the context. */\n output: Decorations;\n /** Optional cache. If omitted, one will be created.\n * @internal\n */\n cache?: DecorationsCache;\n}\n\n/** Provides context for a [[ViewportDecorator]] to add [[Decorations]] to be rendered within a [[Viewport]].\n * @public\n * @extensions\n */\nexport class DecorateContext extends RenderContext {\n private readonly _decorations: Decorations;\n private readonly _cache: DecorationsCache;\n private _curCacheableDecorator?: ViewportDecorator;\n\n /** The [[ScreenViewport]] in which this context's [[Decorations]] will be drawn. */\n public override get viewport(): ScreenViewport {\n return super.viewport as ScreenViewport;\n }\n\n /** @internal */\n constructor(vp: ScreenViewport, decorations: Decorations, cache: DecorationsCache) {\n super(vp);\n this._decorations = decorations;\n this._cache = cache;\n }\n\n /** Create a new DecorateContext.\n * @param args Describes the inputs to the context.\n * @note Typically the [[ScreenViewport]] takes care of creating the context for you.\n * @public\n */\n public static create(args: DecorateContextCreateArgs): DecorateContext {\n return new DecorateContext(args.viewport, args.output, args.cache ?? new DecorationsCache());\n }\n\n /** Create a builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\n * @param type The type of builder to create.\n * @param transform the local-to-world transform in which the builder's geometry is to be defined.\n * @param id If the decoration is to be pickable, a unique identifier to associate with the resultant [[RenderGraphic]].\n * @returns A builder for creating a [[RenderGraphic]] of the specified type appropriate for rendering within this context's [[Viewport]].\n * @see [[IModelConnection.transientIds]] for obtaining an ID for a pickable decoration.\n * @see [[createGraphic]] for more options.\n */\n public createGraphicBuilder(type: GraphicType, transform?: Transform, id?: Id64String): GraphicBuilder {\n return this.createGraphic({ type, placement: transform, pickable: undefined !== id ? { id } : undefined });\n }\n\n /** Create a builder for producing a [[RenderGraphic]] appropriate for rendering within this context's [[Viewport]].\n * @param options Options describing how to create the builder.\n * @returns A builder that produces a [[RenderGraphic]].\n */\n public createGraphic(options: Omit<ViewportGraphicBuilderOptions, \"viewport\">): GraphicBuilder {\n return this._createGraphicBuilder(options);\n }\n\n /** @internal */\n public addFromDecorator(decorator: ViewportDecorator): void {\n assert(undefined === this._curCacheableDecorator);\n try {\n if (decorator.useCachedDecorations) {\n const cached = this._cache.get(decorator);\n if (cached) {\n this.restoreCache(cached);\n return;\n }\n\n this._curCacheableDecorator = decorator;\n }\n\n decorator.decorate(this);\n } finally {\n this._curCacheableDecorator = undefined;\n }\n }\n\n /** Restores decorations onto this context from the specified array of cached decorations. */\n private restoreCache(cachedDecorations: CachedDecoration[]) {\n cachedDecorations.forEach((cachedDecoration) => {\n switch (cachedDecoration.type) {\n case \"graphic\":\n this.addDecoration(cachedDecoration.graphicType, cachedDecoration.graphicOwner);\n break;\n case \"canvas\":\n this.addCanvasDecoration(cachedDecoration.canvasDecoration, cachedDecoration.atFront);\n break;\n case \"html\":\n this.addHtmlDecoration(cachedDecoration.htmlElement);\n break;\n }\n });\n }\n\n private _appendToCache(decoration: CachedDecoration) {\n assert(undefined !== this._curCacheableDecorator);\n this._cache.add(this._curCacheableDecorator, decoration);\n }\n\n /** Calls [[GraphicBuilder.finish]] on the supplied builder to obtain a [[RenderGraphic]], then adds the graphic to the appropriate list of\n * [[Decorations]].\n * @param builder The builder from which to extract the graphic.\n * @note The builder should not be used after calling this method.\n */\n public addDecorationFromBuilder(builder: GraphicBuilder) {\n this.addDecoration(builder.type, builder.finish());\n }\n\n /** Adds a graphic to the set of [[Decorations]] to be drawn in this context's [[ScreenViewport]].\n * @param The type of the graphic, which determines to which list of decorations it is added.\n * @param decoration The decoration graphic to add.\n * @note The type must match the type with which the [[RenderGraphic]]'s [[GraphicBuilder]] was constructed.\n * @see [[DecorateContext.addDecorationFromBuilder]] for a more convenient API.\n */\n public addDecoration(type: GraphicType, decoration: RenderGraphic) {\n if (this._curCacheableDecorator) {\n const graphicOwner = this.target.renderSystem.createGraphicOwner(decoration);\n this._appendToCache({ type: \"graphic\", graphicOwner, graphicType: type });\n decoration = graphicOwner;\n }\n\n switch (type) {\n case GraphicType.Scene:\n if (undefined === this._decorations.normal)\n this._decorations.normal = [];\n this._decorations.normal.push(decoration);\n break;\n\n case GraphicType.WorldDecoration:\n if (!this._decorations.world)\n this._decorations.world = [];\n this._decorations.world.push(decoration);\n break;\n\n case GraphicType.WorldOverlay:\n if (!this._decorations.worldOverlay)\n this._decorations.worldOverlay = [];\n this._decorations.worldOverlay.push(decoration);\n break;\n\n case GraphicType.ViewOverlay:\n if (!this._decorations.viewOverlay)\n this._decorations.viewOverlay = [];\n this._decorations.viewOverlay.push(decoration);\n break;\n\n case GraphicType.ViewBackground:\n this.setViewBackground(decoration);\n break;\n }\n }\n\n /** Add a [[CanvasDecoration]] to be drawn in this context's [[ScreenViewport]]. */\n public addCanvasDecoration(decoration: CanvasDecoration, atFront = false) {\n if (this._curCacheableDecorator)\n this._appendToCache({ type: \"canvas\", canvasDecoration: decoration, atFront });\n\n if (undefined === this._decorations.canvasDecorations)\n this._decorations.canvasDecorations = [];\n\n const list = this._decorations.canvasDecorations;\n if (0 === list.length || true === atFront)\n list.push(decoration);\n else\n list.unshift(decoration);\n }\n\n /** Add an HTMLElement to be drawn as a decoration in this context's [[ScreenViewport]]. */\n public addHtmlDecoration(decoration: HTMLElement) {\n if (this._curCacheableDecorator)\n this._appendToCache({ type: \"html\", htmlElement: decoration });\n\n // an element decoration being added might already be on the decorationDiv, just marked for removal\n if (decoration[ELEMENT_MARKED_FOR_REMOVAL]) {\n decoration[ELEMENT_MARKED_FOR_REMOVAL] = false;\n } else if (decoration.parentElement !== this.viewport.decorationDiv) {\n this.viewport.decorationDiv.appendChild(decoration);\n }\n }\n\n /** @internal */\n public drawStandardGrid(gridOrigin: Point3d, rMatrix: Matrix3d, spacing: XAndY, gridsPerRef: number, _isoGrid: boolean = false, _fixedRepetitions?: Point2d): void {\n const vp = this.viewport;\n\n if (vp.viewingGlobe)\n return;\n\n const color = vp.getContrastToBackgroundColor();\n const planarGrid = this.viewport.target.renderSystem.createPlanarGrid(vp.getFrustum(), { origin: gridOrigin, rMatrix, spacing, gridsPerRef, color });\n if (planarGrid) {\n this.addDecoration(GraphicType.WorldDecoration, planarGrid);\n }\n }\n\n /** Display skyBox graphic that encompasses entire scene and rotates with camera.\n * @see [[RenderSystem.createSkyBox]].\n */\n public setSkyBox(graphic: RenderGraphic) {\n this._decorations.skyBox = graphic;\n }\n\n /** Set the graphic to be displayed behind all other geometry as the background of this context's [[ScreenViewport]]. */\n public setViewBackground(graphic: RenderGraphic) {\n this._decorations.viewBackground = graphic;\n }\n}\n\n/** Context used to create the scene to be drawn in a [[Viewport]]. The scene consists of a set of [[RenderGraphic]]s produced by the\n * [[TileTree]]s visible within the viewport. Creating the scene may result in the enqueueing of requests for [[Tile]] content which\n * should be displayed in the viewport but are not yet loaded.\n * @public\n */\nexport class SceneContext extends RenderContext {\n private _missingChildTiles = false;\n /** The graphics comprising the scene. */\n public readonly scene = new Scene();\n\n /** @internal */\n public readonly missingTiles = new Set<Tile>();\n\n /** @internal */\n public markChildrenLoading(): void {\n this._missingChildTiles = true;\n }\n\n /** @internal */\n public get hasMissingTiles(): boolean {\n return this._missingChildTiles || this.missingTiles.size > 0;\n }\n\n private _viewingSpace?: ViewingSpace;\n private _graphicType: TileGraphicType = TileGraphicType.Scene;\n\n public constructor(vp: Viewport, frustum?: Frustum) {\n super(vp, frustum);\n }\n\n /** The viewed volume containing the scene. */\n public get viewingSpace(): ViewingSpace {\n return undefined !== this._viewingSpace ? this._viewingSpace : this.viewport.viewingSpace;\n }\n\n /** @internal */\n public get graphicType() { return this._graphicType; }\n\n /** Add the specified graphic to the scene. */\n public outputGraphic(graphic: RenderGraphic): void {\n switch (this._graphicType) {\n case TileGraphicType.BackgroundMap:\n this.backgroundGraphics.push(graphic);\n break;\n case TileGraphicType.Overlay:\n this.overlayGraphics.push(graphic);\n break;\n default:\n this.graphics.push(graphic);\n break;\n }\n }\n\n /** Indicate that the specified tile is desired for the scene but is not yet ready. A request to load its contents will later be enqueued. */\n public insertMissingTile(tile: Tile): void {\n switch (tile.loadStatus) {\n case TileLoadStatus.NotLoaded:\n case TileLoadStatus.Queued:\n case TileLoadStatus.Loading:\n this.missingTiles.add(tile);\n break;\n }\n }\n\n /** @internal */\n public requestMissingTiles(): void {\n IModelApp.tileAdmin.requestTiles(this.viewport, this.missingTiles);\n }\n\n /** @internal */\n public addPlanarClassifier(classifiedModelId: Id64String, classifierTree?: SpatialClassifierTileTreeReference, planarClipMask?: PlanarClipMaskState): RenderPlanarClassifier | undefined {\n // Target may have the classifier from a previous frame; if not we must create one.\n let classifier = this.viewport.target.getPlanarClassifier(classifiedModelId);\n if (undefined === classifier)\n classifier = this.viewport.target.createPlanarClassifier(classifierTree?.activeClassifier);\n\n // Either way, we need to collect the graphics to draw for this frame, and record that we did so.\n if (undefined !== classifier) {\n this.planarClassifiers.set(classifiedModelId, classifier);\n classifier.setSource(classifierTree, planarClipMask);\n }\n\n return classifier;\n }\n\n /** @internal */\n public getPlanarClassifierForModel(modelId: Id64String) {\n return this.planarClassifiers.get(modelId);\n }\n\n /** @internal */\n public addBackgroundDrapedModel(drapedTreeRef: TileTreeReference, _heightRange: Range1d | undefined): RenderTextureDrape | undefined {\n const drapedTree = drapedTreeRef.treeOwner.tileTree;\n if (undefined === drapedTree)\n return undefined;\n\n const id = drapedTree.modelId;\n let drape = this.getTextureDrapeForModel(id);\n if (undefined !== drape)\n return drape;\n\n drape = this.viewport.target.getTextureDrape(id);\n if (undefined === drape && this.viewport.backgroundDrapeMap)\n drape = this.viewport.target.renderSystem.createBackgroundMapDrape(drapedTreeRef, this.viewport.backgroundDrapeMap);\n\n if (undefined !== drape)\n this.textureDrapes.set(id, drape);\n\n return drape;\n }\n\n /** @internal */\n public getTextureDrapeForModel(modelId: Id64String) {\n return this.textureDrapes.get(modelId);\n }\n\n /** @internal */\n public withGraphicType(type: TileGraphicType, func: () => void): void {\n const prevType = this._graphicType;\n this._graphicType = type;\n\n func();\n\n this._graphicType = prevType;\n }\n\n /** The graphics in the scene that will be drawn with depth. */\n public get graphics() { return this.scene.foreground; }\n /** The graphics that will be drawn behind everything else in the scene. */\n public get backgroundGraphics() { return this.scene.background; }\n /** The graphics that will be drawn in front of everything else in the scene. */\n public get overlayGraphics() { return this.scene.overlay; }\n /** @internal */\n public get planarClassifiers() { return this.scene.planarClassifiers; }\n /** @internal */\n public get textureDrapes() { return this.scene.textureDrapes; }\n\n /** @internal */\n public setVolumeClassifier(classifier: ActiveSpatialClassifier, modelId: Id64String): void {\n this.scene.volumeClassifier = { classifier, modelId };\n }\n}\n"]}
@@ -76,12 +76,12 @@ class GoogleMapsDecorator {
76
76
  /** Activate the logo based on the given map type. */
77
77
  async activate(mapType) {
78
78
  // Pick the logo that is the most visible on the background map
79
- const imageName = mapType === "roadmap" ?
80
- "google_on_white" :
81
- "google_on_non_white";
79
+ const imageName = mapType === "satellite" ?
80
+ "GoogleMaps_Logo_WithDarkOutline" :
81
+ "GoogleMaps_Logo_WithLightOutline";
82
82
  // We need to move the logo right after the 'i.js' button
83
83
  this.logo.offset = new core_geometry_1.Point3d(45, 10);
84
- return this.logo.activate(Sprites_1.IconSprites.getSpriteFromUrl(`${IModelApp_1.IModelApp.publicPath}images/${imageName}.png`));
84
+ return this.logo.activate(Sprites_1.IconSprites.getSpriteFromUrl(`${IModelApp_1.IModelApp.publicPath}images/${imageName}.svg`));
85
85
  }
86
86
  ;
87
87
  /** Decorate implementation */
@@ -105,8 +105,8 @@ class GoogleMapsDecorator {
105
105
  elem.style.fontSize = "11px";
106
106
  elem.style.textWrap = "wrap";
107
107
  elem.style.position = "absolute";
108
- elem.style.bottom = "10px";
109
- elem.style.left = "107px";
108
+ elem.style.bottom = "14px";
109
+ elem.style.left = "155px";
110
110
  context.addHtmlDecoration(elem);
111
111
  };
112
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleMapsDecorator.js","sourceRoot":"","sources":["../../../src/internal/GoogleMapsDecorator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA4I/F,sCAcC;AAxJD,wDAA+C;AAG/C,4CAAyC;AAEzC,wCAAiD;AASjD;;GAEG;AACH,MAAa,cAAc;IACjB,OAAO,CAAU;IAEzB,4DAA4D;IAC5C,QAAQ,GAAG,IAAI,uBAAO,EAAE,CAAC;IAEjC,OAAO,CAAsB;IAErC,IAAW,MAAM,CAAC,MAA2B;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,0CAA0C;IAC1C,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,4DAA4D;IACrD,qBAAqB,CAAC,OAAwB;QACnD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ;YACzC,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4CAA4C;IAE5C,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AG,MAAM,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;QAE1B,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC;CACH;AArDD,kDAqDC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,EAAkB;IAC9C,MAAM,KAAK,GAAG,qBAAS,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC/C,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,MAAM,IAAI,IAAI,KAAyB,EAAE,CAAC;YAC7C,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;oBAClD,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;oBACjD,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { CanvasDecoration } from \"../render/CanvasDecoration\";\nimport { DecorateContext } from \"../ViewContext\";\nimport { IModelApp } from \"../IModelApp\";\nimport { Decorator } from \"../ViewManager\";\nimport { IconSprites, Sprite } from \"../Sprites\";\nimport { RealityTile } from \"../tile/internal\";\nimport { ScreenViewport } from \"../Viewport\";\n\n/** Layer types that can be added to the map.\n * @internal\n */\ntype GoogleMapsMapTypes = \"roadmap\" | \"satellite\" | \"terrain\";\n\n/** A simple decorator that shows the logo at a given screen position.\n * @internal\n */\nexport class LogoDecoration implements CanvasDecoration {\n private _sprite?: Sprite;\n\n /** The current position of the logo in view coordinates. */\n public readonly position = new Point3d();\n\n private _offset: Point3d | undefined;\n\n public set offset(offset: Point3d | undefined) {\n this._offset = offset;\n }\n\n /** The logo offset in view coordinates.*/\n public get offset() {\n return this._offset;\n }\n\n /** Move the logo to the lower left corner of the screen. */\n public moveToLowerLeftCorner(context: DecorateContext): boolean {\n if (!this._sprite || !this._sprite.isLoaded)\n return false;\n\n this.position.x = this._offset?.x ?? 0;\n this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;\n if (this._offset?.y)\n this.position.y -= this._offset.y;\n return true;\n }\n\n /* TODO: Add other move methods as needed */\n\n /** Indicate if the logo is loaded and ready to be drawn. */\n public get isLoaded() { return this._sprite?.isLoaded ?? false; }\n\n public async activate(sprite: Sprite): Promise<boolean> {\n this._sprite = sprite;\n return new Promise<boolean>((resolve, _reject) => {\n sprite.loadPromise.then(() => {\n resolve(true);\n }).catch(() => {\n resolve (false);\n });\n });\n }\n\n /** Draw this sprite onto the supplied canvas.\n * @see [[CanvasDecoration.drawDecoration]]\n */\n public drawDecoration(ctx: CanvasRenderingContext2D): void {\n if (this.isLoaded && this._sprite?.image !== undefined) {\n // Draw image with an origin at the top left corner\n ctx.drawImage(this._sprite.image, 0, 0);\n }\n }\n\n public decorate(context: DecorateContext) {\n context.addCanvasDecoration(this);\n }\n}\n\n/** A decorator that adds the Google Maps logo to the lower left corner of the screen.\n * @internal\n */\nexport class GoogleMapsDecorator implements Decorator {\n public readonly logo = new LogoDecoration();\n private _showCreditsOnScreen?: boolean;\n\n /** Create a new GoogleMapsDecorator.\n * @param showCreditsOnScreen If true, the data attributions/copyrights from the Google Photorealistic 3D Tiles will be displayed on screen. The Google Maps logo will always be displayed.\n */\n constructor(showCreditsOnScreen?: boolean) {\n this._showCreditsOnScreen = showCreditsOnScreen;\n }\n\n /** Activate the logo based on the given map type. */\n public async activate(mapType: GoogleMapsMapTypes): Promise<boolean> {\n // Pick the logo that is the most visible on the background map\n const imageName = mapType === \"roadmap\" ?\n \"google_on_white\" :\n \"google_on_non_white\";\n\n // We need to move the logo right after the 'i.js' button\n this.logo.offset = new Point3d(45, 10);\n\n return this.logo.activate(IconSprites.getSpriteFromUrl(`${IModelApp.publicPath}images/${imageName}.png`));\n };\n\n /** Decorate implementation */\n public decorate = (context: DecorateContext) => {\n if (!this.logo.isLoaded)\n return;\n this.logo.moveToLowerLeftCorner(context);\n this.logo.decorate(context);\n\n if (!this._showCreditsOnScreen)\n return;\n\n // Get data attribution (copyright) text\n const copyrightMap = getCopyrights(context.viewport);\n // Order by most occurances to least\n // See https://developers.google.com/maps/documentation/tile/create-renderer#display-attributions\n const sortedCopyrights = [...copyrightMap.entries()].sort((a, b) => b[1] - a[1]);\n const copyrightText = sortedCopyrights.map(([key]) => ` • ${key}`).join(\"\");\n\n // Create and add element, offset to leave space for i.js and Google logos\n const elem = document.createElement(\"div\");\n elem.innerHTML = copyrightText;\n elem.style.color = \"white\";\n elem.style.fontSize = \"11px\";\n elem.style.textWrap = \"wrap\";\n elem.style.position = \"absolute\";\n elem.style.bottom = \"10px\";\n elem.style.left = \"107px\";\n\n context.addHtmlDecoration(elem);\n };\n}\n\n/** Get copyrights from tiles currently in the viewport.\n * @internal\n */\nexport function getCopyrights(vp: ScreenViewport): Map<string, number> {\n const tiles = IModelApp.tileAdmin.getTilesForUser(vp)?.selected;\n const copyrightMap = new Map<string, number>();\n if (tiles) {\n for (const tile of tiles as Set<RealityTile>) {\n if (tile.copyright) {\n for (const copyright of tile.copyright.split(\";\")) {\n const currentCount = copyrightMap.get(copyright);\n copyrightMap.set(copyright, currentCount ? currentCount + 1 : 1);\n }\n }\n }\n }\n return copyrightMap;\n}"]}
1
+ {"version":3,"file":"GoogleMapsDecorator.js","sourceRoot":"","sources":["../../../src/internal/GoogleMapsDecorator.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AA4I/F,sCAcC;AAxJD,wDAA+C;AAG/C,4CAAyC;AAEzC,wCAAiD;AASjD;;GAEG;AACH,MAAa,cAAc;IACjB,OAAO,CAAU;IAEzB,4DAA4D;IAC5C,QAAQ,GAAG,IAAI,uBAAO,EAAE,CAAC;IAEjC,OAAO,CAAsB;IAErC,IAAW,MAAM,CAAC,MAA2B;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,0CAA0C;IAC1C,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,4DAA4D;IACrD,qBAAqB,CAAC,OAAwB;QACnD,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ;YACzC,OAAO,KAAK,CAAC;QAEf,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAChF,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4CAA4C;IAE5C,4DAA4D;IAC5D,IAAW,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC;I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,QAAQ,GAAG,UAAU,CAAC;QACjC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;QAE1B,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC,CAAC;CACH;AArDD,kDAqDC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,EAAkB;IAC9C,MAAM,KAAK,GAAG,qBAAS,CAAC,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC/C,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,MAAM,IAAI,IAAI,KAAyB,EAAE,CAAC;YAC7C,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;gBACnB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;oBAClD,MAAM,YAAY,GAAG,YAAY,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;oBACjD,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACnE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport { Point3d } from \"@itwin/core-geometry\";\nimport { CanvasDecoration } from \"../render/CanvasDecoration\";\nimport { DecorateContext } from \"../ViewContext\";\nimport { IModelApp } from \"../IModelApp\";\nimport { Decorator } from \"../ViewManager\";\nimport { IconSprites, Sprite } from \"../Sprites\";\nimport { RealityTile } from \"../tile/internal\";\nimport { ScreenViewport } from \"../Viewport\";\n\n/** Layer types that can be added to the map.\n * @internal\n */\ntype GoogleMapsMapTypes = \"roadmap\" | \"satellite\" | \"terrain\";\n\n/** A simple decorator that shows the logo at a given screen position.\n * @internal\n */\nexport class LogoDecoration implements CanvasDecoration {\n private _sprite?: Sprite;\n\n /** The current position of the logo in view coordinates. */\n public readonly position = new Point3d();\n\n private _offset: Point3d | undefined;\n\n public set offset(offset: Point3d | undefined) {\n this._offset = offset;\n }\n\n /** The logo offset in view coordinates.*/\n public get offset() {\n return this._offset;\n }\n\n /** Move the logo to the lower left corner of the screen. */\n public moveToLowerLeftCorner(context: DecorateContext): boolean {\n if (!this._sprite || !this._sprite.isLoaded)\n return false;\n\n this.position.x = this._offset?.x ?? 0;\n this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;\n if (this._offset?.y)\n this.position.y -= this._offset.y;\n return true;\n }\n\n /* TODO: Add other move methods as needed */\n\n /** Indicate if the logo is loaded and ready to be drawn. */\n public get isLoaded() { return this._sprite?.isLoaded ?? false; }\n\n public async activate(sprite: Sprite): Promise<boolean> {\n this._sprite = sprite;\n return new Promise<boolean>((resolve, _reject) => {\n sprite.loadPromise.then(() => {\n resolve(true);\n }).catch(() => {\n resolve (false);\n });\n });\n }\n\n /** Draw this sprite onto the supplied canvas.\n * @see [[CanvasDecoration.drawDecoration]]\n */\n public drawDecoration(ctx: CanvasRenderingContext2D): void {\n if (this.isLoaded && this._sprite?.image !== undefined) {\n // Draw image with an origin at the top left corner\n ctx.drawImage(this._sprite.image, 0, 0);\n }\n }\n\n public decorate(context: DecorateContext) {\n context.addCanvasDecoration(this);\n }\n}\n\n/** A decorator that adds the Google Maps logo to the lower left corner of the screen.\n * @internal\n */\nexport class GoogleMapsDecorator implements Decorator {\n public readonly logo = new LogoDecoration();\n private _showCreditsOnScreen?: boolean;\n\n /** Create a new GoogleMapsDecorator.\n * @param showCreditsOnScreen If true, the data attributions/copyrights from the Google Photorealistic 3D Tiles will be displayed on screen. The Google Maps logo will always be displayed.\n */\n constructor(showCreditsOnScreen?: boolean) {\n this._showCreditsOnScreen = showCreditsOnScreen;\n }\n\n /** Activate the logo based on the given map type. */\n public async activate(mapType: GoogleMapsMapTypes): Promise<boolean> {\n // Pick the logo that is the most visible on the background map\n const imageName = mapType === \"satellite\" ?\n \"GoogleMaps_Logo_WithDarkOutline\" :\n \"GoogleMaps_Logo_WithLightOutline\";\n\n // We need to move the logo right after the 'i.js' button\n this.logo.offset = new Point3d(45, 10);\n\n return this.logo.activate(IconSprites.getSpriteFromUrl(`${IModelApp.publicPath}images/${imageName}.svg`));\n };\n\n /** Decorate implementation */\n public decorate = (context: DecorateContext) => {\n if (!this.logo.isLoaded)\n return;\n this.logo.moveToLowerLeftCorner(context);\n this.logo.decorate(context);\n\n if (!this._showCreditsOnScreen)\n return;\n\n // Get data attribution (copyright) text\n const copyrightMap = getCopyrights(context.viewport);\n // Order by most occurances to least\n // See https://developers.google.com/maps/documentation/tile/create-renderer#display-attributions\n const sortedCopyrights = [...copyrightMap.entries()].sort((a, b) => b[1] - a[1]);\n const copyrightText = sortedCopyrights.map(([key]) => ` • ${key}`).join(\"\");\n\n // Create and add element, offset to leave space for i.js and Google logos\n const elem = document.createElement(\"div\");\n elem.innerHTML = copyrightText;\n elem.style.color = \"white\";\n elem.style.fontSize = \"11px\";\n elem.style.textWrap = \"wrap\";\n elem.style.position = \"absolute\";\n elem.style.bottom = \"14px\";\n elem.style.left = \"155px\";\n\n context.addHtmlDecoration(elem);\n };\n}\n\n/** Get copyrights from tiles currently in the viewport.\n * @internal\n */\nexport function getCopyrights(vp: ScreenViewport): Map<string, number> {\n const tiles = IModelApp.tileAdmin.getTilesForUser(vp)?.selected;\n const copyrightMap = new Map<string, number>();\n if (tiles) {\n for (const tile of tiles as Set<RealityTile>) {\n if (tile.copyright) {\n for (const copyright of tile.copyright.split(\";\")) {\n const currentCount = copyrightMap.get(copyright);\n copyrightMap.set(copyright, currentCount ? currentCount + 1 : 1);\n }\n }\n }\n }\n return copyrightMap;\n}"]}
@@ -9,7 +9,7 @@ export { PerformanceMetrics } from "./render/webgl/PerformanceMetrics";
9
9
  export { type GLTimerResult, RenderDiagnostics, type RenderSystemDebugControl } from "./render/RenderSystemDebugControl";
10
10
  export { formatAnimationBranchId } from "./render/AnimationBranchState";
11
11
  export { PrimitiveVisibility, type RenderTargetDebugControl } from "./render/RenderTargetDebugControl";
12
- export { acquireImdlDecoder, appendQueryParams, ArcGisErrorCode, ArcGisGeometryReaderJSON, type ArcGisGetServiceJsonArgs, ArcGISImageryProvider, type ArcGISServiceMetadata, ArcGisUtilities, type ArcGisValidateSourceArgs, createSpatialTileTreeReferences, deflateCoordinates, type FeatureAttributeDrivenSymbology, FeatureGeometryBaseRenderer, type FeatureGeometryRenderer, FeatureGraphicsRenderer, type FeatureSymbolizedRenderer, type FeatureSymbologyRenderer, GltfReader, type GltfReaderArgs, type GltfReaderResult, type GraphicsGeometryRenderer, ImageryMapTileTree, type ImdlDecoder, ImdlReader, type MapLayerInfoFromTileTree, MapTileTreeReference, RealityModelTileUtils, RealityTileLoader, SpatialTileTreeReferences, type WGS84Extent, WmsUtilities, LayerTileTreeHandler, type MapLayerTreeSetting, LayerTileTreeReferenceHandler } from "../tile/internal";
12
+ export { acquireImdlDecoder, appendQueryParams, ArcGisErrorCode, ArcGisGeometryReaderJSON, type ArcGisGetServiceJsonArgs, ArcGISImageryProvider, type ArcGISServiceMetadata, ArcGisUtilities, type ArcGisValidateSourceArgs, collectMaskRefs, createSpatialTileTreeReferences, deflateCoordinates, type FeatureAttributeDrivenSymbology, FeatureGeometryBaseRenderer, type FeatureGeometryRenderer, FeatureGraphicsRenderer, type FeatureSymbolizedRenderer, type FeatureSymbologyRenderer, GltfReader, type GltfReaderArgs, type GltfReaderResult, type GraphicsGeometryRenderer, ImageryMapTileTree, type ImdlDecoder, ImdlReader, type MapLayerInfoFromTileTree, MapTileTreeReference, RealityModelTileUtils, RealityTileLoader, SpatialTileTreeReferences, type WGS84Extent, WmsUtilities, LayerTileTreeHandler, type MapLayerTreeSetting, LayerTileTreeReferenceHandler } from "../tile/internal";
13
13
  export { GoogleMapsDecorator, LogoDecoration } from "./GoogleMapsDecorator";
14
14
  export { DebugShaderFile } from "./render/RenderSystemDebugControl";
15
15
  export { IModelTileTree } from "./tile/IModelTileTree";
@@ -1 +1 @@
1
- {"version":3,"file":"cross-package.d.ts","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,KAAK,aAAa,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACzH,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAGvG,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,eAAe,EACf,KAAK,wBAAwB,EAC7B,+BAA+B,EAC/B,kBAAkB,EAClB,KAAK,+BAA+B,EACpC,2BAA2B,EAC3B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,kBAAkB,EACl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3B,KAAK,uBAAuB,EAC5B,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,kBAAkB,EAClB,KAAK,WAAW,EAChB,UAAU,EACV,KAAK,wBAAwB,EAC7B,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,WAAW,EAChB,YAAY,EACZ,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,6BAA6B,EAC7E,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * @module Utils
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.IModelTileTree = exports.DebugShaderFile = exports.LogoDecoration = exports.GoogleMapsDecorator = exports.LayerTileTreeReferenceHandler = exports.LayerTileTreeHandler = exports.WmsUtilities = exports.SpatialTileTreeReferences = exports.RealityTileLoader = exports.RealityModelTileUtils = exports.MapTileTreeReference = exports.ImdlReader = exports.ImageryMapTileTree = exports.GltfReader = exports.FeatureGraphicsRenderer = exports.FeatureGeometryBaseRenderer = exports.deflateCoordinates = exports.createSpatialTileTreeReferences = exports.ArcGisUtilities = exports.ArcGISImageryProvider = exports.ArcGisGeometryReaderJSON = exports.ArcGisErrorCode = exports.appendQueryParams = exports.acquireImdlDecoder = exports.PrimitiveVisibility = exports.formatAnimationBranchId = exports.RenderDiagnostics = exports.PerformanceMetrics = exports.Target = exports.OnScreenTarget = exports.GltfDataType = exports.AnimationNodeId = exports._scheduleScriptReference = exports._callIpcChannel = void 0;
10
+ exports.IModelTileTree = exports.DebugShaderFile = exports.LogoDecoration = exports.GoogleMapsDecorator = exports.LayerTileTreeReferenceHandler = exports.LayerTileTreeHandler = exports.WmsUtilities = exports.SpatialTileTreeReferences = exports.RealityTileLoader = exports.RealityModelTileUtils = exports.MapTileTreeReference = exports.ImdlReader = exports.ImageryMapTileTree = exports.GltfReader = exports.FeatureGraphicsRenderer = exports.FeatureGeometryBaseRenderer = exports.deflateCoordinates = exports.createSpatialTileTreeReferences = exports.collectMaskRefs = exports.ArcGisUtilities = exports.ArcGISImageryProvider = exports.ArcGisGeometryReaderJSON = exports.ArcGisErrorCode = exports.appendQueryParams = exports.acquireImdlDecoder = exports.PrimitiveVisibility = exports.formatAnimationBranchId = exports.RenderDiagnostics = exports.PerformanceMetrics = exports.Target = exports.OnScreenTarget = exports.GltfDataType = exports.AnimationNodeId = exports._scheduleScriptReference = exports._callIpcChannel = void 0;
11
11
  var Symbols_1 = require("../common/internal/Symbols");
12
12
  Object.defineProperty(exports, "_callIpcChannel", { enumerable: true, get: function () { return Symbols_1._callIpcChannel; } });
13
13
  Object.defineProperty(exports, "_scheduleScriptReference", { enumerable: true, get: function () { return Symbols_1._scheduleScriptReference; } });
@@ -34,6 +34,7 @@ Object.defineProperty(exports, "ArcGisErrorCode", { enumerable: true, get: funct
34
34
  Object.defineProperty(exports, "ArcGisGeometryReaderJSON", { enumerable: true, get: function () { return internal_1.ArcGisGeometryReaderJSON; } });
35
35
  Object.defineProperty(exports, "ArcGISImageryProvider", { enumerable: true, get: function () { return internal_1.ArcGISImageryProvider; } });
36
36
  Object.defineProperty(exports, "ArcGisUtilities", { enumerable: true, get: function () { return internal_1.ArcGisUtilities; } });
37
+ Object.defineProperty(exports, "collectMaskRefs", { enumerable: true, get: function () { return internal_1.collectMaskRefs; } });
37
38
  Object.defineProperty(exports, "createSpatialTileTreeReferences", { enumerable: true, get: function () { return internal_1.createSpatialTileTreeReferences; } });
38
39
  Object.defineProperty(exports, "deflateCoordinates", { enumerable: true, get: function () { return internal_1.deflateCoordinates; } });
39
40
  Object.defineProperty(exports, "FeatureGeometryBaseRenderer", { enumerable: true, get: function () { return internal_1.FeatureGeometryBaseRenderer; } });
@@ -1 +1 @@
1
- {"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuF;AAA9E,0GAAA,eAAe,OAAA;AAAE,mHAAA,wBAAwB,OAAA;AAClD,6EAA4E;AAAnE,kHAAA,eAAe,OAAA;AACxB,wDAAiF;AAAxE,0GAAA,YAAY,OAAA;AACrB,gDAA+D;AAAtD,wGAAA,cAAc,OAAA;AAAE,gGAAA,MAAM,OAAA;AAC/B,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,8EAAyH;AAA5F,6HAAA,iBAAiB,OAAA;AAC9C,sEAAwE;AAA/D,+HAAA,uBAAuB,OAAA;AAChC,8EAAuG;AAA9F,+HAAA,mBAAmB,OAAA;AAE5B,iEAAiE;AACjE,6CAiC0B;AAhCzB,8GAAA,kBAAkB,OAAA;AAClB,6GAAA,iBAAiB,OAAA;AACjB,2GAAA,eAAe,OAAA;AACf,oHAAA,wBAAwB,OAAA;AAExB,iHAAA,qBAAqB,OAAA;AAErB,2GAAA,eAAe,OAAA;AAEf,2HAAA,+BAA+B,OAAA;AAC/B,8GAAA,kBAAkB,OAAA;AAElB,uHAAA,2BAA2B,OAAA;AAE3B,mHAAA,uBAAuB,OAAA;AAGvB,sGAAA,UAAU,OAAA;AAIV,8GAAA,kBAAkB,OAAA;AAElB,sGAAA,UAAU,OAAA;AAEV,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AACrB,6GAAA,iBAAiB,OAAA;AACjB,qHAAA,yBAAyB,OAAA;AAEzB,wGAAA,YAAY,OAAA;AACZ,gHAAA,oBAAoB,OAAA;AAA4B,yHAAA,6BAA6B,OAAA;AAE9E,6DAA4E;AAAnE,0HAAA,mBAAmB,OAAA;AAAE,qHAAA,cAAc,OAAA;AAE5C,qFAAqF;AACrF,mCAAmC;AACnC,8EAAoE;AAA3D,2HAAA,eAAe,OAAA;AACxB,wDAAuD;AAA9C,gHAAA,cAAc,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\nexport { _callIpcChannel, _scheduleScriptReference } from \"../common/internal/Symbols\";\nexport { AnimationNodeId } from \"../common/internal/render/AnimationNodeId\";\nexport { GltfDataType, type GltfMeshPrimitive } from \"../common/gltf/GltfSchema\";\nexport { OnScreenTarget, Target } from \"./render/webgl/Target\";\nexport { PerformanceMetrics } from \"./render/webgl/PerformanceMetrics\";\nexport { type GLTimerResult, RenderDiagnostics, type RenderSystemDebugControl } from \"./render/RenderSystemDebugControl\";\nexport { formatAnimationBranchId } from \"./render/AnimationBranchState\";\nexport { PrimitiveVisibility, type RenderTargetDebugControl } from \"./render/RenderTargetDebugControl\";\n\n// Used by frontend-tiles, map-layers-formats, frontend-dev-tools\nexport {\n acquireImdlDecoder,\n appendQueryParams,\n ArcGisErrorCode,\n ArcGisGeometryReaderJSON,\n type ArcGisGetServiceJsonArgs,\n ArcGISImageryProvider,\n type ArcGISServiceMetadata,\n ArcGisUtilities,\n type ArcGisValidateSourceArgs,\n createSpatialTileTreeReferences,\n deflateCoordinates,\n type FeatureAttributeDrivenSymbology,\n FeatureGeometryBaseRenderer,\n type FeatureGeometryRenderer,\n FeatureGraphicsRenderer,\n type FeatureSymbolizedRenderer,\n type FeatureSymbologyRenderer,\n GltfReader,\n type GltfReaderArgs,\n type GltfReaderResult,\n type GraphicsGeometryRenderer,\n ImageryMapTileTree,\n type ImdlDecoder,\n ImdlReader,\n type MapLayerInfoFromTileTree,\n MapTileTreeReference,\n RealityModelTileUtils,\n RealityTileLoader,\n SpatialTileTreeReferences,\n type WGS84Extent,\n WmsUtilities,\n LayerTileTreeHandler, type MapLayerTreeSetting, LayerTileTreeReferenceHandler\n} from \"../tile/internal\";\nexport { GoogleMapsDecorator, LogoDecoration } from \"./GoogleMapsDecorator\";\n\n// Used by display-test-app which currently builds using both ESModules and CommonJS.\n// Remove once CommonJS is dropped.\nexport { DebugShaderFile } from \"./render/RenderSystemDebugControl\";\nexport { IModelTileTree } from \"./tile/IModelTileTree\";\n"]}
1
+ {"version":3,"file":"cross-package.js","sourceRoot":"","sources":["../../../src/internal/cross-package.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAuF;AAA9E,0GAAA,eAAe,OAAA;AAAE,mHAAA,wBAAwB,OAAA;AAClD,6EAA4E;AAAnE,kHAAA,eAAe,OAAA;AACxB,wDAAiF;AAAxE,0GAAA,YAAY,OAAA;AACrB,gDAA+D;AAAtD,wGAAA,cAAc,OAAA;AAAE,gGAAA,MAAM,OAAA;AAC/B,wEAAuE;AAA9D,wHAAA,kBAAkB,OAAA;AAC3B,8EAAyH;AAA5F,6HAAA,iBAAiB,OAAA;AAC9C,sEAAwE;AAA/D,+HAAA,uBAAuB,OAAA;AAChC,8EAAuG;AAA9F,+HAAA,mBAAmB,OAAA;AAE5B,iEAAiE;AACjE,6CAkC0B;AAjCzB,8GAAA,kBAAkB,OAAA;AAClB,6GAAA,iBAAiB,OAAA;AACjB,2GAAA,eAAe,OAAA;AACf,oHAAA,wBAAwB,OAAA;AAExB,iHAAA,qBAAqB,OAAA;AAErB,2GAAA,eAAe,OAAA;AAEf,2GAAA,eAAe,OAAA;AACf,2HAAA,+BAA+B,OAAA;AAC/B,8GAAA,kBAAkB,OAAA;AAElB,uHAAA,2BAA2B,OAAA;AAE3B,mHAAA,uBAAuB,OAAA;AAGvB,sGAAA,UAAU,OAAA;AAIV,8GAAA,kBAAkB,OAAA;AAElB,sGAAA,UAAU,OAAA;AAEV,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AACrB,6GAAA,iBAAiB,OAAA;AACjB,qHAAA,yBAAyB,OAAA;AAEzB,wGAAA,YAAY,OAAA;AACZ,gHAAA,oBAAoB,OAAA;AAA4B,yHAAA,6BAA6B,OAAA;AAE9E,6DAA4E;AAAnE,0HAAA,mBAAmB,OAAA;AAAE,qHAAA,cAAc,OAAA;AAE5C,qFAAqF;AACrF,mCAAmC;AACnC,8EAAoE;AAA3D,2HAAA,eAAe,OAAA;AACxB,wDAAuD;AAA9C,gHAAA,cAAc,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\nexport { _callIpcChannel, _scheduleScriptReference } from \"../common/internal/Symbols\";\nexport { AnimationNodeId } from \"../common/internal/render/AnimationNodeId\";\nexport { GltfDataType, type GltfMeshPrimitive } from \"../common/gltf/GltfSchema\";\nexport { OnScreenTarget, Target } from \"./render/webgl/Target\";\nexport { PerformanceMetrics } from \"./render/webgl/PerformanceMetrics\";\nexport { type GLTimerResult, RenderDiagnostics, type RenderSystemDebugControl } from \"./render/RenderSystemDebugControl\";\nexport { formatAnimationBranchId } from \"./render/AnimationBranchState\";\nexport { PrimitiveVisibility, type RenderTargetDebugControl } from \"./render/RenderTargetDebugControl\";\n\n// Used by frontend-tiles, map-layers-formats, frontend-dev-tools\nexport {\n acquireImdlDecoder,\n appendQueryParams,\n ArcGisErrorCode,\n ArcGisGeometryReaderJSON,\n type ArcGisGetServiceJsonArgs,\n ArcGISImageryProvider,\n type ArcGISServiceMetadata,\n ArcGisUtilities,\n type ArcGisValidateSourceArgs,\n collectMaskRefs,\n createSpatialTileTreeReferences,\n deflateCoordinates,\n type FeatureAttributeDrivenSymbology,\n FeatureGeometryBaseRenderer,\n type FeatureGeometryRenderer,\n FeatureGraphicsRenderer,\n type FeatureSymbolizedRenderer,\n type FeatureSymbologyRenderer,\n GltfReader,\n type GltfReaderArgs,\n type GltfReaderResult,\n type GraphicsGeometryRenderer,\n ImageryMapTileTree,\n type ImdlDecoder,\n ImdlReader,\n type MapLayerInfoFromTileTree,\n MapTileTreeReference,\n RealityModelTileUtils,\n RealityTileLoader,\n SpatialTileTreeReferences,\n type WGS84Extent,\n WmsUtilities,\n LayerTileTreeHandler, type MapLayerTreeSetting, LayerTileTreeReferenceHandler\n} from \"../tile/internal\";\nexport { GoogleMapsDecorator, LogoDecoration } from \"./GoogleMapsDecorator\";\n\n// Used by display-test-app which currently builds using both ESModules and CommonJS.\n// Remove once CommonJS is dropped.\nexport { DebugShaderFile } from \"./render/RenderSystemDebugControl\";\nexport { IModelTileTree } from \"./tile/IModelTileTree\";\n"]}
@@ -119,7 +119,7 @@ class BackgroundMapDrape extends TextureDrape_1.TextureDrape {
119
119
  const prevPlan = target.plan;
120
120
  const drawingParams = PlanarTextureProjection_1.PlanarTextureProjection.getTextureDrawingParams(target);
121
121
  const stack = new BranchStack_1.BranchStack();
122
- stack.changeRenderPlan(drawingParams.viewFlags, prevPlan.is3d, prevPlan.hline);
122
+ stack.changeRenderPlan(drawingParams.viewFlags, prevPlan.is3d, prevPlan.hline, prevPlan.contours);
123
123
  stack.setSymbologyOverrides(this._symbologyOverrides);
124
124
  const batchState = new BatchState_1.BatchState(stack);
125
125
  System_1.System.instance.applyRenderState(drawingParams.state);
@@ -1 +1 @@
1
- {"version":3,"file":"BackgroundMapDrape.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/BackgroundMapDrape.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAqE;AACrE,wDAA0G;AAC1G,oDAA0G;AAC1G,qDAA4G;AAG5G,uEAAoE;AAEpE,6CAA0C;AAC1C,+CAA4C;AAC5C,+CAA4C;AAC5C,6BAA0B;AAC1B,uEAAoE;AACpE,qDAAkD;AAElD,qCAAkC;AAElC,uCAAmD;AACnD,iDAA8C;AAE9C,g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;QAC/O,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAE7B,UAAU,CAAC,KAAK,EAAE,CAAC,CAAG,yBAAyB;QAC/C,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAElC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACnC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;QACrF,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IAChC,CAAC;;AA9JH,gDA+JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { assert, dispose, expectDefined } from \"@itwin/core-bentley\";\nimport { Matrix4d, Plane3dByOriginAndUnitNormal, Point3d, Range3d, Vector3d } from \"@itwin/core-geometry\";\nimport { ColorDef, Frustum, FrustumPlanes, RenderTexture, TextureTransparency } from \"@itwin/core-common\";\nimport { GraphicsCollectorDrawArgs, MapTileTreeReference, TileTreeReference } from \"../../../tile/internal\";\nimport { SceneContext } from \"../../../ViewContext\";\nimport { ViewState3d } from \"../../../ViewState\";\nimport { FeatureSymbology } from \"../../../render/FeatureSymbology\";\nimport { RenderGraphic } from \"../../../render/RenderGraphic\";\nimport { BatchState } from \"./BatchState\";\nimport { BranchStack } from \"./BranchStack\";\nimport { FrameBuffer } from \"./FrameBuffer\";\nimport { GL } from \"./GL\";\nimport { PlanarTextureProjection } from \"./PlanarTextureProjection\";\nimport { RenderCommands } from \"./RenderCommands\";\nimport { RenderPass } from \"./RenderFlags\";\nimport { System } from \"./System\";\nimport { Target } from \"./Target\";\nimport { Texture, TextureHandle } from \"./Texture\";\nimport { TextureDrape } from \"./TextureDrape\";\n\n/** @internal */\nexport class BackgroundMapDrape extends TextureDrape {\n private _fbo?: FrameBuffer;\n private readonly _graphics: RenderGraphic[] = [];\n private _frustum?: Frustum;\n private _width = 0;\n private _height = 0;\n private _mapTree: MapTileTreeReference;\n private _drapedTree: TileTreeReference;\n private static _postProjectionMatrix = Matrix4d.createRowValues(\n 0, 1, 0, 0,\n 0, 0, -1, 0,\n 1, 0, 0, 0,\n 0, 0, 0, 1);\n private _debugFrustum?: Frustum;\n private _debugFrustumGraphic?: RenderGraphic = undefined;\n private readonly _symbologyOverrides = new FeatureSymbology.Overrides();\n private readonly _bgColor = ColorDef.from(0, 0, 0, 255);\n private readonly _plane = expectDefined(Plane3dByOriginAndUnitNormal.create(Point3d.createZero(), Vector3d.create(0, 0, 1)));\n\n private constructor(drapedTree: TileTreeReference, mapTree: MapTileTreeReference) {\n super();\n this._drapedTree = drapedTree;\n this._mapTree = mapTree;\n }\n\n public override get isDisposed(): boolean { return super.isDisposed && undefined === this._fbo; }\n\n public override[Symbol.dispose]() {\n super[Symbol.dispose]();\n this._fbo = dispose(this._fbo);\n }\n\n public addGraphic(graphic: RenderGraphic) {\n this._graphics.push(graphic);\n }\n\n public static create(draped: TileTreeReference, map: MapTileTreeReference): BackgroundMapDrape {\n return new BackgroundMapDrape(draped, map);\n }\n\n public collectGraphics(context: SceneContext) {\n this._graphics.length = 0;\n if (undefined === context.viewingSpace)\n return;\n\n const viewState = context.viewingSpace.view as ViewState3d;\n if (undefined === viewState)\n return;\n\n const tileTree = this._mapTree.treeOwner.load();\n if (undefined === tileTree || !this._mapTree.layerRefHandler.initializeLayers(context))\n return;\n\n const requiredWidth = 2 * Math.max(context.target.viewRect.width, context.target.viewRect.height); // TBD - Size to textured area.\n const requiredHeight = requiredWidth;\n\n if (requiredWidth !== this._width || requiredHeight !== this._height)\n this[Symbol.dispose]();\n\n this._width = requiredWidth;\n this._height = requiredHeight;\n\n const targetTree = this._drapedTree.treeOwner.tileTree;\n const args = this._drapedTree.createDrawArgs(context);\n if (!targetTree || !args)\n return;\n\n const targetTiles = targetTree.selectTiles(args);\n\n const projection = PlanarTextureProjection.computePlanarTextureProjection(this._plane, context, { tiles: targetTiles, location: args.location }, [this._mapTree], viewState, this._width, this._height, Range3d.createNull());\n if (!projection.textureFrustum || !projection.projectionMatrix || !projection.worldToViewMap)\n return;\n\n this._frustum = projection.textureFrustum;\n this._debugFrustum = projection.debugFrustum;\n this._projectionMatrix = projection.projectionMatrix;\n\n const drawArgs = GraphicsCollectorDrawArgs.create(context, this, this._mapTree, FrustumPlanes.fromFrustum(this._frustum), projection.worldToViewMap);\n if (undefined !== drawArgs)\n tileTree.draw(drawArgs);\n\n if (context.target.debugControl && context.target.debugControl.displayDrapeFrustum) {\n this._debugFrustumGraphic = dispose(this._debugFrustumGraphic);\n const builder = context.createSceneGraphicBuilder();\n builder.setSymbology(ColorDef.green, ColorDef.green, 1);\n builder.addFrustum(context.viewingSpace.getFrustum());\n builder.setSymbology(ColorDef.red, ColorDef.red, 1);\n builder.addFrustum(expectDefined(this._debugFrustum));\n builder.setSymbology(ColorDef.white, ColorDef.white, 1);\n builder.addFrustum(this._frustum);\n this._debugFrustumGraphic = builder.finish();\n }\n }\n\n public draw(target: Target) {\n if (undefined !== this._debugFrustumGraphic)\n target.graphics.foreground.push(this._debugFrustumGraphic);\n\n if (undefined === this._frustum || this._graphics.length === 0)\n return;\n\n if (undefined === this._fbo) {\n const colorTextureHandle = TextureHandle.createForAttachment(this._width, this._height, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\n if (undefined === colorTextureHandle) {\n assert(false, \"Failed to create planar texture\");\n return;\n }\n\n this._texture = new Texture({ ownership: \"external\", type: RenderTexture.Type.TileSection, handle: colorTextureHandle, transparency: TextureTransparency.Opaque });\n this._fbo = FrameBuffer.create([colorTextureHandle]);\n }\n if (undefined === this._fbo) {\n assert(false, \"unable to create frame buffer object\");\n return;\n }\n\n System.instance.glTimer.beginOperation(\"Terrain Projection\");\n\n const prevState = System.instance.currentRenderState.clone();\n System.instance.context.viewport(0, 0, this._width, this._height);\n\n const prevPlan = target.plan;\n const drawingParams = PlanarTextureProjection.getTextureDrawingParams(target);\n const stack = new BranchStack();\n stack.changeRenderPlan(drawingParams.viewFlags, prevPlan.is3d, prevPlan.hline);\n stack.setSymbologyOverrides(this._symbologyOverrides);\n\n const batchState = new BatchState(stack);\n System.instance.applyRenderState(drawingParams.state);\n\n target.uniforms.style.changeBackgroundColor(this._bgColor); // Avoid white on white reversal. Will be reset below in changeRenderPlan().\n target.changeFrustum(this._frustum, this._frustum.getFraction(), true);\n\n const prevProjMatrix = target.uniforms.frustum.projectionMatrix;\n target.uniforms.frustum.changeProjectionMatrix(BackgroundMapDrape._postProjectionMatrix.multiplyMatrixMatrix(prevProjMatrix));\n\n target.uniforms.branch.pushState(stack.top);\n\n const renderCommands = new RenderCommands(target, stack, batchState);\n renderCommands.addGraphics(this._graphics, RenderPass.OpaqueGeneral);\n\n const system = System.instance;\n const gl = system.context;\n\n system.frameBufferStack.execute(this._fbo, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\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.\n });\n\n target.uniforms.branch.pop();\n\n batchState.reset(); // Reset the batch Ids...\n target.changeRenderPlan(prevPlan);\n\n system.applyRenderState(prevState);\n gl.viewport(0, 0, target.viewRect.width, target.viewRect.height); // Restore viewport\n system.glTimer.endOperation();\n }\n}\n"]}
1
+ {"version":3,"file":"BackgroundMapDrape.js","sourceRoot":"","sources":["../../../../../src/internal/render/webgl/BackgroundMapDrape.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F;;GAEG;AAEH,sDAAqE;AACrE,wDAA0G;AAC1G,oDAA0G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,CAAC,CAAC,CAAC;YAC1B,EAAE,CAAC,KAAK,CAAC,OAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC7B,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,WAAW,kCAA0B,2CAAkC,CAAC,CAAI,gHAAgH;QAC/O,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAE7B,UAAU,CAAC,KAAK,EAAE,CAAC,CAAG,yBAAyB;QAC/C,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAElC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACnC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,mBAAmB;QACrF,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;IAChC,CAAC;;AA9JH,gDA+JC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module WebGL\n */\n\nimport { assert, dispose, expectDefined } from \"@itwin/core-bentley\";\nimport { Matrix4d, Plane3dByOriginAndUnitNormal, Point3d, Range3d, Vector3d } from \"@itwin/core-geometry\";\nimport { ColorDef, Frustum, FrustumPlanes, RenderTexture, TextureTransparency } from \"@itwin/core-common\";\nimport { GraphicsCollectorDrawArgs, MapTileTreeReference, TileTreeReference } from \"../../../tile/internal\";\nimport { SceneContext } from \"../../../ViewContext\";\nimport { ViewState3d } from \"../../../ViewState\";\nimport { FeatureSymbology } from \"../../../render/FeatureSymbology\";\nimport { RenderGraphic } from \"../../../render/RenderGraphic\";\nimport { BatchState } from \"./BatchState\";\nimport { BranchStack } from \"./BranchStack\";\nimport { FrameBuffer } from \"./FrameBuffer\";\nimport { GL } from \"./GL\";\nimport { PlanarTextureProjection } from \"./PlanarTextureProjection\";\nimport { RenderCommands } from \"./RenderCommands\";\nimport { RenderPass } from \"./RenderFlags\";\nimport { System } from \"./System\";\nimport { Target } from \"./Target\";\nimport { Texture, TextureHandle } from \"./Texture\";\nimport { TextureDrape } from \"./TextureDrape\";\n\n/** @internal */\nexport class BackgroundMapDrape extends TextureDrape {\n private _fbo?: FrameBuffer;\n private readonly _graphics: RenderGraphic[] = [];\n private _frustum?: Frustum;\n private _width = 0;\n private _height = 0;\n private _mapTree: MapTileTreeReference;\n private _drapedTree: TileTreeReference;\n private static _postProjectionMatrix = Matrix4d.createRowValues(\n 0, 1, 0, 0,\n 0, 0, -1, 0,\n 1, 0, 0, 0,\n 0, 0, 0, 1);\n private _debugFrustum?: Frustum;\n private _debugFrustumGraphic?: RenderGraphic = undefined;\n private readonly _symbologyOverrides = new FeatureSymbology.Overrides();\n private readonly _bgColor = ColorDef.from(0, 0, 0, 255);\n private readonly _plane = expectDefined(Plane3dByOriginAndUnitNormal.create(Point3d.createZero(), Vector3d.create(0, 0, 1)));\n\n private constructor(drapedTree: TileTreeReference, mapTree: MapTileTreeReference) {\n super();\n this._drapedTree = drapedTree;\n this._mapTree = mapTree;\n }\n\n public override get isDisposed(): boolean { return super.isDisposed && undefined === this._fbo; }\n\n public override[Symbol.dispose]() {\n super[Symbol.dispose]();\n this._fbo = dispose(this._fbo);\n }\n\n public addGraphic(graphic: RenderGraphic) {\n this._graphics.push(graphic);\n }\n\n public static create(draped: TileTreeReference, map: MapTileTreeReference): BackgroundMapDrape {\n return new BackgroundMapDrape(draped, map);\n }\n\n public collectGraphics(context: SceneContext) {\n this._graphics.length = 0;\n if (undefined === context.viewingSpace)\n return;\n\n const viewState = context.viewingSpace.view as ViewState3d;\n if (undefined === viewState)\n return;\n\n const tileTree = this._mapTree.treeOwner.load();\n if (undefined === tileTree || !this._mapTree.layerRefHandler.initializeLayers(context))\n return;\n\n const requiredWidth = 2 * Math.max(context.target.viewRect.width, context.target.viewRect.height); // TBD - Size to textured area.\n const requiredHeight = requiredWidth;\n\n if (requiredWidth !== this._width || requiredHeight !== this._height)\n this[Symbol.dispose]();\n\n this._width = requiredWidth;\n this._height = requiredHeight;\n\n const targetTree = this._drapedTree.treeOwner.tileTree;\n const args = this._drapedTree.createDrawArgs(context);\n if (!targetTree || !args)\n return;\n\n const targetTiles = targetTree.selectTiles(args);\n\n const projection = PlanarTextureProjection.computePlanarTextureProjection(this._plane, context, { tiles: targetTiles, location: args.location }, [this._mapTree], viewState, this._width, this._height, Range3d.createNull());\n if (!projection.textureFrustum || !projection.projectionMatrix || !projection.worldToViewMap)\n return;\n\n this._frustum = projection.textureFrustum;\n this._debugFrustum = projection.debugFrustum;\n this._projectionMatrix = projection.projectionMatrix;\n\n const drawArgs = GraphicsCollectorDrawArgs.create(context, this, this._mapTree, FrustumPlanes.fromFrustum(this._frustum), projection.worldToViewMap);\n if (undefined !== drawArgs)\n tileTree.draw(drawArgs);\n\n if (context.target.debugControl && context.target.debugControl.displayDrapeFrustum) {\n this._debugFrustumGraphic = dispose(this._debugFrustumGraphic);\n const builder = context.createSceneGraphicBuilder();\n builder.setSymbology(ColorDef.green, ColorDef.green, 1);\n builder.addFrustum(context.viewingSpace.getFrustum());\n builder.setSymbology(ColorDef.red, ColorDef.red, 1);\n builder.addFrustum(expectDefined(this._debugFrustum));\n builder.setSymbology(ColorDef.white, ColorDef.white, 1);\n builder.addFrustum(this._frustum);\n this._debugFrustumGraphic = builder.finish();\n }\n }\n\n public draw(target: Target) {\n if (undefined !== this._debugFrustumGraphic)\n target.graphics.foreground.push(this._debugFrustumGraphic);\n\n if (undefined === this._frustum || this._graphics.length === 0)\n return;\n\n if (undefined === this._fbo) {\n const colorTextureHandle = TextureHandle.createForAttachment(this._width, this._height, GL.Texture.Format.Rgba, GL.Texture.DataType.UnsignedByte);\n if (undefined === colorTextureHandle) {\n assert(false, \"Failed to create planar texture\");\n return;\n }\n\n this._texture = new Texture({ ownership: \"external\", type: RenderTexture.Type.TileSection, handle: colorTextureHandle, transparency: TextureTransparency.Opaque });\n this._fbo = FrameBuffer.create([colorTextureHandle]);\n }\n if (undefined === this._fbo) {\n assert(false, \"unable to create frame buffer object\");\n return;\n }\n\n System.instance.glTimer.beginOperation(\"Terrain Projection\");\n\n const prevState = System.instance.currentRenderState.clone();\n System.instance.context.viewport(0, 0, this._width, this._height);\n\n const prevPlan = target.plan;\n const drawingParams = PlanarTextureProjection.getTextureDrawingParams(target);\n const stack = new BranchStack();\n stack.changeRenderPlan(drawingParams.viewFlags, prevPlan.is3d, prevPlan.hline, prevPlan.contours);\n stack.setSymbologyOverrides(this._symbologyOverrides);\n\n const batchState = new BatchState(stack);\n System.instance.applyRenderState(drawingParams.state);\n\n target.uniforms.style.changeBackgroundColor(this._bgColor); // Avoid white on white reversal. Will be reset below in changeRenderPlan().\n target.changeFrustum(this._frustum, this._frustum.getFraction(), true);\n\n const prevProjMatrix = target.uniforms.frustum.projectionMatrix;\n target.uniforms.frustum.changeProjectionMatrix(BackgroundMapDrape._postProjectionMatrix.multiplyMatrixMatrix(prevProjMatrix));\n\n target.uniforms.branch.pushState(stack.top);\n\n const renderCommands = new RenderCommands(target, stack, batchState);\n renderCommands.addGraphics(this._graphics, RenderPass.OpaqueGeneral);\n\n const system = System.instance;\n const gl = system.context;\n\n system.frameBufferStack.execute(this._fbo, true, false, () => {\n gl.clearColor(0, 0, 0, 0);\n gl.clear(GL.BufferBit.Color);\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.\n });\n\n target.uniforms.branch.pop();\n\n batchState.reset(); // Reset the batch Ids...\n target.changeRenderPlan(prevPlan);\n\n system.applyRenderState(prevState);\n gl.viewport(0, 0, target.viewRect.width, target.viewRect.height); // Restore viewport\n system.glTimer.endOperation();\n }\n}\n"]}