@itwin/core-frontend 5.1.0-dev.47 → 5.1.0-dev.51

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 (71) hide show
  1. package/lib/cjs/IModelApp.d.ts +1 -1
  2. package/lib/cjs/IModelApp.js +1 -1
  3. package/lib/cjs/IModelApp.js.map +1 -1
  4. package/lib/cjs/RealityDataSource.d.ts +65 -3
  5. package/lib/cjs/RealityDataSource.d.ts.map +1 -1
  6. package/lib/cjs/RealityDataSource.js +79 -3
  7. package/lib/cjs/RealityDataSource.js.map +1 -1
  8. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js +1 -1
  9. package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  10. package/lib/cjs/internal/GoogleMapsDecorator.d.ts +53 -0
  11. package/lib/cjs/internal/GoogleMapsDecorator.d.ts.map +1 -0
  12. package/lib/cjs/internal/GoogleMapsDecorator.js +132 -0
  13. package/lib/cjs/internal/GoogleMapsDecorator.js.map +1 -0
  14. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.d.ts +83 -0
  15. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.d.ts.map +1 -0
  16. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.js +201 -0
  17. package/lib/cjs/internal/RealityDataSourceGoogle3dTilesImpl.js.map +1 -0
  18. package/lib/cjs/internal/cross-package.d.ts +1 -0
  19. package/lib/cjs/internal/cross-package.d.ts.map +1 -1
  20. package/lib/cjs/internal/cross-package.js +4 -1
  21. package/lib/cjs/internal/cross-package.js.map +1 -1
  22. package/lib/cjs/internal/tile/RealityModelTileTree.d.ts +5 -2
  23. package/lib/cjs/internal/tile/RealityModelTileTree.d.ts.map +1 -1
  24. package/lib/cjs/internal/tile/RealityModelTileTree.js +15 -4
  25. package/lib/cjs/internal/tile/RealityModelTileTree.js.map +1 -1
  26. package/lib/cjs/tile/GltfReader.d.ts +1 -0
  27. package/lib/cjs/tile/GltfReader.d.ts.map +1 -1
  28. package/lib/cjs/tile/GltfReader.js +1 -0
  29. package/lib/cjs/tile/GltfReader.js.map +1 -1
  30. package/lib/cjs/tile/RealityTile.d.ts +5 -0
  31. package/lib/cjs/tile/RealityTile.d.ts.map +1 -1
  32. package/lib/cjs/tile/RealityTile.js +5 -0
  33. package/lib/cjs/tile/RealityTile.js.map +1 -1
  34. package/lib/esm/IModelApp.d.ts +1 -1
  35. package/lib/esm/IModelApp.js +1 -1
  36. package/lib/esm/IModelApp.js.map +1 -1
  37. package/lib/esm/RealityDataSource.d.ts +65 -3
  38. package/lib/esm/RealityDataSource.d.ts.map +1 -1
  39. package/lib/esm/RealityDataSource.js +77 -3
  40. package/lib/esm/RealityDataSource.js.map +1 -1
  41. package/lib/esm/RealityDataSourceTilesetUrlImpl.js +1 -1
  42. package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
  43. package/lib/esm/internal/GoogleMapsDecorator.d.ts +53 -0
  44. package/lib/esm/internal/GoogleMapsDecorator.d.ts.map +1 -0
  45. package/lib/esm/internal/GoogleMapsDecorator.js +126 -0
  46. package/lib/esm/internal/GoogleMapsDecorator.js.map +1 -0
  47. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.d.ts +83 -0
  48. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.d.ts.map +1 -0
  49. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.js +197 -0
  50. package/lib/esm/internal/RealityDataSourceGoogle3dTilesImpl.js.map +1 -0
  51. package/lib/esm/internal/cross-package.d.ts +1 -0
  52. package/lib/esm/internal/cross-package.d.ts.map +1 -1
  53. package/lib/esm/internal/cross-package.js +1 -0
  54. package/lib/esm/internal/cross-package.js.map +1 -1
  55. package/lib/esm/internal/tile/RealityModelTileTree.d.ts +5 -2
  56. package/lib/esm/internal/tile/RealityModelTileTree.d.ts.map +1 -1
  57. package/lib/esm/internal/tile/RealityModelTileTree.js +15 -4
  58. package/lib/esm/internal/tile/RealityModelTileTree.js.map +1 -1
  59. package/lib/esm/tile/GltfReader.d.ts +1 -0
  60. package/lib/esm/tile/GltfReader.d.ts.map +1 -1
  61. package/lib/esm/tile/GltfReader.js +1 -0
  62. package/lib/esm/tile/GltfReader.js.map +1 -1
  63. package/lib/esm/tile/RealityTile.d.ts +5 -0
  64. package/lib/esm/tile/RealityTile.d.ts.map +1 -1
  65. package/lib/esm/tile/RealityTile.js +5 -0
  66. package/lib/esm/tile/RealityTile.js.map +1 -1
  67. package/lib/public/images/google_on_non_white.png +0 -0
  68. package/lib/public/images/google_on_non_white_hdpi.png +0 -0
  69. package/lib/public/images/google_on_white.png +0 -0
  70. package/lib/public/images/google_on_white_hdpi.png +0 -0
  71. package/package.json +22 -20
@@ -67,7 +67,7 @@ export class RealityDataSourceTilesetUrlImpl {
67
67
  // otherwise the full path to root document is given.
68
68
  // The base URL contains the base URL from which tile relative path are constructed.
69
69
  // The tile's path root will need to be reinserted for child tiles to return a 200
70
- // If the original url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.
70
+ // If the original root tileset url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.
71
71
  setBaseUrl(url) {
72
72
  const urlParts = url.split("/");
73
73
  const newUrl = new URL(url);
@@ -1 +1 @@
1
- {"version":3,"file":"RealityDataSourceTilesetUrlImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAc,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAe,iBAAiB,EAAE,mBAAmB,EAAgD,MAAM,oBAAoB,CAAC;AAEpJ,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D;;;;;;EAME;AACF,MAAM,OAAO,+BAA+B;IAC1B,GA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,CAAC;QACD,OAAO,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACrH,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,cAAc,CAAC,IAAY;QACtC,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,IAAY;QACnC,OAAO,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAChD,CAAC;IAEM,kBAAkB,CAAC,GAAW;QACnC,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACzG,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,4BAA4B;QACvC,IAAI,eAAsD,CAAC;QAC3D,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,UAAU,EAAE,CAAC;YACrD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,eAAe,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC;QAC3F,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { assert, BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\n\r\nimport { request } from \"./request/Request\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\nimport { ThreeDTileFormatInterpreter } from \"./tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceTilesetUrlImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/\r\n private _searchParams: string = \"\";\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n assert(props.sourceKey.provider === RealityDataProvider.TilesetUrl || props.sourceKey.provider === RealityDataProvider.OrbitGtBlob);\r\n this.key = props.sourceKey;\r\n this._tilesetUrl = this.key.id;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, _iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.TilesetUrl)\r\n return undefined;\r\n const rdSource = new RealityDataSourceTilesetUrlImpl({ sourceKey });\r\n return rdSource;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n public getTilesetUrl(): string | undefined {\r\n return this._tilesetUrl;\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n // If the original url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n const newUrl = new URL(url);\r\n this._searchParams = newUrl.search;\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return request(url, \"json\");\r\n }\r\n\r\n private isValidURL(url: string){\r\n try {\r\n new URL(url);\r\n } catch {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns the tile URL.\r\n * If the tile path is a relative URL, the base URL is prepended to it.\r\n * For both absolute and relative tile path URLs, the search parameters are checked. If the search params are empty, the base URL's search params are appended to the tile path.\r\n */\r\n private getTileUrl(tilePath: string){\r\n if (this.isValidURL(tilePath)) {\r\n const url = new URL(tilePath);\r\n return url.search === \"\" ? `${tilePath}${this._searchParams}` : tilePath;\r\n }\r\n return tilePath.includes(\"?\") ? `${this._baseUrl}${tilePath}` : `${this._baseUrl}${tilePath}${this._searchParams}`;\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n return request(this.getTileUrl(name), \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n return request(this.getTileUrl(name), \"json\");\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return new URL(url, \"https://localhost/\").pathname.toLowerCase().endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"RealityDataSource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C,MAAM,KAAK,iBAAiB,CAAC,UAAU,EAAE,CAAC;YACrD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,eAAe,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC;QAC3F,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { assert, BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataFormat, RealityDataProvider, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\n\r\nimport { request } from \"./request/Request\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"./RealityDataSource\";\r\nimport { ThreeDTileFormatInterpreter } from \"./tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data weiter it be from local access, http or ProjectWise Context Share.\r\n * The key provided at the creation determines if this is ProjectWise Context Share reference.\r\n * If not then it is considered local (ex: C:\\temp\\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)\r\n * There is a one to one relationship between a reality data and the instances of present class.\r\n* @internal\r\n*/\r\nexport class RealityDataSourceTilesetUrlImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the reality model. */\r\n private _tilesetUrl: string | undefined;\r\n /** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/\r\n private _baseUrl: string = \"\";\r\n /** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/\r\n private _searchParams: string = \"\";\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps) {\r\n assert(props.sourceKey.provider === RealityDataProvider.TilesetUrl || props.sourceKey.provider === RealityDataProvider.OrbitGtBlob);\r\n this.key = props.sourceKey;\r\n this._tilesetUrl = this.key.id;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context/\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, _iTwinId: GuidString | undefined): Promise<RealityDataSource | undefined> {\r\n if (sourceKey.provider !== RealityDataProvider.TilesetUrl)\r\n return undefined;\r\n const rdSource = new RealityDataSourceTilesetUrlImpl({ sourceKey });\r\n return rdSource;\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n public getTilesetUrl(): string | undefined {\r\n return this._tilesetUrl;\r\n }\r\n // This is to set the root url from the provided root document path.\r\n // If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,\r\n // otherwise the full path to root document is given.\r\n // The base URL contains the base URL from which tile relative path are constructed.\r\n // The tile's path root will need to be reinserted for child tiles to return a 200\r\n // If the original root tileset url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.\r\n private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n const newUrl = new URL(url);\r\n this._searchParams = newUrl.search;\r\n urlParts.pop();\r\n if (urlParts.length === 0)\r\n this._baseUrl = \"\";\r\n else\r\n this._baseUrl = `${urlParts.join(\"/\")}/`;\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(iTwinId: GuidString | undefined): Promise<any> {\r\n const url = await this.getServiceUrl(iTwinId);\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n // The following is only if the reality data is not stored on PW Context Share.\r\n this.setBaseUrl(url);\r\n return request(url, \"json\");\r\n }\r\n\r\n private isValidURL(url: string){\r\n try {\r\n new URL(url);\r\n } catch {\r\n return false;\r\n }\r\n return true;\r\n }\r\n\r\n /** Returns the tile URL.\r\n * If the tile path is a relative URL, the base URL is prepended to it.\r\n * For both absolute and relative tile path URLs, the search parameters are checked. If the search params are empty, the base URL's search params are appended to the tile path.\r\n */\r\n private getTileUrl(tilePath: string){\r\n if (this.isValidURL(tilePath)) {\r\n const url = new URL(tilePath);\r\n return url.search === \"\" ? `${tilePath}${this._searchParams}` : tilePath;\r\n }\r\n return tilePath.includes(\"?\") ? `${this._baseUrl}${tilePath}` : `${this._baseUrl}${tilePath}${this._searchParams}`;\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n return request(this.getTileUrl(name), \"arraybuffer\");\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n return request(this.getTileUrl(name), \"json\");\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return new URL(url, \"https://localhost/\").pathname.toLowerCase().endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
@@ -0,0 +1,53 @@
1
+ import { Point3d } from "@itwin/core-geometry";
2
+ import { CanvasDecoration } from "../render/CanvasDecoration";
3
+ import { DecorateContext } from "../ViewContext";
4
+ import { Decorator } from "../ViewManager";
5
+ import { Sprite } from "../Sprites";
6
+ import { ScreenViewport } from "../Viewport";
7
+ /** Layer types that can be added to the map.
8
+ * @internal
9
+ */
10
+ type GoogleMapsMapTypes = "roadmap" | "satellite" | "terrain";
11
+ /** A simple decorator that shows the logo at a given screen position.
12
+ * @internal
13
+ */
14
+ export declare class LogoDecoration implements CanvasDecoration {
15
+ private _sprite?;
16
+ /** The current position of the logo in view coordinates. */
17
+ readonly position: Point3d;
18
+ private _offset;
19
+ set offset(offset: Point3d | undefined);
20
+ /** The logo offset in view coordinates.*/
21
+ get offset(): Point3d | undefined;
22
+ /** Move the logo to the lower left corner of the screen. */
23
+ moveToLowerLeftCorner(context: DecorateContext): boolean;
24
+ /** Indicate if the logo is loaded and ready to be drawn. */
25
+ get isLoaded(): boolean;
26
+ activate(sprite: Sprite): Promise<boolean>;
27
+ /** Draw this sprite onto the supplied canvas.
28
+ * @see [[CanvasDecoration.drawDecoration]]
29
+ */
30
+ drawDecoration(ctx: CanvasRenderingContext2D): void;
31
+ decorate(context: DecorateContext): void;
32
+ }
33
+ /** A decorator that adds the Google Maps logo to the lower left corner of the screen.
34
+ * @internal
35
+ */
36
+ export declare class GoogleMapsDecorator implements Decorator {
37
+ readonly logo: LogoDecoration;
38
+ private _showCreditsOnScreen?;
39
+ /** Create a new GoogleMapsDecorator.
40
+ * @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.
41
+ */
42
+ constructor(showCreditsOnScreen?: boolean);
43
+ /** Activate the logo based on the given map type. */
44
+ activate(mapType: GoogleMapsMapTypes): Promise<boolean>;
45
+ /** Decorate implementation */
46
+ decorate: (context: DecorateContext) => void;
47
+ }
48
+ /** Get copyrights from tiles currently in the viewport.
49
+ * @internal
50
+ */
51
+ export declare function getCopyrights(vp: ScreenViewport): Map<string, number>;
52
+ export {};
53
+ //# sourceMappingURL=GoogleMapsDecorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleMapsDecorator.d.ts","sourceRoot":"","sources":["../../../src/internal/GoogleMapsDecorator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAe,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,KAAK,kBAAkB,GAAI,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/D;;GAEG;AACH,qBAAa,cAAe,YAAW,gBAAgB;IACrD,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB,4DAA4D;IAC5D,SAAgB,QAAQ,UAAiB;IAEzC,OAAO,CAAC,OAAO,CAAsB;IAErC,IAAW,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,EAE5C;IAED,0CAA0C;IAC1C,IAAW,MAAM,IALS,OAAO,GAAG,SAAS,CAO5C;IAED,4DAA4D;IACrD,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO;IAa/D,4DAA4D;IAC5D,IAAW,QAAQ,YAA8C;IAEpD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWvD;;OAEG;IACI,cAAc,CAAC,GAAG,EAAE,wBAAwB,GAAG,IAAI;IAOnD,QAAQ,CAAC,OAAO,EAAE,eAAe;CAGzC;AAED;;GAEG;AACH,qBAAa,mBAAoB,YAAW,SAAS;IACnD,SAAgB,IAAI,iBAAwB;IAC5C,OAAO,CAAC,oBAAoB,CAAC,CAAU;IAEvC;;OAEG;gBACS,mBAAmB,CAAC,EAAE,OAAO;IAIzC,qDAAqD;IACxC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAYpE,8BAA8B;IACvB,QAAQ,YAAa,eAAe,UA2BzC;CACH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAcrE"}
@@ -0,0 +1,126 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { Point3d } from "@itwin/core-geometry";
6
+ import { IModelApp } from "../IModelApp";
7
+ import { IconSprites } from "../Sprites";
8
+ /** A simple decorator that shows the logo at a given screen position.
9
+ * @internal
10
+ */
11
+ export class LogoDecoration {
12
+ _sprite;
13
+ /** The current position of the logo in view coordinates. */
14
+ position = new Point3d();
15
+ _offset;
16
+ set offset(offset) {
17
+ this._offset = offset;
18
+ }
19
+ /** The logo offset in view coordinates.*/
20
+ get offset() {
21
+ return this._offset;
22
+ }
23
+ /** Move the logo to the lower left corner of the screen. */
24
+ moveToLowerLeftCorner(context) {
25
+ if (!this._sprite || !this._sprite.isLoaded)
26
+ return false;
27
+ this.position.x = this._offset?.x ?? 0;
28
+ this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;
29
+ if (this._offset?.y)
30
+ this.position.y -= this._offset.y;
31
+ return true;
32
+ }
33
+ /* TODO: Add other move methods as needed */
34
+ /** Indicate if the logo is loaded and ready to be drawn. */
35
+ get isLoaded() { return this._sprite?.isLoaded ?? false; }
36
+ async activate(sprite) {
37
+ this._sprite = sprite;
38
+ return new Promise((resolve, _reject) => {
39
+ sprite.loadPromise.then(() => {
40
+ resolve(true);
41
+ }).catch(() => {
42
+ resolve(false);
43
+ });
44
+ });
45
+ }
46
+ /** Draw this sprite onto the supplied canvas.
47
+ * @see [[CanvasDecoration.drawDecoration]]
48
+ */
49
+ drawDecoration(ctx) {
50
+ if (this.isLoaded) {
51
+ // Draw image with an origin at the top left corner
52
+ ctx.drawImage(this._sprite.image, 0, 0);
53
+ }
54
+ }
55
+ decorate(context) {
56
+ context.addCanvasDecoration(this);
57
+ }
58
+ }
59
+ /** A decorator that adds the Google Maps logo to the lower left corner of the screen.
60
+ * @internal
61
+ */
62
+ export class GoogleMapsDecorator {
63
+ logo = new LogoDecoration();
64
+ _showCreditsOnScreen;
65
+ /** Create a new GoogleMapsDecorator.
66
+ * @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.
67
+ */
68
+ constructor(showCreditsOnScreen) {
69
+ this._showCreditsOnScreen = showCreditsOnScreen;
70
+ }
71
+ /** Activate the logo based on the given map type. */
72
+ async activate(mapType) {
73
+ // Pick the logo that is the most visible on the background map
74
+ const imageName = mapType === "roadmap" ?
75
+ "google_on_white" :
76
+ "google_on_non_white";
77
+ // We need to move the logo right after the 'i.js' button
78
+ this.logo.offset = new Point3d(45, 10);
79
+ return this.logo.activate(IconSprites.getSpriteFromUrl(`${IModelApp.publicPath}images/${imageName}.png`));
80
+ }
81
+ ;
82
+ /** Decorate implementation */
83
+ decorate = (context) => {
84
+ if (!this.logo.isLoaded)
85
+ return;
86
+ this.logo.moveToLowerLeftCorner(context);
87
+ this.logo.decorate(context);
88
+ if (!this._showCreditsOnScreen)
89
+ return;
90
+ // Get data attribution (copyright) text
91
+ const copyrightMap = getCopyrights(context.viewport);
92
+ // Order by most occurances to least
93
+ // See https://developers.google.com/maps/documentation/tile/create-renderer#display-attributions
94
+ const sortedCopyrights = [...copyrightMap.entries()].sort((a, b) => b[1] - a[1]);
95
+ const copyrightText = sortedCopyrights.map(([key]) => ` • ${key}`).join("");
96
+ // Create and add element, offset to leave space for i.js and Google logos
97
+ const elem = document.createElement("div");
98
+ elem.innerHTML = copyrightText;
99
+ elem.style.color = "white";
100
+ elem.style.fontSize = "11px";
101
+ elem.style.textWrap = "wrap";
102
+ elem.style.position = "absolute";
103
+ elem.style.bottom = "10px";
104
+ elem.style.left = "107px";
105
+ context.addHtmlDecoration(elem);
106
+ };
107
+ }
108
+ /** Get copyrights from tiles currently in the viewport.
109
+ * @internal
110
+ */
111
+ export function getCopyrights(vp) {
112
+ const tiles = IModelApp.tileAdmin.getTilesForUser(vp)?.selected;
113
+ const copyrightMap = new Map();
114
+ if (tiles) {
115
+ for (const tile of tiles) {
116
+ if (tile.copyright) {
117
+ for (const copyright of tile.copyright.split(";")) {
118
+ const currentCount = copyrightMap.get(copyright);
119
+ copyrightMap.set(copyright, currentCount ? currentCount + 1 : 1);
120
+ }
121
+ }
122
+ }
123
+ }
124
+ return copyrightMap;
125
+ }
126
+ //# sourceMappingURL=GoogleMapsDecorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleMapsDecorator.js","sourceRoot":"","sources":["../../../src/internal/GoogleMapsDecorator.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,C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G,SAAS,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\nimport { CanvasDecoration } from \"../render/CanvasDecoration\";\r\nimport { DecorateContext } from \"../ViewContext\";\r\nimport { IModelApp } from \"../IModelApp\";\r\nimport { Decorator } from \"../ViewManager\";\r\nimport { IconSprites, Sprite } from \"../Sprites\";\r\nimport { RealityTile } from \"../tile/internal\";\r\nimport { ScreenViewport } from \"../Viewport\";\r\n\r\n/** Layer types that can be added to the map.\r\n * @internal\r\n */\r\ntype GoogleMapsMapTypes = \"roadmap\" | \"satellite\" | \"terrain\";\r\n\r\n/** A simple decorator that shows the logo at a given screen position.\r\n * @internal\r\n */\r\nexport class LogoDecoration implements CanvasDecoration {\r\n private _sprite?: Sprite;\r\n\r\n /** The current position of the logo in view coordinates. */\r\n public readonly position = new Point3d();\r\n\r\n private _offset: Point3d | undefined;\r\n\r\n public set offset(offset: Point3d | undefined) {\r\n this._offset = offset;\r\n }\r\n\r\n /** The logo offset in view coordinates.*/\r\n public get offset() {\r\n return this._offset;\r\n }\r\n\r\n /** Move the logo to the lower left corner of the screen. */\r\n public moveToLowerLeftCorner(context: DecorateContext): boolean {\r\n if (!this._sprite || !this._sprite.isLoaded)\r\n return false;\r\n\r\n this.position.x = this._offset?.x ?? 0;\r\n this.position.y = context.viewport.parentDiv.clientHeight - this._sprite.size.y;\r\n if (this._offset?.y)\r\n this.position.y -= this._offset.y;\r\n return true;\r\n }\r\n\r\n /* TODO: Add other move methods as needed */\r\n\r\n /** Indicate if the logo is loaded and ready to be drawn. */\r\n public get isLoaded() { return this._sprite?.isLoaded ?? false; }\r\n\r\n public async activate(sprite: Sprite): Promise<boolean> {\r\n this._sprite = sprite;\r\n return new Promise<boolean>((resolve, _reject) => {\r\n sprite.loadPromise.then(() => {\r\n resolve(true);\r\n }).catch(() => {\r\n resolve (false);\r\n });\r\n });\r\n }\r\n\r\n /** Draw this sprite onto the supplied canvas.\r\n * @see [[CanvasDecoration.drawDecoration]]\r\n */\r\n public drawDecoration(ctx: CanvasRenderingContext2D): void {\r\n if (this.isLoaded) {\r\n // Draw image with an origin at the top left corner\r\n ctx.drawImage(this._sprite!.image!, 0, 0);\r\n }\r\n }\r\n\r\n public decorate(context: DecorateContext) {\r\n context.addCanvasDecoration(this);\r\n }\r\n}\r\n\r\n/** A decorator that adds the Google Maps logo to the lower left corner of the screen.\r\n * @internal\r\n */\r\nexport class GoogleMapsDecorator implements Decorator {\r\n public readonly logo = new LogoDecoration();\r\n private _showCreditsOnScreen?: boolean;\r\n\r\n /** Create a new GoogleMapsDecorator.\r\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.\r\n */\r\n constructor(showCreditsOnScreen?: boolean) {\r\n this._showCreditsOnScreen = showCreditsOnScreen;\r\n }\r\n\r\n /** Activate the logo based on the given map type. */\r\n public async activate(mapType: GoogleMapsMapTypes): Promise<boolean> {\r\n // Pick the logo that is the most visible on the background map\r\n const imageName = mapType === \"roadmap\" ?\r\n \"google_on_white\" :\r\n \"google_on_non_white\";\r\n\r\n // We need to move the logo right after the 'i.js' button\r\n this.logo.offset = new Point3d(45, 10);\r\n\r\n return this.logo.activate(IconSprites.getSpriteFromUrl(`${IModelApp.publicPath}images/${imageName}.png`));\r\n };\r\n\r\n /** Decorate implementation */\r\n public decorate = (context: DecorateContext) => {\r\n if (!this.logo.isLoaded)\r\n return;\r\n this.logo.moveToLowerLeftCorner(context);\r\n this.logo.decorate(context);\r\n\r\n if (!this._showCreditsOnScreen)\r\n return;\r\n\r\n // Get data attribution (copyright) text\r\n const copyrightMap = getCopyrights(context.viewport);\r\n // Order by most occurances to least\r\n // See https://developers.google.com/maps/documentation/tile/create-renderer#display-attributions\r\n const sortedCopyrights = [...copyrightMap.entries()].sort((a, b) => b[1] - a[1]);\r\n const copyrightText = sortedCopyrights.map(([key]) => ` • ${key}`).join(\"\");\r\n\r\n // Create and add element, offset to leave space for i.js and Google logos\r\n const elem = document.createElement(\"div\");\r\n elem.innerHTML = copyrightText;\r\n elem.style.color = \"white\";\r\n elem.style.fontSize = \"11px\";\r\n elem.style.textWrap = \"wrap\";\r\n elem.style.position = \"absolute\";\r\n elem.style.bottom = \"10px\";\r\n elem.style.left = \"107px\";\r\n\r\n context.addHtmlDecoration(elem);\r\n };\r\n}\r\n\r\n/** Get copyrights from tiles currently in the viewport.\r\n * @internal\r\n */\r\nexport function getCopyrights(vp: ScreenViewport): Map<string, number> {\r\n const tiles = IModelApp.tileAdmin.getTilesForUser(vp)?.selected;\r\n const copyrightMap = new Map<string, number>();\r\n if (tiles) {\r\n for (const tile of tiles as Set<RealityTile>) {\r\n if (tile.copyright) {\r\n for (const copyright of tile.copyright.split(\";\")) {\r\n const currentCount = copyrightMap.get(copyright);\r\n copyrightMap.set(copyright, currentCount ? currentCount + 1 : 1);\r\n }\r\n }\r\n }\r\n }\r\n return copyrightMap;\r\n}"]}
@@ -0,0 +1,83 @@
1
+ /** @packageDocumentation
2
+ * @module Tiles
3
+ */
4
+ import { GuidString } from "@itwin/core-bentley";
5
+ import { RealityData, RealityDataSourceKey, RealityDataSourceProps } from "@itwin/core-common";
6
+ import { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from "../RealityDataSource";
7
+ /** This class provides access to the reality data provider services.
8
+ * It encapsulates access to a reality data from the Google Photorealistic 3D Tiles service.
9
+ * A valid Google 3D Tiles authentication key must be configured for this provider to work (provide the key in the [[RealityDataSourceGoogle3dTilesImpl.createFromKey]] method).
10
+ * @internal
11
+ */
12
+ export declare class RealityDataSourceGoogle3dTilesImpl implements RealityDataSource {
13
+ readonly key: RealityDataSourceKey;
14
+ /** The URL that supplies the 3d tiles for displaying the Google 3D Tiles tileset. */
15
+ private _tilesetUrl;
16
+ /** Base URL of the Google 3D Tiles tileset. Does not include trailing subdirectories. */
17
+ private _baseUrl;
18
+ /** Search parameters that must be passed down to child tile requests. */
19
+ private _searchParams?;
20
+ /** Google Map Tiles API Key used to access Google 3D Tiles. */
21
+ private _apiKey?;
22
+ /** Function that returns an OAuth token for authenticating with GP3sDT. This token is expected to not contain the "Bearer" prefix. */
23
+ private _getAuthToken?;
24
+ /** This is necessary for Google 3D Tiles tilesets! This tells the iTwin.js tiling system to use the geometric error specified in the tileset rather than any of our own. */
25
+ readonly usesGeometricError = true;
26
+ readonly maximumScreenSpaceError = 16;
27
+ /** Construct a new reality data source.
28
+ * @param props JSON representation of the reality data source
29
+ */
30
+ protected constructor(props: RealityDataSourceProps, apiKey: string | undefined, _getAuthToken?: () => Promise<string | undefined>);
31
+ /**
32
+ * Create an instance of this class from a source key and iTwin context.
33
+ */
34
+ static createFromKey(sourceKey: RealityDataSourceKey, _iTwinId: GuidString | undefined, apiKey: string | undefined, _getAuthToken?: () => Promise<string | undefined>): Promise<RealityDataSource | undefined>;
35
+ get isContextShare(): boolean;
36
+ /**
37
+ * Returns Reality Data if available
38
+ */
39
+ get realityData(): RealityData | undefined;
40
+ get realityDataId(): string | undefined;
41
+ /**
42
+ * Returns Reality Data type if available
43
+ */
44
+ get realityDataType(): string | undefined;
45
+ getTilesetUrl(): string | undefined;
46
+ /** Return the URL of the Google 3D Tiles tileset with its API key included. */
47
+ private getTilesetUrlWithKey;
48
+ protected setBaseUrl(url: string): void;
49
+ /**
50
+ * This method returns the URL to access the actual 3d tiles from the service provider.
51
+ * @returns string containing the URL to reality data.
52
+ */
53
+ getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined>;
54
+ getRootDocument(_iTwinId: GuidString | undefined): Promise<any>;
55
+ /** Returns the tile URL relative to the base URL.
56
+ * If the tile path is a relative URL, the base URL is prepended to it.
57
+ * For both absolute and relative tile path URLs, the search parameters are checked. If the search params are empty, the base URL's search params are appended to the tile path.
58
+ */
59
+ getTileUrl(tilePath: string): string;
60
+ /**
61
+ * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
62
+ */
63
+ getTileContent(name: string): Promise<ArrayBuffer>;
64
+ /**
65
+ * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.
66
+ */
67
+ getTileJson(name: string): Promise<any>;
68
+ getTileContentType(url: string): "tile" | "tileset";
69
+ /**
70
+ * Gets spatial location and extents of this reality data source
71
+ * @returns spatial location and extents
72
+ * @internal
73
+ */
74
+ getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined>;
75
+ /**
76
+ * Gets information to identify the product and engine that create this reality data
77
+ * Will return undefined if cannot be resolved
78
+ * @returns information to identify the product and engine that create this reality data
79
+ * @alpha
80
+ */
81
+ getPublisherProductInfo(): Promise<PublisherProductInfo | undefined>;
82
+ }
83
+ //# sourceMappingURL=RealityDataSourceGoogle3dTilesImpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RealityDataSourceGoogle3dTilesImpl.d.ts","sourceR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SAAS,CAE7C;IACD;;OAEG;IACH,IAAW,eAAe,IAAI,MAAM,GAAG,SAAS,CAE/C;IAEM,aAAa,IAAI,MAAM,GAAG,SAAS;IAI1C,+EAA+E;IAC/E,OAAO,CAAC,oBAAoB;IAU5B,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAYvC;;;OAGG;IACU,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI5E,eAAe,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAmB5E;;;OAGG;IACI,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IA8B3C;;OAEG;IACU,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAa/D;;OAEG;IACU,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAa7C,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI1D;;;;OAIG;IACU,4BAA4B,IAAI,OAAO,CAAC,yBAAyB,GAAG,SAAS,CAAC;IAQ3F;;;;;OAKG;IACU,uBAAuB,IAAI,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC;CAIlF"}
@@ -0,0 +1,197 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ /** @packageDocumentation
6
+ * @module Tiles
7
+ */
8
+ import { BentleyStatus } from "@itwin/core-bentley";
9
+ import { IModelError, RealityDataFormat } from "@itwin/core-common";
10
+ import { request } from "../request/Request";
11
+ import { ThreeDTileFormatInterpreter } from "../tile/internal";
12
+ /** This class provides access to the reality data provider services.
13
+ * It encapsulates access to a reality data from the Google Photorealistic 3D Tiles service.
14
+ * A valid Google 3D Tiles authentication key must be configured for this provider to work (provide the key in the [[RealityDataSourceGoogle3dTilesImpl.createFromKey]] method).
15
+ * @internal
16
+ */
17
+ export class RealityDataSourceGoogle3dTilesImpl {
18
+ key;
19
+ /** The URL that supplies the 3d tiles for displaying the Google 3D Tiles tileset. */
20
+ _tilesetUrl;
21
+ /** Base URL of the Google 3D Tiles tileset. Does not include trailing subdirectories. */
22
+ _baseUrl = "";
23
+ /** Search parameters that must be passed down to child tile requests. */
24
+ _searchParams;
25
+ /** Google Map Tiles API Key used to access Google 3D Tiles. */
26
+ _apiKey;
27
+ /** Function that returns an OAuth token for authenticating with GP3sDT. This token is expected to not contain the "Bearer" prefix. */
28
+ _getAuthToken;
29
+ /** This is necessary for Google 3D Tiles tilesets! This tells the iTwin.js tiling system to use the geometric error specified in the tileset rather than any of our own. */
30
+ usesGeometricError = true;
31
+ maximumScreenSpaceError = 16;
32
+ /** Construct a new reality data source.
33
+ * @param props JSON representation of the reality data source
34
+ */
35
+ constructor(props, apiKey, _getAuthToken) {
36
+ this.key = props.sourceKey;
37
+ this._tilesetUrl = this.key.id;
38
+ this._apiKey = apiKey;
39
+ this._getAuthToken = _getAuthToken;
40
+ }
41
+ /**
42
+ * Create an instance of this class from a source key and iTwin context.
43
+ */
44
+ static async createFromKey(sourceKey, _iTwinId, apiKey, _getAuthToken) {
45
+ return new RealityDataSourceGoogle3dTilesImpl({ sourceKey }, apiKey, _getAuthToken);
46
+ }
47
+ get isContextShare() {
48
+ return false;
49
+ }
50
+ /**
51
+ * Returns Reality Data if available
52
+ */
53
+ get realityData() {
54
+ return undefined;
55
+ }
56
+ get realityDataId() {
57
+ return undefined;
58
+ }
59
+ /**
60
+ * Returns Reality Data type if available
61
+ */
62
+ get realityDataType() {
63
+ return undefined;
64
+ }
65
+ getTilesetUrl() {
66
+ return this._tilesetUrl;
67
+ }
68
+ /** Return the URL of the Google 3D Tiles tileset with its API key included. */
69
+ getTilesetUrlWithKey() {
70
+ const google3dTilesKey = this._apiKey;
71
+ if (this._getAuthToken) {
72
+ // If we have a getAuthToken function, no need to append API key to the URL
73
+ return this._tilesetUrl;
74
+ }
75
+ else {
76
+ return `${this._tilesetUrl}?key=${google3dTilesKey}`;
77
+ }
78
+ }
79
+ setBaseUrl(url) {
80
+ const urlParts = url.split("/");
81
+ const newUrl = new URL(url);
82
+ this._searchParams = newUrl.searchParams;
83
+ urlParts.pop();
84
+ if (urlParts.length === 0) {
85
+ this._baseUrl = "";
86
+ }
87
+ else {
88
+ this._baseUrl = newUrl.origin;
89
+ }
90
+ }
91
+ /**
92
+ * This method returns the URL to access the actual 3d tiles from the service provider.
93
+ * @returns string containing the URL to reality data.
94
+ */
95
+ async getServiceUrl(_iTwinId) {
96
+ return this._tilesetUrl;
97
+ }
98
+ async getRootDocument(_iTwinId) {
99
+ const url = this.getTilesetUrlWithKey();
100
+ if (!url)
101
+ throw new IModelError(BentleyStatus.ERROR, "Unable to get service url");
102
+ this.setBaseUrl(url);
103
+ let authToken;
104
+ if (this._getAuthToken) {
105
+ authToken = await this._getAuthToken();
106
+ }
107
+ return request(url, "json", authToken ? {
108
+ headers: {
109
+ authorization: `Bearer ${authToken}`
110
+ }
111
+ } : undefined);
112
+ }
113
+ /** Returns the tile URL relative to the base URL.
114
+ * If the tile path is a relative URL, the base URL is prepended to it.
115
+ * For both absolute and relative tile path URLs, the search parameters are checked. If the search params are empty, the base URL's search params are appended to the tile path.
116
+ */
117
+ getTileUrl(tilePath) {
118
+ // this._baseUrl does not include the trailing subdirectories.
119
+ // This is not an issue because the tile path always starts with the appropriate subdirectories.
120
+ // We also do not need to worry about the tile path starting with a slash.
121
+ // This happens in these tiles at the second .json level, but the URL API will handle that for us.
122
+ const url = new URL(tilePath, this._baseUrl);
123
+ // If tile is a reference to a tileset, iterate over tileset url's search params and store them in this._searchParams so we can pass them down to children
124
+ if (this.getTileContentType(url.toString()) === "tileset" && url.searchParams.size !== 0) {
125
+ for (const [key, value] of url.searchParams.entries()) {
126
+ this._searchParams?.append(key, value);
127
+ }
128
+ }
129
+ if (this._searchParams === undefined || this._searchParams.size === 0) {
130
+ return url.toString();
131
+ }
132
+ // Append all stored search params to url's existing ones
133
+ const newUrl = new URL(url.toString());
134
+ for (const [key, value] of this._searchParams.entries()) {
135
+ if (!url.searchParams.has(key)) {
136
+ // Only append the search param if it does not already exist in the url
137
+ newUrl.searchParams.append(key, value);
138
+ }
139
+ }
140
+ return newUrl.toString();
141
+ }
142
+ /**
143
+ * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
144
+ */
145
+ async getTileContent(name) {
146
+ let authToken;
147
+ if (this._getAuthToken) {
148
+ authToken = await this._getAuthToken();
149
+ }
150
+ return request(this.getTileUrl(name), "arraybuffer", authToken ? {
151
+ headers: {
152
+ authorization: `Bearer ${authToken}`
153
+ }
154
+ } : undefined);
155
+ }
156
+ /**
157
+ * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.
158
+ */
159
+ async getTileJson(name) {
160
+ let authToken;
161
+ if (this._getAuthToken) {
162
+ authToken = await this._getAuthToken();
163
+ }
164
+ return request(this.getTileUrl(name), "json", authToken ? {
165
+ headers: {
166
+ authorization: `Bearer ${authToken}`
167
+ }
168
+ } : undefined);
169
+ }
170
+ getTileContentType(url) {
171
+ return new URL(url, "https://localhost/").pathname.toLowerCase().endsWith("json") ? "tileset" : "tile";
172
+ }
173
+ /**
174
+ * Gets spatial location and extents of this reality data source
175
+ * @returns spatial location and extents
176
+ * @internal
177
+ */
178
+ async getSpatialLocationAndExtents() {
179
+ let spatialLocation;
180
+ if (this.key.format === RealityDataFormat.ThreeDTile) {
181
+ const rootDocument = await this.getRootDocument(undefined);
182
+ spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);
183
+ }
184
+ return spatialLocation;
185
+ }
186
+ /**
187
+ * Gets information to identify the product and engine that create this reality data
188
+ * Will return undefined if cannot be resolved
189
+ * @returns information to identify the product and engine that create this reality data
190
+ * @alpha
191
+ */
192
+ async getPublisherProductInfo() {
193
+ let publisherInfo;
194
+ return publisherInfo;
195
+ }
196
+ }
197
+ //# sourceMappingURL=RealityDataSourceGoogle3dTilesImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RealityDataSourceGoogle3dTilesImpl.js","sourceRoot":"","sources":["../../../src/internal/RealityDataSourceGoogle3dTilesImpl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,OAAO,EAAE,aAAa,EAAc,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAe,iBAAiB,EAAgD,MAAM,oBAAoB,CAAC;AAE/H,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAE/D;;;;EAIE;AACF,MAAM,OAAO,kCAAkC;IAC7B,GAAG,CAAuB;IAC1C,qFAAqF;IAC7E,WAAW,CAAqB;IACxC,yFAAyF;IACjF,QAAQ,GAAW,EAAE,CAAA;IAC7B,yEAAyE;IACjE,aAAa,CAAmB;IACxC,+DAA+D;IACvD,OAAO,CAAU;IACzB,sIAAsI;IAC9H,aAAa,CAAqC;IAE1D,4KAA4K;IAC5J,kBAAkB,GAAG,IAAI,CAAC;IAC1B,uBAAuB,GAAG,EAAE,CAAC;IAE7C;;OAEG;IACH,YAAsB,KAA6B,EAAE,MAA0B,EAAE,aAAiD;QAChI,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,SAA+B,EAAE,QAAgC,EAAE,MAA0B,EAAE,aAAiD;Q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CAAC;IAEM,kBAAkB,CAAC,GAAW;QACnC,OAAO,IAAI,GAAG,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IACzG,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,4BAA4B;QACvC,IAAI,eAAsD,CAAC;QAC3D,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,iBAAiB,CAAC,UAAU,EAAE,CAAC;YACrD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,eAAe,GAAG,2BAA2B,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC;QAC3F,CAAC;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACI,KAAK,CAAC,uBAAuB;QAClC,IAAI,aAA+C,CAAC;QACpD,OAAO,aAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Tiles\r\n */\r\nimport { BentleyStatus, GuidString } from \"@itwin/core-bentley\";\r\nimport { IModelError, RealityData, RealityDataFormat, RealityDataSourceKey, RealityDataSourceProps } from \"@itwin/core-common\";\r\n\r\nimport { request } from \"../request/Request\";\r\nimport { PublisherProductInfo, RealityDataSource, SpatialLocationAndExtents } from \"../RealityDataSource\";\r\nimport { ThreeDTileFormatInterpreter } from \"../tile/internal\";\r\n\r\n/** This class provides access to the reality data provider services.\r\n * It encapsulates access to a reality data from the Google Photorealistic 3D Tiles service.\r\n * A valid Google 3D Tiles authentication key must be configured for this provider to work (provide the key in the [[RealityDataSourceGoogle3dTilesImpl.createFromKey]] method).\r\n* @internal\r\n*/\r\nexport class RealityDataSourceGoogle3dTilesImpl implements RealityDataSource {\r\n public readonly key: RealityDataSourceKey;\r\n /** The URL that supplies the 3d tiles for displaying the Google 3D Tiles tileset. */\r\n private _tilesetUrl: string | undefined;\r\n /** Base URL of the Google 3D Tiles tileset. Does not include trailing subdirectories. */\r\n private _baseUrl: string = \"\"\r\n /** Search parameters that must be passed down to child tile requests. */\r\n private _searchParams?: URLSearchParams;\r\n /** Google Map Tiles API Key used to access Google 3D Tiles. */\r\n private _apiKey?: string;\r\n /** Function that returns an OAuth token for authenticating with GP3sDT. This token is expected to not contain the \"Bearer\" prefix. */\r\n private _getAuthToken?: () => Promise<string | undefined>;\r\n\r\n /** This is necessary for Google 3D Tiles tilesets! This tells the iTwin.js tiling system to use the geometric error specified in the tileset rather than any of our own. */\r\n public readonly usesGeometricError = true;\r\n public readonly maximumScreenSpaceError = 16;\r\n\r\n /** Construct a new reality data source.\r\n * @param props JSON representation of the reality data source\r\n */\r\n protected constructor(props: RealityDataSourceProps, apiKey: string | undefined, _getAuthToken?: () => Promise<string | undefined>) {\r\n this.key = props.sourceKey;\r\n this._tilesetUrl = this.key.id;\r\n this._apiKey = apiKey;\r\n this._getAuthToken = _getAuthToken;\r\n }\r\n\r\n /**\r\n * Create an instance of this class from a source key and iTwin context.\r\n */\r\n public static async createFromKey(sourceKey: RealityDataSourceKey, _iTwinId: GuidString | undefined, apiKey: string | undefined, _getAuthToken?: () => Promise<string | undefined>): Promise<RealityDataSource | undefined> {\r\n return new RealityDataSourceGoogle3dTilesImpl({ sourceKey }, apiKey, _getAuthToken);\r\n }\r\n\r\n public get isContextShare(): boolean {\r\n return false;\r\n }\r\n /**\r\n * Returns Reality Data if available\r\n */\r\n public get realityData(): RealityData | undefined {\r\n return undefined;\r\n }\r\n public get realityDataId(): string | undefined {\r\n return undefined;\r\n }\r\n /**\r\n * Returns Reality Data type if available\r\n */\r\n public get realityDataType(): string | undefined {\r\n return undefined;\r\n }\r\n\r\n public getTilesetUrl(): string | undefined {\r\n return this._tilesetUrl;\r\n }\r\n\r\n /** Return the URL of the Google 3D Tiles tileset with its API key included. */\r\n private getTilesetUrlWithKey() {\r\n const google3dTilesKey = this._apiKey;\r\n if (this._getAuthToken) {\r\n // If we have a getAuthToken function, no need to append API key to the URL\r\n return this._tilesetUrl;\r\n } else {\r\n return `${this._tilesetUrl}?key=${google3dTilesKey}`;\r\n }\r\n }\r\n\r\n protected setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\r\n const newUrl = new URL(url);\r\n this._searchParams = newUrl.searchParams;\r\n urlParts.pop();\r\n if (urlParts.length === 0) {\r\n this._baseUrl = \"\";\r\n } else {\r\n this._baseUrl = newUrl.origin;\r\n }\r\n }\r\n\r\n /**\r\n * This method returns the URL to access the actual 3d tiles from the service provider.\r\n * @returns string containing the URL to reality data.\r\n */\r\n public async getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined> {\r\n return this._tilesetUrl;\r\n }\r\n\r\n public async getRootDocument(_iTwinId: GuidString | undefined): Promise<any> {\r\n const url = this.getTilesetUrlWithKey();\r\n if (!url)\r\n throw new IModelError(BentleyStatus.ERROR, \"Unable to get service url\");\r\n\r\n this.setBaseUrl(url);\r\n\r\n let authToken;\r\n if (this._getAuthToken) {\r\n authToken = await this._getAuthToken();\r\n }\r\n\r\n return request(url, \"json\", authToken ? {\r\n headers: {\r\n authorization: `Bearer ${authToken}`\r\n }} : undefined\r\n );\r\n }\r\n\r\n /** Returns the tile URL relative to the base URL.\r\n * If the tile path is a relative URL, the base URL is prepended to it.\r\n * For both absolute and relative tile path URLs, the search parameters are checked. If the search params are empty, the base URL's search params are appended to the tile path.\r\n */\r\n public getTileUrl(tilePath: string): string {\r\n // this._baseUrl does not include the trailing subdirectories.\r\n // This is not an issue because the tile path always starts with the appropriate subdirectories.\r\n // We also do not need to worry about the tile path starting with a slash.\r\n // This happens in these tiles at the second .json level, but the URL API will handle that for us.\r\n const url = new URL(tilePath, this._baseUrl);\r\n\r\n // If tile is a reference to a tileset, iterate over tileset url's search params and store them in this._searchParams so we can pass them down to children\r\n if (this.getTileContentType(url.toString()) === \"tileset\" && url.searchParams.size !== 0) {\r\n for (const [key, value] of url.searchParams.entries()) {\r\n this._searchParams?.append(key, value);\r\n }\r\n }\r\n\r\n if (this._searchParams === undefined || this._searchParams.size === 0) {\r\n return url.toString();\r\n }\r\n\r\n // Append all stored search params to url's existing ones\r\n const newUrl = new URL(url.toString());\r\n for (const [key, value] of this._searchParams.entries()) {\r\n if (!url.searchParams.has(key)) {\r\n // Only append the search param if it does not already exist in the url\r\n newUrl.searchParams.append(key, value);\r\n }\r\n }\r\n\r\n return newUrl.toString();\r\n }\r\n\r\n /**\r\n * Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileContent(name: string): Promise<ArrayBuffer> {\r\n let authToken;\r\n if (this._getAuthToken) {\r\n authToken = await this._getAuthToken();\r\n }\r\n\r\n return request(this.getTileUrl(name), \"arraybuffer\", authToken ? {\r\n headers: {\r\n authorization: `Bearer ${authToken}`\r\n }} : undefined\r\n );\r\n }\r\n\r\n /**\r\n * Returns the tile content in json format. The path to the tile is relative to the base url of present reality data whatever the type.\r\n */\r\n public async getTileJson(name: string): Promise<any> {\r\n let authToken;\r\n if (this._getAuthToken) {\r\n authToken = await this._getAuthToken();\r\n }\r\n\r\n return request(this.getTileUrl(name), \"json\", authToken ? {\r\n headers: {\r\n authorization: `Bearer ${authToken}`\r\n }} : undefined\r\n );\r\n }\r\n\r\n public getTileContentType(url: string): \"tile\" | \"tileset\" {\r\n return new URL(url, \"https://localhost/\").pathname.toLowerCase().endsWith(\"json\") ? \"tileset\" : \"tile\";\r\n }\r\n\r\n /**\r\n * Gets spatial location and extents of this reality data source\r\n * @returns spatial location and extents\r\n * @internal\r\n */\r\n public async getSpatialLocationAndExtents(): Promise<SpatialLocationAndExtents | undefined> {\r\n let spatialLocation: SpatialLocationAndExtents | undefined;\r\n if (this.key.format === RealityDataFormat.ThreeDTile) {\r\n const rootDocument = await this.getRootDocument(undefined);\r\n spatialLocation = ThreeDTileFormatInterpreter.getSpatialLocationAndExtents(rootDocument);\r\n }\r\n return spatialLocation;\r\n }\r\n /**\r\n * Gets information to identify the product and engine that create this reality data\r\n * Will return undefined if cannot be resolved\r\n * @returns information to identify the product and engine that create this reality data\r\n * @alpha\r\n */\r\n public async getPublisherProductInfo(): Promise<PublisherProductInfo | undefined> {\r\n let publisherInfo: PublisherProductInfo | undefined;\r\n return publisherInfo;\r\n }\r\n}\r\n\r\n"]}
@@ -10,6 +10,7 @@ export { type GLTimerResult, RenderDiagnostics, type RenderSystemDebugControl }
10
10
  export { formatAnimationBranchId } from "./render/AnimationBranchState";
11
11
  export { PrimitiveVisibility, type RenderTargetDebugControl } from "./render/RenderTargetDebugControl";
12
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";
13
+ export { GoogleMapsDecorator, LogoDecoration } from "./GoogleMapsDecorator";
13
14
  export { DebugShaderFile } from "./render/RenderSystemDebugControl";
14
15
  export { IModelTileTree } from "./tile/IModelTileTree";
15
16
  //# sourceMappingURL=cross-package.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"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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"}
@@ -15,6 +15,7 @@ export { formatAnimationBranchId } from "./render/AnimationBranchState";
15
15
  export { PrimitiveVisibility } from "./render/RenderTargetDebugControl";
16
16
  // Used by frontend-tiles, map-layers-formats, frontend-dev-tools
17
17
  export { acquireImdlDecoder, appendQueryParams, ArcGisErrorCode, ArcGisGeometryReaderJSON, ArcGISImageryProvider, ArcGisUtilities, createSpatialTileTreeReferences, deflateCoordinates, FeatureGeometryBaseRenderer, FeatureGraphicsRenderer, GltfReader, ImageryMapTileTree, ImdlReader, MapTileTreeReference, RealityModelTileUtils, RealityTileLoader, SpatialTileTreeReferences, WmsUtilities, LayerTileTreeHandler, LayerTileTreeReferenceHandler } from "../tile/internal";
18
+ export { GoogleMapsDecorator, LogoDecoration } from "./GoogleMapsDecorator";
18
19
  // Used by display-test-app which currently builds using both ESModules and CommonJS.
19
20
  // Remove once CommonJS is dropped.
20
21
  export { DebugShaderFile } from "./render/RenderSystemDebugControl";