@itwin/core-backend 3.5.0-dev.19 → 3.5.0-dev.20
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/AliCloudStorageService.d.ts +23 -23
- package/lib/cjs/AliCloudStorageService.js +71 -71
- package/lib/cjs/AliCloudStorageService.js.map +1 -1
- package/lib/cjs/BackendHubAccess.d.ts +224 -224
- package/lib/cjs/BackendHubAccess.js +41 -41
- package/lib/cjs/BackendHubAccess.js.map +1 -1
- package/lib/cjs/BackendLoggerCategory.d.ts +91 -91
- package/lib/cjs/BackendLoggerCategory.js +99 -99
- package/lib/cjs/BackendLoggerCategory.js.map +1 -1
- package/lib/cjs/BisCoreSchema.d.ts +21 -21
- package/lib/cjs/BisCoreSchema.js +60 -60
- package/lib/cjs/BisCoreSchema.js.map +1 -1
- package/lib/cjs/BriefcaseManager.d.ts +165 -165
- package/lib/cjs/BriefcaseManager.js +405 -405
- package/lib/cjs/BriefcaseManager.js.map +1 -1
- package/lib/cjs/Category.d.ts +153 -153
- package/lib/cjs/Category.js +243 -243
- package/lib/cjs/Category.js.map +1 -1
- package/lib/cjs/ChangeSummaryManager.d.ts +187 -187
- package/lib/cjs/ChangeSummaryManager.js +445 -445
- package/lib/cjs/ChangeSummaryManager.js.map +1 -1
- package/lib/cjs/ChangedElementsDb.d.ts +99 -99
- package/lib/cjs/ChangedElementsDb.js +165 -165
- package/lib/cjs/ChangedElementsDb.js.map +1 -1
- package/lib/cjs/ChangedElementsManager.d.ts +39 -39
- package/lib/cjs/ChangedElementsManager.js +88 -88
- package/lib/cjs/ChangedElementsManager.js.map +1 -1
- package/lib/cjs/CheckpointManager.d.ts +120 -120
- package/lib/cjs/CheckpointManager.js +343 -343
- package/lib/cjs/CheckpointManager.js.map +1 -1
- package/lib/cjs/ClassRegistry.d.ts +72 -71
- package/lib/cjs/ClassRegistry.d.ts.map +1 -1
- package/lib/cjs/ClassRegistry.js +243 -215
- package/lib/cjs/ClassRegistry.js.map +1 -1
- package/lib/cjs/CloudSqlite.d.ts +350 -350
- package/lib/cjs/CloudSqlite.js +152 -152
- package/lib/cjs/CloudSqlite.js.map +1 -1
- package/lib/cjs/CloudStorageBackend.d.ts +58 -58
- package/lib/cjs/CloudStorageBackend.js +173 -173
- package/lib/cjs/CloudStorageBackend.js.map +1 -1
- package/lib/cjs/CodeService.d.ts +396 -396
- package/lib/cjs/CodeService.js +63 -63
- package/lib/cjs/CodeService.js.map +1 -1
- package/lib/cjs/CodeSpecs.d.ts +50 -50
- package/lib/cjs/CodeSpecs.js +112 -112
- package/lib/cjs/CodeSpecs.js.map +1 -1
- package/lib/cjs/ConcurrentQuery.d.ts +11 -11
- package/lib/cjs/ConcurrentQuery.js +30 -30
- package/lib/cjs/ConcurrentQuery.js.map +1 -1
- package/lib/cjs/CustomViewState3dCreator.d.ts +32 -32
- package/lib/cjs/CustomViewState3dCreator.js +113 -113
- package/lib/cjs/CustomViewState3dCreator.js.map +1 -1
- package/lib/cjs/DevTools.d.ts +71 -71
- package/lib/cjs/DevTools.js +154 -154
- package/lib/cjs/DevTools.js.map +1 -1
- package/lib/cjs/DisplayStyle.d.ts +106 -106
- package/lib/cjs/DisplayStyle.d.ts.map +1 -1
- package/lib/cjs/DisplayStyle.js +256 -256
- package/lib/cjs/DisplayStyle.js.map +1 -1
- package/lib/cjs/ECDb.d.ts +191 -191
- package/lib/cjs/ECDb.js +350 -350
- package/lib/cjs/ECDb.js.map +1 -1
- package/lib/cjs/ECSchemaXmlContext.d.ts +18 -18
- package/lib/cjs/ECSchemaXmlContext.js +41 -41
- package/lib/cjs/ECSchemaXmlContext.js.map +1 -1
- package/lib/cjs/ECSqlStatement.d.ts +466 -466
- package/lib/cjs/ECSqlStatement.js +791 -791
- package/lib/cjs/ECSqlStatement.js.map +1 -1
- package/lib/cjs/Element.d.ts +1102 -1109
- package/lib/cjs/Element.d.ts.map +1 -1
- package/lib/cjs/Element.js +1416 -1420
- package/lib/cjs/Element.js.map +1 -1
- package/lib/cjs/ElementAspect.d.ts +158 -156
- package/lib/cjs/ElementAspect.d.ts.map +1 -1
- package/lib/cjs/ElementAspect.js +186 -178
- package/lib/cjs/ElementAspect.js.map +1 -1
- package/lib/cjs/ElementGraphics.d.ts +9 -9
- package/lib/cjs/ElementGraphics.js +41 -41
- package/lib/cjs/ElementGraphics.js.map +1 -1
- package/lib/cjs/ElementTreeWalker.d.ts +162 -162
- package/lib/cjs/ElementTreeWalker.js +409 -409
- package/lib/cjs/ElementTreeWalker.js.map +1 -1
- package/lib/cjs/Entity.d.ts +106 -76
- package/lib/cjs/Entity.d.ts.map +1 -1
- package/lib/cjs/Entity.js +134 -82
- package/lib/cjs/Entity.js.map +1 -1
- package/lib/cjs/EntityReferences.d.ts +50 -0
- package/lib/cjs/EntityReferences.d.ts.map +1 -0
- package/lib/cjs/EntityReferences.js +96 -0
- package/lib/cjs/EntityReferences.js.map +1 -0
- package/lib/cjs/ExportGraphics.d.ts +317 -317
- package/lib/cjs/ExportGraphics.js +208 -208
- package/lib/cjs/ExportGraphics.js.map +1 -1
- package/lib/cjs/ExternalSource.d.ts +96 -94
- package/lib/cjs/ExternalSource.d.ts.map +1 -1
- package/lib/cjs/ExternalSource.js +131 -125
- package/lib/cjs/ExternalSource.js.map +1 -1
- package/lib/cjs/GeoCoordConfig.d.ts +19 -19
- package/lib/cjs/GeoCoordConfig.js +82 -82
- package/lib/cjs/GeoCoordConfig.js.map +1 -1
- package/lib/cjs/GeometrySummary.d.ts +4 -4
- package/lib/cjs/GeometrySummary.js +380 -380
- package/lib/cjs/GeometrySummary.js.map +1 -1
- package/lib/cjs/HubMock.d.ts +93 -93
- package/lib/cjs/HubMock.js +190 -190
- package/lib/cjs/HubMock.js.map +1 -1
- package/lib/cjs/IModelCloneContext.d.ts +8 -85
- package/lib/cjs/IModelCloneContext.d.ts.map +1 -1
- package/lib/cjs/IModelCloneContext.js +15 -150
- package/lib/cjs/IModelCloneContext.js.map +1 -1
- package/lib/cjs/IModelDb.d.ts +1167 -1164
- package/lib/cjs/IModelDb.d.ts.map +1 -1
- package/lib/cjs/IModelDb.js +2332 -2329
- package/lib/cjs/IModelDb.js.map +1 -1
- package/lib/cjs/IModelElementCloneContext.d.ts +90 -0
- package/lib/cjs/IModelElementCloneContext.d.ts.map +1 -0
- package/lib/cjs/IModelElementCloneContext.js +160 -0
- package/lib/cjs/IModelElementCloneContext.js.map +1 -0
- package/lib/cjs/IModelHost.d.ts +369 -361
- package/lib/cjs/IModelHost.d.ts.map +1 -1
- package/lib/cjs/IModelHost.js +492 -489
- package/lib/cjs/IModelHost.js.map +1 -1
- package/lib/cjs/IModelJsFs.d.ts +62 -62
- package/lib/cjs/IModelJsFs.js +140 -140
- package/lib/cjs/IModelJsFs.js.map +1 -1
- package/lib/cjs/IpcHost.d.ts +98 -98
- package/lib/cjs/IpcHost.js +234 -234
- package/lib/cjs/IpcHost.js.map +1 -1
- package/lib/cjs/LineStyle.d.ts +311 -311
- package/lib/cjs/LineStyle.js +295 -295
- package/lib/cjs/LineStyle.js.map +1 -1
- package/lib/cjs/LocalHub.d.ts +162 -162
- package/lib/cjs/LocalHub.js +587 -587
- package/lib/cjs/LocalHub.js.map +1 -1
- package/lib/cjs/LocalhostIpcHost.d.ts +20 -20
- package/lib/cjs/LocalhostIpcHost.js +81 -81
- package/lib/cjs/LocalhostIpcHost.js.map +1 -1
- package/lib/cjs/Material.d.ts +103 -103
- package/lib/cjs/Material.js +147 -147
- package/lib/cjs/Material.js.map +1 -1
- package/lib/cjs/Model.d.ts +388 -386
- package/lib/cjs/Model.d.ts.map +1 -1
- package/lib/cjs/Model.js +479 -471
- package/lib/cjs/Model.js.map +1 -1
- package/lib/cjs/NativeAppStorage.d.ts +51 -51
- package/lib/cjs/NativeAppStorage.js +202 -202
- package/lib/cjs/NativeAppStorage.js.map +1 -1
- package/lib/cjs/NativeHost.d.ts +52 -52
- package/lib/cjs/NativeHost.js +168 -168
- package/lib/cjs/NativeHost.js.map +1 -1
- package/lib/cjs/NavigationRelationship.d.ts +156 -156
- package/lib/cjs/NavigationRelationship.js +225 -225
- package/lib/cjs/NavigationRelationship.js.map +1 -1
- package/lib/cjs/PromiseMemoizer.d.ts +51 -51
- package/lib/cjs/PromiseMemoizer.js +101 -101
- package/lib/cjs/PromiseMemoizer.js.map +1 -1
- package/lib/cjs/PropertyStore.d.ts +132 -132
- package/lib/cjs/PropertyStore.js +11 -11
- package/lib/cjs/PropertyStore.js.map +1 -1
- package/lib/cjs/Relationship.d.ts +416 -400
- package/lib/cjs/Relationship.d.ts.map +1 -1
- package/lib/cjs/Relationship.js +494 -465
- package/lib/cjs/Relationship.js.map +1 -1
- package/lib/cjs/RpcBackend.d.ts +28 -28
- package/lib/cjs/RpcBackend.js +126 -126
- package/lib/cjs/RpcBackend.js.map +1 -1
- package/lib/cjs/SQLiteDb.d.ts +219 -219
- package/lib/cjs/SQLiteDb.js +214 -214
- package/lib/cjs/SQLiteDb.js.map +1 -1
- package/lib/cjs/Schema.d.ts +55 -55
- package/lib/cjs/Schema.js +83 -83
- package/lib/cjs/Schema.js.map +1 -1
- package/lib/cjs/ServerBasedLocks.d.ts +57 -57
- package/lib/cjs/ServerBasedLocks.js +168 -168
- package/lib/cjs/ServerBasedLocks.js.map +1 -1
- package/lib/cjs/SqliteStatement.d.ts +360 -360
- package/lib/cjs/SqliteStatement.js +586 -586
- package/lib/cjs/SqliteStatement.js.map +1 -1
- package/lib/cjs/Texture.d.ts +58 -58
- package/lib/cjs/Texture.js +82 -82
- package/lib/cjs/Texture.js.map +1 -1
- package/lib/cjs/TileStorage.d.ts +18 -18
- package/lib/cjs/TileStorage.js +90 -90
- package/lib/cjs/TileStorage.js.map +1 -1
- package/lib/cjs/TxnManager.d.ts +202 -202
- package/lib/cjs/TxnManager.js +356 -356
- package/lib/cjs/TxnManager.js.map +1 -1
- package/lib/cjs/ViewDefinition.d.ts +439 -435
- package/lib/cjs/ViewDefinition.d.ts.map +1 -1
- package/lib/cjs/ViewDefinition.js +646 -635
- package/lib/cjs/ViewDefinition.js.map +1 -1
- package/lib/cjs/ViewStateHydrator.d.ts +13 -13
- package/lib/cjs/ViewStateHydrator.js +103 -103
- package/lib/cjs/ViewStateHydrator.js.map +1 -1
- package/lib/cjs/assets/IModelChange.02.00.00.ecschema.xml +90 -90
- package/lib/cjs/assets/Settings/Schemas/Cloud.Schema.json +67 -67
- package/lib/cjs/assets/Settings/Schemas/Gcs.schema.json +31 -31
- package/lib/cjs/assets/Settings/Schemas/Workspace.Schema.json +52 -52
- package/lib/cjs/assets/Settings/backend.setting.json5 +138 -138
- package/lib/cjs/core-backend.d.ts +184 -182
- package/lib/cjs/core-backend.d.ts.map +1 -1
- package/lib/cjs/core-backend.js +204 -202
- package/lib/cjs/core-backend.js.map +1 -1
- package/lib/cjs/domains/FunctionalElements.d.ts +101 -101
- package/lib/cjs/domains/FunctionalElements.js +145 -145
- package/lib/cjs/domains/FunctionalElements.js.map +1 -1
- package/lib/cjs/domains/FunctionalSchema.d.ts +13 -13
- package/lib/cjs/domains/FunctionalSchema.js +40 -40
- package/lib/cjs/domains/FunctionalSchema.js.map +1 -1
- package/lib/cjs/domains/GenericElements.d.ts +177 -177
- package/lib/cjs/domains/GenericElements.js +263 -263
- package/lib/cjs/domains/GenericElements.js.map +1 -1
- package/lib/cjs/domains/GenericSchema.d.ts +10 -10
- package/lib/cjs/domains/GenericSchema.js +28 -28
- package/lib/cjs/domains/GenericSchema.js.map +1 -1
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js +32 -32
- package/lib/cjs/rpc-impl/DevToolsRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.d.ts +45 -45
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js +262 -262
- package/lib/cjs/rpc-impl/IModelReadRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.d.ts +22 -22
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js +204 -204
- package/lib/cjs/rpc-impl/IModelTileRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.d.ts +36 -36
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js +168 -168
- package/lib/cjs/rpc-impl/RpcBriefcaseUtility.js.map +1 -1
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.d.ts +16 -16
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js +43 -43
- package/lib/cjs/rpc-impl/SnapshotIModelRpcImpl.js.map +1 -1
- package/lib/cjs/rpc-impl/WipRpcImpl.d.ts +15 -15
- package/lib/cjs/rpc-impl/WipRpcImpl.js +37 -37
- package/lib/cjs/rpc-impl/WipRpcImpl.js.map +1 -1
- package/lib/cjs/workspace/Settings.d.ts +186 -186
- package/lib/cjs/workspace/Settings.js +155 -155
- package/lib/cjs/workspace/Settings.js.map +1 -1
- package/lib/cjs/workspace/SettingsSchemas.d.ts +75 -75
- package/lib/cjs/workspace/SettingsSchemas.js +191 -191
- package/lib/cjs/workspace/SettingsSchemas.js.map +1 -1
- package/lib/cjs/workspace/Workspace.d.ts +414 -414
- package/lib/cjs/workspace/Workspace.js +543 -543
- package/lib/cjs/workspace/Workspace.js.map +1 -1
- package/package.json +14 -13
|
@@ -1,263 +1,263 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module RpcInterface
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.IModelReadRpcImpl = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
const core_common_1 = require("@itwin/core-common");
|
|
13
|
-
const core_geometry_1 = require("@itwin/core-geometry");
|
|
14
|
-
const Category_1 = require("../Category");
|
|
15
|
-
const ConcurrentQuery_1 = require("../ConcurrentQuery");
|
|
16
|
-
const GeometrySummary_1 = require("../GeometrySummary");
|
|
17
|
-
const RpcBriefcaseUtility_1 = require("./RpcBriefcaseUtility");
|
|
18
|
-
const RpcBackend_1 = require("../RpcBackend");
|
|
19
|
-
const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
|
|
20
|
-
const CustomViewState3dCreator_1 = require("../CustomViewState3dCreator");
|
|
21
|
-
const ViewStateHydrator_1 = require("../ViewStateHydrator");
|
|
22
|
-
/** The backend implementation of IModelReadRpcInterface.
|
|
23
|
-
* @internal
|
|
24
|
-
*/
|
|
25
|
-
class IModelReadRpcImpl extends core_common_1.RpcInterface {
|
|
26
|
-
static register() { core_common_1.RpcManager.registerImpl(core_common_1.IModelReadRpcInterface, IModelReadRpcImpl); }
|
|
27
|
-
async getConnectionProps(tokenProps) {
|
|
28
|
-
return RpcBriefcaseUtility_1.RpcBriefcaseUtility.openWithTimeout(RpcBackend_1.RpcTrace.expectCurrentActivity, tokenProps, core_common_1.SyncMode.FixedVersion);
|
|
29
|
-
}
|
|
30
|
-
async getCustomViewState3dData(tokenProps, options) {
|
|
31
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
32
|
-
const viewCreator = new CustomViewState3dCreator_1.CustomViewState3dCreator(iModelDb);
|
|
33
|
-
return viewCreator.getCustomViewState3dData(options);
|
|
34
|
-
}
|
|
35
|
-
async hydrateViewState(tokenProps, options) {
|
|
36
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
37
|
-
const viewHydrater = new ViewStateHydrator_1.ViewStateHydrator(iModelDb);
|
|
38
|
-
return viewHydrater.getHydrateResponseProps(options);
|
|
39
|
-
}
|
|
40
|
-
async querySubCategories(tokenProps, compressedCategoryIds) {
|
|
41
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
42
|
-
const decompressedIds = core_bentley_1.CompressedId64Set.decompressArray(compressedCategoryIds);
|
|
43
|
-
return iModelDb.querySubCategories(decompressedIds);
|
|
44
|
-
}
|
|
45
|
-
async queryRows(tokenProps, request) {
|
|
46
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
47
|
-
if (iModelDb.isReadonly && request.usePrimaryConn === true) {
|
|
48
|
-
core_bentley_1.Logger.logWarning(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, "usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.", request);
|
|
49
|
-
request.usePrimaryConn = false;
|
|
50
|
-
}
|
|
51
|
-
return ConcurrentQuery_1.ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);
|
|
52
|
-
}
|
|
53
|
-
async queryBlob(tokenProps, request) {
|
|
54
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
55
|
-
if (iModelDb.isReadonly && request.usePrimaryConn === true) {
|
|
56
|
-
core_bentley_1.Logger.logWarning(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, "usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.", request);
|
|
57
|
-
request.usePrimaryConn = false;
|
|
58
|
-
}
|
|
59
|
-
return ConcurrentQuery_1.ConcurrentQuery.executeBlobRequest(iModelDb.nativeDb, request);
|
|
60
|
-
}
|
|
61
|
-
async queryModelRanges(tokenProps, modelIdsList) {
|
|
62
|
-
const modelIds = new Set(modelIdsList);
|
|
63
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
64
|
-
const ranges = [];
|
|
65
|
-
for (const id of modelIds) {
|
|
66
|
-
try {
|
|
67
|
-
ranges.push(iModelDb.nativeDb.queryModelExtents({ id }).modelExtents);
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
if (err.errorNumber === core_bentley_1.IModelStatus.NoGeometry) { // if there was no geometry, just return null range
|
|
71
|
-
ranges.push(new core_geometry_1.Range3d());
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
if (modelIds.size === 1)
|
|
75
|
-
throw err; // if they're asking for more than one model, don't throw on error.
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return ranges;
|
|
80
|
-
}
|
|
81
|
-
async getModelProps(tokenProps, modelIdsList) {
|
|
82
|
-
const modelIds = new Set(modelIdsList);
|
|
83
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
84
|
-
const modelJsonArray = [];
|
|
85
|
-
for (const id of modelIds) {
|
|
86
|
-
try {
|
|
87
|
-
const modelProps = iModelDb.models.getModelJson({ id });
|
|
88
|
-
modelJsonArray.push(modelProps);
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
if (modelIds.size === 1)
|
|
92
|
-
throw error; // if they're asking for more than one model, don't throw on error.
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return modelJsonArray;
|
|
96
|
-
}
|
|
97
|
-
async queryModelProps(tokenProps, params) {
|
|
98
|
-
const ids = await this.queryEntityIds(tokenProps, params);
|
|
99
|
-
return this.getModelProps(tokenProps, [...ids]);
|
|
100
|
-
}
|
|
101
|
-
async getElementProps(tokenProps, elementIdsList) {
|
|
102
|
-
const elementIds = new Set(elementIdsList);
|
|
103
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
104
|
-
const elementProps = [];
|
|
105
|
-
for (const id of elementIds) {
|
|
106
|
-
try {
|
|
107
|
-
elementProps.push(iModelDb.elements.getElementJson({ id }));
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
if (elementIds.size === 1)
|
|
111
|
-
throw error; // if they're asking for more than one element, don't throw on error.
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return elementProps;
|
|
115
|
-
}
|
|
116
|
-
async loadElementProps(tokenProps, identifier, options) {
|
|
117
|
-
const props = options ? { ...options } : {};
|
|
118
|
-
if (typeof identifier === "string") {
|
|
119
|
-
if (core_bentley_1.Id64.isId64(identifier))
|
|
120
|
-
props.id = identifier;
|
|
121
|
-
else
|
|
122
|
-
props.federationGuid = identifier;
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
props.code = core_common_1.Code.fromJSON(identifier);
|
|
126
|
-
}
|
|
127
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
128
|
-
return iModelDb.elements.tryGetElementProps(props);
|
|
129
|
-
}
|
|
130
|
-
async getGeometrySummary(tokenProps, request) {
|
|
131
|
-
const iModel = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
132
|
-
return (0, GeometrySummary_1.generateGeometrySummaries)(request, iModel);
|
|
133
|
-
}
|
|
134
|
-
async queryElementProps(tokenProps, params) {
|
|
135
|
-
const ids = await this.queryEntityIds(tokenProps, params);
|
|
136
|
-
const res = this.getElementProps(tokenProps, [...ids]);
|
|
137
|
-
return res;
|
|
138
|
-
}
|
|
139
|
-
async queryEntityIds(tokenProps, params) {
|
|
140
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
141
|
-
const res = iModelDb.queryEntityIds(params);
|
|
142
|
-
return [...res];
|
|
143
|
-
}
|
|
144
|
-
async getClassHierarchy(tokenProps, classFullName) {
|
|
145
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
146
|
-
const classArray = [];
|
|
147
|
-
while (true) {
|
|
148
|
-
const classMetaData = iModelDb.getMetaData(classFullName);
|
|
149
|
-
classArray.push(classFullName);
|
|
150
|
-
if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)
|
|
151
|
-
break;
|
|
152
|
-
classFullName = classMetaData.baseClasses[0];
|
|
153
|
-
}
|
|
154
|
-
return classArray;
|
|
155
|
-
}
|
|
156
|
-
async getAllCodeSpecs(tokenProps) {
|
|
157
|
-
const codeSpecs = [];
|
|
158
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
159
|
-
iModelDb.withPreparedStatement("SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec", (statement) => {
|
|
160
|
-
for (const row of statement)
|
|
161
|
-
codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });
|
|
162
|
-
});
|
|
163
|
-
return codeSpecs;
|
|
164
|
-
}
|
|
165
|
-
async getViewStateData(tokenProps, viewDefinitionId, options) {
|
|
166
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
167
|
-
return iModelDb.views.getViewStateData(viewDefinitionId, options);
|
|
168
|
-
}
|
|
169
|
-
async readFontJson(tokenProps) {
|
|
170
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
171
|
-
return iModelDb.nativeDb.readFontMap();
|
|
172
|
-
}
|
|
173
|
-
async requestSnap(tokenProps, sessionId, props) {
|
|
174
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
175
|
-
return iModelDb.requestSnap(sessionId, props);
|
|
176
|
-
}
|
|
177
|
-
async cancelSnap(tokenProps, sessionId) {
|
|
178
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
179
|
-
return iModelDb.cancelSnap(sessionId);
|
|
180
|
-
}
|
|
181
|
-
async getGeometryContainment(tokenProps, props) {
|
|
182
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
183
|
-
return iModelDb.getGeometryContainment(props);
|
|
184
|
-
}
|
|
185
|
-
async getMassProperties(tokenProps, props) {
|
|
186
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
187
|
-
return iModelDb.getMassProperties(props);
|
|
188
|
-
}
|
|
189
|
-
async getMassPropertiesPerCandidate(tokenProps, props) {
|
|
190
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
191
|
-
const getSingleCandidateMassProperties = async (candidate) => {
|
|
192
|
-
try {
|
|
193
|
-
const massPropResults = [];
|
|
194
|
-
for (const op of props.operations) {
|
|
195
|
-
const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });
|
|
196
|
-
massPropResults.push(massProperties);
|
|
197
|
-
}
|
|
198
|
-
let singleCandidateResult = { status: core_bentley_1.BentleyStatus.ERROR, candidate };
|
|
199
|
-
if (massPropResults.some((r) => r.status !== core_bentley_1.BentleyStatus.ERROR)) {
|
|
200
|
-
singleCandidateResult.status = core_bentley_1.BentleyStatus.SUCCESS;
|
|
201
|
-
for (const r of massPropResults.filter((mpr) => mpr.status !== core_bentley_1.BentleyStatus.ERROR)) {
|
|
202
|
-
singleCandidateResult = { ...singleCandidateResult, ...r };
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return singleCandidateResult;
|
|
206
|
-
}
|
|
207
|
-
catch {
|
|
208
|
-
return { status: core_bentley_1.BentleyStatus.ERROR, candidate };
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
const promises = [];
|
|
212
|
-
for (const candidate of core_bentley_1.CompressedId64Set.iterable(props.candidates)) {
|
|
213
|
-
promises.push(getSingleCandidateMassProperties(candidate));
|
|
214
|
-
}
|
|
215
|
-
return Promise.all(promises);
|
|
216
|
-
}
|
|
217
|
-
async getToolTipMessage(tokenProps, id) {
|
|
218
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
219
|
-
const el = iModelDb.elements.getElement(id);
|
|
220
|
-
return (el === undefined) ? [] : el.getToolTipMessage();
|
|
221
|
-
}
|
|
222
|
-
/** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
|
|
223
|
-
* @deprecated
|
|
224
|
-
*/
|
|
225
|
-
async getViewThumbnail(_tokenProps, _viewId) {
|
|
226
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, _tokenProps);
|
|
227
|
-
const thumbnail = iModelDb.views.getThumbnail(_viewId);
|
|
228
|
-
if (undefined === thumbnail || 0 === thumbnail.image.length)
|
|
229
|
-
throw new core_common_1.NoContentError();
|
|
230
|
-
const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size
|
|
231
|
-
new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === "jpeg" ? core_common_1.ImageSourceFormat.Jpeg : core_common_1.ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.
|
|
232
|
-
val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata
|
|
233
|
-
return val;
|
|
234
|
-
}
|
|
235
|
-
async getDefaultViewId(tokenProps) {
|
|
236
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
237
|
-
const spec = { namespace: "dgn_View", name: "DefaultView" };
|
|
238
|
-
const blob = iModelDb.queryFilePropertyBlob(spec);
|
|
239
|
-
if (undefined === blob || 8 !== blob.length)
|
|
240
|
-
return core_bentley_1.Id64.invalid;
|
|
241
|
-
const view = new Uint32Array(blob.buffer);
|
|
242
|
-
return core_bentley_1.Id64.fromUint32Pair(view[0], view[1]);
|
|
243
|
-
}
|
|
244
|
-
async getSpatialCategoryId(tokenProps, categoryName) {
|
|
245
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
246
|
-
const dictionary = iModelDb.models.getModel(core_common_1.IModel.dictionaryId);
|
|
247
|
-
return Category_1.SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);
|
|
248
|
-
}
|
|
249
|
-
async getIModelCoordinatesFromGeoCoordinates(tokenProps, props) {
|
|
250
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
251
|
-
return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);
|
|
252
|
-
}
|
|
253
|
-
async getGeoCoordinatesFromIModelCoordinates(tokenProps, props) {
|
|
254
|
-
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
255
|
-
return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);
|
|
256
|
-
}
|
|
257
|
-
async queryTextureData(tokenProps, textureLoadProps) {
|
|
258
|
-
const db = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
259
|
-
return db.queryTextureData(textureLoadProps);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
exports.IModelReadRpcImpl = IModelReadRpcImpl;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module RpcInterface
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.IModelReadRpcImpl = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
const core_common_1 = require("@itwin/core-common");
|
|
13
|
+
const core_geometry_1 = require("@itwin/core-geometry");
|
|
14
|
+
const Category_1 = require("../Category");
|
|
15
|
+
const ConcurrentQuery_1 = require("../ConcurrentQuery");
|
|
16
|
+
const GeometrySummary_1 = require("../GeometrySummary");
|
|
17
|
+
const RpcBriefcaseUtility_1 = require("./RpcBriefcaseUtility");
|
|
18
|
+
const RpcBackend_1 = require("../RpcBackend");
|
|
19
|
+
const BackendLoggerCategory_1 = require("../BackendLoggerCategory");
|
|
20
|
+
const CustomViewState3dCreator_1 = require("../CustomViewState3dCreator");
|
|
21
|
+
const ViewStateHydrator_1 = require("../ViewStateHydrator");
|
|
22
|
+
/** The backend implementation of IModelReadRpcInterface.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
class IModelReadRpcImpl extends core_common_1.RpcInterface {
|
|
26
|
+
static register() { core_common_1.RpcManager.registerImpl(core_common_1.IModelReadRpcInterface, IModelReadRpcImpl); }
|
|
27
|
+
async getConnectionProps(tokenProps) {
|
|
28
|
+
return RpcBriefcaseUtility_1.RpcBriefcaseUtility.openWithTimeout(RpcBackend_1.RpcTrace.expectCurrentActivity, tokenProps, core_common_1.SyncMode.FixedVersion);
|
|
29
|
+
}
|
|
30
|
+
async getCustomViewState3dData(tokenProps, options) {
|
|
31
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
32
|
+
const viewCreator = new CustomViewState3dCreator_1.CustomViewState3dCreator(iModelDb);
|
|
33
|
+
return viewCreator.getCustomViewState3dData(options);
|
|
34
|
+
}
|
|
35
|
+
async hydrateViewState(tokenProps, options) {
|
|
36
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
37
|
+
const viewHydrater = new ViewStateHydrator_1.ViewStateHydrator(iModelDb);
|
|
38
|
+
return viewHydrater.getHydrateResponseProps(options);
|
|
39
|
+
}
|
|
40
|
+
async querySubCategories(tokenProps, compressedCategoryIds) {
|
|
41
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
42
|
+
const decompressedIds = core_bentley_1.CompressedId64Set.decompressArray(compressedCategoryIds);
|
|
43
|
+
return iModelDb.querySubCategories(decompressedIds);
|
|
44
|
+
}
|
|
45
|
+
async queryRows(tokenProps, request) {
|
|
46
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
47
|
+
if (iModelDb.isReadonly && request.usePrimaryConn === true) {
|
|
48
|
+
core_bentley_1.Logger.logWarning(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, "usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.", request);
|
|
49
|
+
request.usePrimaryConn = false;
|
|
50
|
+
}
|
|
51
|
+
return ConcurrentQuery_1.ConcurrentQuery.executeQueryRequest(iModelDb.nativeDb, request);
|
|
52
|
+
}
|
|
53
|
+
async queryBlob(tokenProps, request) {
|
|
54
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
55
|
+
if (iModelDb.isReadonly && request.usePrimaryConn === true) {
|
|
56
|
+
core_bentley_1.Logger.logWarning(BackendLoggerCategory_1.BackendLoggerCategory.IModelDb, "usePrimaryConn is only supported on imodel that is opened in read/write mode. The option will be ignored.", request);
|
|
57
|
+
request.usePrimaryConn = false;
|
|
58
|
+
}
|
|
59
|
+
return ConcurrentQuery_1.ConcurrentQuery.executeBlobRequest(iModelDb.nativeDb, request);
|
|
60
|
+
}
|
|
61
|
+
async queryModelRanges(tokenProps, modelIdsList) {
|
|
62
|
+
const modelIds = new Set(modelIdsList);
|
|
63
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
64
|
+
const ranges = [];
|
|
65
|
+
for (const id of modelIds) {
|
|
66
|
+
try {
|
|
67
|
+
ranges.push(iModelDb.nativeDb.queryModelExtents({ id }).modelExtents);
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
if (err.errorNumber === core_bentley_1.IModelStatus.NoGeometry) { // if there was no geometry, just return null range
|
|
71
|
+
ranges.push(new core_geometry_1.Range3d());
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (modelIds.size === 1)
|
|
75
|
+
throw err; // if they're asking for more than one model, don't throw on error.
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return ranges;
|
|
80
|
+
}
|
|
81
|
+
async getModelProps(tokenProps, modelIdsList) {
|
|
82
|
+
const modelIds = new Set(modelIdsList);
|
|
83
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
84
|
+
const modelJsonArray = [];
|
|
85
|
+
for (const id of modelIds) {
|
|
86
|
+
try {
|
|
87
|
+
const modelProps = iModelDb.models.getModelJson({ id });
|
|
88
|
+
modelJsonArray.push(modelProps);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (modelIds.size === 1)
|
|
92
|
+
throw error; // if they're asking for more than one model, don't throw on error.
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return modelJsonArray;
|
|
96
|
+
}
|
|
97
|
+
async queryModelProps(tokenProps, params) {
|
|
98
|
+
const ids = await this.queryEntityIds(tokenProps, params);
|
|
99
|
+
return this.getModelProps(tokenProps, [...ids]);
|
|
100
|
+
}
|
|
101
|
+
async getElementProps(tokenProps, elementIdsList) {
|
|
102
|
+
const elementIds = new Set(elementIdsList);
|
|
103
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
104
|
+
const elementProps = [];
|
|
105
|
+
for (const id of elementIds) {
|
|
106
|
+
try {
|
|
107
|
+
elementProps.push(iModelDb.elements.getElementJson({ id }));
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
if (elementIds.size === 1)
|
|
111
|
+
throw error; // if they're asking for more than one element, don't throw on error.
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return elementProps;
|
|
115
|
+
}
|
|
116
|
+
async loadElementProps(tokenProps, identifier, options) {
|
|
117
|
+
const props = options ? { ...options } : {};
|
|
118
|
+
if (typeof identifier === "string") {
|
|
119
|
+
if (core_bentley_1.Id64.isId64(identifier))
|
|
120
|
+
props.id = identifier;
|
|
121
|
+
else
|
|
122
|
+
props.federationGuid = identifier;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
props.code = core_common_1.Code.fromJSON(identifier);
|
|
126
|
+
}
|
|
127
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
128
|
+
return iModelDb.elements.tryGetElementProps(props);
|
|
129
|
+
}
|
|
130
|
+
async getGeometrySummary(tokenProps, request) {
|
|
131
|
+
const iModel = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
132
|
+
return (0, GeometrySummary_1.generateGeometrySummaries)(request, iModel);
|
|
133
|
+
}
|
|
134
|
+
async queryElementProps(tokenProps, params) {
|
|
135
|
+
const ids = await this.queryEntityIds(tokenProps, params);
|
|
136
|
+
const res = this.getElementProps(tokenProps, [...ids]);
|
|
137
|
+
return res;
|
|
138
|
+
}
|
|
139
|
+
async queryEntityIds(tokenProps, params) {
|
|
140
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
141
|
+
const res = iModelDb.queryEntityIds(params);
|
|
142
|
+
return [...res];
|
|
143
|
+
}
|
|
144
|
+
async getClassHierarchy(tokenProps, classFullName) {
|
|
145
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
146
|
+
const classArray = [];
|
|
147
|
+
while (true) {
|
|
148
|
+
const classMetaData = iModelDb.getMetaData(classFullName);
|
|
149
|
+
classArray.push(classFullName);
|
|
150
|
+
if (!classMetaData.baseClasses || classMetaData.baseClasses.length === 0)
|
|
151
|
+
break;
|
|
152
|
+
classFullName = classMetaData.baseClasses[0];
|
|
153
|
+
}
|
|
154
|
+
return classArray;
|
|
155
|
+
}
|
|
156
|
+
async getAllCodeSpecs(tokenProps) {
|
|
157
|
+
const codeSpecs = [];
|
|
158
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
159
|
+
iModelDb.withPreparedStatement("SELECT ECInstanceId AS id, name, jsonProperties FROM BisCore.CodeSpec", (statement) => {
|
|
160
|
+
for (const row of statement)
|
|
161
|
+
codeSpecs.push({ id: row.id, name: row.name, jsonProperties: JSON.parse(row.jsonProperties) });
|
|
162
|
+
});
|
|
163
|
+
return codeSpecs;
|
|
164
|
+
}
|
|
165
|
+
async getViewStateData(tokenProps, viewDefinitionId, options) {
|
|
166
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
167
|
+
return iModelDb.views.getViewStateData(viewDefinitionId, options);
|
|
168
|
+
}
|
|
169
|
+
async readFontJson(tokenProps) {
|
|
170
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
171
|
+
return iModelDb.nativeDb.readFontMap();
|
|
172
|
+
}
|
|
173
|
+
async requestSnap(tokenProps, sessionId, props) {
|
|
174
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
175
|
+
return iModelDb.requestSnap(sessionId, props);
|
|
176
|
+
}
|
|
177
|
+
async cancelSnap(tokenProps, sessionId) {
|
|
178
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
179
|
+
return iModelDb.cancelSnap(sessionId);
|
|
180
|
+
}
|
|
181
|
+
async getGeometryContainment(tokenProps, props) {
|
|
182
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
183
|
+
return iModelDb.getGeometryContainment(props);
|
|
184
|
+
}
|
|
185
|
+
async getMassProperties(tokenProps, props) {
|
|
186
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
187
|
+
return iModelDb.getMassProperties(props);
|
|
188
|
+
}
|
|
189
|
+
async getMassPropertiesPerCandidate(tokenProps, props) {
|
|
190
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
191
|
+
const getSingleCandidateMassProperties = async (candidate) => {
|
|
192
|
+
try {
|
|
193
|
+
const massPropResults = [];
|
|
194
|
+
for (const op of props.operations) {
|
|
195
|
+
const massProperties = await iModelDb.getMassProperties({ operation: op, candidates: [candidate] });
|
|
196
|
+
massPropResults.push(massProperties);
|
|
197
|
+
}
|
|
198
|
+
let singleCandidateResult = { status: core_bentley_1.BentleyStatus.ERROR, candidate };
|
|
199
|
+
if (massPropResults.some((r) => r.status !== core_bentley_1.BentleyStatus.ERROR)) {
|
|
200
|
+
singleCandidateResult.status = core_bentley_1.BentleyStatus.SUCCESS;
|
|
201
|
+
for (const r of massPropResults.filter((mpr) => mpr.status !== core_bentley_1.BentleyStatus.ERROR)) {
|
|
202
|
+
singleCandidateResult = { ...singleCandidateResult, ...r };
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return singleCandidateResult;
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
return { status: core_bentley_1.BentleyStatus.ERROR, candidate };
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
const promises = [];
|
|
212
|
+
for (const candidate of core_bentley_1.CompressedId64Set.iterable(props.candidates)) {
|
|
213
|
+
promises.push(getSingleCandidateMassProperties(candidate));
|
|
214
|
+
}
|
|
215
|
+
return Promise.all(promises);
|
|
216
|
+
}
|
|
217
|
+
async getToolTipMessage(tokenProps, id) {
|
|
218
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
219
|
+
const el = iModelDb.elements.getElement(id);
|
|
220
|
+
return (el === undefined) ? [] : el.getToolTipMessage();
|
|
221
|
+
}
|
|
222
|
+
/** Send a view thumbnail to the frontend. This is a binary transfer with the metadata in a 16-byte prefix header.
|
|
223
|
+
* @deprecated
|
|
224
|
+
*/
|
|
225
|
+
async getViewThumbnail(_tokenProps, _viewId) {
|
|
226
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, _tokenProps);
|
|
227
|
+
const thumbnail = iModelDb.views.getThumbnail(_viewId);
|
|
228
|
+
if (undefined === thumbnail || 0 === thumbnail.image.length)
|
|
229
|
+
throw new core_common_1.NoContentError();
|
|
230
|
+
const val = new Uint8Array(thumbnail.image.length + 16); // allocate a new buffer 16 bytes larger than the image size
|
|
231
|
+
new Uint32Array(val.buffer, 0, 4).set([thumbnail.image.length, thumbnail.format === "jpeg" ? core_common_1.ImageSourceFormat.Jpeg : core_common_1.ImageSourceFormat.Png, thumbnail.width, thumbnail.height]); // Put the metadata in the first 16 bytes.
|
|
232
|
+
val.set(thumbnail.image, 16); // put the image data at offset 16 after metadata
|
|
233
|
+
return val;
|
|
234
|
+
}
|
|
235
|
+
async getDefaultViewId(tokenProps) {
|
|
236
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
237
|
+
const spec = { namespace: "dgn_View", name: "DefaultView" };
|
|
238
|
+
const blob = iModelDb.queryFilePropertyBlob(spec);
|
|
239
|
+
if (undefined === blob || 8 !== blob.length)
|
|
240
|
+
return core_bentley_1.Id64.invalid;
|
|
241
|
+
const view = new Uint32Array(blob.buffer);
|
|
242
|
+
return core_bentley_1.Id64.fromUint32Pair(view[0], view[1]);
|
|
243
|
+
}
|
|
244
|
+
async getSpatialCategoryId(tokenProps, categoryName) {
|
|
245
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
246
|
+
const dictionary = iModelDb.models.getModel(core_common_1.IModel.dictionaryId);
|
|
247
|
+
return Category_1.SpatialCategory.queryCategoryIdByName(iModelDb, dictionary.id, categoryName);
|
|
248
|
+
}
|
|
249
|
+
async getIModelCoordinatesFromGeoCoordinates(tokenProps, props) {
|
|
250
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
251
|
+
return iModelDb.getIModelCoordinatesFromGeoCoordinates(props);
|
|
252
|
+
}
|
|
253
|
+
async getGeoCoordinatesFromIModelCoordinates(tokenProps, props) {
|
|
254
|
+
const iModelDb = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
255
|
+
return iModelDb.getGeoCoordinatesFromIModelCoordinates(props);
|
|
256
|
+
}
|
|
257
|
+
async queryTextureData(tokenProps, textureLoadProps) {
|
|
258
|
+
const db = await RpcBriefcaseUtility_1.RpcBriefcaseUtility.findOpenIModel(RpcBackend_1.RpcTrace.expectCurrentActivity.accessToken, tokenProps);
|
|
259
|
+
return db.queryTextureData(textureLoadProps);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.IModelReadRpcImpl = IModelReadRpcImpl;
|
|
263
263
|
//# sourceMappingURL=IModelReadRpcImpl.js.map
|