@itwin/rpcinterface-full-stack-tests 5.4.0-dev.7 → 5.5.0-dev.2

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.
@@ -103876,9 +103876,20 @@ __webpack_require__.r(__webpack_exports__);
103876
103876
  * @public @preview
103877
103877
  */
103878
103878
  class SchemaJsonLocater {
103879
- _getSchema;
103880
- constructor(_getSchema) {
103881
- 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
+ };
103882
103893
  }
103883
103894
  /** Get a schema by [SchemaKey]
103884
103895
  * @param schemaKey The [SchemaKey] that identifies the schema.
@@ -103896,7 +103907,7 @@ class SchemaJsonLocater {
103896
103907
  * @param matchType The match type to use when locating the schema
103897
103908
  */
103898
103909
  async getSchemaInfo(schemaKey, matchType, context) {
103899
- const schemaProps = this._getSchema(schemaKey.name);
103910
+ const schemaProps = this._getSchemaProps(schemaKey.name);
103900
103911
  if (!schemaProps)
103901
103912
  return undefined;
103902
103913
  const schemaInfo = await _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.startLoadingFromJson(schemaProps, context);
@@ -103911,7 +103922,7 @@ class SchemaJsonLocater {
103911
103922
  * @throws [Error]($ecschema-metadata) if the schema exists, but cannot be loaded.
103912
103923
  */
103913
103924
  getSchemaSync(schemaKey, _matchType, context) {
103914
- const schemaProps = this._getSchema(schemaKey.name);
103925
+ const schemaProps = this._getSchemaProps(schemaKey.name);
103915
103926
  if (!schemaProps)
103916
103927
  return undefined;
103917
103928
  return _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.fromJsonSync(schemaProps, context || new _Context__WEBPACK_IMPORTED_MODULE_0__.SchemaContext());
@@ -117713,6 +117724,7 @@ class IModelApp {
117713
117724
  static _realityDataAccess;
117714
117725
  static _publicPath;
117715
117726
  static _formatsProviderManager;
117727
+ static _incrementalSchemaLoading;
117716
117728
  // No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.
117717
117729
  constructor() { }
117718
117730
  /** Event raised just before the frontend IModelApp is to be [[shutdown]]. */
@@ -117770,6 +117782,13 @@ class IModelApp {
117770
117782
  * @beta
117771
117783
  */
117772
117784
  static get realityDataAccess() { return this._realityDataAccess; }
117785
+ /**
117786
+ * Indicates whether incremental schema loading is enabled.
117787
+ * If not further specified, incremental schema loading is currently disabled by default.
117788
+ * @beta
117789
+ */
117790
+ static get isIncrementalSchemaLoadingEnabled() { return this._incrementalSchemaLoading === "enabled"; }
117791
+ ;
117773
117792
  /** Whether the [renderSystem[]] has been successfully initialized.
117774
117793
  * This will always be `false` before calling [[startup]] and after calling [[shutdown]].
117775
117794
  * In rare circumstances (e.g., while executing in a headless test environment) it may remain `false` due to a failure to
@@ -117897,6 +117916,7 @@ class IModelApp {
117897
117916
  this._realityDataSourceProviders = new _RealityDataSource__WEBPACK_IMPORTED_MODULE_25__.RealityDataSourceProviderRegistry();
117898
117917
  this._realityDataAccess = opts.realityDataAccess;
117899
117918
  this._formatsProviderManager = new _quantity_formatting_QuantityFormatter__WEBPACK_IMPORTED_MODULE_19__.FormatsProviderManager(opts.formatsProvider ?? new _quantity_formatting_QuantityFormatter__WEBPACK_IMPORTED_MODULE_19__.QuantityTypeFormatsProvider());
117919
+ this._incrementalSchemaLoading = opts.incrementalSchemaLoading ?? "disabled";
117900
117920
  this._publicPath = opts.publicPath ?? "";
117901
117921
  if (this._publicPath !== "" && !this._publicPath.endsWith("/")) {
117902
117922
  this._publicPath += "/";
@@ -118745,8 +118765,12 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
118745
118765
  get schemaContext() {
118746
118766
  if (this._schemaContext === undefined) {
118747
118767
  const context = new _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_15__.SchemaContext();
118748
- const locater = new _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__.ECSchemaRpcLocater(this._getRpcProps());
118749
- context.addFallbackLocater(locater);
118768
+ // While incremental schema loading is the prefered way to load schemas on the frontend, there might be cases where clients
118769
+ // would want to use their own locaters, so if incremenal schema loading is disabled, the locater is not registered.
118770
+ if (_IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.isIncrementalSchemaLoadingEnabled) {
118771
+ context.addLocater(new _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__.RpcIncrementalSchemaLocater(this._getRpcProps()));
118772
+ }
118773
+ context.addFallbackLocater(new _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__.ECSchemaRpcLocater(this._getRpcProps()));
118750
118774
  this._schemaContext = context;
118751
118775
  }
118752
118776
  return this._schemaContext;
@@ -123477,18 +123501,10 @@ __webpack_require__.r(__webpack_exports__);
123477
123501
  /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
123478
123502
  /* harmony import */ var _CategorySelectorState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CategorySelectorState */ "../../core/frontend/lib/esm/CategorySelectorState.js");
123479
123503
  /* harmony import */ var _DisplayStyleState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DisplayStyleState */ "../../core/frontend/lib/esm/DisplayStyleState.js");
123480
- /* harmony import */ var _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./render/GraphicBranch */ "../../core/frontend/lib/esm/render/GraphicBranch.js");
123481
- /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
123482
- /* harmony import */ var _internal_render_MockRender__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./internal/render/MockRender */ "../../core/frontend/lib/esm/internal/render/MockRender.js");
123483
- /* harmony import */ var _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./render/FeatureSymbology */ "../../core/frontend/lib/esm/render/FeatureSymbology.js");
123484
- /* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
123485
- /* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
123486
- /* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Viewport */ "../../core/frontend/lib/esm/Viewport.js");
123487
- /* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
123488
- /* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
123489
- /* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
123490
- /* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
123491
- /* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
123504
+ /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
123505
+ /* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
123506
+ /* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
123507
+ /* harmony import */ var _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./internal/SheetViewAttachments */ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js");
123492
123508
  /*---------------------------------------------------------------------------------------------
123493
123509
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
123494
123510
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -123505,14 +123521,6 @@ __webpack_require__.r(__webpack_exports__);
123505
123521
 
123506
123522
 
123507
123523
 
123508
-
123509
-
123510
-
123511
-
123512
-
123513
-
123514
-
123515
-
123516
123524
  // cSpell:ignore ovrs
123517
123525
  /** Describes the geometry and styling of a sheet border decoration.
123518
123526
  * The sheet border decoration mimics a sheet of paper with a drop shadow.
@@ -123581,206 +123589,25 @@ class SheetBorder {
123581
123589
  params.fillColor = fillColor;
123582
123590
  params.gradient = this._gradient;
123583
123591
  builder.activateGraphicParams(params);
123584
- builder.addShape2d(this._shadow, _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance);
123592
+ builder.addShape2d(this._shadow, _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance);
123585
123593
  builder.setSymbology(lineColor, fillColor, 2);
123586
123594
  builder.addLineString2d(this._rect, 0);
123587
123595
  }
123588
123596
  }
123589
- /** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is
123590
- * supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in
123591
- * SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.
123592
- */
123593
- class ViewAttachmentsInfo {
123594
- _attachments;
123595
- get attachments() { return this._attachments; }
123596
- constructor(attachments) {
123597
- this._attachments = attachments;
123598
- }
123599
- get isLoaded() {
123600
- return 0 === this._attachments.length || "string" !== typeof this._attachments[0];
123601
- }
123602
- get viewAttachmentProps() {
123603
- return this.isLoaded ? this._props : [];
123604
- }
123605
- get _props() {
123606
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.isLoaded);
123607
- return this._attachments;
123608
- }
123609
- get _ids() {
123610
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this.isLoaded);
123611
- return this._attachments;
123612
- }
123613
- static fromJSON(ids = []) {
123614
- return new ViewAttachmentsInfo(ids);
123615
- }
123616
- toJSON() {
123617
- return this.isLoaded ? this._props.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(x.id)) : [...this._ids];
123618
- }
123619
- clone(iModel) {
123620
- let attachments = this._attachments;
123621
- if (this.isLoaded) {
123622
- // Need to clone the attached ViewStates.
123623
- attachments = attachments.map((attachment) => {
123624
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(typeof attachment !== "string");
123625
- return {
123626
- ...attachment,
123627
- attachedView: attachment.attachedView.clone(iModel),
123628
- };
123629
- });
123630
- }
123631
- return new ViewAttachmentsInfo(attachments);
123632
- }
123633
- preload(options) {
123634
- if (this.isLoaded)
123635
- return;
123636
- options.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.CompressedId64Set.sortAndCompress(this._ids);
123637
- options.viewStateLoadProps = {
123638
- displayStyle: {
123639
- omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
123640
- compressExcludedElementIds: true,
123641
- },
123642
- };
123643
- }
123644
- async postload(options, iModel) {
123645
- if (options.sheetViewViews === undefined)
123646
- return;
123647
- if (options.sheetViewAttachmentProps === undefined)
123648
- return;
123649
- const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState
123650
- const promises = [];
123651
- for (const viewProps of viewStateProps) {
123652
- const loadView = async () => {
123653
- try {
123654
- if (viewProps === undefined)
123655
- return undefined;
123656
- const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
123657
- return view;
123658
- }
123659
- catch {
123660
- return undefined;
123661
- }
123662
- };
123663
- promises.push(loadView());
123664
- }
123665
- const views = await Promise.all(promises);
123666
- const attachmentProps = options.sheetViewAttachmentProps;
123667
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
123668
- const attachments = [];
123669
- for (let i = 0; i < views.length; i++) {
123670
- const view = views[i];
123671
- if (view && !(view instanceof SheetViewState)) {
123672
- const props = attachmentProps[i];
123673
- props.attachedView = view;
123674
- attachments.push(props);
123675
- }
123676
- }
123677
- this._attachments = attachments;
123678
- }
123679
- async load(iModel) {
123680
- if (this.isLoaded)
123681
- return;
123682
- const attachmentProps = await iModel.elements.getProps(this._ids);
123683
- const promises = [];
123684
- for (const attachment of attachmentProps) {
123685
- const loadView = async () => {
123686
- try {
123687
- const view = await iModel.views.load(attachment.view.id);
123688
- return view;
123689
- }
123690
- catch {
123691
- return undefined;
123692
- }
123693
- };
123694
- promises.push(loadView());
123695
- }
123696
- const views = await Promise.all(promises);
123697
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
123698
- const attachments = [];
123699
- for (let i = 0; i < views.length; i++) {
123700
- const view = views[i];
123701
- if (view && !(view instanceof SheetViewState)) {
123702
- const props = attachmentProps[i];
123703
- props.attachedView = view;
123704
- attachments.push(props);
123705
- }
123706
- }
123707
- this._attachments = attachments;
123708
- }
123709
- createAttachments(sheetView) {
123710
- return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;
123711
- }
123712
- }
123713
- /** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;
123714
- * disposed of when it becomes detached from the viewport.
123715
- */
123716
- class ViewAttachments {
123717
- _attachments = [];
123718
- maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
123719
- constructor(infos, sheetView) {
123720
- for (const info of infos) {
123721
- const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);
123722
- const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;
123723
- const attachment = new ctor(info.attachedView, info, sheetView);
123724
- this._attachments.push(attachment);
123725
- this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);
123726
- }
123727
- }
123728
- [Symbol.dispose]() {
123729
- for (const attachment of this._attachments)
123730
- attachment[Symbol.dispose]();
123731
- this._attachments.length = 0;
123732
- }
123733
- [Symbol.iterator]() {
123734
- return this._attachments[Symbol.iterator]();
123735
- }
123736
- /** For tests. */
123737
- get attachments() {
123738
- return this._attachments;
123739
- }
123740
- get isEmpty() {
123741
- return 0 === this._attachments.length;
123742
- }
123743
- areAllTileTreesLoaded(displayedExtents) {
123744
- return this._attachments.every((x) => {
123745
- const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(x.viewAttachmentProps.placement);
123746
- const attachmentRange = placement.calculateRange();
123747
- if (!attachmentRange.intersectsRangeXY(displayedExtents))
123748
- return true;
123749
- return x.areAllTileTreesLoaded;
123750
- });
123751
- }
123752
- /** Strictly for testing purposes */
123753
- areAllAttachmentsLoaded() {
123754
- return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);
123755
- }
123756
- discloseTileTrees(trees) {
123757
- for (const attachment of this._attachments)
123758
- trees.disclose(attachment);
123759
- }
123760
- collectStatistics(stats) {
123761
- for (const attachment of this._attachments)
123762
- attachment.collectStatistics(stats);
123763
- }
123764
- addToScene(context) {
123765
- for (const attachment of this._attachments)
123766
- attachment.addToScene(context);
123767
- }
123768
- findById(attachmentId) {
123769
- return this._attachments.find((attachment) => attachment.viewAttachmentProps.id === attachmentId);
123770
- }
123771
- }
123772
123597
  /** A view of a [SheetModel]($backend).
123773
123598
  * @public
123774
123599
  * @extensions
123775
123600
  */
123776
- class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2d {
123601
+ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__.ViewState2d {
123777
123602
  /** The width and height of the sheet in world coordinates. */
123778
123603
  sheetSize;
123779
- _attachmentsInfo;
123780
- _attachments;
123604
+ _viewAttachments;
123781
123605
  _viewedExtents;
123606
+ _onViewAttachmentsReloaded = () => undefined;
123607
+ /** Strictly for tests. */
123608
+ onViewAttachmentsReloaded = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
123782
123609
  get attachmentIds() {
123783
- return this._attachmentsInfo.toJSON();
123610
+ return this._viewAttachments.attachmentIds;
123784
123611
  }
123785
123612
  static get className() { return "SheetViewDefinition"; }
123786
123613
  static createFromProps(viewStateData, iModel) {
@@ -123791,7 +123618,7 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123791
123618
  }
123792
123619
  toProps() {
123793
123620
  const props = super.toProps();
123794
- props.sheetAttachments = this._attachmentsInfo.toJSON();
123621
+ props.sheetAttachments = [...this.attachmentIds];
123795
123622
  // For sheetProps all that is actually used is the size, so just null out everything else.
123796
123623
  const codeProps = { spec: "", scope: "", value: "" };
123797
123624
  props.sheetProps = {
@@ -123806,20 +123633,15 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123806
123633
  }
123807
123634
  /** Strictly for testing. @internal */
123808
123635
  get viewAttachmentProps() {
123809
- return this._attachmentsInfo.viewAttachmentProps.map((x) => {
123810
- return {
123811
- ...x,
123812
- attachedView: undefined,
123813
- };
123814
- });
123636
+ return this._viewAttachments.attachmentProps;
123815
123637
  }
123816
123638
  /** Strictly for testing. @internal */
123817
123639
  get viewAttachmentInfos() {
123818
- return this._attachmentsInfo.attachments;
123640
+ return this._viewAttachments.attachmentInfos;
123819
123641
  }
123820
123642
  /** Strictly for testing. @internal */
123821
123643
  get attachments() {
123822
- return this._attachments?.attachments;
123644
+ return this._viewAttachments.attachments;
123823
123645
  }
123824
123646
  isDrawingView() { return false; }
123825
123647
  isSheetView() { return true; }
@@ -123828,41 +123650,53 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123828
123650
  if (categories instanceof SheetViewState) {
123829
123651
  // we are coming from clone...
123830
123652
  this.sheetSize = categories.sheetSize.clone();
123831
- this._attachmentsInfo = categories._attachmentsInfo.clone(iModel);
123653
+ this._viewAttachments = categories._viewAttachments.clone(iModel);
123832
123654
  this._viewedExtents = categories._viewedExtents.clone();
123833
123655
  }
123834
123656
  else {
123835
123657
  this.sheetSize = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(sheetProps.width, sheetProps.height);
123836
- this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachments);
123658
+ this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachments);
123837
123659
  const extents = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);
123838
123660
  const margin = 1.1;
123839
123661
  extents.scaleAboutCenterInPlace(margin);
123840
123662
  this._viewedExtents = extents;
123841
123663
  }
123664
+ if (iModel.isBriefcaseConnection()) {
123665
+ iModel.txns.onElementsChanged.addListener(async (changes) => {
123666
+ let reload = false;
123667
+ for (const change of changes.filter({ includeMetadata: (meta) => meta.is("BisCore:ViewAttachment") })) {
123668
+ if (change.type === "inserted" || this._viewAttachments.attachmentIds.includes(change.id)) {
123669
+ reload = true;
123670
+ break;
123671
+ }
123672
+ }
123673
+ if (reload) {
123674
+ await this._viewAttachments.reload(this.baseModelId, iModel);
123675
+ this._onViewAttachmentsReloaded();
123676
+ this.onViewAttachmentsReloaded.raiseEvent();
123677
+ }
123678
+ });
123679
+ }
123842
123680
  }
123843
123681
  getOrigin() {
123844
123682
  const origin = super.getOrigin();
123845
- if (this._attachments)
123846
- origin.z = -this._attachments.maxDepth;
123683
+ origin.z = -this._viewAttachments.maxDepth;
123847
123684
  return origin;
123848
123685
  }
123849
123686
  getExtents() {
123850
123687
  const extents = super.getExtents();
123851
- if (this._attachments)
123852
- extents.z = this._attachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
123688
+ extents.z = this._viewAttachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance;
123853
123689
  return extents;
123854
123690
  }
123855
123691
  /** Overrides [[ViewState.discloseTileTrees]] to include tile trees associated with [ViewAttachment]($backend)s displayed on this sheet. */
123856
123692
  discloseTileTrees(trees) {
123857
123693
  super.discloseTileTrees(trees);
123858
- if (this._attachments)
123859
- trees.disclose(this._attachments);
123694
+ trees.disclose(this._viewAttachments);
123860
123695
  }
123861
123696
  /** @internal */
123862
123697
  collectNonTileTreeStatistics(stats) {
123863
123698
  super.collectNonTileTreeStatistics(stats);
123864
- if (this._attachments)
123865
- this._attachments.collectStatistics(stats);
123699
+ this._viewAttachments.collectStatistics(stats);
123866
123700
  }
123867
123701
  get defaultExtentLimits() {
123868
123702
  return { min: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };
@@ -123873,36 +123707,23 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123873
123707
  /** @internal */
123874
123708
  preload(hydrateRequest) {
123875
123709
  super.preload(hydrateRequest);
123876
- this._attachmentsInfo.preload(hydrateRequest);
123710
+ this._viewAttachments.preload(hydrateRequest);
123877
123711
  }
123878
123712
  /** @internal */
123879
123713
  async postload(hydrateResponse) {
123880
123714
  const promises = [];
123881
123715
  promises.push(super.postload(hydrateResponse));
123882
- promises.push(this._attachmentsInfo.postload(hydrateResponse, this.iModel));
123716
+ promises.push(this._viewAttachments.postload(hydrateResponse, this.iModel));
123883
123717
  await Promise.all(promises);
123884
123718
  }
123885
123719
  /** @internal */
123886
123720
  createScene(context) {
123887
123721
  super.createScene(context);
123888
- if (this._attachments)
123889
- this._attachments.addToScene(context);
123722
+ this._viewAttachments.addToScene(context);
123890
123723
  }
123891
123724
  /** @internal */
123892
123725
  get secondaryViewports() {
123893
- if (this._attachments === undefined)
123894
- return super.secondaryViewports;
123895
- const attachments = this._attachments;
123896
- function* iterator() {
123897
- for (const attachment of attachments) {
123898
- const vp = attachment.viewport;
123899
- if (vp)
123900
- yield vp;
123901
- }
123902
- }
123903
- return {
123904
- [Symbol.iterator]: () => iterator(),
123905
- };
123726
+ return this._viewAttachments.getSecondaryViewports();
123906
123727
  }
123907
123728
  /** @internal */
123908
123729
  async queryAttachmentIds() {
@@ -123915,39 +123736,43 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123915
123736
  async changeViewedModel(modelId) {
123916
123737
  await super.changeViewedModel(modelId);
123917
123738
  const attachmentIds = await this.queryAttachmentIds();
123918
- this._attachmentsInfo = ViewAttachmentsInfo.fromJSON(attachmentIds);
123919
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined === this._attachments);
123739
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewAttachments);
123740
+ this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachmentIds);
123920
123741
  }
123921
123742
  /** See [[ViewState.attachToViewport]]. */
123922
123743
  attachToViewport(args) {
123923
123744
  super.attachToViewport(args);
123924
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(undefined === this._attachments);
123925
- this._attachments = this._attachmentsInfo.createAttachments(this);
123745
+ this._viewAttachments.attachToViewport({
123746
+ backgroundColor: this.displayStyle.backgroundColor,
123747
+ sheetModelId: this.baseModelId,
123748
+ });
123749
+ this._onViewAttachmentsReloaded = () => args.invalidateController();
123926
123750
  }
123927
123751
  /** See [[ViewState.detachFromViewport]]. */
123928
123752
  detachFromViewport() {
123929
123753
  super.detachFromViewport();
123930
- this._attachments = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._attachments);
123754
+ this._viewAttachments.detachFromViewport();
123755
+ this._onViewAttachmentsReloaded = () => undefined;
123931
123756
  }
123932
123757
  get areAllTileTreesLoaded() {
123758
+ if (!super.areAllTileTreesLoaded) {
123759
+ return false;
123760
+ }
123933
123761
  let displayedExtents = this._viewedExtents;
123934
123762
  const frustum = this.calculateFrustum();
123935
123763
  if (frustum) {
123936
123764
  displayedExtents = frustum.toRange();
123937
123765
  }
123938
- return super.areAllTileTreesLoaded && (!this._attachments || this._attachments.areAllTileTreesLoaded(displayedExtents));
123766
+ return this._viewAttachments.areAllTileTreesLoaded(displayedExtents);
123939
123767
  }
123940
123768
  /** @internal Strictly for testing */
123941
123769
  areAllAttachmentsLoaded() {
123942
- if (this._attachments) {
123943
- return this._attachments.areAllAttachmentsLoaded();
123944
- }
123945
- return true;
123770
+ return this._viewAttachments.areAllAttachmentsLoaded();
123946
123771
  }
123947
123772
  /** Create a sheet border decoration graphic. */
123948
123773
  createBorder(width, height, context) {
123949
123774
  const border = SheetBorder.create(width, height, context);
123950
- const builder = context.createGraphicBuilder(_common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__.GraphicType.ViewBackground);
123775
+ const builder = context.createGraphicBuilder(_common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__.GraphicType.ViewBackground);
123951
123776
  border.addToBuilder(builder);
123952
123777
  return builder.finish();
123953
123778
  }
@@ -123967,453 +123792,13 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
123967
123792
  }
123968
123793
  /** @internal */
123969
123794
  getAttachmentViewport(args) {
123970
- const attachment = args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;
123971
- if (!attachment) {
123972
- return undefined;
123973
- }
123974
- return args.inSectionDrawingAttachment ? attachment.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : attachment.viewport;
123795
+ return this._viewAttachments.getAttachmentViewport(args);
123975
123796
  }
123976
123797
  /** @beta */
123977
123798
  computeDisplayTransform(args) {
123978
123799
  // ###TODO we're currently ignoring model and element Id in args, assuming irrelevant for sheets.
123979
123800
  // Should probably call super or have super call us.
123980
- const attachment = undefined !== args.viewAttachmentId ? this._attachments?.findById(args.viewAttachmentId) : undefined;
123981
- if (!attachment || !(attachment instanceof OrthographicAttachment)) {
123982
- return undefined;
123983
- }
123984
- const sheetTransform = attachment.toSheet;
123985
- const sectionTransform = args.inSectionDrawingAttachment ? attachment.view.computeDisplayTransform(args) : undefined;
123986
- if (!sectionTransform) {
123987
- return sheetTransform.clone(args.output);
123988
- }
123989
- return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
123990
- }
123991
- }
123992
- /** A mostly no-op RenderTarget for an Attachment.
123993
- * its Scene and symbology overrides.
123994
- */
123995
- class AttachmentTarget extends _internal_render_MockRender__WEBPACK_IMPORTED_MODULE_7__.MockRender.OffScreenTarget {
123996
- _attachment;
123997
- constructor(attachment) {
123998
- // The dimensions don't matter - we're not drawing anything.
123999
- const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(1, 1);
124000
- super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem, rect);
124001
- this._attachment = attachment;
124002
- }
124003
- changeScene(scene) {
124004
- this._attachment.scene = scene;
124005
- }
124006
- overrideFeatureSymbology(ovrs) {
124007
- this._attachment.symbologyOverrides = ovrs;
124008
- }
124009
- }
124010
- /** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
124011
- * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
124012
- * collect the resultant graphics and add them to the sheet view's scene.
124013
- */
124014
- class OrthographicAttachment {
124015
- _viewport;
124016
- _props;
124017
- _sheetModelId;
124018
- _viewFlagOverrides;
124019
- _toSheet;
124020
- _fromSheet;
124021
- _sizeInMeters;
124022
- _range;
124023
- _viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, 1, 1);
124024
- _originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Frustum();
124025
- _clipVolume;
124026
- _hiddenLineSettings;
124027
- _scale;
124028
- _debugFeatureTable;
124029
- scene;
124030
- symbologyOverrides;
124031
- zDepth;
124032
- get view() {
124033
- return this._viewport.view;
124034
- }
124035
- get viewAttachmentProps() {
124036
- return this._props;
124037
- }
124038
- get viewport() {
124039
- return this._viewport;
124040
- }
124041
- constructor(view, props, sheetView) {
124042
- this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
124043
- const target = new AttachmentTarget(this);
124044
- this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport.createViewport(view, target, true);
124045
- this._props = props;
124046
- this._sheetModelId = sheetView.baseModelId;
124047
- const applyClip = true; // set to false for debugging
124048
- this._viewFlagOverrides = {
124049
- ...view.viewFlags,
124050
- clipVolume: applyClip,
124051
- lighting: false,
124052
- shadows: false,
124053
- };
124054
- const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
124055
- const range = placement.calculateRange();
124056
- this._range = range;
124057
- this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(range.xLength(), range.yLength());
124058
- // Compute transform from attached view's world coordinates to sheet's world coordinates.
124059
- // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
124060
- const applySkew = true; // set to false for debugging
124061
- const skew = applySkew ? view.getAspectRatioSkew() : 1;
124062
- const extents = this._viewport.viewingSpace.viewDelta.clone();
124063
- const zDepth = Math.abs(extents.z);
124064
- const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
124065
- const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
124066
- this._scale = { x: 1 / scaleX, y: 1 / scaleY };
124067
- const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
124068
- this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
124069
- // View origin is at the *back* of the view. Align *front* of view based on display priority.
124070
- const viewRot = view.getRotation();
124071
- const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
124072
- viewOrg.z += zDepth;
124073
- viewRot.multiplyTransposeVectorInPlace(viewOrg);
124074
- const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.createScale(scaleX, scaleY, 1);
124075
- matrix.multiplyMatrixMatrix(viewRot, matrix);
124076
- const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
124077
- const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(placement.origin);
124078
- attachmentOrigin.z = zBias;
124079
- const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
124080
- origin.addInPlace(viewOrgToAttachment);
124081
- this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createRefs(origin, matrix);
124082
- this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(this._toSheet.inverse());
124083
- // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
124084
- // The clip needs to be transformed into sheet space.
124085
- if (view.isDrawingView())
124086
- this._viewport.drawingToSheetTransform = this._toSheet;
124087
- // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
124088
- // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
124089
- // introduce additional computation, so possibly not worth it.
124090
- // Transform the view's clip (if any) to sheet space
124091
- let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
124092
- if (viewClip)
124093
- viewClip.transformInPlace(this._toSheet);
124094
- else
124095
- viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.createEmpty();
124096
- let sheetClip;
124097
- if (undefined !== props.jsonProperties?.clip)
124098
- sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(props.jsonProperties?.clip);
124099
- if (sheetClip && sheetClip.isValid) {
124100
- // Clip to view attachment's clip. NB: clip is in sheet coordinate space.
124101
- for (const clip of sheetClip.clips)
124102
- viewClip.clips.push(clip);
124103
- }
124104
- else {
124105
- // Clip to view attachment's bounding box
124106
- viewClip.appendShape([
124107
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.low.y),
124108
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.low.y),
124109
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.high.y),
124110
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.high.y),
124111
- ]);
124112
- }
124113
- this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(viewClip);
124114
- // Save off the original frustum (potentially adjusted by viewport).
124115
- this._viewport.setupFromView();
124116
- this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_10__.CoordSystem.World, true, this._originalFrustum);
124117
- const applyHiddenLineSettings = true; // for debugging edge display, set to false...
124118
- const style = view.displayStyle;
124119
- if (style.is3d() && applyHiddenLineSettings)
124120
- this._hiddenLineSettings = style.settings.hiddenLineSettings;
124121
- }
124122
- [Symbol.dispose]() {
124123
- this._viewport[Symbol.dispose]();
124124
- }
124125
- discloseTileTrees(trees) {
124126
- trees.disclose(this._viewport);
124127
- }
124128
- addToScene(context) {
124129
- if (context.viewport.freezeScene)
124130
- return;
124131
- if (!context.viewport.view.viewsCategory(this._props.category))
124132
- return;
124133
- const wantBounds = context.viewport.wantViewAttachmentBoundaries;
124134
- const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
124135
- if (wantBounds || wantClipShapes) {
124136
- const builder = context.createSceneGraphicBuilder();
124137
- if (wantBounds) {
124138
- builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
124139
- builder.addRangeBox(this._range);
124140
- }
124141
- if (wantClipShapes && this._clipVolume) {
124142
- builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, 2);
124143
- for (const prim of this._clipVolume.clipVector.clips) {
124144
- if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipShape))
124145
- continue; // ###TODO handle non-shape primitives, if any such ever encountered
124146
- const pts = [];
124147
- const tf = prim.transformFromClip;
124148
- for (const pt of prim.polygon) {
124149
- const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
124150
- pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(tfPt.x, tfPt.y));
124151
- }
124152
- builder.addLineString2d(pts, 0);
124153
- }
124154
- }
124155
- // Put into a Batch so that we can see tooltip with attachment Id on mouseover.
124156
- const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
124157
- context.outputGraphic(batch);
124158
- }
124159
- if (!context.viewport.wantViewAttachments)
124160
- return;
124161
- // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
124162
- const pixelSize = context.viewport.getPixelSizeAtPoint();
124163
- if (0 === pixelSize)
124164
- return;
124165
- // Adjust attached view frustum based on intersection with sheet view frustum.
124166
- const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
124167
- const attachFrustumRange = attachFrustum.toRange();
124168
- const sheetFrustum = context.viewport.getWorldFrustum();
124169
- const sheetFrustumRange = sheetFrustum.toRange();
124170
- const intersect = attachFrustumRange.intersect(sheetFrustumRange);
124171
- if (intersect.isNull)
124172
- return;
124173
- attachFrustum.initFromRange(intersect);
124174
- attachFrustum.transformBy(this._fromSheet, attachFrustum);
124175
- this._viewport.setupViewFromFrustum(attachFrustum);
124176
- // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
124177
- const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
124178
- const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
124179
- this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
124180
- this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
124181
- this._viewport.setRect(this._viewRect);
124182
- // Propagate settings from on-screen viewport.
124183
- this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
124184
- this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
124185
- // Create the scene.
124186
- this._viewport.renderFrame();
124187
- const scene = this.scene;
124188
- if (!scene)
124189
- return;
124190
- // Extract scene graphics and insert into on-screen scene context.
124191
- const options = {
124192
- viewAttachmentId: this._props.id,
124193
- clipVolume: this._clipVolume,
124194
- hline: this._hiddenLineSettings,
124195
- frustum: {
124196
- is3d: this.view.is3d(),
124197
- scale: this._scale,
124198
- },
124199
- };
124200
- const outputGraphics = (source) => {
124201
- if (0 === source.length)
124202
- return;
124203
- const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch();
124204
- graphics.setViewFlagOverrides(this._viewFlagOverrides);
124205
- graphics.symbologyOverrides = this.symbologyOverrides;
124206
- for (const graphic of source)
124207
- graphics.entries.push(graphic);
124208
- const branch = context.createGraphicBranch(graphics, this._toSheet, options);
124209
- context.outputGraphic(branch);
124210
- };
124211
- outputGraphics(scene.foreground);
124212
- context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
124213
- context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
124214
- // Report tile statistics to sheet view's viewport.
124215
- const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin;
124216
- const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
124217
- const requested = tileAdmin.getRequestsForUser(this._viewport);
124218
- tileAdmin.addExternalTilesForUser(context.viewport, {
124219
- requested: requested?.size ?? 0,
124220
- selected: selectedAndReady?.selected.size ?? 0,
124221
- ready: selectedAndReady?.ready.size ?? 0,
124222
- });
124223
- }
124224
- getDebugFeatureTable() {
124225
- if (this._debugFeatureTable)
124226
- return this._debugFeatureTable;
124227
- const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.FeatureTable(1, this._sheetModelId);
124228
- featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Feature(this._props.id));
124229
- this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable.pack(featureTable);
124230
- return this._debugFeatureTable;
124231
- }
124232
- get areAllTileTreesLoaded() {
124233
- return this.view.areAllTileTreesLoaded;
124234
- }
124235
- collectStatistics(_stats) {
124236
- // Handled by discloseTileTrees()
124237
- }
124238
- get toSheet() {
124239
- return this._toSheet;
124240
- }
124241
- }
124242
- function createRasterAttachmentViewport(_view, _rect, _attachment) {
124243
- class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport {
124244
- _sceneContext;
124245
- _isSceneReady = false;
124246
- _attachment;
124247
- constructor(view, rect, attachment) {
124248
- super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createOffscreenTarget(rect));
124249
- this._attachment = attachment;
124250
- this._isAspectRatioLocked = true;
124251
- this.changeView(view);
124252
- }
124253
- createSceneContext() {
124254
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
124255
- this._sceneContext = super.createSceneContext();
124256
- return this._sceneContext;
124257
- }
124258
- renderFrame() {
124259
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
124260
- this.clearSceneContext();
124261
- super.renderFrame();
124262
- if (undefined !== this._sceneContext) {
124263
- this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
124264
- if (this._isSceneReady)
124265
- this._attachment.produceGraphics(this._sceneContext);
124266
- this._sceneContext = undefined;
124267
- }
124268
- }
124269
- clearSceneContext() {
124270
- this._sceneContext = undefined;
124271
- }
124272
- addDecorations(_decorations) {
124273
- // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
124274
- }
124275
- }
124276
- return new RasterAttachmentViewport(_view, _rect, _attachment);
124277
- }
124278
- /** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */
124279
- class RasterAttachment {
124280
- _props;
124281
- _placement;
124282
- _transform;
124283
- zDepth;
124284
- _viewport;
124285
- _graphics;
124286
- constructor(view, props, sheetView) {
124287
- // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
124288
- const maxSize = 2048;
124289
- const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, maxSize, maxSize);
124290
- const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
124291
- const skew = maxSize / height;
124292
- view.setAspectRatioSkew(skew);
124293
- if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
124294
- // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
124295
- const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);
124296
- view.displayStyle.backgroundColor = bgColor;
124297
- }
124298
- this._viewport = createRasterAttachmentViewport(view, rect, this);
124299
- this._props = props;
124300
- this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
124301
- this._transform = this._placement.transform;
124302
- this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
124303
- }
124304
- [Symbol.dispose]() {
124305
- this._viewport?.[Symbol.dispose]();
124306
- }
124307
- get viewAttachmentProps() {
124308
- return this._props;
124309
- }
124310
- get viewport() {
124311
- return this._viewport;
124312
- }
124313
- get areAllTileTreesLoaded() {
124314
- return this._viewport?.areAllTileTreesLoaded ?? true;
124315
- }
124316
- addToScene(context) {
124317
- // ###TODO: check viewport.wantViewAttachmentClipShapes
124318
- if (!context.viewport.view.viewsCategory(this._props.category))
124319
- return;
124320
- if (context.viewport.wantViewAttachmentBoundaries) {
124321
- const builder = context.createSceneGraphicBuilder(this._transform);
124322
- builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
124323
- builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d.createRange2d(this._placement.bbox));
124324
- context.outputGraphic(builder.finish());
124325
- }
124326
- if (!context.viewport.wantViewAttachments)
124327
- return;
124328
- if (this._graphics) {
124329
- context.outputGraphic(this._graphics);
124330
- return;
124331
- }
124332
- if (undefined === this._viewport)
124333
- return;
124334
- this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
124335
- this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
124336
- this._viewport.renderFrame();
124337
- if (this._graphics)
124338
- context.outputGraphic(this._graphics);
124339
- }
124340
- discloseTileTrees(trees) {
124341
- if (this._viewport)
124342
- trees.disclose(this._viewport);
124343
- }
124344
- produceGraphics(context) {
124345
- (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(context.viewport === this._viewport);
124346
- this._graphics = this.createGraphics(this._viewport);
124347
- this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewport);
124348
- if (undefined !== this._graphics)
124349
- context.outputGraphic(this._graphics);
124350
- }
124351
- createGraphics(vp) {
124352
- // Create a texture from the contents of the view.
124353
- const image = vp.readImageBuffer({ upsideDown: true });
124354
- if (undefined === image)
124355
- return undefined;
124356
- const debugImage = false; // set to true to open a window displaying the captured image.
124357
- if (debugImage) {
124358
- const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.imageBufferToPngDataUrl)(image, false);
124359
- if (url)
124360
- (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.openImageDataUrlInNewWindow)(url, "Attachment");
124361
- }
124362
- const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createTexture({
124363
- image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.TextureTransparency.Opaque },
124364
- });
124365
- if (!texture)
124366
- return undefined;
124367
- // Create a material for the texture
124368
- const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.GraphicParams();
124369
- graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
124370
- // Apply the texture to a rectangular polyface.
124371
- const depth = this.zDepth;
124372
- const east = this._placement.bbox.low.x;
124373
- const west = this._placement.bbox.high.x;
124374
- const north = this._placement.bbox.low.y;
124375
- const south = this._placement.bbox.high.y;
124376
- const corners = [
124377
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, north, depth),
124378
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, north, depth),
124379
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, south, depth),
124380
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, south, depth),
124381
- ];
124382
- const params = [
124383
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 0),
124384
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 0),
124385
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 1),
124386
- _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 1),
124387
- ];
124388
- const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.StrokeOptions();
124389
- strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
124390
- const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.PolyfaceBuilder.create(strokeOptions);
124391
- polyfaceBuilder.addQuadFacet(corners, params);
124392
- const polyface = polyfaceBuilder.claimPolyface();
124393
- 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);
124394
- graphicBuilder.activateGraphicParams(graphicParams);
124395
- graphicBuilder.addPolyface(polyface, false);
124396
- const graphic = graphicBuilder.finish();
124397
- // Wrap the polyface in a GraphicBranch.
124398
- const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch(true);
124399
- const vfOvrs = (0,_tile_internal__WEBPACK_IMPORTED_MODULE_13__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
124400
- // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
124401
- vfOvrs.transparency = false;
124402
- branch.setViewFlagOverrides(vfOvrs);
124403
- branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
124404
- branch.entries.push(graphic);
124405
- // Apply the attachment's clip, if any.
124406
- let clipVolume;
124407
- if (this._props.jsonProperties?.clip) {
124408
- const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
124409
- if (clipVector.isValid)
124410
- clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(clipVector);
124411
- }
124412
- return _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
124413
- }
124414
- collectStatistics(stats) {
124415
- if (this._graphics)
124416
- this._graphics.collectStatistics(stats);
123801
+ return this._viewAttachments.computeDisplayTransform(args);
124417
123802
  }
124418
123803
  }
124419
123804
 
@@ -143289,6 +142674,845 @@ function getAllElementIdsFromScript(script) {
143289
142674
  }
143290
142675
 
143291
142676
 
142677
+ /***/ }),
142678
+
142679
+ /***/ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js":
142680
+ /*!********************************************************************!*\
142681
+ !*** ../../core/frontend/lib/esm/internal/SheetViewAttachments.js ***!
142682
+ \********************************************************************/
142683
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
142684
+
142685
+ "use strict";
142686
+ __webpack_require__.r(__webpack_exports__);
142687
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
142688
+ /* harmony export */ SheetViewAttachments: () => (/* binding */ SheetViewAttachments)
142689
+ /* harmony export */ });
142690
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
142691
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
142692
+ /* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
142693
+ /* harmony import */ var _ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ViewAttachmentRenderer */ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js");
142694
+ /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
142695
+ /*---------------------------------------------------------------------------------------------
142696
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
142697
+ * See LICENSE.md in the project root for license terms and full copyright notice.
142698
+ *--------------------------------------------------------------------------------------------*/
142699
+ /** @packageDocumentation
142700
+ * @module Views
142701
+ */
142702
+
142703
+
142704
+
142705
+
142706
+
142707
+ /** Stateless state for a sheet that has no view attachments. */
142708
+ class EmptyAttachments {
142709
+ // We only need one instance of this stateless class.
142710
+ static _instance;
142711
+ static get() {
142712
+ return this._instance ?? (this._instance = new EmptyAttachments());
142713
+ }
142714
+ constructor() { }
142715
+ clone() {
142716
+ return this;
142717
+ }
142718
+ preload() { }
142719
+ async postload() {
142720
+ return this;
142721
+ }
142722
+ get attachmentIds() {
142723
+ return [];
142724
+ }
142725
+ }
142726
+ /** Holds the element Ids of the view attachments to be loaded for display. */
142727
+ class AttachmentIds {
142728
+ _ids;
142729
+ constructor(ids) {
142730
+ this._ids = ids;
142731
+ }
142732
+ get attachmentIds() {
142733
+ return this._ids;
142734
+ }
142735
+ clone() {
142736
+ return new AttachmentIds([...this._ids]);
142737
+ }
142738
+ preload(request) {
142739
+ request.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.CompressedId64Set.sortAndCompress(this._ids);
142740
+ request.viewStateLoadProps = {
142741
+ displayStyle: {
142742
+ omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
142743
+ compressExcludedElementIds: true,
142744
+ },
142745
+ };
142746
+ }
142747
+ async postload(response, iModel) {
142748
+ if (undefined === response.sheetViewViews || undefined === response.sheetViewAttachmentProps) {
142749
+ return this;
142750
+ }
142751
+ const viewStateProps = response.sheetViewViews;
142752
+ const promises = [];
142753
+ for (const viewProps of viewStateProps) {
142754
+ const loadView = async () => {
142755
+ try {
142756
+ if (viewProps === undefined)
142757
+ return undefined;
142758
+ const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
142759
+ return view;
142760
+ }
142761
+ catch {
142762
+ return undefined;
142763
+ }
142764
+ };
142765
+ promises.push(loadView());
142766
+ }
142767
+ const views = await Promise.all(promises);
142768
+ const attachmentProps = response.sheetViewAttachmentProps;
142769
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
142770
+ const infos = [];
142771
+ for (let i = 0; i < views.length; i++) {
142772
+ const view = views[i];
142773
+ if (view && !(view.isSheetView())) {
142774
+ const props = attachmentProps[i];
142775
+ props.attachedView = view;
142776
+ infos.push(props);
142777
+ }
142778
+ }
142779
+ return new AttachmentInfos(infos);
142780
+ }
142781
+ }
142782
+ /** Fully loaded view attachments. */
142783
+ class AttachmentInfos {
142784
+ infos;
142785
+ constructor(infos) {
142786
+ this.infos = infos;
142787
+ }
142788
+ get attachmentIds() {
142789
+ return this.infos.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.expectDefined)(x.id));
142790
+ }
142791
+ clone(iModel) {
142792
+ const infos = this.infos.map((info) => {
142793
+ return {
142794
+ ...info,
142795
+ attachedView: info.attachedView.clone(iModel),
142796
+ };
142797
+ });
142798
+ return new AttachmentInfos(infos);
142799
+ }
142800
+ preload() {
142801
+ // already loaded.
142802
+ }
142803
+ async postload() {
142804
+ // already loaded.
142805
+ return this;
142806
+ }
142807
+ }
142808
+ /** Reloads the attachments after a change to the database. */
142809
+ async function reloadAttachments(sheetModelId, iModel) {
142810
+ const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${sheetModelId}`;
142811
+ const ids = [];
142812
+ for await (const row of iModel.createQueryReader(ecsql)) {
142813
+ ids.push(row[0]);
142814
+ }
142815
+ const attachmentProps = await iModel.elements.getProps(ids);
142816
+ const promises = [];
142817
+ for (const attachment of attachmentProps) {
142818
+ const loadView = async () => {
142819
+ try {
142820
+ const view = await iModel.views.load(attachment.view.id);
142821
+ return view;
142822
+ }
142823
+ catch {
142824
+ return undefined;
142825
+ }
142826
+ };
142827
+ promises.push(loadView());
142828
+ }
142829
+ const views = await Promise.all(promises);
142830
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
142831
+ const infos = [];
142832
+ for (let i = 0; i < views.length; i++) {
142833
+ const view = views[i];
142834
+ if (view && !view.isSheetView()) {
142835
+ const props = attachmentProps[i];
142836
+ props.attachedView = view;
142837
+ infos.push(props);
142838
+ }
142839
+ }
142840
+ return new AttachmentInfos(infos);
142841
+ }
142842
+ function disposeRenderers(renderers) {
142843
+ if (renderers) {
142844
+ for (const renderer of renderers) {
142845
+ renderer[Symbol.dispose]();
142846
+ }
142847
+ }
142848
+ }
142849
+ /** Manages the set of ViewAttachment elements to be rendered by a SheetViewState.
142850
+ * Takes care of reloading them after ViewAttachment elements are modified, deleted, or inserted.
142851
+ */
142852
+ class SheetViewAttachments {
142853
+ _impl;
142854
+ _reload;
142855
+ _maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
142856
+ _rendererArgs;
142857
+ _renderers;
142858
+ get maxDepth() {
142859
+ return this._maxDepth;
142860
+ }
142861
+ *getSecondaryViewports() {
142862
+ if (this._renderers) {
142863
+ for (const renderer of this._renderers) {
142864
+ if (renderer.viewport) {
142865
+ yield renderer.viewport;
142866
+ }
142867
+ }
142868
+ }
142869
+ }
142870
+ constructor(impl) {
142871
+ this._impl = impl;
142872
+ }
142873
+ [Symbol.dispose]() {
142874
+ disposeRenderers(this._renderers);
142875
+ this._renderers = this._rendererArgs = undefined;
142876
+ this._reload = undefined;
142877
+ }
142878
+ static create(attachmentIds) {
142879
+ const impl = attachmentIds.length === 0 ? EmptyAttachments.get() : new AttachmentIds([...attachmentIds]);
142880
+ return new this(impl);
142881
+ }
142882
+ get attachmentIds() {
142883
+ return this._impl.attachmentIds;
142884
+ }
142885
+ clone(iModel) {
142886
+ return new SheetViewAttachments(this._impl.clone(iModel));
142887
+ }
142888
+ preload(request) {
142889
+ this._impl.preload(request);
142890
+ }
142891
+ async postload(response, iModel) {
142892
+ this._impl = await this._impl.postload(response, iModel);
142893
+ }
142894
+ async reload(sheetModelId, iModel) {
142895
+ const renderers = this._renderers;
142896
+ const reload = this._reload = reloadAttachments(sheetModelId, iModel);
142897
+ const impl = await this._reload;
142898
+ // We keep the previous renderers until reloading completes, to avoid drawing a blank view while waiting.
142899
+ // Afterward, always destroy the previous renderers.
142900
+ disposeRenderers(renderers);
142901
+ // If reload was not called again while we waited...
142902
+ if (this._reload === reload) {
142903
+ this._impl = impl;
142904
+ this._reload = this._renderers = undefined;
142905
+ if (this._rendererArgs) {
142906
+ // We are attached to a Viewport - reload the renderers.
142907
+ this.loadRenderers();
142908
+ }
142909
+ }
142910
+ }
142911
+ attachToViewport(args) {
142912
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
142913
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._rendererArgs);
142914
+ this._rendererArgs = args;
142915
+ this.loadRenderers();
142916
+ }
142917
+ detachFromViewport() {
142918
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== this._rendererArgs);
142919
+ this._rendererArgs = undefined;
142920
+ disposeRenderers(this._renderers);
142921
+ this._renderers = undefined;
142922
+ }
142923
+ areAllTileTreesLoaded(displayedExtents) {
142924
+ if (this._reload) {
142925
+ return false;
142926
+ }
142927
+ else if (!this._renderers) {
142928
+ return true;
142929
+ }
142930
+ return this._renderers.every((renderer) => {
142931
+ const attachmentRange = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(renderer.viewAttachmentProps.placement).calculateRange();
142932
+ return !attachmentRange.intersectsRangeXY(displayedExtents) || renderer.areAllTileTreesLoaded;
142933
+ });
142934
+ }
142935
+ discloseTileTrees(trees) {
142936
+ for (const renderer of this.renderers()) {
142937
+ trees.disclose(renderer);
142938
+ }
142939
+ }
142940
+ collectStatistics(stats) {
142941
+ for (const renderer of this.renderers()) {
142942
+ renderer.collectStatistics(stats);
142943
+ }
142944
+ }
142945
+ addToScene(context) {
142946
+ for (const renderer of this.renderers()) {
142947
+ renderer.addToScene(context);
142948
+ }
142949
+ }
142950
+ getAttachmentViewport(args) {
142951
+ const renderer = args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
142952
+ if (!renderer) {
142953
+ return undefined;
142954
+ }
142955
+ return args.inSectionDrawingAttachment ? renderer.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : renderer.viewport;
142956
+ }
142957
+ computeDisplayTransform(args) {
142958
+ const renderer = undefined !== args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
142959
+ const ortho = renderer?.ortho;
142960
+ const sheetTransform = ortho?.toSheet;
142961
+ if (!sheetTransform) {
142962
+ return undefined;
142963
+ }
142964
+ const sectionTransform = args.inSectionDrawingAttachment ? ortho.view.computeDisplayTransform(args) : undefined;
142965
+ if (!sectionTransform) {
142966
+ return sheetTransform.clone(args.output);
142967
+ }
142968
+ return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
142969
+ }
142970
+ /** Strictly for tests. */
142971
+ areAllAttachmentsLoaded() {
142972
+ return !this._reload && (!this._renderers || this._renderers.every((x) => x.areAllTileTreesLoaded));
142973
+ }
142974
+ /** Strictly for tests. */
142975
+ get attachments() {
142976
+ return this._renderers;
142977
+ }
142978
+ /** Strictly for tests. */
142979
+ get attachmentProps() {
142980
+ const infos = this._impl.infos;
142981
+ if (!infos) {
142982
+ return [];
142983
+ }
142984
+ return infos.map((x) => {
142985
+ return {
142986
+ ...x,
142987
+ attachedView: undefined,
142988
+ };
142989
+ });
142990
+ }
142991
+ /** Strictly for tests. */
142992
+ get attachmentInfos() {
142993
+ const infos = this._impl.infos;
142994
+ return infos ?? this._impl.attachmentIds;
142995
+ }
142996
+ loadRenderers() {
142997
+ const args = this._rendererArgs;
142998
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== args);
142999
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
143000
+ this._maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
143001
+ const infos = this._impl.infos;
143002
+ if (!infos) {
143003
+ return;
143004
+ }
143005
+ this._renderers = infos.map((info) => {
143006
+ const renderer = (0,_ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__.createViewAttachmentRenderer)({
143007
+ ...args,
143008
+ props: info,
143009
+ view: info.attachedView,
143010
+ });
143011
+ this._maxDepth = Math.max(this._maxDepth, renderer.zDepth);
143012
+ return renderer;
143013
+ });
143014
+ }
143015
+ *renderers() {
143016
+ if (this._renderers) {
143017
+ for (const renderer of this._renderers) {
143018
+ yield renderer;
143019
+ }
143020
+ }
143021
+ }
143022
+ findRendererById(id) {
143023
+ return this._renderers?.find((x) => x.viewAttachmentProps.id === id);
143024
+ }
143025
+ }
143026
+
143027
+
143028
+ /***/ }),
143029
+
143030
+ /***/ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js":
143031
+ /*!**********************************************************************!*\
143032
+ !*** ../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js ***!
143033
+ \**********************************************************************/
143034
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
143035
+
143036
+ "use strict";
143037
+ __webpack_require__.r(__webpack_exports__);
143038
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
143039
+ /* harmony export */ createViewAttachmentRenderer: () => (/* binding */ createViewAttachmentRenderer)
143040
+ /* harmony export */ });
143041
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
143042
+ /* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
143043
+ /* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
143044
+ /* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
143045
+ /* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Viewport */ "../../core/frontend/lib/esm/Viewport.js");
143046
+ /* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
143047
+ /* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
143048
+ /* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
143049
+ /* harmony import */ var _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../render/FeatureSymbology */ "../../core/frontend/lib/esm/render/FeatureSymbology.js");
143050
+ /* harmony import */ var _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../render/GraphicBranch */ "../../core/frontend/lib/esm/render/GraphicBranch.js");
143051
+ /* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
143052
+ /* harmony import */ var _render_MockRender__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./render/MockRender */ "../../core/frontend/lib/esm/internal/render/MockRender.js");
143053
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
143054
+ /* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
143055
+ /* harmony import */ var _tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tile/ViewFlagOverrides */ "../../core/frontend/lib/esm/internal/tile/ViewFlagOverrides.js");
143056
+ /*---------------------------------------------------------------------------------------------
143057
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
143058
+ * See LICENSE.md in the project root for license terms and full copyright notice.
143059
+ *--------------------------------------------------------------------------------------------*/
143060
+ /** @packageDocumentation
143061
+ * @module Views
143062
+ */
143063
+
143064
+
143065
+
143066
+
143067
+
143068
+
143069
+
143070
+
143071
+
143072
+
143073
+
143074
+
143075
+
143076
+
143077
+
143078
+ function createViewAttachmentRenderer(args) {
143079
+ const { props, view } = args;
143080
+ if (props.jsonProperties?.displayOptions?.drawAsRaster || (view.is3d() && view.isCameraOn)) {
143081
+ return new RasterAttachment(view, props, args.backgroundColor);
143082
+ }
143083
+ else {
143084
+ return new OrthographicAttachment(view, props, args.sheetModelId);
143085
+ }
143086
+ }
143087
+ /** A mostly no-op RenderTarget for an OrthographicAttachment. */
143088
+ class AttachmentTarget extends _render_MockRender__WEBPACK_IMPORTED_MODULE_11__.MockRender.OffScreenTarget {
143089
+ _attachment;
143090
+ constructor(attachment) {
143091
+ // The dimensions don't matter - we're not drawing anything.
143092
+ const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(1, 1);
143093
+ super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem, rect);
143094
+ this._attachment = attachment;
143095
+ }
143096
+ changeScene(scene) {
143097
+ this._attachment.scene = scene;
143098
+ }
143099
+ overrideFeatureSymbology(ovrs) {
143100
+ this._attachment.symbologyOverrides = ovrs;
143101
+ }
143102
+ }
143103
+ /** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
143104
+ * We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
143105
+ * collect the resultant graphics and add them to the sheet view's scene.
143106
+ */
143107
+ class OrthographicAttachment {
143108
+ _viewport;
143109
+ _props;
143110
+ _sheetModelId;
143111
+ _viewFlagOverrides;
143112
+ _toSheet;
143113
+ _fromSheet;
143114
+ _sizeInMeters;
143115
+ _range;
143116
+ _viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, 1, 1);
143117
+ _originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Frustum();
143118
+ _clipVolume;
143119
+ _hiddenLineSettings;
143120
+ _scale;
143121
+ _debugFeatureTable;
143122
+ scene;
143123
+ symbologyOverrides;
143124
+ zDepth;
143125
+ get view() {
143126
+ return this._viewport.view;
143127
+ }
143128
+ get viewAttachmentProps() {
143129
+ return this._props;
143130
+ }
143131
+ get viewport() {
143132
+ return this._viewport;
143133
+ }
143134
+ constructor(view, props, sheetModelId) {
143135
+ this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
143136
+ const target = new AttachmentTarget(this);
143137
+ this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport.createViewport(view, target, true);
143138
+ this._props = props;
143139
+ this._sheetModelId = sheetModelId;
143140
+ const applyClip = true; // set to false for debugging
143141
+ this._viewFlagOverrides = {
143142
+ ...view.viewFlags,
143143
+ clipVolume: applyClip,
143144
+ lighting: false,
143145
+ shadows: false,
143146
+ };
143147
+ const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
143148
+ const range = placement.calculateRange();
143149
+ this._range = range;
143150
+ this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(range.xLength(), range.yLength());
143151
+ // Compute transform from attached view's world coordinates to sheet's world coordinates.
143152
+ // NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
143153
+ const applySkew = true; // set to false for debugging
143154
+ const skew = applySkew ? view.getAspectRatioSkew() : 1;
143155
+ const extents = this._viewport.viewingSpace.viewDelta.clone();
143156
+ const zDepth = Math.abs(extents.z);
143157
+ const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
143158
+ const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
143159
+ this._scale = { x: 1 / scaleX, y: 1 / scaleY };
143160
+ const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
143161
+ this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
143162
+ // View origin is at the *back* of the view. Align *front* of view based on display priority.
143163
+ const viewRot = view.getRotation();
143164
+ const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
143165
+ viewOrg.z += zDepth;
143166
+ viewRot.multiplyTransposeVectorInPlace(viewOrg);
143167
+ const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.createScale(scaleX, scaleY, 1);
143168
+ matrix.multiplyMatrixMatrix(viewRot, matrix);
143169
+ const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
143170
+ const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.createFrom(placement.origin);
143171
+ attachmentOrigin.z = zBias;
143172
+ const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
143173
+ origin.addInPlace(viewOrgToAttachment);
143174
+ this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Transform.createRefs(origin, matrix);
143175
+ this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.expectDefined)(this._toSheet.inverse());
143176
+ // If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
143177
+ // The clip needs to be transformed into sheet space.
143178
+ if (view.isDrawingView())
143179
+ this._viewport.drawingToSheetTransform = this._toSheet;
143180
+ // ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
143181
+ // However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
143182
+ // introduce additional computation, so possibly not worth it.
143183
+ // Transform the view's clip (if any) to sheet space
143184
+ let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
143185
+ if (viewClip)
143186
+ viewClip.transformInPlace(this._toSheet);
143187
+ else
143188
+ viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.createEmpty();
143189
+ let sheetClip;
143190
+ if (undefined !== props.jsonProperties?.clip)
143191
+ sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(props.jsonProperties?.clip);
143192
+ if (sheetClip && sheetClip.isValid) {
143193
+ // Clip to view attachment's clip. NB: clip is in sheet coordinate space.
143194
+ for (const clip of sheetClip.clips)
143195
+ viewClip.clips.push(clip);
143196
+ }
143197
+ else {
143198
+ // Clip to view attachment's bounding box
143199
+ viewClip.appendShape([
143200
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.low.y),
143201
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.low.y),
143202
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.high.y),
143203
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.high.y),
143204
+ ]);
143205
+ }
143206
+ this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(viewClip);
143207
+ // Save off the original frustum (potentially adjusted by viewport).
143208
+ this._viewport.setupFromView();
143209
+ this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_1__.CoordSystem.World, true, this._originalFrustum);
143210
+ const applyHiddenLineSettings = true; // for debugging edge display, set to false...
143211
+ const style = view.displayStyle;
143212
+ if (style.is3d() && applyHiddenLineSettings)
143213
+ this._hiddenLineSettings = style.settings.hiddenLineSettings;
143214
+ }
143215
+ [Symbol.dispose]() {
143216
+ this._viewport[Symbol.dispose]();
143217
+ }
143218
+ discloseTileTrees(trees) {
143219
+ trees.disclose(this._viewport);
143220
+ }
143221
+ addToScene(context) {
143222
+ if (context.viewport.freezeScene)
143223
+ return;
143224
+ if (!context.viewport.view.viewsCategory(this._props.category))
143225
+ return;
143226
+ const wantBounds = context.viewport.wantViewAttachmentBoundaries;
143227
+ const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
143228
+ if (wantBounds || wantClipShapes) {
143229
+ const builder = context.createSceneGraphicBuilder();
143230
+ if (wantBounds) {
143231
+ builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
143232
+ builder.addRangeBox(this._range);
143233
+ }
143234
+ if (wantClipShapes && this._clipVolume) {
143235
+ builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, 2);
143236
+ for (const prim of this._clipVolume.clipVector.clips) {
143237
+ if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipShape))
143238
+ continue; // ###TODO handle non-shape primitives, if any such ever encountered
143239
+ const pts = [];
143240
+ const tf = prim.transformFromClip;
143241
+ for (const pt of prim.polygon) {
143242
+ const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
143243
+ pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(tfPt.x, tfPt.y));
143244
+ }
143245
+ builder.addLineString2d(pts, 0);
143246
+ }
143247
+ }
143248
+ // Put into a Batch so that we can see tooltip with attachment Id on mouseover.
143249
+ const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
143250
+ context.outputGraphic(batch);
143251
+ }
143252
+ if (!context.viewport.wantViewAttachments)
143253
+ return;
143254
+ // Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
143255
+ const pixelSize = context.viewport.getPixelSizeAtPoint();
143256
+ if (0 === pixelSize)
143257
+ return;
143258
+ // Adjust attached view frustum based on intersection with sheet view frustum.
143259
+ const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
143260
+ const attachFrustumRange = attachFrustum.toRange();
143261
+ const sheetFrustum = context.viewport.getWorldFrustum();
143262
+ const sheetFrustumRange = sheetFrustum.toRange();
143263
+ const intersect = attachFrustumRange.intersect(sheetFrustumRange);
143264
+ if (intersect.isNull)
143265
+ return;
143266
+ attachFrustum.initFromRange(intersect);
143267
+ attachFrustum.transformBy(this._fromSheet, attachFrustum);
143268
+ this._viewport.setupViewFromFrustum(attachFrustum);
143269
+ // Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
143270
+ const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
143271
+ const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
143272
+ this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
143273
+ this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
143274
+ this._viewport.setRect(this._viewRect);
143275
+ // Propagate settings from on-screen viewport.
143276
+ this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
143277
+ this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
143278
+ // Create the scene.
143279
+ this._viewport.renderFrame();
143280
+ const scene = this.scene;
143281
+ if (!scene)
143282
+ return;
143283
+ // Extract scene graphics and insert into on-screen scene context.
143284
+ const options = {
143285
+ viewAttachmentId: this._props.id,
143286
+ clipVolume: this._clipVolume,
143287
+ hline: this._hiddenLineSettings,
143288
+ frustum: {
143289
+ is3d: this.view.is3d(),
143290
+ scale: this._scale,
143291
+ },
143292
+ };
143293
+ const outputGraphics = (source) => {
143294
+ if (0 === source.length)
143295
+ return;
143296
+ const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch();
143297
+ graphics.setViewFlagOverrides(this._viewFlagOverrides);
143298
+ graphics.symbologyOverrides = this.symbologyOverrides;
143299
+ for (const graphic of source)
143300
+ graphics.entries.push(graphic);
143301
+ const branch = context.createGraphicBranch(graphics, this._toSheet, options);
143302
+ context.outputGraphic(branch);
143303
+ };
143304
+ outputGraphics(scene.foreground);
143305
+ context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
143306
+ context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
143307
+ // Report tile statistics to sheet view's viewport.
143308
+ const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.tileAdmin;
143309
+ const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
143310
+ const requested = tileAdmin.getRequestsForUser(this._viewport);
143311
+ tileAdmin.addExternalTilesForUser(context.viewport, {
143312
+ requested: requested?.size ?? 0,
143313
+ selected: selectedAndReady?.selected.size ?? 0,
143314
+ ready: selectedAndReady?.ready.size ?? 0,
143315
+ });
143316
+ }
143317
+ getDebugFeatureTable() {
143318
+ if (this._debugFeatureTable)
143319
+ return this._debugFeatureTable;
143320
+ const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.FeatureTable(1, this._sheetModelId);
143321
+ featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Feature(this._props.id));
143322
+ this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.PackedFeatureTable.pack(featureTable);
143323
+ return this._debugFeatureTable;
143324
+ }
143325
+ get areAllTileTreesLoaded() {
143326
+ return this.view.areAllTileTreesLoaded;
143327
+ }
143328
+ collectStatistics(_stats) {
143329
+ // Handled by discloseTileTrees()
143330
+ }
143331
+ get ortho() {
143332
+ return {
143333
+ toSheet: this._toSheet,
143334
+ view: this.view,
143335
+ };
143336
+ }
143337
+ }
143338
+ function createRasterAttachmentViewport(_view, _rect, _attachment) {
143339
+ class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport {
143340
+ _sceneContext;
143341
+ _isSceneReady = false;
143342
+ _attachment;
143343
+ constructor(view, rect, attachment) {
143344
+ super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createOffscreenTarget(rect));
143345
+ this._attachment = attachment;
143346
+ this._isAspectRatioLocked = true;
143347
+ this.changeView(view);
143348
+ }
143349
+ createSceneContext() {
143350
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
143351
+ this._sceneContext = super.createSceneContext();
143352
+ return this._sceneContext;
143353
+ }
143354
+ renderFrame() {
143355
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
143356
+ this.clearSceneContext();
143357
+ super.renderFrame();
143358
+ if (undefined !== this._sceneContext) {
143359
+ this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
143360
+ if (this._isSceneReady)
143361
+ this._attachment.produceGraphics(this._sceneContext);
143362
+ this._sceneContext = undefined;
143363
+ }
143364
+ }
143365
+ clearSceneContext() {
143366
+ this._sceneContext = undefined;
143367
+ }
143368
+ addDecorations() {
143369
+ // ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
143370
+ }
143371
+ }
143372
+ return new RasterAttachmentViewport(_view, _rect, _attachment);
143373
+ }
143374
+ /** Draws a 3d view (usually with camera enabled) into a sheet view by producing an image of the view's contents offscreen. */
143375
+ class RasterAttachment {
143376
+ _props;
143377
+ _placement;
143378
+ _transform;
143379
+ zDepth;
143380
+ _viewport;
143381
+ _graphics;
143382
+ constructor(view, props, bgColor) {
143383
+ // Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
143384
+ const maxSize = 2048;
143385
+ const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, maxSize, maxSize);
143386
+ const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
143387
+ const skew = maxSize / height;
143388
+ view.setAspectRatioSkew(skew);
143389
+ if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
143390
+ // Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
143391
+ view.displayStyle.backgroundColor = bgColor.withAlpha(0);
143392
+ }
143393
+ this._viewport = createRasterAttachmentViewport(view, rect, this);
143394
+ this._props = props;
143395
+ this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
143396
+ this._transform = this._placement.transform;
143397
+ this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
143398
+ }
143399
+ [Symbol.dispose]() {
143400
+ this._viewport?.[Symbol.dispose]();
143401
+ }
143402
+ get viewAttachmentProps() {
143403
+ return this._props;
143404
+ }
143405
+ get viewport() {
143406
+ return this._viewport;
143407
+ }
143408
+ get areAllTileTreesLoaded() {
143409
+ return this._viewport?.areAllTileTreesLoaded ?? true;
143410
+ }
143411
+ addToScene(context) {
143412
+ // ###TODO: check viewport.wantViewAttachmentClipShapes
143413
+ if (!context.viewport.view.viewsCategory(this._props.category))
143414
+ return;
143415
+ if (context.viewport.wantViewAttachmentBoundaries) {
143416
+ const builder = context.createSceneGraphicBuilder(this._transform);
143417
+ builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
143418
+ builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Range3d.createRange2d(this._placement.bbox));
143419
+ context.outputGraphic(builder.finish());
143420
+ }
143421
+ if (!context.viewport.wantViewAttachments)
143422
+ return;
143423
+ if (this._graphics) {
143424
+ context.outputGraphic(this._graphics);
143425
+ return;
143426
+ }
143427
+ if (undefined === this._viewport)
143428
+ return;
143429
+ this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
143430
+ this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
143431
+ this._viewport.renderFrame();
143432
+ if (this._graphics)
143433
+ context.outputGraphic(this._graphics);
143434
+ }
143435
+ discloseTileTrees(trees) {
143436
+ if (this._viewport)
143437
+ trees.disclose(this._viewport);
143438
+ }
143439
+ produceGraphics(context) {
143440
+ (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(context.viewport === this._viewport);
143441
+ this._graphics = this.createGraphics(this._viewport);
143442
+ this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.dispose)(this._viewport);
143443
+ if (undefined !== this._graphics)
143444
+ context.outputGraphic(this._graphics);
143445
+ }
143446
+ createGraphics(vp) {
143447
+ // Create a texture from the contents of the view.
143448
+ const image = vp.readImageBuffer({ upsideDown: true });
143449
+ if (undefined === image)
143450
+ return undefined;
143451
+ const debugImage = false; // set to true to open a window displaying the captured image.
143452
+ if (debugImage) {
143453
+ const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.imageBufferToPngDataUrl)(image, false);
143454
+ if (url)
143455
+ (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.openImageDataUrlInNewWindow)(url, "Attachment");
143456
+ }
143457
+ const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createTexture({
143458
+ image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.TextureTransparency.Opaque },
143459
+ });
143460
+ if (!texture)
143461
+ return undefined;
143462
+ // Create a material for the texture
143463
+ const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.GraphicParams();
143464
+ graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
143465
+ // Apply the texture to a rectangular polyface.
143466
+ const depth = this.zDepth;
143467
+ const east = this._placement.bbox.low.x;
143468
+ const west = this._placement.bbox.high.x;
143469
+ const north = this._placement.bbox.low.y;
143470
+ const south = this._placement.bbox.high.y;
143471
+ const corners = [
143472
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, north, depth),
143473
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, north, depth),
143474
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, south, depth),
143475
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, south, depth),
143476
+ ];
143477
+ const params = [
143478
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 0),
143479
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 0),
143480
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 1),
143481
+ _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 1),
143482
+ ];
143483
+ const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.StrokeOptions();
143484
+ strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
143485
+ const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.PolyfaceBuilder.create(strokeOptions);
143486
+ polyfaceBuilder.addQuadFacet(corners, params);
143487
+ const polyface = polyfaceBuilder.claimPolyface();
143488
+ 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);
143489
+ graphicBuilder.activateGraphicParams(graphicParams);
143490
+ graphicBuilder.addPolyface(polyface, false);
143491
+ const graphic = graphicBuilder.finish();
143492
+ // Wrap the polyface in a GraphicBranch.
143493
+ const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch(true);
143494
+ const vfOvrs = (0,_tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
143495
+ // Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
143496
+ vfOvrs.transparency = false;
143497
+ branch.setViewFlagOverrides(vfOvrs);
143498
+ branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
143499
+ branch.entries.push(graphic);
143500
+ // Apply the attachment's clip, if any.
143501
+ let clipVolume;
143502
+ if (this._props.jsonProperties?.clip) {
143503
+ const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
143504
+ if (clipVector.isValid)
143505
+ clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(clipVector);
143506
+ }
143507
+ return _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
143508
+ }
143509
+ collectStatistics(stats) {
143510
+ if (this._graphics)
143511
+ this._graphics.collectStatistics(stats);
143512
+ }
143513
+ }
143514
+
143515
+
143292
143516
  /***/ }),
143293
143517
 
143294
143518
  /***/ "../../core/frontend/lib/esm/internal/cross-package.js":
@@ -156849,7 +157073,7 @@ class FrameBuffers {
156849
157073
  undefined !== textures.depthAndOrderMsBuff &&
156850
157074
  undefined !== textures.depthAndOrderMsBuffHidden);
156851
157075
  const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuff, textures.depthAndOrderMsBuff];
156852
- const colorAndPickFilters = [_GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Linear, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest];
157076
+ const colorAndPickFilters = [_GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Linear, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest];
156853
157077
  this.opaqueAll = _FrameBuffer__WEBPACK_IMPORTED_MODULE_9__.FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
156854
157078
  colorAndPick[0] = textures.color;
156855
157079
  this.opaqueAndCompositeAll = _FrameBuffer__WEBPACK_IMPORTED_MODULE_9__.FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
@@ -159502,12 +159726,19 @@ class VertexShaderBuilder extends ShaderBuilder {
159502
159726
  }
159503
159727
  main.addline(" v_color = baseColor;");
159504
159728
  }
159729
+ /*
159730
+ 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).
159731
+
159732
+ 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.
159733
+
159734
+ The workaround for this bug involves ensuring that gl_Position is initialized to a valid position before attempting a discard using a degenerate triangle.
159735
+ */
159736
+ main.addline(" gl_Position = computePosition(rawPosition);");
159505
159737
  const checkForDiscard = this.get(9 /* VertexShaderComponent.CheckForDiscard */);
159506
159738
  if (undefined !== checkForDiscard) {
159507
159739
  prelude.addFunction("bool checkForDiscard()", checkForDiscard);
159508
159740
  main.add(_glsl_Vertex__WEBPACK_IMPORTED_MODULE_3__.vertexDiscard);
159509
159741
  }
159510
- main.addline(" gl_Position = computePosition(rawPosition);");
159511
159742
  const finalizePos = this.get(13 /* VertexShaderComponent.FinalizePosition */);
159512
159743
  if (undefined !== finalizePos) {
159513
159744
  prelude.addFunction("vec4 finalizePosition(vec4 pos)", finalizePos);
@@ -185271,10 +185502,10 @@ class AngleDescription extends _FormattedQuantityDescription__WEBPACK_IMPORTED_M
185271
185502
  constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
185272
185503
  const defaultName = "angle";
185273
185504
  super({
185274
- name: name ? name : defaultName,
185275
- displayLabel: displayLabel ? displayLabel : _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Angle"),
185276
- kindOfQuantityName: kindOfQuantityName ? kindOfQuantityName : "AecUnits.ANGLE",
185277
- iconSpec
185505
+ name: name ?? defaultName,
185506
+ displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Angle"),
185507
+ kindOfQuantityName: kindOfQuantityName ?? "DefaultToolsUnits.ANGLE",
185508
+ iconSpec,
185278
185509
  });
185279
185510
  }
185280
185511
  get formatterQuantityType() { return _quantity_formatting_QuantityFormatter__WEBPACK_IMPORTED_MODULE_1__.QuantityType.Angle; }
@@ -185406,9 +185637,9 @@ class LengthDescription extends _FormattedQuantityDescription__WEBPACK_IMPORTED_
185406
185637
  constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
185407
185638
  const defaultName = "length";
185408
185639
  super({
185409
- name: name ? name : defaultName,
185410
- displayLabel: displayLabel ? displayLabel : _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
185411
- kindOfQuantityName: kindOfQuantityName ? kindOfQuantityName : "AecUnits.LENGTH",
185640
+ name: name ?? defaultName,
185641
+ displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
185642
+ kindOfQuantityName: kindOfQuantityName ?? "DefaultToolsUnits.LENGTH",
185412
185643
  iconSpec,
185413
185644
  });
185414
185645
  }
@@ -185427,9 +185658,9 @@ class SurveyLengthDescription extends _FormattedQuantityDescription__WEBPACK_IMP
185427
185658
  constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
185428
185659
  const defaultName = "surveyLength";
185429
185660
  super({
185430
- name: name ? name : defaultName,
185431
- displayLabel: displayLabel ? displayLabel : _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
185432
- kindOfQuantityName: kindOfQuantityName ? kindOfQuantityName : "AecUnits.LENGTH",
185661
+ name: name ?? defaultName,
185662
+ displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
185663
+ kindOfQuantityName: kindOfQuantityName ?? "CivilUnits.LENGTH",
185433
185664
  iconSpec,
185434
185665
  });
185435
185666
  }
@@ -185448,9 +185679,9 @@ class EngineeringLengthDescription extends _FormattedQuantityDescription__WEBPAC
185448
185679
  constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
185449
185680
  const defaultName = "engineeringLength";
185450
185681
  super({
185451
- name: name ? name : defaultName,
185452
- displayLabel: displayLabel ? displayLabel : _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
185453
- kindOfQuantityName: kindOfQuantityName ? kindOfQuantityName : "AecUnits.LENGTH",
185682
+ name: name ?? defaultName,
185683
+ displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
185684
+ kindOfQuantityName: kindOfQuantityName ?? "AecUnits.LENGTH",
185454
185685
  iconSpec,
185455
185686
  });
185456
185687
  }
@@ -186041,13 +186272,14 @@ class QuantityTypeFormatsProvider {
186041
186272
  this._removeListeners.forEach(listener => listener());
186042
186273
  }
186043
186274
  _kindOfQuantityMap = new Map([
186044
- ["AecUnits.LENGTH", QuantityType.Length],
186045
- ["AecUnits.ANGLE", QuantityType.Angle],
186046
- ["AecUnits.AREA", QuantityType.Area],
186047
- ["AecUnits.VOLUME", QuantityType.Volume],
186048
- ["AecUnits.LENGTH_COORDINATE", QuantityType.Coordinate],
186049
- ["RoadRailUnits.STATION", QuantityType.Stationing],
186050
- ["RoadRailUnits.LENGTH", QuantityType.LengthSurvey],
186275
+ ["DefaultToolsUnits.LENGTH", QuantityType.Length],
186276
+ ["DefaultToolsUnits.ANGLE", QuantityType.Angle],
186277
+ ["DefaultToolsUnits.AREA", QuantityType.Area],
186278
+ ["DefaultToolsUnits.VOLUME", QuantityType.Volume],
186279
+ ["DefaultToolsUnits.LENGTH_COORDINATE", QuantityType.Coordinate],
186280
+ ["CivilUnits.STATION", QuantityType.Stationing],
186281
+ ["CivilUnits.LENGTH", QuantityType.LengthSurvey],
186282
+ ["AecUnits.LENGTH", QuantityType.LengthEngineering]
186051
186283
  ]);
186052
186284
  async getFormat(name) {
186053
186285
  const quantityType = this._kindOfQuantityMap.get(name);
@@ -186275,7 +186507,7 @@ class QuantityFormatter {
186275
186507
  */
186276
186508
  async onInitialized() {
186277
186509
  await this.initializeQuantityTypesRegistry();
186278
- const initialKoQs = [["AecUnits.LENGTH", "Units.M"], ["AecUnits.ANGLE", "Units.RAD"], ["AecUnits.AREA", "Units.SQ_M"], ["AecUnits.VOLUME", "Units.CUB_M"], ["AecUnits.LENGTH_COORDINATE", "Units.M"], ["RoadRailUnits.STATION", "Units.M"], ["RoadRailUnits.LENGTH", "Units.M"]];
186510
+ const initialKoQs = [["DefaultToolsUnits.LENGTH", "Units.M"], ["DefaultToolsUnits.ANGLE", "Units.RAD"], ["DefaultToolsUnits.AREA", "Units.SQ_M"], ["DefaultToolsUnits.VOLUME", "Units.CUB_M"], ["DefaultToolsUnits.LENGTH_COORDINATE", "Units.M"], ["CivilUnits.STATION", "Units.M"], ["CivilUnits.LENGTH", "Units.M"], ["AecUnits.LENGTH", "Units.M"]];
186279
186511
  for (const entry of initialKoQs) {
186280
186512
  try {
186281
186513
  await this.addFormattingSpecsToRegistry(entry[0], entry[1]);
@@ -207409,7 +207641,7 @@ class EventController {
207409
207641
  const element = vp.parentDiv;
207410
207642
  if (element === undefined)
207411
207643
  return;
207412
- // Put events on the parentDiv to allows us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).
207644
+ // Put events on the parentDiv to allow us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).
207413
207645
  this.addDomListeners(["mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "wheel", "touchstart", "touchend", "touchcancel", "touchmove"], element);
207414
207646
  element.oncontextmenu = element.onselectstart = () => false;
207415
207647
  }
@@ -207773,13 +208005,13 @@ class MeasureDistanceTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pr
207773
208005
  /** @internal */
207774
208006
  async onPostInstall() {
207775
208007
  await super.onPostInstall();
207776
- this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
207777
- this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.ANGLE", "Units.RAD");
208008
+ this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208009
+ this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.ANGLE", "Units.RAD");
207778
208010
  this._removeFormatterListener = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.formatsProvider.onFormatsChanged.addListener(async (args) => {
207779
- if (args.formatsChanged === "all" || args.formatsChanged.includes("AecUnits.LENGTH"))
207780
- this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
207781
- if (args.formatsChanged === "all" || args.formatsChanged.includes("AecUnits.ANGLE"))
207782
- this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.ANGLE", "Units.RAD");
208011
+ if (args.formatsChanged === "all" || args.formatsChanged.includes("DefaultToolsUnits.LENGTH"))
208012
+ this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208013
+ if (args.formatsChanged === "all" || args.formatsChanged.includes("DefaultToolsUnits.ANGLE"))
208014
+ this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.ANGLE", "Units.RAD");
207783
208015
  });
207784
208016
  this.setupAndPromptForNextAction();
207785
208017
  }
@@ -208261,7 +208493,7 @@ class MeasureLocationTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pr
208261
208493
  const isSpatial = (undefined !== this.targetView && this.targetView.view.isSpatialView());
208262
208494
  const toolTip = document.createElement("div");
208263
208495
  let toolTipHtml = "";
208264
- const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
208496
+ const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH_COORDINATE", "Units.M");
208265
208497
  if (undefined !== coordFormatterSpec) {
208266
208498
  let pointAdjusted = point;
208267
208499
  if (isSpatial) {
@@ -208277,7 +208509,7 @@ class MeasureLocationTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pr
208277
208509
  toolTipHtml += "<br>";
208278
208510
  }
208279
208511
  if (isSpatial) {
208280
- const latLongFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.ANGLE", "Units.RAD");
208512
+ const latLongFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.ANGLE", "Units.RAD");
208281
208513
  if (undefined !== latLongFormatterSpec && undefined !== coordFormatterSpec) {
208282
208514
  try {
208283
208515
  const cartographic = await this.iModel.spatialToCartographic(point);
@@ -208581,17 +208813,17 @@ class MeasureAreaByPointsTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9_
208581
208813
  const isSpatial = (undefined !== this.targetView && this.targetView.view.isSpatialView());
208582
208814
  const toolTip = document.createElement("div");
208583
208815
  let toolTipHtml = "";
208584
- const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.AREA", "Units.SQ_M");
208816
+ const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
208585
208817
  if (undefined !== areaFormatterSpec) {
208586
208818
  const formattedArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._area, areaFormatterSpec);
208587
208819
  toolTipHtml += `${translateBold("Area") + formattedArea}<br>`;
208588
208820
  }
208589
- const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
208821
+ const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208590
208822
  if (undefined !== perimeterFormatterSpec) {
208591
208823
  const formattedPerimeter = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._perimeter, perimeterFormatterSpec);
208592
208824
  toolTipHtml += `${translateBold("Perimeter") + formattedPerimeter}<br>`;
208593
208825
  }
208594
- const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
208826
+ const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH_COORDINATE", "Units.M");
208595
208827
  if (undefined !== coordFormatterSpec) {
208596
208828
  let pointAdjusted = this._centroid.clone();
208597
208829
  if (isSpatial) {
@@ -208630,7 +208862,7 @@ class MeasureAreaByPointsTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9_
208630
208862
  const toolTip = await this.getMarkerToolTip();
208631
208863
  this._acceptedMeasurement = new MeasureMarker("1", toolTip, this._centroid, _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(25, 25));
208632
208864
  this._marker = undefined;
208633
- const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.AREA", "Units.SQ_M");
208865
+ const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
208634
208866
  if (undefined === areaFormatterSpec)
208635
208867
  return;
208636
208868
  const formattedTotalArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._area, areaFormatterSpec);
@@ -208813,7 +209045,7 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
208813
209045
  let toolTipHtml = "";
208814
209046
  switch (this.getOperation()) {
208815
209047
  case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateLengths: {
208816
- const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
209048
+ const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208817
209049
  if (undefined !== distanceFormatterSpec) {
208818
209050
  const formattedLength = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.length ? responseProps.length : 0, distanceFormatterSpec);
208819
209051
  toolTipHtml += `${translateBold("Length") + formattedLength}<br>`;
@@ -208821,13 +209053,13 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
208821
209053
  break;
208822
209054
  }
208823
209055
  case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateAreas: {
208824
- const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.AREA", "Units.SQ_M");
209056
+ const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
208825
209057
  if (undefined !== areaFormatterSpec) {
208826
209058
  const formattedArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.area ? responseProps.area : 0, areaFormatterSpec);
208827
209059
  toolTipHtml += `${translateBold("Area") + formattedArea}<br>`;
208828
209060
  }
208829
209061
  if (responseProps.perimeter) {
208830
- const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
209062
+ const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208831
209063
  if (undefined !== perimeterFormatterSpec) {
208832
209064
  const formattedPerimeter = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.perimeter, perimeterFormatterSpec);
208833
209065
  toolTipHtml += `${translateBold("Perimeter") + formattedPerimeter}<br>`;
@@ -208836,13 +209068,13 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
208836
209068
  break;
208837
209069
  }
208838
209070
  case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateVolumes: {
208839
- const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.VOLUME", "Units.CUB_M");
209071
+ const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.VOLUME", "Units.CUB_M");
208840
209072
  if (undefined !== volumeFormatterSpec) {
208841
209073
  const formattedVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.volume ? responseProps.volume : 0, volumeFormatterSpec);
208842
209074
  toolTipHtml += `${translateBold("Volume") + formattedVolume}<br>`;
208843
209075
  }
208844
209076
  if (responseProps.area) {
208845
- const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.AREA", "Units.SQ_M");
209077
+ const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
208846
209078
  if (undefined !== areaFormatterSpec) {
208847
209079
  const formattedArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.area, areaFormatterSpec);
208848
209080
  toolTipHtml += `${translateBold("Area") + formattedArea}<br>`;
@@ -208852,7 +209084,7 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
208852
209084
  }
208853
209085
  }
208854
209086
  if (responseProps.centroid) {
208855
- const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
209087
+ const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208856
209088
  if (undefined !== coordFormatterSpec) {
208857
209089
  let pointAdjusted = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.fromJSON(responseProps.centroid);
208858
209090
  if (isSpatial) {
@@ -208903,21 +209135,21 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
208903
209135
  return;
208904
209136
  switch (operation) {
208905
209137
  case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateLengths:
208906
- const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.LENGTH", "Units.M");
209138
+ const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
208907
209139
  if (undefined === distanceFormatterSpec)
208908
209140
  return;
208909
209141
  const formattedTotalDistance = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._totalValue, distanceFormatterSpec);
208910
209142
  this._totalMarker = new MeasureLabel(labelPt, formattedTotalDistance);
208911
209143
  break;
208912
209144
  case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateAreas:
208913
- const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.AREA", "Units.SQ_M");
209145
+ const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
208914
209146
  if (undefined === areaFormatterSpec)
208915
209147
  return;
208916
209148
  const formattedTotalArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._totalValue, areaFormatterSpec);
208917
209149
  this._totalMarker = new MeasureLabel(labelPt, formattedTotalArea);
208918
209150
  break;
208919
209151
  case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateVolumes:
208920
- const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("AecUnits.VOLUME", "Units.CUB_M");
209152
+ const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.VOLUME", "Units.CUB_M");
208921
209153
  if (undefined === volumeFormatterSpec)
208922
209154
  return;
208923
209155
  const formattedTotalVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._totalValue, volumeFormatterSpec);
@@ -224158,7 +224390,7 @@ __webpack_require__.r(__webpack_exports__);
224158
224390
 
224159
224391
 
224160
224392
  /**
224161
- * CurveLocationDetail carries point and paramter data about a point evaluated on a curve.
224393
+ * CurveLocationDetail carries point and parameter data about a point evaluated on a curve.
224162
224394
  * * These are returned by a variety of queries.
224163
224395
  * * Particular contents can vary among the queries.
224164
224396
  * @public
@@ -245047,11 +245279,13 @@ __webpack_require__.r(__webpack_exports__);
245047
245279
  /* harmony import */ var _CurveChainWithDistanceIndex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../CurveChainWithDistanceIndex */ "../../core/geometry/lib/esm/curve/CurveChainWithDistanceIndex.js");
245048
245280
  /* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
245049
245281
  /* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
245282
+ /* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
245050
245283
  /* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
245051
245284
  /* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
245052
245285
  /* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
245053
245286
  /* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Path */ "../../core/geometry/lib/esm/curve/Path.js");
245054
245287
  /* harmony import */ var _ProxyCurve__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ProxyCurve */ "../../core/geometry/lib/esm/curve/ProxyCurve.js");
245288
+ /* harmony import */ var _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../spiral/TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
245055
245289
  /*---------------------------------------------------------------------------------------------
245056
245290
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
245057
245291
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -245078,6 +245312,8 @@ __webpack_require__.r(__webpack_exports__);
245078
245312
 
245079
245313
 
245080
245314
 
245315
+
245316
+
245081
245317
 
245082
245318
 
245083
245319
 
@@ -245777,7 +246013,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245777
246013
  return undefined;
245778
246014
  }
245779
246015
  /** Detail computation for linestring intersecting linestring. */
245780
- computeLineStringLineString(lsA, lsB, reversed) {
246016
+ computeLineStringLineString(lsA, extendA0, extendA1, lsB, extendB0, extendB1, reversed) {
245781
246017
  const pointA0 = CurveCurveIntersectXY._workPointAA0;
245782
246018
  const pointA1 = CurveCurveIntersectXY._workPointAA1;
245783
246019
  const pointB0 = CurveCurveIntersectXY._workPointBB0;
@@ -245801,7 +246037,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245801
246037
  for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
245802
246038
  lsB.pointAt(ib, pointB1);
245803
246039
  fB1 = ib * dfB;
245804
- 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);
246040
+ 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);
245805
246041
  }
245806
246042
  }
245807
246043
  }
@@ -245900,6 +246136,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245900
246136
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
245901
246137
  this.dispatchSegmentBsplineCurve(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
245902
246138
  }
246139
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246140
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246141
+ this._geometryB.emitStrokes(spiralApproximation);
246142
+ const numPreviousResults = this._results.length;
246143
+ this.computeSegmentLineString(segmentA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
246144
+ const numberOfNewResults = this._results.length - numPreviousResults;
246145
+ this.refineSpiralResultsByNewton(segmentA, this._geometryB, numberOfNewResults);
246146
+ }
245903
246147
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245904
246148
  this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
245905
246149
  }
@@ -245912,7 +246156,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245912
246156
  handleLineString3d(lsA) {
245913
246157
  if (this._geometryB instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d) {
245914
246158
  const lsB = this._geometryB;
245915
- this.computeLineStringLineString(lsA, lsB, false);
246159
+ this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, lsB, this._extendB0, this._extendB1, false);
245916
246160
  }
245917
246161
  else if (this._geometryB instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__.LineSegment3d) {
245918
246162
  this.computeSegmentLineString(this._geometryB, this._extendB0, this._extendB1, lsA, this._extendA0, this._extendA1, true);
@@ -245923,6 +246167,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245923
246167
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
245924
246168
  this.dispatchLineStringBSplineCurve(lsA, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
245925
246169
  }
246170
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246171
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246172
+ this._geometryB.emitStrokes(spiralApproximation);
246173
+ const numPreviousResults = this._results.length;
246174
+ this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
246175
+ const numberOfNewResults = this._results.length - numPreviousResults;
246176
+ this.refineSpiralResultsByNewton(lsA, this._geometryB, numberOfNewResults);
246177
+ }
245926
246178
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245927
246179
  this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
245928
246180
  }
@@ -245945,6 +246197,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245945
246197
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
245946
246198
  this.dispatchArcBsplineCurve3d(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
245947
246199
  }
246200
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246201
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246202
+ this._geometryB.emitStrokes(spiralApproximation);
246203
+ const numPreviousResults = this._results.length;
246204
+ this.computeArcLineString(arc0, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
246205
+ const numberOfNewResults = this._results.length - numPreviousResults;
246206
+ this.refineSpiralResultsByNewton(arc0, this._geometryB, numberOfNewResults);
246207
+ }
245948
246208
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245949
246209
  this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
245950
246210
  }
@@ -245967,6 +246227,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245967
246227
  else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3dBase) {
245968
246228
  this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
245969
246229
  }
246230
+ else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
246231
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246232
+ this._geometryB.emitStrokes(spiralApproximation);
246233
+ const numPreviousResults = this._results.length;
246234
+ this.dispatchLineStringBSplineCurve(spiralApproximation, false, false, curve, this._extendA0, this._extendA1, true);
246235
+ const numberOfNewResults = this._results.length - numPreviousResults;
246236
+ this.refineSpiralResultsByNewton(curve, this._geometryB, numberOfNewResults);
246237
+ }
245970
246238
  else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
245971
246239
  this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));
245972
246240
  }
@@ -245975,6 +246243,47 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
245975
246243
  }
245976
246244
  return undefined;
245977
246245
  }
246246
+ /**
246247
+ * Assuming the tail of `this._results` holds the given number of approximate solutions to the curve-spiral
246248
+ * xy-intersection problem, replace each with its Newton refinement, unless it doesn't converge, in which case
246249
+ * it is removed.
246250
+ * @param spiral The transition spiral.
246251
+ * @param otherCurve The other curve primitive.
246252
+ * @param numberOfNewResults The number of results in the tail of `this._results` to be refined.
246253
+ * @param reversed Whether the spiral is geometryA (true) or geometryB (false).
246254
+ */
246255
+ refineSpiralResultsByNewton(otherCurve, spiral, numberOfNewResults, reversed = false) {
246256
+ const resultsToBeRefined = this._results.slice(this._results.length - numberOfNewResults);
246257
+ this._results.length -= numberOfNewResults; // keep already refined results
246258
+ for (const detail of resultsToBeRefined) {
246259
+ let spiralFraction = reversed ? detail.detailA.fraction : detail.detailB.fraction;
246260
+ let otherFraction = reversed ? detail.detailB.fraction : detail.detailA.fraction;
246261
+ const xyMatchingFunction = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.CurveCurveIntersectionXYRRToRRD(spiral, otherCurve);
246262
+ const newtonSearcher = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.Newton2dUnboundedWithDerivative(xyMatchingFunction);
246263
+ newtonSearcher.setUV(spiralFraction, otherFraction);
246264
+ if (newtonSearcher.runIterations()) {
246265
+ spiralFraction = newtonSearcher.getU();
246266
+ otherFraction = newtonSearcher.getV();
246267
+ if (this.acceptFraction(false, spiralFraction, false) && this.acceptFraction(false, otherFraction, false))
246268
+ this.recordPointWithLocalFractions(otherFraction, otherCurve, 0, 1, spiralFraction, spiral, 0, 1, reversed);
246269
+ }
246270
+ }
246271
+ }
246272
+ /** Double dispatch handler for strongly typed spiral curve. */
246273
+ handleTransitionSpiral(spiral) {
246274
+ if (this._geometryB instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__.CurvePrimitive) { // this also handles CurveChainWithDistanceIndex
246275
+ const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
246276
+ spiral.emitStrokes(spiralApproximation);
246277
+ const numPreviousResults = this._results.length;
246278
+ this.handleLineString3d(spiralApproximation);
246279
+ const numberOfNewResults = this._results.length - numPreviousResults;
246280
+ this.refineSpiralResultsByNewton(this._geometryB, spiral, numberOfNewResults, true);
246281
+ }
246282
+ else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
246283
+ this.dispatchCurveCollection(spiral, this.handleTransitionSpiral.bind(this));
246284
+ }
246285
+ return undefined;
246286
+ }
245978
246287
  /** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */
245979
246288
  handleCurveChainWithDistanceIndex(chain) {
245980
246289
  super.handleCurveChainWithDistanceIndex(chain);
@@ -249664,7 +249973,7 @@ class AustralianRailCorpXYEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MO
249664
249973
  * * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
249665
249974
  * an x coordinate.
249666
249975
  * * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
249667
- * this.fractionToX (fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
249976
+ * this.fractionToX(fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
249668
249977
  * * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
249669
249978
  * * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
249670
249979
  * more accurate CurvePrimitive measurements.
@@ -249715,8 +250024,8 @@ __webpack_require__.r(__webpack_exports__);
249715
250024
  * Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.
249716
250025
  * Each instance has:
249717
250026
  * * number of x and y terms to use.
249718
- * * constant for theta = c*x*x.
249719
- * * This value is c = 1/(2*R*L) for curve length L measured from inflection to point with radius R.
250027
+ * * constant for theta = cxx.
250028
+ * * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.
249720
250029
  * @internal
249721
250030
  */
249722
250031
  class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODULE_0__.XYCurveEvaluator {
@@ -249724,7 +250033,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249724
250033
  numXTerms;
249725
250034
  /** Number of terms to use in y Taylor series. */
249726
250035
  numYTerms;
249727
- /** Constant c = 1/(2*R*L) in theta = c*s*s. */
250036
+ /** Constant c = 1/2RL in theta = cxx. */
249728
250037
  constantDiv2LR;
249729
250038
  /** The nominal curve length. */
249730
250039
  nominalLength1;
@@ -249801,10 +250110,12 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249801
250110
  * @param numTerms number of terms to use.
249802
250111
  */
249803
250112
  fractionToXGo(fraction, numTerms) {
249804
- // write the Taylor series for cos(theta)
249805
- // replace theta by s*s*c
249806
- // integrate wrt s
249807
- // x = s - s^5 c^2/ 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
250113
+ // write the Taylor series for cos(theta):
250114
+ // 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...
250115
+ // replace theta by s*s*c:
250116
+ // 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...
250117
+ // integrate wrt s:
250118
+ // x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
249808
250119
  // x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )
249809
250120
  const s = fraction * this.nominalLength1;
249810
250121
  let result = s;
@@ -249824,9 +250135,11 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249824
250135
  return result;
249825
250136
  }
249826
250137
  fractionToYGo(fraction, numTerms) {
249827
- // write the Taylor series for sin(theta)
249828
- // replace theta by s*s*c
249829
- // integrate wrt s
250138
+ // write the Taylor series for sin(theta):
250139
+ // theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...
250140
+ // replace theta by s*s*c:
250141
+ // s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...
250142
+ // integrate wrt s:
249830
250143
  // y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...
249831
250144
  // y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )
249832
250145
  const s = fraction * this.nominalLength1;
@@ -249874,7 +250187,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
249874
250187
  // dY = q - q^3/3!
249875
250188
  // q = s^2 c
249876
250189
  // dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!
249877
- // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
250190
+ // recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
249878
250191
  const s = fraction * this.nominalLength1;
249879
250192
  const q1 = s * s * this.constantDiv2LR;
249880
250193
  let result = q1;
@@ -250096,7 +250409,7 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
250096
250409
  static gammaConstant(length1, radius1) {
250097
250410
  return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);
250098
250411
  }
250099
- /** Compute the czech cubic constant. */
250412
+ /** Compute the Czech cubic constant. */
250100
250413
  static computeCubicM(length1, radius1) {
250101
250414
  const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);
250102
250415
  // in the private update method, the LR values should have been vetted
@@ -250189,17 +250502,9 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
250189
250502
  class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.CubicEvaluator {
250190
250503
  nominalLength1;
250191
250504
  nominalRadius1;
250192
- /**
250193
- * Compute the czech cubic constant.
250194
- * * Funky mixture of lengths.
250195
- */
250505
+ /** Compute the Italian cubic constant. */
250196
250506
  static computeCubicM(lengthXByForward, radius1) {
250197
- const gamma = CzechSpiralEvaluator.gammaConstant(lengthXByForward, radius1);
250198
- // in the private update method, the LR values should have been vetted
250199
- if (gamma === undefined)
250200
- return undefined;
250201
- // if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
250202
- return gamma / Math.abs((6.0 * radius1 * lengthXByForward));
250507
+ return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);
250203
250508
  }
250204
250509
  /** Constructor is private. Caller responsible for cubicM validity. */
250205
250510
  constructor(length1, radius1, lengthX, cubicM) {
@@ -250208,7 +250513,7 @@ class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0_
250208
250513
  this.nominalRadius1 = radius1;
250209
250514
  }
250210
250515
  static create(length1, radius1) {
250211
- // this seems goofy.; lengthX from forward, then invert for another but that's what the native code does too
250516
+ // this seems goofy; lengthX from forward, then invert for another but that's what the native code does too
250212
250517
  const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);
250213
250518
  const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);
250214
250519
  if (lengthX1 === undefined)
@@ -250424,18 +250729,20 @@ __webpack_require__.r(__webpack_exports__);
250424
250729
  * DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
250425
250730
  * "direct" xy calculations without the integrations required for IntegratedSpiral3d.
250426
250731
  * * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
250427
- * * Direct spirals that flow through serialization to native imodel02 are created with these static methods:
250732
+ * * Direct spirals are created with these static methods:
250428
250733
  * * createArema
250429
250734
  * * createJapaneseCubic
250430
- * * createAustralianRail
250431
- * * createDirectHalfCosine
250432
250735
  * * createChineseCubic
250736
+ * * createWesternAustralian
250737
+ * * createDirectHalfCosine
250738
+ * * createAustralianRail
250433
250739
  * * createCzechCubic
250434
250740
  * * createPolishCubic
250741
+ * * createMXCubicAlongArc
250435
250742
  * * createItalian
250436
- * * createWesternAustralian
250437
250743
  * @public
250438
250744
  */
250745
+ // see internaldocs/Spiral.md for more info
250439
250746
  class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
250440
250747
  /** String name for schema properties. */
250441
250748
  curvePrimitiveType = "transitionSpiral";
@@ -250591,11 +250898,11 @@ class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.Tr
250591
250898
  /**
250592
250899
  * Create an MX Cubic whose nominal length is close to along the curve.
250593
250900
  * This is y = m*x^3 with
250594
- * * m is 1/(6RL1).
250901
+ * * m is 1/(6RL).
250595
250902
  * * 1/(6RL) is the leading term of the sine series.
250596
250903
  * * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
250597
250904
  * * x is axis position that is slightly LESS than nominal distance along.
250598
- * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 R R L L))
250905
+ * * L1, x use the approximation `x = s * ( 1 - s^4/ (40 RR LL))
250599
250906
  * @param localToWorld
250600
250907
  * @param nominalL1
250601
250908
  * @param nominalR1
@@ -250956,6 +251263,7 @@ __webpack_require__.r(__webpack_exports__);
250956
251263
  * * [[TransitionConditionalProperties]] implements the computations of the interrelationship of radii, bearing, and length.
250957
251264
  * @public
250958
251265
  */
251266
+ // see internaldocs/Spiral.md for more info
250959
251267
  class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
250960
251268
  /** String name for schema properties. */
250961
251269
  curvePrimitiveType = "transitionSpiral";
@@ -250999,11 +251307,13 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
250999
251307
  static defaultSpiralType = "clothoid";
251000
251308
  /** Use the integrated function to return an angle at fractional position. */
251001
251309
  globalFractionToBearingRadians(fraction) {
251310
+ // calculate area under curvature curve from 0 to fraction and add it to start angle to get angle at the given fraction
251311
+ // see internaldocs/Spiral.md for more info
251002
251312
  const areaFraction = this._evaluator.fractionToArea(fraction);
251003
- const dx = this._arcLength01;
251313
+ const arcLength = this._arcLength01;
251004
251314
  return this.bearing01.startRadians
251005
- + areaFraction * dx * this._curvature01.signedDelta()
251006
- + fraction * this._curvature01.x0 * dx;
251315
+ + fraction * arcLength * this._curvature01.x0
251316
+ + areaFraction * arcLength * this._curvature01.signedDelta();
251007
251317
  }
251008
251318
  /** Use the integrated function to return an angle at fractional position. */
251009
251319
  globalFractionToCurvature(fraction) {
@@ -251042,9 +251352,10 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
251042
251352
  * @param xyz advancing integrated point.
251043
251353
  * @param fractionA fraction at start of interval.
251044
251354
  * @param fractionB fraction at end of interval.
251045
- * @param unitArcLength length of curve for 0 to 1 fractional.
251355
+ * @param applyMatrix if true, apply the localToWorld matrix to the computed delta before adding to xyz.
251046
251356
  */
251047
251357
  fullSpiralIncrementalIntegral(xyz, fractionA, fractionB, applyMatrix) {
251358
+ // see internaldocs/Spiral.md for more info
251048
251359
  const gaussFraction = IntegratedSpiral3d._gaussFraction;
251049
251360
  const gaussWeight = IntegratedSpiral3d._gaussWeight;
251050
251361
  const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);
@@ -251094,7 +251405,7 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
251094
251405
  /**
251095
251406
  * Create a transition spiral with radius and bearing conditions.
251096
251407
  * @param radius01 radius (inverse curvature) at start and end (radius of zero means straight line).
251097
- * @param bearing01 bearing angles at start and end. bearings are measured from the x axis, positive clockwise
251408
+ * @param bearing01 bearing angles at start and end. Bearings are measured from the x axis, positive clockwise
251098
251409
  * towards y axis.
251099
251410
  * @param activeFractionInterval fractional limits of the active portion of the spiral.
251100
251411
  * @param localToWorld placement frame. Fractional coordinate 0 is at the origin.
@@ -251474,10 +251785,12 @@ __webpack_require__.r(__webpack_exports__);
251474
251785
  * * Each implementation provides:
251475
251786
  * * fractionToCurvature -- the f(u) function described above
251476
251787
  * * fractionToCurvatureDerivative -- df(u)/du
251477
- * * fractionToArea -- integral of the area under f(u) from 0 to u.
251478
- * * The symmetry condition ensures that the integral from 0 to 1 is 1/2.
251788
+ * * fractionToArea -- antiderivative A of f, chosen such that A(0) = 0. The value of this function at
251789
+ * fraction u is the area under f from 0 to u. In particular, the symmetry condition on f implies that
251790
+ * 1/2 = "integral of f over [0,1]" = A(1) - A(0) = A(1).
251479
251791
  * @internal
251480
251792
  */
251793
+ // see internaldocs/Spiral.md for more info
251481
251794
  class NormalizedTransition {
251482
251795
  /** Constructor initializes with 0..1 values. Call "setBearingCurvatureLengthCurvature" to apply real values. */
251483
251796
  constructor() { }
@@ -251514,10 +251827,13 @@ class NormalizedTransition {
251514
251827
  }
251515
251828
  /**
251516
251829
  * Transition functions for clothoid spiral.
251517
- * * curvature variation is linear from (0,0) to (1,1)
251830
+ * * Curvature variation is linear from (0,0) to (1,1).
251518
251831
  * @internal
251519
251832
  */
251520
251833
  class NormalizedClothoidTransition extends NormalizedTransition {
251834
+ // clothoid curvature is f(x) = x
251835
+ // derivative f'(x) = 1
251836
+ // integral If(x) = x^2 / 2
251521
251837
  constructor() {
251522
251838
  super();
251523
251839
  }
@@ -251543,13 +251859,12 @@ class NormalizedClothoidTransition extends NormalizedTransition {
251543
251859
  * @internal
251544
251860
  */
251545
251861
  class NormalizedBlossTransition extends NormalizedTransition {
251546
- // bloss curve is (3 - 2x) x ^2 = 3 x^2 - 2 x^3
251862
+ // bloss curvature is x^2 (3 - 2x)
251547
251863
  // derivative 6x (1-x)
251548
- // 2nd derivative 6 - 12 x
251549
- // derivatives zero at 0,1
251550
- // inflection zero at 0.5
251551
- // integral is x^3 - x^4 / 2 = x^3 (1-x/2)
251552
- constructor() { super(); }
251864
+ // integral is x^3 (1-x/2)
251865
+ constructor() {
251866
+ super();
251867
+ }
251553
251868
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
251554
251869
  fractionToCurvatureFraction(u) {
251555
251870
  return u * u * (3 - 2 * u);
@@ -251588,17 +251903,17 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
251588
251903
  }
251589
251904
  /**
251590
251905
  * At fractional position on the x axis, return the (normalized) curvature fraction.
251591
- * * For [u <= 0.5, u >= 0.5]
251592
- * * f(u) = [2 u^2, 1 - 2 (1-u)^2]
251593
- * * f'(u) = [4 u, 4 (1-u)]
251594
- * * If(u) = [2 u^3 / 3, 0.5 (1 -u )^3/3]
251906
+ * * For [u <= 0.5, u > 0.5]
251907
+ * * f(u) = [2u^2, 1 - 2(1-u)^2]
251908
+ * * f'(u) = [4u, 4(1-u)]
251909
+ * * If(u) = [2u^3 / 3, u + 2(1-u)^3 /3]
251595
251910
  */
251596
251911
  fractionToCurvatureFraction(u) {
251597
251912
  return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);
251598
251913
  }
251599
251914
  /** Return the derivative of the (normalized) curvature fraction. */
251600
251915
  fractionToCurvatureFractionDerivative(u) {
251601
- return u < 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
251916
+ return u <= 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
251602
251917
  }
251603
251918
  /**
251604
251919
  * Return the integrated area under the curve.
@@ -251607,6 +251922,7 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
251607
251922
  fractionToArea(u) {
251608
251923
  if (u <= 0.5)
251609
251924
  return this.integratedBasis(u);
251925
+ // 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"
251610
251926
  const v = 1 - u;
251611
251927
  return 0.5 - v + this.integratedBasis(v);
251612
251928
  }
@@ -251619,7 +251935,13 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
251619
251935
  * @internal
251620
251936
  */
251621
251937
  class NormalizedSineTransition extends NormalizedTransition {
251622
- constructor() { super(); }
251938
+ // sine transition curvature is x - sin(2 pi x) / (2 pi)
251939
+ // derivative 1 - cos(2 pi x)
251940
+ // integral x^2 / 2 + (cos(2 pi x) - 1) / (4 pi^2)
251941
+ // note: this is the only snap function whose antiderivative is chosen with nonzero integration constant.
251942
+ constructor() {
251943
+ super();
251944
+ }
251623
251945
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
251624
251946
  fractionToCurvatureFraction(u) {
251625
251947
  const a = 2.0 * Math.PI;
@@ -251645,7 +251967,12 @@ class NormalizedSineTransition extends NormalizedTransition {
251645
251967
  * @internal
251646
251968
  */
251647
251969
  class NormalizedCosineTransition extends NormalizedTransition {
251648
- constructor() { super(); }
251970
+ // cosine transition curvature is 0.5 (1 - cos(pi x))
251971
+ // derivative 0.5 pi sin(pi x)
251972
+ // integral 0.5 (x - sin(pi x) / pi)
251973
+ constructor() {
251974
+ super();
251975
+ }
251649
251976
  /** At fractional position on the x axis, return the (normalized) curvature fraction. */
251650
251977
  fractionToCurvatureFraction(u) {
251651
251978
  const a = Math.PI;
@@ -251831,6 +252158,7 @@ __webpack_require__.r(__webpack_exports__);
251831
252158
  * determines the remaining one.
251832
252159
  * @public
251833
252160
  */
252161
+ // see internaldocs/Spiral.md for more info
251834
252162
  class TransitionConditionalProperties {
251835
252163
  /**
251836
252164
  * Radius at start (radius of the osculating circle at the spiral segment's start).
@@ -252026,6 +252354,7 @@ __webpack_require__.r(__webpack_exports__);
252026
252354
  * * This is not necessary for integrated spirals.
252027
252355
  * @public
252028
252356
  */
252357
+ // see internaldocs/Spiral.md for more info
252029
252358
  class TransitionSpiral3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePrimitive {
252030
252359
  /** String name of spiral type. */
252031
252360
  _spiralType;
@@ -272125,8 +272454,7 @@ class Ray3d {
272125
272454
  return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);
272126
272455
  }
272127
272456
  /**
272128
- * Return the dot product of the ray's direction vector with a vector from the ray origin
272129
- * to the `spacePoint`.
272457
+ * Return the dot product of the ray's direction vector with a vector from the ray origin to the `spacePoint`.
272130
272458
  * * If the instance is the unit normal of a plane, then this method returns the (signed) altitude
272131
272459
  * of `spacePoint` with respect to the plane.
272132
272460
  * * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
@@ -279110,7 +279438,7 @@ class NewtonEvaluatorRtoRD {
279110
279438
  /**
279111
279439
  * Newton iterator for use when both function and derivative can be evaluated.
279112
279440
  * To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.
279113
- * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
279441
+ * To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
279114
279442
  * `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.
279115
279443
  * @internal
279116
279444
  */
@@ -336119,7 +336447,25 @@ class Formatter {
336119
336447
  return { componentText: "", isNegative: false };
336120
336448
  }
336121
336449
  if (i < (spec.format.units?.length ?? 0) - 1) {
336122
- const wholePart = Math.trunc(unitValue);
336450
+ let wholePart = Math.trunc(unitValue);
336451
+ // Check if the remaining fractional part will round up to a full unit in the next (smaller) component
336452
+ if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Fractional && i === spec.unitConversions.length - 2) {
336453
+ // For the second-to-last unit with fractional formatting, check if rounding causes carry-over
336454
+ const fractionalPart = unitValue - wholePart;
336455
+ const nextUnitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(fractionalPart, spec.unitConversions[i + 1].conversion);
336456
+ // Create a FractionalNumeric to determine what the rounded value would be
336457
+ const fn = new FractionalNumeric(Math.abs(nextUnitValue), spec.format.precision, true);
336458
+ // If the fractional numeric rounds to a whole unit (integral part increased due to rounding)
336459
+ // and the next unit value would round to equal the conversion factor, we need to carry it over
336460
+ const roundedNextValue = parseFloat(fn.getIntegralString());
336461
+ const expectedNextValue = Math.floor(Math.abs(nextUnitValue));
336462
+ // Check if rounding caused the value to reach the conversion factor (1 full unit of the parent)
336463
+ const conversionFactor = spec.unitConversions[i + 1].conversion.factor;
336464
+ if (roundedNextValue > expectedNextValue && Math.abs(roundedNextValue - conversionFactor) < this.FPV_MINTHRESHOLD) {
336465
+ // The rounding caused a carry-over to a full parent unit, add 1 to the current unit's whole part
336466
+ wholePart += (unitValue >= 0 ? 1 : -1);
336467
+ }
336468
+ }
336123
336469
  const componentText = Formatter.formatCompositePart(Math.abs(wholePart), false, currentLabel, spec);
336124
336470
  remainingMagnitude = unitValue - wholePart;
336125
336471
  compositeStrings.push(componentText);
@@ -338865,7 +339211,7 @@ class TestContext {
338865
339211
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
338866
339212
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${process.env.IMJS_URL_PREFIX ?? ""}api.bentley.com/imodels` } });
338867
339213
  await core_frontend_1.NoRenderApp.startup({
338868
- applicationVersion: "5.4.0-dev.7",
339214
+ applicationVersion: "5.5.0-dev.2",
338869
339215
  applicationId: this.settings.gprid,
338870
339216
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.serviceAuthToken),
338871
339217
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),
@@ -344169,7 +344515,7 @@ var CoreSelectionSetEventType;
344169
344515
  * See LICENSE.md in the project root for license terms and full copyright notice.
344170
344516
  *--------------------------------------------------------------------------------------------*/
344171
344517
  Object.defineProperty(exports, "__esModule", ({ value: true }));
344172
- 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;
344518
+ 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;
344173
344519
  // WARNING: This barrel file exports internal APIs only for use by `@itwin/presentation-backend` and `@itwin/presentation-frontend` packages.
344174
344520
  // They should not be used outside of these packages. These APIs may be broken or removed at any time without notice.
344175
344521
  var PresentationIpcInterface_js_1 = __webpack_require__(/*! ./presentation-common/PresentationIpcInterface.js */ "../../presentation/common/lib/cjs/presentation-common/PresentationIpcInterface.js");
@@ -344179,7 +344525,7 @@ var Diagnostics_js_1 = __webpack_require__(/*! ./presentation-common/Diagnostics
344179
344525
  Object.defineProperty(exports, "combineDiagnosticsSeverities", ({ enumerable: true, get: function () { return Diagnostics_js_1.combineDiagnosticsSeverities; } }));
344180
344526
  Object.defineProperty(exports, "compareDiagnosticsSeverities", ({ enumerable: true, get: function () { return Diagnostics_js_1.compareDiagnosticsSeverities; } }));
344181
344527
  var ElementProperties_js_1 = __webpack_require__(/*! ./presentation-common/ElementProperties.js */ "../../presentation/common/lib/cjs/presentation-common/ElementProperties.js");
344182
- Object.defineProperty(exports, "buildElementProperties", ({ enumerable: true, get: function () { return ElementProperties_js_1.buildElementProperties; } }));
344528
+ Object.defineProperty(exports, "createElementPropertiesBuilder", ({ enumerable: true, get: function () { return ElementProperties_js_1.createElementPropertiesBuilder; } }));
344183
344529
  var Utils_js_1 = __webpack_require__(/*! ./presentation-common/Utils.js */ "../../presentation/common/lib/cjs/presentation-common/Utils.js");
344184
344530
  Object.defineProperty(exports, "createCancellableTimeoutPromise", ({ enumerable: true, get: function () { return Utils_js_1.createCancellableTimeoutPromise; } }));
344185
344531
  Object.defineProperty(exports, "deepReplaceNullsToUndefined", ({ enumerable: true, get: function () { return Utils_js_1.deepReplaceNullsToUndefined; } }));
@@ -344218,7 +344564,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
344218
344564
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
344219
344565
  };
344220
344566
  Object.defineProperty(exports, "__esModule", ({ value: true }));
344221
- 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;
344567
+ 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;
344568
+ exports.NodeKey = void 0;
344222
344569
  /*---------------------------------------------------------------------------------------------
344223
344570
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
344224
344571
  * See LICENSE.md in the project root for license terms and full copyright notice.
@@ -344307,6 +344654,7 @@ var ContentTraverser_js_1 = __webpack_require__(/*! ./presentation-common/conten
344307
344654
  Object.defineProperty(exports, "traverseFieldHierarchy", ({ enumerable: true, get: function () { return ContentTraverser_js_1.traverseFieldHierarchy; } }));
344308
344655
  Object.defineProperty(exports, "traverseContent", ({ enumerable: true, get: function () { return ContentTraverser_js_1.traverseContent; } }));
344309
344656
  Object.defineProperty(exports, "traverseContentItem", ({ enumerable: true, get: function () { return ContentTraverser_js_1.traverseContentItem; } }));
344657
+ Object.defineProperty(exports, "createContentTraverser", ({ enumerable: true, get: function () { return ContentTraverser_js_1.createContentTraverser; } }));
344310
344658
  Object.defineProperty(exports, "createFieldHierarchies", ({ enumerable: true, get: function () { return ContentTraverser_js_1.createFieldHierarchies; } }));
344311
344659
  Object.defineProperty(exports, "addFieldHierarchy", ({ enumerable: true, get: function () { return ContentTraverser_js_1.addFieldHierarchy; } }));
344312
344660
  Object.defineProperty(exports, "combineFieldNames", ({ enumerable: true, get: function () { return ContentTraverser_js_1.combineFieldNames; } }));
@@ -344772,17 +345120,20 @@ var RelationshipPath;
344772
345120
  * @module RPC
344773
345121
  */
344774
345122
  Object.defineProperty(exports, "__esModule", ({ value: true }));
344775
- exports.buildElementProperties = void 0;
345123
+ exports.createElementPropertiesBuilder = void 0;
344776
345124
  const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
344777
345125
  const ContentTraverser_js_1 = __webpack_require__(/*! ./content/ContentTraverser.js */ "../../presentation/common/lib/cjs/presentation-common/content/ContentTraverser.js");
344778
345126
  const TypeDescription_js_1 = __webpack_require__(/*! ./content/TypeDescription.js */ "../../presentation/common/lib/cjs/presentation-common/content/TypeDescription.js");
344779
345127
  /** @internal */
344780
- const buildElementProperties = (descriptor, item) => {
345128
+ const createElementPropertiesBuilder = () => {
344781
345129
  const builder = new ElementPropertiesBuilder();
344782
- (0, ContentTraverser_js_1.traverseContentItem)(builder, descriptor, item);
344783
- return builder.items[0];
345130
+ const traverseContent = (0, ContentTraverser_js_1.createContentTraverser)(builder);
345131
+ return (descriptor, item) => {
345132
+ traverseContent(descriptor, [item]);
345133
+ return builder.items[0];
345134
+ };
344784
345135
  };
344785
- exports.buildElementProperties = buildElementProperties;
345136
+ exports.createElementPropertiesBuilder = createElementPropertiesBuilder;
344786
345137
  class ElementPropertiesAppender {
344787
345138
  _item;
344788
345139
  _onItemFinished;
@@ -344913,6 +345264,9 @@ class ElementPropertiesBuilder {
344913
345264
  return appender;
344914
345265
  }
344915
345266
  startContent(_props) {
345267
+ this._appendersStack = [];
345268
+ this._items = [];
345269
+ this._elementPropertiesAppender = undefined;
344916
345270
  return true;
344917
345271
  }
344918
345272
  finishContent() { }
@@ -346990,12 +347344,12 @@ exports.FIELD_NAMES_SEPARATOR = void 0;
346990
347344
  exports.traverseFieldHierarchy = traverseFieldHierarchy;
346991
347345
  exports.traverseContent = traverseContent;
346992
347346
  exports.traverseContentItem = traverseContentItem;
347347
+ exports.createContentTraverser = createContentTraverser;
346993
347348
  exports.createFieldHierarchies = createFieldHierarchies;
346994
347349
  exports.addFieldHierarchy = addFieldHierarchy;
346995
347350
  exports.combineFieldNames = combineFieldNames;
346996
347351
  exports.parseCombinedFieldNames = parseCombinedFieldNames;
346997
347352
  const core_bentley_1 = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
346998
- const Content_js_1 = __webpack_require__(/*! ./Content.js */ "../../presentation/common/lib/cjs/presentation-common/content/Content.js");
346999
347353
  const Fields_js_1 = __webpack_require__(/*! ./Fields.js */ "../../presentation/common/lib/cjs/presentation-common/content/Fields.js");
347000
347354
  const Item_js_1 = __webpack_require__(/*! ./Item.js */ "../../presentation/common/lib/cjs/presentation-common/content/Item.js");
347001
347355
  const TypeDescription_js_1 = __webpack_require__(/*! ./TypeDescription.js */ "../../presentation/common/lib/cjs/presentation-common/content/TypeDescription.js");
@@ -347010,32 +347364,46 @@ function traverseFieldHierarchy(hierarchy, cb) {
347010
347364
  hierarchy.childFields.forEach((childHierarchy) => traverseFieldHierarchy(childHierarchy, cb));
347011
347365
  }
347012
347366
  }
347367
+ /* c8 ignore start */
347013
347368
  /**
347014
347369
  * An utility to traverse content using provided visitor. Provides means to parse content into different formats,
347015
347370
  * for different components.
347016
347371
  * @public
347372
+ * @deprecated in 5.4. Use [[createContentTraverser]] instead.
347017
347373
  */
347018
347374
  function traverseContent(visitor, content) {
347019
- if (!visitor.startContent({ descriptor: content.descriptor })) {
347020
- return;
347021
- }
347022
- try {
347023
- const fieldHierarchies = createFieldHierarchies(content.descriptor.fields);
347024
- visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });
347025
- content.contentSet.forEach((item) => {
347026
- traverseContentItemFields(visitor, fieldHierarchies, item);
347027
- });
347028
- }
347029
- finally {
347030
- visitor.finishContent();
347031
- }
347375
+ return createContentTraverser(visitor, content.descriptor)(content.contentSet);
347032
347376
  }
347033
347377
  /**
347034
347378
  * An utility for calling [[traverseContent]] when there's only one content item.
347035
347379
  * @public
347380
+ * @deprecated in 5.4. Use [[createContentTraverser]] instead.
347036
347381
  */
347037
347382
  function traverseContentItem(visitor, descriptor, item) {
347038
- traverseContent(visitor, new Content_js_1.Content(descriptor, [item]));
347383
+ return createContentTraverser(visitor, descriptor)([item]);
347384
+ }
347385
+ /** @public */
347386
+ function createContentTraverser(visitor, descriptorArg) {
347387
+ let memo;
347388
+ const traverseContentItems = (descriptor, items) => {
347389
+ if (!visitor.startContent({ descriptor })) {
347390
+ return;
347391
+ }
347392
+ try {
347393
+ if (memo?.descriptor !== descriptor) {
347394
+ const fieldHierarchies = createFieldHierarchies(descriptor.fields);
347395
+ visitor.processFieldHierarchies({ hierarchies: fieldHierarchies });
347396
+ memo = { descriptor, fieldHierarchies };
347397
+ }
347398
+ items.forEach((item) => {
347399
+ traverseContentItemFields(visitor, memo.fieldHierarchies, item);
347400
+ });
347401
+ }
347402
+ finally {
347403
+ visitor.finishContent();
347404
+ }
347405
+ };
347406
+ return descriptorArg ? (items) => traverseContentItems(descriptorArg, items) : traverseContentItems;
347039
347407
  }
347040
347408
  class VisitedCategories {
347041
347409
  _visitor;
@@ -351108,7 +351476,7 @@ class PresentationManager {
351108
351476
  async getElementProperties(requestOptions) {
351109
351477
  (0, IModelConnectionInitialization_js_1.startIModelInitialization)(requestOptions.imodel);
351110
351478
  const { elementId, contentParser, ...optionsNoElementId } = requestOptions;
351111
- const parser = contentParser ?? internal_1.buildElementProperties;
351479
+ const parser = contentParser ?? (0, internal_1.createElementPropertiesBuilder)();
351112
351480
  const iter = await this.getContentIterator({
351113
351481
  ...optionsNoElementId,
351114
351482
  descriptor: {
@@ -364138,7 +364506,7 @@ var loadLanguages = instance.loadLanguages;
364138
364506
  /***/ ((module) => {
364139
364507
 
364140
364508
  "use strict";
364141
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.4.0-dev.7","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"}}');
364509
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.5.0-dev.2","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.5.0","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"}}');
364142
364510
 
364143
364511
  /***/ }),
364144
364512