@itwin/rpcinterface-full-stack-tests 5.3.0 → 5.4.0-dev.10

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.
@@ -65935,7 +65935,10 @@ class MapImagerySettings {
65935
65935
  }
65936
65936
  /** @internal */
65937
65937
  static createFromJSON(imageryJson, mapProps) {
65938
- const baseLayer = imageryJson?.backgroundBase ? BaseLayerSettings.fromJSON(imageryJson.backgroundBase) : _MapLayerSettings__WEBPACK_IMPORTED_MODULE_1__.BaseMapLayerSettings.fromBackgroundMapProps(mapProps ?? {});
65938
+ const backgroundBase = imageryJson?.backgroundBase;
65939
+ const baseLayer = undefined !== backgroundBase ?
65940
+ BaseLayerSettings.fromJSON(backgroundBase) :
65941
+ _MapLayerSettings__WEBPACK_IMPORTED_MODULE_1__.BaseMapLayerSettings.fromBackgroundMapProps(mapProps ?? {});
65939
65942
  return new MapImagerySettings(baseLayer, imageryJson?.backgroundLayers, imageryJson?.overlayLayers);
65940
65943
  }
65941
65944
  toJSON() {
@@ -103873,9 +103876,20 @@ __webpack_require__.r(__webpack_exports__);
103873
103876
  * @public @preview
103874
103877
  */
103875
103878
  class SchemaJsonLocater {
103876
- _getSchema;
103877
- constructor(_getSchema) {
103878
- this._getSchema = _getSchema;
103879
+ _getSchemaProps;
103880
+ constructor(getSchemaProps) {
103881
+ // Since the getSchemaProps may throw an error, but the locater contract defines that
103882
+ // getSchema should return undefined if the schema could not be located, we wrap the provided
103883
+ // lookup function in a safe block.
103884
+ this._getSchemaProps = (schemaName) => {
103885
+ try {
103886
+ return getSchemaProps(schemaName);
103887
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
103888
+ }
103889
+ catch (error) {
103890
+ return undefined;
103891
+ }
103892
+ };
103879
103893
  }
103880
103894
  /** Get a schema by [SchemaKey]
103881
103895
  * @param schemaKey The [SchemaKey] that identifies the schema.
@@ -103893,7 +103907,7 @@ class SchemaJsonLocater {
103893
103907
  * @param matchType The match type to use when locating the schema
103894
103908
  */
103895
103909
  async getSchemaInfo(schemaKey, matchType, context) {
103896
- const schemaProps = this._getSchema(schemaKey.name);
103910
+ const schemaProps = this._getSchemaProps(schemaKey.name);
103897
103911
  if (!schemaProps)
103898
103912
  return undefined;
103899
103913
  const schemaInfo = await _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.startLoadingFromJson(schemaProps, context);
@@ -103908,7 +103922,7 @@ class SchemaJsonLocater {
103908
103922
  * @throws [Error]($ecschema-metadata) if the schema exists, but cannot be loaded.
103909
103923
  */
103910
103924
  getSchemaSync(schemaKey, _matchType, context) {
103911
- const schemaProps = this._getSchema(schemaKey.name);
103925
+ const schemaProps = this._getSchemaProps(schemaKey.name);
103912
103926
  if (!schemaProps)
103913
103927
  return undefined;
103914
103928
  return _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.fromJsonSync(schemaProps, context || new _Context__WEBPACK_IMPORTED_MODULE_0__.SchemaContext());
@@ -111808,6 +111822,7 @@ class BriefcaseConnection extends _IModelConnection__WEBPACK_IMPORTED_MODULE_5__
111808
111822
  this._modelsMonitor = new ModelChangeMonitor(this);
111809
111823
  if (_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.OpenMode.ReadWrite === this._openMode)
111810
111824
  this.txns.onAfterUndoRedo.addListener(async () => { await _IModelApp__WEBPACK_IMPORTED_MODULE_4__.IModelApp.toolAdmin.restartPrimitiveTool(); });
111825
+ this.categories.cache.attachToBriefcase(this);
111811
111826
  }
111812
111827
  /** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */
111813
111828
  static async openFile(briefcaseProps) {
@@ -123473,18 +123488,10 @@ __webpack_require__.r(__webpack_exports__);
123473
123488
  /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
123474
123489
  /* harmony import */ var _CategorySelectorState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CategorySelectorState */ "../../core/frontend/lib/esm/CategorySelectorState.js");
123475
123490
  /* harmony import */ var _DisplayStyleState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DisplayStyleState */ "../../core/frontend/lib/esm/DisplayStyleState.js");
123476
- /* harmony import */ var _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./render/GraphicBranch */ "../../core/frontend/lib/esm/render/GraphicBranch.js");
123477
- /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
123478
- /* harmony import */ var _internal_render_MockRender__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./internal/render/MockRender */ "../../core/frontend/lib/esm/internal/render/MockRender.js");
123479
- /* harmony import */ var _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./render/FeatureSymbology */ "../../core/frontend/lib/esm/render/FeatureSymbology.js");
123480
- /* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
123481
- /* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
123482
- /* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Viewport */ "../../core/frontend/lib/esm/Viewport.js");
123483
- /* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
123484
- /* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
123485
- /* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
123486
- /* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
123487
- /* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
123491
+ /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
123492
+ /* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
123493
+ /* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
123494
+ /* harmony import */ var _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./internal/SheetViewAttachments */ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js");
123488
123495
  /*---------------------------------------------------------------------------------------------
123489
123496
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
123490
123497
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -123501,14 +123508,6 @@ __webpack_require__.r(__webpack_exports__);
123501
123508
 
123502
123509
 
123503
123510
 
123504
-
123505
-
123506
-
123507
-
123508
-
123509
-
123510
-
123511
-
123512
123511
  // cSpell:ignore ovrs
123513
123512
  /** Describes the geometry and styling of a sheet border decoration.
123514
123513
  * The sheet border decoration mimics a sheet of paper with a drop shadow.
@@ -123577,206 +123576,25 @@ class SheetBorder {
123577
123576
  params.fillColor = fillColor;
123578
123577
  params.gradient = this._gradient;
123579
123578
  builder.activateGraphicParams(params);
123580
- builder.addShape2d(this._shadow, _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance);
123579
+ builder.addShape2d(this._shadow, _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance);
123581
123580
  builder.setSymbology(lineColor, fillColor, 2);
123582
123581
  builder.addLineString2d(this._rect, 0);
123583
123582
  }
123584
123583
  }
123585
- /** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is
123586
- * supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in
123587
- * SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.
123588
- */
123589
- class ViewAttachmentsInfo {
123590
- _attachments;
123591
- get attachments() { return this._attachments; }
123592
- constructor(attachments) {
123593
- this._attachments = attachments;
123594
- }
123595
- get isLoaded() {
123596
- return 0 === this._attachments.length || "string" !== typeof this._attachments[0];
123597
- }
123598
- get viewAttachmentProps() {
123599
- return this.isLoaded ? this._props : [];
123600
- }
123601
- get _props() {
123602
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.isLoaded);
123603
- return this._attachments;
123604
- }
123605
- get _ids() {
123606
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this.isLoaded);
123607
- return this._attachments;
123608
- }
123609
- static fromJSON(ids = []) {
123610
- return new ViewAttachmentsInfo(ids);
123611
- }
123612
- toJSON() {
123613
- return this.isLoaded ? this._props.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(x.id)) : [...this._ids];
123614
- }
123615
- clone(iModel) {
123616
- let attachments = this._attachments;
123617
- if (this.isLoaded) {
123618
- // Need to clone the attached ViewStates.
123619
- attachments = attachments.map((attachment) => {
123620
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(typeof attachment !== "string");
123621
- return {
123622
- ...attachment,
123623
- attachedView: attachment.attachedView.clone(iModel),
123624
- };
123625
- });
123626
- }
123627
- return new ViewAttachmentsInfo(attachments);
123628
- }
123629
- preload(options) {
123630
- if (this.isLoaded)
123631
- return;
123632
- options.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.CompressedId64Set.sortAndCompress(this._ids);
123633
- options.viewStateLoadProps = {
123634
- displayStyle: {
123635
- omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
123636
- compressExcludedElementIds: true,
123637
- },
123638
- };
123639
- }
123640
- async postload(options, iModel) {
123641
- if (options.sheetViewViews === undefined)
123642
- return;
123643
- if (options.sheetViewAttachmentProps === undefined)
123644
- return;
123645
- const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState
123646
- const promises = [];
123647
- for (const viewProps of viewStateProps) {
123648
- const loadView = async () => {
123649
- try {
123650
- if (viewProps === undefined)
123651
- return undefined;
123652
- const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
123653
- return view;
123654
- }
123655
- catch {
123656
- return undefined;
123657
- }
123658
- };
123659
- promises.push(loadView());
123660
- }
123661
- const views = await Promise.all(promises);
123662
- const attachmentProps = options.sheetViewAttachmentProps;
123663
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
123664
- const attachments = [];
123665
- for (let i = 0; i < views.length; i++) {
123666
- const view = views[i];
123667
- if (view && !(view instanceof SheetViewState)) {
123668
- const props = attachmentProps[i];
123669
- props.attachedView = view;
123670
- attachments.push(props);
123671
- }
123672
- }
123673
- this._attachments = attachments;
123674
- }
123675
- async load(iModel) {
123676
- if (this.isLoaded)
123677
- return;
123678
- const attachmentProps = await iModel.elements.getProps(this._ids);
123679
- const promises = [];
123680
- for (const attachment of attachmentProps) {
123681
- const loadView = async () => {
123682
- try {
123683
- const view = await iModel.views.load(attachment.view.id);
123684
- return view;
123685
- }
123686
- catch {
123687
- return undefined;
123688
- }
123689
- };
123690
- promises.push(loadView());
123691
- }
123692
- const views = await Promise.all(promises);
123693
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
123694
- const attachments = [];
123695
- for (let i = 0; i < views.length; i++) {
123696
- const view = views[i];
123697
- if (view && !(view instanceof SheetViewState)) {
123698
- const props = attachmentProps[i];
123699
- props.attachedView = view;
123700
- attachments.push(props);
123701
- }
123702
- }
123703
- this._attachments = attachments;
123704
- }
123705
- createAttachments(sheetView) {
123706
- return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;
123707
- }
123708
- }
123709
- /** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;
123710
- * disposed of when it becomes detached from the viewport.
123711
- */
123712
- class ViewAttachments {
123713
- _attachments = [];
123714
- maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
123715
- constructor(infos, sheetView) {
123716
- for (const info of infos) {
123717
- const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);
123718
- const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;
123719
- const attachment = new ctor(info.attachedView, info, sheetView);
123720
- this._attachments.push(attachment);
123721
- this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);
123722
- }
123723
- }
123724
- [Symbol.dispose]() {
123725
- for (const attachment of this._attachments)
123726
- attachment[Symbol.dispose]();
123727
- this._attachments.length = 0;
123728
- }
123729
- [Symbol.iterator]() {
123730
- return this._attachments[Symbol.iterator]();
123731
- }
123732
- /** For tests. */
123733
- get attachments() {
123734
- return this._attachments;
123735
- }
123736
- get isEmpty() {
123737
- return 0 === this._attachments.length;
123738
- }
123739
- areAllTileTreesLoaded(displayedExtents) {
123740
- return this._attachments.every((x) => {
123741
- const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(x.viewAttachmentProps.placement);
123742
- const attachmentRange = placement.calculateRange();
123743
- if (!attachmentRange.intersectsRangeXY(displayedExtents))
123744
- return true;
123745
- return x.areAllTileTreesLoaded;
123746
- });
123747
- }
123748
- /** Strictly for testing purposes */
123749
- areAllAttachmentsLoaded() {
123750
- return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);
123751
- }
123752
- discloseTileTrees(trees) {
123753
- for (const attachment of this._attachments)
123754
- trees.disclose(attachment);
123755
- }
123756
- collectStatistics(stats) {
123757
- for (const attachment of this._attachments)
123758
- attachment.collectStatistics(stats);
123759
- }
123760
- addToScene(context) {
123761
- for (const attachment of this._attachments)
123762
- attachment.addToScene(context);
123763
- }
123764
- findById(attachmentId) {
123765
- return this._attachments.find((attachment) => attachment.viewAttachmentProps.id === attachmentId);
123766
- }
123767
- }
123768
123584
  /** A view of a [SheetModel]($backend).
123769
123585
  * @public
123770
123586
  * @extensions
123771
123587
  */
123772
- class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2d {
123588
+ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__.ViewState2d {
123773
123589
  /** The width and height of the sheet in world coordinates. */
123774
123590
  sheetSize;
123775
- _attachmentsInfo;
123776
- _attachments;
123591
+ _viewAttachments;
123777
123592
  _viewedExtents;
123593
+ _onViewAttachmentsReloaded = () => undefined;
123594
+ /** Strictly for tests. */
123595
+ onViewAttachmentsReloaded = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
123778
123596
  get attachmentIds() {
123779
- return this._attachmentsInfo.toJSON();
123597
+ return this._viewAttachments.attachmentIds;
123780
123598
  }
123781
123599
  static get className() { return "SheetViewDefinition"; }
123782
123600
  static createFromProps(viewStateData, iModel) {
@@ -123787,7 +123605,7 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123787
123605
  }
123788
123606
  toProps() {
123789
123607
  const props = super.toProps();
123790
- props.sheetAttachments = this._attachmentsInfo.toJSON();
123608
+ props.sheetAttachments = [...this.attachmentIds];
123791
123609
  // For sheetProps all that is actually used is the size, so just null out everything else.
123792
123610
  const codeProps = { spec: "", scope: "", value: "" };
123793
123611
  props.sheetProps = {
@@ -123802,20 +123620,15 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123802
123620
  }
123803
123621
  /** Strictly for testing. @internal */
123804
123622
  get viewAttachmentProps() {
123805
- return this._attachmentsInfo.viewAttachmentProps.map((x) => {
123806
- return {
123807
- ...x,
123808
- attachedView: undefined,
123809
- };
123810
- });
123623
+ return this._viewAttachments.attachmentProps;
123811
123624
  }
123812
123625
  /** Strictly for testing. @internal */
123813
123626
  get viewAttachmentInfos() {
123814
- return this._attachmentsInfo.attachments;
123627
+ return this._viewAttachments.attachmentInfos;
123815
123628
  }
123816
123629
  /** Strictly for testing. @internal */
123817
123630
  get attachments() {
123818
- return this._attachments?.attachments;
123631
+ return this._viewAttachments.attachments;
123819
123632
  }
123820
123633
  isDrawingView() { return false; }
123821
123634
  isSheetView() { return true; }
@@ -123824,41 +123637,53 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123824
123637
  if (categories instanceof SheetViewState) {
123825
123638
  // we are coming from clone...
123826
123639
  this.sheetSize = categories.sheetSize.clone();
123827
- this._attachmentsInfo = categories._attachmentsInfo.clone(iModel);
123640
+ this._viewAttachments = categories._viewAttachments.clone(iModel);
123828
123641
  this._viewedExtents = categories._viewedExtents.clone();
123829
123642
  }
123830
123643
  else {
123831
123644
  this.sheetSize = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(sheetProps.width, sheetProps.height);
123832
- this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachments);
123645
+ this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachments);
123833
123646
  const extents = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);
123834
123647
  const margin = 1.1;
123835
123648
  extents.scaleAboutCenterInPlace(margin);
123836
123649
  this._viewedExtents = extents;
123837
123650
  }
123651
+ if (iModel.isBriefcaseConnection()) {
123652
+ iModel.txns.onElementsChanged.addListener(async (changes) => {
123653
+ let reload = false;
123654
+ for (const change of changes.filter({ includeMetadata: (meta) => meta.is("BisCore:ViewAttachment") })) {
123655
+ if (change.type === "inserted" || this._viewAttachments.attachmentIds.includes(change.id)) {
123656
+ reload = true;
123657
+ break;
123658
+ }
123659
+ }
123660
+ if (reload) {
123661
+ await this._viewAttachments.reload(this.baseModelId, iModel);
123662
+ this._onViewAttachmentsReloaded();
123663
+ this.onViewAttachmentsReloaded.raiseEvent();
123664
+ }
123665
+ });
123666
+ }
123838
123667
  }
123839
123668
  getOrigin() {
123840
123669
  const origin = super.getOrigin();
123841
- if (this._attachments)
123842
- origin.z = -this._attachments.maxDepth;
123670
+ origin.z = -this._viewAttachments.maxDepth;
123843
123671
  return origin;
123844
123672
  }
123845
123673
  getExtents() {
123846
123674
  const extents = super.getExtents();
123847
- if (this._attachments)
123848
- extents.z = this._attachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
123675
+ extents.z = this._viewAttachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance;
123849
123676
  return extents;
123850
123677
  }
123851
123678
  /** Overrides [[ViewState.discloseTileTrees]] to include tile trees associated with [ViewAttachment]($backend)s displayed on this sheet. */
123852
123679
  discloseTileTrees(trees) {
123853
123680
  super.discloseTileTrees(trees);
123854
- if (this._attachments)
123855
- trees.disclose(this._attachments);
123681
+ trees.disclose(this._viewAttachments);
123856
123682
  }
123857
123683
  /** @internal */
123858
123684
  collectNonTileTreeStatistics(stats) {
123859
123685
  super.collectNonTileTreeStatistics(stats);
123860
- if (this._attachments)
123861
- this._attachments.collectStatistics(stats);
123686
+ this._viewAttachments.collectStatistics(stats);
123862
123687
  }
123863
123688
  get defaultExtentLimits() {
123864
123689
  return { min: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };
@@ -123869,36 +123694,23 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123869
123694
  /** @internal */
123870
123695
  preload(hydrateRequest) {
123871
123696
  super.preload(hydrateRequest);
123872
- this._attachmentsInfo.preload(hydrateRequest);
123697
+ this._viewAttachments.preload(hydrateRequest);
123873
123698
  }
123874
123699
  /** @internal */
123875
123700
  async postload(hydrateResponse) {
123876
123701
  const promises = [];
123877
123702
  promises.push(super.postload(hydrateResponse));
123878
- promises.push(this._attachmentsInfo.postload(hydrateResponse, this.iModel));
123703
+ promises.push(this._viewAttachments.postload(hydrateResponse, this.iModel));
123879
123704
  await Promise.all(promises);
123880
123705
  }
123881
123706
  /** @internal */
123882
123707
  createScene(context) {
123883
123708
  super.createScene(context);
123884
- if (this._attachments)
123885
- this._attachments.addToScene(context);
123709
+ this._viewAttachments.addToScene(context);
123886
123710
  }
123887
123711
  /** @internal */
123888
123712
  get secondaryViewports() {
123889
- if (this._attachments === undefined)
123890
- return super.secondaryViewports;
123891
- const attachments = this._attachments;
123892
- function* iterator() {
123893
- for (const attachment of attachments) {
123894
- const vp = attachment.viewport;
123895
- if (vp)
123896
- yield vp;
123897
- }
123898
- }
123899
- return {
123900
- [Symbol.iterator]: () => iterator(),
123901
- };
123713
+ return this._viewAttachments.getSecondaryViewports();
123902
123714
  }
123903
123715
  /** @internal */
123904
123716
  async queryAttachmentIds() {
@@ -123911,39 +123723,43 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123911
123723
  async changeViewedModel(modelId) {
123912
123724
  await super.changeViewedModel(modelId);
123913
123725
  const attachmentIds = await this.queryAttachmentIds();
123914
- this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachmentIds);
123915
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined === this._attachments);
123726
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewAttachments);
123727
+ this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachmentIds);
123916
123728
  }
123917
123729
  /** See [[ViewState.attachToViewport]]. */
123918
123730
  attachToViewport(args) {
123919
123731
  super.attachToViewport(args);
123920
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined === this._attachments);
123921
- this._attachments = this._attachmentsInfo.createAttachments(this);
123732
+ this._viewAttachments.attachToViewport({
123733
+ backgroundColor: this.displayStyle.backgroundColor,
123734
+ sheetModelId: this.baseModelId,
123735
+ });
123736
+ this._onViewAttachmentsReloaded = () => args.invalidateController();
123922
123737
  }
123923
123738
  /** See [[ViewState.detachFromViewport]]. */
123924
123739
  detachFromViewport() {
123925
123740
  super.detachFromViewport();
123926
- this._attachments = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._attachments);
123741
+ this._viewAttachments.detachFromViewport();
123742
+ this._onViewAttachmentsReloaded = () => undefined;
123927
123743
  }
123928
123744
  get areAllTileTreesLoaded() {
123745
+ if (!super.areAllTileTreesLoaded) {
123746
+ return false;
123747
+ }
123929
123748
  let displayedExtents = this._viewedExtents;
123930
123749
  const frustum = this.calculateFrustum();
123931
123750
  if (frustum) {
123932
123751
  displayedExtents = frustum.toRange();
123933
123752
  }
123934
- return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded(displayedExtents));
123753
+ return this._viewAttachments.areAllTileTreesLoaded(displayedExtents);
123935
123754
  }
123936
123755
  /** @internal Strictly for testing */
123937
123756
  areAllAttachmentsLoaded() {
123938
- if (this._attachments) {
123939
- return this._attachments.areAllAttachmentsLoaded();
123940
- }
123941
- return true;
123757
+ return this._viewAttachments.areAllAttachmentsLoaded();
123942
123758
  }
123943
123759
  /** Create a sheet border decoration graphic. */
123944
123760
  createBorder(width, height, context) {
123945
123761
  const border = SheetBorder.create(width, height, context);
123946
- const builder = context.createGraphicBuilder(_common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__.GraphicType.ViewBackground);
123762
+ const builder = context.createGraphicBuilder(_common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__.GraphicType.ViewBackground);
123947
123763
  border.addToBuilder(builder);
123948
123764
  return builder.finish();
123949
123765
  }
@@ -123963,453 +123779,13 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123963
123779
  }
123964
123780
  /** @internal */
123965
123781
  getAttachmentViewport(args) {
123966
- const attachment = args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;
123967
- if (!attachment) {
123968
- return undefined;
123969
- }
123970
- return args.inSectionDrawingAttachment ? attachment.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : attachment.viewport;
123782
+ return this._viewAttachments.getAttachmentViewport(args);
123971
123783
  }
123972
123784
  /** @beta */
123973
123785
  computeDisplayTransform(args) {
123974
123786
  // ###TODO we're currently ignoring model and element Id in args, assuming irrelevant for sheets.
123975
123787
  // Should probably call super or have super call us.
123976
- const attachment = undefined !== args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;
123977
- if (!attachment || !(attachment instanceof OrthographicAttachment)) {
123978
- return undefined;
123979
- }
123980
- const sheetTransform = attachment.toSheet;
123981
- const sectionTransform = args.inSectionDrawingAttachment ? attachment.view.computeDisplayTransform(args) : undefined;
123982
- if (!sectionTransform) {
123983
- return sheetTransform.clone(args.output);
123984
- }
123985
- return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
123986
- }
123987
- }
123988
- /** A mostly no-op RenderTarget for an Attachment.
123989
- * its Scene and symbology overrides.
123990
- */
123991
- class AttachmentTarget extends _internal_render_MockRender__WEBPACK_IMPORTED_MODULE_7__.MockRender.OffScreenTarget {
123992
- _attachment;
123993
- constructor(attachment) {
123994
- // The dimensions don't matter - we're not drawing anything.
123995
- const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(1, 1);
123996
- super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem, rect);
123997
- this._attachment = attachment;
123998
- }
123999
- changeScene(scene) {
124000
- this._attachment.scene = scene;
124001
- }
124002
- overrideFeatureSymbology(ovrs) {
124003
- this._attachment.symbologyOverrides = ovrs;
124004
- }
124005
- }
124006
- /** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
124007
- * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
124008
- * collect the resultant graphics and add them to the sheet view's scene.
124009
- */
124010
- class OrthographicAttachment {
124011
- _viewport;
124012
- _props;
124013
- _sheetModelId;
124014
- _viewFlagOverrides;
124015
- _toSheet;
124016
- _fromSheet;
124017
- _sizeInMeters;
124018
- _range;
124019
- _viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, 1, 1);
124020
- _originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Frustum();
124021
- _clipVolume;
124022
- _hiddenLineSettings;
124023
- _scale;
124024
- _debugFeatureTable;
124025
- scene;
124026
- symbologyOverrides;
124027
- zDepth;
124028
- get view() {
124029
- return this._viewport.view;
124030
- }
124031
- get viewAttachmentProps() {
124032
- return this._props;
124033
- }
124034
- get viewport() {
124035
- return this._viewport;
124036
- }
124037
- constructor(view, props, sheetView) {
124038
- this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
124039
- const target = new AttachmentTarget(this);
124040
- this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport.createViewport(view, target, true);
124041
- this._props = props;
124042
- this._sheetModelId = sheetView.baseModelId;
124043
- const applyClip = true; // set to false for debugging
124044
- this._viewFlagOverrides = {
124045
- ...view.viewFlags,
124046
- clipVolume: applyClip,
124047
- lighting: false,
124048
- shadows: false,
124049
- };
124050
- const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
124051
- const range = placement.calculateRange();
124052
- this._range = range;
124053
- this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(range.xLength(), range.yLength());
124054
- // Compute transform from attached view's world coordinates to sheet's world coordinates.
124055
- // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
124056
- const applySkew = true; // set to false for debugging
124057
- const skew = applySkew ? view.getAspectRatioSkew() : 1;
124058
- const extents = this._viewport.viewingSpace.viewDelta.clone();
124059
- const zDepth = Math.abs(extents.z);
124060
- const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
124061
- const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
124062
- this._scale = { x: 1 / scaleX, y: 1 / scaleY };
124063
- const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
124064
- this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
124065
- // View origin is at the *back* of the view. Align *front* of view based on display priority.
124066
- const viewRot = view.getRotation();
124067
- const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
124068
- viewOrg.z += zDepth;
124069
- viewRot.multiplyTransposeVectorInPlace(viewOrg);
124070
- const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.createScale(scaleX, scaleY, 1);
124071
- matrix.multiplyMatrixMatrix(viewRot, matrix);
124072
- const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
124073
- const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(placement.origin);
124074
- attachmentOrigin.z = zBias;
124075
- const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
124076
- origin.addInPlace(viewOrgToAttachment);
124077
- this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createRefs(origin, matrix);
124078
- this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(this._toSheet.inverse());
124079
- // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
124080
- // The clip needs to be transformed into sheet space.
124081
- if (view.isDrawingView())
124082
- this._viewport.drawingToSheetTransform = this._toSheet;
124083
- // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
124084
- // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
124085
- // introduce additional computation, so possibly not worth it.
124086
- // Transform the view's clip (if any) to sheet space
124087
- let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
124088
- if (viewClip)
124089
- viewClip.transformInPlace(this._toSheet);
124090
- else
124091
- viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.createEmpty();
124092
- let sheetClip;
124093
- if (undefined !== props.jsonProperties?.clip)
124094
- sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(props.jsonProperties?.clip);
124095
- if (sheetClip && sheetClip.isValid) {
124096
- // Clip to view attachment's clip. NB: clip is in sheet coordinate space.
124097
- for (const clip of sheetClip.clips)
124098
- viewClip.clips.push(clip);
124099
- }
124100
- else {
124101
- // Clip to view attachment's bounding box
124102
- viewClip.appendShape([
124103
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.low.y),
124104
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.low.y),
124105
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.high.y),
124106
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.high.y),
124107
- ]);
124108
- }
124109
- this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(viewClip);
124110
- // Save off the original frustum (potentially adjusted by viewport).
124111
- this._viewport.setupFromView();
124112
- this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_10__.CoordSystem.World, true, this._originalFrustum);
124113
- const applyHiddenLineSettings = true; // for debugging edge display, set to false...
124114
- const style = view.displayStyle;
124115
- if (style.is3d() && applyHiddenLineSettings)
124116
- this._hiddenLineSettings = style.settings.hiddenLineSettings;
124117
- }
124118
- [Symbol.dispose]() {
124119
- this._viewport[Symbol.dispose]();
124120
- }
124121
- discloseTileTrees(trees) {
124122
- trees.disclose(this._viewport);
124123
- }
124124
- addToScene(context) {
124125
- if (context.viewport.freezeScene)
124126
- return;
124127
- if (!context.viewport.view.viewsCategory(this._props.category))
124128
- return;
124129
- const wantBounds = context.viewport.wantViewAttachmentBoundaries;
124130
- const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
124131
- if (wantBounds || wantClipShapes) {
124132
- const builder = context.createSceneGraphicBuilder();
124133
- if (wantBounds) {
124134
- builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
124135
- builder.addRangeBox(this._range);
124136
- }
124137
- if (wantClipShapes && this._clipVolume) {
124138
- builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, 2);
124139
- for (const prim of this._clipVolume.clipVector.clips) {
124140
- if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipShape))
124141
- continue; // ###TODO handle non-shape primitives, if any such ever encountered
124142
- const pts = [];
124143
- const tf = prim.transformFromClip;
124144
- for (const pt of prim.polygon) {
124145
- const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
124146
- pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(tfPt.x, tfPt.y));
124147
- }
124148
- builder.addLineString2d(pts, 0);
124149
- }
124150
- }
124151
- // Put into a Batch so that we can see tooltip with attachment Id on mouseover.
124152
- const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
124153
- context.outputGraphic(batch);
124154
- }
124155
- if (!context.viewport.wantViewAttachments)
124156
- return;
124157
- // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
124158
- const pixelSize = context.viewport.getPixelSizeAtPoint();
124159
- if (0 === pixelSize)
124160
- return;
124161
- // Adjust attached view frustum based on intersection with sheet view frustum.
124162
- const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
124163
- const attachFrustumRange = attachFrustum.toRange();
124164
- const sheetFrustum = context.viewport.getWorldFrustum();
124165
- const sheetFrustumRange = sheetFrustum.toRange();
124166
- const intersect = attachFrustumRange.intersect(sheetFrustumRange);
124167
- if (intersect.isNull)
124168
- return;
124169
- attachFrustum.initFromRange(intersect);
124170
- attachFrustum.transformBy(this._fromSheet, attachFrustum);
124171
- this._viewport.setupViewFromFrustum(attachFrustum);
124172
- // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
124173
- const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
124174
- const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
124175
- this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
124176
- this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
124177
- this._viewport.setRect(this._viewRect);
124178
- // Propagate settings from on-screen viewport.
124179
- this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
124180
- this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
124181
- // Create the scene.
124182
- this._viewport.renderFrame();
124183
- const scene = this.scene;
124184
- if (!scene)
124185
- return;
124186
- // Extract scene graphics and insert into on-screen scene context.
124187
- const options = {
124188
- viewAttachmentId: this._props.id,
124189
- clipVolume: this._clipVolume,
124190
- hline: this._hiddenLineSettings,
124191
- frustum: {
124192
- is3d: this.view.is3d(),
124193
- scale: this._scale,
124194
- },
124195
- };
124196
- const outputGraphics = (source) => {
124197
- if (0 === source.length)
124198
- return;
124199
- const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch();
124200
- graphics.setViewFlagOverrides(this._viewFlagOverrides);
124201
- graphics.symbologyOverrides = this.symbologyOverrides;
124202
- for (const graphic of source)
124203
- graphics.entries.push(graphic);
124204
- const branch = context.createGraphicBranch(graphics, this._toSheet, options);
124205
- context.outputGraphic(branch);
124206
- };
124207
- outputGraphics(scene.foreground);
124208
- context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
124209
- context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
124210
- // Report tile statistics to sheet view's viewport.
124211
- const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin;
124212
- const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
124213
- const requested = tileAdmin.getRequestsForUser(this._viewport);
124214
- tileAdmin.addExternalTilesForUser(context.viewport, {
124215
- requested: requested?.size ?? 0,
124216
- selected: selectedAndReady?.selected.size ?? 0,
124217
- ready: selectedAndReady?.ready.size ?? 0,
124218
- });
124219
- }
124220
- getDebugFeatureTable() {
124221
- if (this._debugFeatureTable)
124222
- return this._debugFeatureTable;
124223
- const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.FeatureTable(1, this._sheetModelId);
124224
- featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Feature(this._props.id));
124225
- this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable.pack(featureTable);
124226
- return this._debugFeatureTable;
124227
- }
124228
- get areAllTileTreesLoaded() {
124229
- return this.view.areAllTileTreesLoaded;
124230
- }
124231
- collectStatistics(_stats) {
124232
- // Handled by discloseTileTrees()
124233
- }
124234
- get toSheet() {
124235
- return this._toSheet;
124236
- }
124237
- }
124238
- function createRasterAttachmentViewport(_view, _rect, _attachment) {
124239
- class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport {
124240
- _sceneContext;
124241
- _isSceneReady = false;
124242
- _attachment;
124243
- constructor(view, rect, attachment) {
124244
- super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createOffscreenTarget(rect));
124245
- this._attachment = attachment;
124246
- this._isAspectRatioLocked = true;
124247
- this.changeView(view);
124248
- }
124249
- createSceneContext() {
124250
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
124251
- this._sceneContext = super.createSceneContext();
124252
- return this._sceneContext;
124253
- }
124254
- renderFrame() {
124255
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
124256
- this.clearSceneContext();
124257
- super.renderFrame();
124258
- if (undefined !== this._sceneContext) {
124259
- this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
124260
- if (this._isSceneReady)
124261
- this._attachment.produceGraphics(this._sceneContext);
124262
- this._sceneContext = undefined;
124263
- }
124264
- }
124265
- clearSceneContext() {
124266
- this._sceneContext = undefined;
124267
- }
124268
- addDecorations(_decorations) {
124269
- // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
124270
- }
124271
- }
124272
- return new RasterAttachmentViewport(_view, _rect, _attachment);
124273
- }
124274
- /** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */
124275
- class RasterAttachment {
124276
- _props;
124277
- _placement;
124278
- _transform;
124279
- zDepth;
124280
- _viewport;
124281
- _graphics;
124282
- constructor(view, props, sheetView) {
124283
- // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
124284
- const maxSize = 2048;
124285
- const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, maxSize, maxSize);
124286
- const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
124287
- const skew = maxSize / height;
124288
- view.setAspectRatioSkew(skew);
124289
- if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
124290
- // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
124291
- const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);
124292
- view.displayStyle.backgroundColor = bgColor;
124293
- }
124294
- this._viewport = createRasterAttachmentViewport(view, rect, this);
124295
- this._props = props;
124296
- this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
124297
- this._transform = this._placement.transform;
124298
- this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
124299
- }
124300
- [Symbol.dispose]() {
124301
- this._viewport?.[Symbol.dispose]();
124302
- }
124303
- get viewAttachmentProps() {
124304
- return this._props;
124305
- }
124306
- get viewport() {
124307
- return this._viewport;
124308
- }
124309
- get areAllTileTreesLoaded() {
124310
- return this._viewport?.areAllTileTreesLoaded ?? true;
124311
- }
124312
- addToScene(context) {
124313
- // ###TODO: check viewport.wantViewAttachmentClipShapes
124314
- if (!context.viewport.view.viewsCategory(this._props.category))
124315
- return;
124316
- if (context.viewport.wantViewAttachmentBoundaries) {
124317
- const builder = context.createSceneGraphicBuilder(this._transform);
124318
- builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
124319
- builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d.createRange2d(this._placement.bbox));
124320
- context.outputGraphic(builder.finish());
124321
- }
124322
- if (!context.viewport.wantViewAttachments)
124323
- return;
124324
- if (this._graphics) {
124325
- context.outputGraphic(this._graphics);
124326
- return;
124327
- }
124328
- if (undefined === this._viewport)
124329
- return;
124330
- this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
124331
- this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
124332
- this._viewport.renderFrame();
124333
- if (this._graphics)
124334
- context.outputGraphic(this._graphics);
124335
- }
124336
- discloseTileTrees(trees) {
124337
- if (this._viewport)
124338
- trees.disclose(this._viewport);
124339
- }
124340
- produceGraphics(context) {
124341
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(context.viewport === this._viewport);
124342
- this._graphics = this.createGraphics(this._viewport);
124343
- this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewport);
124344
- if (undefined !== this._graphics)
124345
- context.outputGraphic(this._graphics);
124346
- }
124347
- createGraphics(vp) {
124348
- // Create a texture from the contents of the view.
124349
- const image = vp.readImageBuffer({ upsideDown: true });
124350
- if (undefined === image)
124351
- return undefined;
124352
- const debugImage = false; // set to true to open a window displaying the captured image.
124353
- if (debugImage) {
124354
- const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.imageBufferToPngDataUrl)(image, false);
124355
- if (url)
124356
- (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.openImageDataUrlInNewWindow)(url, "Attachment");
124357
- }
124358
- const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createTexture({
124359
- image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.TextureTransparency.Opaque },
124360
- });
124361
- if (!texture)
124362
- return undefined;
124363
- // Create a material for the texture
124364
- const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.GraphicParams();
124365
- graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
124366
- // Apply the texture to a rectangular polyface.
124367
- const depth = this.zDepth;
124368
- const east = this._placement.bbox.low.x;
124369
- const west = this._placement.bbox.high.x;
124370
- const north = this._placement.bbox.low.y;
124371
- const south = this._placement.bbox.high.y;
124372
- const corners = [
124373
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, north, depth),
124374
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, north, depth),
124375
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, south, depth),
124376
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, south, depth),
124377
- ];
124378
- const params = [
124379
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 0),
124380
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 0),
124381
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 1),
124382
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 1),
124383
- ];
124384
- const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.StrokeOptions();
124385
- strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
124386
- const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.PolyfaceBuilder.create(strokeOptions);
124387
- polyfaceBuilder.addQuadFacet(corners, params);
124388
- const polyface = polyfaceBuilder.claimPolyface();
124389
- const graphicBuilder = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createGraphicBuilder(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createIdentity(), _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__.GraphicType.Scene, vp, this._props.id);
124390
- graphicBuilder.activateGraphicParams(graphicParams);
124391
- graphicBuilder.addPolyface(polyface, false);
124392
- const graphic = graphicBuilder.finish();
124393
- // Wrap the polyface in a GraphicBranch.
124394
- const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch(true);
124395
- const vfOvrs = (0,_tile_internal__WEBPACK_IMPORTED_MODULE_13__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
124396
- // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
124397
- vfOvrs.transparency = false;
124398
- branch.setViewFlagOverrides(vfOvrs);
124399
- branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
124400
- branch.entries.push(graphic);
124401
- // Apply the attachment's clip, if any.
124402
- let clipVolume;
124403
- if (this._props.jsonProperties?.clip) {
124404
- const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
124405
- if (clipVector.isValid)
124406
- clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(clipVector);
124407
- }
124408
- return _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
124409
- }
124410
- collectStatistics(stats) {
124411
- if (this._graphics)
124412
- this._graphics.collectStatistics(stats);
123788
+ return this._viewAttachments.computeDisplayTransform(args);
124413
123789
  }
124414
123790
  }
124415
123791
 
@@ -125009,7 +124385,46 @@ class SubCategoriesCache {
125009
124385
  _appearances = new Map();
125010
124386
  _imodel;
125011
124387
  _missingAtTimeOfPreload;
125012
- constructor(imodel) { this._imodel = imodel; }
124388
+ constructor(imodel) {
124389
+ this._imodel = imodel;
124390
+ }
124391
+ attachToBriefcase(imodel) {
124392
+ // We want to do this in the constructor but can't, because IModelConnection.subcategories is initialized before
124393
+ // BriefcaseConnection.txns.
124394
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(imodel === this._imodel);
124395
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(imodel.isBriefcaseConnection());
124396
+ imodel.txns.onElementsChanged.addListener((changes) => {
124397
+ const affectedSubCategories = new Set();
124398
+ for (const change of changes) {
124399
+ if (change.metadata.is("BisCore:Category")) {
124400
+ if (change.type === "deleted") {
124401
+ this._byCategoryId.delete(change.id);
124402
+ }
124403
+ }
124404
+ else if (change.metadata.is("BisCore:SubCategory")) {
124405
+ if (change.type === "inserted") {
124406
+ // We don't know to which category the subcategory belongs. Blow away the entire cache.
124407
+ this._byCategoryId.clear();
124408
+ this._appearances.clear();
124409
+ return;
124410
+ }
124411
+ this._appearances.delete(change.id);
124412
+ affectedSubCategories.add(change.id);
124413
+ }
124414
+ }
124415
+ if (affectedSubCategories.size > 0) {
124416
+ for (const [catId, subCatIds] of this._byCategoryId) {
124417
+ for (const subCatId of affectedSubCategories) {
124418
+ if (subCatIds.has(subCatId)) {
124419
+ this._byCategoryId.delete(catId);
124420
+ affectedSubCategories.delete(subCatId);
124421
+ break;
124422
+ }
124423
+ }
124424
+ }
124425
+ }
124426
+ });
124427
+ }
125013
124428
  /** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */
125014
124429
  getSubCategories(categoryId) { return this._byCategoryId.get(categoryId); }
125015
124430
  /** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */
@@ -143246,6 +142661,845 @@ function getAllElementIdsFromScript(script) {
143246
142661
  }
143247
142662
 
143248
142663
 
142664
+ /***/ }),
142665
+
142666
+ /***/ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js":
142667
+ /*!********************************************************************!*\
142668
+ !*** ../../core/frontend/lib/esm/internal/SheetViewAttachments.js ***!
142669
+ \********************************************************************/
142670
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
142671
+
142672
+ "use strict";
142673
+ __webpack_require__.r(__webpack_exports__);
142674
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
142675
+ /* harmony export */ SheetViewAttachments: () => (/* binding */ SheetViewAttachments)
142676
+ /* harmony export */ });
142677
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
142678
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
142679
+ /* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
142680
+ /* harmony import */ var _ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ViewAttachmentRenderer */ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js");
142681
+ /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
142682
+ /*---------------------------------------------------------------------------------------------
142683
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
142684
+ * See LICENSE.md in the project root for license terms and full copyright notice.
142685
+ *--------------------------------------------------------------------------------------------*/
142686
+ /** @packageDocumentation
142687
+ * @module Views
142688
+ */
142689
+
142690
+
142691
+
142692
+
142693
+
142694
+ /** Stateless state for a sheet that has no view attachments. */
142695
+ class EmptyAttachments {
142696
+ // We only need one instance of this stateless class.
142697
+ static _instance;
142698
+ static get() {
142699
+ return this._instance ?? (this._instance = new EmptyAttachments());
142700
+ }
142701
+ constructor() { }
142702
+ clone() {
142703
+ return this;
142704
+ }
142705
+ preload() { }
142706
+ async postload() {
142707
+ return this;
142708
+ }
142709
+ get attachmentIds() {
142710
+ return [];
142711
+ }
142712
+ }
142713
+ /** Holds the element Ids of the view attachments to be loaded for display. */
142714
+ class AttachmentIds {
142715
+ _ids;
142716
+ constructor(ids) {
142717
+ this._ids = ids;
142718
+ }
142719
+ get attachmentIds() {
142720
+ return this._ids;
142721
+ }
142722
+ clone() {
142723
+ return new AttachmentIds([...this._ids]);
142724
+ }
142725
+ preload(request) {
142726
+ request.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.CompressedId64Set.sortAndCompress(this._ids);
142727
+ request.viewStateLoadProps = {
142728
+ displayStyle: {
142729
+ omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
142730
+ compressExcludedElementIds: true,
142731
+ },
142732
+ };
142733
+ }
142734
+ async postload(response, iModel) {
142735
+ if (undefined === response.sheetViewViews || undefined === response.sheetViewAttachmentProps) {
142736
+ return this;
142737
+ }
142738
+ const viewStateProps = response.sheetViewViews;
142739
+ const promises = [];
142740
+ for (const viewProps of viewStateProps) {
142741
+ const loadView = async () => {
142742
+ try {
142743
+ if (viewProps === undefined)
142744
+ return undefined;
142745
+ const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
142746
+ return view;
142747
+ }
142748
+ catch {
142749
+ return undefined;
142750
+ }
142751
+ };
142752
+ promises.push(loadView());
142753
+ }
142754
+ const views = await Promise.all(promises);
142755
+ const attachmentProps = response.sheetViewAttachmentProps;
142756
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
142757
+ const infos = [];
142758
+ for (let i = 0; i < views.length; i++) {
142759
+ const view = views[i];
142760
+ if (view && !(view.isSheetView())) {
142761
+ const props = attachmentProps[i];
142762
+ props.attachedView = view;
142763
+ infos.push(props);
142764
+ }
142765
+ }
142766
+ return new AttachmentInfos(infos);
142767
+ }
142768
+ }
142769
+ /** Fully loaded view attachments. */
142770
+ class AttachmentInfos {
142771
+ infos;
142772
+ constructor(infos) {
142773
+ this.infos = infos;
142774
+ }
142775
+ get attachmentIds() {
142776
+ return this.infos.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.expectDefined)(x.id));
142777
+ }
142778
+ clone(iModel) {
142779
+ const infos = this.infos.map((info) => {
142780
+ return {
142781
+ ...info,
142782
+ attachedView: info.attachedView.clone(iModel),
142783
+ };
142784
+ });
142785
+ return new AttachmentInfos(infos);
142786
+ }
142787
+ preload() {
142788
+ // already loaded.
142789
+ }
142790
+ async postload() {
142791
+ // already loaded.
142792
+ return this;
142793
+ }
142794
+ }
142795
+ /** Reloads the attachments after a change to the database. */
142796
+ async function reloadAttachments(sheetModelId, iModel) {
142797
+ const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${sheetModelId}`;
142798
+ const ids = [];
142799
+ for await (const row of iModel.createQueryReader(ecsql)) {
142800
+ ids.push(row[0]);
142801
+ }
142802
+ const attachmentProps = await iModel.elements.getProps(ids);
142803
+ const promises = [];
142804
+ for (const attachment of attachmentProps) {
142805
+ const loadView = async () => {
142806
+ try {
142807
+ const view = await iModel.views.load(attachment.view.id);
142808
+ return view;
142809
+ }
142810
+ catch {
142811
+ return undefined;
142812
+ }
142813
+ };
142814
+ promises.push(loadView());
142815
+ }
142816
+ const views = await Promise.all(promises);
142817
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
142818
+ const infos = [];
142819
+ for (let i = 0; i < views.length; i++) {
142820
+ const view = views[i];
142821
+ if (view && !view.isSheetView()) {
142822
+ const props = attachmentProps[i];
142823
+ props.attachedView = view;
142824
+ infos.push(props);
142825
+ }
142826
+ }
142827
+ return new AttachmentInfos(infos);
142828
+ }
142829
+ function disposeRenderers(renderers) {
142830
+ if (renderers) {
142831
+ for (const renderer of renderers) {
142832
+ renderer[Symbol.dispose]();
142833
+ }
142834
+ }
142835
+ }
142836
+ /** Manages the set of ViewAttachment elements to be rendered by a SheetViewState.
142837
+ * Takes care of reloading them after ViewAttachment elements are modified, deleted, or inserted.
142838
+ */
142839
+ class SheetViewAttachments {
142840
+ _impl;
142841
+ _reload;
142842
+ _maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
142843
+ _rendererArgs;
142844
+ _renderers;
142845
+ get maxDepth() {
142846
+ return this._maxDepth;
142847
+ }
142848
+ *getSecondaryViewports() {
142849
+ if (this._renderers) {
142850
+ for (const renderer of this._renderers) {
142851
+ if (renderer.viewport) {
142852
+ yield renderer.viewport;
142853
+ }
142854
+ }
142855
+ }
142856
+ }
142857
+ constructor(impl) {
142858
+ this._impl = impl;
142859
+ }
142860
+ [Symbol.dispose]() {
142861
+ disposeRenderers(this._renderers);
142862
+ this._renderers = this._rendererArgs = undefined;
142863
+ this._reload = undefined;
142864
+ }
142865
+ static create(attachmentIds) {
142866
+ const impl = attachmentIds.length === 0 ? EmptyAttachments.get() : new AttachmentIds([...attachmentIds]);
142867
+ return new this(impl);
142868
+ }
142869
+ get attachmentIds() {
142870
+ return this._impl.attachmentIds;
142871
+ }
142872
+ clone(iModel) {
142873
+ return new SheetViewAttachments(this._impl.clone(iModel));
142874
+ }
142875
+ preload(request) {
142876
+ this._impl.preload(request);
142877
+ }
142878
+ async postload(response, iModel) {
142879
+ this._impl = await this._impl.postload(response, iModel);
142880
+ }
142881
+ async reload(sheetModelId, iModel) {
142882
+ const renderers = this._renderers;
142883
+ const reload = this._reload = reloadAttachments(sheetModelId, iModel);
142884
+ const impl = await this._reload;
142885
+ // We keep the previous renderers until reloading completes, to avoid drawing a blank view while waiting.
142886
+ // Afterward, always destroy the previous renderers.
142887
+ disposeRenderers(renderers);
142888
+ // If reload was not called again while we waited...
142889
+ if (this._reload === reload) {
142890
+ this._impl = impl;
142891
+ this._reload = this._renderers = undefined;
142892
+ if (this._rendererArgs) {
142893
+ // We are attached to a Viewport - reload the renderers.
142894
+ this.loadRenderers();
142895
+ }
142896
+ }
142897
+ }
142898
+ attachToViewport(args) {
142899
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
142900
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._rendererArgs);
142901
+ this._rendererArgs = args;
142902
+ this.loadRenderers();
142903
+ }
142904
+ detachFromViewport() {
142905
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== this._rendererArgs);
142906
+ this._rendererArgs = undefined;
142907
+ disposeRenderers(this._renderers);
142908
+ this._renderers = undefined;
142909
+ }
142910
+ areAllTileTreesLoaded(displayedExtents) {
142911
+ if (this._reload) {
142912
+ return false;
142913
+ }
142914
+ else if (!this._renderers) {
142915
+ return true;
142916
+ }
142917
+ return this._renderers.every((renderer) => {
142918
+ const attachmentRange = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(renderer.viewAttachmentProps.placement).calculateRange();
142919
+ return !attachmentRange.intersectsRangeXY(displayedExtents) || renderer.areAllTileTreesLoaded;
142920
+ });
142921
+ }
142922
+ discloseTileTrees(trees) {
142923
+ for (const renderer of this.renderers()) {
142924
+ trees.disclose(renderer);
142925
+ }
142926
+ }
142927
+ collectStatistics(stats) {
142928
+ for (const renderer of this.renderers()) {
142929
+ renderer.collectStatistics(stats);
142930
+ }
142931
+ }
142932
+ addToScene(context) {
142933
+ for (const renderer of this.renderers()) {
142934
+ renderer.addToScene(context);
142935
+ }
142936
+ }
142937
+ getAttachmentViewport(args) {
142938
+ const renderer = args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
142939
+ if (!renderer) {
142940
+ return undefined;
142941
+ }
142942
+ return args.inSectionDrawingAttachment ? renderer.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : renderer.viewport;
142943
+ }
142944
+ computeDisplayTransform(args) {
142945
+ const renderer = undefined !== args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
142946
+ const ortho = renderer?.ortho;
142947
+ const sheetTransform = ortho?.toSheet;
142948
+ if (!sheetTransform) {
142949
+ return undefined;
142950
+ }
142951
+ const sectionTransform = args.inSectionDrawingAttachment ? ortho.view.computeDisplayTransform(args) : undefined;
142952
+ if (!sectionTransform) {
142953
+ return sheetTransform.clone(args.output);
142954
+ }
142955
+ return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
142956
+ }
142957
+ /** Strictly for tests. */
142958
+ areAllAttachmentsLoaded() {
142959
+ return !this._reload && (!this._renderers || this._renderers.every((x) => x.areAllTileTreesLoaded));
142960
+ }
142961
+ /** Strictly for tests. */
142962
+ get attachments() {
142963
+ return this._renderers;
142964
+ }
142965
+ /** Strictly for tests. */
142966
+ get attachmentProps() {
142967
+ const infos = this._impl.infos;
142968
+ if (!infos) {
142969
+ return [];
142970
+ }
142971
+ return infos.map((x) => {
142972
+ return {
142973
+ ...x,
142974
+ attachedView: undefined,
142975
+ };
142976
+ });
142977
+ }
142978
+ /** Strictly for tests. */
142979
+ get attachmentInfos() {
142980
+ const infos = this._impl.infos;
142981
+ return infos ?? this._impl.attachmentIds;
142982
+ }
142983
+ loadRenderers() {
142984
+ const args = this._rendererArgs;
142985
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== args);
142986
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
142987
+ this._maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
142988
+ const infos = this._impl.infos;
142989
+ if (!infos) {
142990
+ return;
142991
+ }
142992
+ this._renderers = infos.map((info) => {
142993
+ const renderer = (0,_ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__.createViewAttachmentRenderer)({
142994
+ ...args,
142995
+ props: info,
142996
+ view: info.attachedView,
142997
+ });
142998
+ this._maxDepth = Math.max(this._maxDepth, renderer.zDepth);
142999
+ return renderer;
143000
+ });
143001
+ }
143002
+ *renderers() {
143003
+ if (this._renderers) {
143004
+ for (const renderer of this._renderers) {
143005
+ yield renderer;
143006
+ }
143007
+ }
143008
+ }
143009
+ findRendererById(id) {
143010
+ return this._renderers?.find((x) => x.viewAttachmentProps.id === id);
143011
+ }
143012
+ }
143013
+
143014
+
143015
+ /***/ }),
143016
+
143017
+ /***/ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js":
143018
+ /*!**********************************************************************!*\
143019
+ !*** ../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js ***!
143020
+ \**********************************************************************/
143021
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
143022
+
143023
+ "use strict";
143024
+ __webpack_require__.r(__webpack_exports__);
143025
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
143026
+ /* harmony export */ createViewAttachmentRenderer: () => (/* binding */ createViewAttachmentRenderer)
143027
+ /* harmony export */ });
143028
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
143029
+ /* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
143030
+ /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
143031
+ /* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
143032
+ /* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Viewport */ "../../core/frontend/lib/esm/Viewport.js");
143033
+ /* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
143034
+ /* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
143035
+ /* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
143036
+ /* harmony import */ var _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../render/FeatureSymbology */ "../../core/frontend/lib/esm/render/FeatureSymbology.js");
143037
+ /* harmony import */ var _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../render/GraphicBranch */ "../../core/frontend/lib/esm/render/GraphicBranch.js");
143038
+ /* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
143039
+ /* harmony import */ var _render_MockRender__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./render/MockRender */ "../../core/frontend/lib/esm/internal/render/MockRender.js");
143040
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
143041
+ /* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
143042
+ /* harmony import */ var _tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tile/ViewFlagOverrides */ "../../core/frontend/lib/esm/internal/tile/ViewFlagOverrides.js");
143043
+ /*---------------------------------------------------------------------------------------------
143044
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
143045
+ * See LICENSE.md in the project root for license terms and full copyright notice.
143046
+ *--------------------------------------------------------------------------------------------*/
143047
+ /** @packageDocumentation
143048
+ * @module Views
143049
+ */
143050
+
143051
+
143052
+
143053
+
143054
+
143055
+
143056
+
143057
+
143058
+
143059
+
143060
+
143061
+
143062
+
143063
+
143064
+
143065
+ function createViewAttachmentRenderer(args) {
143066
+ const { props, view } = args;
143067
+ if (props.jsonProperties?.displayOptions?.drawAsRaster || (view.is3d() && view.isCameraOn)) {
143068
+ return new RasterAttachment(view, props, args.backgroundColor);
143069
+ }
143070
+ else {
143071
+ return new OrthographicAttachment(view, props, args.sheetModelId);
143072
+ }
143073
+ }
143074
+ /** A mostly no-op RenderTarget for an OrthographicAttachment. */
143075
+ class AttachmentTarget extends _render_MockRender__WEBPACK_IMPORTED_MODULE_11__.MockRender.OffScreenTarget {
143076
+ _attachment;
143077
+ constructor(attachment) {
143078
+ // The dimensions don't matter - we're not drawing anything.
143079
+ const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(1, 1);
143080
+ super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem, rect);
143081
+ this._attachment = attachment;
143082
+ }
143083
+ changeScene(scene) {
143084
+ this._attachment.scene = scene;
143085
+ }
143086
+ overrideFeatureSymbology(ovrs) {
143087
+ this._attachment.symbologyOverrides = ovrs;
143088
+ }
143089
+ }
143090
+ /** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
143091
+ * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
143092
+ * collect the resultant graphics and add them to the sheet view's scene.
143093
+ */
143094
+ class OrthographicAttachment {
143095
+ _viewport;
143096
+ _props;
143097
+ _sheetModelId;
143098
+ _viewFlagOverrides;
143099
+ _toSheet;
143100
+ _fromSheet;
143101
+ _sizeInMeters;
143102
+ _range;
143103
+ _viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, 1, 1);
143104
+ _originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Frustum();
143105
+ _clipVolume;
143106
+ _hiddenLineSettings;
143107
+ _scale;
143108
+ _debugFeatureTable;
143109
+ scene;
143110
+ symbologyOverrides;
143111
+ zDepth;
143112
+ get view() {
143113
+ return this._viewport.view;
143114
+ }
143115
+ get viewAttachmentProps() {
143116
+ return this._props;
143117
+ }
143118
+ get viewport() {
143119
+ return this._viewport;
143120
+ }
143121
+ constructor(view, props, sheetModelId) {
143122
+ this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
143123
+ const target = new AttachmentTarget(this);
143124
+ this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport.createViewport(view, target, true);
143125
+ this._props = props;
143126
+ this._sheetModelId = sheetModelId;
143127
+ const applyClip = true; // set to false for debugging
143128
+ this._viewFlagOverrides = {
143129
+ ...view.viewFlags,
143130
+ clipVolume: applyClip,
143131
+ lighting: false,
143132
+ shadows: false,
143133
+ };
143134
+ const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
143135
+ const range = placement.calculateRange();
143136
+ this._range = range;
143137
+ this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(range.xLength(), range.yLength());
143138
+ // Compute transform from attached view's world coordinates to sheet's world coordinates.
143139
+ // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
143140
+ const applySkew = true; // set to false for debugging
143141
+ const skew = applySkew ? view.getAspectRatioSkew() : 1;
143142
+ const extents = this._viewport.viewingSpace.viewDelta.clone();
143143
+ const zDepth = Math.abs(extents.z);
143144
+ const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
143145
+ const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
143146
+ this._scale = { x: 1 / scaleX, y: 1 / scaleY };
143147
+ const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
143148
+ this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
143149
+ // View origin is at the *back* of the view. Align *front* of view based on display priority.
143150
+ const viewRot = view.getRotation();
143151
+ const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
143152
+ viewOrg.z += zDepth;
143153
+ viewRot.multiplyTransposeVectorInPlace(viewOrg);
143154
+ const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.createScale(scaleX, scaleY, 1);
143155
+ matrix.multiplyMatrixMatrix(viewRot, matrix);
143156
+ const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
143157
+ const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.createFrom(placement.origin);
143158
+ attachmentOrigin.z = zBias;
143159
+ const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
143160
+ origin.addInPlace(viewOrgToAttachment);
143161
+ this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Transform.createRefs(origin, matrix);
143162
+ this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.expectDefined)(this._toSheet.inverse());
143163
+ // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
143164
+ // The clip needs to be transformed into sheet space.
143165
+ if (view.isDrawingView())
143166
+ this._viewport.drawingToSheetTransform = this._toSheet;
143167
+ // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
143168
+ // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
143169
+ // introduce additional computation, so possibly not worth it.
143170
+ // Transform the view's clip (if any) to sheet space
143171
+ let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
143172
+ if (viewClip)
143173
+ viewClip.transformInPlace(this._toSheet);
143174
+ else
143175
+ viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.createEmpty();
143176
+ let sheetClip;
143177
+ if (undefined !== props.jsonProperties?.clip)
143178
+ sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(props.jsonProperties?.clip);
143179
+ if (sheetClip && sheetClip.isValid) {
143180
+ // Clip to view attachment's clip. NB: clip is in sheet coordinate space.
143181
+ for (const clip of sheetClip.clips)
143182
+ viewClip.clips.push(clip);
143183
+ }
143184
+ else {
143185
+ // Clip to view attachment's bounding box
143186
+ viewClip.appendShape([
143187
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.low.y),
143188
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.low.y),
143189
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.high.y),
143190
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.high.y),
143191
+ ]);
143192
+ }
143193
+ this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(viewClip);
143194
+ // Save off the original frustum (potentially adjusted by viewport).
143195
+ this._viewport.setupFromView();
143196
+ this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_1__.CoordSystem.World, true, this._originalFrustum);
143197
+ const applyHiddenLineSettings = true; // for debugging edge display, set to false...
143198
+ const style = view.displayStyle;
143199
+ if (style.is3d() && applyHiddenLineSettings)
143200
+ this._hiddenLineSettings = style.settings.hiddenLineSettings;
143201
+ }
143202
+ [Symbol.dispose]() {
143203
+ this._viewport[Symbol.dispose]();
143204
+ }
143205
+ discloseTileTrees(trees) {
143206
+ trees.disclose(this._viewport);
143207
+ }
143208
+ addToScene(context) {
143209
+ if (context.viewport.freezeScene)
143210
+ return;
143211
+ if (!context.viewport.view.viewsCategory(this._props.category))
143212
+ return;
143213
+ const wantBounds = context.viewport.wantViewAttachmentBoundaries;
143214
+ const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
143215
+ if (wantBounds || wantClipShapes) {
143216
+ const builder = context.createSceneGraphicBuilder();
143217
+ if (wantBounds) {
143218
+ builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
143219
+ builder.addRangeBox(this._range);
143220
+ }
143221
+ if (wantClipShapes && this._clipVolume) {
143222
+ builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, 2);
143223
+ for (const prim of this._clipVolume.clipVector.clips) {
143224
+ if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipShape))
143225
+ continue; // ###TODO handle non-shape primitives, if any such ever encountered
143226
+ const pts = [];
143227
+ const tf = prim.transformFromClip;
143228
+ for (const pt of prim.polygon) {
143229
+ const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
143230
+ pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(tfPt.x, tfPt.y));
143231
+ }
143232
+ builder.addLineString2d(pts, 0);
143233
+ }
143234
+ }
143235
+ // Put into a Batch so that we can see tooltip with attachment Id on mouseover.
143236
+ const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
143237
+ context.outputGraphic(batch);
143238
+ }
143239
+ if (!context.viewport.wantViewAttachments)
143240
+ return;
143241
+ // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
143242
+ const pixelSize = context.viewport.getPixelSizeAtPoint();
143243
+ if (0 === pixelSize)
143244
+ return;
143245
+ // Adjust attached view frustum based on intersection with sheet view frustum.
143246
+ const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
143247
+ const attachFrustumRange = attachFrustum.toRange();
143248
+ const sheetFrustum = context.viewport.getWorldFrustum();
143249
+ const sheetFrustumRange = sheetFrustum.toRange();
143250
+ const intersect = attachFrustumRange.intersect(sheetFrustumRange);
143251
+ if (intersect.isNull)
143252
+ return;
143253
+ attachFrustum.initFromRange(intersect);
143254
+ attachFrustum.transformBy(this._fromSheet, attachFrustum);
143255
+ this._viewport.setupViewFromFrustum(attachFrustum);
143256
+ // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
143257
+ const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
143258
+ const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
143259
+ this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
143260
+ this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
143261
+ this._viewport.setRect(this._viewRect);
143262
+ // Propagate settings from on-screen viewport.
143263
+ this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
143264
+ this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
143265
+ // Create the scene.
143266
+ this._viewport.renderFrame();
143267
+ const scene = this.scene;
143268
+ if (!scene)
143269
+ return;
143270
+ // Extract scene graphics and insert into on-screen scene context.
143271
+ const options = {
143272
+ viewAttachmentId: this._props.id,
143273
+ clipVolume: this._clipVolume,
143274
+ hline: this._hiddenLineSettings,
143275
+ frustum: {
143276
+ is3d: this.view.is3d(),
143277
+ scale: this._scale,
143278
+ },
143279
+ };
143280
+ const outputGraphics = (source) => {
143281
+ if (0 === source.length)
143282
+ return;
143283
+ const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch();
143284
+ graphics.setViewFlagOverrides(this._viewFlagOverrides);
143285
+ graphics.symbologyOverrides = this.symbologyOverrides;
143286
+ for (const graphic of source)
143287
+ graphics.entries.push(graphic);
143288
+ const branch = context.createGraphicBranch(graphics, this._toSheet, options);
143289
+ context.outputGraphic(branch);
143290
+ };
143291
+ outputGraphics(scene.foreground);
143292
+ context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
143293
+ context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
143294
+ // Report tile statistics to sheet view's viewport.
143295
+ const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.tileAdmin;
143296
+ const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
143297
+ const requested = tileAdmin.getRequestsForUser(this._viewport);
143298
+ tileAdmin.addExternalTilesForUser(context.viewport, {
143299
+ requested: requested?.size ?? 0,
143300
+ selected: selectedAndReady?.selected.size ?? 0,
143301
+ ready: selectedAndReady?.ready.size ?? 0,
143302
+ });
143303
+ }
143304
+ getDebugFeatureTable() {
143305
+ if (this._debugFeatureTable)
143306
+ return this._debugFeatureTable;
143307
+ const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.FeatureTable(1, this._sheetModelId);
143308
+ featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Feature(this._props.id));
143309
+ this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.PackedFeatureTable.pack(featureTable);
143310
+ return this._debugFeatureTable;
143311
+ }
143312
+ get areAllTileTreesLoaded() {
143313
+ return this.view.areAllTileTreesLoaded;
143314
+ }
143315
+ collectStatistics(_stats) {
143316
+ // Handled by discloseTileTrees()
143317
+ }
143318
+ get ortho() {
143319
+ return {
143320
+ toSheet: this._toSheet,
143321
+ view: this.view,
143322
+ };
143323
+ }
143324
+ }
143325
+ function createRasterAttachmentViewport(_view, _rect, _attachment) {
143326
+ class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport {
143327
+ _sceneContext;
143328
+ _isSceneReady = false;
143329
+ _attachment;
143330
+ constructor(view, rect, attachment) {
143331
+ super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createOffscreenTarget(rect));
143332
+ this._attachment = attachment;
143333
+ this._isAspectRatioLocked = true;
143334
+ this.changeView(view);
143335
+ }
143336
+ createSceneContext() {
143337
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
143338
+ this._sceneContext = super.createSceneContext();
143339
+ return this._sceneContext;
143340
+ }
143341
+ renderFrame() {
143342
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
143343
+ this.clearSceneContext();
143344
+ super.renderFrame();
143345
+ if (undefined !== this._sceneContext) {
143346
+ this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
143347
+ if (this._isSceneReady)
143348
+ this._attachment.produceGraphics(this._sceneContext);
143349
+ this._sceneContext = undefined;
143350
+ }
143351
+ }
143352
+ clearSceneContext() {
143353
+ this._sceneContext = undefined;
143354
+ }
143355
+ addDecorations() {
143356
+ // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
143357
+ }
143358
+ }
143359
+ return new RasterAttachmentViewport(_view, _rect, _attachment);
143360
+ }
143361
+ /** Draws a 3d view (usually with camera enabled) into a sheet view by producing an image of the view's contents offscreen. */
143362
+ class RasterAttachment {
143363
+ _props;
143364
+ _placement;
143365
+ _transform;
143366
+ zDepth;
143367
+ _viewport;
143368
+ _graphics;
143369
+ constructor(view, props, bgColor) {
143370
+ // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
143371
+ const maxSize = 2048;
143372
+ const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, maxSize, maxSize);
143373
+ const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
143374
+ const skew = maxSize / height;
143375
+ view.setAspectRatioSkew(skew);
143376
+ if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
143377
+ // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
143378
+ view.displayStyle.backgroundColor = bgColor.withAlpha(0);
143379
+ }
143380
+ this._viewport = createRasterAttachmentViewport(view, rect, this);
143381
+ this._props = props;
143382
+ this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
143383
+ this._transform = this._placement.transform;
143384
+ this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
143385
+ }
143386
+ [Symbol.dispose]() {
143387
+ this._viewport?.[Symbol.dispose]();
143388
+ }
143389
+ get viewAttachmentProps() {
143390
+ return this._props;
143391
+ }
143392
+ get viewport() {
143393
+ return this._viewport;
143394
+ }
143395
+ get areAllTileTreesLoaded() {
143396
+ return this._viewport?.areAllTileTreesLoaded ?? true;
143397
+ }
143398
+ addToScene(context) {
143399
+ // ###TODO: check viewport.wantViewAttachmentClipShapes
143400
+ if (!context.viewport.view.viewsCategory(this._props.category))
143401
+ return;
143402
+ if (context.viewport.wantViewAttachmentBoundaries) {
143403
+ const builder = context.createSceneGraphicBuilder(this._transform);
143404
+ builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
143405
+ builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Range3d.createRange2d(this._placement.bbox));
143406
+ context.outputGraphic(builder.finish());
143407
+ }
143408
+ if (!context.viewport.wantViewAttachments)
143409
+ return;
143410
+ if (this._graphics) {
143411
+ context.outputGraphic(this._graphics);
143412
+ return;
143413
+ }
143414
+ if (undefined === this._viewport)
143415
+ return;
143416
+ this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
143417
+ this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
143418
+ this._viewport.renderFrame();
143419
+ if (this._graphics)
143420
+ context.outputGraphic(this._graphics);
143421
+ }
143422
+ discloseTileTrees(trees) {
143423
+ if (this._viewport)
143424
+ trees.disclose(this._viewport);
143425
+ }
143426
+ produceGraphics(context) {
143427
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(context.viewport === this._viewport);
143428
+ this._graphics = this.createGraphics(this._viewport);
143429
+ this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.dispose)(this._viewport);
143430
+ if (undefined !== this._graphics)
143431
+ context.outputGraphic(this._graphics);
143432
+ }
143433
+ createGraphics(vp) {
143434
+ // Create a texture from the contents of the view.
143435
+ const image = vp.readImageBuffer({ upsideDown: true });
143436
+ if (undefined === image)
143437
+ return undefined;
143438
+ const debugImage = false; // set to true to open a window displaying the captured image.
143439
+ if (debugImage) {
143440
+ const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.imageBufferToPngDataUrl)(image, false);
143441
+ if (url)
143442
+ (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.openImageDataUrlInNewWindow)(url, "Attachment");
143443
+ }
143444
+ const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createTexture({
143445
+ image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.TextureTransparency.Opaque },
143446
+ });
143447
+ if (!texture)
143448
+ return undefined;
143449
+ // Create a material for the texture
143450
+ const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.GraphicParams();
143451
+ graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
143452
+ // Apply the texture to a rectangular polyface.
143453
+ const depth = this.zDepth;
143454
+ const east = this._placement.bbox.low.x;
143455
+ const west = this._placement.bbox.high.x;
143456
+ const north = this._placement.bbox.low.y;
143457
+ const south = this._placement.bbox.high.y;
143458
+ const corners = [
143459
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, north, depth),
143460
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, north, depth),
143461
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, south, depth),
143462
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, south, depth),
143463
+ ];
143464
+ const params = [
143465
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 0),
143466
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 0),
143467
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 1),
143468
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 1),
143469
+ ];
143470
+ const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.StrokeOptions();
143471
+ strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
143472
+ const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.PolyfaceBuilder.create(strokeOptions);
143473
+ polyfaceBuilder.addQuadFacet(corners, params);
143474
+ const polyface = polyfaceBuilder.claimPolyface();
143475
+ const graphicBuilder = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createGraphicBuilder(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Transform.createIdentity(), _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__.GraphicType.Scene, vp, this._props.id);
143476
+ graphicBuilder.activateGraphicParams(graphicParams);
143477
+ graphicBuilder.addPolyface(polyface, false);
143478
+ const graphic = graphicBuilder.finish();
143479
+ // Wrap the polyface in a GraphicBranch.
143480
+ const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch(true);
143481
+ const vfOvrs = (0,_tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
143482
+ // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
143483
+ vfOvrs.transparency = false;
143484
+ branch.setViewFlagOverrides(vfOvrs);
143485
+ branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
143486
+ branch.entries.push(graphic);
143487
+ // Apply the attachment's clip, if any.
143488
+ let clipVolume;
143489
+ if (this._props.jsonProperties?.clip) {
143490
+ const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
143491
+ if (clipVector.isValid)
143492
+ clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(clipVector);
143493
+ }
143494
+ return _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
143495
+ }
143496
+ collectStatistics(stats) {
143497
+ if (this._graphics)
143498
+ this._graphics.collectStatistics(stats);
143499
+ }
143500
+ }
143501
+
143502
+
143249
143503
  /***/ }),
143250
143504
 
143251
143505
  /***/ "../../core/frontend/lib/esm/internal/cross-package.js":
@@ -159459,12 +159713,19 @@ class VertexShaderBuilder extends ShaderBuilder {
159459
159713
  }
159460
159714
  main.addline(" v_color = baseColor;");
159461
159715
  }
159716
+ /*
159717
+ There is currently a driver glitch which is known to affect much of the Intel Ultra 7 family of chipsets when using Intel driver from some point after driver version 32.0.101.6078 (9/13/2024).
159718
+
159719
+ The graphics driver will glitch when discarding triangles using the vertex shader (setting all vertices to the same value) if gl_Position was not initialized to a valid position beforehand.
159720
+
159721
+ The workaround for this bug involves ensuring that gl_Position is initialized to a valid position before attempting a discard using a degenerate triangle.
159722
+ */
159723
+ main.addline(" gl_Position = computePosition(rawPosition);");
159462
159724
  const checkForDiscard = this.get(9 /* VertexShaderComponent.CheckForDiscard */);
159463
159725
  if (undefined !== checkForDiscard) {
159464
159726
  prelude.addFunction("bool checkForDiscard()", checkForDiscard);
159465
159727
  main.add(_glsl_Vertex__WEBPACK_IMPORTED_MODULE_3__.vertexDiscard);
159466
159728
  }
159467
- main.addline(" gl_Position = computePosition(rawPosition);");
159468
159729
  const finalizePos = this.get(13 /* VertexShaderComponent.FinalizePosition */);
159469
159730
  if (undefined !== finalizePos) {
159470
159731
  prelude.addFunction("vec4 finalizePosition(vec4 pos)", finalizePos);
@@ -224115,7 +224376,7 @@ __webpack_require__.r(__webpack_exports__);
224115
224376
 
224116
224377
 
224117
224378
  /**
224118
- * CurveLocationDetail carries point and paramter data about a point evaluated on a curve.
224379
+ * CurveLocationDetail carries point and parameter data about a point evaluated on a curve.
224119
224380
  * * These are returned by a variety of queries.
224120
224381
  * * Particular contents can vary among the queries.
224121
224382
  * @public
@@ -245004,11 +245265,13 @@ __webpack_require__.r(__webpack_exports__);
245004
245265
  /* harmony import */ var _CurveChainWithDistanceIndex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../CurveChainWithDistanceIndex */ "../../core/geometry/lib/esm/curve/CurveChainWithDistanceIndex.js");
245005
245266
  /* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
245006
245267
  /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
245268
+ /* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
245007
245269
  /* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
245008
245270
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
245009
245271
  /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
245010
245272
  /* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Path */ "../../core/geometry/lib/esm/curve/Path.js");
245011
245273
  /* harmony import */ var _ProxyCurve__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ProxyCurve */ "../../core/geometry/lib/esm/curve/ProxyCurve.js");
245274
+ /* harmony import */ var _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../spiral/TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
245012
245275
  /*---------------------------------------------------------------------------------------------
245013
245276
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
245014
245277
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -245035,6 +245298,8 @@ __webpack_require__.r(__webpack_exports__);
245035
245298
 
245036
245299
 
245037
245300
 
245301
+
245302
+
245038
245303
 
245039
245304
 
245040
245305
 
@@ -245734,7 +245999,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245734
245999
  return undefined;
245735
246000
  }
245736
246001
  /** Detail computation for linestring intersecting linestring. */
245737
- computeLineStringLineString(lsA, lsB, reversed) {
246002
+ computeLineStringLineString(lsA, extendA0, extendA1, lsB, extendB0, extendB1, reversed) {
245738
246003
  const pointA0 = CurveCurveIntersectXY._workPointAA0;
245739
246004
  const pointA1 = CurveCurveIntersectXY._workPointAA1;
245740
246005
  const pointB0 = CurveCurveIntersectXY._workPointBB0;
@@ -245758,7 +246023,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245758
246023
  for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
245759
246024
  lsB.pointAt(ib, pointB1);
245760
246025
  fB1 = ib * dfB;
245761
- this.dispatchSegmentSegment(lsA, ia === 1 && this._extendA0, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && this._extendA1, lsB, ib === 1 && this._extendB0, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && this._extendB1, reversed);
246026
+ this.dispatchSegmentSegment(lsA, ia === 1 && extendA0, pointA0, fA0, pointA1, fA1, (ia + 1) === numA && extendA1, lsB, ib === 1 && extendB0, pointB0, fB0, pointB1, fB1, (ib + 1) === numB && extendB1, reversed);
245762
246027
  }
245763
246028
  }
245764
246029
  }
@@ -245857,6 +246122,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245857
246122
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
245858
246123
  this.dispatchSegmentBsplineCurve(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
245859
246124
  }
246125
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246126
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246127
+ this._geometryB.emitStrokes(spiralApproximation);
246128
+ const numPreviousResults = this._results.length;
246129
+ this.computeSegmentLineString(segmentA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
246130
+ const numberOfNewResults = this._results.length - numPreviousResults;
246131
+ this.refineSpiralResultsByNewton(segmentA, this._geometryB, numberOfNewResults);
246132
+ }
245860
246133
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245861
246134
  this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
245862
246135
  }
@@ -245869,7 +246142,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245869
246142
  handleLineString3d(lsA) {
245870
246143
  if (this._geometryB instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d) {
245871
246144
  const lsB = this._geometryB;
245872
- this.computeLineStringLineString(lsA, lsB, false);
246145
+ this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, lsB, this._extendB0, this._extendB1, false);
245873
246146
  }
245874
246147
  else if (this._geometryB instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__.LineSegment3d) {
245875
246148
  this.computeSegmentLineString(this._geometryB, this._extendB0, this._extendB1, lsA, this._extendA0, this._extendA1, true);
@@ -245880,6 +246153,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245880
246153
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
245881
246154
  this.dispatchLineStringBSplineCurve(lsA, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
245882
246155
  }
246156
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246157
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246158
+ this._geometryB.emitStrokes(spiralApproximation);
246159
+ const numPreviousResults = this._results.length;
246160
+ this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
246161
+ const numberOfNewResults = this._results.length - numPreviousResults;
246162
+ this.refineSpiralResultsByNewton(lsA, this._geometryB, numberOfNewResults);
246163
+ }
245883
246164
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245884
246165
  this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
245885
246166
  }
@@ -245902,6 +246183,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245902
246183
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
245903
246184
  this.dispatchArcBsplineCurve3d(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
245904
246185
  }
246186
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246187
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246188
+ this._geometryB.emitStrokes(spiralApproximation);
246189
+ const numPreviousResults = this._results.length;
246190
+ this.computeArcLineString(arc0, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
246191
+ const numberOfNewResults = this._results.length - numPreviousResults;
246192
+ this.refineSpiralResultsByNewton(arc0, this._geometryB, numberOfNewResults);
246193
+ }
245905
246194
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245906
246195
  this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
245907
246196
  }
@@ -245924,6 +246213,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245924
246213
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3dBase) {
245925
246214
  this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
245926
246215
  }
246216
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246217
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246218
+ this._geometryB.emitStrokes(spiralApproximation);
246219
+ const numPreviousResults = this._results.length;
246220
+ this.dispatchLineStringBSplineCurve(spiralApproximation, false, false, curve, this._extendA0, this._extendA1, true);
246221
+ const numberOfNewResults = this._results.length - numPreviousResults;
246222
+ this.refineSpiralResultsByNewton(curve, this._geometryB, numberOfNewResults);
246223
+ }
245927
246224
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245928
246225
  this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));
245929
246226
  }
@@ -245932,6 +246229,47 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245932
246229
  }
245933
246230
  return undefined;
245934
246231
  }
246232
+ /**
246233
+ * Assuming the tail of `this._results` holds the given number of approximate solutions to the curve-spiral
246234
+ * xy-intersection problem, replace each with its Newton refinement, unless it doesn't converge, in which case
246235
+ * it is removed.
246236
+ * @param spiral The transition spiral.
246237
+ * @param otherCurve The other curve primitive.
246238
+ * @param numberOfNewResults The number of results in the tail of `this._results` to be refined.
246239
+ * @param reversed Whether the spiral is geometryA (true) or geometryB (false).
246240
+ */
246241
+ refineSpiralResultsByNewton(otherCurve, spiral, numberOfNewResults, reversed = false) {
246242
+ const resultsToBeRefined = this._results.slice(this._results.length - numberOfNewResults);
246243
+ this._results.length -= numberOfNewResults; // keep already refined results
246244
+ for (const detail of resultsToBeRefined) {
246245
+ let spiralFraction = reversed ? detail.detailA.fraction : detail.detailB.fraction;
246246
+ let otherFraction = reversed ? detail.detailB.fraction : detail.detailA.fraction;
246247
+ const xyMatchingFunction = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.CurveCurveIntersectionXYRRToRRD(spiral, otherCurve);
246248
+ const newtonSearcher = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.Newton2dUnboundedWithDerivative(xyMatchingFunction);
246249
+ newtonSearcher.setUV(spiralFraction, otherFraction);
246250
+ if (newtonSearcher.runIterations()) {
246251
+ spiralFraction = newtonSearcher.getU();
246252
+ otherFraction = newtonSearcher.getV();
246253
+ if (this.acceptFraction(false, spiralFraction, false) && this.acceptFraction(false, otherFraction, false))
246254
+ this.recordPointWithLocalFractions(otherFraction, otherCurve, 0, 1, spiralFraction, spiral, 0, 1, reversed);
246255
+ }
246256
+ }
246257
+ }
246258
+ /** Double dispatch handler for strongly typed spiral curve. */
246259
+ handleTransitionSpiral(spiral) {
246260
+ if (this._geometryB instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__.CurvePrimitive) { // this also handles CurveChainWithDistanceIndex
246261
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246262
+ spiral.emitStrokes(spiralApproximation);
246263
+ const numPreviousResults = this._results.length;
246264
+ this.handleLineString3d(spiralApproximation);
246265
+ const numberOfNewResults = this._results.length - numPreviousResults;
246266
+ this.refineSpiralResultsByNewton(this._geometryB, spiral, numberOfNewResults, true);
246267
+ }
246268
+ else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
246269
+ this.dispatchCurveCollection(spiral, this.handleTransitionSpiral.bind(this));
246270
+ }
246271
+ return undefined;
246272
+ }
245935
246273
  /** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */
245936
246274
  handleCurveChainWithDistanceIndex(chain) {
245937
246275
  super.handleCurveChainWithDistanceIndex(chain);
@@ -249621,7 +249959,7 @@ class AustralianRailCorpXYEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MO
249621
249959
  * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
249622
249960
  * an x coordinate.
249623
249961
  * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
249624
- * this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
249962
+ * this.fractionToX(fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
249625
249963
  * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
249626
249964
  * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
249627
249965
  * more accurate CurvePrimitive measurements.
@@ -249672,8 +250010,8 @@ __webpack_require__.r(__webpack_exports__);
249672
250010
  * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.
249673
250011
  * Each instance has:
249674
250012
  * * number of x and y terms to use.
249675
- * * constant for theta = c*x*x.
249676
- * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
250013
+ * * constant for theta = cxx.
250014
+ * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.
249677
250015
  * @internal
249678
250016
  */
249679
250017
  class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODULE_0__.XYCurveEvaluator {
@@ -249681,7 +250019,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249681
250019
  numXTerms;
249682
250020
  /** Number of terms to use in y Taylor series. */
249683
250021
  numYTerms;
249684
- /** Constant c = 1/(2*R*L) in theta = c*s*s. */
250022
+ /** Constant c = 1/2RL in theta = cxx. */
249685
250023
  constantDiv2LR;
249686
250024
  /** The nominal curve length. */
249687
250025
  nominalLength1;
@@ -249758,10 +250096,12 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249758
250096
  * @param numTerms number of terms to use.
249759
250097
  */
249760
250098
  fractionToXGo(fraction, numTerms) {
249761
- // write the Taylor series for cos(theta)
249762
- // replace theta by s*s*c
249763
- // integrate wrt s
249764
- // x = s - s^5 c^2/ 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
250099
+ // write the Taylor series for cos(theta):
250100
+ // 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...
250101
+ // replace theta by s*s*c:
250102
+ // 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...
250103
+ // integrate wrt s:
250104
+ // x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
249765
250105
  // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )
249766
250106
  const s = fraction * this.nominalLength1;
249767
250107
  let result = s;
@@ -249781,9 +250121,11 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249781
250121
  return result;
249782
250122
  }
249783
250123
  fractionToYGo(fraction, numTerms) {
249784
- // write the Taylor series for sin(theta)
249785
- // replace theta by s*s*c
249786
- // integrate wrt s
250124
+ // write the Taylor series for sin(theta):
250125
+ // theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...
250126
+ // replace theta by s*s*c:
250127
+ // s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...
250128
+ // integrate wrt s:
249787
250129
  // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...
249788
250130
  // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )
249789
250131
  const s = fraction * this.nominalLength1;
@@ -249831,7 +250173,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249831
250173
  // dY = q - q^3/3!
249832
250174
  // q = s^2 c
249833
250175
  // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!
249834
- // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
250176
+ // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
249835
250177
  const s = fraction * this.nominalLength1;
249836
250178
  const q1 = s * s * this.constantDiv2LR;
249837
250179
  let result = q1;
@@ -250053,7 +250395,7 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
250053
250395
  static gammaConstant(length1, radius1) {
250054
250396
  return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);
250055
250397
  }
250056
- /** Compute the czech cubic constant. */
250398
+ /** Compute the Czech cubic constant. */
250057
250399
  static computeCubicM(length1, radius1) {
250058
250400
  const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);
250059
250401
  // in the private update method, the LR values should have been vetted
@@ -250146,17 +250488,9 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
250146
250488
  class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.CubicEvaluator {
250147
250489
  nominalLength1;
250148
250490
  nominalRadius1;
250149
- /**
250150
- * Compute the czech cubic constant.
250151
- * * Funky mixture of lengths.
250152
- */
250491
+ /** Compute the Italian cubic constant. */
250153
250492
  static computeCubicM(lengthXByForward, radius1) {
250154
- const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);
250155
- // in the private update method, the LR values should have been vetted
250156
- if (gamma === undefined)
250157
- return undefined;
250158
- // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
250159
- return gamma / Math.abs((6.0 * radius1 * lengthXByForward));
250493
+ return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);
250160
250494
  }
250161
250495
  /** Constructor is private. Caller responsible for cubicM validity. */
250162
250496
  constructor(length1, radius1, lengthX, cubicM) {
@@ -250165,7 +250499,7 @@ class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0_
250165
250499
  this.nominalRadius1 = radius1;
250166
250500
  }
250167
250501
  static create(length1, radius1) {
250168
- // this seems goofy.; lengthX from forward, then invert for another but that's what the native code does too
250502
+ // this seems goofy; lengthX from forward, then invert for another but that's what the native code does too
250169
250503
  const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);
250170
250504
  const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);
250171
250505
  if (lengthX1 === undefined)
@@ -250381,18 +250715,20 @@ __webpack_require__.r(__webpack_exports__);
250381
250715
  * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
250382
250716
  * "direct" xy calculations without the integrations required for IntegratedSpiral3d.
250383
250717
  * * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
250384
- * * Direct spirals that flow through serialization to native imodel02 are created with these static methods:
250718
+ * * Direct spirals are created with these static methods:
250385
250719
  * * createArema
250386
250720
  * * createJapaneseCubic
250387
- * * createAustralianRail
250388
- * * createDirectHalfCosine
250389
250721
  * * createChineseCubic
250722
+ * * createWesternAustralian
250723
+ * * createDirectHalfCosine
250724
+ * * createAustralianRail
250390
250725
  * * createCzechCubic
250391
250726
  * * createPolishCubic
250727
+ * * createMXCubicAlongArc
250392
250728
  * * createItalian
250393
- * * createWesternAustralian
250394
250729
  * @public
250395
250730
  */
250731
+ // see internaldocs/Spiral.md for more info
250396
250732
  class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
250397
250733
  /** String name for schema properties. */
250398
250734
  curvePrimitiveType = "transitionSpiral";
@@ -250548,11 +250884,11 @@ class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.Tr
250548
250884
  /**
250549
250885
  * Create an MX Cubic whose nominal length is close to along the curve.
250550
250886
  * This is y = m*x^3 with
250551
- * * m is 1/(6RL1).
250887
+ * * m is 1/(6RL).
250552
250888
  * * 1/(6RL) is the leading term of the sine series.
250553
250889
  * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
250554
250890
  * * x is axis position that is slightly LESS than nominal distance along.
250555
- * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))
250891
+ * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 RR LL))
250556
250892
  * @param localToWorld
250557
250893
  * @param nominalL1
250558
250894
  * @param nominalR1
@@ -250913,6 +251249,7 @@ __webpack_require__.r(__webpack_exports__);
250913
251249
  * * [[TransitionConditionalProperties]] implements the computations of the interrelationship of radii, bearing, and length.
250914
251250
  * @public
250915
251251
  */
251252
+ // see internaldocs/Spiral.md for more info
250916
251253
  class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
250917
251254
  /** String name for schema properties. */
250918
251255
  curvePrimitiveType = "transitionSpiral";
@@ -250956,11 +251293,13 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
250956
251293
  static defaultSpiralType = "clothoid";
250957
251294
  /** Use the integrated function to return an angle at fractional position. */
250958
251295
  globalFractionToBearingRadians(fraction) {
251296
+ // calculate area under curvature curve from 0 to fraction and add it to start angle to get angle at the given fraction
251297
+ // see internaldocs/Spiral.md for more info
250959
251298
  const areaFraction = this._evaluator.fractionToArea(fraction);
250960
- const dx = this._arcLength01;
251299
+ const arcLength = this._arcLength01;
250961
251300
  return this.bearing01.startRadians
250962
- + areaFraction * dx * this._curvature01.signedDelta()
250963
- + fraction * this._curvature01.x0 * dx;
251301
+ + fraction * arcLength * this._curvature01.x0
251302
+ + areaFraction * arcLength * this._curvature01.signedDelta();
250964
251303
  }
250965
251304
  /** Use the integrated function to return an angle at fractional position. */
250966
251305
  globalFractionToCurvature(fraction) {
@@ -250999,9 +251338,10 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
250999
251338
  * @param xyz advancing integrated point.
251000
251339
  * @param fractionA fraction at start of interval.
251001
251340
  * @param fractionB fraction at end of interval.
251002
- * @param unitArcLength length of curve for 0 to 1 fractional.
251341
+ * @param applyMatrix if true, apply the localToWorld matrix to the computed delta before adding to xyz.
251003
251342
  */
251004
251343
  fullSpiralIncrementalIntegral(xyz, fractionA, fractionB, applyMatrix) {
251344
+ // see internaldocs/Spiral.md for more info
251005
251345
  const gaussFraction = IntegratedSpiral3d._gaussFraction;
251006
251346
  const gaussWeight = IntegratedSpiral3d._gaussWeight;
251007
251347
  const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);
@@ -251051,7 +251391,7 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
251051
251391
  /**
251052
251392
  * Create a transition spiral with radius and bearing conditions.
251053
251393
  * @param radius01 radius (inverse curvature) at start and end (radius of zero means straight line).
251054
- * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise
251394
+ * @param bearing01 bearing angles at start and end. Bearings are measured from the x axis, positive clockwise
251055
251395
  * towards y axis.
251056
251396
  * @param activeFractionInterval fractional limits of the active portion of the spiral.
251057
251397
  * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.
@@ -251431,10 +251771,12 @@ __webpack_require__.r(__webpack_exports__);
251431
251771
  * * Each implementation provides:
251432
251772
  * * fractionToCurvature -- the f(u) function described above
251433
251773
  * * fractionToCurvatureDerivative -- df(u)/du
251434
- * * fractionToArea -- integral of the area under f(u) from 0 to u.
251435
- * * The symmetry condition ensures that the integral from 0 to 1 is 1/2.
251774
+ * * fractionToArea -- antiderivative A of f, chosen such that A(0) = 0. The value of this function at
251775
+ * fraction u is the area under f from 0 to u. In particular, the symmetry condition on f implies that
251776
+ * 1/2 = "integral of f over [0,1]" = A(1) - A(0) = A(1).
251436
251777
  * @internal
251437
251778
  */
251779
+ // see internaldocs/Spiral.md for more info
251438
251780
  class NormalizedTransition {
251439
251781
  /** Constructor initializes with 0..1 values. Call "setBearingCurvatureLengthCurvature" to apply real values. */
251440
251782
  constructor() { }
@@ -251471,10 +251813,13 @@ class NormalizedTransition {
251471
251813
  }
251472
251814
  /**
251473
251815
  * Transition functions for clothoid spiral.
251474
- * * curvature variation is linear from (0,0) to (1,1)
251816
+ * * Curvature variation is linear from (0,0) to (1,1).
251475
251817
  * @internal
251476
251818
  */
251477
251819
  class NormalizedClothoidTransition extends NormalizedTransition {
251820
+ // clothoid curvature is f(x) = x
251821
+ // derivative f'(x) = 1
251822
+ // integral If(x) = x^2 / 2
251478
251823
  constructor() {
251479
251824
  super();
251480
251825
  }
@@ -251500,13 +251845,12 @@ class NormalizedClothoidTransition extends NormalizedTransition {
251500
251845
  * @internal
251501
251846
  */
251502
251847
  class NormalizedBlossTransition extends NormalizedTransition {
251503
- // bloss curve is (3 - 2x) x ^2 = 3 x^2 - 2 x^3
251848
+ // bloss curvature is x^2 (3 - 2x)
251504
251849
  // derivative 6x (1-x)
251505
- // 2nd derivative 6 - 12 x
251506
- // derivatives zero at 0,1
251507
- // inflection zero at 0.5
251508
- // integral is x^3 - x^4 / 2 = x^3 (1-x/2)
251509
- constructor() { super(); }
251850
+ // integral is x^3 (1-x/2)
251851
+ constructor() {
251852
+ super();
251853
+ }
251510
251854
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
251511
251855
  fractionToCurvatureFraction(u) {
251512
251856
  return u * u * (3 - 2 * u);
@@ -251545,17 +251889,17 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
251545
251889
  }
251546
251890
  /**
251547
251891
  * At fractional position on the x axis, return the (normalized) curvature fraction.
251548
- * * For [u <= 0.5, u >= 0.5]
251549
- * * f(u) = [2 u^2, 1 - 2 (1-u)^2]
251550
- * * f'(u) = [4 u, 4 (1-u)]
251551
- * * If(u) = [2 u^3 / 3, 0.5 (1 -u )^3/3]
251892
+ * * For [u <= 0.5, u > 0.5]
251893
+ * * f(u) = [2u^2, 1 - 2(1-u)^2]
251894
+ * * f'(u) = [4u, 4(1-u)]
251895
+ * * If(u) = [2u^3 / 3, u + 2(1-u)^3 /3]
251552
251896
  */
251553
251897
  fractionToCurvatureFraction(u) {
251554
251898
  return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);
251555
251899
  }
251556
251900
  /** Return the derivative of the (normalized) curvature fraction. */
251557
251901
  fractionToCurvatureFractionDerivative(u) {
251558
- return u < 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
251902
+ return u <= 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
251559
251903
  }
251560
251904
  /**
251561
251905
  * Return the integrated area under the curve.
@@ -251564,6 +251908,7 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
251564
251908
  fractionToArea(u) {
251565
251909
  if (u <= 0.5)
251566
251910
  return this.integratedBasis(u);
251911
+ // if u > 0.5, integral[0 to u] would be integral[0 to 0.5] of "2u^2" + integral[0.5 to u] of "1 - 2(1-u)^2"
251567
251912
  const v = 1 - u;
251568
251913
  return 0.5 - v + this.integratedBasis(v);
251569
251914
  }
@@ -251576,7 +251921,13 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
251576
251921
  * @internal
251577
251922
  */
251578
251923
  class NormalizedSineTransition extends NormalizedTransition {
251579
- constructor() { super(); }
251924
+ // sine transition curvature is x - sin(2 pi x) / (2 pi)
251925
+ // derivative 1 - cos(2 pi x)
251926
+ // integral x^2 / 2 + (cos(2 pi x) - 1) / (4 pi^2)
251927
+ // note: this is the only snap function whose antiderivative is chosen with nonzero integration constant.
251928
+ constructor() {
251929
+ super();
251930
+ }
251580
251931
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
251581
251932
  fractionToCurvatureFraction(u) {
251582
251933
  const a = 2.0 * Math.PI;
@@ -251602,7 +251953,12 @@ class NormalizedSineTransition extends NormalizedTransition {
251602
251953
  * @internal
251603
251954
  */
251604
251955
  class NormalizedCosineTransition extends NormalizedTransition {
251605
- constructor() { super(); }
251956
+ // cosine transition curvature is 0.5 (1 - cos(pi x))
251957
+ // derivative 0.5 pi sin(pi x)
251958
+ // integral 0.5 (x - sin(pi x) / pi)
251959
+ constructor() {
251960
+ super();
251961
+ }
251606
251962
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
251607
251963
  fractionToCurvatureFraction(u) {
251608
251964
  const a = Math.PI;
@@ -251788,6 +252144,7 @@ __webpack_require__.r(__webpack_exports__);
251788
252144
  * determines the remaining one.
251789
252145
  * @public
251790
252146
  */
252147
+ // see internaldocs/Spiral.md for more info
251791
252148
  class TransitionConditionalProperties {
251792
252149
  /**
251793
252150
  * Radius at start (radius of the osculating circle at the spiral segment's start).
@@ -251983,6 +252340,7 @@ __webpack_require__.r(__webpack_exports__);
251983
252340
  * * This is not necessary for integrated spirals.
251984
252341
  * @public
251985
252342
  */
252343
+ // see internaldocs/Spiral.md for more info
251986
252344
  class TransitionSpiral3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePrimitive {
251987
252345
  /** String name of spiral type. */
251988
252346
  _spiralType;
@@ -272082,8 +272440,7 @@ class Ray3d {
272082
272440
  return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);
272083
272441
  }
272084
272442
  /**
272085
- * Return the dot product of the ray's direction vector with a vector from the ray origin
272086
- * to the `spacePoint`.
272443
+ * Return the dot product of the ray's direction vector with a vector from the ray origin to the `spacePoint`.
272087
272444
  * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude
272088
272445
  * of `spacePoint` with respect to the plane.
272089
272446
  * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
@@ -279067,7 +279424,7 @@ class NewtonEvaluatorRtoRD {
279067
279424
  /**
279068
279425
  * Newton iterator for use when both function and derivative can be evaluated.
279069
279426
  * To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.
279070
- * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
279427
+ * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
279071
279428
  * `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.
279072
279429
  * @internal
279073
279430
  */
@@ -338822,7 +339179,7 @@ class TestContext {
338822
339179
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
338823
339180
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
338824
339181
  await core_frontend_1.NoRenderApp.startup({
338825
- applicationVersion: "5.3.0",
339182
+ applicationVersion: "5.4.0-dev.10",
338826
339183
  applicationId: this.settings.gprid,
338827
339184
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.serviceAuthToken),
338828
339185
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
@@ -344126,7 +344483,7 @@ var CoreSelectionSetEventType;
344126
344483
  * See LICENSE.md in the project root for license terms and full copyright notice.
344127
344484
  *--------------------------------------------------------------------------------------------*/
344128
344485
  Object.defineProperty(exports, "__esModule", ({ value: true }));
344129
- exports.AsyncTasksTracker = exports.RpcRequestsHandler = exports.isSingleElementPropertiesRequestOptions = exports.LocalizationHelper = exports.deepReplaceNullsToUndefined = exports.createCancellableTimeoutPromise = exports.buildElementProperties = exports.compareDiagnosticsSeverities = exports.combineDiagnosticsSeverities = exports.PresentationIpcEvents = exports.PRESENTATION_IPC_CHANNEL_NAME = void 0;
344486
+ exports.AsyncTasksTracker = exports.RpcRequestsHandler = exports.isSingleElementPropertiesRequestOptions = exports.LocalizationHelper = exports.deepReplaceNullsToUndefined = exports.createCancellableTimeoutPromise = exports.createElementPropertiesBuilder = exports.compareDiagnosticsSeverities = exports.combineDiagnosticsSeverities = exports.PresentationIpcEvents = exports.PRESENTATION_IPC_CHANNEL_NAME = void 0;
344130
344487
  // WARNING: This barrel file exports internal APIs only for use by `@itwin/presentation-backend` and `@itwin/presentation-frontend` packages.
344131
344488
  // They should not be used outside of these packages. These APIs may be broken or removed at any time without notice.
344132
344489
  var PresentationIpcInterface_js_1 = __webpack_require__(/*! ./presentation-common/PresentationIpcInterface.js */ "../../presentation/common/lib/cjs/presentation-common/PresentationIpcInterface.js");
@@ -344136,7 +344493,7 @@ var Diagnostics_js_1 = __webpack_require__(/*! ./presentation-common/Diagnostics
344136
344493
  Object.defineProperty(exports, "combineDiagnosticsSeverities", ({ enumerable: true, get: function () { return Diagnostics_js_1.combineDiagnosticsSeverities; } }));
344137
344494
  Object.defineProperty(exports, "compareDiagnosticsSeverities", ({ enumerable: true, get: function () { return Diagnostics_js_1.compareDiagnosticsSeverities; } }));
344138
344495
  var ElementProperties_js_1 = __webpack_require__(/*! ./presentation-common/ElementProperties.js */ "../../presentation/common/lib/cjs/presentation-common/ElementProperties.js");
344139
- Object.defineProperty(exports, "buildElementProperties", ({ enumerable: true, get: function () { return ElementProperties_js_1.buildElementProperties; } }));
344496
+ Object.defineProperty(exports, "createElementPropertiesBuilder", ({ enumerable: true, get: function () { return ElementProperties_js_1.createElementPropertiesBuilder; } }));
344140
344497
  var Utils_js_1 = __webpack_require__(/*! ./presentation-common/Utils.js */ "../../presentation/common/lib/cjs/presentation-common/Utils.js");
344141
344498
  Object.defineProperty(exports, "createCancellableTimeoutPromise", ({ enumerable: true, get: function () { return Utils_js_1.createCancellableTimeoutPromise; } }));
344142
344499
  Object.defineProperty(exports, "deepReplaceNullsToUndefined", ({ enumerable: true, get: function () { return Utils_js_1.deepReplaceNullsToUndefined; } }));
@@ -344175,7 +344532,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
344175
344532
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
344176
344533
  };
344177
344534
  Object.defineProperty(exports, "__esModule", ({ value: true }));
344178
- exports.NodeKey = exports.StandardNodeTypes = exports.createContentFormatter = exports.parseCombinedFieldNames = exports.combineFieldNames = exports.addFieldHierarchy = exports.createFieldHierarchies = exports.traverseContentItem = exports.traverseContent = exports.traverseFieldHierarchy = exports.DisplayValue = exports.Value = exports.PropertyValueFormat = exports.Property = exports.Item = exports.FieldDescriptor = exports.FieldDescriptorType = exports.NestedContentField = exports.StructPropertiesField = exports.ArrayPropertiesField = exports.PropertiesField = exports.Field = exports.DefaultContentDisplayTypes = exports.Descriptor = exports.SortDirection = exports.ContentFlags = exports.SelectClassInfo = exports.Content = exports.CategoryDescription = exports.PresentationRpcInterface = exports.KoqPropertyValueFormatter = exports.getInstancesCount = exports.DEFAULT_KEYS_BATCH_SIZE = exports.UPDATE_FULL = exports.RulesetsFactory = exports.RulesetVariable = exports.VariableValueTypes = exports.RegisteredRuleset = exports.LabelDefinition = exports.KeySet = exports.Key = exports.PresentationError = exports.PresentationStatus = exports.RelationshipPath = exports.RelatedClassInfoWithOptionalRelationship = exports.RelatedClassInfo = exports.PropertyInfo = exports.NavigationPropertyInfo = exports.InstanceKey = exports.DiagnosticsLogEntry = void 0;
344535
+ exports.StandardNodeTypes = exports.createContentFormatter = exports.parseCombinedFieldNames = exports.combineFieldNames = exports.addFieldHierarchy = exports.createFieldHierarchies = exports.createContentTraverser = exports.traverseContentItem = exports.traverseContent = exports.traverseFieldHierarchy = exports.DisplayValue = exports.Value = exports.PropertyValueFormat = exports.Property = exports.Item = exports.FieldDescriptor = exports.FieldDescriptorType = exports.NestedContentField = exports.StructPropertiesField = exports.ArrayPropertiesField = exports.PropertiesField = exports.Field = exports.DefaultContentDisplayTypes = exports.Descriptor = exports.SortDirection = exports.ContentFlags = exports.SelectClassInfo = exports.Content = exports.CategoryDescription = exports.PresentationRpcInterface = exports.KoqPropertyValueFormatter = exports.getInstancesCount = exports.DEFAULT_KEYS_BATCH_SIZE = exports.UPDATE_FULL = exports.RulesetsFactory = exports.RulesetVariable = exports.VariableValueTypes = exports.RegisteredRuleset = exports.LabelDefinition = exports.KeySet = exports.Key = exports.PresentationError = exports.PresentationStatus = exports.RelationshipPath = exports.RelatedClassInfoWithOptionalRelationship = exports.RelatedClassInfo = exports.PropertyInfo = exports.NavigationPropertyInfo = exports.InstanceKey = exports.DiagnosticsLogEntry = void 0;
344536
+ exports.NodeKey = void 0;
344179
344537
  /*---------------------------------------------------------------------------------------------
344180
344538
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
344181
344539
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -344264,6 +344622,7 @@ var ContentTraverser_js_1 = __webpack_require__(/*! ./presentation-common/conten
344264
344622
  Object.defineProperty(exports, "traverseFieldHierarchy", ({ enumerable: true, get: function () { return ContentTraverser_js_1.traverseFieldHierarchy; } }));
344265
344623
  Object.defineProperty(exports, "traverseContent", ({ enumerable: true, get: function () { return ContentTraverser_js_1.traverseContent; } }));
344266
344624
  Object.defineProperty(exports, "traverseContentItem", ({ enumerable: true, get: function () { return ContentTraverser_js_1.traverseContentItem; } }));
344625
+ Object.defineProperty(exports, "createContentTraverser", ({ enumerable: true, get: function () { return ContentTraverser_js_1.createContentTraverser; } }));
344267
344626
  Object.defineProperty(exports, "createFieldHierarchies", ({ enumerable: true, get: function () { return ContentTraverser_js_1.createFieldHierarchies; } }));
344268
344627
  Object.defineProperty(exports, "addFieldHierarchy", ({ enumerable: true, get: function () { return ContentTraverser_js_1.addFieldHierarchy; } }));
344269
344628
  Object.defineProperty(exports, "combineFieldNames", ({ enumerable: true, get: function () { return ContentTraverser_js_1.combineFieldNames; } }));
@@ -344729,17 +345088,20 @@ var RelationshipPath;
344729
345088
  * @module RPC
344730
345089
  */
344731
345090
  Object.defineProperty(exports, "__esModule", ({ value: true }));
344732
- exports.buildElementProperties = void 0;
345091
+ exports.createElementPropertiesBuilder = void 0;
344733
345092
  const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
344734
345093
  const ContentTraverser_js_1 = __webpack_require__(/*! ./content/ContentTraverser.js */ "../../presentation/common/lib/cjs/presentation-common/content/ContentTraverser.js");
344735
345094
  const TypeDescription_js_1 = __webpack_require__(/*! ./content/TypeDescription.js */ "../../presentation/common/lib/cjs/presentation-common/content/TypeDescription.js");
344736
345095
  /** @internal */
344737
- const buildElementProperties = (descriptor, item) => {
345096
+ const createElementPropertiesBuilder = () => {
344738
345097
  const builder = new ElementPropertiesBuilder();
344739
- (0, ContentTraverser_js_1.traverseContentItem)(builder, descriptor, item);
344740
- return builder.items[0];
345098
+ const traverseContent = (0, ContentTraverser_js_1.createContentTraverser)(builder);
345099
+ return (descriptor, item) => {
345100
+ traverseContent(descriptor, [item]);
345101
+ return builder.items[0];
345102
+ };
344741
345103
  };
344742
- exports.buildElementProperties = buildElementProperties;
345104
+ exports.createElementPropertiesBuilder = createElementPropertiesBuilder;
344743
345105
  class ElementPropertiesAppender {
344744
345106
  _item;
344745
345107
  _onItemFinished;
@@ -344870,6 +345232,9 @@ class ElementPropertiesBuilder {
344870
345232
  return appender;
344871
345233
  }
344872
345234
  startContent(_props) {
345235
+ this._appendersStack = [];
345236
+ this._items = [];
345237
+ this._elementPropertiesAppender = undefined;
344873
345238
  return true;
344874
345239
  }
344875
345240
  finishContent() { }
@@ -346947,12 +347312,12 @@ exports.FIELD_NAMES_SEPARATOR = void 0;
346947
347312
  exports.traverseFieldHierarchy = traverseFieldHierarchy;
346948
347313
  exports.traverseContent = traverseContent;
346949
347314
  exports.traverseContentItem = traverseContentItem;
347315
+ exports.createContentTraverser = createContentTraverser;
346950
347316
  exports.createFieldHierarchies = createFieldHierarchies;
346951
347317
  exports.addFieldHierarchy = addFieldHierarchy;
346952
347318
  exports.combineFieldNames = combineFieldNames;
346953
347319
  exports.parseCombinedFieldNames = parseCombinedFieldNames;
346954
347320
  const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
346955
- const Content_js_1 = __webpack_require__(/*! ./Content.js */ "../../presentation/common/lib/cjs/presentation-common/content/Content.js");
346956
347321
  const Fields_js_1 = __webpack_require__(/*! ./Fields.js */ "../../presentation/common/lib/cjs/presentation-common/content/Fields.js");
346957
347322
  const Item_js_1 = __webpack_require__(/*! ./Item.js */ "../../presentation/common/lib/cjs/presentation-common/content/Item.js");
346958
347323
  const TypeDescription_js_1 = __webpack_require__(/*! ./TypeDescription.js */ "../../presentation/common/lib/cjs/presentation-common/content/TypeDescription.js");
@@ -346967,32 +347332,46 @@ function traverseFieldHierarchy(hierarchy, cb) {
346967
347332
  hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));
346968
347333
  }
346969
347334
  }
347335
+ /* c8 ignore start */
346970
347336
  /**
346971
347337
  * An utility to traverse content using provided visitor. Provides means to parse content into different formats,
346972
347338
  * for different components.
346973
347339
  * @public
347340
+ * @deprecated in 5.4. Use [[createContentTraverser]] instead.
346974
347341
  */
346975
347342
  function traverseContent(visitor, content) {
346976
- if (!visitor.startContent({ descriptor: content.descriptor })) {
346977
- return;
346978
- }
346979
- try {
346980
- const fieldHierarchies = createFieldHierarchies(content.descriptor.fields);
346981
- visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });
346982
- content.contentSet.forEach((item) => {
346983
- traverseContentItemFields(visitor, fieldHierarchies, item);
346984
- });
346985
- }
346986
- finally {
346987
- visitor.finishContent();
346988
- }
347343
+ return createContentTraverser(visitor, content.descriptor)(content.contentSet);
346989
347344
  }
346990
347345
  /**
346991
347346
  * An utility for calling [[traverseContent]] when there's only one content item.
346992
347347
  * @public
347348
+ * @deprecated in 5.4. Use [[createContentTraverser]] instead.
346993
347349
  */
346994
347350
  function traverseContentItem(visitor, descriptor, item) {
346995
- traverseContent(visitor, new Content_js_1.Content(descriptor, [item]));
347351
+ return createContentTraverser(visitor, descriptor)([item]);
347352
+ }
347353
+ /** @public */
347354
+ function createContentTraverser(visitor, descriptorArg) {
347355
+ let memo;
347356
+ const traverseContentItems = (descriptor, items) => {
347357
+ if (!visitor.startContent({ descriptor })) {
347358
+ return;
347359
+ }
347360
+ try {
347361
+ if (memo?.descriptor !== descriptor) {
347362
+ const fieldHierarchies = createFieldHierarchies(descriptor.fields);
347363
+ visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });
347364
+ memo = { descriptor, fieldHierarchies };
347365
+ }
347366
+ items.forEach((item) => {
347367
+ traverseContentItemFields(visitor, memo.fieldHierarchies, item);
347368
+ });
347369
+ }
347370
+ finally {
347371
+ visitor.finishContent();
347372
+ }
347373
+ };
347374
+ return descriptorArg ? (items) => traverseContentItems(descriptorArg, items) : traverseContentItems;
346996
347375
  }
346997
347376
  class VisitedCategories {
346998
347377
  _visitor;
@@ -351065,7 +351444,7 @@ class PresentationManager {
351065
351444
  async getElementProperties(requestOptions) {
351066
351445
  (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
351067
351446
  const { elementId, contentParser, ...optionsNoElementId } = requestOptions;
351068
- const parser = contentParser ?? internal_1.buildElementProperties;
351447
+ const parser = contentParser ?? (0, internal_1.createElementPropertiesBuilder)();
351069
351448
  const iter = await this.getContentIterator({
351070
351449
  ...optionsNoElementId,
351071
351450
  descriptor: {
@@ -364095,7 +364474,7 @@ var loadLanguages = instance.loadLanguages;
364095
364474
  /***/ ((module) => {
364096
364475
 
364097
364476
  "use strict";
364098
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.3.0","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","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 ES2022 --outDir lib/esm","clean":"rimraf -g 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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//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/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.3.12","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//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/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
364477
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.4.0-dev.10","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 && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","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 ES2022 --outDir lib/esm","clean":"rimraf -g 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","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//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/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.3.12","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//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/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
364099
364478
 
364100
364479
  /***/ }),
364101
364480