UNPKG

@itwin/measure-tools-react

Version:
76 lines 3.63 kB
import type { Id64Arg, Id64String } from "@itwin/core-bentley"; import { BeUiEvent } from "@itwin/core-bentley"; import type { IModelConnection } from "@itwin/core-frontend"; import { SelectionSetEventType } from "@itwin/core-frontend"; import { Measurement } from "./Measurement.js"; export interface MeasurementSelectAddEvent { type: SelectionSetEventType.Add; added: ReadonlyArray<Measurement>; set: MeasurementSelectionSet; } export interface MeasurementSelectRemoveEvent { type: SelectionSetEventType.Remove | SelectionSetEventType.Clear; removed: ReadonlyArray<Measurement>; set: MeasurementSelectionSet; } export interface MeasurementSelectReplaceEvent { type: SelectionSetEventType.Replace; added: ReadonlyArray<Measurement>; removed: ReadonlyArray<Measurement>; set: MeasurementSelectionSet; } export type MeasurementSelectionSetEvent = MeasurementSelectAddEvent | MeasurementSelectRemoveEvent | MeasurementSelectReplaceEvent; /** * A selection set for measurements. Element selection sets are per imodel (generally just a single imodel opened) and are only ID sets, so this * is intended to extend the Selection Sets by caching the actual measurements and is kept in sync with the target imodel's selection. */ export declare class MeasurementSelectionSet { private static _global; private _doNotModifySS; private _ignoreSSEvent; private _imodel?; private _selectedMeasurements; private _idToIndexMap; readonly onChanged: BeUiEvent<MeasurementSelectionSetEvent>; /** * Gets the "Global" measurement selection set. Measurements do not belong to one single imodel and are transient elements that only exist on the frontend, so we do not have * a selection set per imodel. Measurement transient ID's should be taken from the imodel that the global selection set is bound to. * As IModels open and close the global selection tries to bind itself to any opened imodel. */ static get global(): MeasurementSelectionSet; /** * Gets the next transient ID from the current imodel. If undefined then there is no imodel. */ static get nextTransientId(): Id64String | undefined; /** Gets the imodel that corresponds to this selection set. */ get imodel(): IModelConnection | undefined; /** Gets of all the currently selected measurements. This allocates a new array with each measurement. Use the iterator if you wish to iterate over the selected measurements and not create array copies. */ get measurements(): Measurement[]; /** Gets the number of selected measurements. */ get size(): number; private constructor(); [Symbol.iterator](): Generator<Measurement, void, unknown>; getArray(idArg: Id64Arg): Measurement[]; get(id: Id64String): Measurement | undefined; isSelected(id: Id64String): boolean; add(measurements: Measurement | Measurement[]): boolean; private addInAvailableSlotOrAppend; private addSingle; remove(measurements: Measurement | Measurement[]): boolean; private removeSingle; addAndRemove(add: Measurement | Measurement[], remove: Measurement | Measurement[]): boolean; clear(): void; private sendEvent; private handleSelectionSetChanged; private handleSelectionAdd; private handleSelectionRemoved; private handleSelectionReplaced; private startEvents; private getUiFameworkIModel; private onSyncEvent; private ensureActiveModel; private changeActiveIModel; private resetAllTransientIds; private synchronizeFromSelectionSet; } //# sourceMappingURL=MeasurementSelectionSet.d.ts.map