@itwin/ecschema-rpcinterface-tests 5.4.0-dev.7 → 5.5.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/bundled-tests.js +1155 -809
- package/lib/dist/bundled-tests.js.map +1 -1
- package/package.json +17 -17
|
@@ -74241,9 +74241,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
74241
74241
|
* @public @preview
|
|
74242
74242
|
*/
|
|
74243
74243
|
class SchemaJsonLocater {
|
|
74244
|
-
|
|
74245
|
-
constructor(
|
|
74246
|
-
|
|
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
|
+
};
|
|
74247
74258
|
}
|
|
74248
74259
|
/** Get a schema by [SchemaKey]
|
|
74249
74260
|
* @param schemaKey The [SchemaKey] that identifies the schema.
|
|
@@ -74261,7 +74272,7 @@ class SchemaJsonLocater {
|
|
|
74261
74272
|
* @param matchType The match type to use when locating the schema
|
|
74262
74273
|
*/
|
|
74263
74274
|
async getSchemaInfo(schemaKey, matchType, context) {
|
|
74264
|
-
const schemaProps = this.
|
|
74275
|
+
const schemaProps = this._getSchemaProps(schemaKey.name);
|
|
74265
74276
|
if (!schemaProps)
|
|
74266
74277
|
return undefined;
|
|
74267
74278
|
const schemaInfo = await _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.startLoadingFromJson(schemaProps, context);
|
|
@@ -74276,7 +74287,7 @@ class SchemaJsonLocater {
|
|
|
74276
74287
|
* @throws [Error]($ecschema-metadata) if the schema exists, but cannot be loaded.
|
|
74277
74288
|
*/
|
|
74278
74289
|
getSchemaSync(schemaKey, _matchType, context) {
|
|
74279
|
-
const schemaProps = this.
|
|
74290
|
+
const schemaProps = this._getSchemaProps(schemaKey.name);
|
|
74280
74291
|
if (!schemaProps)
|
|
74281
74292
|
return undefined;
|
|
74282
74293
|
return _Metadata_Schema__WEBPACK_IMPORTED_MODULE_1__.Schema.fromJsonSync(schemaProps, context || new _Context__WEBPACK_IMPORTED_MODULE_0__.SchemaContext());
|
|
@@ -88078,6 +88089,7 @@ class IModelApp {
|
|
|
88078
88089
|
static _realityDataAccess;
|
|
88079
88090
|
static _publicPath;
|
|
88080
88091
|
static _formatsProviderManager;
|
|
88092
|
+
static _incrementalSchemaLoading;
|
|
88081
88093
|
// No instances of IModelApp may be created. All members are static and must be on the singleton object IModelApp.
|
|
88082
88094
|
constructor() { }
|
|
88083
88095
|
/** Event raised just before the frontend IModelApp is to be [[shutdown]]. */
|
|
@@ -88135,6 +88147,13 @@ class IModelApp {
|
|
|
88135
88147
|
* @beta
|
|
88136
88148
|
*/
|
|
88137
88149
|
static get realityDataAccess() { return this._realityDataAccess; }
|
|
88150
|
+
/**
|
|
88151
|
+
* Indicates whether incremental schema loading is enabled.
|
|
88152
|
+
* If not further specified, incremental schema loading is currently disabled by default.
|
|
88153
|
+
* @beta
|
|
88154
|
+
*/
|
|
88155
|
+
static get isIncrementalSchemaLoadingEnabled() { return this._incrementalSchemaLoading === "enabled"; }
|
|
88156
|
+
;
|
|
88138
88157
|
/** Whether the [renderSystem[]] has been successfully initialized.
|
|
88139
88158
|
* This will always be `false` before calling [[startup]] and after calling [[shutdown]].
|
|
88140
88159
|
* In rare circumstances (e.g., while executing in a headless test environment) it may remain `false` due to a failure to
|
|
@@ -88262,6 +88281,7 @@ class IModelApp {
|
|
|
88262
88281
|
this._realityDataSourceProviders = new _RealityDataSource__WEBPACK_IMPORTED_MODULE_25__.RealityDataSourceProviderRegistry();
|
|
88263
88282
|
this._realityDataAccess = opts.realityDataAccess;
|
|
88264
88283
|
this._formatsProviderManager = new _quantity_formatting_QuantityFormatter__WEBPACK_IMPORTED_MODULE_19__.FormatsProviderManager(opts.formatsProvider ?? new _quantity_formatting_QuantityFormatter__WEBPACK_IMPORTED_MODULE_19__.QuantityTypeFormatsProvider());
|
|
88284
|
+
this._incrementalSchemaLoading = opts.incrementalSchemaLoading ?? "disabled";
|
|
88265
88285
|
this._publicPath = opts.publicPath ?? "";
|
|
88266
88286
|
if (this._publicPath !== "" && !this._publicPath.endsWith("/")) {
|
|
88267
88287
|
this._publicPath += "/";
|
|
@@ -89110,8 +89130,12 @@ class IModelConnection extends _itwin_core_common__WEBPACK_IMPORTED_MODULE_1__.I
|
|
|
89110
89130
|
get schemaContext() {
|
|
89111
89131
|
if (this._schemaContext === undefined) {
|
|
89112
89132
|
const context = new _itwin_ecschema_metadata__WEBPACK_IMPORTED_MODULE_15__.SchemaContext();
|
|
89113
|
-
|
|
89114
|
-
|
|
89133
|
+
// While incremental schema loading is the prefered way to load schemas on the frontend, there might be cases where clients
|
|
89134
|
+
// would want to use their own locaters, so if incremenal schema loading is disabled, the locater is not registered.
|
|
89135
|
+
if (_IModelApp__WEBPACK_IMPORTED_MODULE_5__.IModelApp.isIncrementalSchemaLoadingEnabled) {
|
|
89136
|
+
context.addLocater(new _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__.RpcIncrementalSchemaLocater(this._getRpcProps()));
|
|
89137
|
+
}
|
|
89138
|
+
context.addFallbackLocater(new _itwin_ecschema_rpcinterface_common__WEBPACK_IMPORTED_MODULE_16__.ECSchemaRpcLocater(this._getRpcProps()));
|
|
89115
89139
|
this._schemaContext = context;
|
|
89116
89140
|
}
|
|
89117
89141
|
return this._schemaContext;
|
|
@@ -93842,18 +93866,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
93842
93866
|
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
93843
93867
|
/* harmony import */ var _CategorySelectorState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./CategorySelectorState */ "../../core/frontend/lib/esm/CategorySelectorState.js");
|
|
93844
93868
|
/* harmony import */ var _DisplayStyleState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./DisplayStyleState */ "../../core/frontend/lib/esm/DisplayStyleState.js");
|
|
93845
|
-
/* harmony import */ var
|
|
93846
|
-
/* harmony import */ var
|
|
93847
|
-
/* harmony import */ var
|
|
93848
|
-
/* harmony import */ var
|
|
93849
|
-
/* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
|
|
93850
|
-
/* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
|
|
93851
|
-
/* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Viewport */ "../../core/frontend/lib/esm/Viewport.js");
|
|
93852
|
-
/* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
|
|
93853
|
-
/* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
|
|
93854
|
-
/* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
|
|
93855
|
-
/* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
|
|
93856
|
-
/* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
|
|
93869
|
+
/* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
|
|
93870
|
+
/* harmony import */ var _ViewState__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ViewState */ "../../core/frontend/lib/esm/ViewState.js");
|
|
93871
|
+
/* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
|
|
93872
|
+
/* harmony import */ var _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./internal/SheetViewAttachments */ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js");
|
|
93857
93873
|
/*---------------------------------------------------------------------------------------------
|
|
93858
93874
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
93859
93875
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -93870,14 +93886,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
93870
93886
|
|
|
93871
93887
|
|
|
93872
93888
|
|
|
93873
|
-
|
|
93874
|
-
|
|
93875
|
-
|
|
93876
|
-
|
|
93877
|
-
|
|
93878
|
-
|
|
93879
|
-
|
|
93880
|
-
|
|
93881
93889
|
// cSpell:ignore ovrs
|
|
93882
93890
|
/** Describes the geometry and styling of a sheet border decoration.
|
|
93883
93891
|
* The sheet border decoration mimics a sheet of paper with a drop shadow.
|
|
@@ -93946,206 +93954,25 @@ class SheetBorder {
|
|
|
93946
93954
|
params.fillColor = fillColor;
|
|
93947
93955
|
params.gradient = this._gradient;
|
|
93948
93956
|
builder.activateGraphicParams(params);
|
|
93949
|
-
builder.addShape2d(this._shadow,
|
|
93957
|
+
builder.addShape2d(this._shadow, _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance);
|
|
93950
93958
|
builder.setSymbology(lineColor, fillColor, 2);
|
|
93951
93959
|
builder.addLineString2d(this._rect, 0);
|
|
93952
93960
|
}
|
|
93953
93961
|
}
|
|
93954
|
-
/** The information required to instantiate an ViewAttachments object to draw ViewAttachments into a sheet. The list of view attachment Ids is
|
|
93955
|
-
* supplied to SheetViewState via the constructor. The corresponding ViewAttachmentProps for each attachment are obtained asynchronously in
|
|
93956
|
-
* SheetViewState.load(). The Attachments object is created in SheetViewState.attachToViewport and disposed of in SheetViewState.detachFromViewport.
|
|
93957
|
-
*/
|
|
93958
|
-
class ViewAttachmentsInfo {
|
|
93959
|
-
_attachments;
|
|
93960
|
-
get attachments() { return this._attachments; }
|
|
93961
|
-
constructor(attachments) {
|
|
93962
|
-
this._attachments = attachments;
|
|
93963
|
-
}
|
|
93964
|
-
get isLoaded() {
|
|
93965
|
-
return 0 === this._attachments.length || "string" !== typeof this._attachments[0];
|
|
93966
|
-
}
|
|
93967
|
-
get viewAttachmentProps() {
|
|
93968
|
-
return this.isLoaded ? this._props : [];
|
|
93969
|
-
}
|
|
93970
|
-
get _props() {
|
|
93971
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(this.isLoaded);
|
|
93972
|
-
return this._attachments;
|
|
93973
|
-
}
|
|
93974
|
-
get _ids() {
|
|
93975
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this.isLoaded);
|
|
93976
|
-
return this._attachments;
|
|
93977
|
-
}
|
|
93978
|
-
static fromJSON(ids = []) {
|
|
93979
|
-
return new ViewAttachmentsInfo(ids);
|
|
93980
|
-
}
|
|
93981
|
-
toJSON() {
|
|
93982
|
-
return this.isLoaded ? this._props.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(x.id)) : [...this._ids];
|
|
93983
|
-
}
|
|
93984
|
-
clone(iModel) {
|
|
93985
|
-
let attachments = this._attachments;
|
|
93986
|
-
if (this.isLoaded) {
|
|
93987
|
-
// Need to clone the attached ViewStates.
|
|
93988
|
-
attachments = attachments.map((attachment) => {
|
|
93989
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(typeof attachment !== "string");
|
|
93990
|
-
return {
|
|
93991
|
-
...attachment,
|
|
93992
|
-
attachedView: attachment.attachedView.clone(iModel),
|
|
93993
|
-
};
|
|
93994
|
-
});
|
|
93995
|
-
}
|
|
93996
|
-
return new ViewAttachmentsInfo(attachments);
|
|
93997
|
-
}
|
|
93998
|
-
preload(options) {
|
|
93999
|
-
if (this.isLoaded)
|
|
94000
|
-
return;
|
|
94001
|
-
options.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.CompressedId64Set.sortAndCompress(this._ids);
|
|
94002
|
-
options.viewStateLoadProps = {
|
|
94003
|
-
displayStyle: {
|
|
94004
|
-
omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
|
|
94005
|
-
compressExcludedElementIds: true,
|
|
94006
|
-
},
|
|
94007
|
-
};
|
|
94008
|
-
}
|
|
94009
|
-
async postload(options, iModel) {
|
|
94010
|
-
if (options.sheetViewViews === undefined)
|
|
94011
|
-
return;
|
|
94012
|
-
if (options.sheetViewAttachmentProps === undefined)
|
|
94013
|
-
return;
|
|
94014
|
-
const viewStateProps = options.sheetViewViews; // This is viewstateProps, need to turn this into ViewState
|
|
94015
|
-
const promises = [];
|
|
94016
|
-
for (const viewProps of viewStateProps) {
|
|
94017
|
-
const loadView = async () => {
|
|
94018
|
-
try {
|
|
94019
|
-
if (viewProps === undefined)
|
|
94020
|
-
return undefined;
|
|
94021
|
-
const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
|
|
94022
|
-
return view;
|
|
94023
|
-
}
|
|
94024
|
-
catch {
|
|
94025
|
-
return undefined;
|
|
94026
|
-
}
|
|
94027
|
-
};
|
|
94028
|
-
promises.push(loadView());
|
|
94029
|
-
}
|
|
94030
|
-
const views = await Promise.all(promises);
|
|
94031
|
-
const attachmentProps = options.sheetViewAttachmentProps;
|
|
94032
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
|
|
94033
|
-
const attachments = [];
|
|
94034
|
-
for (let i = 0; i < views.length; i++) {
|
|
94035
|
-
const view = views[i];
|
|
94036
|
-
if (view && !(view instanceof SheetViewState)) {
|
|
94037
|
-
const props = attachmentProps[i];
|
|
94038
|
-
props.attachedView = view;
|
|
94039
|
-
attachments.push(props);
|
|
94040
|
-
}
|
|
94041
|
-
}
|
|
94042
|
-
this._attachments = attachments;
|
|
94043
|
-
}
|
|
94044
|
-
async load(iModel) {
|
|
94045
|
-
if (this.isLoaded)
|
|
94046
|
-
return;
|
|
94047
|
-
const attachmentProps = await iModel.elements.getProps(this._ids);
|
|
94048
|
-
const promises = [];
|
|
94049
|
-
for (const attachment of attachmentProps) {
|
|
94050
|
-
const loadView = async () => {
|
|
94051
|
-
try {
|
|
94052
|
-
const view = await iModel.views.load(attachment.view.id);
|
|
94053
|
-
return view;
|
|
94054
|
-
}
|
|
94055
|
-
catch {
|
|
94056
|
-
return undefined;
|
|
94057
|
-
}
|
|
94058
|
-
};
|
|
94059
|
-
promises.push(loadView());
|
|
94060
|
-
}
|
|
94061
|
-
const views = await Promise.all(promises);
|
|
94062
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(views.length === attachmentProps.length);
|
|
94063
|
-
const attachments = [];
|
|
94064
|
-
for (let i = 0; i < views.length; i++) {
|
|
94065
|
-
const view = views[i];
|
|
94066
|
-
if (view && !(view instanceof SheetViewState)) {
|
|
94067
|
-
const props = attachmentProps[i];
|
|
94068
|
-
props.attachedView = view;
|
|
94069
|
-
attachments.push(props);
|
|
94070
|
-
}
|
|
94071
|
-
}
|
|
94072
|
-
this._attachments = attachments;
|
|
94073
|
-
}
|
|
94074
|
-
createAttachments(sheetView) {
|
|
94075
|
-
return this.isLoaded ? new ViewAttachments(this._props, sheetView) : undefined;
|
|
94076
|
-
}
|
|
94077
|
-
}
|
|
94078
|
-
/** The set of view attachments to be displayed in a Viewport via a SheetViewState. Allocated when the view becomes attached to a Viewport;
|
|
94079
|
-
* disposed of when it becomes detached from the viewport.
|
|
94080
|
-
*/
|
|
94081
|
-
class ViewAttachments {
|
|
94082
|
-
_attachments = [];
|
|
94083
|
-
maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
|
|
94084
|
-
constructor(infos, sheetView) {
|
|
94085
|
-
for (const info of infos) {
|
|
94086
|
-
const drawAsRaster = info.jsonProperties?.displayOptions?.drawAsRaster || (info.attachedView.is3d() && info.attachedView.isCameraOn);
|
|
94087
|
-
const ctor = drawAsRaster ? RasterAttachment : OrthographicAttachment;
|
|
94088
|
-
const attachment = new ctor(info.attachedView, info, sheetView);
|
|
94089
|
-
this._attachments.push(attachment);
|
|
94090
|
-
this.maxDepth = Math.max(this.maxDepth, attachment.zDepth);
|
|
94091
|
-
}
|
|
94092
|
-
}
|
|
94093
|
-
[Symbol.dispose]() {
|
|
94094
|
-
for (const attachment of this._attachments)
|
|
94095
|
-
attachment[Symbol.dispose]();
|
|
94096
|
-
this._attachments.length = 0;
|
|
94097
|
-
}
|
|
94098
|
-
[Symbol.iterator]() {
|
|
94099
|
-
return this._attachments[Symbol.iterator]();
|
|
94100
|
-
}
|
|
94101
|
-
/** For tests. */
|
|
94102
|
-
get attachments() {
|
|
94103
|
-
return this._attachments;
|
|
94104
|
-
}
|
|
94105
|
-
get isEmpty() {
|
|
94106
|
-
return 0 === this._attachments.length;
|
|
94107
|
-
}
|
|
94108
|
-
areAllTileTreesLoaded(displayedExtents) {
|
|
94109
|
-
return this._attachments.every((x) => {
|
|
94110
|
-
const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(x.viewAttachmentProps.placement);
|
|
94111
|
-
const attachmentRange = placement.calculateRange();
|
|
94112
|
-
if (!attachmentRange.intersectsRangeXY(displayedExtents))
|
|
94113
|
-
return true;
|
|
94114
|
-
return x.areAllTileTreesLoaded;
|
|
94115
|
-
});
|
|
94116
|
-
}
|
|
94117
|
-
/** Strictly for testing purposes */
|
|
94118
|
-
areAllAttachmentsLoaded() {
|
|
94119
|
-
return this._attachments.every((attachment) => attachment.areAllTileTreesLoaded);
|
|
94120
|
-
}
|
|
94121
|
-
discloseTileTrees(trees) {
|
|
94122
|
-
for (const attachment of this._attachments)
|
|
94123
|
-
trees.disclose(attachment);
|
|
94124
|
-
}
|
|
94125
|
-
collectStatistics(stats) {
|
|
94126
|
-
for (const attachment of this._attachments)
|
|
94127
|
-
attachment.collectStatistics(stats);
|
|
94128
|
-
}
|
|
94129
|
-
addToScene(context) {
|
|
94130
|
-
for (const attachment of this._attachments)
|
|
94131
|
-
attachment.addToScene(context);
|
|
94132
|
-
}
|
|
94133
|
-
findById(attachmentId) {
|
|
94134
|
-
return this._attachments.find((attachment) => attachment.viewAttachmentProps.id === attachmentId);
|
|
94135
|
-
}
|
|
94136
|
-
}
|
|
94137
93962
|
/** A view of a [SheetModel]($backend).
|
|
94138
93963
|
* @public
|
|
94139
93964
|
* @extensions
|
|
94140
93965
|
*/
|
|
94141
|
-
class SheetViewState extends
|
|
93966
|
+
class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_6__.ViewState2d {
|
|
94142
93967
|
/** The width and height of the sheet in world coordinates. */
|
|
94143
93968
|
sheetSize;
|
|
94144
|
-
|
|
94145
|
-
_attachments;
|
|
93969
|
+
_viewAttachments;
|
|
94146
93970
|
_viewedExtents;
|
|
93971
|
+
_onViewAttachmentsReloaded = () => undefined;
|
|
93972
|
+
/** Strictly for tests. */
|
|
93973
|
+
onViewAttachmentsReloaded = new _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.BeEvent();
|
|
94147
93974
|
get attachmentIds() {
|
|
94148
|
-
return this.
|
|
93975
|
+
return this._viewAttachments.attachmentIds;
|
|
94149
93976
|
}
|
|
94150
93977
|
static get className() { return "SheetViewDefinition"; }
|
|
94151
93978
|
static createFromProps(viewStateData, iModel) {
|
|
@@ -94156,7 +93983,7 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94156
93983
|
}
|
|
94157
93984
|
toProps() {
|
|
94158
93985
|
const props = super.toProps();
|
|
94159
|
-
props.sheetAttachments = this.
|
|
93986
|
+
props.sheetAttachments = [...this.attachmentIds];
|
|
94160
93987
|
// For sheetProps all that is actually used is the size, so just null out everything else.
|
|
94161
93988
|
const codeProps = { spec: "", scope: "", value: "" };
|
|
94162
93989
|
props.sheetProps = {
|
|
@@ -94171,20 +93998,15 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94171
93998
|
}
|
|
94172
93999
|
/** Strictly for testing. @internal */
|
|
94173
94000
|
get viewAttachmentProps() {
|
|
94174
|
-
return this.
|
|
94175
|
-
return {
|
|
94176
|
-
...x,
|
|
94177
|
-
attachedView: undefined,
|
|
94178
|
-
};
|
|
94179
|
-
});
|
|
94001
|
+
return this._viewAttachments.attachmentProps;
|
|
94180
94002
|
}
|
|
94181
94003
|
/** Strictly for testing. @internal */
|
|
94182
94004
|
get viewAttachmentInfos() {
|
|
94183
|
-
return this.
|
|
94005
|
+
return this._viewAttachments.attachmentInfos;
|
|
94184
94006
|
}
|
|
94185
94007
|
/** Strictly for testing. @internal */
|
|
94186
94008
|
get attachments() {
|
|
94187
|
-
return this.
|
|
94009
|
+
return this._viewAttachments.attachments;
|
|
94188
94010
|
}
|
|
94189
94011
|
isDrawingView() { return false; }
|
|
94190
94012
|
isSheetView() { return true; }
|
|
@@ -94193,41 +94015,53 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94193
94015
|
if (categories instanceof SheetViewState) {
|
|
94194
94016
|
// we are coming from clone...
|
|
94195
94017
|
this.sheetSize = categories.sheetSize.clone();
|
|
94196
|
-
this.
|
|
94018
|
+
this._viewAttachments = categories._viewAttachments.clone(iModel);
|
|
94197
94019
|
this._viewedExtents = categories._viewedExtents.clone();
|
|
94198
94020
|
}
|
|
94199
94021
|
else {
|
|
94200
94022
|
this.sheetSize = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(sheetProps.width, sheetProps.height);
|
|
94201
|
-
this.
|
|
94023
|
+
this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachments);
|
|
94202
94024
|
const extents = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d(0, 0, 0, this.sheetSize.x, this.sheetSize.y, 0);
|
|
94203
94025
|
const margin = 1.1;
|
|
94204
94026
|
extents.scaleAboutCenterInPlace(margin);
|
|
94205
94027
|
this._viewedExtents = extents;
|
|
94206
94028
|
}
|
|
94029
|
+
if (iModel.isBriefcaseConnection()) {
|
|
94030
|
+
iModel.txns.onElementsChanged.addListener(async (changes) => {
|
|
94031
|
+
let reload = false;
|
|
94032
|
+
for (const change of changes.filter({ includeMetadata: (meta) => meta.is("BisCore:ViewAttachment") })) {
|
|
94033
|
+
if (change.type === "inserted" || this._viewAttachments.attachmentIds.includes(change.id)) {
|
|
94034
|
+
reload = true;
|
|
94035
|
+
break;
|
|
94036
|
+
}
|
|
94037
|
+
}
|
|
94038
|
+
if (reload) {
|
|
94039
|
+
await this._viewAttachments.reload(this.baseModelId, iModel);
|
|
94040
|
+
this._onViewAttachmentsReloaded();
|
|
94041
|
+
this.onViewAttachmentsReloaded.raiseEvent();
|
|
94042
|
+
}
|
|
94043
|
+
});
|
|
94044
|
+
}
|
|
94207
94045
|
}
|
|
94208
94046
|
getOrigin() {
|
|
94209
94047
|
const origin = super.getOrigin();
|
|
94210
|
-
|
|
94211
|
-
origin.z = -this._attachments.maxDepth;
|
|
94048
|
+
origin.z = -this._viewAttachments.maxDepth;
|
|
94212
94049
|
return origin;
|
|
94213
94050
|
}
|
|
94214
94051
|
getExtents() {
|
|
94215
94052
|
const extents = super.getExtents();
|
|
94216
|
-
|
|
94217
|
-
extents.z = this._attachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.minimumZDistance;
|
|
94053
|
+
extents.z = this._viewAttachments.maxDepth + _Frustum2d__WEBPACK_IMPORTED_MODULE_5__.Frustum2d.minimumZDistance;
|
|
94218
94054
|
return extents;
|
|
94219
94055
|
}
|
|
94220
94056
|
/** Overrides [[ViewState.discloseTileTrees]] to include tile trees associated with [ViewAttachment]($backend)s displayed on this sheet. */
|
|
94221
94057
|
discloseTileTrees(trees) {
|
|
94222
94058
|
super.discloseTileTrees(trees);
|
|
94223
|
-
|
|
94224
|
-
trees.disclose(this._attachments);
|
|
94059
|
+
trees.disclose(this._viewAttachments);
|
|
94225
94060
|
}
|
|
94226
94061
|
/** @internal */
|
|
94227
94062
|
collectNonTileTreeStatistics(stats) {
|
|
94228
94063
|
super.collectNonTileTreeStatistics(stats);
|
|
94229
|
-
|
|
94230
|
-
this._attachments.collectStatistics(stats);
|
|
94064
|
+
this._viewAttachments.collectStatistics(stats);
|
|
94231
94065
|
}
|
|
94232
94066
|
get defaultExtentLimits() {
|
|
94233
94067
|
return { min: _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Constant.oneMillimeter, max: this.sheetSize.magnitude() * 10 };
|
|
@@ -94238,36 +94072,23 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94238
94072
|
/** @internal */
|
|
94239
94073
|
preload(hydrateRequest) {
|
|
94240
94074
|
super.preload(hydrateRequest);
|
|
94241
|
-
this.
|
|
94075
|
+
this._viewAttachments.preload(hydrateRequest);
|
|
94242
94076
|
}
|
|
94243
94077
|
/** @internal */
|
|
94244
94078
|
async postload(hydrateResponse) {
|
|
94245
94079
|
const promises = [];
|
|
94246
94080
|
promises.push(super.postload(hydrateResponse));
|
|
94247
|
-
promises.push(this.
|
|
94081
|
+
promises.push(this._viewAttachments.postload(hydrateResponse, this.iModel));
|
|
94248
94082
|
await Promise.all(promises);
|
|
94249
94083
|
}
|
|
94250
94084
|
/** @internal */
|
|
94251
94085
|
createScene(context) {
|
|
94252
94086
|
super.createScene(context);
|
|
94253
|
-
|
|
94254
|
-
this._attachments.addToScene(context);
|
|
94087
|
+
this._viewAttachments.addToScene(context);
|
|
94255
94088
|
}
|
|
94256
94089
|
/** @internal */
|
|
94257
94090
|
get secondaryViewports() {
|
|
94258
|
-
|
|
94259
|
-
return super.secondaryViewports;
|
|
94260
|
-
const attachments = this._attachments;
|
|
94261
|
-
function* iterator() {
|
|
94262
|
-
for (const attachment of attachments) {
|
|
94263
|
-
const vp = attachment.viewport;
|
|
94264
|
-
if (vp)
|
|
94265
|
-
yield vp;
|
|
94266
|
-
}
|
|
94267
|
-
}
|
|
94268
|
-
return {
|
|
94269
|
-
[Symbol.iterator]: () => iterator(),
|
|
94270
|
-
};
|
|
94091
|
+
return this._viewAttachments.getSecondaryViewports();
|
|
94271
94092
|
}
|
|
94272
94093
|
/** @internal */
|
|
94273
94094
|
async queryAttachmentIds() {
|
|
@@ -94280,39 +94101,43 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94280
94101
|
async changeViewedModel(modelId) {
|
|
94281
94102
|
await super.changeViewedModel(modelId);
|
|
94282
94103
|
const attachmentIds = await this.queryAttachmentIds();
|
|
94283
|
-
this.
|
|
94284
|
-
|
|
94104
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewAttachments);
|
|
94105
|
+
this._viewAttachments = _internal_SheetViewAttachments__WEBPACK_IMPORTED_MODULE_8__.SheetViewAttachments.create(attachmentIds);
|
|
94285
94106
|
}
|
|
94286
94107
|
/** See [[ViewState.attachToViewport]]. */
|
|
94287
94108
|
attachToViewport(args) {
|
|
94288
94109
|
super.attachToViewport(args);
|
|
94289
|
-
|
|
94290
|
-
|
|
94110
|
+
this._viewAttachments.attachToViewport({
|
|
94111
|
+
backgroundColor: this.displayStyle.backgroundColor,
|
|
94112
|
+
sheetModelId: this.baseModelId,
|
|
94113
|
+
});
|
|
94114
|
+
this._onViewAttachmentsReloaded = () => args.invalidateController();
|
|
94291
94115
|
}
|
|
94292
94116
|
/** See [[ViewState.detachFromViewport]]. */
|
|
94293
94117
|
detachFromViewport() {
|
|
94294
94118
|
super.detachFromViewport();
|
|
94295
|
-
this.
|
|
94119
|
+
this._viewAttachments.detachFromViewport();
|
|
94120
|
+
this._onViewAttachmentsReloaded = () => undefined;
|
|
94296
94121
|
}
|
|
94297
94122
|
get areAllTileTreesLoaded() {
|
|
94123
|
+
if (!super.areAllTileTreesLoaded) {
|
|
94124
|
+
return false;
|
|
94125
|
+
}
|
|
94298
94126
|
let displayedExtents = this._viewedExtents;
|
|
94299
94127
|
const frustum = this.calculateFrustum();
|
|
94300
94128
|
if (frustum) {
|
|
94301
94129
|
displayedExtents = frustum.toRange();
|
|
94302
94130
|
}
|
|
94303
|
-
return
|
|
94131
|
+
return this._viewAttachments.areAllTileTreesLoaded(displayedExtents);
|
|
94304
94132
|
}
|
|
94305
94133
|
/** @internal Strictly for testing */
|
|
94306
94134
|
areAllAttachmentsLoaded() {
|
|
94307
|
-
|
|
94308
|
-
return this._attachments.areAllAttachmentsLoaded();
|
|
94309
|
-
}
|
|
94310
|
-
return true;
|
|
94135
|
+
return this._viewAttachments.areAllAttachmentsLoaded();
|
|
94311
94136
|
}
|
|
94312
94137
|
/** Create a sheet border decoration graphic. */
|
|
94313
94138
|
createBorder(width, height, context) {
|
|
94314
94139
|
const border = SheetBorder.create(width, height, context);
|
|
94315
|
-
const builder = context.createGraphicBuilder(
|
|
94140
|
+
const builder = context.createGraphicBuilder(_common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__.GraphicType.ViewBackground);
|
|
94316
94141
|
border.addToBuilder(builder);
|
|
94317
94142
|
return builder.finish();
|
|
94318
94143
|
}
|
|
@@ -94332,453 +94157,13 @@ class SheetViewState extends _ViewState__WEBPACK_IMPORTED_MODULE_12__.ViewState2
|
|
|
94332
94157
|
}
|
|
94333
94158
|
/** @internal */
|
|
94334
94159
|
getAttachmentViewport(args) {
|
|
94335
|
-
|
|
94336
|
-
if (!attachment) {
|
|
94337
|
-
return undefined;
|
|
94338
|
-
}
|
|
94339
|
-
return args.inSectionDrawingAttachment ? attachment.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : attachment.viewport;
|
|
94160
|
+
return this._viewAttachments.getAttachmentViewport(args);
|
|
94340
94161
|
}
|
|
94341
94162
|
/** @beta */
|
|
94342
94163
|
computeDisplayTransform(args) {
|
|
94343
94164
|
// ###TODO we're currently ignoring model and element Id in args, assuming irrelevant for sheets.
|
|
94344
94165
|
// Should probably call super or have super call us.
|
|
94345
|
-
|
|
94346
|
-
if (!attachment || !(attachment instanceof OrthographicAttachment)) {
|
|
94347
|
-
return undefined;
|
|
94348
|
-
}
|
|
94349
|
-
const sheetTransform = attachment.toSheet;
|
|
94350
|
-
const sectionTransform = args.inSectionDrawingAttachment ? attachment.view.computeDisplayTransform(args) : undefined;
|
|
94351
|
-
if (!sectionTransform) {
|
|
94352
|
-
return sheetTransform.clone(args.output);
|
|
94353
|
-
}
|
|
94354
|
-
return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
|
|
94355
|
-
}
|
|
94356
|
-
}
|
|
94357
|
-
/** A mostly no-op RenderTarget for an Attachment.
|
|
94358
|
-
* its Scene and symbology overrides.
|
|
94359
|
-
*/
|
|
94360
|
-
class AttachmentTarget extends _internal_render_MockRender__WEBPACK_IMPORTED_MODULE_7__.MockRender.OffScreenTarget {
|
|
94361
|
-
_attachment;
|
|
94362
|
-
constructor(attachment) {
|
|
94363
|
-
// The dimensions don't matter - we're not drawing anything.
|
|
94364
|
-
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(1, 1);
|
|
94365
|
-
super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem, rect);
|
|
94366
|
-
this._attachment = attachment;
|
|
94367
|
-
}
|
|
94368
|
-
changeScene(scene) {
|
|
94369
|
-
this._attachment.scene = scene;
|
|
94370
|
-
}
|
|
94371
|
-
overrideFeatureSymbology(ovrs) {
|
|
94372
|
-
this._attachment.symbologyOverrides = ovrs;
|
|
94373
|
-
}
|
|
94374
|
-
}
|
|
94375
|
-
/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
|
|
94376
|
-
* We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
|
|
94377
|
-
* collect the resultant graphics and add them to the sheet view's scene.
|
|
94378
|
-
*/
|
|
94379
|
-
class OrthographicAttachment {
|
|
94380
|
-
_viewport;
|
|
94381
|
-
_props;
|
|
94382
|
-
_sheetModelId;
|
|
94383
|
-
_viewFlagOverrides;
|
|
94384
|
-
_toSheet;
|
|
94385
|
-
_fromSheet;
|
|
94386
|
-
_sizeInMeters;
|
|
94387
|
-
_range;
|
|
94388
|
-
_viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, 1, 1);
|
|
94389
|
-
_originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Frustum();
|
|
94390
|
-
_clipVolume;
|
|
94391
|
-
_hiddenLineSettings;
|
|
94392
|
-
_scale;
|
|
94393
|
-
_debugFeatureTable;
|
|
94394
|
-
scene;
|
|
94395
|
-
symbologyOverrides;
|
|
94396
|
-
zDepth;
|
|
94397
|
-
get view() {
|
|
94398
|
-
return this._viewport.view;
|
|
94399
|
-
}
|
|
94400
|
-
get viewAttachmentProps() {
|
|
94401
|
-
return this._props;
|
|
94402
|
-
}
|
|
94403
|
-
get viewport() {
|
|
94404
|
-
return this._viewport;
|
|
94405
|
-
}
|
|
94406
|
-
constructor(view, props, sheetView) {
|
|
94407
|
-
this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
|
|
94408
|
-
const target = new AttachmentTarget(this);
|
|
94409
|
-
this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport.createViewport(view, target, true);
|
|
94410
|
-
this._props = props;
|
|
94411
|
-
this._sheetModelId = sheetView.baseModelId;
|
|
94412
|
-
const applyClip = true; // set to false for debugging
|
|
94413
|
-
this._viewFlagOverrides = {
|
|
94414
|
-
...view.viewFlags,
|
|
94415
|
-
clipVolume: applyClip,
|
|
94416
|
-
lighting: false,
|
|
94417
|
-
shadows: false,
|
|
94418
|
-
};
|
|
94419
|
-
const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
|
|
94420
|
-
const range = placement.calculateRange();
|
|
94421
|
-
this._range = range;
|
|
94422
|
-
this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(range.xLength(), range.yLength());
|
|
94423
|
-
// Compute transform from attached view's world coordinates to sheet's world coordinates.
|
|
94424
|
-
// NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
|
|
94425
|
-
const applySkew = true; // set to false for debugging
|
|
94426
|
-
const skew = applySkew ? view.getAspectRatioSkew() : 1;
|
|
94427
|
-
const extents = this._viewport.viewingSpace.viewDelta.clone();
|
|
94428
|
-
const zDepth = Math.abs(extents.z);
|
|
94429
|
-
const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
|
|
94430
|
-
const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
|
|
94431
|
-
this._scale = { x: 1 / scaleX, y: 1 / scaleY };
|
|
94432
|
-
const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
94433
|
-
this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
|
|
94434
|
-
// View origin is at the *back* of the view. Align *front* of view based on display priority.
|
|
94435
|
-
const viewRot = view.getRotation();
|
|
94436
|
-
const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
|
|
94437
|
-
viewOrg.z += zDepth;
|
|
94438
|
-
viewRot.multiplyTransposeVectorInPlace(viewOrg);
|
|
94439
|
-
const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.createScale(scaleX, scaleY, 1);
|
|
94440
|
-
matrix.multiplyMatrixMatrix(viewRot, matrix);
|
|
94441
|
-
const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
|
|
94442
|
-
const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.createFrom(placement.origin);
|
|
94443
|
-
attachmentOrigin.z = zBias;
|
|
94444
|
-
const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
|
|
94445
|
-
origin.addInPlace(viewOrgToAttachment);
|
|
94446
|
-
this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Transform.createRefs(origin, matrix);
|
|
94447
|
-
this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.expectDefined)(this._toSheet.inverse());
|
|
94448
|
-
// If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
|
|
94449
|
-
// The clip needs to be transformed into sheet space.
|
|
94450
|
-
if (view.isDrawingView())
|
|
94451
|
-
this._viewport.drawingToSheetTransform = this._toSheet;
|
|
94452
|
-
// ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
|
|
94453
|
-
// However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
|
|
94454
|
-
// introduce additional computation, so possibly not worth it.
|
|
94455
|
-
// Transform the view's clip (if any) to sheet space
|
|
94456
|
-
let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
|
|
94457
|
-
if (viewClip)
|
|
94458
|
-
viewClip.transformInPlace(this._toSheet);
|
|
94459
|
-
else
|
|
94460
|
-
viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.createEmpty();
|
|
94461
|
-
let sheetClip;
|
|
94462
|
-
if (undefined !== props.jsonProperties?.clip)
|
|
94463
|
-
sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(props.jsonProperties?.clip);
|
|
94464
|
-
if (sheetClip && sheetClip.isValid) {
|
|
94465
|
-
// Clip to view attachment's clip. NB: clip is in sheet coordinate space.
|
|
94466
|
-
for (const clip of sheetClip.clips)
|
|
94467
|
-
viewClip.clips.push(clip);
|
|
94468
|
-
}
|
|
94469
|
-
else {
|
|
94470
|
-
// Clip to view attachment's bounding box
|
|
94471
|
-
viewClip.appendShape([
|
|
94472
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.low.y),
|
|
94473
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.low.y),
|
|
94474
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.high.x, this._range.high.y),
|
|
94475
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(this._range.low.x, this._range.high.y),
|
|
94476
|
-
]);
|
|
94477
|
-
}
|
|
94478
|
-
this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(viewClip);
|
|
94479
|
-
// Save off the original frustum (potentially adjusted by viewport).
|
|
94480
|
-
this._viewport.setupFromView();
|
|
94481
|
-
this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_10__.CoordSystem.World, true, this._originalFrustum);
|
|
94482
|
-
const applyHiddenLineSettings = true; // for debugging edge display, set to false...
|
|
94483
|
-
const style = view.displayStyle;
|
|
94484
|
-
if (style.is3d() && applyHiddenLineSettings)
|
|
94485
|
-
this._hiddenLineSettings = style.settings.hiddenLineSettings;
|
|
94486
|
-
}
|
|
94487
|
-
[Symbol.dispose]() {
|
|
94488
|
-
this._viewport[Symbol.dispose]();
|
|
94489
|
-
}
|
|
94490
|
-
discloseTileTrees(trees) {
|
|
94491
|
-
trees.disclose(this._viewport);
|
|
94492
|
-
}
|
|
94493
|
-
addToScene(context) {
|
|
94494
|
-
if (context.viewport.freezeScene)
|
|
94495
|
-
return;
|
|
94496
|
-
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
94497
|
-
return;
|
|
94498
|
-
const wantBounds = context.viewport.wantViewAttachmentBoundaries;
|
|
94499
|
-
const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
|
|
94500
|
-
if (wantBounds || wantClipShapes) {
|
|
94501
|
-
const builder = context.createSceneGraphicBuilder();
|
|
94502
|
-
if (wantBounds) {
|
|
94503
|
-
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
|
|
94504
|
-
builder.addRangeBox(this._range);
|
|
94505
|
-
}
|
|
94506
|
-
if (wantClipShapes && this._clipVolume) {
|
|
94507
|
-
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.blue, 2);
|
|
94508
|
-
for (const prim of this._clipVolume.clipVector.clips) {
|
|
94509
|
-
if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipShape))
|
|
94510
|
-
continue; // ###TODO handle non-shape primitives, if any such ever encountered
|
|
94511
|
-
const pts = [];
|
|
94512
|
-
const tf = prim.transformFromClip;
|
|
94513
|
-
for (const pt of prim.polygon) {
|
|
94514
|
-
const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
|
|
94515
|
-
pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d(tfPt.x, tfPt.y));
|
|
94516
|
-
}
|
|
94517
|
-
builder.addLineString2d(pts, 0);
|
|
94518
|
-
}
|
|
94519
|
-
}
|
|
94520
|
-
// Put into a Batch so that we can see tooltip with attachment Id on mouseover.
|
|
94521
|
-
const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
|
|
94522
|
-
context.outputGraphic(batch);
|
|
94523
|
-
}
|
|
94524
|
-
if (!context.viewport.wantViewAttachments)
|
|
94525
|
-
return;
|
|
94526
|
-
// Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
|
|
94527
|
-
const pixelSize = context.viewport.getPixelSizeAtPoint();
|
|
94528
|
-
if (0 === pixelSize)
|
|
94529
|
-
return;
|
|
94530
|
-
// Adjust attached view frustum based on intersection with sheet view frustum.
|
|
94531
|
-
const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
|
|
94532
|
-
const attachFrustumRange = attachFrustum.toRange();
|
|
94533
|
-
const sheetFrustum = context.viewport.getWorldFrustum();
|
|
94534
|
-
const sheetFrustumRange = sheetFrustum.toRange();
|
|
94535
|
-
const intersect = attachFrustumRange.intersect(sheetFrustumRange);
|
|
94536
|
-
if (intersect.isNull)
|
|
94537
|
-
return;
|
|
94538
|
-
attachFrustum.initFromRange(intersect);
|
|
94539
|
-
attachFrustum.transformBy(this._fromSheet, attachFrustum);
|
|
94540
|
-
this._viewport.setupViewFromFrustum(attachFrustum);
|
|
94541
|
-
// Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
|
|
94542
|
-
const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
|
|
94543
|
-
const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
|
|
94544
|
-
this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
|
|
94545
|
-
this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
|
|
94546
|
-
this._viewport.setRect(this._viewRect);
|
|
94547
|
-
// Propagate settings from on-screen viewport.
|
|
94548
|
-
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
94549
|
-
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
94550
|
-
// Create the scene.
|
|
94551
|
-
this._viewport.renderFrame();
|
|
94552
|
-
const scene = this.scene;
|
|
94553
|
-
if (!scene)
|
|
94554
|
-
return;
|
|
94555
|
-
// Extract scene graphics and insert into on-screen scene context.
|
|
94556
|
-
const options = {
|
|
94557
|
-
viewAttachmentId: this._props.id,
|
|
94558
|
-
clipVolume: this._clipVolume,
|
|
94559
|
-
hline: this._hiddenLineSettings,
|
|
94560
|
-
frustum: {
|
|
94561
|
-
is3d: this.view.is3d(),
|
|
94562
|
-
scale: this._scale,
|
|
94563
|
-
},
|
|
94564
|
-
};
|
|
94565
|
-
const outputGraphics = (source) => {
|
|
94566
|
-
if (0 === source.length)
|
|
94567
|
-
return;
|
|
94568
|
-
const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch();
|
|
94569
|
-
graphics.setViewFlagOverrides(this._viewFlagOverrides);
|
|
94570
|
-
graphics.symbologyOverrides = this.symbologyOverrides;
|
|
94571
|
-
for (const graphic of source)
|
|
94572
|
-
graphics.entries.push(graphic);
|
|
94573
|
-
const branch = context.createGraphicBranch(graphics, this._toSheet, options);
|
|
94574
|
-
context.outputGraphic(branch);
|
|
94575
|
-
};
|
|
94576
|
-
outputGraphics(scene.foreground);
|
|
94577
|
-
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
|
|
94578
|
-
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_13__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
|
|
94579
|
-
// Report tile statistics to sheet view's viewport.
|
|
94580
|
-
const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.tileAdmin;
|
|
94581
|
-
const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
|
|
94582
|
-
const requested = tileAdmin.getRequestsForUser(this._viewport);
|
|
94583
|
-
tileAdmin.addExternalTilesForUser(context.viewport, {
|
|
94584
|
-
requested: requested?.size ?? 0,
|
|
94585
|
-
selected: selectedAndReady?.selected.size ?? 0,
|
|
94586
|
-
ready: selectedAndReady?.ready.size ?? 0,
|
|
94587
|
-
});
|
|
94588
|
-
}
|
|
94589
|
-
getDebugFeatureTable() {
|
|
94590
|
-
if (this._debugFeatureTable)
|
|
94591
|
-
return this._debugFeatureTable;
|
|
94592
|
-
const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.FeatureTable(1, this._sheetModelId);
|
|
94593
|
-
featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Feature(this._props.id));
|
|
94594
|
-
this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.PackedFeatureTable.pack(featureTable);
|
|
94595
|
-
return this._debugFeatureTable;
|
|
94596
|
-
}
|
|
94597
|
-
get areAllTileTreesLoaded() {
|
|
94598
|
-
return this.view.areAllTileTreesLoaded;
|
|
94599
|
-
}
|
|
94600
|
-
collectStatistics(_stats) {
|
|
94601
|
-
// Handled by discloseTileTrees()
|
|
94602
|
-
}
|
|
94603
|
-
get toSheet() {
|
|
94604
|
-
return this._toSheet;
|
|
94605
|
-
}
|
|
94606
|
-
}
|
|
94607
|
-
function createRasterAttachmentViewport(_view, _rect, _attachment) {
|
|
94608
|
-
class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_11__.OffScreenViewport {
|
|
94609
|
-
_sceneContext;
|
|
94610
|
-
_isSceneReady = false;
|
|
94611
|
-
_attachment;
|
|
94612
|
-
constructor(view, rect, attachment) {
|
|
94613
|
-
super(_IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createOffscreenTarget(rect));
|
|
94614
|
-
this._attachment = attachment;
|
|
94615
|
-
this._isAspectRatioLocked = true;
|
|
94616
|
-
this.changeView(view);
|
|
94617
|
-
}
|
|
94618
|
-
createSceneContext() {
|
|
94619
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
|
|
94620
|
-
this._sceneContext = super.createSceneContext();
|
|
94621
|
-
return this._sceneContext;
|
|
94622
|
-
}
|
|
94623
|
-
renderFrame() {
|
|
94624
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(!this._isSceneReady);
|
|
94625
|
-
this.clearSceneContext();
|
|
94626
|
-
super.renderFrame();
|
|
94627
|
-
if (undefined !== this._sceneContext) {
|
|
94628
|
-
this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
|
|
94629
|
-
if (this._isSceneReady)
|
|
94630
|
-
this._attachment.produceGraphics(this._sceneContext);
|
|
94631
|
-
this._sceneContext = undefined;
|
|
94632
|
-
}
|
|
94633
|
-
}
|
|
94634
|
-
clearSceneContext() {
|
|
94635
|
-
this._sceneContext = undefined;
|
|
94636
|
-
}
|
|
94637
|
-
addDecorations(_decorations) {
|
|
94638
|
-
// ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
|
|
94639
|
-
}
|
|
94640
|
-
}
|
|
94641
|
-
return new RasterAttachmentViewport(_view, _rect, _attachment);
|
|
94642
|
-
}
|
|
94643
|
-
/** Draws a 3d view with camera enabled into a sheet view by producing an image of the view's contents offscreen. */
|
|
94644
|
-
class RasterAttachment {
|
|
94645
|
-
_props;
|
|
94646
|
-
_placement;
|
|
94647
|
-
_transform;
|
|
94648
|
-
zDepth;
|
|
94649
|
-
_viewport;
|
|
94650
|
-
_graphics;
|
|
94651
|
-
constructor(view, props, sheetView) {
|
|
94652
|
-
// Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
|
|
94653
|
-
const maxSize = 2048;
|
|
94654
|
-
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_15__.ViewRect(0, 0, maxSize, maxSize);
|
|
94655
|
-
const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
|
|
94656
|
-
const skew = maxSize / height;
|
|
94657
|
-
view.setAspectRatioSkew(skew);
|
|
94658
|
-
if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
|
|
94659
|
-
// Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
|
|
94660
|
-
const bgColor = sheetView.displayStyle.backgroundColor.withAlpha(0);
|
|
94661
|
-
view.displayStyle.backgroundColor = bgColor;
|
|
94662
|
-
}
|
|
94663
|
-
this._viewport = createRasterAttachmentViewport(view, rect, this);
|
|
94664
|
-
this._props = props;
|
|
94665
|
-
this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.Placement2d.fromJSON(props.placement);
|
|
94666
|
-
this._transform = this._placement.transform;
|
|
94667
|
-
this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_6__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
94668
|
-
}
|
|
94669
|
-
[Symbol.dispose]() {
|
|
94670
|
-
this._viewport?.[Symbol.dispose]();
|
|
94671
|
-
}
|
|
94672
|
-
get viewAttachmentProps() {
|
|
94673
|
-
return this._props;
|
|
94674
|
-
}
|
|
94675
|
-
get viewport() {
|
|
94676
|
-
return this._viewport;
|
|
94677
|
-
}
|
|
94678
|
-
get areAllTileTreesLoaded() {
|
|
94679
|
-
return this._viewport?.areAllTileTreesLoaded ?? true;
|
|
94680
|
-
}
|
|
94681
|
-
addToScene(context) {
|
|
94682
|
-
// ###TODO: check viewport.wantViewAttachmentClipShapes
|
|
94683
|
-
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
94684
|
-
return;
|
|
94685
|
-
if (context.viewport.wantViewAttachmentBoundaries) {
|
|
94686
|
-
const builder = context.createSceneGraphicBuilder(this._transform);
|
|
94687
|
-
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.ColorDef.red, 2);
|
|
94688
|
-
builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Range3d.createRange2d(this._placement.bbox));
|
|
94689
|
-
context.outputGraphic(builder.finish());
|
|
94690
|
-
}
|
|
94691
|
-
if (!context.viewport.wantViewAttachments)
|
|
94692
|
-
return;
|
|
94693
|
-
if (this._graphics) {
|
|
94694
|
-
context.outputGraphic(this._graphics);
|
|
94695
|
-
return;
|
|
94696
|
-
}
|
|
94697
|
-
if (undefined === this._viewport)
|
|
94698
|
-
return;
|
|
94699
|
-
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
94700
|
-
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
94701
|
-
this._viewport.renderFrame();
|
|
94702
|
-
if (this._graphics)
|
|
94703
|
-
context.outputGraphic(this._graphics);
|
|
94704
|
-
}
|
|
94705
|
-
discloseTileTrees(trees) {
|
|
94706
|
-
if (this._viewport)
|
|
94707
|
-
trees.disclose(this._viewport);
|
|
94708
|
-
}
|
|
94709
|
-
produceGraphics(context) {
|
|
94710
|
-
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.assert)(context.viewport === this._viewport);
|
|
94711
|
-
this._graphics = this.createGraphics(this._viewport);
|
|
94712
|
-
this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_0__.dispose)(this._viewport);
|
|
94713
|
-
if (undefined !== this._graphics)
|
|
94714
|
-
context.outputGraphic(this._graphics);
|
|
94715
|
-
}
|
|
94716
|
-
createGraphics(vp) {
|
|
94717
|
-
// Create a texture from the contents of the view.
|
|
94718
|
-
const image = vp.readImageBuffer({ upsideDown: true });
|
|
94719
|
-
if (undefined === image)
|
|
94720
|
-
return undefined;
|
|
94721
|
-
const debugImage = false; // set to true to open a window displaying the captured image.
|
|
94722
|
-
if (debugImage) {
|
|
94723
|
-
const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.imageBufferToPngDataUrl)(image, false);
|
|
94724
|
-
if (url)
|
|
94725
|
-
(0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_14__.openImageDataUrlInNewWindow)(url, "Attachment");
|
|
94726
|
-
}
|
|
94727
|
-
const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createTexture({
|
|
94728
|
-
image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.TextureTransparency.Opaque },
|
|
94729
|
-
});
|
|
94730
|
-
if (!texture)
|
|
94731
|
-
return undefined;
|
|
94732
|
-
// Create a material for the texture
|
|
94733
|
-
const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.GraphicParams();
|
|
94734
|
-
graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
|
|
94735
|
-
// Apply the texture to a rectangular polyface.
|
|
94736
|
-
const depth = this.zDepth;
|
|
94737
|
-
const east = this._placement.bbox.low.x;
|
|
94738
|
-
const west = this._placement.bbox.high.x;
|
|
94739
|
-
const north = this._placement.bbox.low.y;
|
|
94740
|
-
const south = this._placement.bbox.high.y;
|
|
94741
|
-
const corners = [
|
|
94742
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, north, depth),
|
|
94743
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, north, depth),
|
|
94744
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(west, south, depth),
|
|
94745
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.create(east, south, depth),
|
|
94746
|
-
];
|
|
94747
|
-
const params = [
|
|
94748
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 0),
|
|
94749
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 0),
|
|
94750
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(1, 1),
|
|
94751
|
-
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(0, 1),
|
|
94752
|
-
];
|
|
94753
|
-
const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.StrokeOptions();
|
|
94754
|
-
strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
|
|
94755
|
-
const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.PolyfaceBuilder.create(strokeOptions);
|
|
94756
|
-
polyfaceBuilder.addQuadFacet(corners, params);
|
|
94757
|
-
const polyface = polyfaceBuilder.claimPolyface();
|
|
94758
|
-
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);
|
|
94759
|
-
graphicBuilder.activateGraphicParams(graphicParams);
|
|
94760
|
-
graphicBuilder.addPolyface(polyface, false);
|
|
94761
|
-
const graphic = graphicBuilder.finish();
|
|
94762
|
-
// Wrap the polyface in a GraphicBranch.
|
|
94763
|
-
const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_5__.GraphicBranch(true);
|
|
94764
|
-
const vfOvrs = (0,_tile_internal__WEBPACK_IMPORTED_MODULE_13__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
|
|
94765
|
-
// Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
|
|
94766
|
-
vfOvrs.transparency = false;
|
|
94767
|
-
branch.setViewFlagOverrides(vfOvrs);
|
|
94768
|
-
branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
|
|
94769
|
-
branch.entries.push(graphic);
|
|
94770
|
-
// Apply the attachment's clip, if any.
|
|
94771
|
-
let clipVolume;
|
|
94772
|
-
if (this._props.jsonProperties?.clip) {
|
|
94773
|
-
const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
|
|
94774
|
-
if (clipVector.isValid)
|
|
94775
|
-
clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createClipVolume(clipVector);
|
|
94776
|
-
}
|
|
94777
|
-
return _IModelApp__WEBPACK_IMPORTED_MODULE_9__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
|
|
94778
|
-
}
|
|
94779
|
-
collectStatistics(stats) {
|
|
94780
|
-
if (this._graphics)
|
|
94781
|
-
this._graphics.collectStatistics(stats);
|
|
94166
|
+
return this._viewAttachments.computeDisplayTransform(args);
|
|
94782
94167
|
}
|
|
94783
94168
|
}
|
|
94784
94169
|
|
|
@@ -113654,6 +113039,845 @@ function getAllElementIdsFromScript(script) {
|
|
|
113654
113039
|
}
|
|
113655
113040
|
|
|
113656
113041
|
|
|
113042
|
+
/***/ }),
|
|
113043
|
+
|
|
113044
|
+
/***/ "../../core/frontend/lib/esm/internal/SheetViewAttachments.js":
|
|
113045
|
+
/*!********************************************************************!*\
|
|
113046
|
+
!*** ../../core/frontend/lib/esm/internal/SheetViewAttachments.js ***!
|
|
113047
|
+
\********************************************************************/
|
|
113048
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
113049
|
+
|
|
113050
|
+
"use strict";
|
|
113051
|
+
__webpack_require__.r(__webpack_exports__);
|
|
113052
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
113053
|
+
/* harmony export */ SheetViewAttachments: () => (/* binding */ SheetViewAttachments)
|
|
113054
|
+
/* harmony export */ });
|
|
113055
|
+
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
113056
|
+
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
113057
|
+
/* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
|
|
113058
|
+
/* harmony import */ var _ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ViewAttachmentRenderer */ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js");
|
|
113059
|
+
/* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
|
|
113060
|
+
/*---------------------------------------------------------------------------------------------
|
|
113061
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
113062
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
113063
|
+
*--------------------------------------------------------------------------------------------*/
|
|
113064
|
+
/** @packageDocumentation
|
|
113065
|
+
* @module Views
|
|
113066
|
+
*/
|
|
113067
|
+
|
|
113068
|
+
|
|
113069
|
+
|
|
113070
|
+
|
|
113071
|
+
|
|
113072
|
+
/** Stateless state for a sheet that has no view attachments. */
|
|
113073
|
+
class EmptyAttachments {
|
|
113074
|
+
// We only need one instance of this stateless class.
|
|
113075
|
+
static _instance;
|
|
113076
|
+
static get() {
|
|
113077
|
+
return this._instance ?? (this._instance = new EmptyAttachments());
|
|
113078
|
+
}
|
|
113079
|
+
constructor() { }
|
|
113080
|
+
clone() {
|
|
113081
|
+
return this;
|
|
113082
|
+
}
|
|
113083
|
+
preload() { }
|
|
113084
|
+
async postload() {
|
|
113085
|
+
return this;
|
|
113086
|
+
}
|
|
113087
|
+
get attachmentIds() {
|
|
113088
|
+
return [];
|
|
113089
|
+
}
|
|
113090
|
+
}
|
|
113091
|
+
/** Holds the element Ids of the view attachments to be loaded for display. */
|
|
113092
|
+
class AttachmentIds {
|
|
113093
|
+
_ids;
|
|
113094
|
+
constructor(ids) {
|
|
113095
|
+
this._ids = ids;
|
|
113096
|
+
}
|
|
113097
|
+
get attachmentIds() {
|
|
113098
|
+
return this._ids;
|
|
113099
|
+
}
|
|
113100
|
+
clone() {
|
|
113101
|
+
return new AttachmentIds([...this._ids]);
|
|
113102
|
+
}
|
|
113103
|
+
preload(request) {
|
|
113104
|
+
request.sheetViewAttachmentIds = _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.CompressedId64Set.sortAndCompress(this._ids);
|
|
113105
|
+
request.viewStateLoadProps = {
|
|
113106
|
+
displayStyle: {
|
|
113107
|
+
omitScheduleScriptElementIds: !_IModelApp__WEBPACK_IMPORTED_MODULE_2__.IModelApp.tileAdmin.enableFrontendScheduleScripts,
|
|
113108
|
+
compressExcludedElementIds: true,
|
|
113109
|
+
},
|
|
113110
|
+
};
|
|
113111
|
+
}
|
|
113112
|
+
async postload(response, iModel) {
|
|
113113
|
+
if (undefined === response.sheetViewViews || undefined === response.sheetViewAttachmentProps) {
|
|
113114
|
+
return this;
|
|
113115
|
+
}
|
|
113116
|
+
const viewStateProps = response.sheetViewViews;
|
|
113117
|
+
const promises = [];
|
|
113118
|
+
for (const viewProps of viewStateProps) {
|
|
113119
|
+
const loadView = async () => {
|
|
113120
|
+
try {
|
|
113121
|
+
if (viewProps === undefined)
|
|
113122
|
+
return undefined;
|
|
113123
|
+
const view = await iModel.views.convertViewStatePropsToViewState(viewProps);
|
|
113124
|
+
return view;
|
|
113125
|
+
}
|
|
113126
|
+
catch {
|
|
113127
|
+
return undefined;
|
|
113128
|
+
}
|
|
113129
|
+
};
|
|
113130
|
+
promises.push(loadView());
|
|
113131
|
+
}
|
|
113132
|
+
const views = await Promise.all(promises);
|
|
113133
|
+
const attachmentProps = response.sheetViewAttachmentProps;
|
|
113134
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
|
|
113135
|
+
const infos = [];
|
|
113136
|
+
for (let i = 0; i < views.length; i++) {
|
|
113137
|
+
const view = views[i];
|
|
113138
|
+
if (view && !(view.isSheetView())) {
|
|
113139
|
+
const props = attachmentProps[i];
|
|
113140
|
+
props.attachedView = view;
|
|
113141
|
+
infos.push(props);
|
|
113142
|
+
}
|
|
113143
|
+
}
|
|
113144
|
+
return new AttachmentInfos(infos);
|
|
113145
|
+
}
|
|
113146
|
+
}
|
|
113147
|
+
/** Fully loaded view attachments. */
|
|
113148
|
+
class AttachmentInfos {
|
|
113149
|
+
infos;
|
|
113150
|
+
constructor(infos) {
|
|
113151
|
+
this.infos = infos;
|
|
113152
|
+
}
|
|
113153
|
+
get attachmentIds() {
|
|
113154
|
+
return this.infos.map((x) => (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.expectDefined)(x.id));
|
|
113155
|
+
}
|
|
113156
|
+
clone(iModel) {
|
|
113157
|
+
const infos = this.infos.map((info) => {
|
|
113158
|
+
return {
|
|
113159
|
+
...info,
|
|
113160
|
+
attachedView: info.attachedView.clone(iModel),
|
|
113161
|
+
};
|
|
113162
|
+
});
|
|
113163
|
+
return new AttachmentInfos(infos);
|
|
113164
|
+
}
|
|
113165
|
+
preload() {
|
|
113166
|
+
// already loaded.
|
|
113167
|
+
}
|
|
113168
|
+
async postload() {
|
|
113169
|
+
// already loaded.
|
|
113170
|
+
return this;
|
|
113171
|
+
}
|
|
113172
|
+
}
|
|
113173
|
+
/** Reloads the attachments after a change to the database. */
|
|
113174
|
+
async function reloadAttachments(sheetModelId, iModel) {
|
|
113175
|
+
const ecsql = `SELECT ECInstanceId as attachmentId FROM bis.ViewAttachment WHERE model.Id=${sheetModelId}`;
|
|
113176
|
+
const ids = [];
|
|
113177
|
+
for await (const row of iModel.createQueryReader(ecsql)) {
|
|
113178
|
+
ids.push(row[0]);
|
|
113179
|
+
}
|
|
113180
|
+
const attachmentProps = await iModel.elements.getProps(ids);
|
|
113181
|
+
const promises = [];
|
|
113182
|
+
for (const attachment of attachmentProps) {
|
|
113183
|
+
const loadView = async () => {
|
|
113184
|
+
try {
|
|
113185
|
+
const view = await iModel.views.load(attachment.view.id);
|
|
113186
|
+
return view;
|
|
113187
|
+
}
|
|
113188
|
+
catch {
|
|
113189
|
+
return undefined;
|
|
113190
|
+
}
|
|
113191
|
+
};
|
|
113192
|
+
promises.push(loadView());
|
|
113193
|
+
}
|
|
113194
|
+
const views = await Promise.all(promises);
|
|
113195
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(views.length === attachmentProps.length);
|
|
113196
|
+
const infos = [];
|
|
113197
|
+
for (let i = 0; i < views.length; i++) {
|
|
113198
|
+
const view = views[i];
|
|
113199
|
+
if (view && !view.isSheetView()) {
|
|
113200
|
+
const props = attachmentProps[i];
|
|
113201
|
+
props.attachedView = view;
|
|
113202
|
+
infos.push(props);
|
|
113203
|
+
}
|
|
113204
|
+
}
|
|
113205
|
+
return new AttachmentInfos(infos);
|
|
113206
|
+
}
|
|
113207
|
+
function disposeRenderers(renderers) {
|
|
113208
|
+
if (renderers) {
|
|
113209
|
+
for (const renderer of renderers) {
|
|
113210
|
+
renderer[Symbol.dispose]();
|
|
113211
|
+
}
|
|
113212
|
+
}
|
|
113213
|
+
}
|
|
113214
|
+
/** Manages the set of ViewAttachment elements to be rendered by a SheetViewState.
|
|
113215
|
+
* Takes care of reloading them after ViewAttachment elements are modified, deleted, or inserted.
|
|
113216
|
+
*/
|
|
113217
|
+
class SheetViewAttachments {
|
|
113218
|
+
_impl;
|
|
113219
|
+
_reload;
|
|
113220
|
+
_maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
|
|
113221
|
+
_rendererArgs;
|
|
113222
|
+
_renderers;
|
|
113223
|
+
get maxDepth() {
|
|
113224
|
+
return this._maxDepth;
|
|
113225
|
+
}
|
|
113226
|
+
*getSecondaryViewports() {
|
|
113227
|
+
if (this._renderers) {
|
|
113228
|
+
for (const renderer of this._renderers) {
|
|
113229
|
+
if (renderer.viewport) {
|
|
113230
|
+
yield renderer.viewport;
|
|
113231
|
+
}
|
|
113232
|
+
}
|
|
113233
|
+
}
|
|
113234
|
+
}
|
|
113235
|
+
constructor(impl) {
|
|
113236
|
+
this._impl = impl;
|
|
113237
|
+
}
|
|
113238
|
+
[Symbol.dispose]() {
|
|
113239
|
+
disposeRenderers(this._renderers);
|
|
113240
|
+
this._renderers = this._rendererArgs = undefined;
|
|
113241
|
+
this._reload = undefined;
|
|
113242
|
+
}
|
|
113243
|
+
static create(attachmentIds) {
|
|
113244
|
+
const impl = attachmentIds.length === 0 ? EmptyAttachments.get() : new AttachmentIds([...attachmentIds]);
|
|
113245
|
+
return new this(impl);
|
|
113246
|
+
}
|
|
113247
|
+
get attachmentIds() {
|
|
113248
|
+
return this._impl.attachmentIds;
|
|
113249
|
+
}
|
|
113250
|
+
clone(iModel) {
|
|
113251
|
+
return new SheetViewAttachments(this._impl.clone(iModel));
|
|
113252
|
+
}
|
|
113253
|
+
preload(request) {
|
|
113254
|
+
this._impl.preload(request);
|
|
113255
|
+
}
|
|
113256
|
+
async postload(response, iModel) {
|
|
113257
|
+
this._impl = await this._impl.postload(response, iModel);
|
|
113258
|
+
}
|
|
113259
|
+
async reload(sheetModelId, iModel) {
|
|
113260
|
+
const renderers = this._renderers;
|
|
113261
|
+
const reload = this._reload = reloadAttachments(sheetModelId, iModel);
|
|
113262
|
+
const impl = await this._reload;
|
|
113263
|
+
// We keep the previous renderers until reloading completes, to avoid drawing a blank view while waiting.
|
|
113264
|
+
// Afterward, always destroy the previous renderers.
|
|
113265
|
+
disposeRenderers(renderers);
|
|
113266
|
+
// If reload was not called again while we waited...
|
|
113267
|
+
if (this._reload === reload) {
|
|
113268
|
+
this._impl = impl;
|
|
113269
|
+
this._reload = this._renderers = undefined;
|
|
113270
|
+
if (this._rendererArgs) {
|
|
113271
|
+
// We are attached to a Viewport - reload the renderers.
|
|
113272
|
+
this.loadRenderers();
|
|
113273
|
+
}
|
|
113274
|
+
}
|
|
113275
|
+
}
|
|
113276
|
+
attachToViewport(args) {
|
|
113277
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
|
|
113278
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._rendererArgs);
|
|
113279
|
+
this._rendererArgs = args;
|
|
113280
|
+
this.loadRenderers();
|
|
113281
|
+
}
|
|
113282
|
+
detachFromViewport() {
|
|
113283
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== this._rendererArgs);
|
|
113284
|
+
this._rendererArgs = undefined;
|
|
113285
|
+
disposeRenderers(this._renderers);
|
|
113286
|
+
this._renderers = undefined;
|
|
113287
|
+
}
|
|
113288
|
+
areAllTileTreesLoaded(displayedExtents) {
|
|
113289
|
+
if (this._reload) {
|
|
113290
|
+
return false;
|
|
113291
|
+
}
|
|
113292
|
+
else if (!this._renderers) {
|
|
113293
|
+
return true;
|
|
113294
|
+
}
|
|
113295
|
+
return this._renderers.every((renderer) => {
|
|
113296
|
+
const attachmentRange = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(renderer.viewAttachmentProps.placement).calculateRange();
|
|
113297
|
+
return !attachmentRange.intersectsRangeXY(displayedExtents) || renderer.areAllTileTreesLoaded;
|
|
113298
|
+
});
|
|
113299
|
+
}
|
|
113300
|
+
discloseTileTrees(trees) {
|
|
113301
|
+
for (const renderer of this.renderers()) {
|
|
113302
|
+
trees.disclose(renderer);
|
|
113303
|
+
}
|
|
113304
|
+
}
|
|
113305
|
+
collectStatistics(stats) {
|
|
113306
|
+
for (const renderer of this.renderers()) {
|
|
113307
|
+
renderer.collectStatistics(stats);
|
|
113308
|
+
}
|
|
113309
|
+
}
|
|
113310
|
+
addToScene(context) {
|
|
113311
|
+
for (const renderer of this.renderers()) {
|
|
113312
|
+
renderer.addToScene(context);
|
|
113313
|
+
}
|
|
113314
|
+
}
|
|
113315
|
+
getAttachmentViewport(args) {
|
|
113316
|
+
const renderer = args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
|
|
113317
|
+
if (!renderer) {
|
|
113318
|
+
return undefined;
|
|
113319
|
+
}
|
|
113320
|
+
return args.inSectionDrawingAttachment ? renderer.viewport?.view.getAttachmentViewport({ inSectionDrawingAttachment: true }) : renderer.viewport;
|
|
113321
|
+
}
|
|
113322
|
+
computeDisplayTransform(args) {
|
|
113323
|
+
const renderer = undefined !== args.viewAttachmentId ? this.findRendererById(args.viewAttachmentId) : undefined;
|
|
113324
|
+
const ortho = renderer?.ortho;
|
|
113325
|
+
const sheetTransform = ortho?.toSheet;
|
|
113326
|
+
if (!sheetTransform) {
|
|
113327
|
+
return undefined;
|
|
113328
|
+
}
|
|
113329
|
+
const sectionTransform = args.inSectionDrawingAttachment ? ortho.view.computeDisplayTransform(args) : undefined;
|
|
113330
|
+
if (!sectionTransform) {
|
|
113331
|
+
return sheetTransform.clone(args.output);
|
|
113332
|
+
}
|
|
113333
|
+
return sheetTransform.multiplyTransformTransform(sectionTransform, args.output);
|
|
113334
|
+
}
|
|
113335
|
+
/** Strictly for tests. */
|
|
113336
|
+
areAllAttachmentsLoaded() {
|
|
113337
|
+
return !this._reload && (!this._renderers || this._renderers.every((x) => x.areAllTileTreesLoaded));
|
|
113338
|
+
}
|
|
113339
|
+
/** Strictly for tests. */
|
|
113340
|
+
get attachments() {
|
|
113341
|
+
return this._renderers;
|
|
113342
|
+
}
|
|
113343
|
+
/** Strictly for tests. */
|
|
113344
|
+
get attachmentProps() {
|
|
113345
|
+
const infos = this._impl.infos;
|
|
113346
|
+
if (!infos) {
|
|
113347
|
+
return [];
|
|
113348
|
+
}
|
|
113349
|
+
return infos.map((x) => {
|
|
113350
|
+
return {
|
|
113351
|
+
...x,
|
|
113352
|
+
attachedView: undefined,
|
|
113353
|
+
};
|
|
113354
|
+
});
|
|
113355
|
+
}
|
|
113356
|
+
/** Strictly for tests. */
|
|
113357
|
+
get attachmentInfos() {
|
|
113358
|
+
const infos = this._impl.infos;
|
|
113359
|
+
return infos ?? this._impl.attachmentIds;
|
|
113360
|
+
}
|
|
113361
|
+
loadRenderers() {
|
|
113362
|
+
const args = this._rendererArgs;
|
|
113363
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined !== args);
|
|
113364
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_1__.assert)(undefined === this._renderers);
|
|
113365
|
+
this._maxDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_4__.Frustum2d.minimumZDistance;
|
|
113366
|
+
const infos = this._impl.infos;
|
|
113367
|
+
if (!infos) {
|
|
113368
|
+
return;
|
|
113369
|
+
}
|
|
113370
|
+
this._renderers = infos.map((info) => {
|
|
113371
|
+
const renderer = (0,_ViewAttachmentRenderer__WEBPACK_IMPORTED_MODULE_3__.createViewAttachmentRenderer)({
|
|
113372
|
+
...args,
|
|
113373
|
+
props: info,
|
|
113374
|
+
view: info.attachedView,
|
|
113375
|
+
});
|
|
113376
|
+
this._maxDepth = Math.max(this._maxDepth, renderer.zDepth);
|
|
113377
|
+
return renderer;
|
|
113378
|
+
});
|
|
113379
|
+
}
|
|
113380
|
+
*renderers() {
|
|
113381
|
+
if (this._renderers) {
|
|
113382
|
+
for (const renderer of this._renderers) {
|
|
113383
|
+
yield renderer;
|
|
113384
|
+
}
|
|
113385
|
+
}
|
|
113386
|
+
}
|
|
113387
|
+
findRendererById(id) {
|
|
113388
|
+
return this._renderers?.find((x) => x.viewAttachmentProps.id === id);
|
|
113389
|
+
}
|
|
113390
|
+
}
|
|
113391
|
+
|
|
113392
|
+
|
|
113393
|
+
/***/ }),
|
|
113394
|
+
|
|
113395
|
+
/***/ "../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js":
|
|
113396
|
+
/*!**********************************************************************!*\
|
|
113397
|
+
!*** ../../core/frontend/lib/esm/internal/ViewAttachmentRenderer.js ***!
|
|
113398
|
+
\**********************************************************************/
|
|
113399
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
113400
|
+
|
|
113401
|
+
"use strict";
|
|
113402
|
+
__webpack_require__.r(__webpack_exports__);
|
|
113403
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
113404
|
+
/* harmony export */ createViewAttachmentRenderer: () => (/* binding */ createViewAttachmentRenderer)
|
|
113405
|
+
/* harmony export */ });
|
|
113406
|
+
/* harmony import */ var _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @itwin/core-common */ "../../core/common/lib/esm/core-common.js");
|
|
113407
|
+
/* harmony import */ var _CoordSystem__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../CoordSystem */ "../../core/frontend/lib/esm/CoordSystem.js");
|
|
113408
|
+
/* harmony import */ var _Frustum2d__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Frustum2d */ "../../core/frontend/lib/esm/Frustum2d.js");
|
|
113409
|
+
/* harmony import */ var _IModelApp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../IModelApp */ "../../core/frontend/lib/esm/IModelApp.js");
|
|
113410
|
+
/* harmony import */ var _Viewport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Viewport */ "../../core/frontend/lib/esm/Viewport.js");
|
|
113411
|
+
/* harmony import */ var _common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/ImageUtil */ "../../core/frontend/lib/esm/common/ImageUtil.js");
|
|
113412
|
+
/* harmony import */ var _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/ViewRect */ "../../core/frontend/lib/esm/common/ViewRect.js");
|
|
113413
|
+
/* harmony import */ var _common_render_GraphicType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../common/render/GraphicType */ "../../core/frontend/lib/esm/common/render/GraphicType.js");
|
|
113414
|
+
/* harmony import */ var _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../render/FeatureSymbology */ "../../core/frontend/lib/esm/render/FeatureSymbology.js");
|
|
113415
|
+
/* harmony import */ var _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../render/GraphicBranch */ "../../core/frontend/lib/esm/render/GraphicBranch.js");
|
|
113416
|
+
/* harmony import */ var _tile_internal__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../tile/internal */ "../../core/frontend/lib/esm/tile/internal.js");
|
|
113417
|
+
/* harmony import */ var _render_MockRender__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./render/MockRender */ "../../core/frontend/lib/esm/internal/render/MockRender.js");
|
|
113418
|
+
/* harmony import */ var _itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @itwin/core-bentley */ "../../core/bentley/lib/esm/core-bentley.js");
|
|
113419
|
+
/* harmony import */ var _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @itwin/core-geometry */ "../../core/geometry/lib/esm/core-geometry.js");
|
|
113420
|
+
/* harmony import */ var _tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./tile/ViewFlagOverrides */ "../../core/frontend/lib/esm/internal/tile/ViewFlagOverrides.js");
|
|
113421
|
+
/*---------------------------------------------------------------------------------------------
|
|
113422
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
113423
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
113424
|
+
*--------------------------------------------------------------------------------------------*/
|
|
113425
|
+
/** @packageDocumentation
|
|
113426
|
+
* @module Views
|
|
113427
|
+
*/
|
|
113428
|
+
|
|
113429
|
+
|
|
113430
|
+
|
|
113431
|
+
|
|
113432
|
+
|
|
113433
|
+
|
|
113434
|
+
|
|
113435
|
+
|
|
113436
|
+
|
|
113437
|
+
|
|
113438
|
+
|
|
113439
|
+
|
|
113440
|
+
|
|
113441
|
+
|
|
113442
|
+
|
|
113443
|
+
function createViewAttachmentRenderer(args) {
|
|
113444
|
+
const { props, view } = args;
|
|
113445
|
+
if (props.jsonProperties?.displayOptions?.drawAsRaster || (view.is3d() && view.isCameraOn)) {
|
|
113446
|
+
return new RasterAttachment(view, props, args.backgroundColor);
|
|
113447
|
+
}
|
|
113448
|
+
else {
|
|
113449
|
+
return new OrthographicAttachment(view, props, args.sheetModelId);
|
|
113450
|
+
}
|
|
113451
|
+
}
|
|
113452
|
+
/** A mostly no-op RenderTarget for an OrthographicAttachment. */
|
|
113453
|
+
class AttachmentTarget extends _render_MockRender__WEBPACK_IMPORTED_MODULE_11__.MockRender.OffScreenTarget {
|
|
113454
|
+
_attachment;
|
|
113455
|
+
constructor(attachment) {
|
|
113456
|
+
// The dimensions don't matter - we're not drawing anything.
|
|
113457
|
+
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(1, 1);
|
|
113458
|
+
super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem, rect);
|
|
113459
|
+
this._attachment = attachment;
|
|
113460
|
+
}
|
|
113461
|
+
changeScene(scene) {
|
|
113462
|
+
this._attachment.scene = scene;
|
|
113463
|
+
}
|
|
113464
|
+
overrideFeatureSymbology(ovrs) {
|
|
113465
|
+
this._attachment.symbologyOverrides = ovrs;
|
|
113466
|
+
}
|
|
113467
|
+
}
|
|
113468
|
+
/** Draws the contents a 2d or orthographic 3d view directly into a sheet view.
|
|
113469
|
+
* We select tiles for the view in the context of a light-weight offscreen viewport with a no-op RenderTarget, then
|
|
113470
|
+
* collect the resultant graphics and add them to the sheet view's scene.
|
|
113471
|
+
*/
|
|
113472
|
+
class OrthographicAttachment {
|
|
113473
|
+
_viewport;
|
|
113474
|
+
_props;
|
|
113475
|
+
_sheetModelId;
|
|
113476
|
+
_viewFlagOverrides;
|
|
113477
|
+
_toSheet;
|
|
113478
|
+
_fromSheet;
|
|
113479
|
+
_sizeInMeters;
|
|
113480
|
+
_range;
|
|
113481
|
+
_viewRect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, 1, 1);
|
|
113482
|
+
_originalFrustum = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Frustum();
|
|
113483
|
+
_clipVolume;
|
|
113484
|
+
_hiddenLineSettings;
|
|
113485
|
+
_scale;
|
|
113486
|
+
_debugFeatureTable;
|
|
113487
|
+
scene;
|
|
113488
|
+
symbologyOverrides;
|
|
113489
|
+
zDepth;
|
|
113490
|
+
get view() {
|
|
113491
|
+
return this._viewport.view;
|
|
113492
|
+
}
|
|
113493
|
+
get viewAttachmentProps() {
|
|
113494
|
+
return this._props;
|
|
113495
|
+
}
|
|
113496
|
+
get viewport() {
|
|
113497
|
+
return this._viewport;
|
|
113498
|
+
}
|
|
113499
|
+
constructor(view, props, sheetModelId) {
|
|
113500
|
+
this.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides(view);
|
|
113501
|
+
const target = new AttachmentTarget(this);
|
|
113502
|
+
this._viewport = _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport.createViewport(view, target, true);
|
|
113503
|
+
this._props = props;
|
|
113504
|
+
this._sheetModelId = sheetModelId;
|
|
113505
|
+
const applyClip = true; // set to false for debugging
|
|
113506
|
+
this._viewFlagOverrides = {
|
|
113507
|
+
...view.viewFlags,
|
|
113508
|
+
clipVolume: applyClip,
|
|
113509
|
+
lighting: false,
|
|
113510
|
+
shadows: false,
|
|
113511
|
+
};
|
|
113512
|
+
const placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
|
|
113513
|
+
const range = placement.calculateRange();
|
|
113514
|
+
this._range = range;
|
|
113515
|
+
this._sizeInMeters = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(range.xLength(), range.yLength());
|
|
113516
|
+
// Compute transform from attached view's world coordinates to sheet's world coordinates.
|
|
113517
|
+
// NB: We obtain the extents and origin from the *viewport* not the *view* - they may have been adjusted by the viewport.
|
|
113518
|
+
const applySkew = true; // set to false for debugging
|
|
113519
|
+
const skew = applySkew ? view.getAspectRatioSkew() : 1;
|
|
113520
|
+
const extents = this._viewport.viewingSpace.viewDelta.clone();
|
|
113521
|
+
const zDepth = Math.abs(extents.z);
|
|
113522
|
+
const scaleX = this._sizeInMeters.x / Math.abs(extents.x);
|
|
113523
|
+
const scaleY = skew * this._sizeInMeters.y / Math.abs(extents.y);
|
|
113524
|
+
this._scale = { x: 1 / scaleX, y: 1 / scaleY };
|
|
113525
|
+
const zBias = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
113526
|
+
this.zDepth = 1.01 * (zDepth - zBias); // give a little padding so that geometry right up against far plane doesn't get clipped.
|
|
113527
|
+
// View origin is at the *back* of the view. Align *front* of view based on display priority.
|
|
113528
|
+
const viewRot = view.getRotation();
|
|
113529
|
+
const viewOrg = viewRot.multiplyVector(this._viewport.viewingSpace.viewOrigin);
|
|
113530
|
+
viewOrg.z += zDepth;
|
|
113531
|
+
viewRot.multiplyTransposeVectorInPlace(viewOrg);
|
|
113532
|
+
const matrix = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.createScale(scaleX, scaleY, 1);
|
|
113533
|
+
matrix.multiplyMatrixMatrix(viewRot, matrix);
|
|
113534
|
+
const origin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Matrix3d.xyzMinusMatrixTimesXYZ(viewOrg, matrix, viewOrg);
|
|
113535
|
+
const attachmentOrigin = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.createFrom(placement.origin);
|
|
113536
|
+
attachmentOrigin.z = zBias;
|
|
113537
|
+
const viewOrgToAttachment = attachmentOrigin.minus(viewOrg);
|
|
113538
|
+
origin.addInPlace(viewOrgToAttachment);
|
|
113539
|
+
this._toSheet = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Transform.createRefs(origin, matrix);
|
|
113540
|
+
this._fromSheet = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.expectDefined)(this._toSheet.inverse());
|
|
113541
|
+
// If the attached view is a section drawing, it may itself have an attached spatial view with a clip.
|
|
113542
|
+
// The clip needs to be transformed into sheet space.
|
|
113543
|
+
if (view.isDrawingView())
|
|
113544
|
+
this._viewport.drawingToSheetTransform = this._toSheet;
|
|
113545
|
+
// ###TODO? If we also apply the attachment's clip to the attached view, we may get additional culling during tile selection.
|
|
113546
|
+
// However the attached view's frustum is already clipped by intersection with sheet view's frustum, and additional clipping planes
|
|
113547
|
+
// introduce additional computation, so possibly not worth it.
|
|
113548
|
+
// Transform the view's clip (if any) to sheet space
|
|
113549
|
+
let viewClip = view.viewFlags.clipVolume ? view.getViewClip()?.clone() : undefined;
|
|
113550
|
+
if (viewClip)
|
|
113551
|
+
viewClip.transformInPlace(this._toSheet);
|
|
113552
|
+
else
|
|
113553
|
+
viewClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.createEmpty();
|
|
113554
|
+
let sheetClip;
|
|
113555
|
+
if (undefined !== props.jsonProperties?.clip)
|
|
113556
|
+
sheetClip = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(props.jsonProperties?.clip);
|
|
113557
|
+
if (sheetClip && sheetClip.isValid) {
|
|
113558
|
+
// Clip to view attachment's clip. NB: clip is in sheet coordinate space.
|
|
113559
|
+
for (const clip of sheetClip.clips)
|
|
113560
|
+
viewClip.clips.push(clip);
|
|
113561
|
+
}
|
|
113562
|
+
else {
|
|
113563
|
+
// Clip to view attachment's bounding box
|
|
113564
|
+
viewClip.appendShape([
|
|
113565
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.low.y),
|
|
113566
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.low.y),
|
|
113567
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.high.x, this._range.high.y),
|
|
113568
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(this._range.low.x, this._range.high.y),
|
|
113569
|
+
]);
|
|
113570
|
+
}
|
|
113571
|
+
this._clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(viewClip);
|
|
113572
|
+
// Save off the original frustum (potentially adjusted by viewport).
|
|
113573
|
+
this._viewport.setupFromView();
|
|
113574
|
+
this._viewport.viewingSpace.getFrustum(_CoordSystem__WEBPACK_IMPORTED_MODULE_1__.CoordSystem.World, true, this._originalFrustum);
|
|
113575
|
+
const applyHiddenLineSettings = true; // for debugging edge display, set to false...
|
|
113576
|
+
const style = view.displayStyle;
|
|
113577
|
+
if (style.is3d() && applyHiddenLineSettings)
|
|
113578
|
+
this._hiddenLineSettings = style.settings.hiddenLineSettings;
|
|
113579
|
+
}
|
|
113580
|
+
[Symbol.dispose]() {
|
|
113581
|
+
this._viewport[Symbol.dispose]();
|
|
113582
|
+
}
|
|
113583
|
+
discloseTileTrees(trees) {
|
|
113584
|
+
trees.disclose(this._viewport);
|
|
113585
|
+
}
|
|
113586
|
+
addToScene(context) {
|
|
113587
|
+
if (context.viewport.freezeScene)
|
|
113588
|
+
return;
|
|
113589
|
+
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
113590
|
+
return;
|
|
113591
|
+
const wantBounds = context.viewport.wantViewAttachmentBoundaries;
|
|
113592
|
+
const wantClipShapes = context.viewport.wantViewAttachmentClipShapes;
|
|
113593
|
+
if (wantBounds || wantClipShapes) {
|
|
113594
|
+
const builder = context.createSceneGraphicBuilder();
|
|
113595
|
+
if (wantBounds) {
|
|
113596
|
+
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
|
|
113597
|
+
builder.addRangeBox(this._range);
|
|
113598
|
+
}
|
|
113599
|
+
if (wantClipShapes && this._clipVolume) {
|
|
113600
|
+
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.blue, 2);
|
|
113601
|
+
for (const prim of this._clipVolume.clipVector.clips) {
|
|
113602
|
+
if (!(prim instanceof _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipShape))
|
|
113603
|
+
continue; // ###TODO handle non-shape primitives, if any such ever encountered
|
|
113604
|
+
const pts = [];
|
|
113605
|
+
const tf = prim.transformFromClip;
|
|
113606
|
+
for (const pt of prim.polygon) {
|
|
113607
|
+
const tfPt = tf ? tf.multiplyPoint3d(pt) : pt;
|
|
113608
|
+
pts.push(new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d(tfPt.x, tfPt.y));
|
|
113609
|
+
}
|
|
113610
|
+
builder.addLineString2d(pts, 0);
|
|
113611
|
+
}
|
|
113612
|
+
}
|
|
113613
|
+
// Put into a Batch so that we can see tooltip with attachment Id on mouseover.
|
|
113614
|
+
const batch = context.target.renderSystem.createBatch(builder.finish(), this.getDebugFeatureTable(), this._range);
|
|
113615
|
+
context.outputGraphic(batch);
|
|
113616
|
+
}
|
|
113617
|
+
if (!context.viewport.wantViewAttachments)
|
|
113618
|
+
return;
|
|
113619
|
+
// Pixel size used to compute size of ViewRect so that tiles of appropriate LOD are selected.
|
|
113620
|
+
const pixelSize = context.viewport.getPixelSizeAtPoint();
|
|
113621
|
+
if (0 === pixelSize)
|
|
113622
|
+
return;
|
|
113623
|
+
// Adjust attached view frustum based on intersection with sheet view frustum.
|
|
113624
|
+
const attachFrustum = this._originalFrustum.transformBy(this._toSheet);
|
|
113625
|
+
const attachFrustumRange = attachFrustum.toRange();
|
|
113626
|
+
const sheetFrustum = context.viewport.getWorldFrustum();
|
|
113627
|
+
const sheetFrustumRange = sheetFrustum.toRange();
|
|
113628
|
+
const intersect = attachFrustumRange.intersect(sheetFrustumRange);
|
|
113629
|
+
if (intersect.isNull)
|
|
113630
|
+
return;
|
|
113631
|
+
attachFrustum.initFromRange(intersect);
|
|
113632
|
+
attachFrustum.transformBy(this._fromSheet, attachFrustum);
|
|
113633
|
+
this._viewport.setupViewFromFrustum(attachFrustum);
|
|
113634
|
+
// Adjust view rect based on size of attachment on screen so that tiles of appropriate LOD are selected.
|
|
113635
|
+
const width = this._sizeInMeters.x * intersect.xLength() / attachFrustumRange.xLength();
|
|
113636
|
+
const height = this._sizeInMeters.y * intersect.yLength() / attachFrustumRange.yLength();
|
|
113637
|
+
this._viewRect.width = Math.max(1, Math.round(width / pixelSize));
|
|
113638
|
+
this._viewRect.height = Math.max(1, Math.round(height / pixelSize));
|
|
113639
|
+
this._viewport.setRect(this._viewRect);
|
|
113640
|
+
// Propagate settings from on-screen viewport.
|
|
113641
|
+
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
113642
|
+
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
113643
|
+
// Create the scene.
|
|
113644
|
+
this._viewport.renderFrame();
|
|
113645
|
+
const scene = this.scene;
|
|
113646
|
+
if (!scene)
|
|
113647
|
+
return;
|
|
113648
|
+
// Extract scene graphics and insert into on-screen scene context.
|
|
113649
|
+
const options = {
|
|
113650
|
+
viewAttachmentId: this._props.id,
|
|
113651
|
+
clipVolume: this._clipVolume,
|
|
113652
|
+
hline: this._hiddenLineSettings,
|
|
113653
|
+
frustum: {
|
|
113654
|
+
is3d: this.view.is3d(),
|
|
113655
|
+
scale: this._scale,
|
|
113656
|
+
},
|
|
113657
|
+
};
|
|
113658
|
+
const outputGraphics = (source) => {
|
|
113659
|
+
if (0 === source.length)
|
|
113660
|
+
return;
|
|
113661
|
+
const graphics = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch();
|
|
113662
|
+
graphics.setViewFlagOverrides(this._viewFlagOverrides);
|
|
113663
|
+
graphics.symbologyOverrides = this.symbologyOverrides;
|
|
113664
|
+
for (const graphic of source)
|
|
113665
|
+
graphics.entries.push(graphic);
|
|
113666
|
+
const branch = context.createGraphicBranch(graphics, this._toSheet, options);
|
|
113667
|
+
context.outputGraphic(branch);
|
|
113668
|
+
};
|
|
113669
|
+
outputGraphics(scene.foreground);
|
|
113670
|
+
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.BackgroundMap, () => outputGraphics(scene.background));
|
|
113671
|
+
context.withGraphicType(_tile_internal__WEBPACK_IMPORTED_MODULE_10__.TileGraphicType.Overlay, () => outputGraphics(scene.overlay));
|
|
113672
|
+
// Report tile statistics to sheet view's viewport.
|
|
113673
|
+
const tileAdmin = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.tileAdmin;
|
|
113674
|
+
const selectedAndReady = tileAdmin.getTilesForUser(this._viewport);
|
|
113675
|
+
const requested = tileAdmin.getRequestsForUser(this._viewport);
|
|
113676
|
+
tileAdmin.addExternalTilesForUser(context.viewport, {
|
|
113677
|
+
requested: requested?.size ?? 0,
|
|
113678
|
+
selected: selectedAndReady?.selected.size ?? 0,
|
|
113679
|
+
ready: selectedAndReady?.ready.size ?? 0,
|
|
113680
|
+
});
|
|
113681
|
+
}
|
|
113682
|
+
getDebugFeatureTable() {
|
|
113683
|
+
if (this._debugFeatureTable)
|
|
113684
|
+
return this._debugFeatureTable;
|
|
113685
|
+
const featureTable = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.FeatureTable(1, this._sheetModelId);
|
|
113686
|
+
featureTable.insert(new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Feature(this._props.id));
|
|
113687
|
+
this._debugFeatureTable = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.PackedFeatureTable.pack(featureTable);
|
|
113688
|
+
return this._debugFeatureTable;
|
|
113689
|
+
}
|
|
113690
|
+
get areAllTileTreesLoaded() {
|
|
113691
|
+
return this.view.areAllTileTreesLoaded;
|
|
113692
|
+
}
|
|
113693
|
+
collectStatistics(_stats) {
|
|
113694
|
+
// Handled by discloseTileTrees()
|
|
113695
|
+
}
|
|
113696
|
+
get ortho() {
|
|
113697
|
+
return {
|
|
113698
|
+
toSheet: this._toSheet,
|
|
113699
|
+
view: this.view,
|
|
113700
|
+
};
|
|
113701
|
+
}
|
|
113702
|
+
}
|
|
113703
|
+
function createRasterAttachmentViewport(_view, _rect, _attachment) {
|
|
113704
|
+
class RasterAttachmentViewport extends _Viewport__WEBPACK_IMPORTED_MODULE_4__.OffScreenViewport {
|
|
113705
|
+
_sceneContext;
|
|
113706
|
+
_isSceneReady = false;
|
|
113707
|
+
_attachment;
|
|
113708
|
+
constructor(view, rect, attachment) {
|
|
113709
|
+
super(_IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createOffscreenTarget(rect));
|
|
113710
|
+
this._attachment = attachment;
|
|
113711
|
+
this._isAspectRatioLocked = true;
|
|
113712
|
+
this.changeView(view);
|
|
113713
|
+
}
|
|
113714
|
+
createSceneContext() {
|
|
113715
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
|
|
113716
|
+
this._sceneContext = super.createSceneContext();
|
|
113717
|
+
return this._sceneContext;
|
|
113718
|
+
}
|
|
113719
|
+
renderFrame() {
|
|
113720
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(!this._isSceneReady);
|
|
113721
|
+
this.clearSceneContext();
|
|
113722
|
+
super.renderFrame();
|
|
113723
|
+
if (undefined !== this._sceneContext) {
|
|
113724
|
+
this._isSceneReady = !this._sceneContext.hasMissingTiles && this.view.areAllTileTreesLoaded;
|
|
113725
|
+
if (this._isSceneReady)
|
|
113726
|
+
this._attachment.produceGraphics(this._sceneContext);
|
|
113727
|
+
this._sceneContext = undefined;
|
|
113728
|
+
}
|
|
113729
|
+
}
|
|
113730
|
+
clearSceneContext() {
|
|
113731
|
+
this._sceneContext = undefined;
|
|
113732
|
+
}
|
|
113733
|
+
addDecorations() {
|
|
113734
|
+
// ###TODO: skybox, ground plane, possibly grid. DecorateContext requires a ScreenViewport...
|
|
113735
|
+
}
|
|
113736
|
+
}
|
|
113737
|
+
return new RasterAttachmentViewport(_view, _rect, _attachment);
|
|
113738
|
+
}
|
|
113739
|
+
/** Draws a 3d view (usually with camera enabled) into a sheet view by producing an image of the view's contents offscreen. */
|
|
113740
|
+
class RasterAttachment {
|
|
113741
|
+
_props;
|
|
113742
|
+
_placement;
|
|
113743
|
+
_transform;
|
|
113744
|
+
zDepth;
|
|
113745
|
+
_viewport;
|
|
113746
|
+
_graphics;
|
|
113747
|
+
constructor(view, props, bgColor) {
|
|
113748
|
+
// Render to a 2048x2048 view rect. Scale in Y to preserve aspect ratio.
|
|
113749
|
+
const maxSize = 2048;
|
|
113750
|
+
const rect = new _common_ViewRect__WEBPACK_IMPORTED_MODULE_6__.ViewRect(0, 0, maxSize, maxSize);
|
|
113751
|
+
const height = maxSize * view.getAspectRatio() * view.getAspectRatioSkew();
|
|
113752
|
+
const skew = maxSize / height;
|
|
113753
|
+
view.setAspectRatioSkew(skew);
|
|
113754
|
+
if (true !== props.jsonProperties?.displayOptions?.preserveBackground) {
|
|
113755
|
+
// Make background color 100% transparent so that Viewport.readImageBuffer() will discard transparent pixels.
|
|
113756
|
+
view.displayStyle.backgroundColor = bgColor.withAlpha(0);
|
|
113757
|
+
}
|
|
113758
|
+
this._viewport = createRasterAttachmentViewport(view, rect, this);
|
|
113759
|
+
this._props = props;
|
|
113760
|
+
this._placement = _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.Placement2d.fromJSON(props.placement);
|
|
113761
|
+
this._transform = this._placement.transform;
|
|
113762
|
+
this.zDepth = _Frustum2d__WEBPACK_IMPORTED_MODULE_2__.Frustum2d.depthFromDisplayPriority(props.jsonProperties?.displayPriority ?? 0);
|
|
113763
|
+
}
|
|
113764
|
+
[Symbol.dispose]() {
|
|
113765
|
+
this._viewport?.[Symbol.dispose]();
|
|
113766
|
+
}
|
|
113767
|
+
get viewAttachmentProps() {
|
|
113768
|
+
return this._props;
|
|
113769
|
+
}
|
|
113770
|
+
get viewport() {
|
|
113771
|
+
return this._viewport;
|
|
113772
|
+
}
|
|
113773
|
+
get areAllTileTreesLoaded() {
|
|
113774
|
+
return this._viewport?.areAllTileTreesLoaded ?? true;
|
|
113775
|
+
}
|
|
113776
|
+
addToScene(context) {
|
|
113777
|
+
// ###TODO: check viewport.wantViewAttachmentClipShapes
|
|
113778
|
+
if (!context.viewport.view.viewsCategory(this._props.category))
|
|
113779
|
+
return;
|
|
113780
|
+
if (context.viewport.wantViewAttachmentBoundaries) {
|
|
113781
|
+
const builder = context.createSceneGraphicBuilder(this._transform);
|
|
113782
|
+
builder.setSymbology(_itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.ColorDef.red, 2);
|
|
113783
|
+
builder.addRangeBox(_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Range3d.createRange2d(this._placement.bbox));
|
|
113784
|
+
context.outputGraphic(builder.finish());
|
|
113785
|
+
}
|
|
113786
|
+
if (!context.viewport.wantViewAttachments)
|
|
113787
|
+
return;
|
|
113788
|
+
if (this._graphics) {
|
|
113789
|
+
context.outputGraphic(this._graphics);
|
|
113790
|
+
return;
|
|
113791
|
+
}
|
|
113792
|
+
if (undefined === this._viewport)
|
|
113793
|
+
return;
|
|
113794
|
+
this._viewport.debugBoundingBoxes = context.viewport.debugBoundingBoxes;
|
|
113795
|
+
this._viewport.setTileSizeModifier(context.viewport.tileSizeModifier);
|
|
113796
|
+
this._viewport.renderFrame();
|
|
113797
|
+
if (this._graphics)
|
|
113798
|
+
context.outputGraphic(this._graphics);
|
|
113799
|
+
}
|
|
113800
|
+
discloseTileTrees(trees) {
|
|
113801
|
+
if (this._viewport)
|
|
113802
|
+
trees.disclose(this._viewport);
|
|
113803
|
+
}
|
|
113804
|
+
produceGraphics(context) {
|
|
113805
|
+
(0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.assert)(context.viewport === this._viewport);
|
|
113806
|
+
this._graphics = this.createGraphics(this._viewport);
|
|
113807
|
+
this._viewport = (0,_itwin_core_bentley__WEBPACK_IMPORTED_MODULE_12__.dispose)(this._viewport);
|
|
113808
|
+
if (undefined !== this._graphics)
|
|
113809
|
+
context.outputGraphic(this._graphics);
|
|
113810
|
+
}
|
|
113811
|
+
createGraphics(vp) {
|
|
113812
|
+
// Create a texture from the contents of the view.
|
|
113813
|
+
const image = vp.readImageBuffer({ upsideDown: true });
|
|
113814
|
+
if (undefined === image)
|
|
113815
|
+
return undefined;
|
|
113816
|
+
const debugImage = false; // set to true to open a window displaying the captured image.
|
|
113817
|
+
if (debugImage) {
|
|
113818
|
+
const url = (0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.imageBufferToPngDataUrl)(image, false);
|
|
113819
|
+
if (url)
|
|
113820
|
+
(0,_common_ImageUtil__WEBPACK_IMPORTED_MODULE_5__.openImageDataUrlInNewWindow)(url, "Attachment");
|
|
113821
|
+
}
|
|
113822
|
+
const texture = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createTexture({
|
|
113823
|
+
image: { source: image, transparency: _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.TextureTransparency.Opaque },
|
|
113824
|
+
});
|
|
113825
|
+
if (!texture)
|
|
113826
|
+
return undefined;
|
|
113827
|
+
// Create a material for the texture
|
|
113828
|
+
const graphicParams = new _itwin_core_common__WEBPACK_IMPORTED_MODULE_0__.GraphicParams();
|
|
113829
|
+
graphicParams.material = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createRenderMaterial({ textureMapping: { texture } });
|
|
113830
|
+
// Apply the texture to a rectangular polyface.
|
|
113831
|
+
const depth = this.zDepth;
|
|
113832
|
+
const east = this._placement.bbox.low.x;
|
|
113833
|
+
const west = this._placement.bbox.high.x;
|
|
113834
|
+
const north = this._placement.bbox.low.y;
|
|
113835
|
+
const south = this._placement.bbox.high.y;
|
|
113836
|
+
const corners = [
|
|
113837
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, north, depth),
|
|
113838
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, north, depth),
|
|
113839
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(west, south, depth),
|
|
113840
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point3d.create(east, south, depth),
|
|
113841
|
+
];
|
|
113842
|
+
const params = [
|
|
113843
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 0),
|
|
113844
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 0),
|
|
113845
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(1, 1),
|
|
113846
|
+
_itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.Point2d.create(0, 1),
|
|
113847
|
+
];
|
|
113848
|
+
const strokeOptions = new _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.StrokeOptions();
|
|
113849
|
+
strokeOptions.needParams = strokeOptions.shouldTriangulate = true;
|
|
113850
|
+
const polyfaceBuilder = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.PolyfaceBuilder.create(strokeOptions);
|
|
113851
|
+
polyfaceBuilder.addQuadFacet(corners, params);
|
|
113852
|
+
const polyface = polyfaceBuilder.claimPolyface();
|
|
113853
|
+
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);
|
|
113854
|
+
graphicBuilder.activateGraphicParams(graphicParams);
|
|
113855
|
+
graphicBuilder.addPolyface(polyface, false);
|
|
113856
|
+
const graphic = graphicBuilder.finish();
|
|
113857
|
+
// Wrap the polyface in a GraphicBranch.
|
|
113858
|
+
const branch = new _render_GraphicBranch__WEBPACK_IMPORTED_MODULE_9__.GraphicBranch(true);
|
|
113859
|
+
const vfOvrs = (0,_tile_ViewFlagOverrides__WEBPACK_IMPORTED_MODULE_14__.createDefaultViewFlagOverrides)({ clipVolume: true, shadows: false, lighting: false, thematic: false });
|
|
113860
|
+
// Disable transparency - background pixels are 100% transparent so they will be discarded anyway. Other pixels are 100% opaque.
|
|
113861
|
+
vfOvrs.transparency = false;
|
|
113862
|
+
branch.setViewFlagOverrides(vfOvrs);
|
|
113863
|
+
branch.symbologyOverrides = new _render_FeatureSymbology__WEBPACK_IMPORTED_MODULE_8__.FeatureSymbology.Overrides();
|
|
113864
|
+
branch.entries.push(graphic);
|
|
113865
|
+
// Apply the attachment's clip, if any.
|
|
113866
|
+
let clipVolume;
|
|
113867
|
+
if (this._props.jsonProperties?.clip) {
|
|
113868
|
+
const clipVector = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_13__.ClipVector.fromJSON(this._props.jsonProperties?.clip);
|
|
113869
|
+
if (clipVector.isValid)
|
|
113870
|
+
clipVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createClipVolume(clipVector);
|
|
113871
|
+
}
|
|
113872
|
+
return _IModelApp__WEBPACK_IMPORTED_MODULE_3__.IModelApp.renderSystem.createGraphicBranch(branch, this._transform, { clipVolume });
|
|
113873
|
+
}
|
|
113874
|
+
collectStatistics(stats) {
|
|
113875
|
+
if (this._graphics)
|
|
113876
|
+
this._graphics.collectStatistics(stats);
|
|
113877
|
+
}
|
|
113878
|
+
}
|
|
113879
|
+
|
|
113880
|
+
|
|
113657
113881
|
/***/ }),
|
|
113658
113882
|
|
|
113659
113883
|
/***/ "../../core/frontend/lib/esm/internal/cross-package.js":
|
|
@@ -127214,7 +127438,7 @@ class FrameBuffers {
|
|
|
127214
127438
|
undefined !== textures.depthAndOrderMsBuff &&
|
|
127215
127439
|
undefined !== textures.depthAndOrderMsBuffHidden);
|
|
127216
127440
|
const colorAndPickMsBuffs = [textures.colorMsBuff, textures.featureIdMsBuff, textures.depthAndOrderMsBuff];
|
|
127217
|
-
const colorAndPickFilters = [_GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Linear, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest
|
|
127441
|
+
const colorAndPickFilters = [_GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Linear, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest, _GL__WEBPACK_IMPORTED_MODULE_10__.GL.MultiSampling.Filter.Nearest];
|
|
127218
127442
|
this.opaqueAll = _FrameBuffer__WEBPACK_IMPORTED_MODULE_9__.FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
127219
127443
|
colorAndPick[0] = textures.color;
|
|
127220
127444
|
this.opaqueAndCompositeAll = _FrameBuffer__WEBPACK_IMPORTED_MODULE_9__.FrameBuffer.create(colorAndPick, depth, colorAndPickMsBuffs, colorAndPickFilters, depthMs);
|
|
@@ -129867,12 +130091,19 @@ class VertexShaderBuilder extends ShaderBuilder {
|
|
|
129867
130091
|
}
|
|
129868
130092
|
main.addline(" v_color = baseColor;");
|
|
129869
130093
|
}
|
|
130094
|
+
/*
|
|
130095
|
+
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).
|
|
130096
|
+
|
|
130097
|
+
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.
|
|
130098
|
+
|
|
130099
|
+
The workaround for this bug involves ensuring that gl_Position is initialized to a valid position before attempting a discard using a degenerate triangle.
|
|
130100
|
+
*/
|
|
130101
|
+
main.addline(" gl_Position = computePosition(rawPosition);");
|
|
129870
130102
|
const checkForDiscard = this.get(9 /* VertexShaderComponent.CheckForDiscard */);
|
|
129871
130103
|
if (undefined !== checkForDiscard) {
|
|
129872
130104
|
prelude.addFunction("bool checkForDiscard()", checkForDiscard);
|
|
129873
130105
|
main.add(_glsl_Vertex__WEBPACK_IMPORTED_MODULE_3__.vertexDiscard);
|
|
129874
130106
|
}
|
|
129875
|
-
main.addline(" gl_Position = computePosition(rawPosition);");
|
|
129876
130107
|
const finalizePos = this.get(13 /* VertexShaderComponent.FinalizePosition */);
|
|
129877
130108
|
if (undefined !== finalizePos) {
|
|
129878
130109
|
prelude.addFunction("vec4 finalizePosition(vec4 pos)", finalizePos);
|
|
@@ -155636,10 +155867,10 @@ class AngleDescription extends _FormattedQuantityDescription__WEBPACK_IMPORTED_M
|
|
|
155636
155867
|
constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
|
|
155637
155868
|
const defaultName = "angle";
|
|
155638
155869
|
super({
|
|
155639
|
-
name: name
|
|
155640
|
-
displayLabel: displayLabel
|
|
155641
|
-
kindOfQuantityName: kindOfQuantityName
|
|
155642
|
-
iconSpec
|
|
155870
|
+
name: name ?? defaultName,
|
|
155871
|
+
displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Angle"),
|
|
155872
|
+
kindOfQuantityName: kindOfQuantityName ?? "DefaultToolsUnits.ANGLE",
|
|
155873
|
+
iconSpec,
|
|
155643
155874
|
});
|
|
155644
155875
|
}
|
|
155645
155876
|
get formatterQuantityType() { return _quantity_formatting_QuantityFormatter__WEBPACK_IMPORTED_MODULE_1__.QuantityType.Angle; }
|
|
@@ -155771,9 +156002,9 @@ class LengthDescription extends _FormattedQuantityDescription__WEBPACK_IMPORTED_
|
|
|
155771
156002
|
constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
|
|
155772
156003
|
const defaultName = "length";
|
|
155773
156004
|
super({
|
|
155774
|
-
name: name
|
|
155775
|
-
displayLabel: displayLabel
|
|
155776
|
-
kindOfQuantityName: kindOfQuantityName
|
|
156005
|
+
name: name ?? defaultName,
|
|
156006
|
+
displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
|
|
156007
|
+
kindOfQuantityName: kindOfQuantityName ?? "DefaultToolsUnits.LENGTH",
|
|
155777
156008
|
iconSpec,
|
|
155778
156009
|
});
|
|
155779
156010
|
}
|
|
@@ -155792,9 +156023,9 @@ class SurveyLengthDescription extends _FormattedQuantityDescription__WEBPACK_IMP
|
|
|
155792
156023
|
constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
|
|
155793
156024
|
const defaultName = "surveyLength";
|
|
155794
156025
|
super({
|
|
155795
|
-
name: name
|
|
155796
|
-
displayLabel: displayLabel
|
|
155797
|
-
kindOfQuantityName: kindOfQuantityName
|
|
156026
|
+
name: name ?? defaultName,
|
|
156027
|
+
displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
|
|
156028
|
+
kindOfQuantityName: kindOfQuantityName ?? "CivilUnits.LENGTH",
|
|
155798
156029
|
iconSpec,
|
|
155799
156030
|
});
|
|
155800
156031
|
}
|
|
@@ -155813,9 +156044,9 @@ class EngineeringLengthDescription extends _FormattedQuantityDescription__WEBPAC
|
|
|
155813
156044
|
constructor(name, displayLabel, iconSpec, kindOfQuantityName) {
|
|
155814
156045
|
const defaultName = "engineeringLength";
|
|
155815
156046
|
super({
|
|
155816
|
-
name: name
|
|
155817
|
-
displayLabel: displayLabel
|
|
155818
|
-
kindOfQuantityName: kindOfQuantityName
|
|
156047
|
+
name: name ?? defaultName,
|
|
156048
|
+
displayLabel: displayLabel ?? _IModelApp__WEBPACK_IMPORTED_MODULE_0__.IModelApp.localization.getLocalizedString("iModelJs:Properties.Length"),
|
|
156049
|
+
kindOfQuantityName: kindOfQuantityName ?? "AecUnits.LENGTH",
|
|
155819
156050
|
iconSpec,
|
|
155820
156051
|
});
|
|
155821
156052
|
}
|
|
@@ -156406,13 +156637,14 @@ class QuantityTypeFormatsProvider {
|
|
|
156406
156637
|
this._removeListeners.forEach(listener => listener());
|
|
156407
156638
|
}
|
|
156408
156639
|
_kindOfQuantityMap = new Map([
|
|
156409
|
-
["
|
|
156410
|
-
["
|
|
156411
|
-
["
|
|
156412
|
-
["
|
|
156413
|
-
["
|
|
156414
|
-
["
|
|
156415
|
-
["
|
|
156640
|
+
["DefaultToolsUnits.LENGTH", QuantityType.Length],
|
|
156641
|
+
["DefaultToolsUnits.ANGLE", QuantityType.Angle],
|
|
156642
|
+
["DefaultToolsUnits.AREA", QuantityType.Area],
|
|
156643
|
+
["DefaultToolsUnits.VOLUME", QuantityType.Volume],
|
|
156644
|
+
["DefaultToolsUnits.LENGTH_COORDINATE", QuantityType.Coordinate],
|
|
156645
|
+
["CivilUnits.STATION", QuantityType.Stationing],
|
|
156646
|
+
["CivilUnits.LENGTH", QuantityType.LengthSurvey],
|
|
156647
|
+
["AecUnits.LENGTH", QuantityType.LengthEngineering]
|
|
156416
156648
|
]);
|
|
156417
156649
|
async getFormat(name) {
|
|
156418
156650
|
const quantityType = this._kindOfQuantityMap.get(name);
|
|
@@ -156640,7 +156872,7 @@ class QuantityFormatter {
|
|
|
156640
156872
|
*/
|
|
156641
156873
|
async onInitialized() {
|
|
156642
156874
|
await this.initializeQuantityTypesRegistry();
|
|
156643
|
-
const initialKoQs = [["
|
|
156875
|
+
const initialKoQs = [["DefaultToolsUnits.LENGTH", "Units.M"], ["DefaultToolsUnits.ANGLE", "Units.RAD"], ["DefaultToolsUnits.AREA", "Units.SQ_M"], ["DefaultToolsUnits.VOLUME", "Units.CUB_M"], ["DefaultToolsUnits.LENGTH_COORDINATE", "Units.M"], ["CivilUnits.STATION", "Units.M"], ["CivilUnits.LENGTH", "Units.M"], ["AecUnits.LENGTH", "Units.M"]];
|
|
156644
156876
|
for (const entry of initialKoQs) {
|
|
156645
156877
|
try {
|
|
156646
156878
|
await this.addFormattingSpecsToRegistry(entry[0], entry[1]);
|
|
@@ -177774,7 +178006,7 @@ class EventController {
|
|
|
177774
178006
|
const element = vp.parentDiv;
|
|
177775
178007
|
if (element === undefined)
|
|
177776
178008
|
return;
|
|
177777
|
-
// Put events
|
|
178009
|
+
// Put events on the parentDiv to allow us to stopPropagation of events to the view canvas when they are meant for a sibling of view canvas (markup canvas, for example).
|
|
177778
178010
|
this.addDomListeners(["mousedown", "mouseup", "mousemove", "mouseover", "mouseout", "wheel", "touchstart", "touchend", "touchcancel", "touchmove"], element);
|
|
177779
178011
|
element.oncontextmenu = element.onselectstart = () => false;
|
|
177780
178012
|
}
|
|
@@ -178138,13 +178370,13 @@ class MeasureDistanceTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pr
|
|
|
178138
178370
|
/** @internal */
|
|
178139
178371
|
async onPostInstall() {
|
|
178140
178372
|
await super.onPostInstall();
|
|
178141
|
-
this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
178142
|
-
this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
178373
|
+
this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
178374
|
+
this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.ANGLE", "Units.RAD");
|
|
178143
178375
|
this._removeFormatterListener = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.formatsProvider.onFormatsChanged.addListener(async (args) => {
|
|
178144
|
-
if (args.formatsChanged === "all" || args.formatsChanged.includes("
|
|
178145
|
-
this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
178146
|
-
if (args.formatsChanged === "all" || args.formatsChanged.includes("
|
|
178147
|
-
this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
178376
|
+
if (args.formatsChanged === "all" || args.formatsChanged.includes("DefaultToolsUnits.LENGTH"))
|
|
178377
|
+
this._lengthFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
178378
|
+
if (args.formatsChanged === "all" || args.formatsChanged.includes("DefaultToolsUnits.ANGLE"))
|
|
178379
|
+
this._angleFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.ANGLE", "Units.RAD");
|
|
178148
178380
|
});
|
|
178149
178381
|
this.setupAndPromptForNextAction();
|
|
178150
178382
|
}
|
|
@@ -178626,7 +178858,7 @@ class MeasureLocationTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pr
|
|
|
178626
178858
|
const isSpatial = (undefined !== this.targetView && this.targetView.view.isSpatialView());
|
|
178627
178859
|
const toolTip = document.createElement("div");
|
|
178628
178860
|
let toolTipHtml = "";
|
|
178629
|
-
const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
178861
|
+
const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH_COORDINATE", "Units.M");
|
|
178630
178862
|
if (undefined !== coordFormatterSpec) {
|
|
178631
178863
|
let pointAdjusted = point;
|
|
178632
178864
|
if (isSpatial) {
|
|
@@ -178642,7 +178874,7 @@ class MeasureLocationTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pr
|
|
|
178642
178874
|
toolTipHtml += "<br>";
|
|
178643
178875
|
}
|
|
178644
178876
|
if (isSpatial) {
|
|
178645
|
-
const latLongFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
178877
|
+
const latLongFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.ANGLE", "Units.RAD");
|
|
178646
178878
|
if (undefined !== latLongFormatterSpec && undefined !== coordFormatterSpec) {
|
|
178647
178879
|
try {
|
|
178648
178880
|
const cartographic = await this.iModel.spatialToCartographic(point);
|
|
@@ -178946,17 +179178,17 @@ class MeasureAreaByPointsTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9_
|
|
|
178946
179178
|
const isSpatial = (undefined !== this.targetView && this.targetView.view.isSpatialView());
|
|
178947
179179
|
const toolTip = document.createElement("div");
|
|
178948
179180
|
let toolTipHtml = "";
|
|
178949
|
-
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179181
|
+
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
|
|
178950
179182
|
if (undefined !== areaFormatterSpec) {
|
|
178951
179183
|
const formattedArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._area, areaFormatterSpec);
|
|
178952
179184
|
toolTipHtml += `${translateBold("Area") + formattedArea}<br>`;
|
|
178953
179185
|
}
|
|
178954
|
-
const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179186
|
+
const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
178955
179187
|
if (undefined !== perimeterFormatterSpec) {
|
|
178956
179188
|
const formattedPerimeter = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._perimeter, perimeterFormatterSpec);
|
|
178957
179189
|
toolTipHtml += `${translateBold("Perimeter") + formattedPerimeter}<br>`;
|
|
178958
179190
|
}
|
|
178959
|
-
const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179191
|
+
const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH_COORDINATE", "Units.M");
|
|
178960
179192
|
if (undefined !== coordFormatterSpec) {
|
|
178961
179193
|
let pointAdjusted = this._centroid.clone();
|
|
178962
179194
|
if (isSpatial) {
|
|
@@ -178995,7 +179227,7 @@ class MeasureAreaByPointsTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9_
|
|
|
178995
179227
|
const toolTip = await this.getMarkerToolTip();
|
|
178996
179228
|
this._acceptedMeasurement = new MeasureMarker("1", toolTip, this._centroid, _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point2d.create(25, 25));
|
|
178997
179229
|
this._marker = undefined;
|
|
178998
|
-
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179230
|
+
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
|
|
178999
179231
|
if (undefined === areaFormatterSpec)
|
|
179000
179232
|
return;
|
|
179001
179233
|
const formattedTotalArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._area, areaFormatterSpec);
|
|
@@ -179178,7 +179410,7 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
|
|
|
179178
179410
|
let toolTipHtml = "";
|
|
179179
179411
|
switch (this.getOperation()) {
|
|
179180
179412
|
case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateLengths: {
|
|
179181
|
-
const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179413
|
+
const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
179182
179414
|
if (undefined !== distanceFormatterSpec) {
|
|
179183
179415
|
const formattedLength = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.length ? responseProps.length : 0, distanceFormatterSpec);
|
|
179184
179416
|
toolTipHtml += `${translateBold("Length") + formattedLength}<br>`;
|
|
@@ -179186,13 +179418,13 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
|
|
|
179186
179418
|
break;
|
|
179187
179419
|
}
|
|
179188
179420
|
case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateAreas: {
|
|
179189
|
-
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179421
|
+
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
|
|
179190
179422
|
if (undefined !== areaFormatterSpec) {
|
|
179191
179423
|
const formattedArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.area ? responseProps.area : 0, areaFormatterSpec);
|
|
179192
179424
|
toolTipHtml += `${translateBold("Area") + formattedArea}<br>`;
|
|
179193
179425
|
}
|
|
179194
179426
|
if (responseProps.perimeter) {
|
|
179195
|
-
const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179427
|
+
const perimeterFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
179196
179428
|
if (undefined !== perimeterFormatterSpec) {
|
|
179197
179429
|
const formattedPerimeter = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.perimeter, perimeterFormatterSpec);
|
|
179198
179430
|
toolTipHtml += `${translateBold("Perimeter") + formattedPerimeter}<br>`;
|
|
@@ -179201,13 +179433,13 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
|
|
|
179201
179433
|
break;
|
|
179202
179434
|
}
|
|
179203
179435
|
case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateVolumes: {
|
|
179204
|
-
const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179436
|
+
const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.VOLUME", "Units.CUB_M");
|
|
179205
179437
|
if (undefined !== volumeFormatterSpec) {
|
|
179206
179438
|
const formattedVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.volume ? responseProps.volume : 0, volumeFormatterSpec);
|
|
179207
179439
|
toolTipHtml += `${translateBold("Volume") + formattedVolume}<br>`;
|
|
179208
179440
|
}
|
|
179209
179441
|
if (responseProps.area) {
|
|
179210
|
-
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179442
|
+
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
|
|
179211
179443
|
if (undefined !== areaFormatterSpec) {
|
|
179212
179444
|
const formattedArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(responseProps.area, areaFormatterSpec);
|
|
179213
179445
|
toolTipHtml += `${translateBold("Area") + formattedArea}<br>`;
|
|
@@ -179217,7 +179449,7 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
|
|
|
179217
179449
|
}
|
|
179218
179450
|
}
|
|
179219
179451
|
if (responseProps.centroid) {
|
|
179220
|
-
const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179452
|
+
const coordFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
179221
179453
|
if (undefined !== coordFormatterSpec) {
|
|
179222
179454
|
let pointAdjusted = _itwin_core_geometry__WEBPACK_IMPORTED_MODULE_1__.Point3d.fromJSON(responseProps.centroid);
|
|
179223
179455
|
if (isSpatial) {
|
|
@@ -179268,21 +179500,21 @@ class MeasureElementTool extends _PrimitiveTool__WEBPACK_IMPORTED_MODULE_9__.Pri
|
|
|
179268
179500
|
return;
|
|
179269
179501
|
switch (operation) {
|
|
179270
179502
|
case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateLengths:
|
|
179271
|
-
const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179503
|
+
const distanceFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.LENGTH", "Units.M");
|
|
179272
179504
|
if (undefined === distanceFormatterSpec)
|
|
179273
179505
|
return;
|
|
179274
179506
|
const formattedTotalDistance = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._totalValue, distanceFormatterSpec);
|
|
179275
179507
|
this._totalMarker = new MeasureLabel(labelPt, formattedTotalDistance);
|
|
179276
179508
|
break;
|
|
179277
179509
|
case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateAreas:
|
|
179278
|
-
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179510
|
+
const areaFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.AREA", "Units.SQ_M");
|
|
179279
179511
|
if (undefined === areaFormatterSpec)
|
|
179280
179512
|
return;
|
|
179281
179513
|
const formattedTotalArea = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._totalValue, areaFormatterSpec);
|
|
179282
179514
|
this._totalMarker = new MeasureLabel(labelPt, formattedTotalArea);
|
|
179283
179515
|
break;
|
|
179284
179516
|
case _itwin_core_common__WEBPACK_IMPORTED_MODULE_2__.MassPropertiesOperation.AccumulateVolumes:
|
|
179285
|
-
const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("
|
|
179517
|
+
const volumeFormatterSpec = await getFormatterSpecByKoQAndPersistenceUnit("DefaultToolsUnits.VOLUME", "Units.CUB_M");
|
|
179286
179518
|
if (undefined === volumeFormatterSpec)
|
|
179287
179519
|
return;
|
|
179288
179520
|
const formattedTotalVolume = _IModelApp__WEBPACK_IMPORTED_MODULE_6__.IModelApp.quantityFormatter.formatQuantity(this._totalValue, volumeFormatterSpec);
|
|
@@ -194523,7 +194755,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
194523
194755
|
|
|
194524
194756
|
|
|
194525
194757
|
/**
|
|
194526
|
-
* CurveLocationDetail carries point and
|
|
194758
|
+
* CurveLocationDetail carries point and parameter data about a point evaluated on a curve.
|
|
194527
194759
|
* * These are returned by a variety of queries.
|
|
194528
194760
|
* * Particular contents can vary among the queries.
|
|
194529
194761
|
* @public
|
|
@@ -215412,11 +215644,13 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
215412
215644
|
/* harmony import */ var _CurveChainWithDistanceIndex__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../CurveChainWithDistanceIndex */ "../../core/geometry/lib/esm/curve/CurveChainWithDistanceIndex.js");
|
|
215413
215645
|
/* harmony import */ var _CurveCollection__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../CurveCollection */ "../../core/geometry/lib/esm/curve/CurveCollection.js");
|
|
215414
215646
|
/* harmony import */ var _CurveLocationDetail__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CurveLocationDetail */ "../../core/geometry/lib/esm/curve/CurveLocationDetail.js");
|
|
215647
|
+
/* harmony import */ var _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../CurvePrimitive */ "../../core/geometry/lib/esm/curve/CurvePrimitive.js");
|
|
215415
215648
|
/* harmony import */ var _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../LineSegment3d */ "../../core/geometry/lib/esm/curve/LineSegment3d.js");
|
|
215416
215649
|
/* harmony import */ var _LineString3d__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../LineString3d */ "../../core/geometry/lib/esm/curve/LineString3d.js");
|
|
215417
215650
|
/* harmony import */ var _Loop__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../Loop */ "../../core/geometry/lib/esm/curve/Loop.js");
|
|
215418
215651
|
/* harmony import */ var _Path__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../Path */ "../../core/geometry/lib/esm/curve/Path.js");
|
|
215419
215652
|
/* harmony import */ var _ProxyCurve__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ProxyCurve */ "../../core/geometry/lib/esm/curve/ProxyCurve.js");
|
|
215653
|
+
/* harmony import */ var _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../spiral/TransitionSpiral3d */ "../../core/geometry/lib/esm/curve/spiral/TransitionSpiral3d.js");
|
|
215420
215654
|
/*---------------------------------------------------------------------------------------------
|
|
215421
215655
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
215422
215656
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -215443,6 +215677,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
215443
215677
|
|
|
215444
215678
|
|
|
215445
215679
|
|
|
215680
|
+
|
|
215681
|
+
|
|
215446
215682
|
|
|
215447
215683
|
|
|
215448
215684
|
|
|
@@ -216142,7 +216378,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216142
216378
|
return undefined;
|
|
216143
216379
|
}
|
|
216144
216380
|
/** Detail computation for linestring intersecting linestring. */
|
|
216145
|
-
computeLineStringLineString(lsA, lsB, reversed) {
|
|
216381
|
+
computeLineStringLineString(lsA, extendA0, extendA1, lsB, extendB0, extendB1, reversed) {
|
|
216146
216382
|
const pointA0 = CurveCurveIntersectXY._workPointAA0;
|
|
216147
216383
|
const pointA1 = CurveCurveIntersectXY._workPointAA1;
|
|
216148
216384
|
const pointB0 = CurveCurveIntersectXY._workPointBB0;
|
|
@@ -216166,7 +216402,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216166
216402
|
for (let ib = 1; ib < numB; ib++, pointB0.setFrom(pointB1), fB0 = fB1) {
|
|
216167
216403
|
lsB.pointAt(ib, pointB1);
|
|
216168
216404
|
fB1 = ib * dfB;
|
|
216169
|
-
this.dispatchSegmentSegment(lsA, ia === 1 &&
|
|
216405
|
+
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);
|
|
216170
216406
|
}
|
|
216171
216407
|
}
|
|
216172
216408
|
}
|
|
@@ -216265,6 +216501,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216265
216501
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
|
|
216266
216502
|
this.dispatchSegmentBsplineCurve(segmentA, this._extendA0, segmentA.point0Ref, 0.0, segmentA.point1Ref, 1.0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
216267
216503
|
}
|
|
216504
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216505
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216506
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216507
|
+
const numPreviousResults = this._results.length;
|
|
216508
|
+
this.computeSegmentLineString(segmentA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
|
|
216509
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216510
|
+
this.refineSpiralResultsByNewton(segmentA, this._geometryB, numberOfNewResults);
|
|
216511
|
+
}
|
|
216268
216512
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216269
216513
|
this.dispatchCurveCollection(segmentA, this.handleLineSegment3d.bind(this));
|
|
216270
216514
|
}
|
|
@@ -216277,7 +216521,7 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216277
216521
|
handleLineString3d(lsA) {
|
|
216278
216522
|
if (this._geometryB instanceof _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d) {
|
|
216279
216523
|
const lsB = this._geometryB;
|
|
216280
|
-
this.computeLineStringLineString(lsA, lsB, false);
|
|
216524
|
+
this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, lsB, this._extendB0, this._extendB1, false);
|
|
216281
216525
|
}
|
|
216282
216526
|
else if (this._geometryB instanceof _LineSegment3d__WEBPACK_IMPORTED_MODULE_18__.LineSegment3d) {
|
|
216283
216527
|
this.computeSegmentLineString(this._geometryB, this._extendB0, this._extendB1, lsA, this._extendA0, this._extendA1, true);
|
|
@@ -216288,6 +216532,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216288
216532
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
|
|
216289
216533
|
this.dispatchLineStringBSplineCurve(lsA, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
216290
216534
|
}
|
|
216535
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216536
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216537
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216538
|
+
const numPreviousResults = this._results.length;
|
|
216539
|
+
this.computeLineStringLineString(lsA, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
|
|
216540
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216541
|
+
this.refineSpiralResultsByNewton(lsA, this._geometryB, numberOfNewResults);
|
|
216542
|
+
}
|
|
216291
216543
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216292
216544
|
this.dispatchCurveCollection(lsA, this.handleLineString3d.bind(this));
|
|
216293
216545
|
}
|
|
@@ -216310,6 +216562,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216310
216562
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3d) {
|
|
216311
216563
|
this.dispatchArcBsplineCurve3d(arc0, this._extendA0, this._extendA1, this._geometryB, this._extendB0, this._extendB1, false);
|
|
216312
216564
|
}
|
|
216565
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216566
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216567
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216568
|
+
const numPreviousResults = this._results.length;
|
|
216569
|
+
this.computeArcLineString(arc0, this._extendA0, this._extendA1, spiralApproximation, false, false, false);
|
|
216570
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216571
|
+
this.refineSpiralResultsByNewton(arc0, this._geometryB, numberOfNewResults);
|
|
216572
|
+
}
|
|
216313
216573
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216314
216574
|
this.dispatchCurveCollection(arc0, this.handleArc3d.bind(this));
|
|
216315
216575
|
}
|
|
@@ -216332,6 +216592,14 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216332
216592
|
else if (this._geometryB instanceof _bspline_BSplineCurve__WEBPACK_IMPORTED_MODULE_21__.BSplineCurve3dBase) {
|
|
216333
216593
|
this.dispatchBSplineCurve3dBSplineCurve3d(curve, this._geometryB, false);
|
|
216334
216594
|
}
|
|
216595
|
+
else if (this._geometryB instanceof _spiral_TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_22__.TransitionSpiral3d) {
|
|
216596
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216597
|
+
this._geometryB.emitStrokes(spiralApproximation);
|
|
216598
|
+
const numPreviousResults = this._results.length;
|
|
216599
|
+
this.dispatchLineStringBSplineCurve(spiralApproximation, false, false, curve, this._extendA0, this._extendA1, true);
|
|
216600
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216601
|
+
this.refineSpiralResultsByNewton(curve, this._geometryB, numberOfNewResults);
|
|
216602
|
+
}
|
|
216335
216603
|
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216336
216604
|
this.dispatchCurveCollection(curve, this.handleBSplineCurve3d.bind(this));
|
|
216337
216605
|
}
|
|
@@ -216340,6 +216608,47 @@ class CurveCurveIntersectXY extends _geometry3d_GeometryHandler__WEBPACK_IMPORTE
|
|
|
216340
216608
|
}
|
|
216341
216609
|
return undefined;
|
|
216342
216610
|
}
|
|
216611
|
+
/**
|
|
216612
|
+
* Assuming the tail of `this._results` holds the given number of approximate solutions to the curve-spiral
|
|
216613
|
+
* xy-intersection problem, replace each with its Newton refinement, unless it doesn't converge, in which case
|
|
216614
|
+
* it is removed.
|
|
216615
|
+
* @param spiral The transition spiral.
|
|
216616
|
+
* @param otherCurve The other curve primitive.
|
|
216617
|
+
* @param numberOfNewResults The number of results in the tail of `this._results` to be refined.
|
|
216618
|
+
* @param reversed Whether the spiral is geometryA (true) or geometryB (false).
|
|
216619
|
+
*/
|
|
216620
|
+
refineSpiralResultsByNewton(otherCurve, spiral, numberOfNewResults, reversed = false) {
|
|
216621
|
+
const resultsToBeRefined = this._results.slice(this._results.length - numberOfNewResults);
|
|
216622
|
+
this._results.length -= numberOfNewResults; // keep already refined results
|
|
216623
|
+
for (const detail of resultsToBeRefined) {
|
|
216624
|
+
let spiralFraction = reversed ? detail.detailA.fraction : detail.detailB.fraction;
|
|
216625
|
+
let otherFraction = reversed ? detail.detailB.fraction : detail.detailA.fraction;
|
|
216626
|
+
const xyMatchingFunction = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.CurveCurveIntersectionXYRRToRRD(spiral, otherCurve);
|
|
216627
|
+
const newtonSearcher = new _numerics_Newton__WEBPACK_IMPORTED_MODULE_13__.Newton2dUnboundedWithDerivative(xyMatchingFunction);
|
|
216628
|
+
newtonSearcher.setUV(spiralFraction, otherFraction);
|
|
216629
|
+
if (newtonSearcher.runIterations()) {
|
|
216630
|
+
spiralFraction = newtonSearcher.getU();
|
|
216631
|
+
otherFraction = newtonSearcher.getV();
|
|
216632
|
+
if (this.acceptFraction(false, spiralFraction, false) && this.acceptFraction(false, otherFraction, false))
|
|
216633
|
+
this.recordPointWithLocalFractions(otherFraction, otherCurve, 0, 1, spiralFraction, spiral, 0, 1, reversed);
|
|
216634
|
+
}
|
|
216635
|
+
}
|
|
216636
|
+
}
|
|
216637
|
+
/** Double dispatch handler for strongly typed spiral curve. */
|
|
216638
|
+
handleTransitionSpiral(spiral) {
|
|
216639
|
+
if (this._geometryB instanceof _CurvePrimitive__WEBPACK_IMPORTED_MODULE_23__.CurvePrimitive) { // this also handles CurveChainWithDistanceIndex
|
|
216640
|
+
const spiralApproximation = _LineString3d__WEBPACK_IMPORTED_MODULE_19__.LineString3d.create();
|
|
216641
|
+
spiral.emitStrokes(spiralApproximation);
|
|
216642
|
+
const numPreviousResults = this._results.length;
|
|
216643
|
+
this.handleLineString3d(spiralApproximation);
|
|
216644
|
+
const numberOfNewResults = this._results.length - numPreviousResults;
|
|
216645
|
+
this.refineSpiralResultsByNewton(this._geometryB, spiral, numberOfNewResults, true);
|
|
216646
|
+
}
|
|
216647
|
+
else if (this._geometryB instanceof _CurveCollection__WEBPACK_IMPORTED_MODULE_14__.CurveCollection) {
|
|
216648
|
+
this.dispatchCurveCollection(spiral, this.handleTransitionSpiral.bind(this));
|
|
216649
|
+
}
|
|
216650
|
+
return undefined;
|
|
216651
|
+
}
|
|
216343
216652
|
/** Double dispatch handler for strongly typed CurveChainWithDistanceIndex. */
|
|
216344
216653
|
handleCurveChainWithDistanceIndex(chain) {
|
|
216345
216654
|
super.handleCurveChainWithDistanceIndex(chain);
|
|
@@ -220029,7 +220338,7 @@ class AustralianRailCorpXYEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MO
|
|
|
220029
220338
|
* * The AustralianRailSpiral has a supporting power series to approximately map distance along the spiral to
|
|
220030
220339
|
* an x coordinate.
|
|
220031
220340
|
* * The `xToFraction(x)` method quickly (with a single divide) converts this x to fraction used for
|
|
220032
|
-
* this.fractionToX
|
|
220341
|
+
* this.fractionToX(fraction), this.fractionToY(fraction) etc to get coordinates and derivatives.
|
|
220033
220342
|
* * The x-to-distance relation is not as precise as the CurvePrimitive method moveSignedDistanceFromFraction.
|
|
220034
220343
|
* * It is supported here for users interested in replicating the AustralianRail distance mapping rather than the
|
|
220035
220344
|
* more accurate CurvePrimitive measurements.
|
|
@@ -220080,8 +220389,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
220080
220389
|
* Methods to evaluate caller-specified number of terms of the x and y Taylor series for a clothoid.
|
|
220081
220390
|
* Each instance has:
|
|
220082
220391
|
* * number of x and y terms to use.
|
|
220083
|
-
* * constant for theta =
|
|
220084
|
-
* * This value is c = 1/
|
|
220392
|
+
* * constant for theta = cxx.
|
|
220393
|
+
* * This value is c = 1/2RL for curve length L measured from inflection to point with radius R.
|
|
220085
220394
|
* @internal
|
|
220086
220395
|
*/
|
|
220087
220396
|
class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODULE_0__.XYCurveEvaluator {
|
|
@@ -220089,7 +220398,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220089
220398
|
numXTerms;
|
|
220090
220399
|
/** Number of terms to use in y Taylor series. */
|
|
220091
220400
|
numYTerms;
|
|
220092
|
-
/** Constant c = 1/
|
|
220401
|
+
/** Constant c = 1/2RL in theta = cxx. */
|
|
220093
220402
|
constantDiv2LR;
|
|
220094
220403
|
/** The nominal curve length. */
|
|
220095
220404
|
nominalLength1;
|
|
@@ -220166,10 +220475,12 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220166
220475
|
* @param numTerms number of terms to use.
|
|
220167
220476
|
*/
|
|
220168
220477
|
fractionToXGo(fraction, numTerms) {
|
|
220169
|
-
// write the Taylor series for cos(theta)
|
|
220170
|
-
//
|
|
220171
|
-
//
|
|
220172
|
-
//
|
|
220478
|
+
// write the Taylor series for cos(theta):
|
|
220479
|
+
// 1 - theta^2 / 2! + theta^4 / 4! - theta^6 / 6! + ...
|
|
220480
|
+
// replace theta by s*s*c:
|
|
220481
|
+
// 1 - s^4c^2 / 2! + s^8c^4 / 4! - s^12c^6 / 6! + ...
|
|
220482
|
+
// integrate wrt s:
|
|
220483
|
+
// x = s - s^5 c^2 / 5*2! + s^9 c^4 / 9*4! - s^13 c^6 / 13*6! + ...
|
|
220173
220484
|
// x = s(1 - (s^4 c^2/2) ( 1/5 - (s^4 c^2 / 3*4) (1/9 - ...) ) )
|
|
220174
220485
|
const s = fraction * this.nominalLength1;
|
|
220175
220486
|
let result = s;
|
|
@@ -220189,9 +220500,11 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220189
220500
|
return result;
|
|
220190
220501
|
}
|
|
220191
220502
|
fractionToYGo(fraction, numTerms) {
|
|
220192
|
-
// write the Taylor series for sin(theta)
|
|
220193
|
-
//
|
|
220194
|
-
//
|
|
220503
|
+
// write the Taylor series for sin(theta):
|
|
220504
|
+
// theta - theta^3 / 3! + theta^5 / 5! - theta^7 / 7! + ...
|
|
220505
|
+
// replace theta by s*s*c:
|
|
220506
|
+
// s^2 c - s^6 c^3 / 3! + s^10 c^5 / 5! - s^14 c^7 / 7! + ...
|
|
220507
|
+
// integrate wrt s:
|
|
220195
220508
|
// y = s^3 c / 3 - s^7 c^3 / 7*3! + s^11 c^5 / 11*5! - s^15 c^7 / 15*7! + ...
|
|
220196
220509
|
// y = s^3 c ( 1/3 - s^4 c^2/ 3! ( (1/7) - (s^4 c^2 / 4*5) (1/11 - ...) ) )
|
|
220197
220510
|
const s = fraction * this.nominalLength1;
|
|
@@ -220239,7 +220552,7 @@ class ClothoidSeriesRLEvaluator extends _XYCurveEvaluator__WEBPACK_IMPORTED_MODU
|
|
|
220239
220552
|
// dY = q - q^3/3!
|
|
220240
220553
|
// q = s^2 c
|
|
220241
220554
|
// dY = s^2 c - s^6 c^3/3! + s^10 c^5/ 5!
|
|
220242
|
-
// recurrence
|
|
220555
|
+
// recurrence advancing m by 2 alpha *= -(s^4 c^2) / (m(m+1))
|
|
220243
220556
|
const s = fraction * this.nominalLength1;
|
|
220244
220557
|
const q1 = s * s * this.constantDiv2LR;
|
|
220245
220558
|
let result = q1;
|
|
@@ -220461,7 +220774,7 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
220461
220774
|
static gammaConstant(length1, radius1) {
|
|
220462
220775
|
return 2.0 * radius1 / Math.sqrt(4.0 * radius1 * radius1 - length1 * length1);
|
|
220463
220776
|
}
|
|
220464
|
-
/** Compute the
|
|
220777
|
+
/** Compute the Czech cubic constant. */
|
|
220465
220778
|
static computeCubicM(length1, radius1) {
|
|
220466
220779
|
const gamma = CzechSpiralEvaluator.gammaConstant(length1, radius1);
|
|
220467
220780
|
// in the private update method, the LR values should have been vetted
|
|
@@ -220554,17 +220867,9 @@ class CzechSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.
|
|
|
220554
220867
|
class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0__.CubicEvaluator {
|
|
220555
220868
|
nominalLength1;
|
|
220556
220869
|
nominalRadius1;
|
|
220557
|
-
/**
|
|
220558
|
-
* Compute the czech cubic constant.
|
|
220559
|
-
* * Funky mixture of lengths.
|
|
220560
|
-
*/
|
|
220870
|
+
/** Compute the Italian cubic constant. */
|
|
220561
220871
|
static computeCubicM(lengthXByForward, radius1) {
|
|
220562
|
-
|
|
220563
|
-
// in the private update method, the LR values should have been vetted
|
|
220564
|
-
if (gamma === undefined)
|
|
220565
|
-
return undefined;
|
|
220566
|
-
// if radius is negative, it shows up in gamma; but the a signed denominator undoes it so take abs of denominator
|
|
220567
|
-
return gamma / Math.abs((6.0 * radius1 * lengthXByForward));
|
|
220872
|
+
return CzechSpiralEvaluator.computeCubicM(lengthXByForward, radius1);
|
|
220568
220873
|
}
|
|
220569
220874
|
/** Constructor is private. Caller responsible for cubicM validity. */
|
|
220570
220875
|
constructor(length1, radius1, lengthX, cubicM) {
|
|
@@ -220573,7 +220878,7 @@ class ItalianSpiralEvaluator extends _CubicEvaluator__WEBPACK_IMPORTED_MODULE_0_
|
|
|
220573
220878
|
this.nominalRadius1 = radius1;
|
|
220574
220879
|
}
|
|
220575
220880
|
static create(length1, radius1) {
|
|
220576
|
-
// this seems goofy
|
|
220881
|
+
// this seems goofy; lengthX from forward, then invert for another but that's what the native code does too
|
|
220577
220882
|
const lengthX = CzechSpiralEvaluator.forwardL2R2Map(length1, -1.0, length1, radius1);
|
|
220578
220883
|
const lengthX1 = CzechSpiralEvaluator.inverseL2R2Map(length1, 1.0, lengthX, radius1);
|
|
220579
220884
|
if (lengthX1 === undefined)
|
|
@@ -220789,18 +221094,20 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
220789
221094
|
* DirectSpiral3d acts like a TransitionSpiral3d for serialization purposes, but implements spiral types that have
|
|
220790
221095
|
* "direct" xy calculations without the integrations required for IntegratedSpiral3d.
|
|
220791
221096
|
* * Each DirectSpiral3d carries an XYCurveEvaluator to give it specialized behavior.
|
|
220792
|
-
* * Direct spirals
|
|
221097
|
+
* * Direct spirals are created with these static methods:
|
|
220793
221098
|
* * createArema
|
|
220794
221099
|
* * createJapaneseCubic
|
|
220795
|
-
* * createAustralianRail
|
|
220796
|
-
* * createDirectHalfCosine
|
|
220797
221100
|
* * createChineseCubic
|
|
221101
|
+
* * createWesternAustralian
|
|
221102
|
+
* * createDirectHalfCosine
|
|
221103
|
+
* * createAustralianRail
|
|
220798
221104
|
* * createCzechCubic
|
|
220799
221105
|
* * createPolishCubic
|
|
221106
|
+
* * createMXCubicAlongArc
|
|
220800
221107
|
* * createItalian
|
|
220801
|
-
* * createWesternAustralian
|
|
220802
221108
|
* @public
|
|
220803
221109
|
*/
|
|
221110
|
+
// see internaldocs/Spiral.md for more info
|
|
220804
221111
|
class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
|
|
220805
221112
|
/** String name for schema properties. */
|
|
220806
221113
|
curvePrimitiveType = "transitionSpiral";
|
|
@@ -220956,11 +221263,11 @@ class DirectSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.Tr
|
|
|
220956
221263
|
/**
|
|
220957
221264
|
* Create an MX Cubic whose nominal length is close to along the curve.
|
|
220958
221265
|
* This is y = m*x^3 with
|
|
220959
|
-
* * m is 1/(
|
|
221266
|
+
* * m is 1/(6RL).
|
|
220960
221267
|
* * 1/(6RL) is the leading term of the sine series.
|
|
220961
221268
|
* * L1 is an along-the-x-axis distance that is slightly LESS THAN the nominal length.
|
|
220962
221269
|
* * x is axis position that is slightly LESS than nominal distance along.
|
|
220963
|
-
* * L1, x use the approximation `x = s * ( 1 - s^4/ (40
|
|
221270
|
+
* * L1, x use the approximation `x = s * ( 1 - s^4/ (40 RR LL))
|
|
220964
221271
|
* @param localToWorld
|
|
220965
221272
|
* @param nominalL1
|
|
220966
221273
|
* @param nominalR1
|
|
@@ -221321,6 +221628,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
221321
221628
|
* * [[TransitionConditionalProperties]] implements the computations of the interrelationship of radii, bearing, and length.
|
|
221322
221629
|
* @public
|
|
221323
221630
|
*/
|
|
221631
|
+
// see internaldocs/Spiral.md for more info
|
|
221324
221632
|
class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0__.TransitionSpiral3d {
|
|
221325
221633
|
/** String name for schema properties. */
|
|
221326
221634
|
curvePrimitiveType = "transitionSpiral";
|
|
@@ -221364,11 +221672,13 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
|
|
|
221364
221672
|
static defaultSpiralType = "clothoid";
|
|
221365
221673
|
/** Use the integrated function to return an angle at fractional position. */
|
|
221366
221674
|
globalFractionToBearingRadians(fraction) {
|
|
221675
|
+
// calculate area under curvature curve from 0 to fraction and add it to start angle to get angle at the given fraction
|
|
221676
|
+
// see internaldocs/Spiral.md for more info
|
|
221367
221677
|
const areaFraction = this._evaluator.fractionToArea(fraction);
|
|
221368
|
-
const
|
|
221678
|
+
const arcLength = this._arcLength01;
|
|
221369
221679
|
return this.bearing01.startRadians
|
|
221370
|
-
+
|
|
221371
|
-
+
|
|
221680
|
+
+ fraction * arcLength * this._curvature01.x0
|
|
221681
|
+
+ areaFraction * arcLength * this._curvature01.signedDelta();
|
|
221372
221682
|
}
|
|
221373
221683
|
/** Use the integrated function to return an angle at fractional position. */
|
|
221374
221684
|
globalFractionToCurvature(fraction) {
|
|
@@ -221407,9 +221717,10 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
|
|
|
221407
221717
|
* @param xyz advancing integrated point.
|
|
221408
221718
|
* @param fractionA fraction at start of interval.
|
|
221409
221719
|
* @param fractionB fraction at end of interval.
|
|
221410
|
-
* @param
|
|
221720
|
+
* @param applyMatrix if true, apply the localToWorld matrix to the computed delta before adding to xyz.
|
|
221411
221721
|
*/
|
|
221412
221722
|
fullSpiralIncrementalIntegral(xyz, fractionA, fractionB, applyMatrix) {
|
|
221723
|
+
// see internaldocs/Spiral.md for more info
|
|
221413
221724
|
const gaussFraction = IntegratedSpiral3d._gaussFraction;
|
|
221414
221725
|
const gaussWeight = IntegratedSpiral3d._gaussWeight;
|
|
221415
221726
|
const numEval = IntegratedSpiral3d._gaussMapper(fractionA, fractionB, gaussFraction, gaussWeight);
|
|
@@ -221459,7 +221770,7 @@ class IntegratedSpiral3d extends _TransitionSpiral3d__WEBPACK_IMPORTED_MODULE_0_
|
|
|
221459
221770
|
/**
|
|
221460
221771
|
* Create a transition spiral with radius and bearing conditions.
|
|
221461
221772
|
* @param radius01 radius (inverse curvature) at start and end (radius of zero means straight line).
|
|
221462
|
-
* @param bearing01 bearing angles at start and end.
|
|
221773
|
+
* @param bearing01 bearing angles at start and end. Bearings are measured from the x axis, positive clockwise
|
|
221463
221774
|
* towards y axis.
|
|
221464
221775
|
* @param activeFractionInterval fractional limits of the active portion of the spiral.
|
|
221465
221776
|
* @param localToWorld placement frame. Fractional coordinate 0 is at the origin.
|
|
@@ -221839,10 +222150,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
221839
222150
|
* * Each implementation provides:
|
|
221840
222151
|
* * fractionToCurvature -- the f(u) function described above
|
|
221841
222152
|
* * fractionToCurvatureDerivative -- df(u)/du
|
|
221842
|
-
* * fractionToArea --
|
|
221843
|
-
*
|
|
222153
|
+
* * fractionToArea -- antiderivative A of f, chosen such that A(0) = 0. The value of this function at
|
|
222154
|
+
* fraction u is the area under f from 0 to u. In particular, the symmetry condition on f implies that
|
|
222155
|
+
* 1/2 = "integral of f over [0,1]" = A(1) - A(0) = A(1).
|
|
221844
222156
|
* @internal
|
|
221845
222157
|
*/
|
|
222158
|
+
// see internaldocs/Spiral.md for more info
|
|
221846
222159
|
class NormalizedTransition {
|
|
221847
222160
|
/** Constructor initializes with 0..1 values. Call "setBearingCurvatureLengthCurvature" to apply real values. */
|
|
221848
222161
|
constructor() { }
|
|
@@ -221879,10 +222192,13 @@ class NormalizedTransition {
|
|
|
221879
222192
|
}
|
|
221880
222193
|
/**
|
|
221881
222194
|
* Transition functions for clothoid spiral.
|
|
221882
|
-
* *
|
|
222195
|
+
* * Curvature variation is linear from (0,0) to (1,1).
|
|
221883
222196
|
* @internal
|
|
221884
222197
|
*/
|
|
221885
222198
|
class NormalizedClothoidTransition extends NormalizedTransition {
|
|
222199
|
+
// clothoid curvature is f(x) = x
|
|
222200
|
+
// derivative f'(x) = 1
|
|
222201
|
+
// integral If(x) = x^2 / 2
|
|
221886
222202
|
constructor() {
|
|
221887
222203
|
super();
|
|
221888
222204
|
}
|
|
@@ -221908,13 +222224,12 @@ class NormalizedClothoidTransition extends NormalizedTransition {
|
|
|
221908
222224
|
* @internal
|
|
221909
222225
|
*/
|
|
221910
222226
|
class NormalizedBlossTransition extends NormalizedTransition {
|
|
221911
|
-
// bloss
|
|
222227
|
+
// bloss curvature is x^2 (3 - 2x)
|
|
221912
222228
|
// derivative 6x (1-x)
|
|
221913
|
-
//
|
|
221914
|
-
|
|
221915
|
-
|
|
221916
|
-
|
|
221917
|
-
constructor() { super(); }
|
|
222229
|
+
// integral is x^3 (1-x/2)
|
|
222230
|
+
constructor() {
|
|
222231
|
+
super();
|
|
222232
|
+
}
|
|
221918
222233
|
/** At fractional position on the x axis, return the (normalized) curvature fraction. */
|
|
221919
222234
|
fractionToCurvatureFraction(u) {
|
|
221920
222235
|
return u * u * (3 - 2 * u);
|
|
@@ -221953,17 +222268,17 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
|
|
|
221953
222268
|
}
|
|
221954
222269
|
/**
|
|
221955
222270
|
* At fractional position on the x axis, return the (normalized) curvature fraction.
|
|
221956
|
-
* * For [u <= 0.5, u
|
|
221957
|
-
* * f(u) = [
|
|
221958
|
-
* * f'(u) = [
|
|
221959
|
-
* * If(u) = [
|
|
222271
|
+
* * For [u <= 0.5, u > 0.5]
|
|
222272
|
+
* * f(u) = [2u^2, 1 - 2(1-u)^2]
|
|
222273
|
+
* * f'(u) = [4u, 4(1-u)]
|
|
222274
|
+
* * If(u) = [2u^3 / 3, u + 2(1-u)^3 /3]
|
|
221960
222275
|
*/
|
|
221961
222276
|
fractionToCurvatureFraction(u) {
|
|
221962
222277
|
return u <= 0.5 ? this.basis(u) : 1.0 - this.basis(1.0 - u);
|
|
221963
222278
|
}
|
|
221964
222279
|
/** Return the derivative of the (normalized) curvature fraction. */
|
|
221965
222280
|
fractionToCurvatureFractionDerivative(u) {
|
|
221966
|
-
return u
|
|
222281
|
+
return u <= 0.5 ? this.basisDerivative(u) : this.basisDerivative(1 - u);
|
|
221967
222282
|
}
|
|
221968
222283
|
/**
|
|
221969
222284
|
* Return the integrated area under the curve.
|
|
@@ -221972,6 +222287,7 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
|
|
|
221972
222287
|
fractionToArea(u) {
|
|
221973
222288
|
if (u <= 0.5)
|
|
221974
222289
|
return this.integratedBasis(u);
|
|
222290
|
+
// 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"
|
|
221975
222291
|
const v = 1 - u;
|
|
221976
222292
|
return 0.5 - v + this.integratedBasis(v);
|
|
221977
222293
|
}
|
|
@@ -221984,7 +222300,13 @@ class NormalizedBiQuadraticTransition extends NormalizedTransition {
|
|
|
221984
222300
|
* @internal
|
|
221985
222301
|
*/
|
|
221986
222302
|
class NormalizedSineTransition extends NormalizedTransition {
|
|
221987
|
-
|
|
222303
|
+
// sine transition curvature is x - sin(2 pi x) / (2 pi)
|
|
222304
|
+
// derivative 1 - cos(2 pi x)
|
|
222305
|
+
// integral x^2 / 2 + (cos(2 pi x) - 1) / (4 pi^2)
|
|
222306
|
+
// note: this is the only snap function whose antiderivative is chosen with nonzero integration constant.
|
|
222307
|
+
constructor() {
|
|
222308
|
+
super();
|
|
222309
|
+
}
|
|
221988
222310
|
/** At fractional position on the x axis, return the (normalized) curvature fraction. */
|
|
221989
222311
|
fractionToCurvatureFraction(u) {
|
|
221990
222312
|
const a = 2.0 * Math.PI;
|
|
@@ -222010,7 +222332,12 @@ class NormalizedSineTransition extends NormalizedTransition {
|
|
|
222010
222332
|
* @internal
|
|
222011
222333
|
*/
|
|
222012
222334
|
class NormalizedCosineTransition extends NormalizedTransition {
|
|
222013
|
-
|
|
222335
|
+
// cosine transition curvature is 0.5 (1 - cos(pi x))
|
|
222336
|
+
// derivative 0.5 pi sin(pi x)
|
|
222337
|
+
// integral 0.5 (x - sin(pi x) / pi)
|
|
222338
|
+
constructor() {
|
|
222339
|
+
super();
|
|
222340
|
+
}
|
|
222014
222341
|
/** At fractional position on the x axis, return the (normalized) curvature fraction. */
|
|
222015
222342
|
fractionToCurvatureFraction(u) {
|
|
222016
222343
|
const a = Math.PI;
|
|
@@ -222196,6 +222523,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222196
222523
|
* determines the remaining one.
|
|
222197
222524
|
* @public
|
|
222198
222525
|
*/
|
|
222526
|
+
// see internaldocs/Spiral.md for more info
|
|
222199
222527
|
class TransitionConditionalProperties {
|
|
222200
222528
|
/**
|
|
222201
222529
|
* Radius at start (radius of the osculating circle at the spiral segment's start).
|
|
@@ -222391,6 +222719,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
222391
222719
|
* * This is not necessary for integrated spirals.
|
|
222392
222720
|
* @public
|
|
222393
222721
|
*/
|
|
222722
|
+
// see internaldocs/Spiral.md for more info
|
|
222394
222723
|
class TransitionSpiral3d extends _CurvePrimitive__WEBPACK_IMPORTED_MODULE_0__.CurvePrimitive {
|
|
222395
222724
|
/** String name of spiral type. */
|
|
222396
222725
|
_spiralType;
|
|
@@ -242490,8 +242819,7 @@ class Ray3d {
|
|
|
242490
242819
|
return this.origin.isAlmostEqual(other.origin, tolerance) && this.direction.isAlmostEqual(other.direction, tolerance);
|
|
242491
242820
|
}
|
|
242492
242821
|
/**
|
|
242493
|
-
* Return the dot product of the ray's direction vector with a vector from the ray origin
|
|
242494
|
-
* to the `spacePoint`.
|
|
242822
|
+
* Return the dot product of the ray's direction vector with a vector from the ray origin to the `spacePoint`.
|
|
242495
242823
|
* * If the instance is the unit normal of a plane, then this method returns the (signed) altitude
|
|
242496
242824
|
* of `spacePoint` with respect to the plane.
|
|
242497
242825
|
* * Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/ProjectVectorOnPlane
|
|
@@ -249475,7 +249803,7 @@ class NewtonEvaluatorRtoRD {
|
|
|
249475
249803
|
/**
|
|
249476
249804
|
* Newton iterator for use when both function and derivative can be evaluated.
|
|
249477
249805
|
* To solve `f(x) = 0`, the Newton iteration is `x_{n+1} = x_n - dx = x_n - f(x_n)/f'(x_n)`.
|
|
249478
|
-
* To solve `f(x) = target` which is equivalent to solving
|
|
249806
|
+
* To solve `f(x) = target` which is equivalent to solving `g(x) = f(x) - target = 0`, the Newton iteration is
|
|
249479
249807
|
* `x_{n+1} = x_n - dx = x_n - g(x_n)/g'(x_n) = x_n - (f(x_n)-target)/f'(x_n)`.
|
|
249480
249808
|
* @internal
|
|
249481
249809
|
*/
|
|
@@ -306484,7 +306812,25 @@ class Formatter {
|
|
|
306484
306812
|
return { componentText: "", isNegative: false };
|
|
306485
306813
|
}
|
|
306486
306814
|
if (i < (spec.format.units?.length ?? 0) - 1) {
|
|
306487
|
-
|
|
306815
|
+
let wholePart = Math.trunc(unitValue);
|
|
306816
|
+
// Check if the remaining fractional part will round up to a full unit in the next (smaller) component
|
|
306817
|
+
if (spec.format.type === _FormatEnums__WEBPACK_IMPORTED_MODULE_2__.FormatType.Fractional && i === spec.unitConversions.length - 2) {
|
|
306818
|
+
// For the second-to-last unit with fractional formatting, check if rounding causes carry-over
|
|
306819
|
+
const fractionalPart = unitValue - wholePart;
|
|
306820
|
+
const nextUnitValue = (0,_Quantity__WEBPACK_IMPORTED_MODULE_3__.applyConversion)(fractionalPart, spec.unitConversions[i + 1].conversion);
|
|
306821
|
+
// Create a FractionalNumeric to determine what the rounded value would be
|
|
306822
|
+
const fn = new FractionalNumeric(Math.abs(nextUnitValue), spec.format.precision, true);
|
|
306823
|
+
// If the fractional numeric rounds to a whole unit (integral part increased due to rounding)
|
|
306824
|
+
// and the next unit value would round to equal the conversion factor, we need to carry it over
|
|
306825
|
+
const roundedNextValue = parseFloat(fn.getIntegralString());
|
|
306826
|
+
const expectedNextValue = Math.floor(Math.abs(nextUnitValue));
|
|
306827
|
+
// Check if rounding caused the value to reach the conversion factor (1 full unit of the parent)
|
|
306828
|
+
const conversionFactor = spec.unitConversions[i + 1].conversion.factor;
|
|
306829
|
+
if (roundedNextValue > expectedNextValue && Math.abs(roundedNextValue - conversionFactor) < this.FPV_MINTHRESHOLD) {
|
|
306830
|
+
// The rounding caused a carry-over to a full parent unit, add 1 to the current unit's whole part
|
|
306831
|
+
wholePart += (unitValue >= 0 ? 1 : -1);
|
|
306832
|
+
}
|
|
306833
|
+
}
|
|
306488
306834
|
const componentText = Formatter.formatCompositePart(Math.abs(wholePart), false, currentLabel, spec);
|
|
306489
306835
|
remainingMagnitude = unitValue - wholePart;
|
|
306490
306836
|
compositeStrings.push(componentText);
|
|
@@ -321911,7 +322257,7 @@ var loadLanguages = instance.loadLanguages;
|
|
|
321911
322257
|
/***/ ((module) => {
|
|
321912
322258
|
|
|
321913
322259
|
"use strict";
|
|
321914
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.
|
|
322260
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@itwin/core-frontend","version":"5.5.0-dev.2","description":"iTwin.js frontend components","main":"lib/cjs/core-frontend.js","module":"lib/esm/core-frontend.js","typings":"lib/cjs/core-frontend","license":"MIT","scripts":{"build":"npm run -s copy:public && npm run -s build:cjs && npm run -s build:esm && npm run -s webpackWorkers && npm run -s copy:workers && npm run -s copy:draco","build:cjs":"npm run -s copy:js:cjs && tsc 1>&2 --outDir lib/cjs","build:esm":"npm run -s copy:js:esm && tsc 1>&2 --module ES2022 --outDir lib/esm","clean":"rimraf -g lib .rush/temp/package-deps*.json","copy:public":"cpx \\"./src/public/**/*\\" ./lib/public","copy:js:cjs":"cpx \\"./src/**/*.js\\" ./lib/cjs","copy:js:esm":"cpx \\"./src/**/*.js\\" ./lib/esm","copy:workers":"cpx \\"./lib/workers/webpack/parse-imdl-worker.js\\" ./lib/public/scripts","copy:draco":"cpx \\"./node_modules/@loaders.gl/draco/dist/libs/*\\" ./lib/public/scripts","docs":"betools docs --json=../../generated-docs/core/core-frontend/file.json --tsIndexFile=./core-frontend.ts --onlyJson --excludes=webgl/**/*,**/map/*.d.ts,**/tile/*.d.ts,**/*-css.ts","extract-api":"betools extract-api --entry=core-frontend && npm run extract-extension-api","extract-extension-api":"eslint --no-inline-config -c extraction.eslint.config.js \\"./src/**/*.ts\\" 1>&2","lint":"eslint \\"./src/**/*.ts\\" 1>&2","lint-fix":"eslint --fix -f visualstudio \\"./src/**/*.ts\\" 1>&2","lint-deprecation":"eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \\"./src/**/*.ts\\"","pseudolocalize":"betools pseudolocalize --englishDir ./src/public/locales/en --out ./public/locales/en-PSEUDO","test":"npm run webpackTestWorker && vitest --run","cover":"npm run webpackTestWorker && vitest --run","webpackTests":"webpack --config ./src/test/utils/webpack.config.js 1>&2 && npm run -s webpackTestWorker","webpackTestWorker":"webpack --config ./src/test/worker/webpack.config.js 1>&2 && cpx \\"./lib/test/test-worker.js\\" ./lib/test","webpackWorkers":"webpack --config ./src/workers/ImdlParser/webpack.config.js 1>&2"},"repository":{"type":"git","url":"https://github.com/iTwin/itwinjs-core.git","directory":"core/frontend"},"keywords":["Bentley","BIM","iModel","digital-twin","iTwin"],"author":{"name":"Bentley Systems, Inc.","url":"http://www.bentley.com"},"peerDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*"},"//devDependencies":["NOTE: All peerDependencies should also be listed as devDependencies since peerDependencies are not considered by npm install","NOTE: All tools used by scripts in this package must be listed as devDependencies"],"devDependencies":{"@itwin/appui-abstract":"workspace:*","@itwin/build-tools":"workspace:*","@itwin/core-bentley":"workspace:*","@itwin/core-common":"workspace:*","@itwin/core-geometry":"workspace:*","@itwin/core-orbitgt":"workspace:*","@itwin/core-quantity":"workspace:*","@itwin/ecschema-metadata":"workspace:*","@itwin/ecschema-rpcinterface-common":"workspace:*","@itwin/object-storage-core":"^3.0.4","@itwin/eslint-plugin":"5.2.2-dev.2","@types/chai-as-promised":"^7","@types/draco3d":"^1.4.10","@types/sinon":"^17.0.2","@vitest/browser":"^3.0.6","@vitest/coverage-v8":"^3.0.6","cpx2":"^8.0.0","eslint":"^9.31.0","glob":"^10.5.0","playwright":"~1.56.1","rimraf":"^6.0.1","sinon":"^17.0.2","source-map-loader":"^5.0.0","typescript":"~5.6.2","typemoq":"^2.1.0","vitest":"^3.0.6","vite-multiple-assets":"^1.3.1","vite-plugin-static-copy":"2.2.0","webpack":"^5.97.1"},"//dependencies":["NOTE: these dependencies should be only for things that DO NOT APPEAR IN THE API","NOTE: core-frontend should remain UI technology agnostic, so no react/angular dependencies are allowed"],"dependencies":{"@itwin/core-i18n":"workspace:*","@itwin/webgl-compatibility":"workspace:*","@loaders.gl/core":"^4.3.4","@loaders.gl/draco":"^4.3.4","fuse.js":"^3.3.0","wms-capabilities":"0.4.0"}}');
|
|
321915
322261
|
|
|
321916
322262
|
/***/ })
|
|
321917
322263
|
|