import { PluginConfig, THREE } from "@x-viewer/core"; import { type BaseViewer, Plugin } from "@x-viewer/core"; import { BaseMeasureDrawable } from "./BaseMeasureDrawable"; import { MeasurementData, MeasurementType } from "./BaseMeasurement"; /** * Measurement plugin config. */ export type MeasurementPluginConfig = Partial; export declare class MeasurementPlugin extends Plugin { static readonly DEFAULT_ID = "MeasurementPlugin"; selectedDrawable: BaseMeasureDrawable | undefined; constructor(viewer: BaseViewer, cfg?: MeasurementPluginConfig); protected get canvas(): HTMLCanvasElement; protected get raycaster(): THREE.Raycaster; add(drawable: BaseMeasureDrawable, needFireEvent?: boolean): void; create(data: MeasurementData): BaseMeasureDrawable; remove(drawable: BaseMeasureDrawable, needFireEvent?: boolean): void; /** * Set osnap tolerance in pixcel size. The pixcel size will be converted to a size in world coordinate and pass to OSnapHelper. */ setSnapTolerance(toleranceInPixel: number): void; /** * Activates distance, area, or angle measurement according to `type`. * @param type Measurement mode to start. */ activate(type: MeasurementType): void; /** Deactivates the current measurement mode and restores selection settings. */ deactivate(): void; getActiveMeasurementType(): MeasurementType | undefined; /** * * @returns {boolean} * @description Is measure plugin active */ isActive(): boolean; /** * * @returns {boolean} Is measuring now */ isMeasuring(): boolean; /** Returns all persisted measurement records from the drawable list. */ getData(): MeasurementData[]; /** * Aborts the in-progress measurement stroke without leaving measurement mode (user can start again). */ cancel(): void; /** * Replaces measurements from serialized `MeasurementData` entries (undo-aware batch). * @param dataArray Records to materialize as drawables. */ setData(dataArray: MeasurementData[]): void; /** * Sets a measurement drawable's visibility by id. * @param id * @param visible * @returns * @description Sets a measurement's visibility. */ setVisibleById(id: string, visible: boolean): boolean; /** * Sets all measurement drawables' visibilities. */ setVisibilities(visible: boolean): void; /** Clears all measurement drawables after exiting any active draw. */ clear(): void; /** * Gets a measurement drawable by id. */ getById(id: string): BaseMeasureDrawable; removeById(id: string): void; /** * Selects a measurement drawable by id. * @param {string} id * @description Selects a measurement by id */ selectById(id: string): void; /** * Selects a measurement drawable. */ select(drawable: BaseMeasureDrawable): void; /** * * @param renderEnabled If need render measurement * @description Unselects a measurement. */ unselect(renderEnabled?: boolean): void; /** * Gets the scale value. * Scale is the ratio of real world value and the value in three.js(pdf, a map, etc.). * e.g., Real world distance is 1000, and the value in three.js is 1, then scale is 1000. * We should display 1000 rather than 1 while measuring. */ getScale(): number | undefined; /** * Sets the scale value. */ setScale(scale: number | undefined): void; /** * @description Destroy measure plugin */ destroy(): void; }