@itwin/measure-tools-react
Version:
Frontend framework and tools for measurements
94 lines • 4.22 kB
TypeScript
import type { Id64String } from "@itwin/core-bentley";
import type { XYAndZ, XYZProps } from "@itwin/core-geometry";
import { Point3d } from "@itwin/core-geometry";
import type { GeometryStreamProps } from "@itwin/core-common";
import type { DecorateContext } from "@itwin/core-frontend";
import type { MeasurementEqualityOptions, MeasurementWidgetData } from "../api/Measurement.js";
import { Measurement, MeasurementPickContext, MeasurementSerializer } from "../api/Measurement.js";
import type { MeasurementProps } from "../api/MeasurementProps.js";
/**
* Props for serializing a [[DistanceMeasurement]].
*/
export interface DistanceMeasurementProps extends MeasurementProps {
startPoint: XYZProps;
endPoint: XYZProps;
showAxes?: boolean;
}
/** Serializer for a [[DistanceMeasurement]]. */
export declare class DistanceMeasurementSerializer extends MeasurementSerializer {
static readonly distanceMeasurementName = "distanceMeasurement";
get measurementName(): string;
isValidType(measurement: Measurement): boolean;
isValidJSON(json: any): boolean;
protected parseSingle(data: MeasurementProps): Measurement | undefined;
}
/**
* Distance measurement. Composed of a line and a formatted distance in a "text pill" in the middle of the line.
*/
export declare class DistanceMeasurement extends Measurement {
static readonly serializer: MeasurementSerializer | undefined;
private _startPoint;
private _endPoint;
private _showAxes;
private _isDynamic;
private _textMarker?;
private _runRiseAxes;
private _textStyleOverride?;
private _graphicStyleOverride?;
get startPointRef(): Point3d;
get endPointRef(): Point3d;
get isDynamic(): boolean;
set isDynamic(v: boolean);
get showAxes(): boolean;
set showAxes(v: boolean);
private get isAxis();
constructor(props?: DistanceMeasurementProps);
setStartPoint(point: XYAndZ): void;
setEndPoint(point: XYAndZ): void;
setStartEndPoints(start: XYAndZ, end: XYAndZ): void;
private setupAxis;
testDecorationHit(pickContext: MeasurementPickContext): boolean;
getDecorationGeometry(pickContext: MeasurementPickContext): GeometryStreamProps | undefined;
getDecorationToolTip(_pickContext: MeasurementPickContext): Promise<HTMLElement | string>;
private getSnapId;
protected onTransientIdChanged(_prevId: Id64String): void;
decorate(context: DecorateContext): void;
/** Clamps the segment to the current view frustum and return its midpoint.
* @remarks Returns undefined if the segment is entirely 'behind' the camera eye
*/
private calculateWorldTextLocation;
private buildRunRiseAxes;
protected onStyleChanged(_isLock: boolean, _prevStyle: string): void;
protected onLockToggled(): void;
protected onDisplayLabelsToggled(): void;
onDisplayUnitsChanged(): void;
private updateMarkerStyle;
private createTextMarker;
private handleTextMarkerButtonEvent;
protected getDataForMeasurementWidgetInternal(): Promise<MeasurementWidgetData>;
/**
* Tests equality with another measurement.
* @param other Measurement to test equality for.
* @param opts Options for equality testing.
* @returns true if the other measurement is equal, false if some property is not the same or if the measurement is not of the same type.
*/
equals(other: Measurement, opts?: MeasurementEqualityOptions): boolean;
/**
* Copies data from the other measurement into this instance.
* @param other Measurement to copy property values from.
*/
protected copyFrom(other: Measurement): void;
/**
* Deserializes properties (if they exist) from the JSON object.
* @param json JSON object to read data from.
*/
protected readFromJSON(json: MeasurementProps): void;
/**
* Serializes properties to a JSON object.
* @param json JSON object to append data to.
*/
protected writeToJSON(json: MeasurementProps): void;
static create(start: Point3d, end: Point3d, viewType?: string): DistanceMeasurement;
static fromJSON(data: DistanceMeasurementProps): DistanceMeasurement;
}
//# sourceMappingURL=DistanceMeasurement.d.ts.map