@itwin/rpcinterface-full-stack-tests 3.2.0-dev.41 → 3.2.0-dev.42

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.
@@ -70352,6 +70352,8 @@ class IModelReadRpcInterface extends _RpcInterface__WEBPACK_IMPORTED_MODULE_0__[
70352
70352
  /** @deprecated */
70353
70353
  async getViewThumbnail(_iModelToken, _viewId) { return this.forward(arguments); }
70354
70354
  async getDefaultViewId(_iModelToken) { return this.forward(arguments); }
70355
+ async getCustomViewState3dData(_iModelToken, _options) { return this.forward(arguments); }
70356
+ async hydrateViewState(_iModelToken, _options) { return this.forward(arguments); }
70355
70357
  async requestSnap(_iModelToken, _sessionId, _props) { return this.forward(arguments); }
70356
70358
  async cancelSnap(_iModelToken, _sessionId) { return this.forward(arguments); }
70357
70359
  async getGeometryContainment(_iModelToken, _props) { return this.forward(arguments); }
@@ -73803,7 +73805,7 @@ class WebAppRpcRequest extends _core_RpcRequest__WEBPACK_IMPORTED_MODULE_4__["Rp
73803
73805
  /** The maximum size permitted for an encoded component in a URL.
73804
73806
  * @note This is used for features like encoding the payload of a cacheable request in the URL.
73805
73807
  */
73806
- WebAppRpcRequest.maxUrlComponentSize = 1024;
73808
+ WebAppRpcRequest.maxUrlComponentSize = 4096;
73807
73809
 
73808
73810
  /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../../common/temp/node_modules/.pnpm/buffer@4.9.2/node_modules/buffer/index.js */ "../../common/temp/node_modules/.pnpm/buffer@4.9.2/node_modules/buffer/index.js").Buffer))
73809
73811
 
@@ -82322,6 +82324,21 @@ class SectionAttachmentInfo {
82322
82324
  clone() {
82323
82325
  return new SectionAttachmentInfo(this._spatialView, this._drawingToSpatialTransform, this._displaySpatialView);
82324
82326
  }
82327
+ preload(options) {
82328
+ if (!this.wantDisplayed)
82329
+ return;
82330
+ if (this._spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"])
82331
+ return;
82332
+ if (!_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].isValidId64(this._spatialView))
82333
+ return;
82334
+ options.spatialViewId = this._spatialView;
82335
+ options.viewStateLoadProps = {
82336
+ displayStyle: {
82337
+ omitScheduleScriptElementIds: true,
82338
+ compressExcludedElementIds: true,
82339
+ },
82340
+ };
82341
+ }
82325
82342
  async load(iModel) {
82326
82343
  if (!this.wantDisplayed)
82327
82344
  return;
@@ -82333,6 +82350,14 @@ class SectionAttachmentInfo {
82333
82350
  if (spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"])
82334
82351
  this._spatialView = spatialView;
82335
82352
  }
82353
+ async postload(options, iModel) {
82354
+ let spatialView;
82355
+ if (options.spatialViewProps) {
82356
+ spatialView = await iModel.views.convertViewStatePropsToViewState(options.spatialViewProps);
82357
+ }
82358
+ if (spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"])
82359
+ this._spatialView = spatialView;
82360
+ }
82336
82361
  createAttachment(toSheet) {
82337
82362
  if (!this.wantDisplayed || !(this._spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"]))
82338
82363
  return undefined;
@@ -82550,10 +82575,17 @@ class DrawingViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewSta
82550
82575
  return { spatialView, displaySpatialView, drawingToSpatialTransform };
82551
82576
  }
82552
82577
  /** @internal */
82553
- async load() {
82578
+ preload(hydrateRequest) {
82554
82579
  Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["assert"])(!this.isAttachedToViewport);
82555
- await super.load();
82556
- await this._attachmentInfo.load(this.iModel);
82580
+ super.preload(hydrateRequest);
82581
+ this._attachmentInfo.preload(hydrateRequest);
82582
+ }
82583
+ /** @internal */
82584
+ async postload(hydrateResponse) {
82585
+ const promises = [];
82586
+ promises.push(super.postload(hydrateResponse));
82587
+ promises.push(this._attachmentInfo.postload(hydrateResponse, this.iModel));
82588
+ await Promise.all(promises);
82557
82589
  }
82558
82590
  static createFromProps(props, iModel) {
82559
82591
  const cat = new _CategorySelectorState__WEBPACK_IMPORTED_MODULE_3__["CategorySelectorState"](props.categorySelectorProps, iModel);
@@ -86678,7 +86710,16 @@ class SnapshotConnection extends IModelConnection {
86678
86710
  return; // all requested models are already loaded
86679
86711
  try {
86680
86712
  const propArray = await this.getProps(notLoaded);
86681
- for (const props of propArray) {
86713
+ await this.updateLoadedWithModelProps(propArray);
86714
+ }
86715
+ catch (err) {
86716
+ // ignore error, we had nothing to do.
86717
+ }
86718
+ }
86719
+ /** Given an array of modelProps, find the class for each model and construct it. save it in the iModelConnection's loaded set. */
86720
+ async updateLoadedWithModelProps(modelProps) {
86721
+ try {
86722
+ for (const props of modelProps) {
86682
86723
  const ctor = await this._iModel.findClassFor(props.classFullName, _ModelState__WEBPACK_IMPORTED_MODULE_7__["ModelState"]);
86683
86724
  if (undefined === this.getLoaded(props.id)) { // do not overwrite if someone else loads it while we await
86684
86725
  const modelState = new ctor(props, this._iModel); // create a new instance of the appropriate ModelState subclass
@@ -86957,6 +86998,11 @@ class SnapshotConnection extends IModelConnection {
86957
86998
  },
86958
86999
  };
86959
87000
  const viewProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModelReadRpcInterface"].getClientForRouting(this._iModel.routingContext.token).getViewStateData(this._iModel.getRpcProps(), viewDefinitionId, options);
87001
+ const viewState = await this.convertViewStatePropsToViewState(viewProps);
87002
+ return viewState;
87003
+ }
87004
+ /** Return the [[ViewState]] object associated with the [[ViewStateProps]] passed in. */
87005
+ async convertViewStatePropsToViewState(viewProps) {
86960
87006
  const className = viewProps.viewDefinitionProps.classFullName;
86961
87007
  const ctor = await this._iModel.findClassFor(className, undefined);
86962
87008
  if (undefined === ctor)
@@ -90867,6 +90913,52 @@ class ViewAttachmentsInfo {
90867
90913
  // No reason to clone the array.
90868
90914
  return new ViewAttachmentsInfo(this._attachments);
90869
90915
  }
90916
+ preload(options) {
90917
+ if (this.isLoaded)
90918
+ return;
90919
+ options.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(this._ids);
90920
+ options.viewStateLoadProps = {
90921
+ displayStyle: {
90922
+ omitScheduleScriptElementIds: true,
90923
+ compressExcludedElementIds: true,
90924
+ },
90925
+ };
90926
+ }
90927
+ async postload(options, iModel) {
90928
+ if (options.sheetViewViews === undefined)
90929
+ return;
90930
+ if (options.sheetViewAttachmentProps === undefined)
90931
+ return;
90932
+ const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState
90933
+ const promises = [];
90934
+ for (const viewProps of viewStateProps) {
90935
+ const loadView = async () => {
90936
+ try {
90937
+ if (viewProps === undefined)
90938
+ return undefined;
90939
+ const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
90940
+ return view;
90941
+ }
90942
+ catch {
90943
+ return undefined;
90944
+ }
90945
+ };
90946
+ promises.push(loadView());
90947
+ }
90948
+ const views = await Promise.all(promises);
90949
+ const attachmentProps = options.sheetViewAttachmentProps;
90950
+ Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["assert"])(views.length === attachmentProps.length);
90951
+ const attachments = [];
90952
+ for (let i = 0; i < views.length; i++) {
90953
+ const view = views[i];
90954
+ if (view && !(view instanceof SheetViewState)) {
90955
+ const props = attachmentProps[i];
90956
+ props.attachedView = view;
90957
+ attachments.push(props);
90958
+ }
90959
+ }
90960
+ this._attachments = attachments;
90961
+ }
90870
90962
  async load(iModel) {
90871
90963
  if (this.isLoaded)
90872
90964
  return;
@@ -91043,12 +91135,17 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState
91043
91135
  getViewedExtents() {
91044
91136
  return this._viewedExtents;
91045
91137
  }
91046
- /** Load the size and attachment for this sheet, as well as any other 2d view state characteristics.
91047
- * @internal override
91048
- */
91049
- async load() {
91050
- await super.load();
91051
- await this._attachmentsInfo.load(this.iModel);
91138
+ /** @internal */
91139
+ preload(hydrateRequest) {
91140
+ super.preload(hydrateRequest);
91141
+ this._attachmentsInfo.preload(hydrateRequest);
91142
+ }
91143
+ /** @internal */
91144
+ async postload(hydrateResponse) {
91145
+ const promises = [];
91146
+ promises.push(super.postload(hydrateResponse));
91147
+ promises.push(this._attachmentsInfo.postload(hydrateResponse, this.iModel));
91148
+ await Promise.all(promises);
91052
91149
  }
91053
91150
  /** @internal */
91054
91151
  createScene(context) {
@@ -91673,9 +91770,21 @@ class SpatialViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__["ViewStat
91673
91770
  val.modelSelectorId = this.modelSelector.id;
91674
91771
  return val;
91675
91772
  }
91676
- async load() {
91677
- await super.load();
91678
- return this.modelSelector.load();
91773
+ /** @internal */
91774
+ preload(hydrateRequest) {
91775
+ super.preload(hydrateRequest);
91776
+ const notLoaded = this.iModel.models.filterLoaded(this.modelSelector.models);
91777
+ if (undefined === notLoaded)
91778
+ return; // all requested models are already loaded
91779
+ hydrateRequest.notLoadedModelSelectorStateModels = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(notLoaded);
91780
+ }
91781
+ /** @internal */
91782
+ async postload(hydrateResponse) {
91783
+ const promises = [];
91784
+ promises.push(super.postload(hydrateResponse));
91785
+ if (hydrateResponse.modelSelectorStateModels !== undefined)
91786
+ promises.push(this.iModel.models.updateLoadedWithModelProps(hydrateResponse.modelSelectorStateModels));
91787
+ await Promise.all(promises);
91679
91788
  }
91680
91789
  viewsModel(modelId) { return this.modelSelector.containsModel(modelId); }
91681
91790
  clearViewedModels() { this.modelSelector.models.clear(); }
@@ -92026,14 +92135,7 @@ class SubCategoriesCache {
92026
92135
  * containing the corresponding promise and the set of categories still to be loaded.
92027
92136
  */
92028
92137
  load(categoryIds) {
92029
- let missing;
92030
- for (const catId of _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].iterable(categoryIds)) {
92031
- if (undefined === this._byCategoryId.get(catId)) {
92032
- if (undefined === missing)
92033
- missing = new Set();
92034
- missing.add(catId);
92035
- }
92036
- }
92138
+ const missing = this.getMissing(categoryIds);
92037
92139
  if (undefined === missing)
92038
92140
  return undefined;
92039
92141
  const request = new SubCategoriesCache.Request(missing, this._imodel);
@@ -92048,6 +92150,41 @@ class SubCategoriesCache {
92048
92150
  cancel: () => request.cancel(),
92049
92151
  };
92050
92152
  }
92153
+ /**
92154
+ * Populates the notLoadedCategoryIds property of the HydrateViewStateRequestProps.
92155
+ * notLoadedCategoryIds is a subset of categoryIds, filtering out any ids which already have an entry in the cache.
92156
+ */
92157
+ preload(options, categoryIds) {
92158
+ const missing = this.getMissing(categoryIds);
92159
+ if (undefined === missing)
92160
+ return;
92161
+ this._missingAtTimeOfPreload = missing;
92162
+ options.notLoadedCategoryIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(missing);
92163
+ }
92164
+ /**
92165
+ * Populates the SubCategoriesCache using the categoryIdsResult of the HydrateViewStateResponseProps
92166
+ */
92167
+ postload(options) {
92168
+ if (options.categoryIdsResult === undefined)
92169
+ return;
92170
+ // missingAtTimeOfPreload shouldn't be undefined if options.categoryIdsResult is defined... but just to be safe we'll check
92171
+ const missing = this._missingAtTimeOfPreload === undefined ? new Set() : this._missingAtTimeOfPreload;
92172
+ this.processResults(options.categoryIdsResult, missing);
92173
+ // clear missing
92174
+ this._missingAtTimeOfPreload = undefined;
92175
+ }
92176
+ /** Given categoryIds, return which of these are not cached. */
92177
+ getMissing(categoryIds) {
92178
+ let missing;
92179
+ for (const catId of _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].iterable(categoryIds)) {
92180
+ if (undefined === this._byCategoryId.get(catId)) {
92181
+ if (undefined === missing)
92182
+ missing = new Set();
92183
+ missing.add(catId);
92184
+ }
92185
+ }
92186
+ return missing;
92187
+ }
92051
92188
  clear() {
92052
92189
  this._byCategoryId.clear();
92053
92190
  this._appearances.clear();
@@ -93530,13 +93667,22 @@ ViewCreator2d._sheetModelClasses = [_ModelState__WEBPACK_IMPORTED_MODULE_4__["Sh
93530
93667
  "use strict";
93531
93668
  __webpack_require__.r(__webpack_exports__);
93532
93669
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewCreator3d", function() { return ViewCreator3d; });
93533
- /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
93534
- /* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
93535
- /* harmony import */ var _SpatialViewState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SpatialViewState */ "../../core/frontend/lib/esm/SpatialViewState.js");
93670
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
93671
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
93672
+ /* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
93673
+ /* harmony import */ var _SpatialViewState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SpatialViewState */ "../../core/frontend/lib/esm/SpatialViewState.js");
93536
93674
  /*---------------------------------------------------------------------------------------------
93537
93675
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
93538
93676
  * See LICENSE.md in the project root for license terms and full copyright notice.
93539
93677
  *--------------------------------------------------------------------------------------------*/
93678
+ /** @packageDocumentation
93679
+ * @module Views
93680
+ */
93681
+ /*
93682
+ API for creating a 3D default view for an iModel.
93683
+ Either takes in a list of modelIds, or displays all 3D models by default.
93684
+ */
93685
+
93540
93686
 
93541
93687
 
93542
93688
 
@@ -93562,7 +93708,7 @@ class ViewCreator3d {
93562
93708
  */
93563
93709
  this._executeQuery = async (query) => {
93564
93710
  const rows = [];
93565
- for await (const row of this._imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["QueryRowFormat"].UseJsPropertyNames }))
93711
+ for await (const row of this._imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["QueryRowFormat"].UseJsPropertyNames }))
93566
93712
  rows.push(row.id);
93567
93713
  return rows;
93568
93714
  };
@@ -93574,9 +93720,9 @@ class ViewCreator3d {
93574
93720
  * @throws [IModelError]($common) If no 3d models are found in the iModel.
93575
93721
  */
93576
93722
  async createDefaultView(options, modelIds) {
93577
- const models = modelIds !== null && modelIds !== void 0 ? modelIds : await this._getAllModels();
93578
- const props = await this._createViewStateProps(models, options);
93579
- const viewState = _SpatialViewState__WEBPACK_IMPORTED_MODULE_2__["SpatialViewState"].createFromProps(props, this._imodel);
93723
+ const serializedProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModelReadRpcInterface"].getClientForRouting(this._imodel.routingContext.token).getCustomViewState3dData(this._imodel.getRpcProps(), modelIds === undefined ? {} : { modelIds: _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(modelIds) });
93724
+ const props = await this._createViewStateProps(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].decompressArray(serializedProps.modelIds), _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].decompressArray(serializedProps.categoryIds), _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_2__["Range3d"].fromJSON(serializedProps.modelExtents), options);
93725
+ const viewState = _SpatialViewState__WEBPACK_IMPORTED_MODULE_3__["SpatialViewState"].createFromProps(props, this._imodel);
93580
93726
  try {
93581
93727
  await viewState.load();
93582
93728
  }
@@ -93593,17 +93739,9 @@ class ViewCreator3d {
93593
93739
  * @param models Models to put in view props
93594
93740
  * @param options view creation options like camera On and skybox On
93595
93741
  */
93596
- async _createViewStateProps(models, options) {
93742
+ async _createViewStateProps(models, categories, modelExtents, options) {
93597
93743
  // Use dictionary model in all props
93598
- const dictionaryId = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["IModel"].dictionaryId;
93599
- const categories = await this._getAllCategories();
93600
- // model extents
93601
- const modelExtents = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__["Range3d"]();
93602
- if (models.length > 0) {
93603
- const modelProps = await this._imodel.models.queryModelRanges(models);
93604
- for (const props of modelProps)
93605
- modelExtents.union(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__["Range3d"].fromJSON(props), modelExtents);
93606
- }
93744
+ const dictionaryId = _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModel"].dictionaryId;
93607
93745
  if (modelExtents.isNull)
93608
93746
  modelExtents.setFrom(this._imodel.projectExtents);
93609
93747
  let originX = modelExtents.low.x;
@@ -93628,22 +93766,22 @@ class ViewCreator3d {
93628
93766
  }
93629
93767
  const categorySelectorProps = {
93630
93768
  categories,
93631
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
93769
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
93632
93770
  model: dictionaryId,
93633
93771
  classFullName: "BisCore:CategorySelector",
93634
93772
  };
93635
93773
  const modelSelectorProps = {
93636
93774
  models,
93637
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
93775
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
93638
93776
  model: dictionaryId,
93639
93777
  classFullName: "BisCore:ModelSelector",
93640
93778
  };
93641
- const cameraData = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Camera"]();
93779
+ const cameraData = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Camera"]();
93642
93780
  const cameraOn = (options === null || options === void 0 ? void 0 : options.cameraOn) !== false;
93643
93781
  const viewDefinitionProps = {
93644
93782
  categorySelectorId: "",
93645
93783
  displayStyleId: "",
93646
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
93784
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
93647
93785
  model: dictionaryId,
93648
93786
  origin: { x: originX, y: originY, z: originZ },
93649
93787
  extents: { x: deltaX, y: deltaY, z: deltaZ },
@@ -93656,13 +93794,13 @@ class ViewCreator3d {
93656
93794
  },
93657
93795
  };
93658
93796
  const displayStyleProps = {
93659
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
93797
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
93660
93798
  model: dictionaryId,
93661
93799
  classFullName: "BisCore:DisplayStyle3d",
93662
93800
  jsonProperties: {
93663
93801
  styles: {
93664
93802
  viewflags: {
93665
- renderMode: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["RenderMode"].SmoothShade,
93803
+ renderMode: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["RenderMode"].SmoothShade,
93666
93804
  noSourceLights: false,
93667
93805
  noCameraLights: false,
93668
93806
  noSolarLight: false,
@@ -93674,7 +93812,7 @@ class ViewCreator3d {
93674
93812
  environment: options !== undefined &&
93675
93813
  options.skyboxOn !== undefined &&
93676
93814
  options.skyboxOn
93677
- ? _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Environment"].defaults.withDisplay({ sky: true }).toJSON()
93815
+ ? _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Environment"].defaults.withDisplay({ sky: true }).toJSON()
93678
93816
  : undefined,
93679
93817
  },
93680
93818
  },
@@ -93719,10 +93857,10 @@ class ViewCreator3d {
93719
93857
  async _getDefaultViewId() {
93720
93858
  const viewId = await this._imodel.views.queryDefaultViewId();
93721
93859
  const params = {};
93722
- params.from = _SpatialViewState__WEBPACK_IMPORTED_MODULE_2__["SpatialViewState"].classFullName;
93860
+ params.from = _SpatialViewState__WEBPACK_IMPORTED_MODULE_3__["SpatialViewState"].classFullName;
93723
93861
  params.where = `ECInstanceId=${viewId}`;
93724
93862
  // Check validity of default view
93725
- const viewProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["IModelReadRpcInterface"].getClient().queryElementProps(this._imodel.getRpcProps(), params);
93863
+ const viewProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModelReadRpcInterface"].getClient().queryElementProps(this._imodel.getRpcProps(), params);
93726
93864
  if (viewProps.length === 0) {
93727
93865
  // Return the first view we can find
93728
93866
  const viewList = await this._imodel.views.getViewList({ wantPrivate: false });
@@ -93735,33 +93873,6 @@ class ViewCreator3d {
93735
93873
  }
93736
93874
  return viewId;
93737
93875
  }
93738
- /**
93739
- * Get all categories containing elements
93740
- */
93741
- async _getAllCategories() {
93742
- // Only use categories with elements in them
93743
- const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;
93744
- const categories = await this._executeQuery(query);
93745
- return categories;
93746
- }
93747
- /**
93748
- * Get all PhysicalModel ids in the connection
93749
- */
93750
- async _getAllModels() {
93751
- // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.
93752
- // If the iModel has an earlier version, the statement will throw because the property does not exist.
93753
- // If the iModel was created from an earlier version and later upgraded to a newer version, the property may be NULL for models created prior to the upgrade.
93754
- const select = "SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false";
93755
- const spatialCriterion = "AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)";
93756
- let models = [];
93757
- try {
93758
- models = await this._executeQuery(`${select} ${spatialCriterion}`);
93759
- }
93760
- catch {
93761
- models = await this._executeQuery(select);
93762
- }
93763
- return models;
93764
- }
93765
93876
  }
93766
93877
 
93767
93878
 
@@ -94863,19 +94974,37 @@ class ViewState extends _EntityState__WEBPACK_IMPORTED_MODULE_5__["ElementState"
94863
94974
  catch { }
94864
94975
  }
94865
94976
  }
94977
+ /**
94978
+ * Populates the hydrateRequest object stored on the ViewState with:
94979
+ * not loaded categoryIds based off of the ViewStates categorySelector.
94980
+ * Auxiliary coordinate system id if valid.
94981
+ */
94982
+ preload(hydrateRequest) {
94983
+ const acsId = this.getAuxiliaryCoordinateSystemId();
94984
+ if (_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].isValid(acsId))
94985
+ hydrateRequest.acsId = acsId;
94986
+ this.iModel.subcategories.preload(hydrateRequest, this.categorySelector.categories);
94987
+ }
94866
94988
  /** Asynchronously load any required data for this ViewState from the backend.
94989
+ * FINAL, No subclass should override load. If additional load behavior is needed, see preload and postload.
94867
94990
  * @note callers should await the Promise returned by this method before using this ViewState.
94868
94991
  * @see [Views]($docs/learning/frontend/Views.md)
94869
94992
  */
94870
94993
  async load() {
94994
+ const hydrateRequest = {};
94995
+ this.preload(hydrateRequest);
94871
94996
  const promises = [
94872
- this.loadAcs(),
94997
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__["IModelReadRpcInterface"].getClientForRouting(this.iModel.routingContext.token).hydrateViewState(this.iModel.getRpcProps(), hydrateRequest),
94873
94998
  this.displayStyle.load(),
94874
94999
  ];
94875
- const subcategories = this.iModel.subcategories.load(this.categorySelector.categories);
94876
- if (undefined !== subcategories)
94877
- promises.push(subcategories.promise.then((_) => { }));
94878
- await Promise.all(promises);
95000
+ const result = await Promise.all(promises);
95001
+ const hydrateResponse = result[0];
95002
+ await this.postload(hydrateResponse);
95003
+ }
95004
+ async postload(hydrateResponse) {
95005
+ this.iModel.subcategories.postload(hydrateResponse);
95006
+ if (hydrateResponse.acsElementProps)
95007
+ this._auxCoordSystem = _AuxCoordSys__WEBPACK_IMPORTED_MODULE_3__["AuxCoordSystemState"].fromProps(hydrateResponse.acsElementProps, this.iModel);
94879
95008
  }
94880
95009
  /** Returns true if all [[TileTree]]s required by this view have been loaded.
94881
95010
  * Note that the map tile trees associated to the viewport rather than the view, to check the
@@ -96405,9 +96534,17 @@ class ViewState2d extends ViewState {
96405
96534
  computeFitRange() {
96406
96535
  return this.getViewedExtents();
96407
96536
  }
96408
- async load() {
96409
- await super.load();
96410
- return this.iModel.models.load(this.baseModelId);
96537
+ /** @internal */
96538
+ preload(hydrateRequest) {
96539
+ super.preload(hydrateRequest);
96540
+ if (this.iModel.models.getLoaded(this.baseModelId) === undefined)
96541
+ hydrateRequest.baseModelId = this.baseModelId;
96542
+ }
96543
+ /** @internal */
96544
+ async postload(hydrateResponse) {
96545
+ if (hydrateResponse.baseModelProps === undefined)
96546
+ return;
96547
+ await this.iModel.models.updateLoadedWithModelProps([hydrateResponse.baseModelProps]);
96411
96548
  }
96412
96549
  /** Provides access to optional detail settings for this view. */
96413
96550
  get details() {
@@ -167445,7 +167582,6 @@ class DefaultViewTouchTool extends ViewManip {
167445
167582
  this._startDistance = 0.0;
167446
167583
  this._startTouchCount = 0;
167447
167584
  this._singleTouch = false;
167448
- this._hasZoom = false;
167449
167585
  this._rotate2dDisabled = false;
167450
167586
  this._only2dManipulations = false;
167451
167587
  this._only2dManipulations = only2dManipulations;
@@ -167492,7 +167628,6 @@ class DefaultViewTouchTool extends ViewManip {
167492
167628
  this._startDistance = (2 === ev.touchCount ? this._startDirection.magnitude() : 0.0);
167493
167629
  }
167494
167630
  computeZoomRatio(ev) {
167495
- this._hasZoom = false;
167496
167631
  if (undefined === ev || 0.0 === this._startDistance)
167497
167632
  return 1.0;
167498
167633
  const vp = this.viewport;
@@ -167500,7 +167635,8 @@ class DefaultViewTouchTool extends ViewManip {
167500
167635
  const threshold = this.viewport.pixelsFromInches(_ToolSettings__WEBPACK_IMPORTED_MODULE_22__["ToolSettings"].touchZoomChangeThresholdInches);
167501
167636
  if (0.0 === distance || Math.abs(this._startDistance - distance) < threshold)
167502
167637
  return 1.0;
167503
- this._hasZoom = true;
167638
+ // Remove inertia if the viewing operation includes zoom, only use it for pan and rotate.
167639
+ this._inertiaVec = undefined;
167504
167640
  const adjustedDist = (distance > this._startDistance ? (distance - threshold) : (distance + threshold)); // Avoid sudden jump in zoom scale by subtracting zoom threshold distance...
167505
167641
  return _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__["Geometry"].clamp(this._startDistance / adjustedDist, .1, 10);
167506
167642
  }
@@ -167612,8 +167748,7 @@ class DefaultViewTouchTool extends ViewManip {
167612
167748
  this._lastPtView.setFrom(this._startPtView);
167613
167749
  }
167614
167750
  else {
167615
- // Don't add inertia if the viewing operation included zoom, only do this for pan and rotate.
167616
- if (!samePoint && !this._hasZoom) {
167751
+ if (!samePoint) {
167617
167752
  this._inertiaVec = this._lastPtView.vectorTo(thisPt);
167618
167753
  this._inertiaVec.z = 0;
167619
167754
  }
@@ -167633,6 +167768,10 @@ class DefaultViewTouchTool extends ViewManip {
167633
167768
  }
167634
167769
  async onDataButtonDown(_ev) { return _Tool__WEBPACK_IMPORTED_MODULE_20__["EventHandled"].Yes; }
167635
167770
  async onDataButtonUp(_ev) { return _Tool__WEBPACK_IMPORTED_MODULE_20__["EventHandled"].Yes; }
167771
+ async onTouchStart(ev) {
167772
+ if (undefined !== this.viewport)
167773
+ this.onStart(ev);
167774
+ }
167636
167775
  async onTouchMove(ev) {
167637
167776
  this.handleEvent(ev);
167638
167777
  }
@@ -168126,7 +168265,7 @@ SetupWalkCameraTool.iconSpec = "icon-camera-location";
168126
168265
  /*! exports provided: name, version, description, main, module, typings, license, scripts, repository, keywords, author, peerDependencies, //devDependencies, devDependencies, //dependencies, dependencies, nyc, eslintConfig, default */
168127
168266
  /***/ (function(module) {
168128
168267
 
168129
- module.exports = JSON.parse("{\"name\":\"@itwin/core-frontend\",\"version\":\"3.2.0-dev.41\",\"description\":\"iTwin.js frontend components\",\"main\":\"lib/cjs/core-frontend.js\",\"module\":\"lib/esm/core-frontend.js\",\"typings\":\"lib/cjs/core-frontend\",\"license\":\"MIT\",\"scripts\":{\"build\":\"npm run -s copy:public && npm run -s build:cjs\",\"build:ci\":\"npm run -s build && npm run -s build:esm\",\"build:cjs\":\"tsc 1>&2 --outDir lib/cjs\",\"build:esm\":\"tsc 1>&2 --module ES2020 --outDir lib/esm\",\"clean\":\"rimraf lib .rush/temp/package-deps*.json\",\"copy:public\":\"cpx \\\"./src/public/**/*\\\" ./lib/public\",\"docs\":\"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts\",\"extract-api\":\"betools extract-api --entry=core-frontend && npm run extract-extension-api\",\"extract-extension-api\":\"eslint --no-eslintrc -c \\\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\\" \\\"./src/**/*.ts\\\" 1>&2\",\"lint\":\"eslint -f visualstudio \\\"./src/**/*.ts\\\" 1>&2\",\"pseudolocalize\":\"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO\",\"test\":\"npm run -s webpackTests && certa -r chrome\",\"cover\":\"npm -s test\",\"test:debug\":\"certa -r chrome --debug\",\"webpackTests\":\"webpack --config ./src/test/utils/webpack.config.js 1>&2\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend\"},\"keywords\":[\"Bentley\",\"BIM\",\"iModel\",\"digital-twin\",\"iTwin\"],\"author\":{\"name\":\"Bentley Systems, Inc.\",\"url\":\"http://www.bentley.com\"},\"peerDependencies\":{\"@itwin/appui-abstract\":\"workspace:^3.2.0-dev.41\",\"@itwin/core-bentley\":\"workspace:^3.2.0-dev.41\",\"@itwin/core-common\":\"workspace:^3.2.0-dev.41\",\"@itwin/core-geometry\":\"workspace:^3.2.0-dev.41\",\"@itwin/core-orbitgt\":\"workspace:^3.2.0-dev.41\",\"@itwin/core-quantity\":\"workspace:^3.2.0-dev.41\",\"@itwin/webgl-compatibility\":\"workspace:^3.2.0-dev.41\"},\"//devDependencies\":[\"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install\",\"NOTE: All tools used by scripts in this package must be listed as devDependencies\"],\"devDependencies\":{\"@itwin/appui-abstract\":\"workspace:*\",\"@itwin/build-tools\":\"workspace:*\",\"@itwin/core-bentley\":\"workspace:*\",\"@itwin/core-common\":\"workspace:*\",\"@itwin/core-geometry\":\"workspace:*\",\"@itwin/core-orbitgt\":\"workspace:*\",\"@itwin/core-quantity\":\"workspace:*\",\"@itwin/certa\":\"workspace:*\",\"@itwin/eslint-plugin\":\"workspace:*\",\"@itwin/webgl-compatibility\":\"workspace:*\",\"@types/chai\":\"^4.1.4\",\"@types/chai-as-promised\":\"^7\",\"@types/deep-assign\":\"^0.1.0\",\"@types/lodash\":\"^4.14.0\",\"@types/mocha\":\"^8.2.2\",\"@types/node\":\"14.14.31\",\"@types/qs\":\"^6.5.0\",\"@types/semver\":\"^5.5.0\",\"@types/superagent\":\"^4.1.14\",\"@types/sinon\":\"^9.0.0\",\"chai\":\"^4.1.2\",\"chai-as-promised\":\"^7\",\"cpx2\":\"^3.0.0\",\"eslint\":\"^7.11.0\",\"glob\":\"^7.1.2\",\"mocha\":\"^8.3.2\",\"nyc\":\"^15.1.0\",\"rimraf\":\"^3.0.2\",\"sinon\":\"^9.0.2\",\"source-map-loader\":\"^1.0.0\",\"typescript\":\"~4.4.0\",\"webpack\":\"4.42.0\"},\"//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/core-telemetry\":\"workspace:*\",\"@loaders.gl/core\":\"^3.1.6\",\"@loaders.gl/draco\":\"^3.1.6\",\"deep-assign\":\"^2.0.0\",\"fuse.js\":\"^3.3.0\",\"lodash\":\"^4.17.10\",\"qs\":\"^6.5.1\",\"semver\":\"^5.5.0\",\"superagent\":\"^7.0.1\",\"wms-capabilities\":\"0.4.0\",\"xml-js\":\"~1.6.11\"},\"nyc\":{\"extends\":\"./node_modules/@itwin/build-tools/.nycrc\"},\"eslintConfig\":{\"plugins\":[\"@itwin\"],\"extends\":\"plugin:@itwin/itwinjs-recommended\",\"rules\":{\"@itwin/no-internal-barrel-imports\":[\"error\",{\"required-barrel-modules\":[\"./src/tile/internal.ts\"]}],\"@itwin/public-extension-exports\":[\"error\",{\"releaseTags\":[\"public\",\"preview\"],\"outputApiFile\":false}]},\"overrides\":[{\"files\":[\"*.test.ts\",\"*.test.tsx\",\"**/test/**/*.ts\",\"**/test/**/*.tsx\"],\"rules\":{\"@itwin/no-internal-barrel-imports\":\"off\"}}]}}");
168268
+ module.exports = JSON.parse("{\"name\":\"@itwin/core-frontend\",\"version\":\"3.2.0-dev.42\",\"description\":\"iTwin.js frontend components\",\"main\":\"lib/cjs/core-frontend.js\",\"module\":\"lib/esm/core-frontend.js\",\"typings\":\"lib/cjs/core-frontend\",\"license\":\"MIT\",\"scripts\":{\"build\":\"npm run -s copy:public && npm run -s build:cjs\",\"build:ci\":\"npm run -s build && npm run -s build:esm\",\"build:cjs\":\"tsc 1>&2 --outDir lib/cjs\",\"build:esm\":\"tsc 1>&2 --module ES2020 --outDir lib/esm\",\"clean\":\"rimraf lib .rush/temp/package-deps*.json\",\"copy:public\":\"cpx \\\"./src/public/**/*\\\" ./lib/public\",\"docs\":\"betools docs --includes=../../generated-docs/extract --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/primitives,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts\",\"extract-api\":\"betools extract-api --entry=core-frontend && npm run extract-extension-api\",\"extract-extension-api\":\"eslint --no-eslintrc -c \\\"../../tools/eslint-plugin/dist/configs/extension-exports-config.js\\\" \\\"./src/**/*.ts\\\" 1>&2\",\"lint\":\"eslint -f visualstudio \\\"./src/**/*.ts\\\" 1>&2\",\"pseudolocalize\":\"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO\",\"test\":\"npm run -s webpackTests && certa -r chrome\",\"cover\":\"npm -s test\",\"test:debug\":\"certa -r chrome --debug\",\"webpackTests\":\"webpack --config ./src/test/utils/webpack.config.js 1>&2\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/iTwin/itwinjs-core/tree/master/core/frontend\"},\"keywords\":[\"Bentley\",\"BIM\",\"iModel\",\"digital-twin\",\"iTwin\"],\"author\":{\"name\":\"Bentley Systems, Inc.\",\"url\":\"http://www.bentley.com\"},\"peerDependencies\":{\"@itwin/appui-abstract\":\"workspace:^3.2.0-dev.42\",\"@itwin/core-bentley\":\"workspace:^3.2.0-dev.42\",\"@itwin/core-common\":\"workspace:^3.2.0-dev.42\",\"@itwin/core-geometry\":\"workspace:^3.2.0-dev.42\",\"@itwin/core-orbitgt\":\"workspace:^3.2.0-dev.42\",\"@itwin/core-quantity\":\"workspace:^3.2.0-dev.42\",\"@itwin/webgl-compatibility\":\"workspace:^3.2.0-dev.42\"},\"//devDependencies\":[\"NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install\",\"NOTE: All tools used by scripts in this package must be listed as devDependencies\"],\"devDependencies\":{\"@itwin/appui-abstract\":\"workspace:*\",\"@itwin/build-tools\":\"workspace:*\",\"@itwin/core-bentley\":\"workspace:*\",\"@itwin/core-common\":\"workspace:*\",\"@itwin/core-geometry\":\"workspace:*\",\"@itwin/core-orbitgt\":\"workspace:*\",\"@itwin/core-quantity\":\"workspace:*\",\"@itwin/certa\":\"workspace:*\",\"@itwin/eslint-plugin\":\"workspace:*\",\"@itwin/webgl-compatibility\":\"workspace:*\",\"@types/chai\":\"^4.1.4\",\"@types/chai-as-promised\":\"^7\",\"@types/deep-assign\":\"^0.1.0\",\"@types/lodash\":\"^4.14.0\",\"@types/mocha\":\"^8.2.2\",\"@types/node\":\"14.14.31\",\"@types/qs\":\"^6.5.0\",\"@types/semver\":\"^5.5.0\",\"@types/superagent\":\"^4.1.14\",\"@types/sinon\":\"^9.0.0\",\"chai\":\"^4.1.2\",\"chai-as-promised\":\"^7\",\"cpx2\":\"^3.0.0\",\"eslint\":\"^7.11.0\",\"glob\":\"^7.1.2\",\"mocha\":\"^8.3.2\",\"nyc\":\"^15.1.0\",\"rimraf\":\"^3.0.2\",\"sinon\":\"^9.0.2\",\"source-map-loader\":\"^1.0.0\",\"typescript\":\"~4.4.0\",\"webpack\":\"4.42.0\"},\"//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/core-telemetry\":\"workspace:*\",\"@loaders.gl/core\":\"^3.1.6\",\"@loaders.gl/draco\":\"^3.1.6\",\"deep-assign\":\"^2.0.0\",\"fuse.js\":\"^3.3.0\",\"lodash\":\"^4.17.10\",\"qs\":\"^6.5.1\",\"semver\":\"^5.5.0\",\"superagent\":\"^7.0.1\",\"wms-capabilities\":\"0.4.0\",\"xml-js\":\"~1.6.11\"},\"nyc\":{\"extends\":\"./node_modules/@itwin/build-tools/.nycrc\"},\"eslintConfig\":{\"plugins\":[\"@itwin\"],\"extends\":\"plugin:@itwin/itwinjs-recommended\",\"rules\":{\"@itwin/no-internal-barrel-imports\":[\"error\",{\"required-barrel-modules\":[\"./src/tile/internal.ts\"]}],\"@itwin/public-extension-exports\":[\"error\",{\"releaseTags\":[\"public\",\"preview\"],\"outputApiFile\":false}]},\"overrides\":[{\"files\":[\"*.test.ts\",\"*.test.tsx\",\"**/test/**/*.ts\",\"**/test/**/*.tsx\"],\"rules\":{\"@itwin/no-internal-barrel-imports\":\"off\"}}]}}");
168130
168269
 
168131
168270
  /***/ }),
168132
168271
 
@@ -281016,6 +281155,11 @@ describe("IModel Views", () => {
281016
281155
  const viewState = await views.load(props[0].id);
281017
281156
  expect(viewState).to.exist.and.be.not.empty;
281018
281157
  });
281158
+ it("should create viewstate3d using viewcreator3d", async () => {
281159
+ const viewcreator3d = new core_frontend_1.ViewCreator3d(iModel);
281160
+ const viewState = await viewcreator3d.createDefaultView();
281161
+ expect(viewState).to.exist.and.be.not.empty;
281162
+ });
281019
281163
  });
281020
281164
 
281021
281165
 
@@ -281202,7 +281346,7 @@ class TestContext {
281202
281346
  this.initializeRpcInterfaces({ title: this.settings.Backend.name, version: this.settings.Backend.version });
281203
281347
  const iModelClient = new imodels_client_management_1.IModelsClient({ api: { baseUrl: `https://${(_a = process.env.IMJS_URL_PREFIX) !== null && _a !== void 0 ? _a : ""}api.bentley.com/imodels` } });
281204
281348
  await core_frontend_1.NoRenderApp.startup({
281205
- applicationVersion: "3.2.0-dev.41",
281349
+ applicationVersion: "3.2.0-dev.42",
281206
281350
  applicationId: this.settings.gprid,
281207
281351
  authorizationClient: new frontend_1.TestFrontendAuthorizationClient(this.adminUserAccessToken),
281208
281352
  hubAccess: new imodels_access_frontend_1.FrontendIModelsAccess(iModelClient),