@itwin/ecschema-rpcinterface-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.
@@ -70015,6 +70015,8 @@ class IModelReadRpcInterface extends _RpcInterface__WEBPACK_IMPORTED_MODULE_0__[
70015
70015
  /** @deprecated */
70016
70016
  async getViewThumbnail(_iModelToken, _viewId) { return this.forward(arguments); }
70017
70017
  async getDefaultViewId(_iModelToken) { return this.forward(arguments); }
70018
+ async getCustomViewState3dData(_iModelToken, _options) { return this.forward(arguments); }
70019
+ async hydrateViewState(_iModelToken, _options) { return this.forward(arguments); }
70018
70020
  async requestSnap(_iModelToken, _sessionId, _props) { return this.forward(arguments); }
70019
70021
  async cancelSnap(_iModelToken, _sessionId) { return this.forward(arguments); }
70020
70022
  async getGeometryContainment(_iModelToken, _props) { return this.forward(arguments); }
@@ -73466,7 +73468,7 @@ class WebAppRpcRequest extends _core_RpcRequest__WEBPACK_IMPORTED_MODULE_4__["Rp
73466
73468
  /** The maximum size permitted for an encoded component in a URL.
73467
73469
  * @note This is used for features like encoding the payload of a cacheable request in the URL.
73468
73470
  */
73469
- WebAppRpcRequest.maxUrlComponentSize = 1024;
73471
+ WebAppRpcRequest.maxUrlComponentSize = 4096;
73470
73472
 
73471
73473
  /* 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))
73472
73474
 
@@ -91559,6 +91561,21 @@ class SectionAttachmentInfo {
91559
91561
  clone() {
91560
91562
  return new SectionAttachmentInfo(this._spatialView, this._drawingToSpatialTransform, this._displaySpatialView);
91561
91563
  }
91564
+ preload(options) {
91565
+ if (!this.wantDisplayed)
91566
+ return;
91567
+ if (this._spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"])
91568
+ return;
91569
+ if (!_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].isValidId64(this._spatialView))
91570
+ return;
91571
+ options.spatialViewId = this._spatialView;
91572
+ options.viewStateLoadProps = {
91573
+ displayStyle: {
91574
+ omitScheduleScriptElementIds: true,
91575
+ compressExcludedElementIds: true,
91576
+ },
91577
+ };
91578
+ }
91562
91579
  async load(iModel) {
91563
91580
  if (!this.wantDisplayed)
91564
91581
  return;
@@ -91570,6 +91587,14 @@ class SectionAttachmentInfo {
91570
91587
  if (spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"])
91571
91588
  this._spatialView = spatialView;
91572
91589
  }
91590
+ async postload(options, iModel) {
91591
+ let spatialView;
91592
+ if (options.spatialViewProps) {
91593
+ spatialView = await iModel.views.convertViewStatePropsToViewState(options.spatialViewProps);
91594
+ }
91595
+ if (spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"])
91596
+ this._spatialView = spatialView;
91597
+ }
91573
91598
  createAttachment(toSheet) {
91574
91599
  if (!this.wantDisplayed || !(this._spatialView instanceof _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState3d"]))
91575
91600
  return undefined;
@@ -91787,10 +91812,17 @@ class DrawingViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewSta
91787
91812
  return { spatialView, displaySpatialView, drawingToSpatialTransform };
91788
91813
  }
91789
91814
  /** @internal */
91790
- async load() {
91815
+ preload(hydrateRequest) {
91791
91816
  Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["assert"])(!this.isAttachedToViewport);
91792
- await super.load();
91793
- await this._attachmentInfo.load(this.iModel);
91817
+ super.preload(hydrateRequest);
91818
+ this._attachmentInfo.preload(hydrateRequest);
91819
+ }
91820
+ /** @internal */
91821
+ async postload(hydrateResponse) {
91822
+ const promises = [];
91823
+ promises.push(super.postload(hydrateResponse));
91824
+ promises.push(this._attachmentInfo.postload(hydrateResponse, this.iModel));
91825
+ await Promise.all(promises);
91794
91826
  }
91795
91827
  static createFromProps(props, iModel) {
91796
91828
  const cat = new _CategorySelectorState__WEBPACK_IMPORTED_MODULE_3__["CategorySelectorState"](props.categorySelectorProps, iModel);
@@ -95915,7 +95947,16 @@ class SnapshotConnection extends IModelConnection {
95915
95947
  return; // all requested models are already loaded
95916
95948
  try {
95917
95949
  const propArray = await this.getProps(notLoaded);
95918
- for (const props of propArray) {
95950
+ await this.updateLoadedWithModelProps(propArray);
95951
+ }
95952
+ catch (err) {
95953
+ // ignore error, we had nothing to do.
95954
+ }
95955
+ }
95956
+ /** Given an array of modelProps, find the class for each model and construct it. save it in the iModelConnection's loaded set. */
95957
+ async updateLoadedWithModelProps(modelProps) {
95958
+ try {
95959
+ for (const props of modelProps) {
95919
95960
  const ctor = await this._iModel.findClassFor(props.classFullName, _ModelState__WEBPACK_IMPORTED_MODULE_7__["ModelState"]);
95920
95961
  if (undefined === this.getLoaded(props.id)) { // do not overwrite if someone else loads it while we await
95921
95962
  const modelState = new ctor(props, this._iModel); // create a new instance of the appropriate ModelState subclass
@@ -96194,6 +96235,11 @@ class SnapshotConnection extends IModelConnection {
96194
96235
  },
96195
96236
  };
96196
96237
  const viewProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModelReadRpcInterface"].getClientForRouting(this._iModel.routingContext.token).getViewStateData(this._iModel.getRpcProps(), viewDefinitionId, options);
96238
+ const viewState = await this.convertViewStatePropsToViewState(viewProps);
96239
+ return viewState;
96240
+ }
96241
+ /** Return the [[ViewState]] object associated with the [[ViewStateProps]] passed in. */
96242
+ async convertViewStatePropsToViewState(viewProps) {
96197
96243
  const className = viewProps.viewDefinitionProps.classFullName;
96198
96244
  const ctor = await this._iModel.findClassFor(className, undefined);
96199
96245
  if (undefined === ctor)
@@ -100104,6 +100150,52 @@ class ViewAttachmentsInfo {
100104
100150
  // No reason to clone the array.
100105
100151
  return new ViewAttachmentsInfo(this._attachments);
100106
100152
  }
100153
+ preload(options) {
100154
+ if (this.isLoaded)
100155
+ return;
100156
+ options.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(this._ids);
100157
+ options.viewStateLoadProps = {
100158
+ displayStyle: {
100159
+ omitScheduleScriptElementIds: true,
100160
+ compressExcludedElementIds: true,
100161
+ },
100162
+ };
100163
+ }
100164
+ async postload(options, iModel) {
100165
+ if (options.sheetViewViews === undefined)
100166
+ return;
100167
+ if (options.sheetViewAttachmentProps === undefined)
100168
+ return;
100169
+ const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState
100170
+ const promises = [];
100171
+ for (const viewProps of viewStateProps) {
100172
+ const loadView = async () => {
100173
+ try {
100174
+ if (viewProps === undefined)
100175
+ return undefined;
100176
+ const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
100177
+ return view;
100178
+ }
100179
+ catch {
100180
+ return undefined;
100181
+ }
100182
+ };
100183
+ promises.push(loadView());
100184
+ }
100185
+ const views = await Promise.all(promises);
100186
+ const attachmentProps = options.sheetViewAttachmentProps;
100187
+ Object(_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["assert"])(views.length === attachmentProps.length);
100188
+ const attachments = [];
100189
+ for (let i = 0; i < views.length; i++) {
100190
+ const view = views[i];
100191
+ if (view && !(view instanceof SheetViewState)) {
100192
+ const props = attachmentProps[i];
100193
+ props.attachedView = view;
100194
+ attachments.push(props);
100195
+ }
100196
+ }
100197
+ this._attachments = attachments;
100198
+ }
100107
100199
  async load(iModel) {
100108
100200
  if (this.isLoaded)
100109
100201
  return;
@@ -100280,12 +100372,17 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_14__["ViewState
100280
100372
  getViewedExtents() {
100281
100373
  return this._viewedExtents;
100282
100374
  }
100283
- /** Load the size and attachment for this sheet, as well as any other 2d view state characteristics.
100284
- * @internal override
100285
- */
100286
- async load() {
100287
- await super.load();
100288
- await this._attachmentsInfo.load(this.iModel);
100375
+ /** @internal */
100376
+ preload(hydrateRequest) {
100377
+ super.preload(hydrateRequest);
100378
+ this._attachmentsInfo.preload(hydrateRequest);
100379
+ }
100380
+ /** @internal */
100381
+ async postload(hydrateResponse) {
100382
+ const promises = [];
100383
+ promises.push(super.postload(hydrateResponse));
100384
+ promises.push(this._attachmentsInfo.postload(hydrateResponse, this.iModel));
100385
+ await Promise.all(promises);
100289
100386
  }
100290
100387
  /** @internal */
100291
100388
  createScene(context) {
@@ -100910,9 +101007,21 @@ class SpatialViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__["ViewStat
100910
101007
  val.modelSelectorId = this.modelSelector.id;
100911
101008
  return val;
100912
101009
  }
100913
- async load() {
100914
- await super.load();
100915
- return this.modelSelector.load();
101010
+ /** @internal */
101011
+ preload(hydrateRequest) {
101012
+ super.preload(hydrateRequest);
101013
+ const notLoaded = this.iModel.models.filterLoaded(this.modelSelector.models);
101014
+ if (undefined === notLoaded)
101015
+ return; // all requested models are already loaded
101016
+ hydrateRequest.notLoadedModelSelectorStateModels = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(notLoaded);
101017
+ }
101018
+ /** @internal */
101019
+ async postload(hydrateResponse) {
101020
+ const promises = [];
101021
+ promises.push(super.postload(hydrateResponse));
101022
+ if (hydrateResponse.modelSelectorStateModels !== undefined)
101023
+ promises.push(this.iModel.models.updateLoadedWithModelProps(hydrateResponse.modelSelectorStateModels));
101024
+ await Promise.all(promises);
100916
101025
  }
100917
101026
  viewsModel(modelId) { return this.modelSelector.containsModel(modelId); }
100918
101027
  clearViewedModels() { this.modelSelector.models.clear(); }
@@ -101263,14 +101372,7 @@ class SubCategoriesCache {
101263
101372
  * containing the corresponding promise and the set of categories still to be loaded.
101264
101373
  */
101265
101374
  load(categoryIds) {
101266
- let missing;
101267
- for (const catId of _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].iterable(categoryIds)) {
101268
- if (undefined === this._byCategoryId.get(catId)) {
101269
- if (undefined === missing)
101270
- missing = new Set();
101271
- missing.add(catId);
101272
- }
101273
- }
101375
+ const missing = this.getMissing(categoryIds);
101274
101376
  if (undefined === missing)
101275
101377
  return undefined;
101276
101378
  const request = new SubCategoriesCache.Request(missing, this._imodel);
@@ -101285,6 +101387,41 @@ class SubCategoriesCache {
101285
101387
  cancel: () => request.cancel(),
101286
101388
  };
101287
101389
  }
101390
+ /**
101391
+ * Populates the notLoadedCategoryIds property of the HydrateViewStateRequestProps.
101392
+ * notLoadedCategoryIds is a subset of categoryIds, filtering out any ids which already have an entry in the cache.
101393
+ */
101394
+ preload(options, categoryIds) {
101395
+ const missing = this.getMissing(categoryIds);
101396
+ if (undefined === missing)
101397
+ return;
101398
+ this._missingAtTimeOfPreload = missing;
101399
+ options.notLoadedCategoryIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["CompressedId64Set"].sortAndCompress(missing);
101400
+ }
101401
+ /**
101402
+ * Populates the SubCategoriesCache using the categoryIdsResult of the HydrateViewStateResponseProps
101403
+ */
101404
+ postload(options) {
101405
+ if (options.categoryIdsResult === undefined)
101406
+ return;
101407
+ // missingAtTimeOfPreload shouldn't be undefined if options.categoryIdsResult is defined... but just to be safe we'll check
101408
+ const missing = this._missingAtTimeOfPreload === undefined ? new Set() : this._missingAtTimeOfPreload;
101409
+ this.processResults(options.categoryIdsResult, missing);
101410
+ // clear missing
101411
+ this._missingAtTimeOfPreload = undefined;
101412
+ }
101413
+ /** Given categoryIds, return which of these are not cached. */
101414
+ getMissing(categoryIds) {
101415
+ let missing;
101416
+ for (const catId of _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].iterable(categoryIds)) {
101417
+ if (undefined === this._byCategoryId.get(catId)) {
101418
+ if (undefined === missing)
101419
+ missing = new Set();
101420
+ missing.add(catId);
101421
+ }
101422
+ }
101423
+ return missing;
101424
+ }
101288
101425
  clear() {
101289
101426
  this._byCategoryId.clear();
101290
101427
  this._appearances.clear();
@@ -102767,13 +102904,22 @@ ViewCreator2d._sheetModelClasses = [_ModelState__WEBPACK_IMPORTED_MODULE_4__["Sh
102767
102904
  "use strict";
102768
102905
  __webpack_require__.r(__webpack_exports__);
102769
102906
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewCreator3d", function() { return ViewCreator3d; });
102770
- /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
102771
- /* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
102772
- /* harmony import */ var _SpatialViewState__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./SpatialViewState */ "../../core/frontend/lib/esm/SpatialViewState.js");
102907
+ /* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
102908
+ /* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
102909
+ /* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
102910
+ /* harmony import */ var _SpatialViewState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SpatialViewState */ "../../core/frontend/lib/esm/SpatialViewState.js");
102773
102911
  /*---------------------------------------------------------------------------------------------
102774
102912
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
102775
102913
  * See LICENSE.md in the project root for license terms and full copyright notice.
102776
102914
  *--------------------------------------------------------------------------------------------*/
102915
+ /** @packageDocumentation
102916
+ * @module Views
102917
+ */
102918
+ /*
102919
+ API for creating a 3D default view for an iModel.
102920
+ Either takes in a list of modelIds, or displays all 3D models by default.
102921
+ */
102922
+
102777
102923
 
102778
102924
 
102779
102925
 
@@ -102799,7 +102945,7 @@ class ViewCreator3d {
102799
102945
  */
102800
102946
  this._executeQuery = async (query) => {
102801
102947
  const rows = [];
102802
- for await (const row of this._imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["QueryRowFormat"].UseJsPropertyNames }))
102948
+ for await (const row of this._imodel.query(query, undefined, { rowFormat: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["QueryRowFormat"].UseJsPropertyNames }))
102803
102949
  rows.push(row.id);
102804
102950
  return rows;
102805
102951
  };
@@ -102811,9 +102957,9 @@ class ViewCreator3d {
102811
102957
  * @throws [IModelError]($common) If no 3d models are found in the iModel.
102812
102958
  */
102813
102959
  async createDefaultView(options, modelIds) {
102814
- const models = modelIds !== null && modelIds !== void 0 ? modelIds : await this._getAllModels();
102815
- const props = await this._createViewStateProps(models, options);
102816
- const viewState = _SpatialViewState__WEBPACK_IMPORTED_MODULE_2__["SpatialViewState"].createFromProps(props, this._imodel);
102960
+ 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) });
102961
+ 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);
102962
+ const viewState = _SpatialViewState__WEBPACK_IMPORTED_MODULE_3__["SpatialViewState"].createFromProps(props, this._imodel);
102817
102963
  try {
102818
102964
  await viewState.load();
102819
102965
  }
@@ -102830,17 +102976,9 @@ class ViewCreator3d {
102830
102976
  * @param models Models to put in view props
102831
102977
  * @param options view creation options like camera On and skybox On
102832
102978
  */
102833
- async _createViewStateProps(models, options) {
102979
+ async _createViewStateProps(models, categories, modelExtents, options) {
102834
102980
  // Use dictionary model in all props
102835
- const dictionaryId = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["IModel"].dictionaryId;
102836
- const categories = await this._getAllCategories();
102837
- // model extents
102838
- const modelExtents = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__["Range3d"]();
102839
- if (models.length > 0) {
102840
- const modelProps = await this._imodel.models.queryModelRanges(models);
102841
- for (const props of modelProps)
102842
- modelExtents.union(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__["Range3d"].fromJSON(props), modelExtents);
102843
- }
102981
+ const dictionaryId = _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModel"].dictionaryId;
102844
102982
  if (modelExtents.isNull)
102845
102983
  modelExtents.setFrom(this._imodel.projectExtents);
102846
102984
  let originX = modelExtents.low.x;
@@ -102865,22 +103003,22 @@ class ViewCreator3d {
102865
103003
  }
102866
103004
  const categorySelectorProps = {
102867
103005
  categories,
102868
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
103006
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
102869
103007
  model: dictionaryId,
102870
103008
  classFullName: "BisCore:CategorySelector",
102871
103009
  };
102872
103010
  const modelSelectorProps = {
102873
103011
  models,
102874
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
103012
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
102875
103013
  model: dictionaryId,
102876
103014
  classFullName: "BisCore:ModelSelector",
102877
103015
  };
102878
- const cameraData = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Camera"]();
103016
+ const cameraData = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Camera"]();
102879
103017
  const cameraOn = (options === null || options === void 0 ? void 0 : options.cameraOn) !== false;
102880
103018
  const viewDefinitionProps = {
102881
103019
  categorySelectorId: "",
102882
103020
  displayStyleId: "",
102883
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
103021
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
102884
103022
  model: dictionaryId,
102885
103023
  origin: { x: originX, y: originY, z: originZ },
102886
103024
  extents: { x: deltaX, y: deltaY, z: deltaZ },
@@ -102893,13 +103031,13 @@ class ViewCreator3d {
102893
103031
  },
102894
103032
  };
102895
103033
  const displayStyleProps = {
102896
- code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Code"].createEmpty(),
103034
+ code: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Code"].createEmpty(),
102897
103035
  model: dictionaryId,
102898
103036
  classFullName: "BisCore:DisplayStyle3d",
102899
103037
  jsonProperties: {
102900
103038
  styles: {
102901
103039
  viewflags: {
102902
- renderMode: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["RenderMode"].SmoothShade,
103040
+ renderMode: _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["RenderMode"].SmoothShade,
102903
103041
  noSourceLights: false,
102904
103042
  noCameraLights: false,
102905
103043
  noSolarLight: false,
@@ -102911,7 +103049,7 @@ class ViewCreator3d {
102911
103049
  environment: options !== undefined &&
102912
103050
  options.skyboxOn !== undefined &&
102913
103051
  options.skyboxOn
102914
- ? _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["Environment"].defaults.withDisplay({ sky: true }).toJSON()
103052
+ ? _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["Environment"].defaults.withDisplay({ sky: true }).toJSON()
102915
103053
  : undefined,
102916
103054
  },
102917
103055
  },
@@ -102956,10 +103094,10 @@ class ViewCreator3d {
102956
103094
  async _getDefaultViewId() {
102957
103095
  const viewId = await this._imodel.views.queryDefaultViewId();
102958
103096
  const params = {};
102959
- params.from = _SpatialViewState__WEBPACK_IMPORTED_MODULE_2__["SpatialViewState"].classFullName;
103097
+ params.from = _SpatialViewState__WEBPACK_IMPORTED_MODULE_3__["SpatialViewState"].classFullName;
102960
103098
  params.where = `ECInstanceId=${viewId}`;
102961
103099
  // Check validity of default view
102962
- const viewProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__["IModelReadRpcInterface"].getClient().queryElementProps(this._imodel.getRpcProps(), params);
103100
+ const viewProps = await _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__["IModelReadRpcInterface"].getClient().queryElementProps(this._imodel.getRpcProps(), params);
102963
103101
  if (viewProps.length === 0) {
102964
103102
  // Return the first view we can find
102965
103103
  const viewList = await this._imodel.views.getViewList({ wantPrivate: false });
@@ -102972,33 +103110,6 @@ class ViewCreator3d {
102972
103110
  }
102973
103111
  return viewId;
102974
103112
  }
102975
- /**
102976
- * Get all categories containing elements
102977
- */
102978
- async _getAllCategories() {
102979
- // Only use categories with elements in them
102980
- const query = `SELECT DISTINCT Category.Id AS id FROM BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId FROM BisCore.SpatialCategory)`;
102981
- const categories = await this._executeQuery(query);
102982
- return categories;
102983
- }
102984
- /**
102985
- * Get all PhysicalModel ids in the connection
102986
- */
102987
- async _getAllModels() {
102988
- // Note: IsNotSpatiallyLocated was introduced in a later version of the BisCore ECSchema.
102989
- // If the iModel has an earlier version, the statement will throw because the property does not exist.
102990
- // 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.
102991
- const select = "SELECT ECInstanceId FROM Bis.GeometricModel3D WHERE IsPrivate = false AND IsTemplate = false";
102992
- const spatialCriterion = "AND (IsNotSpatiallyLocated IS NULL OR IsNotSpatiallyLocated = false)";
102993
- let models = [];
102994
- try {
102995
- models = await this._executeQuery(`${select} ${spatialCriterion}`);
102996
- }
102997
- catch {
102998
- models = await this._executeQuery(select);
102999
- }
103000
- return models;
103001
- }
103002
103113
  }
103003
103114
 
103004
103115
 
@@ -104100,19 +104211,37 @@ class ViewState extends _EntityState__WEBPACK_IMPORTED_MODULE_5__["ElementState"
104100
104211
  catch { }
104101
104212
  }
104102
104213
  }
104214
+ /**
104215
+ * Populates the hydrateRequest object stored on the ViewState with:
104216
+ * not loaded categoryIds based off of the ViewStates categorySelector.
104217
+ * Auxiliary coordinate system id if valid.
104218
+ */
104219
+ preload(hydrateRequest) {
104220
+ const acsId = this.getAuxiliaryCoordinateSystemId();
104221
+ if (_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__["Id64"].isValid(acsId))
104222
+ hydrateRequest.acsId = acsId;
104223
+ this.iModel.subcategories.preload(hydrateRequest, this.categorySelector.categories);
104224
+ }
104103
104225
  /** Asynchronously load any required data for this ViewState from the backend.
104226
+ * FINAL, No subclass should override load. If additional load behavior is needed, see preload and postload.
104104
104227
  * @note callers should await the Promise returned by this method before using this ViewState.
104105
104228
  * @see [Views]($docs/learning/frontend/Views.md)
104106
104229
  */
104107
104230
  async load() {
104231
+ const hydrateRequest = {};
104232
+ this.preload(hydrateRequest);
104108
104233
  const promises = [
104109
- this.loadAcs(),
104234
+ _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__["IModelReadRpcInterface"].getClientForRouting(this.iModel.routingContext.token).hydrateViewState(this.iModel.getRpcProps(), hydrateRequest),
104110
104235
  this.displayStyle.load(),
104111
104236
  ];
104112
- const subcategories = this.iModel.subcategories.load(this.categorySelector.categories);
104113
- if (undefined !== subcategories)
104114
- promises.push(subcategories.promise.then((_) => { }));
104115
- await Promise.all(promises);
104237
+ const result = await Promise.all(promises);
104238
+ const hydrateResponse = result[0];
104239
+ await this.postload(hydrateResponse);
104240
+ }
104241
+ async postload(hydrateResponse) {
104242
+ this.iModel.subcategories.postload(hydrateResponse);
104243
+ if (hydrateResponse.acsElementProps)
104244
+ this._auxCoordSystem = _AuxCoordSys__WEBPACK_IMPORTED_MODULE_3__["AuxCoordSystemState"].fromProps(hydrateResponse.acsElementProps, this.iModel);
104116
104245
  }
104117
104246
  /** Returns true if all [[TileTree]]s required by this view have been loaded.
104118
104247
  * Note that the map tile trees associated to the viewport rather than the view, to check the
@@ -105642,9 +105771,17 @@ class ViewState2d extends ViewState {
105642
105771
  computeFitRange() {
105643
105772
  return this.getViewedExtents();
105644
105773
  }
105645
- async load() {
105646
- await super.load();
105647
- return this.iModel.models.load(this.baseModelId);
105774
+ /** @internal */
105775
+ preload(hydrateRequest) {
105776
+ super.preload(hydrateRequest);
105777
+ if (this.iModel.models.getLoaded(this.baseModelId) === undefined)
105778
+ hydrateRequest.baseModelId = this.baseModelId;
105779
+ }
105780
+ /** @internal */
105781
+ async postload(hydrateResponse) {
105782
+ if (hydrateResponse.baseModelProps === undefined)
105783
+ return;
105784
+ await this.iModel.models.updateLoadedWithModelProps([hydrateResponse.baseModelProps]);
105648
105785
  }
105649
105786
  /** Provides access to optional detail settings for this view. */
105650
105787
  get details() {
@@ -176682,7 +176819,6 @@ class DefaultViewTouchTool extends ViewManip {
176682
176819
  this._startDistance = 0.0;
176683
176820
  this._startTouchCount = 0;
176684
176821
  this._singleTouch = false;
176685
- this._hasZoom = false;
176686
176822
  this._rotate2dDisabled = false;
176687
176823
  this._only2dManipulations = false;
176688
176824
  this._only2dManipulations = only2dManipulations;
@@ -176729,7 +176865,6 @@ class DefaultViewTouchTool extends ViewManip {
176729
176865
  this._startDistance = (2 === ev.touchCount ? this._startDirection.magnitude() : 0.0);
176730
176866
  }
176731
176867
  computeZoomRatio(ev) {
176732
- this._hasZoom = false;
176733
176868
  if (undefined === ev || 0.0 === this._startDistance)
176734
176869
  return 1.0;
176735
176870
  const vp = this.viewport;
@@ -176737,7 +176872,8 @@ class DefaultViewTouchTool extends ViewManip {
176737
176872
  const threshold = this.viewport.pixelsFromInches(_ToolSettings__WEBPACK_IMPORTED_MODULE_22__["ToolSettings"].touchZoomChangeThresholdInches);
176738
176873
  if (0.0 === distance || Math.abs(this._startDistance - distance) < threshold)
176739
176874
  return 1.0;
176740
- this._hasZoom = true;
176875
+ // Remove inertia if the viewing operation includes zoom, only use it for pan and rotate.
176876
+ this._inertiaVec = undefined;
176741
176877
  const adjustedDist = (distance > this._startDistance ? (distance - threshold) : (distance + threshold)); // Avoid sudden jump in zoom scale by subtracting zoom threshold distance...
176742
176878
  return _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__["Geometry"].clamp(this._startDistance / adjustedDist, .1, 10);
176743
176879
  }
@@ -176849,8 +176985,7 @@ class DefaultViewTouchTool extends ViewManip {
176849
176985
  this._lastPtView.setFrom(this._startPtView);
176850
176986
  }
176851
176987
  else {
176852
- // Don't add inertia if the viewing operation included zoom, only do this for pan and rotate.
176853
- if (!samePoint && !this._hasZoom) {
176988
+ if (!samePoint) {
176854
176989
  this._inertiaVec = this._lastPtView.vectorTo(thisPt);
176855
176990
  this._inertiaVec.z = 0;
176856
176991
  }
@@ -176870,6 +177005,10 @@ class DefaultViewTouchTool extends ViewManip {
176870
177005
  }
176871
177006
  async onDataButtonDown(_ev) { return _Tool__WEBPACK_IMPORTED_MODULE_20__["EventHandled"].Yes; }
176872
177007
  async onDataButtonUp(_ev) { return _Tool__WEBPACK_IMPORTED_MODULE_20__["EventHandled"].Yes; }
177008
+ async onTouchStart(ev) {
177009
+ if (undefined !== this.viewport)
177010
+ this.onStart(ev);
177011
+ }
176873
177012
  async onTouchMove(ev) {
176874
177013
  this.handleEvent(ev);
176875
177014
  }
@@ -177363,7 +177502,7 @@ SetupWalkCameraTool.iconSpec = "icon-camera-location";
177363
177502
  /*! exports provided: name, version, description, main, module, typings, license, scripts, repository, keywords, author, peerDependencies, //devDependencies, devDependencies, //dependencies, dependencies, nyc, eslintConfig, default */
177364
177503
  /***/ (function(module) {
177365
177504
 
177366
- 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\"}}]}}");
177505
+ 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\"}}]}}");
177367
177506
 
177368
177507
  /***/ }),
177369
177508