/** @packageDocumentation
 * @module LocatingElements
 */
import { Id64String } from "@itwin/core-bentley";
import { CurvePrimitive, Point3d, Transform, Vector3d, XYZProps } from "@itwin/core-geometry";
import { GeometryClass } from "@itwin/core-common";
import { IModelConnection } from "./IModelConnection";
import { Sprite } from "./Sprites";
import { DecorateContext } from "./ViewContext";
import { ScreenViewport, Viewport } from "./Viewport";
/**
 * @public
 * @extensions
 */
export declare enum SnapMode {
    Nearest = 1,
    NearestKeypoint = 2,
    MidPoint = 4,
    Center = 8,
    Origin = 16,
    Bisector = 32,
    Intersection = 64
}
/**
 * @public
 * @extensions
 */
export declare enum SnapHeat {
    None = 0,
    NotInRange = 1,// "of interest", but out of range
    InRange = 2
}
/** The procedure that generated this Hit.
 * @public
 * @extensions
 */
export declare enum HitSource {
    None = 0,
    FromUser = 1,
    MotionLocate = 2,
    AccuSnap = 3,
    TentativeSnap = 4,
    DataPoint = 5,
    Application = 6,
    EditAction = 7,
    EditActionSS = 8
}
/** What was being tested to generate this hit. This is not the element or
 * GeometricPrimitive that generated the Hit, it is an indication of whether it is an edge or interior hit.
 * @public
 * @extensions
 */
export declare enum HitGeomType {
    None = 0,
    Point = 1,
    Segment = 2,
    Curve = 3,
    Arc = 4,
    Surface = 5
}
/** Classification of GeometricPrimitive that generated the Hit.
 * @public
 * @extensions
 */
export declare enum HitParentGeomType {
    None = 0,
    Wire = 1,
    Sheet = 2,
    Solid = 3,
    Mesh = 4,
    Text = 5
}
/**
 * @public
 * @extensions
 */
export declare enum HitPriority {
    WireEdge = 0,
    PlanarEdge = 1,
    NonPlanarEdge = 2,
    SilhouetteEdge = 3,
    PlanarSurface = 4,
    NonPlanarSurface = 5,
    Unknown = 6
}
/**
 * @public
 * @extensions
 */
export declare enum HitDetailType {
    Hit = 1,
    Snap = 2,
    Intersection = 3
}
/** As part of a [[HitPath]], describes the [ViewAttachment]($backend), if any, from which the hit represented by a [[HitDetail]] originated.
 * @beta
 */
export interface ViewAttachmentHitInfo {
    /** The element Id of the [ViewAttachment]($backend) from which the hit originated. */
    readonly id: Id64String;
    /** The viewport that renders the contents of the attached view into the [[ScreenViewport]].
     * @note Do not alter the state of this viewport.
     * @alpha
     */
    readonly viewport: Viewport;
}
/** As part of a [[HitPath]], describes the [SectionDrawing]($backend), if any, from which the hit represented by a [[HitDetail]] originated.
 * @beta
 */
export interface SectionDrawingAttachmentHitInfo {
    /** The viewport that renders the contents of the attached view into the [[ScreenViewport]].
     * @note Do not alter the state of this viewport.
     * @alpha
     */
    readonly viewport: Viewport;
}
/** As part of a [[HitDetail]], describes a series of "attached" views through which the hit was located.
 * Typically, the contents of a view are rendered directly to the screen via [[HitDetail.viewport]].
 * However, in some contexts one view might be "attached" to the viewport's view via a [ViewAttachment]($backend), [SectionDrawing]($backend), or both.
 * HitPath captures this information in one of the following possible ways:
 * 1. A [[SheetViewState]] renders another view through a [ViewAttachment]($backend), in which case [[viewAttachment]] will be defined.
 * 2. A [[DrawingViewState]] renders a [[SpatialViewState]] through a [SectionDrawing]($backend) attachment, in which case [[sectionDrawingAttachment]] will be defined; or
 * 3. A combination of 1 and 2 where a [ViewAttachment]($backend) on a sheet renders a [SectionDrawing]($backend) with an attached [[SpatialViewState]], in which both [viewAttachment]] and [[sectionDrawingAttachment]] will be defined.
 * @beta
 */
export interface HitPath {
    /** Details about the [ViewAttachment]($backend) through which the hit was obtained. */
    viewAttachment?: ViewAttachmentHitInfo;
    /** Details about the [SectionDrawing]($backend) attachment through which the hit was obtained. */
    sectionDrawingAttachment?: SectionDrawingAttachmentHitInfo;
}
/** Arguments supplied to the [[HitDetail]] constructor.
 * @public
 */
export interface HitDetailProps {
    /** The point in world coordinates that was used as the initial locate point. */
    readonly testPoint: Point3d;
    /** The viewport in which the locate operation was performed. */
    readonly viewport: ScreenViewport;
    /** The procedure that requested the locate operation. */
    readonly hitSource: HitSource;
    /** The approximate location in world coordinates on the geometry identified by this HitDetail. */
    readonly hitPoint: Point3d;
    /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */
    readonly sourceId: Id64String;
    /** The hit geometry priority/classification. */
    readonly priority: HitPriority;
    /** The xy distance to the hit in view coordinates. */
    readonly distXY: number;
    /** The distance in view coordinates between the hit and the near plane. */
    readonly distFraction: number;
    /** The [SubCategory]($backend) to which the hit geometry belongs. */
    readonly subCategoryId?: Id64String;
    /** The class of the hit geometry. */
    readonly geometryClass?: GeometryClass;
    /** The Id of the [[ModelState]] from which the hit originated. */
    readonly modelId?: string;
    /** The IModelConnection from which the hit originated.
     * This should almost always be left undefined, unless the hit is known to have originated from an iModel
     * other than the one associated with the viewport.
     * @internal
     */
    readonly sourceIModel?: IModelConnection;
    /** @internal */
    readonly transformFromSourceIModel?: Transform;
    /** @internal chiefly for debugging */
    readonly tileId?: string;
    /** True if the hit originated from a reality model classifier.
     * @alpha
     */
    readonly isClassifier?: boolean;
    /** Describes the path by which the hit was located through a series of attached views.
     * @beta
     */
    readonly path?: HitPath;
}
/** A HitDetail stores the result when locating geometry displayed in a view.
 * It holds an approximate location on an element (or decoration) from a *pick*.
 * @public
 * @extensions
 */
export declare class HitDetail {
    private readonly _props;
    /** The point in world coordinates that was used as the initial locate point. */
    get testPoint(): Point3d;
    /** The viewport in which the locate operation was performed. */
    get viewport(): ScreenViewport;
    /** The procedure that requested the locate operation. */
    get hitSource(): HitSource;
    /** The approximate location in world coordinates on the geometry identified by this HitDetail. */
    get hitPoint(): Point3d;
    /** The source of the geometry. This may be a persistent element Id, or a transient Id used for, e.g., pickable decorations. */
    get sourceId(): Id64String;
    /** The hit geometry priority/classification. */
    get priority(): HitPriority;
    /** The xy distance to the hit in view coordinates. */
    get distXY(): number;
    /** The distance in view coordinates between the hit and the near plane. */
    get distFraction(): number;
    /** The [SubCategory]($backend) to which the hit geometry belongs. */
    get subCategoryId(): Id64String | undefined;
    /** The class of the hit geometry. */
    get geometryClass(): GeometryClass | undefined;
    /** The Id of the [[ModelState]] from which the hit originated. */
    get modelId(): string | undefined;
    /** The IModelConnection from which the hit originated.
     * This should almost always be left undefined, unless the hit is known to have originated from an iModel
     * other than the one associated with the viewport.
     * @internal
     */
    get sourceIModel(): IModelConnection | undefined;
    /** @internal */
    get transformFromSourceIModel(): Transform | undefined;
    /** @internal chiefly for debugging */
    get tileId(): string | undefined;
    /** True if the hit originated from a reality model classifier.
     * @alpha
     */
    get isClassifier(): boolean | undefined;
    /** Information about the [ViewAttachment]($backend) within which the hit geometry resides, if any.
     * @note Only [[SheetViewState]]s can have view attachments.
     * @beta
     */
    get viewAttachment(): ViewAttachmentHitInfo | undefined;
    /** Describes the path by which the hit was located through a series of attached views.
     * @beta
     */
    get path(): HitPath | undefined;
    /** Create a new HitDetail from the inputs to and results of a locate operation. */
    constructor(props: HitDetailProps);
    /** @deprecated in 4.1. Use the overload that takes a [[HitDetailProps]]. */
    constructor(testPoint: Point3d, viewport: ScreenViewport, hitSource: HitSource, hitPoint: Point3d, sourceId: string, priority: HitPriority, distXY: number, distFraction: number, subCategoryId?: string, geometryClass?: GeometryClass, modelId?: string, sourceIModel?: IModelConnection, tileId?: string, isClassifier?: boolean);
    /** Get the type of HitDetail.
     * @returns HitDetailType.Hit if this is a HitDetail, HitDetailType.Snap if it is a SnapDetail
     */
    getHitType(): HitDetailType;
    /** Get the *hit point* for this HitDetail. Returns the approximate point on the element that caused the hit when not a SnapDetail or IntersectDetail.
     * For a snap that is *hot*, the *exact* point on the Element for the snap mode is returned, otherwise the close point on the hit geometry is returned.
     */
    getPoint(): Point3d;
    /** Determine if this HitPoint is from the same source as another HitDetail. */
    isSameHit(otherHit?: HitDetail): boolean;
    /** Return whether sourceId is for a persistent element and not a pickable decoration. */
    get isElementHit(): boolean;
    get isModelHit(): boolean;
    get isMapHit(): boolean;
    /** Create a deep copy of this HitDetail */
    clone(): HitDetail;
    /** Draw this HitDetail as a Decoration. Causes the picked element to *flash* */
    draw(_context: DecorateContext): void;
    /** Get the tooltip content for this HitDetail. */
    getToolTip(): Promise<HTMLElement | string>;
    /** The IModelConnection from which the hit originated. In some cases this may not be the same as the iModel associated with the Viewport -
     * for example, if a [[TiledGraphicsProvider]] is used to display graphics from a different iModel in the viewport.
     * This HitDetail's element, subcategory, and model Ids are defined in the context of this IModelConnection.
     */
    get iModel(): IModelConnection;
    /** Returns true if this hit originated from an [[IModelConnection]] other than the one associated with the [[Viewport]].
     * @see [[iModel]].
     */
    get isExternalIModelHit(): boolean;
}
/** A SnapDetail is generated from the result of a snap request. In addition to the HitDetail about the reason the element was *picked*,
 * it holds the *exact* point on the element from the snapping logic, plus additional information that varies with the type of element and snap mode.
 * @public
 * @extensions
 */
export declare class SnapDetail extends HitDetail {
    snapMode: SnapMode;
    heat: SnapHeat;
    /** A sprite to show the user the type of snap performed */
    sprite?: Sprite;
    /** HitPoint adjusted by snap */
    readonly snapPoint: Point3d;
    /** AccuSnap/AccuDraw can adjust the point after the snap. */
    readonly adjustedPoint: Point3d;
    /** Curve primitive for snap. */
    primitive?: CurvePrimitive;
    /** Surface normal at snapPoint */
    normal?: Vector3d;
    /** The HitGeomType of this SnapDetail */
    geomType?: HitGeomType;
    /** The HitGeomType of this SnapDetail */
    parentGeomType?: HitParentGeomType;
    /** Constructor for SnapDetail.
     * @param from The HitDetail that created this snap
     * @param snapMode The SnapMode used to create this SnapDetail
     * @param heat The SnapHeat of this SnapDetail
     * @param snapPoint The snapped point in the element
     */
    constructor(from: HitDetail, snapMode?: SnapMode, heat?: SnapHeat, snapPoint?: XYZProps);
    /** Returns `HitDetailType.Snap` */
    getHitType(): HitDetailType;
    /** Get the snap point if this SnapDetail is *hot*, the pick point otherwise. */
    getPoint(): Point3d;
    /** Return true if the pick point was closer than the snap aperture from the generated snap point. */
    get isHot(): boolean;
    /** Determine whether the [[adjustedPoint]] is different than the [[snapPoint]]. This happens, for example, when points are adjusted for grids, acs plane snap, and AccuDraw. */
    get isPointAdjusted(): boolean;
    /** Change the snap point. */
    setSnapPoint(point: Point3d, heat: SnapHeat): void;
    /** Set curve primitive and HitGeometryType for this SnapDetail. */
    setCurvePrimitive(primitive?: CurvePrimitive, localToWorld?: Transform, geomType?: HitGeomType): void;
    /** Make a copy of this SnapDetail. */
    clone(): SnapDetail;
    getCurvePrimitive(singleSegment?: boolean): CurvePrimitive | undefined;
    draw(context: DecorateContext): void;
    private static getSnapSpriteUrl;
}
/**
 * @public
 * @extensions
 */
export declare class IntersectDetail extends SnapDetail {
    readonly otherPrimitive: CurvePrimitive;
    readonly otherId: string;
    constructor(from: SnapDetail, heat: SnapHeat | undefined, snapPoint: XYZProps, otherPrimitive: CurvePrimitive, otherId: string);
    draw(context: DecorateContext): void;
}
/** The result of a "locate" is a sorted list of objects that satisfied the search criteria (a HitList). Earlier hits in the list
 * are somehow *better* than those later on.
 * @public
 * @extensions
 */
export declare class HitList<T extends HitDetail> {
    hits: T[];
    currHit: number;
    get length(): number;
    empty(): void;
    resetCurrentHit(): void;
    /** Get a hit from a particular index into a HitList
     * return the requested hit from the HitList or undefined
     */
    getHit(hitNum: number): T | undefined;
    /** When setting one or more indices to undefined you must call dropNulls afterwards */
    setHit(i: number, p: T | undefined): void;
    dropNulls(): void;
    getNextHit(): T | undefined;
    getCurrentHit(): T | undefined;
    setCurrentHit(hit: T): void;
    /** remove the current hit from the list. */
    removeCurrentHit(): void;
    /** remove a hit in the list. */
    removeHit(hitNum: number): void;
    /** search through list and remove any hits that contain a specified element id. */
    removeHitsFrom(sourceId: string): boolean;
    private getPriorityZOverride;
    /** compare two hits for insertion into list. */
    compare(hit1: HitDetail | undefined, hit2: HitDetail | undefined): -1 | 1 | 0;
    /** Add a new hit to the list. Hits are sorted according to their priority and distance. */
    addHit(newHit: T): number;
    /** Insert a new hit into the list at the supplied index. */
    insertHit(i: number, hit: T): void;
}
//# sourceMappingURL=HitDetail.d.ts.map