@itwin/core-frontend 5.0.0-dev.5 → 5.0.0-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts +6 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.js +14 -2
- package/lib/cjs/RealityDataSourceTilesetUrlImpl.js.map +1 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts +6 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.d.ts.map +1 -1
- package/lib/esm/RealityDataSourceTilesetUrlImpl.js +14 -2
- package/lib/esm/RealityDataSourceTilesetUrlImpl.js.map +1 -1
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
# Change Log - @itwin/core-frontend
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 14 Nov 2024 18:13:56 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.10.1
|
|
6
|
+
Thu, 14 Nov 2024 18:11:00 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.10.0
|
|
11
|
+
Wed, 13 Nov 2024 15:23:38 GMT
|
|
12
|
+
|
|
13
|
+
### Updates
|
|
14
|
+
|
|
15
|
+
- Deprecate `SnapshotConnection.openRemote`
|
|
16
|
+
- Fixed problem with zoom when background map is on and allow3dManipulations is on.
|
|
17
|
+
- Fixed reading of KHR compressed meshes in GLTF reader.
|
|
18
|
+
- When a inUseLocks error is thrown on the backend during an IPC call, it will also be thrown on the frontend.
|
|
19
|
+
- Promote some overridden methods/properties from internal to public.
|
|
20
|
+
- Fix WorkerReturnType for async implementations.
|
|
21
|
+
- Add support for instancing to GraphicBuilder, GraphicDescriptionBuilder, and glTF.
|
|
22
|
+
- Add support for snapping to secondary iModels within a viewport.
|
|
23
|
+
- Permit FeatureAppearance to independently override line color and transparency.
|
|
24
|
+
- Add option to temporarily hide specific elements for Viewport.readPixels.
|
|
25
|
+
- Support snapping within section drawing attachments.
|
|
26
|
+
- Allow context reality model visibility to be toggled on/off
|
|
27
|
+
- Support ContourDisplay rendering.
|
|
4
28
|
|
|
5
29
|
## 4.9.7
|
|
6
30
|
Wed, 06 Nov 2024 19:23:04 GMT
|
|
@@ -17,6 +17,8 @@ export declare class RealityDataSourceTilesetUrlImpl implements RealityDataSourc
|
|
|
17
17
|
private _tilesetUrl;
|
|
18
18
|
/** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/
|
|
19
19
|
private _baseUrl;
|
|
20
|
+
/** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/
|
|
21
|
+
private _searchParams;
|
|
20
22
|
/** Construct a new reality data source.
|
|
21
23
|
* @param props JSON representation of the reality data source
|
|
22
24
|
*/
|
|
@@ -43,7 +45,10 @@ export declare class RealityDataSourceTilesetUrlImpl implements RealityDataSourc
|
|
|
43
45
|
getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined>;
|
|
44
46
|
getRootDocument(iTwinId: GuidString | undefined): Promise<any>;
|
|
45
47
|
private isValidURL;
|
|
46
|
-
/** Returns the tile URL.
|
|
48
|
+
/** Returns the tile URL.
|
|
49
|
+
* If the tile path is a relative URL, the base URL is prepended to it.
|
|
50
|
+
* 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.
|
|
51
|
+
*/
|
|
47
52
|
private getTileUrl;
|
|
48
53
|
/**
|
|
49
54
|
* Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSourceTilesetUrlImpl.d.ts","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImp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EnC;IACD;;MAEE;IACF,IAAW,WAAW,IAAI,WAAW,GAAG,SAAS,CAEhD;IACD,IAAW,aAAa,IAAI,MAAM,GAAG,SAAS,CAE7C;IACD;;OAEG;IACH,IAAW,eAAe,IAAI,MAAM,GAAG,SAAS,CAE/C;IAQD,OAAO,CAAC,UAAU;IAWlB;;;OAGG;IACU,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI5E,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAU3E,OAAO,CAAC,UAAU;IASlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACU,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI/D;;OAEG;IACU,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7C,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"}
|
|
@@ -26,6 +26,8 @@ class RealityDataSourceTilesetUrlImpl {
|
|
|
26
26
|
constructor(props) {
|
|
27
27
|
/** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/
|
|
28
28
|
this._baseUrl = "";
|
|
29
|
+
/** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/
|
|
30
|
+
this._searchParams = "";
|
|
29
31
|
(0, core_bentley_1.assert)(props.sourceKey.provider === core_common_1.RealityDataProvider.TilesetUrl || props.sourceKey.provider === core_common_1.RealityDataProvider.OrbitGtBlob);
|
|
30
32
|
this.key = props.sourceKey;
|
|
31
33
|
this._tilesetUrl = this.key.id;
|
|
@@ -62,8 +64,11 @@ class RealityDataSourceTilesetUrlImpl {
|
|
|
62
64
|
// otherwise the full path to root document is given.
|
|
63
65
|
// The base URL contains the base URL from which tile relative path are constructed.
|
|
64
66
|
// The tile's path root will need to be reinserted for child tiles to return a 200
|
|
67
|
+
// If the original url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.
|
|
65
68
|
setBaseUrl(url) {
|
|
66
69
|
const urlParts = url.split("/");
|
|
70
|
+
const newUrl = new URL(url);
|
|
71
|
+
this._searchParams = newUrl.search;
|
|
67
72
|
urlParts.pop();
|
|
68
73
|
if (urlParts.length === 0)
|
|
69
74
|
this._baseUrl = "";
|
|
@@ -94,9 +99,16 @@ class RealityDataSourceTilesetUrlImpl {
|
|
|
94
99
|
}
|
|
95
100
|
return true;
|
|
96
101
|
}
|
|
97
|
-
/** Returns the tile URL.
|
|
102
|
+
/** Returns the tile URL.
|
|
103
|
+
* If the tile path is a relative URL, the base URL is prepended to it.
|
|
104
|
+
* 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.
|
|
105
|
+
*/
|
|
98
106
|
getTileUrl(tilePath) {
|
|
99
|
-
|
|
107
|
+
if (this.isValidURL(tilePath)) {
|
|
108
|
+
const url = new URL(tilePath);
|
|
109
|
+
return url.search === "" ? `${tilePath}${this._searchParams}` : tilePath;
|
|
110
|
+
}
|
|
111
|
+
return tilePath.includes("?") ? `${this._baseUrl}${tilePath}` : `${this._baseUrl}${tilePath}${this._searchParams}`;
|
|
100
112
|
}
|
|
101
113
|
/**
|
|
102
114
|
* Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSourceTilesetUrlImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAw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AC;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,+BAAiB,CAAC,UAAU,EAAE,CAAC;YACrD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,eAAe,GAAG,sCAA2B,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;AApID,0EAoIC","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\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 // 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 private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\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. If the tile path is a full URL, it is returned as is. Otherwise, the base URL is prepended to the tile path. */\r\n private getTileUrl(tilePath: string){\r\n return this.isValidURL(tilePath) ? tilePath : this._baseUrl + tilePath;\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":"RealityDataSourceTilesetUrlImpl.js","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F;;GAEG;AACH,sDAAwE;AACxE,oDAAoJ;AAEpJ,+CAA4C;AAE5C,8CAA8D;AAE9D;;;;;;EAME;AACF,MAAa,+BAA+B;IAS1C;;OAEG;IACH,YAAsB,KAA6B;QARnD,sIAAsI;QAC9H,aAAQ,GAAW,EAAE,CAAC;QAC9B,wIAAwI;QAChI,kBAAa,GAAW,EAAE,CAAC;QAMjC,IAAA,qBAAM,EAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,WAAW,CAAC,CAAC;QACpI,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,SAA+B,EAAE,QAAgC;QACjG,IAAI,SAAS,CAAC,QAAQ,KAAK,iCAAmB,CAAC,UAAU;YACvD,OAAO,SAAS,CAAC;QACnB,MAAM,QAAQ,GAAG,IAAI,+BAA+B,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC;QACpE,OAAO,QAAQ,CAAC;IA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4BAA4B;QACvC,IAAI,eAAsD,CAAC;QAC3D,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,+BAAiB,CAAC,UAAU,EAAE,CAAC;YACrD,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3D,eAAe,GAAG,sCAA2B,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;AAhJD,0EAgJC","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 // 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"]}
|
|
@@ -17,6 +17,8 @@ export declare class RealityDataSourceTilesetUrlImpl implements RealityDataSourc
|
|
|
17
17
|
private _tilesetUrl;
|
|
18
18
|
/** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/
|
|
19
19
|
private _baseUrl;
|
|
20
|
+
/** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/
|
|
21
|
+
private _searchParams;
|
|
20
22
|
/** Construct a new reality data source.
|
|
21
23
|
* @param props JSON representation of the reality data source
|
|
22
24
|
*/
|
|
@@ -43,7 +45,10 @@ export declare class RealityDataSourceTilesetUrlImpl implements RealityDataSourc
|
|
|
43
45
|
getServiceUrl(_iTwinId: GuidString | undefined): Promise<string | undefined>;
|
|
44
46
|
getRootDocument(iTwinId: GuidString | undefined): Promise<any>;
|
|
45
47
|
private isValidURL;
|
|
46
|
-
/** Returns the tile URL.
|
|
48
|
+
/** Returns the tile URL.
|
|
49
|
+
* If the tile path is a relative URL, the base URL is prepended to it.
|
|
50
|
+
* 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.
|
|
51
|
+
*/
|
|
47
52
|
private getTileUrl;
|
|
48
53
|
/**
|
|
49
54
|
* Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSourceTilesetUrlImpl.d.ts","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAyB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAe,WAAW,EAA0C,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGpJ,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGzG;;;;;;EAME;AACF,qBAAa,+BAAgC,YAAW,iBAAiB;IACvE,SAAgB,GAAG,EAAE,oBAAoB,CAAC;IAC1C,2EAA2E;IAC3E,OAAO,CAAC,WAAW,CAAqB;IACxC,sIAAsI;IACtI,OAAO,CAAC,QAAQ,CAAc;
|
|
1
|
+
{"version":3,"file":"RealityDataSourceTilesetUrlImpl.d.ts","sourceRoot":"","sources":["../../src/RealityDataSourceTilesetUrlImpl.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAyB,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAe,WAAW,EAA0C,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGpJ,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAGzG;;;;;;EAME;AACF,qBAAa,+BAAgC,YAAW,iBAAiB;IACvE,SAAgB,GAAG,EAAE,oBAAoB,CAAC;IAC1C,2EAA2E;IAC3E,OAAO,CAAC,WAAW,CAAqB;IACxC,sIAAsI;IACtI,OAAO,CAAC,QAAQ,CAAc;IAC9B,wIAAwI;IACxI,OAAO,CAAC,aAAa,CAAc;IAEnC;;OAEG;IACH,SAAS,aAAa,KAAK,EAAE,sBAAsB;IAMnD;;OAEG;WACiB,aAAa,CAAC,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC;IAO5I,IAAW,cAAc,IAAI,OAAO,CAEnC;IACD;;MAEE;IACF,IAAW,WAAW,IAAI,WAAW,GAAG,SAAS,CAEhD;IACD,IAAW,aAAa,IAAI,MAAM,GAAG,SAAS,CAE7C;IACD;;OAEG;IACH,IAAW,eAAe,IAAI,MAAM,GAAG,SAAS,CAE/C;IAQD,OAAO,CAAC,UAAU;IAWlB;;;OAGG;IACU,aAAa,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAI5E,eAAe,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAU3E,OAAO,CAAC,UAAU;IASlB;;;OAGG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACU,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI/D;;OAEG;IACU,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7C,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"}
|
|
@@ -23,6 +23,8 @@ export class RealityDataSourceTilesetUrlImpl {
|
|
|
23
23
|
constructor(props) {
|
|
24
24
|
/** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/
|
|
25
25
|
this._baseUrl = "";
|
|
26
|
+
/** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/
|
|
27
|
+
this._searchParams = "";
|
|
26
28
|
assert(props.sourceKey.provider === RealityDataProvider.TilesetUrl || props.sourceKey.provider === RealityDataProvider.OrbitGtBlob);
|
|
27
29
|
this.key = props.sourceKey;
|
|
28
30
|
this._tilesetUrl = this.key.id;
|
|
@@ -59,8 +61,11 @@ export class RealityDataSourceTilesetUrlImpl {
|
|
|
59
61
|
// otherwise the full path to root document is given.
|
|
60
62
|
// The base URL contains the base URL from which tile relative path are constructed.
|
|
61
63
|
// The tile's path root will need to be reinserted for child tiles to return a 200
|
|
64
|
+
// If the original url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.
|
|
62
65
|
setBaseUrl(url) {
|
|
63
66
|
const urlParts = url.split("/");
|
|
67
|
+
const newUrl = new URL(url);
|
|
68
|
+
this._searchParams = newUrl.search;
|
|
64
69
|
urlParts.pop();
|
|
65
70
|
if (urlParts.length === 0)
|
|
66
71
|
this._baseUrl = "";
|
|
@@ -91,9 +96,16 @@ export class RealityDataSourceTilesetUrlImpl {
|
|
|
91
96
|
}
|
|
92
97
|
return true;
|
|
93
98
|
}
|
|
94
|
-
/** Returns the tile URL.
|
|
99
|
+
/** Returns the tile URL.
|
|
100
|
+
* If the tile path is a relative URL, the base URL is prepended to it.
|
|
101
|
+
* 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.
|
|
102
|
+
*/
|
|
95
103
|
getTileUrl(tilePath) {
|
|
96
|
-
|
|
104
|
+
if (this.isValidURL(tilePath)) {
|
|
105
|
+
const url = new URL(tilePath);
|
|
106
|
+
return url.search === "" ? `${tilePath}${this._searchParams}` : tilePath;
|
|
107
|
+
}
|
|
108
|
+
return tilePath.includes("?") ? `${this._baseUrl}${tilePath}` : `${this._baseUrl}${tilePath}${this._searchParams}`;
|
|
97
109
|
}
|
|
98
110
|
/**
|
|
99
111
|
* Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RealityDataSourceTilesetUrlImpl.js","sourceRoot":"","sources":["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c,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\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 // 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 private setBaseUrl(url: string): void {\r\n const urlParts = url.split(\"/\");\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. If the tile path is a full URL, it is returned as is. Otherwise, the base URL is prepended to the tile path. */\r\n private getTileUrl(tilePath: string){\r\n return this.isValidURL(tilePath) ? tilePath : this._baseUrl + tilePath;\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":"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;IAS1C;;OAEG;IACH,YAAsB,KAA6B;QARnD,sIAAsI;QAC9H,aAAQ,GAAW,EAAE,CAAC;QAC9B,wIAAwI;QAChI,kBAAa,GAAW,EAAE,CAAC;QAMjC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,mBAAmB,CAAC,UAAU,IAAI,KAAK,CAAC,SAAS,CAAC,QAAQ,KAAK,mBA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ACvD,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 // 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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-frontend",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.7",
|
|
4
4
|
"description": "iTwin.js frontend components",
|
|
5
5
|
"main": "lib/cjs/core-frontend.js",
|
|
6
6
|
"module": "lib/esm/core-frontend.js",
|
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
"url": "http://www.bentley.com"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@itwin/appui-abstract": "^5.0.0-dev.
|
|
27
|
-
"@itwin/core-bentley": "^5.0.0-dev.
|
|
28
|
-
"@itwin/core-common": "^5.0.0-dev.
|
|
29
|
-
"@itwin/core-geometry": "^5.0.0-dev.
|
|
30
|
-
"@itwin/core-orbitgt": "^5.0.0-dev.
|
|
31
|
-
"@itwin/core-quantity": "^5.0.0-dev.
|
|
26
|
+
"@itwin/appui-abstract": "^5.0.0-dev.7",
|
|
27
|
+
"@itwin/core-bentley": "^5.0.0-dev.7",
|
|
28
|
+
"@itwin/core-common": "^5.0.0-dev.7",
|
|
29
|
+
"@itwin/core-geometry": "^5.0.0-dev.7",
|
|
30
|
+
"@itwin/core-orbitgt": "^5.0.0-dev.7",
|
|
31
|
+
"@itwin/core-quantity": "^5.0.0-dev.7"
|
|
32
32
|
},
|
|
33
33
|
"//devDependencies": [
|
|
34
34
|
"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install",
|
|
@@ -53,13 +53,13 @@
|
|
|
53
53
|
"vite-multiple-assets": "^1.3.1",
|
|
54
54
|
"vite-plugin-static-copy": "1.0.6",
|
|
55
55
|
"webpack": "^5.76.0",
|
|
56
|
-
"@itwin/appui-abstract": "5.0.0-dev.
|
|
57
|
-
"@itwin/build-tools": "5.0.0-dev.
|
|
58
|
-
"@itwin/core-common": "5.0.0-dev.
|
|
59
|
-
"@itwin/core-bentley": "5.0.0-dev.
|
|
60
|
-
"@itwin/core-geometry": "5.0.0-dev.
|
|
61
|
-
"@itwin/core-orbitgt": "5.0.0-dev.
|
|
62
|
-
"@itwin/core-quantity": "5.0.0-dev.
|
|
56
|
+
"@itwin/appui-abstract": "5.0.0-dev.7",
|
|
57
|
+
"@itwin/build-tools": "5.0.0-dev.7",
|
|
58
|
+
"@itwin/core-common": "5.0.0-dev.7",
|
|
59
|
+
"@itwin/core-bentley": "5.0.0-dev.7",
|
|
60
|
+
"@itwin/core-geometry": "5.0.0-dev.7",
|
|
61
|
+
"@itwin/core-orbitgt": "5.0.0-dev.7",
|
|
62
|
+
"@itwin/core-quantity": "5.0.0-dev.7"
|
|
63
63
|
},
|
|
64
64
|
"//dependencies": [
|
|
65
65
|
"NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API",
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"fuse.js": "^3.3.0",
|
|
74
74
|
"meshoptimizer": "~0.20.0",
|
|
75
75
|
"wms-capabilities": "0.4.0",
|
|
76
|
-
"@itwin/core-i18n": "5.0.0-dev.
|
|
77
|
-
"@itwin/core-telemetry": "5.0.0-dev.
|
|
78
|
-
"@itwin/webgl-compatibility": "5.0.0-dev.
|
|
76
|
+
"@itwin/core-i18n": "5.0.0-dev.7",
|
|
77
|
+
"@itwin/core-telemetry": "5.0.0-dev.7",
|
|
78
|
+
"@itwin/webgl-compatibility": "5.0.0-dev.7"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"build": "npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"copy:js:cjs": "cpx \"./src/**/*.js\" ./lib/cjs",
|
|
87
87
|
"copy:js:esm": "cpx \"./src/**/*.js\" ./lib/esm",
|
|
88
88
|
"copy:workers": "cpx \"./lib/workers/webpack/parse-imdl-worker.js\" ./lib/public/scripts",
|
|
89
|
-
"docs": "betools docs --
|
|
89
|
+
"docs": "betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts",
|
|
90
90
|
"extract-api": "betools extract-api --entry=core-frontend && npm run extract-extension-api",
|
|
91
91
|
"extract-extension-api": "eslint --no-inline-config -c extraction.eslint.config.js \"./src/**/*.ts\" 1>&2",
|
|
92
92
|
"lint": "eslint \"./src/**/*.ts\" 1>&2",
|