@itwin/core-frontend 3.0.0-dev.102 → 3.0.0-dev.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/ApproximateTerrainHeights.js +3 -3
- package/lib/cjs/ApproximateTerrainHeights.js.map +1 -1
- package/lib/cjs/ContextRealityModelState.js +1 -1
- package/lib/cjs/ContextRealityModelState.js.map +1 -1
- package/lib/cjs/ElementLocateManager.d.ts +5 -0
- package/lib/cjs/ElementLocateManager.d.ts.map +1 -1
- package/lib/cjs/ElementLocateManager.js +12 -2
- package/lib/cjs/ElementLocateManager.js.map +1 -1
- package/lib/cjs/ModelState.js +1 -1
- package/lib/cjs/ModelState.js.map +1 -1
- package/lib/cjs/RealityDataSource.d.ts +53 -29
- package/lib/cjs/RealityDataSource.d.ts.map +1 -1
- package/lib/cjs/RealityDataSource.js +245 -91
- package/lib/cjs/RealityDataSource.js.map +1 -1
- package/lib/cjs/TwoWayViewportSync.d.ts +35 -6
- package/lib/cjs/TwoWayViewportSync.d.ts.map +1 -1
- package/lib/cjs/TwoWayViewportSync.js +51 -11
- package/lib/cjs/TwoWayViewportSync.js.map +1 -1
- package/lib/cjs/Viewport.d.ts +23 -5
- package/lib/cjs/Viewport.d.ts.map +1 -1
- package/lib/cjs/Viewport.js +13 -9
- package/lib/cjs/Viewport.js.map +1 -1
- package/lib/cjs/core-frontend.d.ts +0 -1
- package/lib/cjs/core-frontend.d.ts.map +1 -1
- package/lib/cjs/core-frontend.js +0 -1
- package/lib/cjs/core-frontend.js.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/cjs/render/webgl/PlanarClassifier.js +4 -2
- package/lib/cjs/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.d.ts.map +1 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.js +10 -1
- package/lib/cjs/render/webgl/glsl/PlanarClassification.js.map +1 -1
- package/lib/cjs/tile/CesiumAssetProvider.d.ts +13 -0
- package/lib/cjs/tile/CesiumAssetProvider.d.ts.map +1 -0
- package/lib/cjs/tile/CesiumAssetProvider.js +34 -0
- package/lib/cjs/tile/CesiumAssetProvider.js.map +1 -0
- package/lib/cjs/tile/ContextShareProvider.d.ts +22 -0
- package/lib/cjs/tile/ContextShareProvider.d.ts.map +1 -0
- package/lib/cjs/tile/ContextShareProvider.js +110 -0
- package/lib/cjs/tile/ContextShareProvider.js.map +1 -0
- package/lib/cjs/tile/OrbitGtTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/OrbitGtTileTree.js +8 -5
- package/lib/cjs/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.d.ts +1 -54
- package/lib/cjs/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/RealityModelTileTree.js +24 -217
- package/lib/cjs/tile/RealityModelTileTree.js.map +1 -1
- package/lib/cjs/tile/internal.d.ts +3 -0
- package/lib/cjs/tile/internal.d.ts.map +1 -1
- package/lib/cjs/tile/internal.js +3 -0
- package/lib/cjs/tile/internal.js.map +1 -1
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts +22 -0
- package/lib/cjs/tile/map/ArcGISTileMap.d.ts.map +1 -0
- package/lib/cjs/tile/map/ArcGISTileMap.js +173 -0
- package/lib/cjs/tile/map/ArcGISTileMap.js.map +1 -0
- package/lib/cjs/tile/map/CesiumTerrainProvider.js +5 -4
- package/lib/cjs/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -2
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +18 -40
- package/lib/cjs/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts +6 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +63 -21
- package/lib/cjs/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.d.ts +4 -4
- package/lib/cjs/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/cjs/tile/map/ImageryTileTree.js +20 -24
- package/lib/cjs/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js +1 -1
- package/lib/cjs/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryFormats.js +17 -6
- package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +9 -4
- package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapLayerImageryProvider.js +22 -4
- package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/cjs/tile/map/MapTile.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTile.js +4 -3
- package/lib/cjs/tile/map/MapTile.js.map +1 -1
- package/lib/cjs/tile/map/MapTileTree.js +1 -1
- package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.d.ts +7 -2
- package/lib/cjs/tile/map/MapTilingScheme.d.ts.map +1 -1
- package/lib/cjs/tile/map/MapTilingScheme.js +21 -8
- package/lib/cjs/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/cjs/tile/map/QuadId.d.ts +1 -0
- package/lib/cjs/tile/map/QuadId.d.ts.map +1 -1
- package/lib/cjs/tile/map/QuadId.js +2 -1
- package/lib/cjs/tile/map/QuadId.js.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts +7 -0
- package/lib/cjs/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/cjs/tile/map/WmtsCapabilities.js +16 -2
- package/lib/cjs/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/cjs/tools/ViewTool.d.ts.map +1 -1
- package/lib/cjs/tools/ViewTool.js +2 -10
- package/lib/cjs/tools/ViewTool.js.map +1 -1
- package/lib/esm/ApproximateTerrainHeights.js +3 -3
- package/lib/esm/ApproximateTerrainHeights.js.map +1 -1
- package/lib/esm/ContextRealityModelState.js +1 -1
- package/lib/esm/ContextRealityModelState.js.map +1 -1
- package/lib/esm/ElementLocateManager.d.ts +5 -0
- package/lib/esm/ElementLocateManager.d.ts.map +1 -1
- package/lib/esm/ElementLocateManager.js +12 -2
- package/lib/esm/ElementLocateManager.js.map +1 -1
- package/lib/esm/ModelState.js +1 -1
- package/lib/esm/ModelState.js.map +1 -1
- package/lib/esm/RealityDataSource.d.ts +53 -29
- package/lib/esm/RealityDataSource.d.ts.map +1 -1
- package/lib/esm/RealityDataSource.js +246 -90
- package/lib/esm/RealityDataSource.js.map +1 -1
- package/lib/esm/TwoWayViewportSync.d.ts +35 -6
- package/lib/esm/TwoWayViewportSync.d.ts.map +1 -1
- package/lib/esm/TwoWayViewportSync.js +49 -10
- package/lib/esm/TwoWayViewportSync.js.map +1 -1
- package/lib/esm/Viewport.d.ts +23 -5
- package/lib/esm/Viewport.d.ts.map +1 -1
- package/lib/esm/Viewport.js +13 -9
- package/lib/esm/Viewport.js.map +1 -1
- package/lib/esm/core-frontend.d.ts +0 -1
- package/lib/esm/core-frontend.d.ts.map +1 -1
- package/lib/esm/core-frontend.js +0 -1
- package/lib/esm/core-frontend.js.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.d.ts.map +1 -1
- package/lib/esm/render/webgl/PlanarClassifier.js +4 -2
- package/lib/esm/render/webgl/PlanarClassifier.js.map +1 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.d.ts.map +1 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.js +10 -1
- package/lib/esm/render/webgl/glsl/PlanarClassification.js.map +1 -1
- package/lib/esm/tile/CesiumAssetProvider.d.ts +13 -0
- package/lib/esm/tile/CesiumAssetProvider.d.ts.map +1 -0
- package/lib/esm/tile/CesiumAssetProvider.js +30 -0
- package/lib/esm/tile/CesiumAssetProvider.js.map +1 -0
- package/lib/esm/tile/ContextShareProvider.d.ts +22 -0
- package/lib/esm/tile/ContextShareProvider.d.ts.map +1 -0
- package/lib/esm/tile/ContextShareProvider.js +106 -0
- package/lib/esm/tile/ContextShareProvider.js.map +1 -0
- package/lib/esm/tile/OrbitGtTileTree.d.ts.map +1 -1
- package/lib/esm/tile/OrbitGtTileTree.js +8 -5
- package/lib/esm/tile/OrbitGtTileTree.js.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.d.ts +1 -54
- package/lib/esm/tile/RealityModelTileTree.d.ts.map +1 -1
- package/lib/esm/tile/RealityModelTileTree.js +26 -218
- package/lib/esm/tile/RealityModelTileTree.js.map +1 -1
- package/lib/esm/tile/internal.d.ts +3 -0
- package/lib/esm/tile/internal.d.ts.map +1 -1
- package/lib/esm/tile/internal.js +3 -0
- package/lib/esm/tile/internal.js.map +1 -1
- package/lib/esm/tile/map/ArcGISTileMap.d.ts +22 -0
- package/lib/esm/tile/map/ArcGISTileMap.d.ts.map +1 -0
- package/lib/esm/tile/map/ArcGISTileMap.js +169 -0
- package/lib/esm/tile/map/ArcGISTileMap.js.map +1 -0
- package/lib/esm/tile/map/CesiumTerrainProvider.js +5 -4
- package/lib/esm/tile/map/CesiumTerrainProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts +2 -2
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +19 -41
- package/lib/esm/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts +6 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +63 -21
- package/lib/esm/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.d.ts +4 -4
- package/lib/esm/tile/map/ImageryTileTree.d.ts.map +1 -1
- package/lib/esm/tile/map/ImageryTileTree.js +21 -25
- package/lib/esm/tile/map/ImageryTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js +1 -1
- package/lib/esm/tile/map/MapCartoRectangle.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryFormats.js +17 -6
- package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +9 -4
- package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
- package/lib/esm/tile/map/MapLayerImageryProvider.js +22 -4
- package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
- package/lib/esm/tile/map/MapTile.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTile.js +4 -3
- package/lib/esm/tile/map/MapTile.js.map +1 -1
- package/lib/esm/tile/map/MapTileTree.js +1 -1
- package/lib/esm/tile/map/MapTileTree.js.map +1 -1
- package/lib/esm/tile/map/MapTilingScheme.d.ts +7 -2
- package/lib/esm/tile/map/MapTilingScheme.d.ts.map +1 -1
- package/lib/esm/tile/map/MapTilingScheme.js +22 -9
- package/lib/esm/tile/map/MapTilingScheme.js.map +1 -1
- package/lib/esm/tile/map/QuadId.d.ts +1 -0
- package/lib/esm/tile/map/QuadId.d.ts.map +1 -1
- package/lib/esm/tile/map/QuadId.js +2 -1
- package/lib/esm/tile/map/QuadId.js.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.d.ts +7 -0
- package/lib/esm/tile/map/WmtsCapabilities.d.ts.map +1 -1
- package/lib/esm/tile/map/WmtsCapabilities.js +16 -2
- package/lib/esm/tile/map/WmtsCapabilities.js.map +1 -1
- package/lib/esm/tools/ViewTool.d.ts.map +1 -1
- package/lib/esm/tools/ViewTool.js +2 -10
- package/lib/esm/tools/ViewTool.js.map +1 -1
- package/package.json +24 -24
- package/lib/cjs/RealityDataConnection.d.ts +0 -31
- package/lib/cjs/RealityDataConnection.d.ts.map +0 -1
- package/lib/cjs/RealityDataConnection.js +0 -101
- package/lib/cjs/RealityDataConnection.js.map +0 -1
- package/lib/esm/RealityDataConnection.d.ts +0 -31
- package/lib/esm/RealityDataConnection.d.ts.map +0 -1
- package/lib/esm/RealityDataConnection.js +0 -98
- package/lib/esm/RealityDataConnection.js.map +0 -1
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* @module Utils
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
const itwin_client_1 = require("@bentley/itwin-client");
|
|
10
|
+
exports.RealityModelTileTree = exports.RealityModelTileUtils = exports.RealityTileRegion = exports.createRealityTileTreeReference = void 0;
|
|
12
11
|
const core_bentley_1 = require("@itwin/core-bentley");
|
|
13
12
|
const core_common_1 = require("@itwin/core-common");
|
|
14
13
|
const core_geometry_1 = require("@itwin/core-geometry");
|
|
@@ -16,7 +15,6 @@ const BackgroundMapGeometry_1 = require("../BackgroundMapGeometry");
|
|
|
16
15
|
const IModelApp_1 = require("../IModelApp");
|
|
17
16
|
const PlanarClipMaskState_1 = require("../PlanarClipMaskState");
|
|
18
17
|
const RealityDataAccessProps_1 = require("../RealityDataAccessProps");
|
|
19
|
-
const RealityDataConnection_1 = require("../RealityDataConnection");
|
|
20
18
|
const RealityDataSource_1 = require("../RealityDataSource");
|
|
21
19
|
const internal_1 = require("./internal");
|
|
22
20
|
function getUrl(content) {
|
|
@@ -194,12 +192,12 @@ var SMTextureType;
|
|
|
194
192
|
})(SMTextureType || (SMTextureType = {}));
|
|
195
193
|
/** @internal */
|
|
196
194
|
class RealityModelTileTreeProps {
|
|
197
|
-
constructor(json, root,
|
|
195
|
+
constructor(json, root, rdSource, tilesetToDbTransform, tilesetToEcef) {
|
|
198
196
|
this.tilesetToEcef = tilesetToEcef;
|
|
199
197
|
this.doDrapeBackgroundMap = false;
|
|
200
198
|
this.yAxisUp = false;
|
|
201
199
|
this.tilesetJson = root;
|
|
202
|
-
this.
|
|
200
|
+
this.rdSource = rdSource;
|
|
203
201
|
this.location = tilesetToDbTransform;
|
|
204
202
|
this.doDrapeBackgroundMap = (json.root && json.root.SMMasterHeader && SMTextureType.Streaming === json.root.SMMasterHeader.IsTextured);
|
|
205
203
|
if (json.asset.gltfUpAxis === undefined || json.asset.gltfUpAxis === "y" || json.asset.gltfUpAxis === "Y")
|
|
@@ -207,12 +205,12 @@ class RealityModelTileTreeProps {
|
|
|
207
205
|
}
|
|
208
206
|
}
|
|
209
207
|
class RealityModelTileTreeParams {
|
|
210
|
-
constructor(
|
|
208
|
+
constructor(tileTreeId, iModel, modelId, loader, gcsConverterAvailable, rootToEcef) {
|
|
211
209
|
this.gcsConverterAvailable = gcsConverterAvailable;
|
|
212
210
|
this.rootToEcef = rootToEcef;
|
|
213
211
|
this.is3d = true;
|
|
214
212
|
this.loader = loader;
|
|
215
|
-
this.id =
|
|
213
|
+
this.id = tileTreeId;
|
|
216
214
|
this.modelId = modelId;
|
|
217
215
|
this.iModel = iModel;
|
|
218
216
|
this.rootTile = new RealityModelTileProps(loader.tree.tilesetJson, undefined, "", undefined, undefined === loader.tree.tilesetJson.refine ? undefined : loader.tree.tilesetJson.refine === "ADD");
|
|
@@ -292,10 +290,10 @@ function addUrlPrefix(subTree, prefix) {
|
|
|
292
290
|
addUrlPrefix(child, prefix);
|
|
293
291
|
}
|
|
294
292
|
/** @internal */
|
|
295
|
-
async function expandSubTree(root,
|
|
293
|
+
async function expandSubTree(root, rdsource) {
|
|
296
294
|
const childUrl = getUrl(root.content);
|
|
297
295
|
if (undefined !== childUrl && childUrl.endsWith("json")) { // A child may contain a subTree...
|
|
298
|
-
const subTree = await
|
|
296
|
+
const subTree = await rdsource.getTileJson(childUrl);
|
|
299
297
|
const prefixIndex = childUrl.lastIndexOf("/");
|
|
300
298
|
if (prefixIndex > 0)
|
|
301
299
|
addUrlPrefix(subTree.root, childUrl.substring(0, prefixIndex + 1));
|
|
@@ -358,7 +356,7 @@ class RealityModelTileLoader extends internal_1.RealityTileLoader {
|
|
|
358
356
|
const foundChild = await this.findTileInJson(this.tree.tilesetJson, tile.contentId, "");
|
|
359
357
|
if (undefined === foundChild || undefined === foundChild.json.content || isCanceled())
|
|
360
358
|
return undefined;
|
|
361
|
-
return this.tree.
|
|
359
|
+
return this.tree.rdSource.getTileContent(getUrl(foundChild.json.content));
|
|
362
360
|
}
|
|
363
361
|
async findTileInJson(tilesetJson, id, parentId, transformToRoot) {
|
|
364
362
|
if (id.length === 0)
|
|
@@ -379,7 +377,7 @@ class RealityModelTileLoader extends internal_1.RealityTileLoader {
|
|
|
379
377
|
if (separatorIndex >= 0) {
|
|
380
378
|
return this.findTileInJson(foundChild, id.substring(separatorIndex + 1), thisParentId, transformToRoot);
|
|
381
379
|
}
|
|
382
|
-
tilesetJson.children[childIndex] = await expandSubTree(foundChild, this.tree.
|
|
380
|
+
tilesetJson.children[childIndex] = await expandSubTree(foundChild, this.tree.rdSource);
|
|
383
381
|
return new FindChildResult(thisParentId, tilesetJson.children[childIndex], transformToRoot);
|
|
384
382
|
}
|
|
385
383
|
}
|
|
@@ -481,28 +479,25 @@ exports.RealityModelTileTree = RealityModelTileTree;
|
|
|
481
479
|
}
|
|
482
480
|
RealityModelTileTree.Reference = Reference;
|
|
483
481
|
async function createRealityModelTileTree(rdSourceKey, iModel, modelId, tilesetToDb) {
|
|
484
|
-
const
|
|
482
|
+
const rdSource = await RealityDataSource_1.RealityDataSource.fromKey(rdSourceKey, iModel.iTwinId);
|
|
485
483
|
// If we can get a valid connection from sourceKey, returns the tile tree
|
|
486
|
-
if (
|
|
487
|
-
|
|
488
|
-
|
|
484
|
+
if (rdSource) {
|
|
485
|
+
// Serialize the reality data source key into a string to uniquely identify this tile tree
|
|
486
|
+
const tileTreeId = RealityDataSource_1.RealityDataSource.keyToString(rdSource.key);
|
|
487
|
+
if (tileTreeId === undefined)
|
|
489
488
|
return undefined;
|
|
490
|
-
const props = await getTileTreeProps(
|
|
489
|
+
const props = await getTileTreeProps(rdSource, tilesetToDb, iModel);
|
|
491
490
|
const loader = new RealityModelTileLoader(props, new internal_1.BatchedTileIdMap(iModel));
|
|
492
491
|
const gcsConverterAvailable = await (0, internal_1.getGcsConverterAvailable)(iModel);
|
|
493
|
-
const params = new RealityModelTileTreeParams(
|
|
492
|
+
const params = new RealityModelTileTreeParams(tileTreeId, iModel, modelId, loader, gcsConverterAvailable, props.tilesetToEcef);
|
|
494
493
|
return new RealityModelTileTree(params);
|
|
495
494
|
}
|
|
496
495
|
return undefined;
|
|
497
496
|
}
|
|
498
497
|
RealityModelTileTree.createRealityModelTileTree = createRealityModelTileTree;
|
|
499
|
-
async function getTileTreeProps(
|
|
498
|
+
async function getTileTreeProps(rdSource, tilesetToDbJson, iModel) {
|
|
500
499
|
var _a, _b;
|
|
501
|
-
const
|
|
502
|
-
if (!url)
|
|
503
|
-
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Unable to read reality data");
|
|
504
|
-
const tileClient = new RealityModelTileClient(rdConnection, iModel.iTwinId);
|
|
505
|
-
const json = await tileClient.getRootDocument(url);
|
|
500
|
+
const json = await rdSource.getRootDocument(iModel.iTwinId);
|
|
506
501
|
let rootTransform = iModel.ecefLocation ? iModel.getMapEcefToDb(0) : core_geometry_1.Transform.createIdentity();
|
|
507
502
|
const geoConverter = iModel.noGcsDefined ? undefined : iModel.geoServices.getConverter("WGS84");
|
|
508
503
|
if (geoConverter !== undefined) {
|
|
@@ -544,8 +539,8 @@ exports.RealityModelTileTree = RealityModelTileTree;
|
|
|
544
539
|
}
|
|
545
540
|
if (undefined !== tilesetToDbJson)
|
|
546
541
|
rootTransform = core_geometry_1.Transform.fromJSON(tilesetToDbJson).multiplyTransformTransform(rootTransform);
|
|
547
|
-
const root = await expandSubTree(json.root,
|
|
548
|
-
return new RealityModelTileTreeProps(json, root,
|
|
542
|
+
const root = await expandSubTree(json.root, rdSource);
|
|
543
|
+
return new RealityModelTileTreeProps(json, root, rdSource, rootTransform, tilesetToEcef);
|
|
549
544
|
}
|
|
550
545
|
})(RealityModelTileTree = exports.RealityModelTileTree || (exports.RealityModelTileTree = {}));
|
|
551
546
|
/** Supplies a reality data [[TileTree]] from a URL. May be associated with a persistent [[GeometricModelState]], or attached at run-time via a [[ContextRealityModelState]].
|
|
@@ -555,8 +550,8 @@ class RealityTreeReference extends RealityModelTileTree.Reference {
|
|
|
555
550
|
constructor(props) {
|
|
556
551
|
super(props);
|
|
557
552
|
// Maybe we should throw if both props.rdSourceKey && props.url are undefined
|
|
558
|
-
this._rdSourceKey = props.rdSourceKey ? props.rdSourceKey : props.url ? RealityDataSource_1.RealityDataSource.
|
|
559
|
-
RealityDataSource_1.RealityDataSource.
|
|
553
|
+
this._rdSourceKey = props.rdSourceKey ? props.rdSourceKey : props.url ? RealityDataSource_1.RealityDataSource.createKeyFromUrl(props.url, core_common_1.RealityDataProvider.ContextShare) :
|
|
554
|
+
RealityDataSource_1.RealityDataSource.createKeyFromUrl("", core_common_1.RealityDataProvider.ContextShare);
|
|
560
555
|
}
|
|
561
556
|
get treeOwner() {
|
|
562
557
|
const treeId = { rdSourceKey: this._rdSourceKey, transform: this._transform, modelId: this.modelId, maskModelIds: this.maskModelIds };
|
|
@@ -602,7 +597,7 @@ class RealityTreeReference extends RealityModelTileTree.Reference {
|
|
|
602
597
|
return undefined;
|
|
603
598
|
const strings = [];
|
|
604
599
|
const loader = tree.loader;
|
|
605
|
-
const type =
|
|
600
|
+
const type = loader.tree.rdSource.realityDataType;
|
|
606
601
|
// If a type is specified, display it
|
|
607
602
|
if (type !== undefined) {
|
|
608
603
|
// Case insensitive
|
|
@@ -622,7 +617,7 @@ class RealityTreeReference extends RealityModelTileTree.Reference {
|
|
|
622
617
|
strings.push(`${IModelApp_1.IModelApp.localization.getLocalizedString("iModelJs:TooltipInfo.Name")} ${this._name}`);
|
|
623
618
|
}
|
|
624
619
|
else {
|
|
625
|
-
const cesiumAsset = this._rdSourceKey.provider === core_common_1.RealityDataProvider.CesiumIonAsset ? parseCesiumUrl(this._rdSourceKey.id) : undefined;
|
|
620
|
+
const cesiumAsset = this._rdSourceKey.provider === core_common_1.RealityDataProvider.CesiumIonAsset ? internal_1.CesiumIonAssetProvider.parseCesiumUrl(this._rdSourceKey.id) : undefined;
|
|
626
621
|
strings.push(cesiumAsset ? `Cesium Asset: ${cesiumAsset.id}` : this._rdSourceKey.id);
|
|
627
622
|
}
|
|
628
623
|
if (batch !== undefined)
|
|
@@ -639,192 +634,4 @@ class RealityTreeReference extends RealityModelTileTree.Reference {
|
|
|
639
634
|
}
|
|
640
635
|
}
|
|
641
636
|
}
|
|
642
|
-
// TBD - Allow an object to override the URL and provide its own authentication.
|
|
643
|
-
function parseCesiumUrl(url) {
|
|
644
|
-
const cesiumSuffix = "$CesiumIonAsset=";
|
|
645
|
-
const cesiumIndex = url.indexOf(cesiumSuffix);
|
|
646
|
-
if (cesiumIndex < 0)
|
|
647
|
-
return undefined;
|
|
648
|
-
const cesiumIonString = url.slice(cesiumIndex + cesiumSuffix.length);
|
|
649
|
-
const cesiumParts = cesiumIonString.split(":");
|
|
650
|
-
if (cesiumParts.length !== 2)
|
|
651
|
-
return undefined;
|
|
652
|
-
const id = parseInt(cesiumParts[0], 10);
|
|
653
|
-
if (id === undefined)
|
|
654
|
-
return undefined;
|
|
655
|
-
return { id, key: cesiumParts[1] };
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* ###TODO temporarily here for testing, needs to be moved to the clients repo
|
|
659
|
-
* @internal
|
|
660
|
-
* This class encapsulates access to a reality data wether it be from local access, http or RDS
|
|
661
|
-
* The url provided at the creation is parsed to determine if this is a RDS (ProjectWise Context Share) reference.
|
|
662
|
-
* If not then it is considered local (ex: C:\temp\TileRoot.json) or plain http access (http://someserver.com/data/TileRoot.json)
|
|
663
|
-
* There is a one to one relationship between a reality data and the instances of present class.
|
|
664
|
-
*/
|
|
665
|
-
class RealityModelTileClient {
|
|
666
|
-
// ###TODO we should be able to pass the iTwinId / tileId directly, instead of parsing the url
|
|
667
|
-
// But if the present can also be used by non PW Context Share stored data then the url is required and token is not. Possibly two classes inheriting from common interface.
|
|
668
|
-
constructor(rdConnection, iTwinId) {
|
|
669
|
-
this._baseUrl = ""; // For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container
|
|
670
|
-
this._rdConnection = rdConnection;
|
|
671
|
-
const rdSource = this._rdConnection.source;
|
|
672
|
-
if (rdSource.isContextShare)
|
|
673
|
-
this.rdsProps = this.getRDSClientPropsFromSource(rdSource); // Note that returned is undefined if url does not refer to a PW Context Share reality data.
|
|
674
|
-
if (iTwinId && this.rdsProps)
|
|
675
|
-
this.rdsProps.iTwinId = iTwinId;
|
|
676
|
-
}
|
|
677
|
-
initializeRDSRealityData() {
|
|
678
|
-
var _a;
|
|
679
|
-
if (undefined !== this.rdsProps) {
|
|
680
|
-
if (!this._realityData) {
|
|
681
|
-
this._realityData = this._rdConnection.realityData;
|
|
682
|
-
if (!this._realityData)
|
|
683
|
-
throw new core_common_1.IModelError(core_bentley_1.BentleyStatus.ERROR, "Unable to read reality data");
|
|
684
|
-
// A reality data that has not root document set should not be considered.
|
|
685
|
-
const rootDocument = (_a = this._realityData.rootDocument) !== null && _a !== void 0 ? _a : "";
|
|
686
|
-
this.setBaseUrl(rootDocument);
|
|
687
|
-
}
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
// ###TODO temporary means of extracting the tileId and projectId from the given url
|
|
691
|
-
// This is the method that determines if the url refers to Reality Data stored on PW Context Share. If not then undefined is returned.
|
|
692
|
-
// ###TODO This method should be replaced by realityDataServiceClient.getRealityDataIdFromUrl()
|
|
693
|
-
// We obtain the projectId from URL but it should be used normally. The iModel context should be used everywhere: verify!
|
|
694
|
-
getRDSClientPropsFromSource(rdSource, iTwinIdFromApp) {
|
|
695
|
-
// We have URLs with incorrect slashes that must be supported. The ~2F are WSG encoded slashes and may prevent parsing out the reality data id.
|
|
696
|
-
const tilesId = rdSource.realityDataId;
|
|
697
|
-
const iTwinIdFromSrc = rdSource.iTwinId;
|
|
698
|
-
let props;
|
|
699
|
-
if (undefined !== tilesId) {
|
|
700
|
-
const iTwinId = iTwinIdFromSrc ? iTwinIdFromSrc : iTwinIdFromApp ? iTwinIdFromApp : "server";
|
|
701
|
-
props = { iTwinId, tilesId };
|
|
702
|
-
}
|
|
703
|
-
return props;
|
|
704
|
-
}
|
|
705
|
-
// This is to set the root url from the provided root document path.
|
|
706
|
-
// If the root document is stored on PW Context Share then the root document property of the Reality Data is provided,
|
|
707
|
-
// otherwise the full path to root document is given.
|
|
708
|
-
// The base URL contains the base URL from which tile relative path are constructed.
|
|
709
|
-
// The tile's path root will need to be reinserted for child tiles to return a 200
|
|
710
|
-
setBaseUrl(url) {
|
|
711
|
-
const urlParts = url.split("/");
|
|
712
|
-
urlParts.pop();
|
|
713
|
-
if (urlParts.length === 0)
|
|
714
|
-
this._baseUrl = "";
|
|
715
|
-
else
|
|
716
|
-
this._baseUrl = `${urlParts.join("/")}/`;
|
|
717
|
-
}
|
|
718
|
-
async _doRequest(url, responseType) {
|
|
719
|
-
let options = {
|
|
720
|
-
method: "GET",
|
|
721
|
-
responseType,
|
|
722
|
-
};
|
|
723
|
-
const authToken = this._requestAuthorization;
|
|
724
|
-
if (authToken) {
|
|
725
|
-
options = {
|
|
726
|
-
...options,
|
|
727
|
-
headers: {
|
|
728
|
-
authorization: authToken,
|
|
729
|
-
},
|
|
730
|
-
};
|
|
731
|
-
}
|
|
732
|
-
const data = await (0, itwin_client_1.request)(url, options);
|
|
733
|
-
return data.body;
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Gets a tileset's app data json
|
|
737
|
-
* @param name name or path of tile
|
|
738
|
-
* @returns app data json object
|
|
739
|
-
* @internal
|
|
740
|
-
*/
|
|
741
|
-
async getRealityDataTileJson(accessToken, name, realityData) {
|
|
742
|
-
const url = await realityData.getBlobUrl(accessToken, name);
|
|
743
|
-
const data = await (0, itwin_client_1.getJson)(url.toString());
|
|
744
|
-
return data;
|
|
745
|
-
}
|
|
746
|
-
// ### TODO. Technically the url should not be required. If the reality data encapsulated is stored on PW Context Share then
|
|
747
|
-
// the relative path to root document is extracted from the reality data. Otherwise the full url to root document should have been provided at
|
|
748
|
-
// the construction of the instance.
|
|
749
|
-
async getRootDocument(url) {
|
|
750
|
-
const token = await IModelApp_1.IModelApp.getAccessToken();
|
|
751
|
-
if (this.rdsProps && token) {
|
|
752
|
-
this.initializeRDSRealityData(); // Only needed for PW Context Share data ... return immediately otherwise.
|
|
753
|
-
const realityData = this._realityData;
|
|
754
|
-
if (!realityData)
|
|
755
|
-
throw new Error(`Reality Data not defined`);
|
|
756
|
-
if (!realityData.rootDocument)
|
|
757
|
-
throw new Error(`Root document not defined for reality data: ${realityData.id}`);
|
|
758
|
-
return this.getRealityDataTileJson(token, realityData.rootDocument, realityData);
|
|
759
|
-
}
|
|
760
|
-
// The following is only if the reality data is not stored on PW Context Share.
|
|
761
|
-
const cesiumAsset = parseCesiumUrl(url);
|
|
762
|
-
if (cesiumAsset) {
|
|
763
|
-
const tokenAndUrl = await (0, internal_1.getCesiumAccessTokenAndEndpointUrl)(cesiumAsset.id, cesiumAsset.key);
|
|
764
|
-
if (tokenAndUrl.url && tokenAndUrl.token) {
|
|
765
|
-
url = tokenAndUrl.url;
|
|
766
|
-
this._requestAuthorization = `Bearer ${tokenAndUrl.token}`;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
// The following is only if the reality data is not stored on PW Context Share.
|
|
770
|
-
this.setBaseUrl(url);
|
|
771
|
-
return this._doRequest(url, "json");
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Gets tile content
|
|
775
|
-
* @param name name or path of tile
|
|
776
|
-
* @returns array buffer of tile content
|
|
777
|
-
*/
|
|
778
|
-
async getRealityDataTileContent(accessToken, name, realityData) {
|
|
779
|
-
const url = await realityData.getBlobUrl(accessToken, name);
|
|
780
|
-
const options = {
|
|
781
|
-
method: "GET",
|
|
782
|
-
responseType: "arraybuffer",
|
|
783
|
-
};
|
|
784
|
-
const data = await (0, itwin_client_1.request)(url.toString(), options);
|
|
785
|
-
return data.body;
|
|
786
|
-
}
|
|
787
|
-
/**
|
|
788
|
-
* Returns the tile content. The path to the tile is relative to the base url of present reality data whatever the type.
|
|
789
|
-
*/
|
|
790
|
-
async getTileContent(url) {
|
|
791
|
-
(0, core_bentley_1.assert)(url !== undefined);
|
|
792
|
-
const token = await IModelApp_1.IModelApp.getAccessToken();
|
|
793
|
-
const useRds = this.rdsProps !== undefined && token !== undefined;
|
|
794
|
-
if (useRds) {
|
|
795
|
-
this.initializeRDSRealityData(); // Only needed for PW Context Share data ... return immediately otherwise.
|
|
796
|
-
}
|
|
797
|
-
const tileUrl = this._baseUrl + url;
|
|
798
|
-
if (useRds && this._realityData)
|
|
799
|
-
return this.getRealityDataTileContent(token, tileUrl, this._realityData);
|
|
800
|
-
return this._doRequest(tileUrl, "arraybuffer");
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* 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.
|
|
804
|
-
*/
|
|
805
|
-
async getTileJson(url) {
|
|
806
|
-
(0, core_bentley_1.assert)(url !== undefined);
|
|
807
|
-
const token = await IModelApp_1.IModelApp.getAccessToken();
|
|
808
|
-
if (this.rdsProps && token) {
|
|
809
|
-
this.initializeRDSRealityData(); // Only needed for PW Context Share data ... return immediately otherwise.
|
|
810
|
-
}
|
|
811
|
-
const tileUrl = this._baseUrl + url;
|
|
812
|
-
if (undefined !== this.rdsProps && undefined !== token && this._realityData)
|
|
813
|
-
return this.getRealityDataTileJson(token, tileUrl, this._realityData);
|
|
814
|
-
return this._doRequest(tileUrl, "json");
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Returns Reality Data type if available
|
|
818
|
-
*/
|
|
819
|
-
async getRealityDataType() {
|
|
820
|
-
const token = await IModelApp_1.IModelApp.getAccessToken();
|
|
821
|
-
if (this.rdsProps && token) {
|
|
822
|
-
this.initializeRDSRealityData(); // Only needed for PW Context Share data
|
|
823
|
-
return this._realityData.type;
|
|
824
|
-
}
|
|
825
|
-
// The reality data type is not available if not stored on PW Context Share.
|
|
826
|
-
return undefined;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
exports.RealityModelTileClient = RealityModelTileClient;
|
|
830
637
|
//# sourceMappingURL=RealityModelTileTree.js.map
|