@itwin/rpcinterface-full-stack-tests 3.6.0-dev.14 → 3.6.0-dev.22
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/dist/_cb67.bundled-tests.js.map +1 -1
- package/lib/dist/bundled-tests.js +471 -181
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
- package/lib/dist/object-storage.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_itwin_object-storage-azure_1_4_0_node_modules_itwin_obj-3576c6.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_3_2_12_node_modules_loaders_gl_draco_d-b19815.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_reflect-metadata_0_1_13_node_modules_reflect-metadata_R-610cb3.bundled-tests.js.map +1 -1
- package/package.json +14 -14
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
/***/ }),
|
|
23
23
|
|
|
24
|
-
/***/ "../../common/temp/node_modules/.pnpm/@itwin+certa@3.
|
|
24
|
+
/***/ "../../common/temp/node_modules/.pnpm/@itwin+certa@3.5.1/node_modules/@itwin/certa/lib/utils/CallbackUtils.js":
|
|
25
25
|
/*!********************************************************************************************************************!*\
|
|
26
|
-
!*** ../../common/temp/node_modules/.pnpm/@itwin+certa@3.
|
|
26
|
+
!*** ../../common/temp/node_modules/.pnpm/@itwin+certa@3.5.1/node_modules/@itwin/certa/lib/utils/CallbackUtils.js ***!
|
|
27
27
|
\********************************************************************************************************************/
|
|
28
28
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
29
29
|
|
|
@@ -2772,7 +2772,7 @@ exports.getAccessTokenFromBackend = exports.getTokenCallbackName = void 0;
|
|
|
2772
2772
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
2773
2773
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
2774
2774
|
*--------------------------------------------------------------------------------------------*/
|
|
2775
|
-
const CallbackUtils_1 = __webpack_require__(/*! @itwin/certa/lib/utils/CallbackUtils */ "../../common/temp/node_modules/.pnpm/@itwin+certa@3.
|
|
2775
|
+
const CallbackUtils_1 = __webpack_require__(/*! @itwin/certa/lib/utils/CallbackUtils */ "../../common/temp/node_modules/.pnpm/@itwin+certa@3.5.1/node_modules/@itwin/certa/lib/utils/CallbackUtils.js");
|
|
2776
2776
|
// Shared by both the frontend and backend side of the tests
|
|
2777
2777
|
exports.getTokenCallbackName = "getToken";
|
|
2778
2778
|
async function getAccessTokenFromBackend(user, oidcConfig) {
|
|
@@ -51725,8 +51725,16 @@ class TransientIdSequence {
|
|
|
51725
51725
|
constructor() {
|
|
51726
51726
|
this._localId = 0;
|
|
51727
51727
|
}
|
|
51728
|
+
/** Generate and return the next transient Id64String in the sequence.
|
|
51729
|
+
* @deprecated Use [[getNext]].
|
|
51730
|
+
*/
|
|
51731
|
+
get next() {
|
|
51732
|
+
return this.getNext();
|
|
51733
|
+
}
|
|
51728
51734
|
/** Generate and return the next transient Id64String in the sequence. */
|
|
51729
|
-
|
|
51735
|
+
getNext() {
|
|
51736
|
+
return Id64.fromLocalAndBriefcaseIds(++this._localId, 0xffffff);
|
|
51737
|
+
}
|
|
51730
51738
|
}
|
|
51731
51739
|
/**
|
|
51732
51740
|
* The Guid namespace provides facilities for working with GUID strings using the "8-4-4-4-12" pattern.
|
|
@@ -88509,7 +88517,7 @@ class AccuDraw {
|
|
|
88509
88517
|
if (context.viewport.viewFlags.acsTriad) {
|
|
88510
88518
|
context.viewport.view.auxiliaryCoordinateSystem.display(context, (_AuxCoordSys__WEBPACK_IMPORTED_MODULE_4__.ACSDisplayOptions.CheckVisible | _AuxCoordSys__WEBPACK_IMPORTED_MODULE_4__.ACSDisplayOptions.Active));
|
|
88511
88519
|
if (undefined === this._acsPickId)
|
|
88512
|
-
this._acsPickId = context.viewport.iModel.transientIds.
|
|
88520
|
+
this._acsPickId = context.viewport.iModel.transientIds.getNext();
|
|
88513
88521
|
const acsPickBuilder = context.createGraphicBuilder(_render_GraphicBuilder__WEBPACK_IMPORTED_MODULE_7__.GraphicType.WorldDecoration, undefined, this._acsPickId);
|
|
88514
88522
|
const color = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue.adjustedForContrast(context.viewport.view.backgroundColor, 50);
|
|
88515
88523
|
acsPickBuilder.setSymbology(color, color, 6);
|
|
@@ -116888,7 +116896,6 @@ class RealityMeshParamsBuilder {
|
|
|
116888
116896
|
* @returns the index of the new vertex in [[positions]].
|
|
116889
116897
|
*/
|
|
116890
116898
|
addQuantizedVertex(position, uv, normal) {
|
|
116891
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.positions.length < 0xffff, "RealityMeshParams supports no more than 64k vertices");
|
|
116892
116899
|
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)((undefined === normal) === (undefined === this.normals), "RealityMeshParams requires all vertices to have normals, or none.");
|
|
116893
116900
|
this.positions.push(position);
|
|
116894
116901
|
this.uvs.push(uv);
|
|
@@ -116915,7 +116922,6 @@ class RealityMeshParamsBuilder {
|
|
|
116915
116922
|
this.addIndex(index);
|
|
116916
116923
|
}
|
|
116917
116924
|
addIndex(index) {
|
|
116918
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(index <= 0xffff, "RealityMeshParams supports no more than 64k vertices");
|
|
116919
116925
|
this.indices.push(index);
|
|
116920
116926
|
}
|
|
116921
116927
|
/** Extract the finished [[RealityMeshParams]]. */
|
|
@@ -123720,6 +123726,7 @@ class BranchState {
|
|
|
123720
123726
|
get viewFlags() { return this._opts.viewFlags; }
|
|
123721
123727
|
set viewFlags(vf) { this._opts.viewFlags = vf.normalize(); }
|
|
123722
123728
|
get clipVolume() { return this._opts.clipVolume; }
|
|
123729
|
+
get forceViewCoords() { return true === this._opts.forceViewCoords; }
|
|
123723
123730
|
get planarClassifier() { return this._opts.planarClassifier; }
|
|
123724
123731
|
get textureDrape() { return this._opts.textureDrape; }
|
|
123725
123732
|
get edgeSettings() { return this._opts.edgeSettings; }
|
|
@@ -123751,6 +123758,7 @@ class BranchState {
|
|
|
123751
123758
|
planarClassifier: (undefined !== branch.planarClassifier && undefined !== branch.planarClassifier.texture) ? branch.planarClassifier : prev.planarClassifier,
|
|
123752
123759
|
textureDrape: (_c = branch.textureDrape) !== null && _c !== void 0 ? _c : prev.textureDrape,
|
|
123753
123760
|
clipVolume: branch.clips,
|
|
123761
|
+
forceViewCoords: prev.forceViewCoords,
|
|
123754
123762
|
edgeSettings: (_d = branch.edgeSettings) !== null && _d !== void 0 ? _d : prev.edgeSettings,
|
|
123755
123763
|
is3d: (_f = (_e = branch.frustum) === null || _e === void 0 ? void 0 : _e.is3d) !== null && _f !== void 0 ? _f : prev.is3d,
|
|
123756
123764
|
frustumScale: (_h = (_g = branch.frustum) === null || _g === void 0 ? void 0 : _g.scale) !== null && _h !== void 0 ? _h : prev.frustumScale,
|
|
@@ -123769,6 +123777,9 @@ class BranchState {
|
|
|
123769
123777
|
const vf = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.ViewFlags({ renderMode: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.RenderMode.SmoothShade, lighting: false, whiteOnWhiteReversal: false });
|
|
123770
123778
|
return new BranchState({ viewFlags: vf, transform: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_0__.Transform.createIdentity(), symbologyOverrides: new _FeatureSymbology__WEBPACK_IMPORTED_MODULE_2__.FeatureSymbology.Overrides(), edgeSettings: _EdgeSettings__WEBPACK_IMPORTED_MODULE_3__.EdgeSettings.create(undefined), is3d: true });
|
|
123771
123779
|
}
|
|
123780
|
+
withViewCoords() {
|
|
123781
|
+
return new BranchState({ ...this._opts, forceViewCoords: true });
|
|
123782
|
+
}
|
|
123772
123783
|
}
|
|
123773
123784
|
|
|
123774
123785
|
|
|
@@ -125669,7 +125680,9 @@ class DrawParams {
|
|
|
125669
125680
|
get target() { return this.programParams.target; }
|
|
125670
125681
|
get renderPass() { return this.programParams.renderPass; }
|
|
125671
125682
|
get projectionMatrix() { return this.programParams.projectionMatrix; }
|
|
125672
|
-
get isViewCoords() {
|
|
125683
|
+
get isViewCoords() {
|
|
125684
|
+
return this.programParams.isViewCoords || this.target.currentBranch.forceViewCoords;
|
|
125685
|
+
}
|
|
125673
125686
|
get isOverlayPass() { return this.programParams.isOverlayPass; }
|
|
125674
125687
|
get context() { return this.programParams.context; }
|
|
125675
125688
|
init(programParams, geometry) {
|
|
@@ -132586,18 +132599,26 @@ class RenderCommands {
|
|
|
132586
132599
|
this._commands.forEach((cmds) => cmds.splice(0));
|
|
132587
132600
|
this._layers.clear();
|
|
132588
132601
|
}
|
|
132589
|
-
|
|
132602
|
+
initForPickOverlayDecorations(overlays) {
|
|
132603
|
+
for (const overlay of overlays) {
|
|
132604
|
+
const gf = overlay;
|
|
132605
|
+
if (gf.isPickable)
|
|
132606
|
+
gf.addCommands(this);
|
|
132607
|
+
}
|
|
132608
|
+
}
|
|
132609
|
+
initForPickOverlays(sceneOverlays, worldOverlayDecorations, viewOverlayDecorations) {
|
|
132590
132610
|
this._clearCommands();
|
|
132591
132611
|
this._addTranslucentAsOpaque = true;
|
|
132592
132612
|
for (const sceneGf of sceneOverlays)
|
|
132593
132613
|
sceneGf.addCommands(this);
|
|
132594
|
-
if (
|
|
132614
|
+
if (worldOverlayDecorations === null || worldOverlayDecorations === void 0 ? void 0 : worldOverlayDecorations.length) {
|
|
132595
132615
|
this.pushAndPopState(this.target.decorationsState, () => {
|
|
132596
|
-
|
|
132597
|
-
|
|
132598
|
-
|
|
132599
|
-
|
|
132600
|
-
|
|
132616
|
+
this.initForPickOverlayDecorations(worldOverlayDecorations);
|
|
132617
|
+
});
|
|
132618
|
+
}
|
|
132619
|
+
if (viewOverlayDecorations === null || viewOverlayDecorations === void 0 ? void 0 : viewOverlayDecorations.length) {
|
|
132620
|
+
this.pushAndPopState(this.target.decorationsState.withViewCoords(), () => {
|
|
132621
|
+
this.initForPickOverlayDecorations(viewOverlayDecorations);
|
|
132601
132622
|
});
|
|
132602
132623
|
}
|
|
132603
132624
|
this._addTranslucentAsOpaque = false;
|
|
@@ -134180,7 +134201,7 @@ class Compositor extends SceneCompositor {
|
|
|
134180
134201
|
this.target.popViewClip();
|
|
134181
134202
|
}
|
|
134182
134203
|
get fullHeight() { return this.target.viewRect.height; }
|
|
134183
|
-
drawForReadPixels(commands, sceneOverlays,
|
|
134204
|
+
drawForReadPixels(commands, sceneOverlays, worldOverlayDecorations, viewOverlayDecorations) {
|
|
134184
134205
|
this.target.beginPerfMetricRecord("Render Background", true);
|
|
134185
134206
|
if (!this.preDraw()) {
|
|
134186
134207
|
this.target.endPerfMetricRecord(true); // End Render Background record if returning
|
|
@@ -134221,11 +134242,11 @@ class Compositor extends SceneCompositor {
|
|
|
134221
134242
|
this.target.endPerfMetricRecord(true);
|
|
134222
134243
|
this.target.popViewClip();
|
|
134223
134244
|
}
|
|
134224
|
-
if (
|
|
134245
|
+
if (!sceneOverlays.length && !(worldOverlayDecorations === null || worldOverlayDecorations === void 0 ? void 0 : worldOverlayDecorations.length) && !(viewOverlayDecorations === null || viewOverlayDecorations === void 0 ? void 0 : viewOverlayDecorations.length))
|
|
134225
134246
|
return;
|
|
134226
134247
|
// Now populate the opaque passes with any pickable world overlays
|
|
134227
134248
|
this.target.beginPerfMetricRecord("Overlay Draws", true);
|
|
134228
|
-
commands.initForPickOverlays(sceneOverlays,
|
|
134249
|
+
commands.initForPickOverlays(sceneOverlays, worldOverlayDecorations, viewOverlayDecorations);
|
|
134229
134250
|
if (commands.isEmpty) {
|
|
134230
134251
|
this.target.endPerfMetricRecord(true); // End Overlay Draws record if returning
|
|
134231
134252
|
return;
|
|
@@ -139756,7 +139777,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
139756
139777
|
get frameStatsCollector() { return this._frameStatsCollector; }
|
|
139757
139778
|
assignFrameStatsCollector(collector) { this._frameStatsCollector = collector; }
|
|
139758
139779
|
paintScene(sceneMilSecElapsed) {
|
|
139759
|
-
var _a;
|
|
139780
|
+
var _a, _b;
|
|
139760
139781
|
if (!this._dcAssigned)
|
|
139761
139782
|
return;
|
|
139762
139783
|
this._frameStatsCollector.beginTime("totalFrameTime");
|
|
@@ -139771,7 +139792,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
139771
139792
|
// Set this to true to visualize the output of readPixels()...useful for debugging pick.
|
|
139772
139793
|
if (this.drawForReadPixels) {
|
|
139773
139794
|
this.beginReadPixels(_Pixel__WEBPACK_IMPORTED_MODULE_6__.Pixel.Selector.Feature);
|
|
139774
|
-
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay);
|
|
139795
|
+
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay, (_b = this.graphics.decorations) === null || _b === void 0 ? void 0 : _b.viewOverlay);
|
|
139775
139796
|
this.endReadPixels();
|
|
139776
139797
|
}
|
|
139777
139798
|
else {
|
|
@@ -139957,7 +139978,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
139957
139978
|
this._isReadPixelsInProgress = false;
|
|
139958
139979
|
}
|
|
139959
139980
|
readPixelsFromFbo(rect, selector) {
|
|
139960
|
-
var _a;
|
|
139981
|
+
var _a, _b;
|
|
139961
139982
|
// Create a culling frustum based on the input rect. We can't do this if a screen-space effect is going to move pixels around.
|
|
139962
139983
|
let rectFrust;
|
|
139963
139984
|
if (!this.renderSystem.screenSpaceEffects.shouldApply(this)) {
|
|
@@ -139988,7 +140009,7 @@ class Target extends _RenderTarget__WEBPACK_IMPORTED_MODULE_8__.RenderTarget {
|
|
|
139988
140009
|
}
|
|
139989
140010
|
this.beginReadPixels(selector, rectFrust);
|
|
139990
140011
|
// Draw the scene
|
|
139991
|
-
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay);
|
|
140012
|
+
this.compositor.drawForReadPixels(this._renderCommands, this.graphics.overlays, (_a = this.graphics.decorations) === null || _a === void 0 ? void 0 : _a.worldOverlay, (_b = this.graphics.decorations) === null || _b === void 0 ? void 0 : _b.viewOverlay);
|
|
139992
140013
|
if (this.performanceMetrics && !this.performanceMetrics.gatherCurPerformanceMetrics) { // Only collect readPixels data if in disp-perf-test-app
|
|
139993
140014
|
this.performanceMetrics.endOperation(); // End the 'CPU Total Time' operation
|
|
139994
140015
|
if (this.performanceMetrics.gatherGlFinish && !this.renderSystem.isGLTimerSupported) {
|
|
@@ -151726,7 +151747,7 @@ class BatchedTileIdMap {
|
|
|
151726
151747
|
const key = JSON.stringify(properties);
|
|
151727
151748
|
let entry = this._featureMap.get(key);
|
|
151728
151749
|
if (undefined === entry) {
|
|
151729
|
-
const id = this._iModel.transientIds.
|
|
151750
|
+
const id = this._iModel.transientIds.getNext();
|
|
151730
151751
|
entry = { id, properties };
|
|
151731
151752
|
this._featureMap.set(key, entry);
|
|
151732
151753
|
this._idMap.set(id, properties);
|
|
@@ -158087,7 +158108,7 @@ class RealityModelTileTree extends _internal__WEBPACK_IMPORTED_MODULE_7__.Realit
|
|
|
158087
158108
|
constructor(props) {
|
|
158088
158109
|
super();
|
|
158089
158110
|
this._name = undefined !== props.name ? props.name : "";
|
|
158090
|
-
this._modelId = props.modelId ? props.modelId : props.iModel.transientIds.
|
|
158111
|
+
this._modelId = props.modelId ? props.modelId : props.iModel.transientIds.getNext();
|
|
158091
158112
|
let transform;
|
|
158092
158113
|
if (undefined !== props.tilesetToDbTransform) {
|
|
158093
158114
|
const tf = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_2__.Transform.fromJSON(props.tilesetToDbTransform);
|
|
@@ -165821,7 +165842,7 @@ class ImageryMapLayerTreeSupplier {
|
|
|
165821
165842
|
if (undefined === imageryProvider)
|
|
165822
165843
|
return undefined;
|
|
165823
165844
|
await imageryProvider.initialize();
|
|
165824
|
-
const modelId = iModel.transientIds.
|
|
165845
|
+
const modelId = iModel.transientIds.getNext();
|
|
165825
165846
|
const tilingScheme = imageryProvider.tilingScheme;
|
|
165826
165847
|
const rootLevel = (1 === tilingScheme.numberOfLevelZeroTilesX && 1 === tilingScheme.numberOfLevelZeroTilesY) ? 0 : -1;
|
|
165827
165848
|
const rootTileId = new _internal__WEBPACK_IMPORTED_MODULE_4__.QuadId(rootLevel, 0, 0).contentId;
|
|
@@ -168385,7 +168406,7 @@ class MapTreeSupplier {
|
|
|
168385
168406
|
async createTileTree(id, iModel) {
|
|
168386
168407
|
let bimElevationBias = 0, terrainProvider, geodeticOffset = 0;
|
|
168387
168408
|
let applyTerrain = id.applyTerrain;
|
|
168388
|
-
const modelId = iModel.transientIds.
|
|
168409
|
+
const modelId = iModel.transientIds.getNext();
|
|
168389
168410
|
const gcsConverterAvailable = await getGcsConverterAvailable(iModel);
|
|
168390
168411
|
const terrainOpts = {
|
|
168391
168412
|
wantSkirts: id.wantSkirts,
|
|
@@ -172435,7 +172456,7 @@ class ViewClipDecoration extends _EditManipulator__WEBPACK_IMPORTED_MODULE_8__.E
|
|
|
172435
172456
|
this._suspendDecorator = false;
|
|
172436
172457
|
if (!this.getClipData())
|
|
172437
172458
|
return;
|
|
172438
|
-
this._clipId = this.iModel.transientIds.
|
|
172459
|
+
this._clipId = this.iModel.transientIds.getNext();
|
|
172439
172460
|
this.updateDecorationListener(true);
|
|
172440
172461
|
this._removeViewCloseListener = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.viewManager.onViewClose.addListener(this.onViewClose, this); // eslint-disable-line @typescript-eslint/unbound-method
|
|
172441
172462
|
if (undefined !== this._clipEventHandler && this._clipEventHandler.selectOnCreate())
|
|
@@ -172517,7 +172538,7 @@ class ViewClipDecoration extends _EditManipulator__WEBPACK_IMPORTED_MODULE_8__.E
|
|
|
172517
172538
|
if (numCurrent < numReqControls) {
|
|
172518
172539
|
const transientIds = this.iModel.transientIds;
|
|
172519
172540
|
for (let i = numCurrent; i < numReqControls; i++)
|
|
172520
|
-
this._controlIds[i] = transientIds.
|
|
172541
|
+
this._controlIds[i] = transientIds.getNext();
|
|
172521
172542
|
}
|
|
172522
172543
|
else if (numCurrent > numReqControls) {
|
|
172523
172544
|
this._controlIds.length = numReqControls;
|
|
@@ -174822,7 +174843,7 @@ class MeasureDistanceTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_11__.P
|
|
|
174822
174843
|
if (undefined === snapPoints)
|
|
174823
174844
|
return;
|
|
174824
174845
|
if (undefined === this._snapGeomId)
|
|
174825
|
-
this._snapGeomId = this.iModel.transientIds.
|
|
174846
|
+
this._snapGeomId = this.iModel.transientIds.getNext();
|
|
174826
174847
|
const builderSnapPts = context.createGraphicBuilder(_render_GraphicBuilder__WEBPACK_IMPORTED_MODULE_10__.GraphicType.WorldOverlay, undefined, this._snapGeomId);
|
|
174827
174848
|
const colorAccPts = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.white.adjustedForContrast(context.viewport.view.backgroundColor);
|
|
174828
174849
|
builderSnapPts.setSymbology(colorAccPts, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.black, 7);
|
|
@@ -221092,11 +221113,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
221092
221113
|
|
|
221093
221114
|
/* cspell:word cxcz, cxsz, cxcy, cxsy, sxcz, sxsz, sxcy, sxsy, cycz, cysz, sycz, sysz */
|
|
221094
221115
|
/**
|
|
221095
|
-
*
|
|
221096
|
-
* order in which to apply them.
|
|
221116
|
+
* represents a non-trivial rotation using three simple axis rotation angles and an order in which to apply them.
|
|
221097
221117
|
* * This class accommodates application-specific interpretation of "multiplying 3 rotation matrices" with regard to
|
|
221098
221118
|
* * Whether a "vector" is a "row" or a "column"
|
|
221099
221119
|
* * The order in which the X,Y,Z rotations are applied.
|
|
221120
|
+
* * This class bakes in angle rotation directions via create functions (i.e., createRadians, createDegrees, and
|
|
221121
|
+
* createAngles) so you can define each of the 3 rotations to be clockwise or counterclockwise. The default
|
|
221122
|
+
* rotation is counterclockwise.
|
|
221100
221123
|
* * Within the imodel geometry library, the preferred rotation order is encapsulated in `YawPitchRollAngles`.
|
|
221101
221124
|
* @alpha
|
|
221102
221125
|
*/
|
|
@@ -221148,7 +221171,7 @@ class OrderedRotationAngles {
|
|
|
221148
221171
|
get zRadians() {
|
|
221149
221172
|
return this._z.radians;
|
|
221150
221173
|
}
|
|
221151
|
-
/**
|
|
221174
|
+
/** the flag controlling whether vectors are treated as rows or as columns */
|
|
221152
221175
|
static get treatVectorsAsColumns() {
|
|
221153
221176
|
return OrderedRotationAngles._sTreatVectorsAsColumns;
|
|
221154
221177
|
}
|
|
@@ -221156,68 +221179,81 @@ class OrderedRotationAngles {
|
|
|
221156
221179
|
OrderedRotationAngles._sTreatVectorsAsColumns = value;
|
|
221157
221180
|
}
|
|
221158
221181
|
/**
|
|
221159
|
-
* Create an OrderedRotationAngles from three angles
|
|
221160
|
-
*
|
|
221161
|
-
* @param
|
|
221162
|
-
* @param
|
|
221182
|
+
* Create an OrderedRotationAngles from three angles (in radians), an ordering in which to apply them when
|
|
221183
|
+
* rotating, and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.
|
|
221184
|
+
* @param xRadians rotation around x
|
|
221185
|
+
* @param yRadians rotation around y
|
|
221186
|
+
* @param zRadians rotation around z
|
|
221163
221187
|
* @param order left to right order of axis names identifies the order that rotations are applied.
|
|
221164
221188
|
* For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
|
|
221165
221189
|
* * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
|
|
221166
221190
|
* matrix multiplication would be zRot*yRot*xRot
|
|
221167
|
-
|
|
221168
|
-
|
|
221191
|
+
* @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
|
|
221192
|
+
* rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
|
|
221193
|
+
* * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
|
|
221194
|
+
* @param result caller-allocated OrderedRotationAngles
|
|
221195
|
+
*/
|
|
221196
|
+
static createRadians(xRadians, yRadians, zRadians, order, xyzRotationIsClockwise, result) {
|
|
221197
|
+
if (!xyzRotationIsClockwise) {
|
|
221198
|
+
xyzRotationIsClockwise = [false, false, false];
|
|
221199
|
+
}
|
|
221200
|
+
const xRadian = xyzRotationIsClockwise[0] ? -xRadians : xRadians;
|
|
221201
|
+
const yRadian = xyzRotationIsClockwise[1] ? -yRadians : yRadians;
|
|
221202
|
+
const zRadian = xyzRotationIsClockwise[2] ? -zRadians : zRadians;
|
|
221169
221203
|
if (result) {
|
|
221170
|
-
result._x.
|
|
221171
|
-
result._y.
|
|
221172
|
-
result._z.
|
|
221204
|
+
result._x.setRadians(xRadian);
|
|
221205
|
+
result._y.setRadians(yRadian);
|
|
221206
|
+
result._z.setRadians(zRadian);
|
|
221173
221207
|
result._order = order;
|
|
221174
221208
|
return result;
|
|
221175
221209
|
}
|
|
221176
|
-
return new OrderedRotationAngles(
|
|
221210
|
+
return new OrderedRotationAngles(_Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(xRadian), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(yRadian), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(zRadian), order);
|
|
221177
221211
|
}
|
|
221178
221212
|
/**
|
|
221179
|
-
* Create an OrderedRotationAngles from three angles (in
|
|
221213
|
+
* Create an OrderedRotationAngles from three angles (in degrees) and an ordering in which to apply
|
|
221180
221214
|
* them when rotating.
|
|
221181
|
-
* @param
|
|
221182
|
-
* @param
|
|
221183
|
-
* @param
|
|
221215
|
+
* @param xDegrees rotation around x
|
|
221216
|
+
* @param yDegrees rotation around y
|
|
221217
|
+
* @param zDegrees rotation around z
|
|
221184
221218
|
* @param order left to right order of axis names identifies the order that rotations are applied.
|
|
221185
221219
|
* For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
|
|
221186
221220
|
* * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
|
|
221187
221221
|
* matrix multiplication would be zRot*yRot*xRot
|
|
221222
|
+
* @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
|
|
221223
|
+
* rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
|
|
221224
|
+
* * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
|
|
221225
|
+
* @param result caller-allocated OrderedRotationAngles
|
|
221188
221226
|
*/
|
|
221189
|
-
static
|
|
221190
|
-
|
|
221191
|
-
result._x.setRadians(xRadians);
|
|
221192
|
-
result._y.setRadians(yRadians);
|
|
221193
|
-
result._z.setRadians(zRadians);
|
|
221194
|
-
result._order = order;
|
|
221195
|
-
return result;
|
|
221196
|
-
}
|
|
221197
|
-
return new OrderedRotationAngles(_Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(xRadians), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(yRadians), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(zRadians), order);
|
|
221227
|
+
static createDegrees(xDegrees, yDegrees, zDegrees, order, xyzRotationIsClockwise, result) {
|
|
221228
|
+
return OrderedRotationAngles.createRadians(_Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.degreesToRadians(xDegrees), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.degreesToRadians(yDegrees), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.degreesToRadians(zDegrees), order, xyzRotationIsClockwise, result);
|
|
221198
221229
|
}
|
|
221199
221230
|
/**
|
|
221200
|
-
* Create an OrderedRotationAngles from three angles
|
|
221201
|
-
*
|
|
221202
|
-
* @param
|
|
221203
|
-
* @param
|
|
221204
|
-
* @param
|
|
221205
|
-
* @param order left to right order of axis names identifies the order that rotations are applied
|
|
221231
|
+
* Create an OrderedRotationAngles from three angles, an ordering in which to apply them when rotating,
|
|
221232
|
+
* and a flag triple controlling whether direction of x,y,z is clockwise or counterclockwise.
|
|
221233
|
+
* @param xRotation rotation around x
|
|
221234
|
+
* @param yRotation rotation around y
|
|
221235
|
+
* @param zRotation rotation around z
|
|
221236
|
+
* @param order left to right order of axis names identifies the order that rotations are applied
|
|
221206
221237
|
* For example XYZ means to rotate around x axis first, then y axis, and finally Z axis.
|
|
221207
221238
|
* * Note that rotation order is reverse of rotation matrix multiplication so for XYZ the rotation
|
|
221208
221239
|
* matrix multiplication would be zRot*yRot*xRot
|
|
221240
|
+
* @param xyzRotationIsClockwise the flags controlling whether direction of x,y,z is clockwise or counterclockwise.
|
|
221241
|
+
* rotation direction of x,y,z: true ---> clockwise - false ---> counterclockwise.
|
|
221242
|
+
* * if xyzRotationIsClockwise is undefined it's set to [false, false, false].
|
|
221243
|
+
* @param result caller-allocated OrderedRotationAngles
|
|
221209
221244
|
*/
|
|
221210
|
-
static
|
|
221211
|
-
|
|
221212
|
-
result._x.setDegrees(xDegrees);
|
|
221213
|
-
result._y.setDegrees(yDegrees);
|
|
221214
|
-
result._z.setDegrees(zDegrees);
|
|
221215
|
-
result._order = order;
|
|
221216
|
-
return result;
|
|
221217
|
-
}
|
|
221218
|
-
return new OrderedRotationAngles(_Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createDegrees(xDegrees), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createDegrees(yDegrees), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createDegrees(zDegrees), order);
|
|
221245
|
+
static createAngles(xRotation, yRotation, zRotation, order, xyzRotationIsClockwise, result) {
|
|
221246
|
+
return OrderedRotationAngles.createRadians(xRotation.radians, yRotation.radians, zRotation.radians, order, xyzRotationIsClockwise, result);
|
|
221219
221247
|
}
|
|
221220
|
-
/**
|
|
221248
|
+
/**
|
|
221249
|
+
* Create an OrderedRotationAngles from a 3x3 rotational matrix, given the ordering of axis rotations
|
|
221250
|
+
* that the matrix derives from.
|
|
221251
|
+
* * This function creates an OrderedRotationAngles with default angle rotation directions, i.e.,
|
|
221252
|
+
* it assumes all x, y, and z rotations are counterclockwise.
|
|
221253
|
+
* * In the failure case the method's return value is `undefined`.
|
|
221254
|
+
* * In the failure case, if the optional result was supplied, that result will nonetheless be filled with
|
|
221255
|
+
* a set of angles.
|
|
221256
|
+
* */
|
|
221221
221257
|
static createFromMatrix3d(matrix, order, result) {
|
|
221222
221258
|
// treat vector as columns
|
|
221223
221259
|
let m11 = matrix.coffs[0], m12 = matrix.coffs[1], m13 = matrix.coffs[2];
|
|
@@ -221240,13 +221276,19 @@ class OrderedRotationAngles {
|
|
|
221240
221276
|
zRad = Math.atan2(m21, m11);
|
|
221241
221277
|
}
|
|
221242
221278
|
else {
|
|
221243
|
-
|
|
221244
|
-
|
|
221245
|
-
|
|
221246
|
-
|
|
221247
|
-
|
|
221248
|
-
|
|
221249
|
-
|
|
221279
|
+
/**
|
|
221280
|
+
* If Math.abs(m31) = 1 then yRad = +-90 degrees and therefore, we have a gimbal lock.
|
|
221281
|
+
* This means xRad and zRad can be anything as long as their sum xRad + zRad is constant.
|
|
221282
|
+
* so we can pick zRad = 0 and calculate xRad (or pick xRad = 0 and calculate zRad).
|
|
221283
|
+
* Therefore, rotation matrix becomes
|
|
221284
|
+
* Matrix3d.createRowValues(
|
|
221285
|
+
* 0, +-sx, +-cx,
|
|
221286
|
+
* 0, cx, -sx,
|
|
221287
|
+
* -+1, 0, 0
|
|
221288
|
+
* );
|
|
221289
|
+
* Math details can be found
|
|
221290
|
+
* https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles
|
|
221291
|
+
*/
|
|
221250
221292
|
xRad = Math.atan2(-m23, m22);
|
|
221251
221293
|
zRad = 0;
|
|
221252
221294
|
}
|
|
@@ -221316,7 +221358,21 @@ class OrderedRotationAngles {
|
|
|
221316
221358
|
xRad = yRad = zRad = 0;
|
|
221317
221359
|
}
|
|
221318
221360
|
}
|
|
221319
|
-
|
|
221361
|
+
const xyzRotationIsClockwise = [false, false, false];
|
|
221362
|
+
const angles = OrderedRotationAngles.createRadians(xRad, yRad, zRad, order, xyzRotationIsClockwise, result);
|
|
221363
|
+
// sanity check
|
|
221364
|
+
const matrix1 = angles.toMatrix3d();
|
|
221365
|
+
/**
|
|
221366
|
+
* Below tolerance loosened to allow sanity check to pass for
|
|
221367
|
+
*
|
|
221368
|
+
* OrderedRotationAngles.createFromMatrix3d(
|
|
221369
|
+
* OrderedRotationAngles.createDegrees(0, 89.999, 0.001, AxisOrder.XYZ).toMatrix3d(),
|
|
221370
|
+
* AxisOrder.XYZ
|
|
221371
|
+
* );
|
|
221372
|
+
*
|
|
221373
|
+
* with treatVectorsAsColumns = true.
|
|
221374
|
+
*/
|
|
221375
|
+
return (matrix.maxDiff(matrix1) < 10 * _Geometry__WEBPACK_IMPORTED_MODULE_1__.Geometry.smallFraction) ? angles : undefined;
|
|
221320
221376
|
}
|
|
221321
221377
|
/**
|
|
221322
221378
|
* Create a 3x3 rotational matrix from this OrderedRotationAngles.
|
|
@@ -230411,39 +230467,62 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
230411
230467
|
|
|
230412
230468
|
|
|
230413
230469
|
|
|
230414
|
-
|
|
230415
|
-
|
|
230470
|
+
/**
|
|
230471
|
+
* Three angles that determine the orientation of an object in space, sometimes referred to as [Tait–Bryan angles]
|
|
230472
|
+
* (https://en.wikipedia.org/wiki/Euler_angles).
|
|
230416
230473
|
* * The matrix construction can be replicated by this logic:
|
|
230417
230474
|
* * xyz coordinates have
|
|
230418
230475
|
* * x forward
|
|
230419
230476
|
* * y to left
|
|
230420
230477
|
* * z up
|
|
230421
|
-
*
|
|
230422
|
-
*
|
|
230478
|
+
* * Note that this is a right handed coordinate system.
|
|
230479
|
+
* * yaw is a rotation of x towards y, i.e. around positive z (counterclockwise):
|
|
230423
230480
|
* * `yawMatrix = Matrix3d.createRotationAroundAxisIndex(2, Angle.createDegrees(yawDegrees));`
|
|
230424
|
-
*
|
|
230481
|
+
* * pitch is a rotation that raises x towards z, i.e. rotation around **negative y** (**clockwise**):
|
|
230425
230482
|
* * `pitchMatrix = Matrix3d.createRotationAroundAxisIndex(1, Angle.createDegrees(-pitchDegrees));`
|
|
230426
|
-
*
|
|
230483
|
+
* * roll is rotation of y towards z, i.e. rotation around positive x (counterclockwise):
|
|
230427
230484
|
* * `rollMatrix = Matrix3d.createRotationAroundAxisIndex(0, Angle.createDegrees(rollDegrees));`
|
|
230428
|
-
*
|
|
230485
|
+
* * The YPR matrix is the product
|
|
230429
230486
|
* * `result = yawMatrix.multiplyMatrixMatrix(pitchMatrix.multiplyMatrixMatrix(rollMatrix));`
|
|
230430
|
-
*
|
|
230431
|
-
*
|
|
230487
|
+
* * Note that this is for "column based" matrix with vectors multiplying on the right of the matrix.
|
|
230488
|
+
* Hence a vector is first rotated by roll, then the pitch, finally yaw. So multiplication order in
|
|
230489
|
+
* the sense of AxisOrder is `RPY` (i.e., XYZ), in contrast to the familiar name `YPR`.
|
|
230432
230490
|
* @public
|
|
230433
230491
|
*/
|
|
230434
230492
|
class YawPitchRollAngles {
|
|
230493
|
+
/**
|
|
230494
|
+
* constructor
|
|
230495
|
+
* @param yaw counterclockwise rotation angle around z
|
|
230496
|
+
* @param pitch **clockwise** rotation angle around y
|
|
230497
|
+
* @param roll counterclockwise rotation angle around x
|
|
230498
|
+
* */
|
|
230435
230499
|
constructor(yaw = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.zero(), pitch = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.zero(), roll = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.zero()) {
|
|
230436
230500
|
this.yaw = yaw;
|
|
230437
230501
|
this.pitch = pitch;
|
|
230438
230502
|
this.roll = roll;
|
|
230439
230503
|
}
|
|
230440
230504
|
/** Freeze this YawPitchRollAngles */
|
|
230441
|
-
freeze() {
|
|
230442
|
-
|
|
230505
|
+
freeze() {
|
|
230506
|
+
this.yaw.freeze();
|
|
230507
|
+
this.pitch.freeze();
|
|
230508
|
+
this.roll.freeze();
|
|
230509
|
+
return Object.freeze(this);
|
|
230510
|
+
}
|
|
230511
|
+
/**
|
|
230512
|
+
* constructor for YawPitchRollAngles with angles in degrees.
|
|
230513
|
+
* @param yawDegrees counterclockwise rotation angle (in degrees) around z
|
|
230514
|
+
* @param pitchDegrees **clockwise** rotation angle (in degrees) around y
|
|
230515
|
+
* @param rollDegrees counterclockwise rotation angle (in degrees) around x
|
|
230516
|
+
* */
|
|
230443
230517
|
static createDegrees(yawDegrees, pitchDegrees, rollDegrees) {
|
|
230444
230518
|
return new YawPitchRollAngles(_Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createDegrees(yawDegrees), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createDegrees(pitchDegrees), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createDegrees(rollDegrees));
|
|
230445
230519
|
}
|
|
230446
|
-
/**
|
|
230520
|
+
/**
|
|
230521
|
+
* constructor for YawPitchRollAngles with angles in radians.
|
|
230522
|
+
* @param yawRadians counterclockwise rotation angle (in radians) around z
|
|
230523
|
+
* @param pitchRadians **clockwise** rotation angle (in radians) around y
|
|
230524
|
+
* @param rollRadians counterclockwise rotation angle (in radians) around x
|
|
230525
|
+
* */
|
|
230447
230526
|
static createRadians(yawRadians, pitchRadians, rollRadians) {
|
|
230448
230527
|
return new YawPitchRollAngles(_Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(yawRadians), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(pitchRadians), _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(rollRadians));
|
|
230449
230528
|
}
|
|
@@ -230459,7 +230538,10 @@ class YawPitchRollAngles {
|
|
|
230459
230538
|
this.pitch = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.fromJSON(json.pitch);
|
|
230460
230539
|
this.roll = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.fromJSON(json.roll);
|
|
230461
230540
|
}
|
|
230462
|
-
/**
|
|
230541
|
+
/**
|
|
230542
|
+
* Convert to a JSON object of form { pitch: 20 , roll: 30 , yaw: 10 }. Angles are in degrees.
|
|
230543
|
+
* Any values that are exactly zero (with tolerance `Geometry.smallAngleRadians`) are omitted.
|
|
230544
|
+
**/
|
|
230463
230545
|
toJSON() {
|
|
230464
230546
|
const val = {};
|
|
230465
230547
|
if (!this.pitch.isAlmostZero)
|
|
@@ -230480,7 +230562,7 @@ class YawPitchRollAngles {
|
|
|
230480
230562
|
this.roll.setFrom(other.roll);
|
|
230481
230563
|
}
|
|
230482
230564
|
/**
|
|
230483
|
-
*
|
|
230565
|
+
* Compare angles between `this` and `other`.
|
|
230484
230566
|
* * Comparisons are via `isAlmostEqualAllowPeriodShift`.
|
|
230485
230567
|
* @param other YawPitchRollAngles source
|
|
230486
230568
|
*/
|
|
@@ -230492,30 +230574,47 @@ class YawPitchRollAngles {
|
|
|
230492
230574
|
/**
|
|
230493
230575
|
* Make a copy of this YawPitchRollAngles.
|
|
230494
230576
|
*/
|
|
230495
|
-
clone() {
|
|
230577
|
+
clone() {
|
|
230578
|
+
return new YawPitchRollAngles(this.yaw.clone(), this.pitch.clone(), this.roll.clone());
|
|
230579
|
+
}
|
|
230496
230580
|
/**
|
|
230497
230581
|
* Expand the angles into a (rigid rotation) matrix.
|
|
230498
230582
|
*
|
|
230499
|
-
* * The returned matrix is "rigid"
|
|
230500
|
-
* * The
|
|
230583
|
+
* * The returned matrix is "rigid" (i.e., it has unit length rows and columns, and its transpose is its inverse).
|
|
230584
|
+
* * The rigid matrix is always a right handed coordinate system.
|
|
230501
230585
|
* @param result optional pre-allocated `Matrix3d`
|
|
230502
230586
|
*/
|
|
230503
230587
|
toMatrix3d(result) {
|
|
230504
|
-
const
|
|
230505
|
-
const
|
|
230506
|
-
const
|
|
230507
|
-
const
|
|
230508
|
-
const
|
|
230509
|
-
const
|
|
230510
|
-
|
|
230511
|
-
|
|
230512
|
-
|
|
230513
|
-
|
|
230514
|
-
|
|
230515
|
-
|
|
230516
|
-
|
|
230517
|
-
|
|
230518
|
-
|
|
230588
|
+
const cz = Math.cos(this.yaw.radians);
|
|
230589
|
+
const sz = Math.sin(this.yaw.radians);
|
|
230590
|
+
const cy = Math.cos(this.pitch.radians);
|
|
230591
|
+
const sy = Math.sin(this.pitch.radians);
|
|
230592
|
+
const cx = Math.cos(this.roll.radians);
|
|
230593
|
+
const sx = Math.sin(this.roll.radians);
|
|
230594
|
+
/**
|
|
230595
|
+
* The axis order is XYZ (i.e., RPY) so the rotation matrix is calculated via rZ*rY*rX where
|
|
230596
|
+
* rX, rY, and rZ are base rotation matrixes:
|
|
230597
|
+
*
|
|
230598
|
+
* const rX = Matrix3d.createRowValues(
|
|
230599
|
+
* 1, 0, 0,
|
|
230600
|
+
* 0, Math.cos(x), -Math.sin(x),
|
|
230601
|
+
* 0, Math.sin(x), Math.cos(x),
|
|
230602
|
+
* );
|
|
230603
|
+
* const rY = Matrix3d.createRowValues(
|
|
230604
|
+
* Math.cos(y), 0, Math.sin(y),
|
|
230605
|
+
* 0, 1, 0,
|
|
230606
|
+
* -Math.sin(y), 0, Math.cos(y),
|
|
230607
|
+
* );
|
|
230608
|
+
* const rZ = Matrix3d.createRowValues(
|
|
230609
|
+
* Math.cos(z), -Math.sin(z), 0,
|
|
230610
|
+
* Math.sin(z), Math.cos(z), 0,
|
|
230611
|
+
* 0, 0, 1,
|
|
230612
|
+
* );
|
|
230613
|
+
*
|
|
230614
|
+
* Then we replace sin(y) with -sin(y) because y rotation (i.e., pitch) is clockwise (alternatively, you
|
|
230615
|
+
* can use transpose of rY in the matrix multiplication to get the same result)
|
|
230616
|
+
*/
|
|
230617
|
+
return _Matrix3d__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.createRowValues(cz * cy, -(sz * cx + cz * sy * sx), (sz * sx - cz * sy * cx), sz * cy, (cz * cx - sz * sy * sx), -(cz * sx + sz * sy * cx), sy, cy * sx, cy * cx, result);
|
|
230519
230618
|
}
|
|
230520
230619
|
/** Returns true if this rotation does nothing.
|
|
230521
230620
|
* * If allowPeriodShift is false, any nonzero angle is considered a non-identity
|
|
@@ -230531,52 +230630,104 @@ class YawPitchRollAngles {
|
|
|
230531
230630
|
&& _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.isAlmostEqualRadiansNoPeriodShift(0.0, this.pitch.radians)
|
|
230532
230631
|
&& _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.isAlmostEqualRadiansNoPeriodShift(0.0, this.roll.radians);
|
|
230533
230632
|
}
|
|
230633
|
+
/** Return the largest angle in radians */
|
|
230634
|
+
maxAbsRadians() {
|
|
230635
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.maxAbsXYZ(this.yaw.radians, this.pitch.radians, this.roll.radians);
|
|
230636
|
+
}
|
|
230637
|
+
/** Return the sum of the angles in squared radians */
|
|
230638
|
+
sumSquaredRadians() {
|
|
230639
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.hypotenuseSquaredXYZ(this.yaw.radians, this.pitch.radians, this.roll.radians);
|
|
230640
|
+
}
|
|
230534
230641
|
/** Return the largest difference of angles (in radians) between this and other */
|
|
230535
230642
|
maxDiffRadians(other) {
|
|
230536
230643
|
return Math.max(this.yaw.radians - other.yaw.radians, this.pitch.radians - other.pitch.radians, this.roll.radians - other.roll.radians);
|
|
230537
230644
|
}
|
|
230538
230645
|
/** Return the largest angle in degrees. */
|
|
230539
|
-
maxAbsDegrees() {
|
|
230646
|
+
maxAbsDegrees() {
|
|
230647
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.maxAbsXYZ(this.yaw.degrees, this.pitch.degrees, this.roll.degrees);
|
|
230648
|
+
}
|
|
230540
230649
|
/** Return the sum of squared angles in degrees. */
|
|
230541
|
-
sumSquaredDegrees() {
|
|
230650
|
+
sumSquaredDegrees() {
|
|
230651
|
+
return _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.hypotenuseSquaredXYZ(this.yaw.degrees, this.pitch.degrees, this.roll.degrees);
|
|
230652
|
+
}
|
|
230653
|
+
/** Return the largest difference of angles (in degrees) between this and other */
|
|
230654
|
+
maxDiffDegrees(other) {
|
|
230655
|
+
return Math.max(this.yaw.degrees - other.yaw.degrees, this.pitch.degrees - other.pitch.degrees, this.roll.degrees - other.roll.degrees);
|
|
230656
|
+
}
|
|
230542
230657
|
/** Return an object from a Transform as an origin and YawPitchRollAngles. */
|
|
230543
230658
|
static tryFromTransform(transform) {
|
|
230544
|
-
// bundle up the transform's origin with the angle data extracted from the transform
|
|
230545
230659
|
return {
|
|
230546
|
-
angles: YawPitchRollAngles.createFromMatrix3d(transform.matrix),
|
|
230547
230660
|
origin: _Point3dVector3d__WEBPACK_IMPORTED_MODULE_3__.Point3d.createFrom(transform.origin),
|
|
230661
|
+
angles: YawPitchRollAngles.createFromMatrix3d(transform.matrix),
|
|
230548
230662
|
};
|
|
230549
230663
|
}
|
|
230550
|
-
/** Attempts to create a YawPitchRollAngles object from
|
|
230551
|
-
* * This conversion fails if the matrix is not rigid (unit rows and columns, transpose is inverse)
|
|
230664
|
+
/** Attempts to create a YawPitchRollAngles object from a Matrix3d
|
|
230665
|
+
* * This conversion fails if the matrix is not rigid (unit rows and columns, and transpose is inverse)
|
|
230552
230666
|
* * In the failure case the method's return value is `undefined`.
|
|
230553
|
-
* * In the failure case, if the optional result was supplied, that result will nonetheless be filled with
|
|
230667
|
+
* * In the failure case, if the optional result was supplied, that result will nonetheless be filled with
|
|
230668
|
+
* a set of angles.
|
|
230554
230669
|
*/
|
|
230555
230670
|
static createFromMatrix3d(matrix, result) {
|
|
230556
|
-
|
|
230557
|
-
|
|
230558
|
-
|
|
230559
|
-
|
|
230560
|
-
|
|
230561
|
-
|
|
230671
|
+
/**
|
|
230672
|
+
* The rotation matrix for is
|
|
230673
|
+
*
|
|
230674
|
+
* Matrix3d.createRowValues(
|
|
230675
|
+
* cz * cy, -(sz * cx + cz * sy * sx), (sz * sx - cz * sy * cx),
|
|
230676
|
+
* sz * cy, (cz * cx - sz * sy * sx), -(cz * sx + sz * sy * cx),
|
|
230677
|
+
* sy, cy * sx, cy * cx
|
|
230678
|
+
* );
|
|
230679
|
+
*
|
|
230680
|
+
* where cx = cos(x), sx = sin(x), cy = cos(y), sy = sin(y), cz = cos(z), and sz = sin(z)
|
|
230681
|
+
*/
|
|
230682
|
+
const sy = matrix.at(2, 0); // sin(y)
|
|
230683
|
+
const cy = Math.sqrt(matrix.at(2, 1) * matrix.at(2, 1) + matrix.at(2, 2) * matrix.at(2, 2)); // |cos(y)|
|
|
230684
|
+
const pitchA = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(sy, cy); // with positive cosine
|
|
230685
|
+
const pitchB = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(sy, -cy); // with negative cosine
|
|
230686
|
+
const angles = result ? result : new YawPitchRollAngles();
|
|
230687
|
+
/**
|
|
230688
|
+
* If cos(y) = 0 then y = +-90 degrees so we have a gimbal lock.
|
|
230689
|
+
* This means x and z can be anything as long as their sum x + z is constant.
|
|
230690
|
+
* so we can pick z = 0 and calculate x (or pick x = 0 and calculate z).
|
|
230691
|
+
* Math details can be found
|
|
230692
|
+
* https://en.wikipedia.org/wiki/Gimbal_lock#Loss_of_a_degree_of_freedom_with_Euler_angles
|
|
230693
|
+
*
|
|
230694
|
+
* The rotation matrix for y = +-90 degrees and x = 0 becomes
|
|
230695
|
+
*
|
|
230696
|
+
* Matrix3d.createRowValues(
|
|
230697
|
+
* 0, -sz, -+cz,
|
|
230698
|
+
* 0, cz, -+sz,
|
|
230699
|
+
* +-1, 0, 0
|
|
230700
|
+
* );
|
|
230701
|
+
*
|
|
230702
|
+
* so z = atan(sz/cz) = atan(-matrix.at(0, 1), matrix.at(1, 1))
|
|
230703
|
+
*/
|
|
230704
|
+
if (cy < _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallAngleRadians) {
|
|
230562
230705
|
angles.yaw = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(-matrix.at(0, 1), matrix.at(1, 1));
|
|
230563
|
-
angles.pitch = pitchA;
|
|
230706
|
+
angles.pitch = pitchA; // this is an arbitrary choice. can pick pitchB instead.
|
|
230564
230707
|
angles.roll = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createRadians(0.0);
|
|
230565
230708
|
}
|
|
230566
230709
|
else {
|
|
230710
|
+
/**
|
|
230711
|
+
* positive cosine
|
|
230712
|
+
* z = atan(sz/cz) = atan(matrix.at(1, 0), matrix.at(0, 0))
|
|
230713
|
+
* x = atan(sx/cx) = atan(matrix.at(2, 1), matrix.at(2, 2))
|
|
230714
|
+
*/
|
|
230567
230715
|
const yawA = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(matrix.at(1, 0), matrix.at(0, 0));
|
|
230568
230716
|
const rollA = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(matrix.at(2, 1), matrix.at(2, 2));
|
|
230717
|
+
// similar with negative cosine
|
|
230569
230718
|
const yawB = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(-matrix.at(1, 0), -matrix.at(0, 0));
|
|
230570
230719
|
const rollB = _Angle__WEBPACK_IMPORTED_MODULE_0__.Angle.createAtan2(-matrix.at(2, 1), -matrix.at(2, 2));
|
|
230720
|
+
// create YPR
|
|
230571
230721
|
const yprA = new YawPitchRollAngles(yawA, pitchA, rollA);
|
|
230572
230722
|
const yprB = new YawPitchRollAngles(yawB, pitchB, rollB);
|
|
230723
|
+
// decide to pick yprA or yprB with smallest magnitude angles
|
|
230573
230724
|
const absFactor = 0.95;
|
|
230574
|
-
const
|
|
230575
|
-
const
|
|
230576
|
-
if (
|
|
230725
|
+
const maxRadiansA = yprA.maxAbsRadians();
|
|
230726
|
+
const maxRadiansB = yprB.maxAbsRadians();
|
|
230727
|
+
if (maxRadiansA < absFactor * maxRadiansB) {
|
|
230577
230728
|
angles.setFrom(yprA);
|
|
230578
230729
|
}
|
|
230579
|
-
else if (
|
|
230730
|
+
else if (maxRadiansB < absFactor * maxRadiansA) {
|
|
230580
230731
|
angles.setFrom(yprB);
|
|
230581
230732
|
}
|
|
230582
230733
|
else {
|
|
@@ -230590,6 +230741,7 @@ class YawPitchRollAngles {
|
|
|
230590
230741
|
}
|
|
230591
230742
|
}
|
|
230592
230743
|
}
|
|
230744
|
+
// sanity check
|
|
230593
230745
|
const matrix1 = angles.toMatrix3d();
|
|
230594
230746
|
return matrix.maxDiff(matrix1) < _Geometry__WEBPACK_IMPORTED_MODULE_2__.Geometry.smallAngleRadians ? angles : undefined;
|
|
230595
230747
|
}
|
|
@@ -243557,6 +243709,85 @@ class PolyfaceQuery {
|
|
|
243557
243709
|
const inertiaProducts = PolyfaceQuery.sumFacetSecondVolumeMomentProducts(source, origin);
|
|
243558
243710
|
return _geometry4d_MomentData__WEBPACK_IMPORTED_MODULE_7__.MomentData.inertiaProductsToPrincipalAxes(origin, inertiaProducts);
|
|
243559
243711
|
}
|
|
243712
|
+
/**
|
|
243713
|
+
* Test for convex volume by dihedral angle tests on all edges.
|
|
243714
|
+
* * This tests if all dihedral angles are positive.
|
|
243715
|
+
* * In a closed solid, this is a strong test for overall convexity.
|
|
243716
|
+
* * With `ignoreBoundaries` true, this may be a useful test when all the facets are in a single edge-connected component, such as a pyramid with no underside.
|
|
243717
|
+
* * It is not a correct test if there are multiple, disjoint components.
|
|
243718
|
+
* * Take the above-mentioned pyramid with no underside.
|
|
243719
|
+
* * Within the same mesh, have a second pyramid placed to the side, still facing upward.
|
|
243720
|
+
* * The angles will pass the dihedral convexity test, but the composite thing surely is not convex.
|
|
243721
|
+
* @param source mesh to examine
|
|
243722
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
243723
|
+
* @returns true if the mesh is closed and has all dihedral angles (angle across edge) positive
|
|
243724
|
+
*/
|
|
243725
|
+
static isConvexByDihedralAngleCount(source, ignoreBoundaries = false) {
|
|
243726
|
+
return this.dihedralAngleSummary(source, ignoreBoundaries) > 0;
|
|
243727
|
+
}
|
|
243728
|
+
/**
|
|
243729
|
+
* Compute a number summarizing the dihedral angles in the mesh.
|
|
243730
|
+
* @see [[isConvexByDihedralAngleCount]] for comments about ignoreBoundaries===true when there are multiple connected components.
|
|
243731
|
+
* @param source mesh to examine
|
|
243732
|
+
* @param ignoreBoundaries if true, ignore simple boundary edges, i.e. allow unclosed meshes.
|
|
243733
|
+
* @returns a number summarizing the dihedral angles in the mesh.
|
|
243734
|
+
* * Return 1 if all angles are positive or planar. The mesh is probably convex with outward normals.
|
|
243735
|
+
* * Return -1 if all angles are negative or planar. The mesh is probably convex with inward normals.
|
|
243736
|
+
* * Return 0 if
|
|
243737
|
+
* * angles area mixed
|
|
243738
|
+
* * any edge has other than 1 incident facet or more than 2 incident facets.
|
|
243739
|
+
* * (but null edges are permitted -- These occur naturally at edges of quads at north or south pole)
|
|
243740
|
+
*/
|
|
243741
|
+
static dihedralAngleSummary(source, ignoreBoundaries = false) {
|
|
243742
|
+
const edges = new _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_9__.IndexedEdgeMatcher();
|
|
243743
|
+
const visitor = source.createVisitor(1);
|
|
243744
|
+
visitor.reset();
|
|
243745
|
+
const centroidNormal = [];
|
|
243746
|
+
let normalCounter = 0;
|
|
243747
|
+
while (visitor.moveToNextFacet()) {
|
|
243748
|
+
const numEdges = visitor.pointCount - 1;
|
|
243749
|
+
const normal = _geometry3d_PolygonOps__WEBPACK_IMPORTED_MODULE_4__.PolygonOps.centroidAreaNormal(visitor.point);
|
|
243750
|
+
if (normal === undefined)
|
|
243751
|
+
return 0;
|
|
243752
|
+
centroidNormal.push(normal);
|
|
243753
|
+
for (let i = 0; i < numEdges; i++) {
|
|
243754
|
+
edges.addEdge(visitor.clientPointIndex(i), visitor.clientPointIndex(i + 1), normalCounter);
|
|
243755
|
+
}
|
|
243756
|
+
normalCounter++;
|
|
243757
|
+
}
|
|
243758
|
+
const badClusters = [];
|
|
243759
|
+
const manifoldClusters = [];
|
|
243760
|
+
edges.sortAndCollectClusters(manifoldClusters, ignoreBoundaries ? undefined : badClusters, undefined, badClusters);
|
|
243761
|
+
if (badClusters.length > 0)
|
|
243762
|
+
return 0;
|
|
243763
|
+
let numPositive = 0;
|
|
243764
|
+
let numPlanar = 0;
|
|
243765
|
+
let numNegative = 0;
|
|
243766
|
+
const edgeVector = _geometry3d_Point3dVector3d__WEBPACK_IMPORTED_MODULE_6__.Vector3d.create();
|
|
243767
|
+
for (const cluster of manifoldClusters) {
|
|
243768
|
+
const sideA = cluster.at(0);
|
|
243769
|
+
const sideB = cluster.at(1);
|
|
243770
|
+
if (sideA instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_9__.SortableEdge
|
|
243771
|
+
&& sideB instanceof _IndexedEdgeMatcher__WEBPACK_IMPORTED_MODULE_9__.SortableEdge
|
|
243772
|
+
&& source.data.point.vectorIndexIndex(sideA.vertexIndexA, sideA.vertexIndexB, edgeVector)) {
|
|
243773
|
+
const dihedralAngle = centroidNormal[sideA.facetIndex].direction.signedAngleTo(centroidNormal[sideB.facetIndex].direction, edgeVector);
|
|
243774
|
+
if (dihedralAngle.isAlmostZero)
|
|
243775
|
+
numPlanar++;
|
|
243776
|
+
else if (dihedralAngle.radians > 0.0)
|
|
243777
|
+
numPositive++;
|
|
243778
|
+
else
|
|
243779
|
+
numNegative++;
|
|
243780
|
+
}
|
|
243781
|
+
}
|
|
243782
|
+
if (numPositive > 0 && numNegative === 0)
|
|
243783
|
+
return 1;
|
|
243784
|
+
if (numNegative > 0 && numPositive === 0)
|
|
243785
|
+
return -1;
|
|
243786
|
+
// problem case: if all edges have zero dihedral angle, record it as convex.
|
|
243787
|
+
if (numPlanar > 0 && numPositive === 0 && numNegative === 0)
|
|
243788
|
+
return 1;
|
|
243789
|
+
return 0;
|
|
243790
|
+
}
|
|
243560
243791
|
/**
|
|
243561
243792
|
* Test if the facets in `source` occur in perfectly mated pairs, as is required for a closed manifold volume.
|
|
243562
243793
|
*/
|
|
@@ -285942,7 +286173,7 @@ class TestContext {
|
|
|
285942
286173
|
this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
|
|
285943
286174
|
const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
|
|
285944
286175
|
await core_frontend_1.NoRenderApp.startup({
|
|
285945
|
-
applicationVersion: "3.6.0-dev.
|
|
286176
|
+
applicationVersion: "3.6.0-dev.22",
|
|
285946
286177
|
applicationId: this.settings.gprid,
|
|
285947
286178
|
authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
|
|
285948
286179
|
hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
|
|
@@ -291889,7 +292120,10 @@ class IpcRequestsHandler {
|
|
|
291889
292120
|
const jsonParams = {
|
|
291890
292121
|
...params,
|
|
291891
292122
|
clientId: this.clientId,
|
|
291892
|
-
|
|
292123
|
+
stateChanges: params.stateChanges.map((sc) => ({
|
|
292124
|
+
...sc,
|
|
292125
|
+
...(sc.nodeKey ? { nodeKey: _itwin_presentation_common__WEBPACK_IMPORTED_MODULE_1__.NodeKey.toJSON(sc.nodeKey) } : undefined),
|
|
292126
|
+
})),
|
|
291893
292127
|
};
|
|
291894
292128
|
return this.call("updateHierarchyState", jsonParams);
|
|
291895
292129
|
}
|
|
@@ -292879,6 +293113,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
292879
293113
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
292880
293114
|
/* harmony export */ "StateTracker": () => (/* binding */ StateTracker)
|
|
292881
293115
|
/* harmony export */ });
|
|
293116
|
+
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
292882
293117
|
/*---------------------------------------------------------------------------------------------
|
|
292883
293118
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
292884
293119
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -292886,67 +293121,122 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
292886
293121
|
/** @packageDocumentation
|
|
292887
293122
|
* @module Core
|
|
292888
293123
|
*/
|
|
292889
|
-
|
|
293124
|
+
|
|
293125
|
+
/**
|
|
293126
|
+
* The tracker stores up-to-date UI state of the hierarchies on the frontend and reports
|
|
293127
|
+
* just the state changes to the backend as soon as component sends in a new hierarchy state.
|
|
293128
|
+
*
|
|
293129
|
+
* @internal
|
|
293130
|
+
*/
|
|
292890
293131
|
class StateTracker {
|
|
292891
293132
|
constructor(ipcRequestsHandler) {
|
|
292892
293133
|
this._ipcRequestsHandler = ipcRequestsHandler;
|
|
292893
|
-
this.
|
|
293134
|
+
this._hierarchyStates = new Map();
|
|
292894
293135
|
}
|
|
292895
|
-
async updateHierarchyStateIfNeeded(imodelKey, rulesetId,
|
|
292896
|
-
if (
|
|
293136
|
+
async updateHierarchyStateIfNeeded(imodelKey, rulesetId, stateChanges) {
|
|
293137
|
+
if (stateChanges.length === 0)
|
|
292897
293138
|
return;
|
|
292898
|
-
await this._ipcRequestsHandler.updateHierarchyState({ imodelKey, rulesetId,
|
|
293139
|
+
await this._ipcRequestsHandler.updateHierarchyState({ imodelKey, rulesetId, stateChanges });
|
|
292899
293140
|
}
|
|
292900
293141
|
async onHierarchyClosed(imodel, rulesetId, sourceId) {
|
|
292901
|
-
const
|
|
292902
|
-
if (!
|
|
293142
|
+
const hierarchyState = this._hierarchyStates.get(rulesetId);
|
|
293143
|
+
if (!hierarchyState)
|
|
292903
293144
|
return;
|
|
292904
|
-
const
|
|
292905
|
-
|
|
292906
|
-
|
|
292907
|
-
|
|
292908
|
-
|
|
292909
|
-
|
|
292910
|
-
|
|
292911
|
-
|
|
292912
|
-
|
|
292913
|
-
|
|
292914
|
-
|
|
292915
|
-
await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, "nodesCollapsed", removedKeys);
|
|
293145
|
+
const stateChanges = [];
|
|
293146
|
+
hierarchyState.forEach((entry) => {
|
|
293147
|
+
if (!entry.states.has(sourceId)) {
|
|
293148
|
+
// the node has no state for this source - nothing to do
|
|
293149
|
+
return;
|
|
293150
|
+
}
|
|
293151
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.using)(new MergedNodeStateChangeReporter(entry, stateChanges), (_) => {
|
|
293152
|
+
entry.states.delete(sourceId);
|
|
293153
|
+
});
|
|
293154
|
+
});
|
|
293155
|
+
await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, stateChanges);
|
|
292916
293156
|
}
|
|
292917
|
-
async
|
|
292918
|
-
let
|
|
292919
|
-
if (
|
|
292920
|
-
|
|
292921
|
-
|
|
292922
|
-
|
|
292923
|
-
this.
|
|
292924
|
-
}
|
|
292925
|
-
const
|
|
292926
|
-
const
|
|
292927
|
-
|
|
292928
|
-
|
|
292929
|
-
|
|
292930
|
-
|
|
292931
|
-
|
|
293157
|
+
async onHierarchyStateChanged(imodel, rulesetId, sourceId, newHierarchyState) {
|
|
293158
|
+
let hierarchyState = this._hierarchyStates.get(rulesetId);
|
|
293159
|
+
if (!hierarchyState) {
|
|
293160
|
+
if (newHierarchyState.length === 0)
|
|
293161
|
+
return;
|
|
293162
|
+
hierarchyState = new Map();
|
|
293163
|
+
this._hierarchyStates.set(rulesetId, hierarchyState);
|
|
293164
|
+
}
|
|
293165
|
+
const handledNodeIds = new Set();
|
|
293166
|
+
const stateChanges = [];
|
|
293167
|
+
// step 1: walk over new state and report all changes
|
|
293168
|
+
newHierarchyState.forEach(({ node, state }) => {
|
|
293169
|
+
const nodeId = node === null || node === void 0 ? void 0 : node.id;
|
|
293170
|
+
const nodeKey = node === null || node === void 0 ? void 0 : node.key;
|
|
293171
|
+
const existingNodeEntry = hierarchyState.get(nodeId);
|
|
293172
|
+
if (existingNodeEntry) {
|
|
293173
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.using)(new MergedNodeStateChangeReporter(existingNodeEntry, stateChanges), (_) => {
|
|
293174
|
+
existingNodeEntry.states.set(sourceId, state);
|
|
293175
|
+
});
|
|
292932
293176
|
}
|
|
292933
|
-
|
|
292934
|
-
|
|
292935
|
-
|
|
292936
|
-
|
|
292937
|
-
|
|
292938
|
-
|
|
293177
|
+
else {
|
|
293178
|
+
hierarchyState.set(nodeId, { key: nodeKey, states: new Map([[sourceId, state]]) });
|
|
293179
|
+
stateChanges.push({ ...calculateMergedNodeState([state].values()), nodeKey });
|
|
293180
|
+
}
|
|
293181
|
+
handledNodeIds.add(nodeId);
|
|
293182
|
+
});
|
|
293183
|
+
// step 2: walk over old state and remove all state that's not in the new state
|
|
293184
|
+
const erasedNodeIds = new Set();
|
|
293185
|
+
hierarchyState.forEach((entry, nodeId) => {
|
|
293186
|
+
if (handledNodeIds.has(nodeId)) {
|
|
293187
|
+
// the node was handled with the new state - nothing to do here
|
|
293188
|
+
return;
|
|
293189
|
+
}
|
|
293190
|
+
if (!entry.states.has(sourceId)) {
|
|
293191
|
+
// the node had no state for this source, so it's not affected by this report
|
|
293192
|
+
return;
|
|
293193
|
+
}
|
|
293194
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.using)(new MergedNodeStateChangeReporter(entry, stateChanges), (_) => {
|
|
293195
|
+
entry.states.delete(sourceId);
|
|
293196
|
+
});
|
|
293197
|
+
// istanbul ignore next
|
|
293198
|
+
if (entry.states.size === 0) {
|
|
293199
|
+
// there are no more components holding state for this node
|
|
293200
|
+
erasedNodeIds.add(nodeId);
|
|
293201
|
+
}
|
|
293202
|
+
});
|
|
293203
|
+
// step 3: cleanup erased node ids and possibly the whole hierarchy state
|
|
293204
|
+
for (const nodeId of erasedNodeIds) {
|
|
293205
|
+
hierarchyState.delete(nodeId);
|
|
292939
293206
|
}
|
|
292940
|
-
|
|
292941
|
-
|
|
292942
|
-
|
|
292943
|
-
|
|
292944
|
-
|
|
292945
|
-
|
|
292946
|
-
|
|
293207
|
+
if (hierarchyState.size === 0)
|
|
293208
|
+
this._hierarchyStates.delete(rulesetId);
|
|
293209
|
+
// finally, report
|
|
293210
|
+
await this.updateHierarchyStateIfNeeded(imodel.key, rulesetId, stateChanges);
|
|
293211
|
+
}
|
|
293212
|
+
}
|
|
293213
|
+
function calculateMergedNodeState(perComponentStates) {
|
|
293214
|
+
const merged = {};
|
|
293215
|
+
for (const state of perComponentStates) {
|
|
293216
|
+
if (state.isExpanded)
|
|
293217
|
+
merged.isExpanded = true;
|
|
293218
|
+
if (state.instanceFilter) {
|
|
293219
|
+
if (!merged.instanceFilters)
|
|
293220
|
+
merged.instanceFilters = [state.instanceFilter];
|
|
293221
|
+
else if (!merged.instanceFilters.includes(state.instanceFilter))
|
|
293222
|
+
merged.instanceFilters.push(state.instanceFilter);
|
|
292947
293223
|
}
|
|
292948
|
-
|
|
292949
|
-
|
|
293224
|
+
}
|
|
293225
|
+
return merged;
|
|
293226
|
+
}
|
|
293227
|
+
class MergedNodeStateChangeReporter {
|
|
293228
|
+
constructor(entry, outStateChanges) {
|
|
293229
|
+
this._entry = entry;
|
|
293230
|
+
this._stateBefore = calculateMergedNodeState(this._entry.states.values());
|
|
293231
|
+
this._outStateChanges = outStateChanges;
|
|
293232
|
+
}
|
|
293233
|
+
dispose() {
|
|
293234
|
+
var _a, _b, _c, _d;
|
|
293235
|
+
const stateAfter = calculateMergedNodeState(this._entry.states.values());
|
|
293236
|
+
const expandedFlagsDiffer = !!stateAfter.isExpanded !== !!this._stateBefore.isExpanded;
|
|
293237
|
+
const instanceFiltersDiffer = ((_b = (_a = stateAfter.instanceFilters) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) !== ((_d = (_c = this._stateBefore.instanceFilters) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0);
|
|
293238
|
+
if (expandedFlagsDiffer || instanceFiltersDiffer)
|
|
293239
|
+
this._outStateChanges.push({ ...stateAfter, nodeKey: this._entry.key });
|
|
292950
293240
|
}
|
|
292951
293241
|
}
|
|
292952
293242
|
|
|
@@ -305050,7 +305340,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.21.4","description":"P
|
|
|
305050
305340
|
/***/ ((module) => {
|
|
305051
305341
|
|
|
305052
305342
|
"use strict";
|
|
305053
|
-
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.6.0-dev.
|
|
305343
|
+
module.exports = JSON.parse('{"name":"@itwin/core-frontend","version":"3.6.0-dev.22","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs","build:ci":"npm run -s build && npm run -s build:esm","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2020 --outDir lib/esm","clean":"rimraf lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","docs":"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-eslintrc -c \\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\" \\"./src/**/*.ts\\" 1>&2","lint":"eslint -f visualstudio \\"./src/**/*.ts\\" 1>&2","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run -s webpackTests && certa -r chrome","cover":"npm -s test","test:debug":"certa -r chrome --debug","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:^3.6.0-dev.22","@itwin/core-bentley":"workspace:^3.6.0-dev.22","@itwin/core-common":"workspace:^3.6.0-dev.22","@itwin/core-geometry":"workspace:^3.6.0-dev.22","@itwin/core-orbitgt":"workspace:^3.6.0-dev.22","@itwin/core-quantity":"workspace:^3.6.0-dev.22","@itwin/webgl-compatibility":"workspace:^3.6.0-dev.22"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/certa":"workspace:*","@itwin/eslint-plugin":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@types/chai":"4.3.1","@types/chai-as-promised":"^7","@types/deep-assign":"^0.1.0","@types/lodash":"^4.14.0","@types/mocha":"^8.2.2","@types/node":"18.11.5","@types/qs":"^6.5.0","@types/semver":"7.3.10","@types/superagent":"^4.1.14","@types/sinon":"^9.0.0","babel-loader":"~8.2.5","babel-plugin-istanbul":"~6.1.1","chai":"^4.1.2","chai-as-promised":"^7","cpx2":"^3.0.0","eslint":"^7.11.0","glob":"^7.1.2","mocha":"^10.0.0","nyc":"^15.1.0","rimraf":"^3.0.2","sinon":"^9.0.2","source-map-loader":"^4.0.0","typescript":"~4.4.0","webpack":"^5.64.4"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/object-storage-azure":"~1.4.0","@itwin/cloud-agnostic-core":"~1.4.0","@itwin/object-storage-core":"~1.4.0","@itwin/core-i18n":"workspace:*","@itwin/core-telemetry":"workspace:*","@loaders.gl/core":"^3.1.6","@loaders.gl/draco":"^3.1.6","deep-assign":"^2.0.0","fuse.js":"^3.3.0","lodash":"^4.17.10","qs":"^6.5.3","semver":"^7.3.5","superagent":"^7.1.5","wms-capabilities":"0.4.0","reflect-metadata":"0.1.13"},"nyc":{"extends":"./node_modules/@itwin/build-tools/.nycrc"},"eslintConfig":{"plugins":["@itwin"],"extends":"plugin:@itwin/itwinjs-recommended","rules":{"@itwin/no-internal-barrel-imports":["error",{"required-barrel-modules":["./src/tile/internal.ts"]}],"@itwin/public-extension-exports":["error",{"releaseTags":["public","preview"],"outputApiFile":false}]},"overrides":[{"files":["*.test.ts","*.test.tsx","**/test/**/*.ts"],"rules":{"@itwin/no-internal-barrel-imports":"off"}}]}}');
|
|
305054
305344
|
|
|
305055
305345
|
/***/ }),
|
|
305056
305346
|
|