@itwin/ecschema-rpcinterface-tests 5.3.0 → 5.4.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/bundled-tests.js +1121 -764
- package/lib/dist/bundled-tests.js.map +1 -1
- package/lib/dist/core_frontend_lib_esm_ApproximateTerrainHeightsProps_js.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_cross-fetch_4_0_0_node_modules_cross-fetch_dist_browser-24291b.bundled-tests.js.map +1 -1
- package/lib/dist/vendors-common_temp_node_modules_pnpm_loaders_gl_draco_4_3_4__loaders_gl_core_4_3_4_node_modu-4c1fc9.bundled-tests.js.map +1 -1
- package/package.json +15 -15
|
@@ -36300,7 +36300,10 @@ class MapImagerySettings {
|
|
|
36300
36300
|
}
|
|
36301
36301
|
/** @internal */
|
|
36302
36302
|
static createFromJSON(imageryJson, mapProps) {
|
|
36303
|
-
const
|
|
36303
|
+
const backgroundBase = imageryJson?.backgroundBase;
|
|
36304
|
+
const baseLayer = undefined !== backgroundBase ?
|
|
36305
|
+
BaseLayerSettings.fromJSON(backgroundBase) :
|
|
36306
|
+
_MapLayerSettings__WEBPACK_IMPORTED_MODULE_1__.BaseMapLayerSettings.fromBackgroundMapProps(mapProps ?? {});
|
|
36304
36307
|
return new MapImagerySettings(baseLayer, imageryJson?.backgroundLayers, imageryJson?.overlayLayers);
|
|
36305
36308
|
}
|
|
36306
36309
|
toJSON() {
|
|
@@ -74238,9 +74241,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
74238
74241
|
* @public @preview
|
|
74239
74242
|
*/
|
|
74240
74243
|
class SchemaJsonLocater {
|
|
74241
|
-
|
|
74242
|
-
constructor(
|
|
74243
|
-
|
|
74244
|
+
_getSchemaProps;
|
|
74245
|
+
constructor(getSchemaProps) {
|
|
74246
|
+
// Since the getSchemaProps may throw an error, but the locater contract defines that
|
|
74247
|
+
// getSchema should return undefined if the schema could not be located, we wrap the provided
|
|
74248
|
+
// lookup function in a safe block.
|
|
74249
|
+
this._getSchemaProps = (schemaName) => {
|
|
74250
|
+
try {
|
|
74251
|
+
return getSchemaProps(schemaName);
|
|
74252
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74253
|
+
}
|
|
74254
|
+
catch (error) {
|
|
74255
|
+
return undefined;
|
|
74256
|
+
}
|
|
74257
|
+
};
|
|
74244
74258
|
}
|
|
74245
74259
|
/** Get a schema by [SchemaKey]
|
|
74246
74260
|
* @param schemaKey The [SchemaKey] that identifies the schema.
|
|
@@ -74258,7 +74272,7 @@ class SchemaJsonLocater {
|
|
|
74258
74272
|
* @param matchType The match type to use when locating the schema
|
|
74259
74273
|
*/
|
|
74260
74274
|
async getSchemaInfo(schemaKey, matchType, context) {
|
|
74261
|
-
const schemaProps = this.
|
|
74275
|
+
const schemaProps = this._getSchemaProps(schemaKey.name);
|
|
74262
74276
|
if (!schemaProps)
|
|
74263
74277
|
return undefined;
|
|
74264
74278
|
const schemaInfo = await _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.startLoadingFromJson(schemaProps, context);
|
|
@@ -74273,7 +74287,7 @@ class SchemaJsonLocater {
|
|
|
74273
74287
|
* @throws [Error]($ecschema-metadata) if the schema exists, but cannot be loaded.
|
|
74274
74288
|
*/
|
|
74275
74289
|
getSchemaSync(schemaKey, _matchType, context) {
|
|
74276
|
-
const schemaProps = this.
|
|
74290
|
+
const schemaProps = this._getSchemaProps(schemaKey.name);
|
|
74277
74291
|
if (!schemaProps)
|
|
74278
74292
|
return undefined;
|
|
74279
74293
|
return _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.fromJsonSync(schemaProps, context || new _Context__WEBPACK_IMPORTED_MODULE_0__.SchemaContext());
|
|
@@ -82173,6 +82187,7 @@ class BriefcaseConnection extends _IModelConnection__WEBPACK_IMPORTED_MODULE_5__
|
|
|
82173
82187
|
this._modelsMonitor = new ModelChangeMonitor(this);
|
|
82174
82188
|
if (_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.OpenMode.ReadWrite === this._openMode)
|
|
82175
82189
|
this.txns.onAfterUndoRedo.addListener(async () => { await _IModelApp__WEBPACK_IMPORTED_MODULE_4__.IModelApp.toolAdmin.restartPrimitiveTool(); });
|
|
82190
|
+
this.categories.cache.attachToBriefcase(this);
|
|
82176
82191
|
}
|
|
82177
82192
|
/** Open a BriefcaseConnection to a [BriefcaseDb]($backend). */
|
|
82178
82193
|
static async openFile(briefcaseProps) {
|
|
@@ -93838,18 +93853,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
93838
93853
|
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
93839
93854
|
/* harmony import */ var _CategorySelectorState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CategorySelectorState */ "../../core/frontend/lib/esm/CategorySelectorState.js");
|
|
93840
93855
|
/* harmony import */ var _DisplayStyleState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DisplayStyleState */ "../../core/frontend/lib/esm/DisplayStyleState.js");
|
|
93841
|
-
/* harmony import */ var
|
|
93842
|
-
/* harmony import */ var
|
|
93843
|
-
/* harmony import */ var
|
|
93844
|
-
/* harmony import */ var
|
|
93845
|
-
/* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
|
|
93846
|
-
/* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
|
|
93847
|
-
/* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Viewport */ "../../core/frontend/lib/esm/Viewport.js");
|
|
93848
|
-
/* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
|
|
93849
|
-
/* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
|
|
93850
|
-
/* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
|
|
93851
|
-
/* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
|
|
93852
|
-
/* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
|
|
93856
|
+
/* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
|
|
93857
|
+
/* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
|
|
93858
|
+
/* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
|
|
93859
|
+
/* harmony import */ var _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./internal/SheetViewAttachments */ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js");
|
|
93853
93860
|
/*---------------------------------------------------------------------------------------------
|
|
93854
93861
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
93855
93862
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -93866,14 +93873,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
93866
93873
|
|
|
93867
93874
|
|
|
93868
93875
|
|
|
93869
|
-
|
|
93870
|
-
|
|
93871
|
-
|
|
93872
|
-
|
|
93873
|
-
|
|
93874
|
-
|
|
93875
|
-
|
|
93876
|
-
|
|
93877
93876
|
// cSpell:ignore ovrs
|
|
93878
93877
|
/** Describes the geometry and styling of a sheet border decoration.
|
|
93879
93878
|
* The sheet border decoration mimics a sheet of paper with a drop shadow.
|
|
@@ -93942,206 +93941,25 @@ class SheetBorder {
|
|
|
93942
93941
|
params.fillColor = fillColor;
|
|
93943
93942
|
params.gradient = this._gradient;
|
|
93944
93943
|
builder.activateGraphicParams(params);
|
|
93945
|
-
builder.addShape2d(this._shadow,
|
|
93944
|
+
builder.addShape2d(this._shadow, _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance);
|
|
93946
93945
|
builder.setSymbology(lineColor, fillColor, 2);
|
|
93947
93946
|
builder.addLineString2d(this._rect, 0);
|
|
93948
93947
|
}
|
|
93949
93948
|
}
|
|
93950
|
-
/** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is
|
|
93951
|
-
* supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in
|
|
93952
|
-
* SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.
|
|
93953
|
-
*/
|
|
93954
|
-
class ViewAttachmentsInfo {
|
|
93955
|
-
_attachments;
|
|
93956
|
-
get attachments() { return this._attachments; }
|
|
93957
|
-
constructor(attachments) {
|
|
93958
|
-
this._attachments = attachments;
|
|
93959
|
-
}
|
|
93960
|
-
get isLoaded() {
|
|
93961
|
-
return 0 === this._attachments.length || "string" !== typeof this._attachments[0];
|
|
93962
|
-
}
|
|
93963
|
-
get viewAttachmentProps() {
|
|
93964
|
-
return this.isLoaded ? this._props : [];
|
|
93965
|
-
}
|
|
93966
|
-
get _props() {
|
|
93967
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.isLoaded);
|
|
93968
|
-
return this._attachments;
|
|
93969
|
-
}
|
|
93970
|
-
get _ids() {
|
|
93971
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this.isLoaded);
|
|
93972
|
-
return this._attachments;
|
|
93973
|
-
}
|
|
93974
|
-
static fromJSON(ids = []) {
|
|
93975
|
-
return new ViewAttachmentsInfo(ids);
|
|
93976
|
-
}
|
|
93977
|
-
toJSON() {
|
|
93978
|
-
return this.isLoaded ? this._props.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(x.id)) : [...this._ids];
|
|
93979
|
-
}
|
|
93980
|
-
clone(iModel) {
|
|
93981
|
-
let attachments = this._attachments;
|
|
93982
|
-
if (this.isLoaded) {
|
|
93983
|
-
// Need to clone the attached ViewStates.
|
|
93984
|
-
attachments = attachments.map((attachment) => {
|
|
93985
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(typeof attachment !== "string");
|
|
93986
|
-
return {
|
|
93987
|
-
...attachment,
|
|
93988
|
-
attachedView: attachment.attachedView.clone(iModel),
|
|
93989
|
-
};
|
|
93990
|
-
});
|
|
93991
|
-
}
|
|
93992
|
-
return new ViewAttachmentsInfo(attachments);
|
|
93993
|
-
}
|
|
93994
|
-
preload(options) {
|
|
93995
|
-
if (this.isLoaded)
|
|
93996
|
-
return;
|
|
93997
|
-
options.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.CompressedId64Set.sortAndCompress(this._ids);
|
|
93998
|
-
options.viewStateLoadProps = {
|
|
93999
|
-
displayStyle: {
|
|
94000
|
-
omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
|
|
94001
|
-
compressExcludedElementIds: true,
|
|
94002
|
-
},
|
|
94003
|
-
};
|
|
94004
|
-
}
|
|
94005
|
-
async postload(options, iModel) {
|
|
94006
|
-
if (options.sheetViewViews === undefined)
|
|
94007
|
-
return;
|
|
94008
|
-
if (options.sheetViewAttachmentProps === undefined)
|
|
94009
|
-
return;
|
|
94010
|
-
const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState
|
|
94011
|
-
const promises = [];
|
|
94012
|
-
for (const viewProps of viewStateProps) {
|
|
94013
|
-
const loadView = async () => {
|
|
94014
|
-
try {
|
|
94015
|
-
if (viewProps === undefined)
|
|
94016
|
-
return undefined;
|
|
94017
|
-
const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
|
|
94018
|
-
return view;
|
|
94019
|
-
}
|
|
94020
|
-
catch {
|
|
94021
|
-
return undefined;
|
|
94022
|
-
}
|
|
94023
|
-
};
|
|
94024
|
-
promises.push(loadView());
|
|
94025
|
-
}
|
|
94026
|
-
const views = await Promise.all(promises);
|
|
94027
|
-
const attachmentProps = options.sheetViewAttachmentProps;
|
|
94028
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
|
|
94029
|
-
const attachments = [];
|
|
94030
|
-
for (let i = 0; i < views.length; i++) {
|
|
94031
|
-
const view = views[i];
|
|
94032
|
-
if (view && !(view instanceof SheetViewState)) {
|
|
94033
|
-
const props = attachmentProps[i];
|
|
94034
|
-
props.attachedView = view;
|
|
94035
|
-
attachments.push(props);
|
|
94036
|
-
}
|
|
94037
|
-
}
|
|
94038
|
-
this._attachments = attachments;
|
|
94039
|
-
}
|
|
94040
|
-
async load(iModel) {
|
|
94041
|
-
if (this.isLoaded)
|
|
94042
|
-
return;
|
|
94043
|
-
const attachmentProps = await iModel.elements.getProps(this._ids);
|
|
94044
|
-
const promises = [];
|
|
94045
|
-
for (const attachment of attachmentProps) {
|
|
94046
|
-
const loadView = async () => {
|
|
94047
|
-
try {
|
|
94048
|
-
const view = await iModel.views.load(attachment.view.id);
|
|
94049
|
-
return view;
|
|
94050
|
-
}
|
|
94051
|
-
catch {
|
|
94052
|
-
return undefined;
|
|
94053
|
-
}
|
|
94054
|
-
};
|
|
94055
|
-
promises.push(loadView());
|
|
94056
|
-
}
|
|
94057
|
-
const views = await Promise.all(promises);
|
|
94058
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
|
|
94059
|
-
const attachments = [];
|
|
94060
|
-
for (let i = 0; i < views.length; i++) {
|
|
94061
|
-
const view = views[i];
|
|
94062
|
-
if (view && !(view instanceof SheetViewState)) {
|
|
94063
|
-
const props = attachmentProps[i];
|
|
94064
|
-
props.attachedView = view;
|
|
94065
|
-
attachments.push(props);
|
|
94066
|
-
}
|
|
94067
|
-
}
|
|
94068
|
-
this._attachments = attachments;
|
|
94069
|
-
}
|
|
94070
|
-
createAttachments(sheetView) {
|
|
94071
|
-
return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;
|
|
94072
|
-
}
|
|
94073
|
-
}
|
|
94074
|
-
/** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;
|
|
94075
|
-
* disposed of when it becomes detached from the viewport.
|
|
94076
|
-
*/
|
|
94077
|
-
class ViewAttachments {
|
|
94078
|
-
_attachments = [];
|
|
94079
|
-
maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
|
|
94080
|
-
constructor(infos, sheetView) {
|
|
94081
|
-
for (const info of infos) {
|
|
94082
|
-
const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);
|
|
94083
|
-
const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;
|
|
94084
|
-
const attachment = new ctor(info.attachedView, info, sheetView);
|
|
94085
|
-
this._attachments.push(attachment);
|
|
94086
|
-
this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);
|
|
94087
|
-
}
|
|
94088
|
-
}
|
|
94089
|
-
[Symbol.dispose]() {
|
|
94090
|
-
for (const attachment of this._attachments)
|
|
94091
|
-
attachment[Symbol.dispose]();
|
|
94092
|
-
this._attachments.length = 0;
|
|
94093
|
-
}
|
|
94094
|
-
[Symbol.iterator]() {
|
|
94095
|
-
return this._attachments[Symbol.iterator]();
|
|
94096
|
-
}
|
|
94097
|
-
/** For tests. */
|
|
94098
|
-
get attachments() {
|
|
94099
|
-
return this._attachments;
|
|
94100
|
-
}
|
|
94101
|
-
get isEmpty() {
|
|
94102
|
-
return 0 === this._attachments.length;
|
|
94103
|
-
}
|
|
94104
|
-
areAllTileTreesLoaded(displayedExtents) {
|
|
94105
|
-
return this._attachments.every((x) => {
|
|
94106
|
-
const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(x.viewAttachmentProps.placement);
|
|
94107
|
-
const attachmentRange = placement.calculateRange();
|
|
94108
|
-
if (!attachmentRange.intersectsRangeXY(displayedExtents))
|
|
94109
|
-
return true;
|
|
94110
|
-
return x.areAllTileTreesLoaded;
|
|
94111
|
-
});
|
|
94112
|
-
}
|
|
94113
|
-
/** Strictly for testing purposes */
|
|
94114
|
-
areAllAttachmentsLoaded() {
|
|
94115
|
-
return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);
|
|
94116
|
-
}
|
|
94117
|
-
discloseTileTrees(trees) {
|
|
94118
|
-
for (const attachment of this._attachments)
|
|
94119
|
-
trees.disclose(attachment);
|
|
94120
|
-
}
|
|
94121
|
-
collectStatistics(stats) {
|
|
94122
|
-
for (const attachment of this._attachments)
|
|
94123
|
-
attachment.collectStatistics(stats);
|
|
94124
|
-
}
|
|
94125
|
-
addToScene(context) {
|
|
94126
|
-
for (const attachment of this._attachments)
|
|
94127
|
-
attachment.addToScene(context);
|
|
94128
|
-
}
|
|
94129
|
-
findById(attachmentId) {
|
|
94130
|
-
return this._attachments.find((attachment) => attachment.viewAttachmentProps.id === attachmentId);
|
|
94131
|
-
}
|
|
94132
|
-
}
|
|
94133
93949
|
/** A view of a [SheetModel]($backend).
|
|
94134
93950
|
* @public
|
|
94135
93951
|
* @extensions
|
|
94136
93952
|
*/
|
|
94137
|
-
class SheetViewState extends
|
|
93953
|
+
class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__.ViewState2d {
|
|
94138
93954
|
/** The width and height of the sheet in world coordinates. */
|
|
94139
93955
|
sheetSize;
|
|
94140
|
-
|
|
94141
|
-
_attachments;
|
|
93956
|
+
_viewAttachments;
|
|
94142
93957
|
_viewedExtents;
|
|
93958
|
+
_onViewAttachmentsReloaded = () => undefined;
|
|
93959
|
+
/** Strictly for tests. */
|
|
93960
|
+
onViewAttachmentsReloaded = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
94143
93961
|
get attachmentIds() {
|
|
94144
|
-
return this.
|
|
93962
|
+
return this._viewAttachments.attachmentIds;
|
|
94145
93963
|
}
|
|
94146
93964
|
static get className() { return "SheetViewDefinition"; }
|
|
94147
93965
|
static createFromProps(viewStateData, iModel) {
|
|
@@ -94152,7 +93970,7 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94152
93970
|
}
|
|
94153
93971
|
toProps() {
|
|
94154
93972
|
const props = super.toProps();
|
|
94155
|
-
props.sheetAttachments = this.
|
|
93973
|
+
props.sheetAttachments = [...this.attachmentIds];
|
|
94156
93974
|
// For sheetProps all that is actually used is the size, so just null out everything else.
|
|
94157
93975
|
const codeProps = { spec: "", scope: "", value: "" };
|
|
94158
93976
|
props.sheetProps = {
|
|
@@ -94167,20 +93985,15 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94167
93985
|
}
|
|
94168
93986
|
/** Strictly for testing. @internal */
|
|
94169
93987
|
get viewAttachmentProps() {
|
|
94170
|
-
return this.
|
|
94171
|
-
return {
|
|
94172
|
-
...x,
|
|
94173
|
-
attachedView: undefined,
|
|
94174
|
-
};
|
|
94175
|
-
});
|
|
93988
|
+
return this._viewAttachments.attachmentProps;
|
|
94176
93989
|
}
|
|
94177
93990
|
/** Strictly for testing. @internal */
|
|
94178
93991
|
get viewAttachmentInfos() {
|
|
94179
|
-
return this.
|
|
93992
|
+
return this._viewAttachments.attachmentInfos;
|
|
94180
93993
|
}
|
|
94181
93994
|
/** Strictly for testing. @internal */
|
|
94182
93995
|
get attachments() {
|
|
94183
|
-
return this.
|
|
93996
|
+
return this._viewAttachments.attachments;
|
|
94184
93997
|
}
|
|
94185
93998
|
isDrawingView() { return false; }
|
|
94186
93999
|
isSheetView() { return true; }
|
|
@@ -94189,41 +94002,53 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94189
94002
|
if (categories instanceof SheetViewState) {
|
|
94190
94003
|
// we are coming from clone...
|
|
94191
94004
|
this.sheetSize = categories.sheetSize.clone();
|
|
94192
|
-
this.
|
|
94005
|
+
this._viewAttachments = categories._viewAttachments.clone(iModel);
|
|
94193
94006
|
this._viewedExtents = categories._viewedExtents.clone();
|
|
94194
94007
|
}
|
|
94195
94008
|
else {
|
|
94196
94009
|
this.sheetSize = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(sheetProps.width, sheetProps.height);
|
|
94197
|
-
this.
|
|
94010
|
+
this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachments);
|
|
94198
94011
|
const extents = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);
|
|
94199
94012
|
const margin = 1.1;
|
|
94200
94013
|
extents.scaleAboutCenterInPlace(margin);
|
|
94201
94014
|
this._viewedExtents = extents;
|
|
94202
94015
|
}
|
|
94016
|
+
if (iModel.isBriefcaseConnection()) {
|
|
94017
|
+
iModel.txns.onElementsChanged.addListener(async (changes) => {
|
|
94018
|
+
let reload = false;
|
|
94019
|
+
for (const change of changes.filter({ includeMetadata: (meta) => meta.is("BisCore:ViewAttachment") })) {
|
|
94020
|
+
if (change.type === "inserted" || this._viewAttachments.attachmentIds.includes(change.id)) {
|
|
94021
|
+
reload = true;
|
|
94022
|
+
break;
|
|
94023
|
+
}
|
|
94024
|
+
}
|
|
94025
|
+
if (reload) {
|
|
94026
|
+
await this._viewAttachments.reload(this.baseModelId, iModel);
|
|
94027
|
+
this._onViewAttachmentsReloaded();
|
|
94028
|
+
this.onViewAttachmentsReloaded.raiseEvent();
|
|
94029
|
+
}
|
|
94030
|
+
});
|
|
94031
|
+
}
|
|
94203
94032
|
}
|
|
94204
94033
|
getOrigin() {
|
|
94205
94034
|
const origin = super.getOrigin();
|
|
94206
|
-
|
|
94207
|
-
origin.z = -this._attachments.maxDepth;
|
|
94035
|
+
origin.z = -this._viewAttachments.maxDepth;
|
|
94208
94036
|
return origin;
|
|
94209
94037
|
}
|
|
94210
94038
|
getExtents() {
|
|
94211
94039
|
const extents = super.getExtents();
|
|
94212
|
-
|
|
94213
|
-
extents.z = this._attachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
|
|
94040
|
+
extents.z = this._viewAttachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance;
|
|
94214
94041
|
return extents;
|
|
94215
94042
|
}
|
|
94216
94043
|
/** Overrides [[ViewState.discloseTileTrees]] to include tile trees associated with [ViewAttachment]($backend)s displayed on this sheet. */
|
|
94217
94044
|
discloseTileTrees(trees) {
|
|
94218
94045
|
super.discloseTileTrees(trees);
|
|
94219
|
-
|
|
94220
|
-
trees.disclose(this._attachments);
|
|
94046
|
+
trees.disclose(this._viewAttachments);
|
|
94221
94047
|
}
|
|
94222
94048
|
/** @internal */
|
|
94223
94049
|
collectNonTileTreeStatistics(stats) {
|
|
94224
94050
|
super.collectNonTileTreeStatistics(stats);
|
|
94225
|
-
|
|
94226
|
-
this._attachments.collectStatistics(stats);
|
|
94051
|
+
this._viewAttachments.collectStatistics(stats);
|
|
94227
94052
|
}
|
|
94228
94053
|
get defaultExtentLimits() {
|
|
94229
94054
|
return { min: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };
|
|
@@ -94234,36 +94059,23 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94234
94059
|
/** @internal */
|
|
94235
94060
|
preload(hydrateRequest) {
|
|
94236
94061
|
super.preload(hydrateRequest);
|
|
94237
|
-
this.
|
|
94062
|
+
this._viewAttachments.preload(hydrateRequest);
|
|
94238
94063
|
}
|
|
94239
94064
|
/** @internal */
|
|
94240
94065
|
async postload(hydrateResponse) {
|
|
94241
94066
|
const promises = [];
|
|
94242
94067
|
promises.push(super.postload(hydrateResponse));
|
|
94243
|
-
promises.push(this.
|
|
94068
|
+
promises.push(this._viewAttachments.postload(hydrateResponse, this.iModel));
|
|
94244
94069
|
await Promise.all(promises);
|
|
94245
94070
|
}
|
|
94246
94071
|
/** @internal */
|
|
94247
94072
|
createScene(context) {
|
|
94248
94073
|
super.createScene(context);
|
|
94249
|
-
|
|
94250
|
-
this._attachments.addToScene(context);
|
|
94074
|
+
this._viewAttachments.addToScene(context);
|
|
94251
94075
|
}
|
|
94252
94076
|
/** @internal */
|
|
94253
94077
|
get secondaryViewports() {
|
|
94254
|
-
|
|
94255
|
-
return super.secondaryViewports;
|
|
94256
|
-
const attachments = this._attachments;
|
|
94257
|
-
function* iterator() {
|
|
94258
|
-
for (const attachment of attachments) {
|
|
94259
|
-
const vp = attachment.viewport;
|
|
94260
|
-
if (vp)
|
|
94261
|
-
yield vp;
|
|
94262
|
-
}
|
|
94263
|
-
}
|
|
94264
|
-
return {
|
|
94265
|
-
[Symbol.iterator]: () => iterator(),
|
|
94266
|
-
};
|
|
94078
|
+
return this._viewAttachments.getSecondaryViewports();
|
|
94267
94079
|
}
|
|
94268
94080
|
/** @internal */
|
|
94269
94081
|
async queryAttachmentIds() {
|
|
@@ -94276,39 +94088,43 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94276
94088
|
async changeViewedModel(modelId) {
|
|
94277
94089
|
await super.changeViewedModel(modelId);
|
|
94278
94090
|
const attachmentIds = await this.queryAttachmentIds();
|
|
94279
|
-
this.
|
|
94280
|
-
|
|
94091
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewAttachments);
|
|
94092
|
+
this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachmentIds);
|
|
94281
94093
|
}
|
|
94282
94094
|
/** See [[ViewState.attachToViewport]]. */
|
|
94283
94095
|
attachToViewport(args) {
|
|
94284
94096
|
super.attachToViewport(args);
|
|
94285
|
-
|
|
94286
|
-
|
|
94097
|
+
this._viewAttachments.attachToViewport({
|
|
94098
|
+
backgroundColor: this.displayStyle.backgroundColor,
|
|
94099
|
+
sheetModelId: this.baseModelId,
|
|
94100
|
+
});
|
|
94101
|
+
this._onViewAttachmentsReloaded = () => args.invalidateController();
|
|
94287
94102
|
}
|
|
94288
94103
|
/** See [[ViewState.detachFromViewport]]. */
|
|
94289
94104
|
detachFromViewport() {
|
|
94290
94105
|
super.detachFromViewport();
|
|
94291
|
-
this.
|
|
94106
|
+
this._viewAttachments.detachFromViewport();
|
|
94107
|
+
this._onViewAttachmentsReloaded = () => undefined;
|
|
94292
94108
|
}
|
|
94293
94109
|
get areAllTileTreesLoaded() {
|
|
94110
|
+
if (!super.areAllTileTreesLoaded) {
|
|
94111
|
+
return false;
|
|
94112
|
+
}
|
|
94294
94113
|
let displayedExtents = this._viewedExtents;
|
|
94295
94114
|
const frustum = this.calculateFrustum();
|
|
94296
94115
|
if (frustum) {
|
|
94297
94116
|
displayedExtents = frustum.toRange();
|
|
94298
94117
|
}
|
|
94299
|
-
return
|
|
94118
|
+
return this._viewAttachments.areAllTileTreesLoaded(displayedExtents);
|
|
94300
94119
|
}
|
|
94301
94120
|
/** @internal Strictly for testing */
|
|
94302
94121
|
areAllAttachmentsLoaded() {
|
|
94303
|
-
|
|
94304
|
-
return this._attachments.areAllAttachmentsLoaded();
|
|
94305
|
-
}
|
|
94306
|
-
return true;
|
|
94122
|
+
return this._viewAttachments.areAllAttachmentsLoaded();
|
|
94307
94123
|
}
|
|
94308
94124
|
/** Create a sheet border decoration graphic. */
|
|
94309
94125
|
createBorder(width, height, context) {
|
|
94310
94126
|
const border = SheetBorder.create(width, height, context);
|
|
94311
|
-
const builder = context.createGraphicBuilder(
|
|
94127
|
+
const builder = context.createGraphicBuilder(_common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__.GraphicType.ViewBackground);
|
|
94312
94128
|
border.addToBuilder(builder);
|
|
94313
94129
|
return builder.finish();
|
|
94314
94130
|
}
|
|
@@ -94328,453 +94144,13 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94328
94144
|
}
|
|
94329
94145
|
/** @internal */
|
|
94330
94146
|
getAttachmentViewport(args) {
|
|
94331
|
-
|
|
94332
|
-
if (!attachment) {
|
|
94333
|
-
return undefined;
|
|
94334
|
-
}
|
|
94335
|
-
return args.inSectionDrawingAttachment ? attachment.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : attachment.viewport;
|
|
94147
|
+
return this._viewAttachments.getAttachmentViewport(args);
|
|
94336
94148
|
}
|
|
94337
94149
|
/** @beta */
|
|
94338
94150
|
computeDisplayTransform(args) {
|
|
94339
94151
|
// ###TODO we're currently ignoring model and element Id in args, assuming irrelevant for sheets.
|
|
94340
94152
|
// Should probably call super or have super call us.
|
|
94341
|
-
|
|
94342
|
-
if (!attachment || !(attachment instanceof OrthographicAttachment)) {
|
|
94343
|
-
return undefined;
|
|
94344
|
-
}
|
|
94345
|
-
const sheetTransform = attachment.toSheet;
|
|
94346
|
-
const sectionTransform = args.inSectionDrawingAttachment ? attachment.view.computeDisplayTransform(args) : undefined;
|
|
94347
|
-
if (!sectionTransform) {
|
|
94348
|
-
return sheetTransform.clone(args.output);
|
|
94349
|
-
}
|
|
94350
|
-
return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
|
|
94351
|
-
}
|
|
94352
|
-
}
|
|
94353
|
-
/** A mostly no-op RenderTarget for an Attachment.
|
|
94354
|
-
* its Scene and symbology overrides.
|
|
94355
|
-
*/
|
|
94356
|
-
class AttachmentTarget extends _internal_render_MockRender__WEBPACK_IMPORTED_MODULE_7__.MockRender.OffScreenTarget {
|
|
94357
|
-
_attachment;
|
|
94358
|
-
constructor(attachment) {
|
|
94359
|
-
// The dimensions don't matter - we're not drawing anything.
|
|
94360
|
-
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(1, 1);
|
|
94361
|
-
super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem, rect);
|
|
94362
|
-
this._attachment = attachment;
|
|
94363
|
-
}
|
|
94364
|
-
changeScene(scene) {
|
|
94365
|
-
this._attachment.scene = scene;
|
|
94366
|
-
}
|
|
94367
|
-
overrideFeatureSymbology(ovrs) {
|
|
94368
|
-
this._attachment.symbologyOverrides = ovrs;
|
|
94369
|
-
}
|
|
94370
|
-
}
|
|
94371
|
-
/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
|
|
94372
|
-
* We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
|
|
94373
|
-
* collect the resultant graphics and add them to the sheet view's scene.
|
|
94374
|
-
*/
|
|
94375
|
-
class OrthographicAttachment {
|
|
94376
|
-
_viewport;
|
|
94377
|
-
_props;
|
|
94378
|
-
_sheetModelId;
|
|
94379
|
-
_viewFlagOverrides;
|
|
94380
|
-
_toSheet;
|
|
94381
|
-
_fromSheet;
|
|
94382
|
-
_sizeInMeters;
|
|
94383
|
-
_range;
|
|
94384
|
-
_viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, 1, 1);
|
|
94385
|
-
_originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Frustum();
|
|
94386
|
-
_clipVolume;
|
|
94387
|
-
_hiddenLineSettings;
|
|
94388
|
-
_scale;
|
|
94389
|
-
_debugFeatureTable;
|
|
94390
|
-
scene;
|
|
94391
|
-
symbologyOverrides;
|
|
94392
|
-
zDepth;
|
|
94393
|
-
get view() {
|
|
94394
|
-
return this._viewport.view;
|
|
94395
|
-
}
|
|
94396
|
-
get viewAttachmentProps() {
|
|
94397
|
-
return this._props;
|
|
94398
|
-
}
|
|
94399
|
-
get viewport() {
|
|
94400
|
-
return this._viewport;
|
|
94401
|
-
}
|
|
94402
|
-
constructor(view, props, sheetView) {
|
|
94403
|
-
this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
|
|
94404
|
-
const target = new AttachmentTarget(this);
|
|
94405
|
-
this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport.createViewport(view, target, true);
|
|
94406
|
-
this._props = props;
|
|
94407
|
-
this._sheetModelId = sheetView.baseModelId;
|
|
94408
|
-
const applyClip = true; // set to false for debugging
|
|
94409
|
-
this._viewFlagOverrides = {
|
|
94410
|
-
...view.viewFlags,
|
|
94411
|
-
clipVolume: applyClip,
|
|
94412
|
-
lighting: false,
|
|
94413
|
-
shadows: false,
|
|
94414
|
-
};
|
|
94415
|
-
const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
|
|
94416
|
-
const range = placement.calculateRange();
|
|
94417
|
-
this._range = range;
|
|
94418
|
-
this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(range.xLength(), range.yLength());
|
|
94419
|
-
// Compute transform from attached view's world coordinates to sheet's world coordinates.
|
|
94420
|
-
// NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
|
|
94421
|
-
const applySkew = true; // set to false for debugging
|
|
94422
|
-
const skew = applySkew ? view.getAspectRatioSkew() : 1;
|
|
94423
|
-
const extents = this._viewport.viewingSpace.viewDelta.clone();
|
|
94424
|
-
const zDepth = Math.abs(extents.z);
|
|
94425
|
-
const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
|
|
94426
|
-
const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
|
|
94427
|
-
this._scale = { x: 1 / scaleX, y: 1 / scaleY };
|
|
94428
|
-
const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
94429
|
-
this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
|
|
94430
|
-
// View origin is at the *back* of the view. Align *front* of view based on display priority.
|
|
94431
|
-
const viewRot = view.getRotation();
|
|
94432
|
-
const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
|
|
94433
|
-
viewOrg.z += zDepth;
|
|
94434
|
-
viewRot.multiplyTransposeVectorInPlace(viewOrg);
|
|
94435
|
-
const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.createScale(scaleX, scaleY, 1);
|
|
94436
|
-
matrix.multiplyMatrixMatrix(viewRot, matrix);
|
|
94437
|
-
const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
|
|
94438
|
-
const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(placement.origin);
|
|
94439
|
-
attachmentOrigin.z = zBias;
|
|
94440
|
-
const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
|
|
94441
|
-
origin.addInPlace(viewOrgToAttachment);
|
|
94442
|
-
this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createRefs(origin, matrix);
|
|
94443
|
-
this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(this._toSheet.inverse());
|
|
94444
|
-
// If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
|
|
94445
|
-
// The clip needs to be transformed into sheet space.
|
|
94446
|
-
if (view.isDrawingView())
|
|
94447
|
-
this._viewport.drawingToSheetTransform = this._toSheet;
|
|
94448
|
-
// ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
|
|
94449
|
-
// However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
|
|
94450
|
-
// introduce additional computation, so possibly not worth it.
|
|
94451
|
-
// Transform the view's clip (if any) to sheet space
|
|
94452
|
-
let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
|
|
94453
|
-
if (viewClip)
|
|
94454
|
-
viewClip.transformInPlace(this._toSheet);
|
|
94455
|
-
else
|
|
94456
|
-
viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.createEmpty();
|
|
94457
|
-
let sheetClip;
|
|
94458
|
-
if (undefined !== props.jsonProperties?.clip)
|
|
94459
|
-
sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(props.jsonProperties?.clip);
|
|
94460
|
-
if (sheetClip && sheetClip.isValid) {
|
|
94461
|
-
// Clip to view attachment's clip. NB: clip is in sheet coordinate space.
|
|
94462
|
-
for (const clip of sheetClip.clips)
|
|
94463
|
-
viewClip.clips.push(clip);
|
|
94464
|
-
}
|
|
94465
|
-
else {
|
|
94466
|
-
// Clip to view attachment's bounding box
|
|
94467
|
-
viewClip.appendShape([
|
|
94468
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.low.y),
|
|
94469
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.low.y),
|
|
94470
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.high.y),
|
|
94471
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.high.y),
|
|
94472
|
-
]);
|
|
94473
|
-
}
|
|
94474
|
-
this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(viewClip);
|
|
94475
|
-
// Save off the original frustum (potentially adjusted by viewport).
|
|
94476
|
-
this._viewport.setupFromView();
|
|
94477
|
-
this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_10__.CoordSystem.World, true, this._originalFrustum);
|
|
94478
|
-
const applyHiddenLineSettings = true; // for debugging edge display, set to false...
|
|
94479
|
-
const style = view.displayStyle;
|
|
94480
|
-
if (style.is3d() && applyHiddenLineSettings)
|
|
94481
|
-
this._hiddenLineSettings = style.settings.hiddenLineSettings;
|
|
94482
|
-
}
|
|
94483
|
-
[Symbol.dispose]() {
|
|
94484
|
-
this._viewport[Symbol.dispose]();
|
|
94485
|
-
}
|
|
94486
|
-
discloseTileTrees(trees) {
|
|
94487
|
-
trees.disclose(this._viewport);
|
|
94488
|
-
}
|
|
94489
|
-
addToScene(context) {
|
|
94490
|
-
if (context.viewport.freezeScene)
|
|
94491
|
-
return;
|
|
94492
|
-
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
94493
|
-
return;
|
|
94494
|
-
const wantBounds = context.viewport.wantViewAttachmentBoundaries;
|
|
94495
|
-
const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
|
|
94496
|
-
if (wantBounds || wantClipShapes) {
|
|
94497
|
-
const builder = context.createSceneGraphicBuilder();
|
|
94498
|
-
if (wantBounds) {
|
|
94499
|
-
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
|
|
94500
|
-
builder.addRangeBox(this._range);
|
|
94501
|
-
}
|
|
94502
|
-
if (wantClipShapes && this._clipVolume) {
|
|
94503
|
-
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, 2);
|
|
94504
|
-
for (const prim of this._clipVolume.clipVector.clips) {
|
|
94505
|
-
if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipShape))
|
|
94506
|
-
continue; // ###TODO handle non-shape primitives, if any such ever encountered
|
|
94507
|
-
const pts = [];
|
|
94508
|
-
const tf = prim.transformFromClip;
|
|
94509
|
-
for (const pt of prim.polygon) {
|
|
94510
|
-
const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
|
|
94511
|
-
pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(tfPt.x, tfPt.y));
|
|
94512
|
-
}
|
|
94513
|
-
builder.addLineString2d(pts, 0);
|
|
94514
|
-
}
|
|
94515
|
-
}
|
|
94516
|
-
// Put into a Batch so that we can see tooltip with attachment Id on mouseover.
|
|
94517
|
-
const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
|
|
94518
|
-
context.outputGraphic(batch);
|
|
94519
|
-
}
|
|
94520
|
-
if (!context.viewport.wantViewAttachments)
|
|
94521
|
-
return;
|
|
94522
|
-
// Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
|
|
94523
|
-
const pixelSize = context.viewport.getPixelSizeAtPoint();
|
|
94524
|
-
if (0 === pixelSize)
|
|
94525
|
-
return;
|
|
94526
|
-
// Adjust attached view frustum based on intersection with sheet view frustum.
|
|
94527
|
-
const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
|
|
94528
|
-
const attachFrustumRange = attachFrustum.toRange();
|
|
94529
|
-
const sheetFrustum = context.viewport.getWorldFrustum();
|
|
94530
|
-
const sheetFrustumRange = sheetFrustum.toRange();
|
|
94531
|
-
const intersect = attachFrustumRange.intersect(sheetFrustumRange);
|
|
94532
|
-
if (intersect.isNull)
|
|
94533
|
-
return;
|
|
94534
|
-
attachFrustum.initFromRange(intersect);
|
|
94535
|
-
attachFrustum.transformBy(this._fromSheet, attachFrustum);
|
|
94536
|
-
this._viewport.setupViewFromFrustum(attachFrustum);
|
|
94537
|
-
// Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
|
|
94538
|
-
const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
|
|
94539
|
-
const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
|
|
94540
|
-
this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
|
|
94541
|
-
this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
|
|
94542
|
-
this._viewport.setRect(this._viewRect);
|
|
94543
|
-
// Propagate settings from on-screen viewport.
|
|
94544
|
-
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
94545
|
-
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
94546
|
-
// Create the scene.
|
|
94547
|
-
this._viewport.renderFrame();
|
|
94548
|
-
const scene = this.scene;
|
|
94549
|
-
if (!scene)
|
|
94550
|
-
return;
|
|
94551
|
-
// Extract scene graphics and insert into on-screen scene context.
|
|
94552
|
-
const options = {
|
|
94553
|
-
viewAttachmentId: this._props.id,
|
|
94554
|
-
clipVolume: this._clipVolume,
|
|
94555
|
-
hline: this._hiddenLineSettings,
|
|
94556
|
-
frustum: {
|
|
94557
|
-
is3d: this.view.is3d(),
|
|
94558
|
-
scale: this._scale,
|
|
94559
|
-
},
|
|
94560
|
-
};
|
|
94561
|
-
const outputGraphics = (source) => {
|
|
94562
|
-
if (0 === source.length)
|
|
94563
|
-
return;
|
|
94564
|
-
const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch();
|
|
94565
|
-
graphics.setViewFlagOverrides(this._viewFlagOverrides);
|
|
94566
|
-
graphics.symbologyOverrides = this.symbologyOverrides;
|
|
94567
|
-
for (const graphic of source)
|
|
94568
|
-
graphics.entries.push(graphic);
|
|
94569
|
-
const branch = context.createGraphicBranch(graphics, this._toSheet, options);
|
|
94570
|
-
context.outputGraphic(branch);
|
|
94571
|
-
};
|
|
94572
|
-
outputGraphics(scene.foreground);
|
|
94573
|
-
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
|
|
94574
|
-
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
|
|
94575
|
-
// Report tile statistics to sheet view's viewport.
|
|
94576
|
-
const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin;
|
|
94577
|
-
const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
|
|
94578
|
-
const requested = tileAdmin.getRequestsForUser(this._viewport);
|
|
94579
|
-
tileAdmin.addExternalTilesForUser(context.viewport, {
|
|
94580
|
-
requested: requested?.size ?? 0,
|
|
94581
|
-
selected: selectedAndReady?.selected.size ?? 0,
|
|
94582
|
-
ready: selectedAndReady?.ready.size ?? 0,
|
|
94583
|
-
});
|
|
94584
|
-
}
|
|
94585
|
-
getDebugFeatureTable() {
|
|
94586
|
-
if (this._debugFeatureTable)
|
|
94587
|
-
return this._debugFeatureTable;
|
|
94588
|
-
const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.FeatureTable(1, this._sheetModelId);
|
|
94589
|
-
featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Feature(this._props.id));
|
|
94590
|
-
this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable.pack(featureTable);
|
|
94591
|
-
return this._debugFeatureTable;
|
|
94592
|
-
}
|
|
94593
|
-
get areAllTileTreesLoaded() {
|
|
94594
|
-
return this.view.areAllTileTreesLoaded;
|
|
94595
|
-
}
|
|
94596
|
-
collectStatistics(_stats) {
|
|
94597
|
-
// Handled by discloseTileTrees()
|
|
94598
|
-
}
|
|
94599
|
-
get toSheet() {
|
|
94600
|
-
return this._toSheet;
|
|
94601
|
-
}
|
|
94602
|
-
}
|
|
94603
|
-
function createRasterAttachmentViewport(_view, _rect, _attachment) {
|
|
94604
|
-
class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport {
|
|
94605
|
-
_sceneContext;
|
|
94606
|
-
_isSceneReady = false;
|
|
94607
|
-
_attachment;
|
|
94608
|
-
constructor(view, rect, attachment) {
|
|
94609
|
-
super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createOffscreenTarget(rect));
|
|
94610
|
-
this._attachment = attachment;
|
|
94611
|
-
this._isAspectRatioLocked = true;
|
|
94612
|
-
this.changeView(view);
|
|
94613
|
-
}
|
|
94614
|
-
createSceneContext() {
|
|
94615
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
|
|
94616
|
-
this._sceneContext = super.createSceneContext();
|
|
94617
|
-
return this._sceneContext;
|
|
94618
|
-
}
|
|
94619
|
-
renderFrame() {
|
|
94620
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
|
|
94621
|
-
this.clearSceneContext();
|
|
94622
|
-
super.renderFrame();
|
|
94623
|
-
if (undefined !== this._sceneContext) {
|
|
94624
|
-
this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
|
|
94625
|
-
if (this._isSceneReady)
|
|
94626
|
-
this._attachment.produceGraphics(this._sceneContext);
|
|
94627
|
-
this._sceneContext = undefined;
|
|
94628
|
-
}
|
|
94629
|
-
}
|
|
94630
|
-
clearSceneContext() {
|
|
94631
|
-
this._sceneContext = undefined;
|
|
94632
|
-
}
|
|
94633
|
-
addDecorations(_decorations) {
|
|
94634
|
-
// ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
|
|
94635
|
-
}
|
|
94636
|
-
}
|
|
94637
|
-
return new RasterAttachmentViewport(_view, _rect, _attachment);
|
|
94638
|
-
}
|
|
94639
|
-
/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */
|
|
94640
|
-
class RasterAttachment {
|
|
94641
|
-
_props;
|
|
94642
|
-
_placement;
|
|
94643
|
-
_transform;
|
|
94644
|
-
zDepth;
|
|
94645
|
-
_viewport;
|
|
94646
|
-
_graphics;
|
|
94647
|
-
constructor(view, props, sheetView) {
|
|
94648
|
-
// Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
|
|
94649
|
-
const maxSize = 2048;
|
|
94650
|
-
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, maxSize, maxSize);
|
|
94651
|
-
const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
|
|
94652
|
-
const skew = maxSize / height;
|
|
94653
|
-
view.setAspectRatioSkew(skew);
|
|
94654
|
-
if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
|
|
94655
|
-
// Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
|
|
94656
|
-
const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);
|
|
94657
|
-
view.displayStyle.backgroundColor = bgColor;
|
|
94658
|
-
}
|
|
94659
|
-
this._viewport = createRasterAttachmentViewport(view, rect, this);
|
|
94660
|
-
this._props = props;
|
|
94661
|
-
this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
|
|
94662
|
-
this._transform = this._placement.transform;
|
|
94663
|
-
this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
94664
|
-
}
|
|
94665
|
-
[Symbol.dispose]() {
|
|
94666
|
-
this._viewport?.[Symbol.dispose]();
|
|
94667
|
-
}
|
|
94668
|
-
get viewAttachmentProps() {
|
|
94669
|
-
return this._props;
|
|
94670
|
-
}
|
|
94671
|
-
get viewport() {
|
|
94672
|
-
return this._viewport;
|
|
94673
|
-
}
|
|
94674
|
-
get areAllTileTreesLoaded() {
|
|
94675
|
-
return this._viewport?.areAllTileTreesLoaded ?? true;
|
|
94676
|
-
}
|
|
94677
|
-
addToScene(context) {
|
|
94678
|
-
// ###TODO: check viewport.wantViewAttachmentClipShapes
|
|
94679
|
-
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
94680
|
-
return;
|
|
94681
|
-
if (context.viewport.wantViewAttachmentBoundaries) {
|
|
94682
|
-
const builder = context.createSceneGraphicBuilder(this._transform);
|
|
94683
|
-
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
|
|
94684
|
-
builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d.createRange2d(this._placement.bbox));
|
|
94685
|
-
context.outputGraphic(builder.finish());
|
|
94686
|
-
}
|
|
94687
|
-
if (!context.viewport.wantViewAttachments)
|
|
94688
|
-
return;
|
|
94689
|
-
if (this._graphics) {
|
|
94690
|
-
context.outputGraphic(this._graphics);
|
|
94691
|
-
return;
|
|
94692
|
-
}
|
|
94693
|
-
if (undefined === this._viewport)
|
|
94694
|
-
return;
|
|
94695
|
-
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
94696
|
-
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
94697
|
-
this._viewport.renderFrame();
|
|
94698
|
-
if (this._graphics)
|
|
94699
|
-
context.outputGraphic(this._graphics);
|
|
94700
|
-
}
|
|
94701
|
-
discloseTileTrees(trees) {
|
|
94702
|
-
if (this._viewport)
|
|
94703
|
-
trees.disclose(this._viewport);
|
|
94704
|
-
}
|
|
94705
|
-
produceGraphics(context) {
|
|
94706
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(context.viewport === this._viewport);
|
|
94707
|
-
this._graphics = this.createGraphics(this._viewport);
|
|
94708
|
-
this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewport);
|
|
94709
|
-
if (undefined !== this._graphics)
|
|
94710
|
-
context.outputGraphic(this._graphics);
|
|
94711
|
-
}
|
|
94712
|
-
createGraphics(vp) {
|
|
94713
|
-
// Create a texture from the contents of the view.
|
|
94714
|
-
const image = vp.readImageBuffer({ upsideDown: true });
|
|
94715
|
-
if (undefined === image)
|
|
94716
|
-
return undefined;
|
|
94717
|
-
const debugImage = false; // set to true to open a window displaying the captured image.
|
|
94718
|
-
if (debugImage) {
|
|
94719
|
-
const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.imageBufferToPngDataUrl)(image, false);
|
|
94720
|
-
if (url)
|
|
94721
|
-
(0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.openImageDataUrlInNewWindow)(url, "Attachment");
|
|
94722
|
-
}
|
|
94723
|
-
const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createTexture({
|
|
94724
|
-
image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.TextureTransparency.Opaque },
|
|
94725
|
-
});
|
|
94726
|
-
if (!texture)
|
|
94727
|
-
return undefined;
|
|
94728
|
-
// Create a material for the texture
|
|
94729
|
-
const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.GraphicParams();
|
|
94730
|
-
graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
|
|
94731
|
-
// Apply the texture to a rectangular polyface.
|
|
94732
|
-
const depth = this.zDepth;
|
|
94733
|
-
const east = this._placement.bbox.low.x;
|
|
94734
|
-
const west = this._placement.bbox.high.x;
|
|
94735
|
-
const north = this._placement.bbox.low.y;
|
|
94736
|
-
const south = this._placement.bbox.high.y;
|
|
94737
|
-
const corners = [
|
|
94738
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, north, depth),
|
|
94739
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, north, depth),
|
|
94740
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, south, depth),
|
|
94741
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, south, depth),
|
|
94742
|
-
];
|
|
94743
|
-
const params = [
|
|
94744
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 0),
|
|
94745
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 0),
|
|
94746
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 1),
|
|
94747
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 1),
|
|
94748
|
-
];
|
|
94749
|
-
const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.StrokeOptions();
|
|
94750
|
-
strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
|
|
94751
|
-
const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.PolyfaceBuilder.create(strokeOptions);
|
|
94752
|
-
polyfaceBuilder.addQuadFacet(corners, params);
|
|
94753
|
-
const polyface = polyfaceBuilder.claimPolyface();
|
|
94754
|
-
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);
|
|
94755
|
-
graphicBuilder.activateGraphicParams(graphicParams);
|
|
94756
|
-
graphicBuilder.addPolyface(polyface, false);
|
|
94757
|
-
const graphic = graphicBuilder.finish();
|
|
94758
|
-
// Wrap the polyface in a GraphicBranch.
|
|
94759
|
-
const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch(true);
|
|
94760
|
-
const vfOvrs = (0,_tile_internal__WEBPACK_IMPORTED_MODULE_13__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
|
|
94761
|
-
// Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
|
|
94762
|
-
vfOvrs.transparency = false;
|
|
94763
|
-
branch.setViewFlagOverrides(vfOvrs);
|
|
94764
|
-
branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
|
|
94765
|
-
branch.entries.push(graphic);
|
|
94766
|
-
// Apply the attachment's clip, if any.
|
|
94767
|
-
let clipVolume;
|
|
94768
|
-
if (this._props.jsonProperties?.clip) {
|
|
94769
|
-
const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
|
|
94770
|
-
if (clipVector.isValid)
|
|
94771
|
-
clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(clipVector);
|
|
94772
|
-
}
|
|
94773
|
-
return _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
|
|
94774
|
-
}
|
|
94775
|
-
collectStatistics(stats) {
|
|
94776
|
-
if (this._graphics)
|
|
94777
|
-
this._graphics.collectStatistics(stats);
|
|
94153
|
+
return this._viewAttachments.computeDisplayTransform(args);
|
|
94778
94154
|
}
|
|
94779
94155
|
}
|
|
94780
94156
|
|
|
@@ -95374,7 +94750,46 @@ class SubCategoriesCache {
|
|
|
95374
94750
|
_appearances = new Map();
|
|
95375
94751
|
_imodel;
|
|
95376
94752
|
_missingAtTimeOfPreload;
|
|
95377
|
-
constructor(imodel) {
|
|
94753
|
+
constructor(imodel) {
|
|
94754
|
+
this._imodel = imodel;
|
|
94755
|
+
}
|
|
94756
|
+
attachToBriefcase(imodel) {
|
|
94757
|
+
// We want to do this in the constructor but can't, because IModelConnection.subcategories is initialized before
|
|
94758
|
+
// BriefcaseConnection.txns.
|
|
94759
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(imodel === this._imodel);
|
|
94760
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(imodel.isBriefcaseConnection());
|
|
94761
|
+
imodel.txns.onElementsChanged.addListener((changes) => {
|
|
94762
|
+
const affectedSubCategories = new Set();
|
|
94763
|
+
for (const change of changes) {
|
|
94764
|
+
if (change.metadata.is("BisCore:Category")) {
|
|
94765
|
+
if (change.type === "deleted") {
|
|
94766
|
+
this._byCategoryId.delete(change.id);
|
|
94767
|
+
}
|
|
94768
|
+
}
|
|
94769
|
+
else if (change.metadata.is("BisCore:SubCategory")) {
|
|
94770
|
+
if (change.type === "inserted") {
|
|
94771
|
+
// We don't know to which category the subcategory belongs. Blow away the entire cache.
|
|
94772
|
+
this._byCategoryId.clear();
|
|
94773
|
+
this._appearances.clear();
|
|
94774
|
+
return;
|
|
94775
|
+
}
|
|
94776
|
+
this._appearances.delete(change.id);
|
|
94777
|
+
affectedSubCategories.add(change.id);
|
|
94778
|
+
}
|
|
94779
|
+
}
|
|
94780
|
+
if (affectedSubCategories.size > 0) {
|
|
94781
|
+
for (const [catId, subCatIds] of this._byCategoryId) {
|
|
94782
|
+
for (const subCatId of affectedSubCategories) {
|
|
94783
|
+
if (subCatIds.has(subCatId)) {
|
|
94784
|
+
this._byCategoryId.delete(catId);
|
|
94785
|
+
affectedSubCategories.delete(subCatId);
|
|
94786
|
+
break;
|
|
94787
|
+
}
|
|
94788
|
+
}
|
|
94789
|
+
}
|
|
94790
|
+
}
|
|
94791
|
+
});
|
|
94792
|
+
}
|
|
95378
94793
|
/** Get the Ids of all subcategories belonging to the category with the specified Id, or undefined if no such information is present. */
|
|
95379
94794
|
getSubCategories(categoryId) { return this._byCategoryId.get(categoryId); }
|
|
95380
94795
|
/** Get the base appearance of the subcategory with the specified Id, or undefined if no such information is present. */
|
|
@@ -113611,6 +113026,845 @@ function getAllElementIdsFromScript(script) {
|
|
|
113611
113026
|
}
|
|
113612
113027
|
|
|
113613
113028
|
|
|
113029
|
+
/***/ }),
|
|
113030
|
+
|
|
113031
|
+
/***/ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js":
|
|
113032
|
+
/*!********************************************************************!*\
|
|
113033
|
+
!*** ../../core/frontend/lib/esm/internal/SheetViewAttachments.js ***!
|
|
113034
|
+
\********************************************************************/
|
|
113035
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
113036
|
+
|
|
113037
|
+
"use strict";
|
|
113038
|
+
__webpack_require__.r(__webpack_exports__);
|
|
113039
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
113040
|
+
/* harmony export */ SheetViewAttachments: () => (/* binding */ SheetViewAttachments)
|
|
113041
|
+
/* harmony export */ });
|
|
113042
|
+
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
113043
|
+
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
113044
|
+
/* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
|
|
113045
|
+
/* harmony import */ var _ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ViewAttachmentRenderer */ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js");
|
|
113046
|
+
/* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
|
|
113047
|
+
/*---------------------------------------------------------------------------------------------
|
|
113048
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
113049
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
113050
|
+
*--------------------------------------------------------------------------------------------*/
|
|
113051
|
+
/** @packageDocumentation
|
|
113052
|
+
* @module Views
|
|
113053
|
+
*/
|
|
113054
|
+
|
|
113055
|
+
|
|
113056
|
+
|
|
113057
|
+
|
|
113058
|
+
|
|
113059
|
+
/** Stateless state for a sheet that has no view attachments. */
|
|
113060
|
+
class EmptyAttachments {
|
|
113061
|
+
// We only need one instance of this stateless class.
|
|
113062
|
+
static _instance;
|
|
113063
|
+
static get() {
|
|
113064
|
+
return this._instance ?? (this._instance = new EmptyAttachments());
|
|
113065
|
+
}
|
|
113066
|
+
constructor() { }
|
|
113067
|
+
clone() {
|
|
113068
|
+
return this;
|
|
113069
|
+
}
|
|
113070
|
+
preload() { }
|
|
113071
|
+
async postload() {
|
|
113072
|
+
return this;
|
|
113073
|
+
}
|
|
113074
|
+
get attachmentIds() {
|
|
113075
|
+
return [];
|
|
113076
|
+
}
|
|
113077
|
+
}
|
|
113078
|
+
/** Holds the element Ids of the view attachments to be loaded for display. */
|
|
113079
|
+
class AttachmentIds {
|
|
113080
|
+
_ids;
|
|
113081
|
+
constructor(ids) {
|
|
113082
|
+
this._ids = ids;
|
|
113083
|
+
}
|
|
113084
|
+
get attachmentIds() {
|
|
113085
|
+
return this._ids;
|
|
113086
|
+
}
|
|
113087
|
+
clone() {
|
|
113088
|
+
return new AttachmentIds([...this._ids]);
|
|
113089
|
+
}
|
|
113090
|
+
preload(request) {
|
|
113091
|
+
request.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.CompressedId64Set.sortAndCompress(this._ids);
|
|
113092
|
+
request.viewStateLoadProps = {
|
|
113093
|
+
displayStyle: {
|
|
113094
|
+
omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
|
|
113095
|
+
compressExcludedElementIds: true,
|
|
113096
|
+
},
|
|
113097
|
+
};
|
|
113098
|
+
}
|
|
113099
|
+
async postload(response, iModel) {
|
|
113100
|
+
if (undefined === response.sheetViewViews || undefined === response.sheetViewAttachmentProps) {
|
|
113101
|
+
return this;
|
|
113102
|
+
}
|
|
113103
|
+
const viewStateProps = response.sheetViewViews;
|
|
113104
|
+
const promises = [];
|
|
113105
|
+
for (const viewProps of viewStateProps) {
|
|
113106
|
+
const loadView = async () => {
|
|
113107
|
+
try {
|
|
113108
|
+
if (viewProps === undefined)
|
|
113109
|
+
return undefined;
|
|
113110
|
+
const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
|
|
113111
|
+
return view;
|
|
113112
|
+
}
|
|
113113
|
+
catch {
|
|
113114
|
+
return undefined;
|
|
113115
|
+
}
|
|
113116
|
+
};
|
|
113117
|
+
promises.push(loadView());
|
|
113118
|
+
}
|
|
113119
|
+
const views = await Promise.all(promises);
|
|
113120
|
+
const attachmentProps = response.sheetViewAttachmentProps;
|
|
113121
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
|
|
113122
|
+
const infos = [];
|
|
113123
|
+
for (let i = 0; i < views.length; i++) {
|
|
113124
|
+
const view = views[i];
|
|
113125
|
+
if (view && !(view.isSheetView())) {
|
|
113126
|
+
const props = attachmentProps[i];
|
|
113127
|
+
props.attachedView = view;
|
|
113128
|
+
infos.push(props);
|
|
113129
|
+
}
|
|
113130
|
+
}
|
|
113131
|
+
return new AttachmentInfos(infos);
|
|
113132
|
+
}
|
|
113133
|
+
}
|
|
113134
|
+
/** Fully loaded view attachments. */
|
|
113135
|
+
class AttachmentInfos {
|
|
113136
|
+
infos;
|
|
113137
|
+
constructor(infos) {
|
|
113138
|
+
this.infos = infos;
|
|
113139
|
+
}
|
|
113140
|
+
get attachmentIds() {
|
|
113141
|
+
return this.infos.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.expectDefined)(x.id));
|
|
113142
|
+
}
|
|
113143
|
+
clone(iModel) {
|
|
113144
|
+
const infos = this.infos.map((info) => {
|
|
113145
|
+
return {
|
|
113146
|
+
...info,
|
|
113147
|
+
attachedView: info.attachedView.clone(iModel),
|
|
113148
|
+
};
|
|
113149
|
+
});
|
|
113150
|
+
return new AttachmentInfos(infos);
|
|
113151
|
+
}
|
|
113152
|
+
preload() {
|
|
113153
|
+
// already loaded.
|
|
113154
|
+
}
|
|
113155
|
+
async postload() {
|
|
113156
|
+
// already loaded.
|
|
113157
|
+
return this;
|
|
113158
|
+
}
|
|
113159
|
+
}
|
|
113160
|
+
/** Reloads the attachments after a change to the database. */
|
|
113161
|
+
async function reloadAttachments(sheetModelId, iModel) {
|
|
113162
|
+
const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${sheetModelId}`;
|
|
113163
|
+
const ids = [];
|
|
113164
|
+
for await (const row of iModel.createQueryReader(ecsql)) {
|
|
113165
|
+
ids.push(row[0]);
|
|
113166
|
+
}
|
|
113167
|
+
const attachmentProps = await iModel.elements.getProps(ids);
|
|
113168
|
+
const promises = [];
|
|
113169
|
+
for (const attachment of attachmentProps) {
|
|
113170
|
+
const loadView = async () => {
|
|
113171
|
+
try {
|
|
113172
|
+
const view = await iModel.views.load(attachment.view.id);
|
|
113173
|
+
return view;
|
|
113174
|
+
}
|
|
113175
|
+
catch {
|
|
113176
|
+
return undefined;
|
|
113177
|
+
}
|
|
113178
|
+
};
|
|
113179
|
+
promises.push(loadView());
|
|
113180
|
+
}
|
|
113181
|
+
const views = await Promise.all(promises);
|
|
113182
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
|
|
113183
|
+
const infos = [];
|
|
113184
|
+
for (let i = 0; i < views.length; i++) {
|
|
113185
|
+
const view = views[i];
|
|
113186
|
+
if (view && !view.isSheetView()) {
|
|
113187
|
+
const props = attachmentProps[i];
|
|
113188
|
+
props.attachedView = view;
|
|
113189
|
+
infos.push(props);
|
|
113190
|
+
}
|
|
113191
|
+
}
|
|
113192
|
+
return new AttachmentInfos(infos);
|
|
113193
|
+
}
|
|
113194
|
+
function disposeRenderers(renderers) {
|
|
113195
|
+
if (renderers) {
|
|
113196
|
+
for (const renderer of renderers) {
|
|
113197
|
+
renderer[Symbol.dispose]();
|
|
113198
|
+
}
|
|
113199
|
+
}
|
|
113200
|
+
}
|
|
113201
|
+
/** Manages the set of ViewAttachment elements to be rendered by a SheetViewState.
|
|
113202
|
+
* Takes care of reloading them after ViewAttachment elements are modified, deleted, or inserted.
|
|
113203
|
+
*/
|
|
113204
|
+
class SheetViewAttachments {
|
|
113205
|
+
_impl;
|
|
113206
|
+
_reload;
|
|
113207
|
+
_maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
|
|
113208
|
+
_rendererArgs;
|
|
113209
|
+
_renderers;
|
|
113210
|
+
get maxDepth() {
|
|
113211
|
+
return this._maxDepth;
|
|
113212
|
+
}
|
|
113213
|
+
*getSecondaryViewports() {
|
|
113214
|
+
if (this._renderers) {
|
|
113215
|
+
for (const renderer of this._renderers) {
|
|
113216
|
+
if (renderer.viewport) {
|
|
113217
|
+
yield renderer.viewport;
|
|
113218
|
+
}
|
|
113219
|
+
}
|
|
113220
|
+
}
|
|
113221
|
+
}
|
|
113222
|
+
constructor(impl) {
|
|
113223
|
+
this._impl = impl;
|
|
113224
|
+
}
|
|
113225
|
+
[Symbol.dispose]() {
|
|
113226
|
+
disposeRenderers(this._renderers);
|
|
113227
|
+
this._renderers = this._rendererArgs = undefined;
|
|
113228
|
+
this._reload = undefined;
|
|
113229
|
+
}
|
|
113230
|
+
static create(attachmentIds) {
|
|
113231
|
+
const impl = attachmentIds.length === 0 ? EmptyAttachments.get() : new AttachmentIds([...attachmentIds]);
|
|
113232
|
+
return new this(impl);
|
|
113233
|
+
}
|
|
113234
|
+
get attachmentIds() {
|
|
113235
|
+
return this._impl.attachmentIds;
|
|
113236
|
+
}
|
|
113237
|
+
clone(iModel) {
|
|
113238
|
+
return new SheetViewAttachments(this._impl.clone(iModel));
|
|
113239
|
+
}
|
|
113240
|
+
preload(request) {
|
|
113241
|
+
this._impl.preload(request);
|
|
113242
|
+
}
|
|
113243
|
+
async postload(response, iModel) {
|
|
113244
|
+
this._impl = await this._impl.postload(response, iModel);
|
|
113245
|
+
}
|
|
113246
|
+
async reload(sheetModelId, iModel) {
|
|
113247
|
+
const renderers = this._renderers;
|
|
113248
|
+
const reload = this._reload = reloadAttachments(sheetModelId, iModel);
|
|
113249
|
+
const impl = await this._reload;
|
|
113250
|
+
// We keep the previous renderers until reloading completes, to avoid drawing a blank view while waiting.
|
|
113251
|
+
// Afterward, always destroy the previous renderers.
|
|
113252
|
+
disposeRenderers(renderers);
|
|
113253
|
+
// If reload was not called again while we waited...
|
|
113254
|
+
if (this._reload === reload) {
|
|
113255
|
+
this._impl = impl;
|
|
113256
|
+
this._reload = this._renderers = undefined;
|
|
113257
|
+
if (this._rendererArgs) {
|
|
113258
|
+
// We are attached to a Viewport - reload the renderers.
|
|
113259
|
+
this.loadRenderers();
|
|
113260
|
+
}
|
|
113261
|
+
}
|
|
113262
|
+
}
|
|
113263
|
+
attachToViewport(args) {
|
|
113264
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
|
|
113265
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._rendererArgs);
|
|
113266
|
+
this._rendererArgs = args;
|
|
113267
|
+
this.loadRenderers();
|
|
113268
|
+
}
|
|
113269
|
+
detachFromViewport() {
|
|
113270
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== this._rendererArgs);
|
|
113271
|
+
this._rendererArgs = undefined;
|
|
113272
|
+
disposeRenderers(this._renderers);
|
|
113273
|
+
this._renderers = undefined;
|
|
113274
|
+
}
|
|
113275
|
+
areAllTileTreesLoaded(displayedExtents) {
|
|
113276
|
+
if (this._reload) {
|
|
113277
|
+
return false;
|
|
113278
|
+
}
|
|
113279
|
+
else if (!this._renderers) {
|
|
113280
|
+
return true;
|
|
113281
|
+
}
|
|
113282
|
+
return this._renderers.every((renderer) => {
|
|
113283
|
+
const attachmentRange = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(renderer.viewAttachmentProps.placement).calculateRange();
|
|
113284
|
+
return !attachmentRange.intersectsRangeXY(displayedExtents) || renderer.areAllTileTreesLoaded;
|
|
113285
|
+
});
|
|
113286
|
+
}
|
|
113287
|
+
discloseTileTrees(trees) {
|
|
113288
|
+
for (const renderer of this.renderers()) {
|
|
113289
|
+
trees.disclose(renderer);
|
|
113290
|
+
}
|
|
113291
|
+
}
|
|
113292
|
+
collectStatistics(stats) {
|
|
113293
|
+
for (const renderer of this.renderers()) {
|
|
113294
|
+
renderer.collectStatistics(stats);
|
|
113295
|
+
}
|
|
113296
|
+
}
|
|
113297
|
+
addToScene(context) {
|
|
113298
|
+
for (const renderer of this.renderers()) {
|
|
113299
|
+
renderer.addToScene(context);
|
|
113300
|
+
}
|
|
113301
|
+
}
|
|
113302
|
+
getAttachmentViewport(args) {
|
|
113303
|
+
const renderer = args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
|
|
113304
|
+
if (!renderer) {
|
|
113305
|
+
return undefined;
|
|
113306
|
+
}
|
|
113307
|
+
return args.inSectionDrawingAttachment ? renderer.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : renderer.viewport;
|
|
113308
|
+
}
|
|
113309
|
+
computeDisplayTransform(args) {
|
|
113310
|
+
const renderer = undefined !== args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
|
|
113311
|
+
const ortho = renderer?.ortho;
|
|
113312
|
+
const sheetTransform = ortho?.toSheet;
|
|
113313
|
+
if (!sheetTransform) {
|
|
113314
|
+
return undefined;
|
|
113315
|
+
}
|
|
113316
|
+
const sectionTransform = args.inSectionDrawingAttachment ? ortho.view.computeDisplayTransform(args) : undefined;
|
|
113317
|
+
if (!sectionTransform) {
|
|
113318
|
+
return sheetTransform.clone(args.output);
|
|
113319
|
+
}
|
|
113320
|
+
return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
|
|
113321
|
+
}
|
|
113322
|
+
/** Strictly for tests. */
|
|
113323
|
+
areAllAttachmentsLoaded() {
|
|
113324
|
+
return !this._reload && (!this._renderers || this._renderers.every((x) => x.areAllTileTreesLoaded));
|
|
113325
|
+
}
|
|
113326
|
+
/** Strictly for tests. */
|
|
113327
|
+
get attachments() {
|
|
113328
|
+
return this._renderers;
|
|
113329
|
+
}
|
|
113330
|
+
/** Strictly for tests. */
|
|
113331
|
+
get attachmentProps() {
|
|
113332
|
+
const infos = this._impl.infos;
|
|
113333
|
+
if (!infos) {
|
|
113334
|
+
return [];
|
|
113335
|
+
}
|
|
113336
|
+
return infos.map((x) => {
|
|
113337
|
+
return {
|
|
113338
|
+
...x,
|
|
113339
|
+
attachedView: undefined,
|
|
113340
|
+
};
|
|
113341
|
+
});
|
|
113342
|
+
}
|
|
113343
|
+
/** Strictly for tests. */
|
|
113344
|
+
get attachmentInfos() {
|
|
113345
|
+
const infos = this._impl.infos;
|
|
113346
|
+
return infos ?? this._impl.attachmentIds;
|
|
113347
|
+
}
|
|
113348
|
+
loadRenderers() {
|
|
113349
|
+
const args = this._rendererArgs;
|
|
113350
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== args);
|
|
113351
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
|
|
113352
|
+
this._maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
|
|
113353
|
+
const infos = this._impl.infos;
|
|
113354
|
+
if (!infos) {
|
|
113355
|
+
return;
|
|
113356
|
+
}
|
|
113357
|
+
this._renderers = infos.map((info) => {
|
|
113358
|
+
const renderer = (0,_ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__.createViewAttachmentRenderer)({
|
|
113359
|
+
...args,
|
|
113360
|
+
props: info,
|
|
113361
|
+
view: info.attachedView,
|
|
113362
|
+
});
|
|
113363
|
+
this._maxDepth = Math.max(this._maxDepth, renderer.zDepth);
|
|
113364
|
+
return renderer;
|
|
113365
|
+
});
|
|
113366
|
+
}
|
|
113367
|
+
*renderers() {
|
|
113368
|
+
if (this._renderers) {
|
|
113369
|
+
for (const renderer of this._renderers) {
|
|
113370
|
+
yield renderer;
|
|
113371
|
+
}
|
|
113372
|
+
}
|
|
113373
|
+
}
|
|
113374
|
+
findRendererById(id) {
|
|
113375
|
+
return this._renderers?.find((x) => x.viewAttachmentProps.id === id);
|
|
113376
|
+
}
|
|
113377
|
+
}
|
|
113378
|
+
|
|
113379
|
+
|
|
113380
|
+
/***/ }),
|
|
113381
|
+
|
|
113382
|
+
/***/ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js":
|
|
113383
|
+
/*!**********************************************************************!*\
|
|
113384
|
+
!*** ../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js ***!
|
|
113385
|
+
\**********************************************************************/
|
|
113386
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
113387
|
+
|
|
113388
|
+
"use strict";
|
|
113389
|
+
__webpack_require__.r(__webpack_exports__);
|
|
113390
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
113391
|
+
/* harmony export */ createViewAttachmentRenderer: () => (/* binding */ createViewAttachmentRenderer)
|
|
113392
|
+
/* harmony export */ });
|
|
113393
|
+
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
113394
|
+
/* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
|
|
113395
|
+
/* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
|
|
113396
|
+
/* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
|
|
113397
|
+
/* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Viewport */ "../../core/frontend/lib/esm/Viewport.js");
|
|
113398
|
+
/* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
|
|
113399
|
+
/* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
|
|
113400
|
+
/* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
|
|
113401
|
+
/* harmony import */ var _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../render/FeatureSymbology */ "../../core/frontend/lib/esm/render/FeatureSymbology.js");
|
|
113402
|
+
/* harmony import */ var _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../render/GraphicBranch */ "../../core/frontend/lib/esm/render/GraphicBranch.js");
|
|
113403
|
+
/* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
|
|
113404
|
+
/* harmony import */ var _render_MockRender__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./render/MockRender */ "../../core/frontend/lib/esm/internal/render/MockRender.js");
|
|
113405
|
+
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
113406
|
+
/* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
|
|
113407
|
+
/* harmony import */ var _tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tile/ViewFlagOverrides */ "../../core/frontend/lib/esm/internal/tile/ViewFlagOverrides.js");
|
|
113408
|
+
/*---------------------------------------------------------------------------------------------
|
|
113409
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
113410
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
113411
|
+
*--------------------------------------------------------------------------------------------*/
|
|
113412
|
+
/** @packageDocumentation
|
|
113413
|
+
* @module Views
|
|
113414
|
+
*/
|
|
113415
|
+
|
|
113416
|
+
|
|
113417
|
+
|
|
113418
|
+
|
|
113419
|
+
|
|
113420
|
+
|
|
113421
|
+
|
|
113422
|
+
|
|
113423
|
+
|
|
113424
|
+
|
|
113425
|
+
|
|
113426
|
+
|
|
113427
|
+
|
|
113428
|
+
|
|
113429
|
+
|
|
113430
|
+
function createViewAttachmentRenderer(args) {
|
|
113431
|
+
const { props, view } = args;
|
|
113432
|
+
if (props.jsonProperties?.displayOptions?.drawAsRaster || (view.is3d() && view.isCameraOn)) {
|
|
113433
|
+
return new RasterAttachment(view, props, args.backgroundColor);
|
|
113434
|
+
}
|
|
113435
|
+
else {
|
|
113436
|
+
return new OrthographicAttachment(view, props, args.sheetModelId);
|
|
113437
|
+
}
|
|
113438
|
+
}
|
|
113439
|
+
/** A mostly no-op RenderTarget for an OrthographicAttachment. */
|
|
113440
|
+
class AttachmentTarget extends _render_MockRender__WEBPACK_IMPORTED_MODULE_11__.MockRender.OffScreenTarget {
|
|
113441
|
+
_attachment;
|
|
113442
|
+
constructor(attachment) {
|
|
113443
|
+
// The dimensions don't matter - we're not drawing anything.
|
|
113444
|
+
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(1, 1);
|
|
113445
|
+
super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem, rect);
|
|
113446
|
+
this._attachment = attachment;
|
|
113447
|
+
}
|
|
113448
|
+
changeScene(scene) {
|
|
113449
|
+
this._attachment.scene = scene;
|
|
113450
|
+
}
|
|
113451
|
+
overrideFeatureSymbology(ovrs) {
|
|
113452
|
+
this._attachment.symbologyOverrides = ovrs;
|
|
113453
|
+
}
|
|
113454
|
+
}
|
|
113455
|
+
/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
|
|
113456
|
+
* We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
|
|
113457
|
+
* collect the resultant graphics and add them to the sheet view's scene.
|
|
113458
|
+
*/
|
|
113459
|
+
class OrthographicAttachment {
|
|
113460
|
+
_viewport;
|
|
113461
|
+
_props;
|
|
113462
|
+
_sheetModelId;
|
|
113463
|
+
_viewFlagOverrides;
|
|
113464
|
+
_toSheet;
|
|
113465
|
+
_fromSheet;
|
|
113466
|
+
_sizeInMeters;
|
|
113467
|
+
_range;
|
|
113468
|
+
_viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, 1, 1);
|
|
113469
|
+
_originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Frustum();
|
|
113470
|
+
_clipVolume;
|
|
113471
|
+
_hiddenLineSettings;
|
|
113472
|
+
_scale;
|
|
113473
|
+
_debugFeatureTable;
|
|
113474
|
+
scene;
|
|
113475
|
+
symbologyOverrides;
|
|
113476
|
+
zDepth;
|
|
113477
|
+
get view() {
|
|
113478
|
+
return this._viewport.view;
|
|
113479
|
+
}
|
|
113480
|
+
get viewAttachmentProps() {
|
|
113481
|
+
return this._props;
|
|
113482
|
+
}
|
|
113483
|
+
get viewport() {
|
|
113484
|
+
return this._viewport;
|
|
113485
|
+
}
|
|
113486
|
+
constructor(view, props, sheetModelId) {
|
|
113487
|
+
this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
|
|
113488
|
+
const target = new AttachmentTarget(this);
|
|
113489
|
+
this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport.createViewport(view, target, true);
|
|
113490
|
+
this._props = props;
|
|
113491
|
+
this._sheetModelId = sheetModelId;
|
|
113492
|
+
const applyClip = true; // set to false for debugging
|
|
113493
|
+
this._viewFlagOverrides = {
|
|
113494
|
+
...view.viewFlags,
|
|
113495
|
+
clipVolume: applyClip,
|
|
113496
|
+
lighting: false,
|
|
113497
|
+
shadows: false,
|
|
113498
|
+
};
|
|
113499
|
+
const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
|
|
113500
|
+
const range = placement.calculateRange();
|
|
113501
|
+
this._range = range;
|
|
113502
|
+
this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(range.xLength(), range.yLength());
|
|
113503
|
+
// Compute transform from attached view's world coordinates to sheet's world coordinates.
|
|
113504
|
+
// NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
|
|
113505
|
+
const applySkew = true; // set to false for debugging
|
|
113506
|
+
const skew = applySkew ? view.getAspectRatioSkew() : 1;
|
|
113507
|
+
const extents = this._viewport.viewingSpace.viewDelta.clone();
|
|
113508
|
+
const zDepth = Math.abs(extents.z);
|
|
113509
|
+
const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
|
|
113510
|
+
const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
|
|
113511
|
+
this._scale = { x: 1 / scaleX, y: 1 / scaleY };
|
|
113512
|
+
const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
113513
|
+
this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
|
|
113514
|
+
// View origin is at the *back* of the view. Align *front* of view based on display priority.
|
|
113515
|
+
const viewRot = view.getRotation();
|
|
113516
|
+
const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
|
|
113517
|
+
viewOrg.z += zDepth;
|
|
113518
|
+
viewRot.multiplyTransposeVectorInPlace(viewOrg);
|
|
113519
|
+
const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.createScale(scaleX, scaleY, 1);
|
|
113520
|
+
matrix.multiplyMatrixMatrix(viewRot, matrix);
|
|
113521
|
+
const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
|
|
113522
|
+
const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.createFrom(placement.origin);
|
|
113523
|
+
attachmentOrigin.z = zBias;
|
|
113524
|
+
const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
|
|
113525
|
+
origin.addInPlace(viewOrgToAttachment);
|
|
113526
|
+
this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Transform.createRefs(origin, matrix);
|
|
113527
|
+
this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.expectDefined)(this._toSheet.inverse());
|
|
113528
|
+
// If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
|
|
113529
|
+
// The clip needs to be transformed into sheet space.
|
|
113530
|
+
if (view.isDrawingView())
|
|
113531
|
+
this._viewport.drawingToSheetTransform = this._toSheet;
|
|
113532
|
+
// ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
|
|
113533
|
+
// However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
|
|
113534
|
+
// introduce additional computation, so possibly not worth it.
|
|
113535
|
+
// Transform the view's clip (if any) to sheet space
|
|
113536
|
+
let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
|
|
113537
|
+
if (viewClip)
|
|
113538
|
+
viewClip.transformInPlace(this._toSheet);
|
|
113539
|
+
else
|
|
113540
|
+
viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.createEmpty();
|
|
113541
|
+
let sheetClip;
|
|
113542
|
+
if (undefined !== props.jsonProperties?.clip)
|
|
113543
|
+
sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(props.jsonProperties?.clip);
|
|
113544
|
+
if (sheetClip && sheetClip.isValid) {
|
|
113545
|
+
// Clip to view attachment's clip. NB: clip is in sheet coordinate space.
|
|
113546
|
+
for (const clip of sheetClip.clips)
|
|
113547
|
+
viewClip.clips.push(clip);
|
|
113548
|
+
}
|
|
113549
|
+
else {
|
|
113550
|
+
// Clip to view attachment's bounding box
|
|
113551
|
+
viewClip.appendShape([
|
|
113552
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.low.y),
|
|
113553
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.low.y),
|
|
113554
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.high.y),
|
|
113555
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.high.y),
|
|
113556
|
+
]);
|
|
113557
|
+
}
|
|
113558
|
+
this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(viewClip);
|
|
113559
|
+
// Save off the original frustum (potentially adjusted by viewport).
|
|
113560
|
+
this._viewport.setupFromView();
|
|
113561
|
+
this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_1__.CoordSystem.World, true, this._originalFrustum);
|
|
113562
|
+
const applyHiddenLineSettings = true; // for debugging edge display, set to false...
|
|
113563
|
+
const style = view.displayStyle;
|
|
113564
|
+
if (style.is3d() && applyHiddenLineSettings)
|
|
113565
|
+
this._hiddenLineSettings = style.settings.hiddenLineSettings;
|
|
113566
|
+
}
|
|
113567
|
+
[Symbol.dispose]() {
|
|
113568
|
+
this._viewport[Symbol.dispose]();
|
|
113569
|
+
}
|
|
113570
|
+
discloseTileTrees(trees) {
|
|
113571
|
+
trees.disclose(this._viewport);
|
|
113572
|
+
}
|
|
113573
|
+
addToScene(context) {
|
|
113574
|
+
if (context.viewport.freezeScene)
|
|
113575
|
+
return;
|
|
113576
|
+
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
113577
|
+
return;
|
|
113578
|
+
const wantBounds = context.viewport.wantViewAttachmentBoundaries;
|
|
113579
|
+
const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
|
|
113580
|
+
if (wantBounds || wantClipShapes) {
|
|
113581
|
+
const builder = context.createSceneGraphicBuilder();
|
|
113582
|
+
if (wantBounds) {
|
|
113583
|
+
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
|
|
113584
|
+
builder.addRangeBox(this._range);
|
|
113585
|
+
}
|
|
113586
|
+
if (wantClipShapes && this._clipVolume) {
|
|
113587
|
+
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, 2);
|
|
113588
|
+
for (const prim of this._clipVolume.clipVector.clips) {
|
|
113589
|
+
if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipShape))
|
|
113590
|
+
continue; // ###TODO handle non-shape primitives, if any such ever encountered
|
|
113591
|
+
const pts = [];
|
|
113592
|
+
const tf = prim.transformFromClip;
|
|
113593
|
+
for (const pt of prim.polygon) {
|
|
113594
|
+
const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
|
|
113595
|
+
pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(tfPt.x, tfPt.y));
|
|
113596
|
+
}
|
|
113597
|
+
builder.addLineString2d(pts, 0);
|
|
113598
|
+
}
|
|
113599
|
+
}
|
|
113600
|
+
// Put into a Batch so that we can see tooltip with attachment Id on mouseover.
|
|
113601
|
+
const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
|
|
113602
|
+
context.outputGraphic(batch);
|
|
113603
|
+
}
|
|
113604
|
+
if (!context.viewport.wantViewAttachments)
|
|
113605
|
+
return;
|
|
113606
|
+
// Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
|
|
113607
|
+
const pixelSize = context.viewport.getPixelSizeAtPoint();
|
|
113608
|
+
if (0 === pixelSize)
|
|
113609
|
+
return;
|
|
113610
|
+
// Adjust attached view frustum based on intersection with sheet view frustum.
|
|
113611
|
+
const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
|
|
113612
|
+
const attachFrustumRange = attachFrustum.toRange();
|
|
113613
|
+
const sheetFrustum = context.viewport.getWorldFrustum();
|
|
113614
|
+
const sheetFrustumRange = sheetFrustum.toRange();
|
|
113615
|
+
const intersect = attachFrustumRange.intersect(sheetFrustumRange);
|
|
113616
|
+
if (intersect.isNull)
|
|
113617
|
+
return;
|
|
113618
|
+
attachFrustum.initFromRange(intersect);
|
|
113619
|
+
attachFrustum.transformBy(this._fromSheet, attachFrustum);
|
|
113620
|
+
this._viewport.setupViewFromFrustum(attachFrustum);
|
|
113621
|
+
// Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
|
|
113622
|
+
const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
|
|
113623
|
+
const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
|
|
113624
|
+
this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
|
|
113625
|
+
this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
|
|
113626
|
+
this._viewport.setRect(this._viewRect);
|
|
113627
|
+
// Propagate settings from on-screen viewport.
|
|
113628
|
+
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
113629
|
+
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
113630
|
+
// Create the scene.
|
|
113631
|
+
this._viewport.renderFrame();
|
|
113632
|
+
const scene = this.scene;
|
|
113633
|
+
if (!scene)
|
|
113634
|
+
return;
|
|
113635
|
+
// Extract scene graphics and insert into on-screen scene context.
|
|
113636
|
+
const options = {
|
|
113637
|
+
viewAttachmentId: this._props.id,
|
|
113638
|
+
clipVolume: this._clipVolume,
|
|
113639
|
+
hline: this._hiddenLineSettings,
|
|
113640
|
+
frustum: {
|
|
113641
|
+
is3d: this.view.is3d(),
|
|
113642
|
+
scale: this._scale,
|
|
113643
|
+
},
|
|
113644
|
+
};
|
|
113645
|
+
const outputGraphics = (source) => {
|
|
113646
|
+
if (0 === source.length)
|
|
113647
|
+
return;
|
|
113648
|
+
const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch();
|
|
113649
|
+
graphics.setViewFlagOverrides(this._viewFlagOverrides);
|
|
113650
|
+
graphics.symbologyOverrides = this.symbologyOverrides;
|
|
113651
|
+
for (const graphic of source)
|
|
113652
|
+
graphics.entries.push(graphic);
|
|
113653
|
+
const branch = context.createGraphicBranch(graphics, this._toSheet, options);
|
|
113654
|
+
context.outputGraphic(branch);
|
|
113655
|
+
};
|
|
113656
|
+
outputGraphics(scene.foreground);
|
|
113657
|
+
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
|
|
113658
|
+
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
|
|
113659
|
+
// Report tile statistics to sheet view's viewport.
|
|
113660
|
+
const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.tileAdmin;
|
|
113661
|
+
const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
|
|
113662
|
+
const requested = tileAdmin.getRequestsForUser(this._viewport);
|
|
113663
|
+
tileAdmin.addExternalTilesForUser(context.viewport, {
|
|
113664
|
+
requested: requested?.size ?? 0,
|
|
113665
|
+
selected: selectedAndReady?.selected.size ?? 0,
|
|
113666
|
+
ready: selectedAndReady?.ready.size ?? 0,
|
|
113667
|
+
});
|
|
113668
|
+
}
|
|
113669
|
+
getDebugFeatureTable() {
|
|
113670
|
+
if (this._debugFeatureTable)
|
|
113671
|
+
return this._debugFeatureTable;
|
|
113672
|
+
const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.FeatureTable(1, this._sheetModelId);
|
|
113673
|
+
featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Feature(this._props.id));
|
|
113674
|
+
this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.PackedFeatureTable.pack(featureTable);
|
|
113675
|
+
return this._debugFeatureTable;
|
|
113676
|
+
}
|
|
113677
|
+
get areAllTileTreesLoaded() {
|
|
113678
|
+
return this.view.areAllTileTreesLoaded;
|
|
113679
|
+
}
|
|
113680
|
+
collectStatistics(_stats) {
|
|
113681
|
+
// Handled by discloseTileTrees()
|
|
113682
|
+
}
|
|
113683
|
+
get ortho() {
|
|
113684
|
+
return {
|
|
113685
|
+
toSheet: this._toSheet,
|
|
113686
|
+
view: this.view,
|
|
113687
|
+
};
|
|
113688
|
+
}
|
|
113689
|
+
}
|
|
113690
|
+
function createRasterAttachmentViewport(_view, _rect, _attachment) {
|
|
113691
|
+
class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport {
|
|
113692
|
+
_sceneContext;
|
|
113693
|
+
_isSceneReady = false;
|
|
113694
|
+
_attachment;
|
|
113695
|
+
constructor(view, rect, attachment) {
|
|
113696
|
+
super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createOffscreenTarget(rect));
|
|
113697
|
+
this._attachment = attachment;
|
|
113698
|
+
this._isAspectRatioLocked = true;
|
|
113699
|
+
this.changeView(view);
|
|
113700
|
+
}
|
|
113701
|
+
createSceneContext() {
|
|
113702
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
|
|
113703
|
+
this._sceneContext = super.createSceneContext();
|
|
113704
|
+
return this._sceneContext;
|
|
113705
|
+
}
|
|
113706
|
+
renderFrame() {
|
|
113707
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
|
|
113708
|
+
this.clearSceneContext();
|
|
113709
|
+
super.renderFrame();
|
|
113710
|
+
if (undefined !== this._sceneContext) {
|
|
113711
|
+
this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
|
|
113712
|
+
if (this._isSceneReady)
|
|
113713
|
+
this._attachment.produceGraphics(this._sceneContext);
|
|
113714
|
+
this._sceneContext = undefined;
|
|
113715
|
+
}
|
|
113716
|
+
}
|
|
113717
|
+
clearSceneContext() {
|
|
113718
|
+
this._sceneContext = undefined;
|
|
113719
|
+
}
|
|
113720
|
+
addDecorations() {
|
|
113721
|
+
// ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
|
|
113722
|
+
}
|
|
113723
|
+
}
|
|
113724
|
+
return new RasterAttachmentViewport(_view, _rect, _attachment);
|
|
113725
|
+
}
|
|
113726
|
+
/** Draws a 3d view (usually with camera enabled) into a sheet view by producing an image of the view's contents offscreen. */
|
|
113727
|
+
class RasterAttachment {
|
|
113728
|
+
_props;
|
|
113729
|
+
_placement;
|
|
113730
|
+
_transform;
|
|
113731
|
+
zDepth;
|
|
113732
|
+
_viewport;
|
|
113733
|
+
_graphics;
|
|
113734
|
+
constructor(view, props, bgColor) {
|
|
113735
|
+
// Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
|
|
113736
|
+
const maxSize = 2048;
|
|
113737
|
+
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, maxSize, maxSize);
|
|
113738
|
+
const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
|
|
113739
|
+
const skew = maxSize / height;
|
|
113740
|
+
view.setAspectRatioSkew(skew);
|
|
113741
|
+
if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
|
|
113742
|
+
// Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
|
|
113743
|
+
view.displayStyle.backgroundColor = bgColor.withAlpha(0);
|
|
113744
|
+
}
|
|
113745
|
+
this._viewport = createRasterAttachmentViewport(view, rect, this);
|
|
113746
|
+
this._props = props;
|
|
113747
|
+
this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
|
|
113748
|
+
this._transform = this._placement.transform;
|
|
113749
|
+
this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
113750
|
+
}
|
|
113751
|
+
[Symbol.dispose]() {
|
|
113752
|
+
this._viewport?.[Symbol.dispose]();
|
|
113753
|
+
}
|
|
113754
|
+
get viewAttachmentProps() {
|
|
113755
|
+
return this._props;
|
|
113756
|
+
}
|
|
113757
|
+
get viewport() {
|
|
113758
|
+
return this._viewport;
|
|
113759
|
+
}
|
|
113760
|
+
get areAllTileTreesLoaded() {
|
|
113761
|
+
return this._viewport?.areAllTileTreesLoaded ?? true;
|
|
113762
|
+
}
|
|
113763
|
+
addToScene(context) {
|
|
113764
|
+
// ###TODO: check viewport.wantViewAttachmentClipShapes
|
|
113765
|
+
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
113766
|
+
return;
|
|
113767
|
+
if (context.viewport.wantViewAttachmentBoundaries) {
|
|
113768
|
+
const builder = context.createSceneGraphicBuilder(this._transform);
|
|
113769
|
+
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
|
|
113770
|
+
builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Range3d.createRange2d(this._placement.bbox));
|
|
113771
|
+
context.outputGraphic(builder.finish());
|
|
113772
|
+
}
|
|
113773
|
+
if (!context.viewport.wantViewAttachments)
|
|
113774
|
+
return;
|
|
113775
|
+
if (this._graphics) {
|
|
113776
|
+
context.outputGraphic(this._graphics);
|
|
113777
|
+
return;
|
|
113778
|
+
}
|
|
113779
|
+
if (undefined === this._viewport)
|
|
113780
|
+
return;
|
|
113781
|
+
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
113782
|
+
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
113783
|
+
this._viewport.renderFrame();
|
|
113784
|
+
if (this._graphics)
|
|
113785
|
+
context.outputGraphic(this._graphics);
|
|
113786
|
+
}
|
|
113787
|
+
discloseTileTrees(trees) {
|
|
113788
|
+
if (this._viewport)
|
|
113789
|
+
trees.disclose(this._viewport);
|
|
113790
|
+
}
|
|
113791
|
+
produceGraphics(context) {
|
|
113792
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(context.viewport === this._viewport);
|
|
113793
|
+
this._graphics = this.createGraphics(this._viewport);
|
|
113794
|
+
this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.dispose)(this._viewport);
|
|
113795
|
+
if (undefined !== this._graphics)
|
|
113796
|
+
context.outputGraphic(this._graphics);
|
|
113797
|
+
}
|
|
113798
|
+
createGraphics(vp) {
|
|
113799
|
+
// Create a texture from the contents of the view.
|
|
113800
|
+
const image = vp.readImageBuffer({ upsideDown: true });
|
|
113801
|
+
if (undefined === image)
|
|
113802
|
+
return undefined;
|
|
113803
|
+
const debugImage = false; // set to true to open a window displaying the captured image.
|
|
113804
|
+
if (debugImage) {
|
|
113805
|
+
const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.imageBufferToPngDataUrl)(image, false);
|
|
113806
|
+
if (url)
|
|
113807
|
+
(0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.openImageDataUrlInNewWindow)(url, "Attachment");
|
|
113808
|
+
}
|
|
113809
|
+
const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createTexture({
|
|
113810
|
+
image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.TextureTransparency.Opaque },
|
|
113811
|
+
});
|
|
113812
|
+
if (!texture)
|
|
113813
|
+
return undefined;
|
|
113814
|
+
// Create a material for the texture
|
|
113815
|
+
const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.GraphicParams();
|
|
113816
|
+
graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
|
|
113817
|
+
// Apply the texture to a rectangular polyface.
|
|
113818
|
+
const depth = this.zDepth;
|
|
113819
|
+
const east = this._placement.bbox.low.x;
|
|
113820
|
+
const west = this._placement.bbox.high.x;
|
|
113821
|
+
const north = this._placement.bbox.low.y;
|
|
113822
|
+
const south = this._placement.bbox.high.y;
|
|
113823
|
+
const corners = [
|
|
113824
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, north, depth),
|
|
113825
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, north, depth),
|
|
113826
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, south, depth),
|
|
113827
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, south, depth),
|
|
113828
|
+
];
|
|
113829
|
+
const params = [
|
|
113830
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 0),
|
|
113831
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 0),
|
|
113832
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 1),
|
|
113833
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 1),
|
|
113834
|
+
];
|
|
113835
|
+
const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.StrokeOptions();
|
|
113836
|
+
strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
|
|
113837
|
+
const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.PolyfaceBuilder.create(strokeOptions);
|
|
113838
|
+
polyfaceBuilder.addQuadFacet(corners, params);
|
|
113839
|
+
const polyface = polyfaceBuilder.claimPolyface();
|
|
113840
|
+
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);
|
|
113841
|
+
graphicBuilder.activateGraphicParams(graphicParams);
|
|
113842
|
+
graphicBuilder.addPolyface(polyface, false);
|
|
113843
|
+
const graphic = graphicBuilder.finish();
|
|
113844
|
+
// Wrap the polyface in a GraphicBranch.
|
|
113845
|
+
const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch(true);
|
|
113846
|
+
const vfOvrs = (0,_tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
|
|
113847
|
+
// Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
|
|
113848
|
+
vfOvrs.transparency = false;
|
|
113849
|
+
branch.setViewFlagOverrides(vfOvrs);
|
|
113850
|
+
branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
|
|
113851
|
+
branch.entries.push(graphic);
|
|
113852
|
+
// Apply the attachment's clip, if any.
|
|
113853
|
+
let clipVolume;
|
|
113854
|
+
if (this._props.jsonProperties?.clip) {
|
|
113855
|
+
const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
|
|
113856
|
+
if (clipVector.isValid)
|
|
113857
|
+
clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(clipVector);
|
|
113858
|
+
}
|
|
113859
|
+
return _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
|
|
113860
|
+
}
|
|
113861
|
+
collectStatistics(stats) {
|
|
113862
|
+
if (this._graphics)
|
|
113863
|
+
this._graphics.collectStatistics(stats);
|
|
113864
|
+
}
|
|
113865
|
+
}
|
|
113866
|
+
|
|
113867
|
+
|
|
113614
113868
|
/***/ }),
|
|
113615
113869
|
|
|
113616
113870
|
/***/ "../../core/frontend/lib/esm/internal/cross-package.js":
|
|
@@ -129824,12 +130078,19 @@ class VertexShaderBuilder extends ShaderBuilder {
|
|
|
129824
130078
|
}
|
|
129825
130079
|
main.addline(" v_color = baseColor;");
|
|
129826
130080
|
}
|
|
130081
|
+
/*
|
|
130082
|
+
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).
|
|
130083
|
+
|
|
130084
|
+
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.
|
|
130085
|
+
|
|
130086
|
+
The workaround for this bug involves ensuring that gl_Position is initialized to a valid position before attempting a discard using a degenerate triangle.
|
|
130087
|
+
*/
|
|
130088
|
+
main.addline(" gl_Position = computePosition(rawPosition);");
|
|
129827
130089
|
const checkForDiscard = this.get(9 /* VertexShaderComponent.CheckForDiscard */);
|
|
129828
130090
|
if (undefined !== checkForDiscard) {
|
|
129829
130091
|
prelude.addFunction("bool checkForDiscard()", checkForDiscard);
|
|
129830
130092
|
main.add(_glsl_Vertex__WEBPACK_IMPORTED_MODULE_3__.vertexDiscard);
|
|
129831
130093
|
}
|
|
129832
|
-
main.addline(" gl_Position = computePosition(rawPosition);");
|
|
129833
130094
|
const finalizePos = this.get(13 /* VertexShaderComponent.FinalizePosition */);
|
|
129834
130095
|
if (undefined !== finalizePos) {
|
|
129835
130096
|
prelude.addFunction("vec4 finalizePosition(vec4 pos)", finalizePos);
|
|
@@ -194480,7 +194741,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
194480
194741
|
|
|
194481
194742
|
|
|
194482
194743
|
/**
|
|
194483
|
-
* CurveLocationDetail carries point and
|
|
194744
|
+
* CurveLocationDetail carries point and parameter data about a point evaluated on a curve.
|
|
194484
194745
|
* * These are returned by a variety of queries.
|
|
194485
194746
|
* * Particular contents can vary among the queries.
|
|
194486
194747
|
* @public
|
|
@@ -215369,11 +215630,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
215369
215630
|
/* harmony import */ var _CurveChainWithDistanceIndex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../CurveChainWithDistanceIndex */ "../../core/geometry/lib/esm/curve/CurveChainWithDistanceIndex.js");
|
|
215370
215631
|
/* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
|
|
215371
215632
|
/* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
|
|
215633
|
+
/* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
|
|
215372
215634
|
/* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
|
|
215373
215635
|
/* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
|
|
215374
215636
|
/* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
|
|
215375
215637
|
/* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Path */ "../../core/geometry/lib/esm/curve/Path.js");
|
|
215376
215638
|
/* harmony import */ var _ProxyCurve__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ProxyCurve */ "../../core/geometry/lib/esm/curve/ProxyCurve.js");
|
|
215639
|
+
/* harmony import */ var _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../spiral/TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
|
|
215377
215640
|
/*---------------------------------------------------------------------------------------------
|
|
215378
215641
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
215379
215642
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -215400,6 +215663,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
215400
215663
|
|
|
215401
215664
|
|
|
215402
215665
|
|
|
215666
|
+
|
|
215667
|
+
|
|
215403
215668
|
|
|
215404
215669
|
|
|
215405
215670
|
|
|
@@ -216099,7 +216364,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216099
216364
|
return undefined;
|
|
216100
216365
|
}
|
|
216101
216366
|
/** Detail computation for linestring intersecting linestring. */
|
|
216102
|
-
computeLineStringLineString(lsA, lsB, reversed) {
|
|
216367
|
+
computeLineStringLineString(lsA, extendA0, extendA1, lsB, extendB0, extendB1, reversed) {
|
|
216103
216368
|
const pointA0 = CurveCurveIntersectXY._workPointAA0;
|
|
216104
216369
|
const pointA1 = CurveCurveIntersectXY._workPointAA1;
|
|
216105
216370
|
const pointB0 = CurveCurveIntersectXY._workPointBB0;
|
|
@@ -216123,7 +216388,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216123
216388
|
for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
|
|
216124
216389
|
lsB.pointAt(ib, pointB1);
|
|
216125
216390
|
fB1 = ib * dfB;
|
|
216126
|
-
this.dispatchSegmentSegment(lsA, ia === 1 &&
|
|
216391
|
+
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);
|
|
216127
216392
|
}
|
|
216128
216393
|
}
|
|
216129
216394
|
}
|
|
@@ -216222,6 +216487,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216222
216487
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
|
|
216223
216488
|
this.dispatchSegmentBsplineCurve(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
216224
216489
|
}
|
|
216490
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216491
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216492
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216493
|
+
const numPreviousResults = this._results.length;
|
|
216494
|
+
this.computeSegmentLineString(segmentA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
|
|
216495
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216496
|
+
this.refineSpiralResultsByNewton(segmentA, this._geometryB, numberOfNewResults);
|
|
216497
|
+
}
|
|
216225
216498
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216226
216499
|
this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
|
|
216227
216500
|
}
|
|
@@ -216234,7 +216507,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216234
216507
|
handleLineString3d(lsA) {
|
|
216235
216508
|
if (this._geometryB instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d) {
|
|
216236
216509
|
const lsB = this._geometryB;
|
|
216237
|
-
this.computeLineStringLineString(lsA, lsB, false);
|
|
216510
|
+
this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, lsB, this._extendB0, this._extendB1, false);
|
|
216238
216511
|
}
|
|
216239
216512
|
else if (this._geometryB instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__.LineSegment3d) {
|
|
216240
216513
|
this.computeSegmentLineString(this._geometryB, this._extendB0, this._extendB1, lsA, this._extendA0, this._extendA1, true);
|
|
@@ -216245,6 +216518,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216245
216518
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
|
|
216246
216519
|
this.dispatchLineStringBSplineCurve(lsA, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
216247
216520
|
}
|
|
216521
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216522
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216523
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216524
|
+
const numPreviousResults = this._results.length;
|
|
216525
|
+
this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
|
|
216526
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216527
|
+
this.refineSpiralResultsByNewton(lsA, this._geometryB, numberOfNewResults);
|
|
216528
|
+
}
|
|
216248
216529
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216249
216530
|
this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
|
|
216250
216531
|
}
|
|
@@ -216267,6 +216548,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216267
216548
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
|
|
216268
216549
|
this.dispatchArcBsplineCurve3d(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
216269
216550
|
}
|
|
216551
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216552
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216553
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216554
|
+
const numPreviousResults = this._results.length;
|
|
216555
|
+
this.computeArcLineString(arc0, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
|
|
216556
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216557
|
+
this.refineSpiralResultsByNewton(arc0, this._geometryB, numberOfNewResults);
|
|
216558
|
+
}
|
|
216270
216559
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216271
216560
|
this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
|
|
216272
216561
|
}
|
|
@@ -216289,6 +216578,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216289
216578
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3dBase) {
|
|
216290
216579
|
this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
|
|
216291
216580
|
}
|
|
216581
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216582
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216583
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216584
|
+
const numPreviousResults = this._results.length;
|
|
216585
|
+
this.dispatchLineStringBSplineCurve(spiralApproximation, false, false, curve, this._extendA0, this._extendA1, true);
|
|
216586
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216587
|
+
this.refineSpiralResultsByNewton(curve, this._geometryB, numberOfNewResults);
|
|
216588
|
+
}
|
|
216292
216589
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216293
216590
|
this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));
|
|
216294
216591
|
}
|
|
@@ -216297,6 +216594,47 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216297
216594
|
}
|
|
216298
216595
|
return undefined;
|
|
216299
216596
|
}
|
|
216597
|
+
/**
|
|
216598
|
+
* Assuming the tail of `this._results` holds the given number of approximate solutions to the curve-spiral
|
|
216599
|
+
* xy-intersection problem, replace each with its Newton refinement, unless it doesn't converge, in which case
|
|
216600
|
+
* it is removed.
|
|
216601
|
+
* @param spiral The transition spiral.
|
|
216602
|
+
* @param otherCurve The other curve primitive.
|
|
216603
|
+
* @param numberOfNewResults The number of results in the tail of `this._results` to be refined.
|
|
216604
|
+
* @param reversed Whether the spiral is geometryA (true) or geometryB (false).
|
|
216605
|
+
*/
|
|
216606
|
+
refineSpiralResultsByNewton(otherCurve, spiral, numberOfNewResults, reversed = false) {
|
|
216607
|
+
const resultsToBeRefined = this._results.slice(this._results.length - numberOfNewResults);
|
|
216608
|
+
this._results.length -= numberOfNewResults; // keep already refined results
|
|
216609
|
+
for (const detail of resultsToBeRefined) {
|
|
216610
|
+
let spiralFraction = reversed ? detail.detailA.fraction : detail.detailB.fraction;
|
|
216611
|
+
let otherFraction = reversed ? detail.detailB.fraction : detail.detailA.fraction;
|
|
216612
|
+
const xyMatchingFunction = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.CurveCurveIntersectionXYRRToRRD(spiral, otherCurve);
|
|
216613
|
+
const newtonSearcher = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.Newton2dUnboundedWithDerivative(xyMatchingFunction);
|
|
216614
|
+
newtonSearcher.setUV(spiralFraction, otherFraction);
|
|
216615
|
+
if (newtonSearcher.runIterations()) {
|
|
216616
|
+
spiralFraction = newtonSearcher.getU();
|
|
216617
|
+
otherFraction = newtonSearcher.getV();
|
|
216618
|
+
if (this.acceptFraction(false, spiralFraction, false) && this.acceptFraction(false, otherFraction, false))
|
|
216619
|
+
this.recordPointWithLocalFractions(otherFraction, otherCurve, 0, 1, spiralFraction, spiral, 0, 1, reversed);
|
|
216620
|
+
}
|
|
216621
|
+
}
|
|
216622
|
+
}
|
|
216623
|
+
/** Double dispatch handler for strongly typed spiral curve. */
|
|
216624
|
+
handleTransitionSpiral(spiral) {
|
|
216625
|
+
if (this._geometryB instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__.CurvePrimitive) { // this also handles CurveChainWithDistanceIndex
|
|
216626
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216627
|
+
spiral.emitStrokes(spiralApproximation);
|
|
216628
|
+
const numPreviousResults = this._results.length;
|
|
216629
|
+
this.handleLineString3d(spiralApproximation);
|
|
216630
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216631
|
+
this.refineSpiralResultsByNewton(this._geometryB, spiral, numberOfNewResults, true);
|
|
216632
|
+
}
|
|
216633
|
+
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216634
|
+
this.dispatchCurveCollection(spiral, this.handleTransitionSpiral.bind(this));
|
|
216635
|
+
}
|
|
216636
|
+
return undefined;
|
|
216637
|
+
}
|
|
216300
216638
|
/** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */
|
|
216301
216639
|
handleCurveChainWithDistanceIndex(chain) {
|
|
216302
216640
|
super.handleCurveChainWithDistanceIndex(chain);
|
|
@@ -219986,7 +220324,7 @@ class AustralianRailCorpXYEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MO
|
|
|
219986
220324
|
* * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
|
|
219987
220325
|
* an x coordinate.
|
|
219988
220326
|
* * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
|
|
219989
|
-
* this.fractionToX
|
|
220327
|
+
* this.fractionToX(fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
|
|
219990
220328
|
* * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
|
|
219991
220329
|
* * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
|
|
219992
220330
|
* more accurate CurvePrimitive measurements.
|
|
@@ -220037,8 +220375,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
220037
220375
|
* Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.
|
|
220038
220376
|
* Each instance has:
|
|
220039
220377
|
* * number of x and y terms to use.
|
|
220040
|
-
* * constant for theta =
|
|
220041
|
-
* * This value is c = 1/
|
|
220378
|
+
* * constant for theta = cxx.
|
|
220379
|
+
* * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.
|
|
220042
220380
|
* @internal
|
|
220043
220381
|
*/
|
|
220044
220382
|
class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODULE_0__.XYCurveEvaluator {
|
|
@@ -220046,7 +220384,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220046
220384
|
numXTerms;
|
|
220047
220385
|
/** Number of terms to use in y Taylor series. */
|
|
220048
220386
|
numYTerms;
|
|
220049
|
-
/** Constant c = 1/
|
|
220387
|
+
/** Constant c = 1/2RL in theta = cxx. */
|
|
220050
220388
|
constantDiv2LR;
|
|
220051
220389
|
/** The nominal curve length. */
|
|
220052
220390
|
nominalLength1;
|
|
@@ -220123,10 +220461,12 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220123
220461
|
* @param numTerms number of terms to use.
|
|
220124
220462
|
*/
|
|
220125
220463
|
fractionToXGo(fraction, numTerms) {
|
|
220126
|
-
// write the Taylor series for cos(theta)
|
|
220127
|
-
//
|
|
220128
|
-
//
|
|
220129
|
-
//
|
|
220464
|
+
// write the Taylor series for cos(theta):
|
|
220465
|
+
// 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...
|
|
220466
|
+
// replace theta by s*s*c:
|
|
220467
|
+
// 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...
|
|
220468
|
+
// integrate wrt s:
|
|
220469
|
+
// x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
|
|
220130
220470
|
// x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )
|
|
220131
220471
|
const s = fraction * this.nominalLength1;
|
|
220132
220472
|
let result = s;
|
|
@@ -220146,9 +220486,11 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220146
220486
|
return result;
|
|
220147
220487
|
}
|
|
220148
220488
|
fractionToYGo(fraction, numTerms) {
|
|
220149
|
-
// write the Taylor series for sin(theta)
|
|
220150
|
-
//
|
|
220151
|
-
//
|
|
220489
|
+
// write the Taylor series for sin(theta):
|
|
220490
|
+
// theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...
|
|
220491
|
+
// replace theta by s*s*c:
|
|
220492
|
+
// s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...
|
|
220493
|
+
// integrate wrt s:
|
|
220152
220494
|
// y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...
|
|
220153
220495
|
// y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )
|
|
220154
220496
|
const s = fraction * this.nominalLength1;
|
|
@@ -220196,7 +220538,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220196
220538
|
// dY = q - q^3/3!
|
|
220197
220539
|
// q = s^2 c
|
|
220198
220540
|
// dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!
|
|
220199
|
-
// recurrence
|
|
220541
|
+
// recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
|
|
220200
220542
|
const s = fraction * this.nominalLength1;
|
|
220201
220543
|
const q1 = s * s * this.constantDiv2LR;
|
|
220202
220544
|
let result = q1;
|
|
@@ -220418,7 +220760,7 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
220418
220760
|
static gammaConstant(length1, radius1) {
|
|
220419
220761
|
return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);
|
|
220420
220762
|
}
|
|
220421
|
-
/** Compute the
|
|
220763
|
+
/** Compute the Czech cubic constant. */
|
|
220422
220764
|
static computeCubicM(length1, radius1) {
|
|
220423
220765
|
const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);
|
|
220424
220766
|
// in the private update method, the LR values should have been vetted
|
|
@@ -220511,17 +220853,9 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
220511
220853
|
class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.CubicEvaluator {
|
|
220512
220854
|
nominalLength1;
|
|
220513
220855
|
nominalRadius1;
|
|
220514
|
-
/**
|
|
220515
|
-
* Compute the czech cubic constant.
|
|
220516
|
-
* * Funky mixture of lengths.
|
|
220517
|
-
*/
|
|
220856
|
+
/** Compute the Italian cubic constant. */
|
|
220518
220857
|
static computeCubicM(lengthXByForward, radius1) {
|
|
220519
|
-
|
|
220520
|
-
// in the private update method, the LR values should have been vetted
|
|
220521
|
-
if (gamma === undefined)
|
|
220522
|
-
return undefined;
|
|
220523
|
-
// if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
|
|
220524
|
-
return gamma / Math.abs((6.0 * radius1 * lengthXByForward));
|
|
220858
|
+
return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);
|
|
220525
220859
|
}
|
|
220526
220860
|
/** Constructor is private. Caller responsible for cubicM validity. */
|
|
220527
220861
|
constructor(length1, radius1, lengthX, cubicM) {
|
|
@@ -220530,7 +220864,7 @@ class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0_
|
|
|
220530
220864
|
this.nominalRadius1 = radius1;
|
|
220531
220865
|
}
|
|
220532
220866
|
static create(length1, radius1) {
|
|
220533
|
-
// this seems goofy
|
|
220867
|
+
// this seems goofy; lengthX from forward, then invert for another but that's what the native code does too
|
|
220534
220868
|
const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);
|
|
220535
220869
|
const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);
|
|
220536
220870
|
if (lengthX1 === undefined)
|
|
@@ -220746,18 +221080,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
220746
221080
|
* DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
|
|
220747
221081
|
* "direct" xy calculations without the integrations required for IntegratedSpiral3d.
|
|
220748
221082
|
* * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
|
|
220749
|
-
* * Direct spirals
|
|
221083
|
+
* * Direct spirals are created with these static methods:
|
|
220750
221084
|
* * createArema
|
|
220751
221085
|
* * createJapaneseCubic
|
|
220752
|
-
* * createAustralianRail
|
|
220753
|
-
* * createDirectHalfCosine
|
|
220754
221086
|
* * createChineseCubic
|
|
221087
|
+
* * createWesternAustralian
|
|
221088
|
+
* * createDirectHalfCosine
|
|
221089
|
+
* * createAustralianRail
|
|
220755
221090
|
* * createCzechCubic
|
|
220756
221091
|
* * createPolishCubic
|
|
221092
|
+
* * createMXCubicAlongArc
|
|
220757
221093
|
* * createItalian
|
|
220758
|
-
* * createWesternAustralian
|
|
220759
221094
|
* @public
|
|
220760
221095
|
*/
|
|
221096
|
+
// see internaldocs/Spiral.md for more info
|
|
220761
221097
|
class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
|
|
220762
221098
|
/** String name for schema properties. */
|
|
220763
221099
|
curvePrimitiveType = "transitionSpiral";
|
|
@@ -220913,11 +221249,11 @@ class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.Tr
|
|
|
220913
221249
|
/**
|
|
220914
221250
|
* Create an MX Cubic whose nominal length is close to along the curve.
|
|
220915
221251
|
* This is y = m*x^3 with
|
|
220916
|
-
* * m is 1/(
|
|
221252
|
+
* * m is 1/(6RL).
|
|
220917
221253
|
* * 1/(6RL) is the leading term of the sine series.
|
|
220918
221254
|
* * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
|
|
220919
221255
|
* * x is axis position that is slightly LESS than nominal distance along.
|
|
220920
|
-
* * L1, x use the approximation `x = s * ( 1 - s^4/ (40
|
|
221256
|
+
* * L1, x use the approximation `x = s * ( 1 - s^4/ (40 RR LL))
|
|
220921
221257
|
* @param localToWorld
|
|
220922
221258
|
* @param nominalL1
|
|
220923
221259
|
* @param nominalR1
|
|
@@ -221278,6 +221614,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
221278
221614
|
* * [[TransitionConditionalProperties]] implements the computations of the interrelationship of radii, bearing, and length.
|
|
221279
221615
|
* @public
|
|
221280
221616
|
*/
|
|
221617
|
+
// see internaldocs/Spiral.md for more info
|
|
221281
221618
|
class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
|
|
221282
221619
|
/** String name for schema properties. */
|
|
221283
221620
|
curvePrimitiveType = "transitionSpiral";
|
|
@@ -221321,11 +221658,13 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
|
|
|
221321
221658
|
static defaultSpiralType = "clothoid";
|
|
221322
221659
|
/** Use the integrated function to return an angle at fractional position. */
|
|
221323
221660
|
globalFractionToBearingRadians(fraction) {
|
|
221661
|
+
// calculate area under curvature curve from 0 to fraction and add it to start angle to get angle at the given fraction
|
|
221662
|
+
// see internaldocs/Spiral.md for more info
|
|
221324
221663
|
const areaFraction = this._evaluator.fractionToArea(fraction);
|
|
221325
|
-
const
|
|
221664
|
+
const arcLength = this._arcLength01;
|
|
221326
221665
|
return this.bearing01.startRadians
|
|
221327
|
-
+
|
|
221328
|
-
+
|
|
221666
|
+
+ fraction * arcLength * this._curvature01.x0
|
|
221667
|
+
+ areaFraction * arcLength * this._curvature01.signedDelta();
|
|
221329
221668
|
}
|
|
221330
221669
|
/** Use the integrated function to return an angle at fractional position. */
|
|
221331
221670
|
globalFractionToCurvature(fraction) {
|
|
@@ -221364,9 +221703,10 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
|
|
|
221364
221703
|
* @param xyz advancing integrated point.
|
|
221365
221704
|
* @param fractionA fraction at start of interval.
|
|
221366
221705
|
* @param fractionB fraction at end of interval.
|
|
221367
|
-
* @param
|
|
221706
|
+
* @param applyMatrix if true, apply the localToWorld matrix to the computed delta before adding to xyz.
|
|
221368
221707
|
*/
|
|
221369
221708
|
fullSpiralIncrementalIntegral(xyz, fractionA, fractionB, applyMatrix) {
|
|
221709
|
+
// see internaldocs/Spiral.md for more info
|
|
221370
221710
|
const gaussFraction = IntegratedSpiral3d._gaussFraction;
|
|
221371
221711
|
const gaussWeight = IntegratedSpiral3d._gaussWeight;
|
|
221372
221712
|
const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);
|
|
@@ -221416,7 +221756,7 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
|
|
|
221416
221756
|
/**
|
|
221417
221757
|
* Create a transition spiral with radius and bearing conditions.
|
|
221418
221758
|
* @param radius01 radius (inverse curvature) at start and end (radius of zero means straight line).
|
|
221419
|
-
* @param bearing01 bearing angles at start and end.
|
|
221759
|
+
* @param bearing01 bearing angles at start and end. Bearings are measured from the x axis, positive clockwise
|
|
221420
221760
|
* towards y axis.
|
|
221421
221761
|
* @param activeFractionInterval fractional limits of the active portion of the spiral.
|
|
221422
221762
|
* @param localToWorld placement frame. Fractional coordinate 0 is at the origin.
|
|
@@ -221796,10 +222136,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
221796
222136
|
* * Each implementation provides:
|
|
221797
222137
|
* * fractionToCurvature -- the f(u) function described above
|
|
221798
222138
|
* * fractionToCurvatureDerivative -- df(u)/du
|
|
221799
|
-
* * fractionToArea --
|
|
221800
|
-
*
|
|
222139
|
+
* * fractionToArea -- antiderivative A of f, chosen such that A(0) = 0. The value of this function at
|
|
222140
|
+
* fraction u is the area under f from 0 to u. In particular, the symmetry condition on f implies that
|
|
222141
|
+
* 1/2 = "integral of f over [0,1]" = A(1) - A(0) = A(1).
|
|
221801
222142
|
* @internal
|
|
221802
222143
|
*/
|
|
222144
|
+
// see internaldocs/Spiral.md for more info
|
|
221803
222145
|
class NormalizedTransition {
|
|
221804
222146
|
/** Constructor initializes with 0..1 values. Call "setBearingCurvatureLengthCurvature" to apply real values. */
|
|
221805
222147
|
constructor() { }
|
|
@@ -221836,10 +222178,13 @@ class NormalizedTransition {
|
|
|
221836
222178
|
}
|
|
221837
222179
|
/**
|
|
221838
222180
|
* Transition functions for clothoid spiral.
|
|
221839
|
-
* *
|
|
222181
|
+
* * Curvature variation is linear from (0,0) to (1,1).
|
|
221840
222182
|
* @internal
|
|
221841
222183
|
*/
|
|
221842
222184
|
class NormalizedClothoidTransition extends NormalizedTransition {
|
|
222185
|
+
// clothoid curvature is f(x) = x
|
|
222186
|
+
// derivative f'(x) = 1
|
|
222187
|
+
// integral If(x) = x^2 / 2
|
|
221843
222188
|
constructor() {
|
|
221844
222189
|
super();
|
|
221845
222190
|
}
|
|
@@ -221865,13 +222210,12 @@ class NormalizedClothoidTransition extends NormalizedTransition {
|
|
|
221865
222210
|
* @internal
|
|
221866
222211
|
*/
|
|
221867
222212
|
class NormalizedBlossTransition extends NormalizedTransition {
|
|
221868
|
-
// bloss
|
|
222213
|
+
// bloss curvature is x^2 (3 - 2x)
|
|
221869
222214
|
// derivative 6x (1-x)
|
|
221870
|
-
//
|
|
221871
|
-
|
|
221872
|
-
|
|
221873
|
-
|
|
221874
|
-
constructor() { super(); }
|
|
222215
|
+
// integral is x^3 (1-x/2)
|
|
222216
|
+
constructor() {
|
|
222217
|
+
super();
|
|
222218
|
+
}
|
|
221875
222219
|
/** At fractional position on the x axis, return the (normalized) curvature fraction. */
|
|
221876
222220
|
fractionToCurvatureFraction(u) {
|
|
221877
222221
|
return u * u * (3 - 2 * u);
|
|
@@ -221910,17 +222254,17 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
|
|
|
221910
222254
|
}
|
|
221911
222255
|
/**
|
|
221912
222256
|
* At fractional position on the x axis, return the (normalized) curvature fraction.
|
|
221913
|
-
* * For [u <= 0.5, u
|
|
221914
|
-
* * f(u) = [
|
|
221915
|
-
* * f'(u) = [
|
|
221916
|
-
* * If(u) = [
|
|
222257
|
+
* * For [u <= 0.5, u > 0.5]
|
|
222258
|
+
* * f(u) = [2u^2, 1 - 2(1-u)^2]
|
|
222259
|
+
* * f'(u) = [4u, 4(1-u)]
|
|
222260
|
+
* * If(u) = [2u^3 / 3, u + 2(1-u)^3 /3]
|
|
221917
222261
|
*/
|
|
221918
222262
|
fractionToCurvatureFraction(u) {
|
|
221919
222263
|
return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);
|
|
221920
222264
|
}
|
|
221921
222265
|
/** Return the derivative of the (normalized) curvature fraction. */
|
|
221922
222266
|
fractionToCurvatureFractionDerivative(u) {
|
|
221923
|
-
return u
|
|
222267
|
+
return u <= 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
|
|
221924
222268
|
}
|
|
221925
222269
|
/**
|
|
221926
222270
|
* Return the integrated area under the curve.
|
|
@@ -221929,6 +222273,7 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
|
|
|
221929
222273
|
fractionToArea(u) {
|
|
221930
222274
|
if (u <= 0.5)
|
|
221931
222275
|
return this.integratedBasis(u);
|
|
222276
|
+
// 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"
|
|
221932
222277
|
const v = 1 - u;
|
|
221933
222278
|
return 0.5 - v + this.integratedBasis(v);
|
|
221934
222279
|
}
|
|
@@ -221941,7 +222286,13 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
|
|
|
221941
222286
|
* @internal
|
|
221942
222287
|
*/
|
|
221943
222288
|
class NormalizedSineTransition extends NormalizedTransition {
|
|
221944
|
-
|
|
222289
|
+
// sine transition curvature is x - sin(2 pi x) / (2 pi)
|
|
222290
|
+
// derivative 1 - cos(2 pi x)
|
|
222291
|
+
// integral x^2 / 2 + (cos(2 pi x) - 1) / (4 pi^2)
|
|
222292
|
+
// note: this is the only snap function whose antiderivative is chosen with nonzero integration constant.
|
|
222293
|
+
constructor() {
|
|
222294
|
+
super();
|
|
222295
|
+
}
|
|
221945
222296
|
/** At fractional position on the x axis, return the (normalized) curvature fraction. */
|
|
221946
222297
|
fractionToCurvatureFraction(u) {
|
|
221947
222298
|
const a = 2.0 * Math.PI;
|
|
@@ -221967,7 +222318,12 @@ class NormalizedSineTransition extends NormalizedTransition {
|
|
|
221967
222318
|
* @internal
|
|
221968
222319
|
*/
|
|
221969
222320
|
class NormalizedCosineTransition extends NormalizedTransition {
|
|
221970
|
-
|
|
222321
|
+
// cosine transition curvature is 0.5 (1 - cos(pi x))
|
|
222322
|
+
// derivative 0.5 pi sin(pi x)
|
|
222323
|
+
// integral 0.5 (x - sin(pi x) / pi)
|
|
222324
|
+
constructor() {
|
|
222325
|
+
super();
|
|
222326
|
+
}
|
|
221971
222327
|
/** At fractional position on the x axis, return the (normalized) curvature fraction. */
|
|
221972
222328
|
fractionToCurvatureFraction(u) {
|
|
221973
222329
|
const a = Math.PI;
|
|
@@ -222153,6 +222509,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222153
222509
|
* determines the remaining one.
|
|
222154
222510
|
* @public
|
|
222155
222511
|
*/
|
|
222512
|
+
// see internaldocs/Spiral.md for more info
|
|
222156
222513
|
class TransitionConditionalProperties {
|
|
222157
222514
|
/**
|
|
222158
222515
|
* Radius at start (radius of the osculating circle at the spiral segment's start).
|
|
@@ -222348,6 +222705,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222348
222705
|
* * This is not necessary for integrated spirals.
|
|
222349
222706
|
* @public
|
|
222350
222707
|
*/
|
|
222708
|
+
// see internaldocs/Spiral.md for more info
|
|
222351
222709
|
class TransitionSpiral3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePrimitive {
|
|
222352
222710
|
/** String name of spiral type. */
|
|
222353
222711
|
_spiralType;
|
|
@@ -242447,8 +242805,7 @@ class Ray3d {
|
|
|
242447
242805
|
return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);
|
|
242448
242806
|
}
|
|
242449
242807
|
/**
|
|
242450
|
-
* Return the dot product of the ray's direction vector with a vector from the ray origin
|
|
242451
|
-
* to the `spacePoint`.
|
|
242808
|
+
* Return the dot product of the ray's direction vector with a vector from the ray origin to the `spacePoint`.
|
|
242452
242809
|
* * If the instance is the unit normal of a plane, then this method returns the (signed) altitude
|
|
242453
242810
|
* of `spacePoint` with respect to the plane.
|
|
242454
242811
|
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
|
|
@@ -249432,7 +249789,7 @@ class NewtonEvaluatorRtoRD {
|
|
|
249432
249789
|
/**
|
|
249433
249790
|
* Newton iterator for use when both function and derivative can be evaluated.
|
|
249434
249791
|
* To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.
|
|
249435
|
-
* To solve `f(x) = target` which is equivalent to solving
|
|
249792
|
+
* To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
|
|
249436
249793
|
* `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.
|
|
249437
249794
|
* @internal
|
|
249438
249795
|
*/
|
|
@@ -321868,7 +322225,7 @@ var loadLanguages = instance.loadLanguages;
|
|
|
321868
322225
|
/***/ ((module) => {
|
|
321869
322226
|
|
|
321870
322227
|
"use strict";
|
|
321871
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.
|
|
322228
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.4.0-dev.10","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.3.12","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
|
|
321872
322229
|
|
|
321873
322230
|
/***/ })
|
|
321874
322231
|
|