UNPKG

@itwin/measure-tools-react

Version:
62 lines 3.05 kB
import type { DecorateContext, HitDetail } from "@itwin/core-frontend"; import type { GeometryStreamProps } from "@itwin/core-common"; import { BeUiEvent } from "@itwin/core-bentley"; import type { Measurement } from "./Measurement.js"; /** Base class for any ToolModel that creates Measurements. * It is templated so that all functions return the correct measurement subclass. */ export declare abstract class MeasurementToolModel<T extends Measurement> { private _measurements; private _redoStack; private _ignoreMeasurementsRemoved; private _initialized; /** When true, new measurements will be added/removed from the selection set */ synchMeasurementsWithSelectionSet: boolean; /** Event when a new dynamic measurement is created. */ readonly onNewMeasurement: BeUiEvent<Measurement>; /** Event when the dynamic measurement has changed. */ readonly onDynamicMeasurementChanged: BeUiEvent<Measurement>; constructor(); /** Returns the dynamic measurement or undefined. */ get dynamicMeasurement(): T | undefined; /** Resets the toolModel to its initial state, optionally clearing measurements. */ reset(clearMeasurements: boolean): void; /** Returns all the measurements. */ get measurements(): ReadonlyArray<T>; /** Returns a reference to the measurements array of this toolModel. */ get measurementsRef(): T[]; /** Gets if the model has been initialized */ get isInitialized(): boolean; /** Returns true if undo is possible. */ get canUndo(): boolean; /** Returns true if redo is possible. */ get canRedo(): boolean; /** Undo (deletes) the last measurement. * * NOTE: ignores the current state of the ToolModel */ undoMeasurement(): boolean; /** Redo the (previously undone) measurement. * * NOTE: ignores the current state of the ToolModel */ redoMeasurement(): boolean; protected addMeasurementAndReset(...measurement: T[]): void; initialize(): void; cleanup(): void; private handleMeasurementRemoved; protected notifyNewMeasurement(): void; protected notifyDynamicMeasurementChanged(): void; /** Performs any final logic to ensure measurements are valid after a tool commits them. The current list of measurements are cleared. */ persistMeasurements(): boolean; /** Clears the completed measurement this tool owns. */ clearMeasurements(viewType?: string): void; /** Returns true if the supplied `id` belong to one of the measurements. */ testDecorationHit(id: string): boolean; /** Return snappable geometry for the hit measurement, or undefined. */ getDecorationGeometry(hit: HitDetail): GeometryStreamProps | undefined; /** Returns the tooltip of the located measurement. */ getToolTip(hit: HitDetail): Promise<HTMLElement | string>; /** Decorate the measurements in the provided viewport. */ decorate(context: DecorateContext): void; private removeMeasurementsFromManager; } //# sourceMappingURL=MeasurementToolModel.d.ts.map