@itwin/core-frontend
Version:
iTwin.js frontend components
142 lines • 5.38 kB
TypeScript
/** @packageDocumentation
* @module LocatingElements
*/
import { Id64String } from "@itwin/core-bentley";
import { Point3d } from "@itwin/core-geometry";
import { HitDetail, HitList, HitSource } from "./HitDetail";
import { InputSource } from "./tools/Tool";
import { ScreenViewport, Viewport } from "./Viewport";
/** The possible actions for which a locate filter can be called.
* @public
* @extensions
*/
export declare enum LocateAction {
Identify = 0,
AutoLocate = 1
}
/** Values to return from a locate filter.
* Return `Reject` to indicate the element is unacceptable.
* @public
* @extensions
*/
export declare enum LocateFilterStatus {
Accept = 0,
Reject = 1
}
/**
* @public
* @extensions
*/
export declare enum SnapStatus {
Success = 0,
Aborted = 1,
NoElements = 2,
Disabled = 100,
NoSnapPossible = 200,
NotSnappable = 300,
FilteredByApp = 600,
FilteredByAppQuietly = 700
}
/** Options that customize the way element location (i.e. *picking*) works.
* @public
* @extensions
*/
export declare class LocateOptions {
/** If true, also test graphics from view decorations. */
allowDecorations: boolean;
/** If true, also test graphics with non-locatable flag set. */
allowNonLocatable: boolean;
/** Maximum number of hits to return. */
maxHits: number;
/** The [[HitSource]] identifying the caller. */
hitSource: HitSource;
/** If true, also test graphics from an IModelConnection other than the one associated with the Viewport. This can occur if, e.g., a
* [[TiledGraphicsProvider]] is used to display graphics from a different iModel into the [[Viewport]].
* @note If you override this, you must be prepared to properly handle [[HitDetail]]s originating from other IModelConnections.
* @see [[HitDetail.iModel]] and [[HitDetail.isExternalIModelHit]]
*/
allowExternalIModels: boolean;
/** If true, then the world point of a hit on a model will preserve any transforms applied to the model at display time,
* such as those supplied by a [[ModelDisplayTransformProvider]] or [PlanProjectionSettings.elevation]($common).
* Otherwise, the world point will be multiplied by the inverse of any such transforms to correlate it with the model's true coordinate space.
*/
preserveModelDisplayTransforms: boolean;
/** Make a copy of this LocateOptions. */
clone(): LocateOptions;
setFrom(other: LocateOptions): void;
init(): void;
}
/**
* @public
* @extensions
*/
export declare class LocateResponse {
snapStatus: SnapStatus;
reason?: string;
explanation: string;
/** @internal */
clone(): LocateResponse;
/** @internal */
setFrom(other: LocateResponse): void;
}
/**
* @public
* @extensions
*/
export interface HitListHolder {
setHitList(list: HitList<HitDetail> | undefined): void;
}
/**
* @public
* @extensions
*/
export declare class ElementPicker {
viewport?: Viewport;
readonly pickPointWorld: Point3d;
hitList?: HitList<HitDetail>;
empty(): void;
/** return the HitList for the last Pick performed. Optionally allows the caller to take ownership of the list. */
getHitList(takeOwnership: boolean): HitList<HitDetail>;
getNextHit(): HitDetail | undefined;
/** Return a hit from the list of hits created the last time pickElements was called. */
getHit(i: number): HitDetail | undefined;
resetCurrentHit(): void;
private comparePixel;
/** Generate a list of elements that are close to a given point.
* @param vp Viewport to use for pick
* @param pickPointWorld Pick location in world coordinates
* @param pickRadiusView Pick radius in pixels
* @param options Pick options to use
* @param excludedElements Optional ids to not draw during pick. Allows hits for geometry obscured by these ids to be returned.
* @returns The number of hits in the hitList of this object.
*/
doPick(vp: ScreenViewport, pickPointWorld: Point3d, pickRadiusView: number, options: LocateOptions, excludedElements?: Iterable<Id64String>): number;
testHit(hit: HitDetail, vp: ScreenViewport, pickPointWorld: Point3d, pickRadiusView: number, options: LocateOptions): boolean;
}
/**
* @public
* @extensions
*/
export declare class ElementLocateManager {
hitList?: HitList<HitDetail>;
currHit?: HitDetail;
readonly options: LocateOptions;
readonly picker: ElementPicker;
/** get the full message key for a locate failure */
static getFailureMessageKey(key: string): string;
onInitialized(): void;
get apertureInches(): number;
get touchApertureInches(): number;
clear(): void;
setHitList(list?: HitList<HitDetail>): void;
setCurrHit(hit?: HitDetail): void;
getNextHit(): HitDetail | undefined;
/** return the current path from either the snapping logic or the pre-locating systems. */
getPreLocatedHit(): HitDetail | undefined;
filterHit(hit: HitDetail, _action: LocateAction, out: LocateResponse): Promise<LocateFilterStatus>;
initLocateOptions(): void;
initToolLocate(): void;
private _doLocate;
doLocate(response: LocateResponse, newSearch: boolean, testPoint: Point3d, view: ScreenViewport | undefined, source: InputSource, filterHits?: boolean): Promise<HitDetail | undefined>;
}
//# sourceMappingURL=ElementLocateManager.d.ts.map