@itwin/core-frontend
Version:
iTwin.js frontend components
81 lines • 5.08 kB
TypeScript
/** @packageDocumentation
* @module IModelConnection
*/
import { BeEvent, Id64String } from "@itwin/core-bentley";
import { EditingScopeNotifications, ElementGeometryChange, ModelGeometryChanges, ModelGeometryChangesProps } from "@itwin/core-common";
import { BriefcaseNotificationHandler } from "./BriefcaseTxns";
import { BriefcaseConnection } from "./BriefcaseConnection";
/** Represents a period of time within an [interactive editing]($docs/learning/InteractiveEditing.md) session during which the
* geometry of elements being displayed in one or more [[Viewport]]s is being modified. Outside of such a scope, whenever the
* geometry within a [GeometricModel]($backend) changes new [[Tile]]s must be generated to reflect those changes in a viewport.
* Regenerating entire tiles each time individual elements change can be time-consuming, which may introduce an unacceptable delay
* between making a modification and seeing its result on the screen.
*
* Within the context of a graphical editing scope, no new tiles are generated. Instead, the geometry for any deleted or modified elements
* is hidden in the tile graphics, and additional temporary graphics are displayed for any newly-inserted or modified elements. Only when the
* scope exits are new tiles produced.
*
* The application decides when to enter and exit a graphical editing scope. A single interactive editing session may involve any number of
* editing scopes. Typically, applications will enter a new editing scope (after first exiting a previous scope, if one exists):
* - When switching from a non-graphical workflow to one that involves editing geometry; or
* - When changing which geometric model is being edited; or
* - After performing an operation that creates or modifies a "large" number (perhaps hundreds?) of elements.
*
* An application should typically exit any graphical editing scope before:
* - Pulling changesets; or
* - Switching from a graphical editing workflow to some non-graphical workflow.
*
* Graphical editing scopes are only supported for [[BriefcaseConnection]]s opened in read-write mode that contain version 1.0.11 or newer of the BisCore schema.
* @see [[BriefcaseConnection.enterEditingScope]] to create a scope for a briefcase.
* @see [[BriefcaseConnection.editingScope]] to obtain a briefcase's current scope.
* @see [[exit]] to terminate a scope.
* @public
*/
export declare class GraphicalEditingScope extends BriefcaseNotificationHandler implements EditingScopeNotifications {
get briefcaseChannelName(): "itwinjs-core/editing-scope";
/** Maps model Id to accumulated changes to geometric elements within the associated model. */
private readonly _geometryChanges;
private _disposed;
private _cleanup?;
/** The connection to the iModel being edited. */
readonly iModel: BriefcaseConnection;
/** Event raised when a new scope is created for any [[BriefcaseConnection]].
* @see [[onExiting]] and [[onExited]] for complementary events.
*/
static readonly onEnter: BeEvent<(scope: GraphicalEditingScope) => void>;
/** Event raised when this scope is about to exit.
* @see [[onEnter]] for the complementary event.
* @see [[onExited]] for an event raised after the scope exits.
*/
readonly onExiting: BeEvent<(scope: GraphicalEditingScope) => void>;
/** Event raised when this scope has exited.
* @see [[onEnter]] for the complementary event.
* @see [[onExiting]] for an event raised just before the scope is exited.
*/
readonly onExited: BeEvent<(scope: GraphicalEditingScope) => void>;
/** Event raised after geometric changes are written to the iModel. */
readonly onGeometryChanges: BeEvent<(changes: Iterable<ModelGeometryChanges>, scope: GraphicalEditingScope) => void>;
/** Don't call this directly - use BriefcaseConnection.enterEditingScope.
* @internal
*/
static enter(imodel: BriefcaseConnection): Promise<GraphicalEditingScope>;
/** Exits this editing scope. The associated [[BriefcaseConnection]]'s `editingScope` will be reset to `undefined`.
* @throws Error if the scope could not be exited, e.g., if it has already been exited.
* @see [[BriefcaseConnection.enterEditingScope]] to enter an editing scope.
*/
exit(): Promise<void>;
/** Obtain all geometric changes to elements within the specified model accumulated within this scope. */
getGeometryChangesForModel(modelId: Id64String): Iterable<ElementGeometryChange> | undefined;
/** Obtain all geometric changes to models accumulated within this scope. */
getGeometryChanges(): Iterable<ModelGeometryChanges>;
/** @internal */
get isDisposed(): boolean;
private geometryChangeIterator;
private constructor();
private [Symbol.dispose];
/** @deprecated in 5.0 - will not be removed until after 2026-06-13. Use [Symbol.dispose] instead. */
dispose(): void;
/** @internal */
notifyGeometryChanged(props: ModelGeometryChangesProps[]): void;
}
//# sourceMappingURL=GraphicalEditingScope.d.ts.map