UNPKG

@itwin/core-common

Version:

iTwin.js components common to frontend and backend

108 lines 5.35 kB
/** @packageDocumentation * @module Geometry */ import { CompressedId64Set, DbOpcode, GuidString, Id64String } from "@itwin/core-bentley"; import { Range3d, Range3dProps } from "@itwin/core-geometry"; /** Compact wire format representing geometric changes to a set of elements as part of a [[ModelGeometryChangesProps]]. * All of the elements belong to the same model. * The number of [[ids]] and [[ranges]] are guaranteed to be the same. * @see [[ElementGeometryChange]] for a more useful representation of an individual element change. * @see [[ModelGeometryChanges.iterable]] to iterate over [[ElementGeometryChange]]s. * @public * @extensions */ export interface ElementIdsAndRangesProps { /** The Ids of the elements, compressed and sorted in ascending order. */ readonly ids: CompressedId64Set; /** The range of each element, indexed by the position of the corresponding element's Id in [[ids]]. */ readonly ranges: Range3dProps[]; } /** Compact wire format representing geometric changes to [GeometricElement]($backend)s within a [GeometricModel]($backend). * A given element Id will appear in no more than one of [[inserted]], [[updated]], or [[deleted]]. * @see [[ModelGeometryChanges]] for a more useful representation. * @public * @extensions */ export interface ModelGeometryChangesProps { /** The Id of the model. */ readonly id: Id64String; /** The range of the model, computed as the union of the ranges of all geometric elements within the model. */ readonly range: Range3dProps; /** The geometry GUID of the model. */ readonly guid: GuidString; /** If defined, the Ids and ranges of newly-inserted [GeometricElement]($backend)s. */ readonly inserted?: ElementIdsAndRangesProps; /** If defined, the Ids and ranges of [GeometricElement]($backend)s whose geometric properties were modified. */ readonly updated?: ElementIdsAndRangesProps; /** If defined, the Ids of deleted [GeometricElement]($backend)s. */ readonly deleted?: CompressedId64Set; } /** Represents the insertion of a new [GeometricElement]($backend), or a change to the geometric properties of an existing [GeometricElement]($backend). * @see [[ElementGeometryChange]]. * @public * @extensions */ export interface ExtantElementGeometryChange { /** Indicates whether this change resulted from the insertion of a new element or modification of an existing one. * Used as discriminant for [[ElementGeometryChange]] union. */ readonly type: DbOpcode.Insert | DbOpcode.Update; /** The element's Id. */ readonly id: Id64String; /** The element's range. */ readonly range: Range3d; } /** Represents the deletion of a [GeometricElement]($backend). * @see [[ElementGeometryChange]]. * @public * @extensions */ export interface DeletedElementGeometryChange { /** Discriminant for [[ElementGeometryChange]] union. */ readonly type: DbOpcode.Delete; /** The element's Id. */ readonly id: Id64String; } /** * @public * @extensions */ export type ElementGeometryChange = ExtantElementGeometryChange | DeletedElementGeometryChange; /** Represents a change to the geometry of a [GeometricElement]($backend), as exposed by [[ModelGeometryChanges.elements]]. * @public */ export declare namespace ElementGeometryChange { /** Obtain an iterator over the geometry changes for a single [GeometricModel]($backend). A given element will appear at most once. */ function iterator(modelChanges: ModelGeometryChangesProps): Iterator<ElementGeometryChange>; /** Obtain an iterable over the geometry changes for a single [GeometricModel]($backend). A given element will appear at most once. */ function iterable(modelChanges: ModelGeometryChangesProps): Iterable<ElementGeometryChange>; } /** Represents geometric changes to a set of [GeometricElement]($backend)s belonging to a single [GeometricModel]($backend). * @public * @extensions */ export interface ModelGeometryChanges { /** The model's Id. */ readonly id: Id64String; /** The model's geometry GUID. */ readonly geometryGuid: GuidString; /** The model's range. */ readonly range: Range3d; /** The individual geometric element changes. */ readonly elements: Iterable<ElementGeometryChange>; } /** Represents geometric changes to a set of [GeometricElement]($backend)s belonging to a single [GeometricModel]($backend). * @see [GraphicalEditingScope]($frontend) to monitor these changes. * @public */ export declare namespace ModelGeometryChanges { /** Obtain an iterator over the geometry changes for a set of models. A given model will appear at most once. */ function iterator(modelChanges: ModelGeometryChangesProps[]): Iterator<ModelGeometryChanges>; /** Obtain an iterable over the geometry changes for a set of models. A given model will appear at most once. */ function iterable(modelChanges: ModelGeometryChangesProps[]): Iterable<ModelGeometryChanges>; /** Instantiate from wire format. */ function fromJSON(props: ModelGeometryChangesProps): ModelGeometryChanges; /** Obtain the ModelGeometryChanges for the specified model Id. */ function findByModelId(changes: Iterable<ModelGeometryChanges>, modelId: Id64String): ModelGeometryChanges | undefined; } //# sourceMappingURL=ModelGeometryChanges.d.ts.map