@itwin/measure-tools-react
Version:
Frontend framework and tools for measurements
122 lines • 5.52 kB
TypeScript
import type { Id64String } from "@itwin/core-bentley";
import type { XYZProps } from "@itwin/core-geometry";
import { Point3d } from "@itwin/core-geometry";
import type { CartographicProps, GeometryStreamProps } from "@itwin/core-common";
import { Cartographic } 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 { MeasurementFormattingProps, MeasurementProps } from "../api/MeasurementProps.js";
/**
* Props for serializing a [[LocationMeasurement]].
*/
export interface LocationMeasurementProps extends MeasurementProps {
location: XYZProps;
geoLocation?: CartographicProps;
slope?: number;
station?: number;
offset?: number;
formatting?: LocationMeasurementFormattingProps;
}
/** Formatting properties for location measurement. */
export interface LocationMeasurementFormattingProps {
/** Defaults to "AecUnits.LENGTH" and "Units.M" */
length?: MeasurementFormattingProps;
/** Defaults to "RoadRailUnits.STATION" and "Units.M" */
station?: MeasurementFormattingProps;
/** Defaults to "AecUnits.ANGLE" and "Units.RAD" */
angle?: MeasurementFormattingProps;
}
/** Serializer for a [[LocationMeasurement]]. */
export declare class LocationMeasurementSerializer extends MeasurementSerializer {
static readonly locationMeasurementName = "locationMeasurement";
get measurementName(): string;
isValidType(measurement: Measurement): boolean;
isValidJSON(json: any): boolean;
protected parseSingle(data: MeasurementProps): Measurement | undefined;
}
/**
* Location measurement. A point somewhere in the world, optionally with other values (such as slope, station, offset, etc).
*/
export declare class LocationMeasurement extends Measurement {
static readonly serializer: MeasurementSerializer | undefined;
private _location;
private _geoLocation?;
private _slope?;
private _station?;
private _offset?;
private _textMarker?;
private _isDynamic;
private _lengthKoQ;
private _lengthPersistenceUnitName;
private _stationKoQ;
private _stationPersistenceUnitName;
private _angleKoQ;
private _anglePersistenceUnitName;
get location(): Point3d;
set location(pt: Point3d);
get geoLocation(): Cartographic | undefined;
set geoLocation(geoLoc: Cartographic | undefined);
get slope(): number | undefined;
set slope(slope: number | undefined);
get station(): number | undefined;
set station(station: number | undefined);
get offset(): number | undefined;
set offset(offset: number | undefined);
get isDynamic(): boolean;
set isDynamic(v: boolean);
get lengthKoQ(): string;
set lengthKoQ(value: string);
get lengthPersistenceUnitName(): string;
set lengthPersistenceUnitName(value: string);
get stationKoQ(): string;
set stationKoQ(value: string);
get stationPersistenceUnitName(): string;
set stationPersistenceUnitName(value: string);
get angleKoQ(): string;
set angleKoQ(value: string);
get anglePersistenceUnitName(): string;
set anglePersistenceUnitName(value: string);
constructor(props?: LocationMeasurementProps);
/** Changes the location. Only possible if the measurement is dynamic. */
changeLocation(props: LocationMeasurementProps): boolean;
testDecorationHit(pickContext: MeasurementPickContext): boolean;
getDecorationGeometry(_pickContext: MeasurementPickContext): GeometryStreamProps | undefined;
getDecorationToolTip(_pickContext: MeasurementPickContext): Promise<HTMLElement | string>;
private getSnapId;
protected onTransientIdChanged(_prevId: Id64String): void;
populateFormattingSpecsRegistry(_force?: boolean): Promise<void>;
decorate(context: DecorateContext): void;
private createTextMarker;
protected getDataForMeasurementWidgetInternal(): Promise<MeasurementWidgetData | undefined>;
private handleTextMarkerButtonEvent;
protected onStyleChanged(_isLock: boolean, _prevStyle: string): void;
protected onLockToggled(): void;
onDisplayUnitsChanged(): void;
private updateMarkerStyle;
/**
* 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(location: Point3d, viewType?: string, formatting?: LocationMeasurementFormattingProps): LocationMeasurement;
static fromJSON(props: LocationMeasurementProps): LocationMeasurement;
}
//# sourceMappingURL=LocationMeasurement.d.ts.map