/** @packageDocumentation
 * @module AccuDraw
 */
import { BentleyStatus } from "@itwin/core-bentley";
import { Matrix3d, Point3d, Ray3d, Transform, Vector3d } from "@itwin/core-geometry";
import { ColorDef, GeometryStreamProps } from "@itwin/core-common";
import { AuxCoordSystemState } from "./AuxCoordSys";
import { HitDetail, SnapDetail } from "./HitDetail";
import { StandardViewId } from "./StandardView";
import { BeButtonEvent } from "./tools/Tool";
import { DecorateContext } from "./ViewContext";
import { ScreenViewport, Viewport } from "./Viewport";
/** @internal */
export declare enum AccuDrawFlags {
    None = 0,
    SetModePolar = 1,
    SetModeRect = 2,
    SetOrigin = 4,
    FixedOrigin = 8,
    SetRMatrix = 16,
    SetXAxis = 32,
    SetNormal = 64,
    SetDistance = 128,
    LockDistance = 256,
    Lock_X = 512,
    Lock_Y = 1024,
    Lock_Z = 2048,
    Disable = 4096,
    OrientDefault = 16384,
    SetFocus = 32768,
    OrientACS = 131072,
    SetXAxis2 = 262144,
    LockAngle = 524288,
    AlwaysSetOrigin = 2097156,
    RedrawCompass = 4194304,
    UpdateRotation = 8388608,
    SmartRotation = 16777216
}
/** AccuDraw coordinate input mode
 * @public
 */
export declare enum CompassMode {
    /** Coordinate input using distance and angle */
    Polar = 0,
    /** Coordinate input using x, y, and z deltas */
    Rectangular = 1
}
/** AccuDraw compass base rotation
 * @public
 */
export declare enum RotationMode {
    /** Aligned with standard view top or ACS top when [[ToolAdmin.acsContextLock]] is enabled */
    Top = 1,
    /** Aligned with standard view front or ACS front when [[ToolAdmin.acsContextLock]] is enabled */
    Front = 2,
    /** Aligned with standard view right or ACS right when [[ToolAdmin.acsContextLock]] is enabled */
    Side = 3,
    /** Aligned with view */
    View = 4,
    /** Aligned with view ACS */
    ACS = 5,
    /** Not aligned with a standard rotation or ACS */
    Context = 6
}
/** @internal */
export declare enum LockedStates {
    NONE_LOCKED = 0,
    X_BM = 1,
    Y_BM = 2,
    VEC_BM = 4,
    DIST_BM = 8,
    XY_BM = 3,
    ANGLE_BM = 7
}
/** AccuDraw enabled states
 * @public
 */
export declare enum CurrentState {
    /** Compass disabled/unwanted for this session */
    NotEnabled = 0,
    /** Compass deactivated but CAN be activated by user */
    Deactivated = 1,
    /** Compass not displayed awaiting automatic activation (default tool state) */
    Inactive = 2,
    /** Compass displayed and adjusting points */
    Active = 3
}
/** @internal */
export declare enum ContextMode {
    Locked = 0,
    XAxis = 1,
    YAxis = 2,
    ZAxis = 3,
    XAxis2 = 4,
    None = 15
}
/** AccuDraw coordinate input fields
 * @public
 */
export declare enum ItemField {
    /** Distance for polar mode */
    DIST_Item = 0,
    /** Angle for polar mode */
    ANGLE_Item = 1,
    /** X delta for rectangular mode */
    X_Item = 2,
    /** Y delta for rectangular mode */
    Y_Item = 3,
    /** Z delta (3d only) */
    Z_Item = 4
}
/** @internal */
export declare enum KeyinStatus {
    Dynamic = 0,
    Partial = 1,
    DontUpdate = 2
}
/** @internal */
export declare class AccudrawData {
    flags: number;
    readonly origin: Point3d;
    readonly delta: Point3d;
    readonly rMatrix: Matrix3d;
    readonly vector: Vector3d;
    distance: number;
    angle: number;
    zero(): void;
}
/** @internal */
export declare class Flags {
    redrawCompass: boolean;
    dialogNeedsUpdate: boolean;
    rotationNeedsUpdate: boolean;
    lockedRotation: boolean;
    indexLocked: boolean;
    haveValidOrigin: boolean;
    fixedOrg: boolean;
    auxRotationPlane: RotationMode;
    contextRotMode: number;
    baseRotation: RotationMode;
    baseMode: number;
    pointIsOnPlane: boolean;
    softAngleLock: boolean;
    bearingFixToPlane2D: boolean;
    inDataPoint: boolean;
    ignoreDataButton: boolean;
    animateRotation: boolean;
}
/** @internal */
export declare class RoundOff {
    active: boolean;
    units: Set<number>;
}
/** @internal */
export declare class SavedState {
    state: CurrentState;
    mode: CompassMode;
    rotationMode: RotationMode;
    readonly axes: ThreeAxes;
    readonly origin: Point3d;
    auxRotationPlane: number;
    contextRotMode: number;
    fixedOrg: boolean;
    ignoreDataButton: boolean;
    ignoreFlags: AccuDrawFlags;
}
/** @internal */
export declare class ThreeAxes {
    readonly x: Vector3d;
    readonly y: Vector3d;
    readonly z: Vector3d;
    setFrom(other: ThreeAxes): void;
    fromMatrix3d(rMatrix: Matrix3d): void;
    static createFromMatrix3d(rMatrix: Matrix3d, result?: ThreeAxes): ThreeAxes;
    toMatrix3d(out?: Matrix3d): Matrix3d;
    clone(): ThreeAxes;
    equals(other: ThreeAxes): boolean;
}
/** Accudraw is an aide for entering coordinate data.
 * This class is public to allow applications to provide a user interface for AccuDraw, either by implementing their own, or
 * using the one supplied by the itwin appui package.
 * @note When writing an [[InteractiveTool]] it is not correct to call methods on AccuDraw directly, tools should instead
 * provide hints to AccuDraw using [[AccuDrawHintBuilder]].
 * @public
 */
export declare class AccuDraw {
    private _currentState;
    /** Current AccuDraw state */
    get currentState(): CurrentState;
    set currentState(state: CurrentState);
    compassMode: CompassMode;
    rotationMode: RotationMode;
    /** @internal */
    currentView?: ScreenViewport;
    /** @internal */
    readonly published: AccudrawData;
    /** @internal */
    readonly origin: Point3d;
    /** @internal */
    readonly axes: ThreeAxes;
    /** @internal */
    readonly delta: Vector3d;
    private _distance;
    private _angle;
    /** @internal */
    locked: LockedStates;
    /** @internal */
    indexed: LockedStates;
    private readonly _distanceRoundOff;
    private readonly _angleRoundOff;
    /** @internal */
    readonly flags: Flags;
    private readonly _fieldLocked;
    private readonly _keyinStatus;
    /** @internal */
    readonly savedStateViewTool: SavedState;
    /** @internal */
    readonly savedStateInputCollector: SavedState;
    private readonly _savedCoords;
    /** @internal */
    readonly baseAxes: ThreeAxes;
    /** @internal */
    readonly lastAxes: ThreeAxes;
    private _lastDistance;
    private _tolerance;
    private _percentChanged;
    private _threshold;
    /** @internal */
    readonly planePt: Point3d;
    private readonly _rawDelta;
    private readonly _rawPoint;
    private readonly _rawPointOnPlane;
    /** @internal */
    readonly point: Point3d;
    /** @internal */
    readonly vector: Vector3d;
    private _xIsNegative;
    private _yIsNegative;
    private _xIsExplicit;
    private _yIsExplicit;
    /** Disable automatic focus change when user is entering input. */
    dontMoveFocus: boolean;
    /** Set input field to move focus to (X_Item or Y_Item) for automatic focus change. */
    newFocus: ItemField;
    private readonly _rMatrix;
    /** @internal */
    protected _acsPickId?: string;
    /** @internal */
    protected _compassSizeInches: number;
    /** @internal */
    protected _animationFrames: number;
    /** @internal */
    protected _indexToleranceInches: number;
    /** @internal */
    protected readonly _frameColor: ColorDef;
    /** @internal */
    protected readonly _fillColor: ColorDef;
    /** @internal */
    protected readonly _xColor: ColorDef;
    /** @internal */
    protected readonly _yColor: ColorDef;
    /** @internal */
    protected readonly _indexColor: ColorDef;
    /** @internal */
    protected readonly _frameColorNoFocus: ColorDef;
    /** @internal */
    protected readonly _fillColorNoFocus: ColorDef;
    smartKeyin: boolean;
    floatingOrigin: boolean;
    stickyZLock: boolean;
    alwaysShowCompass: boolean;
    contextSensitive: boolean;
    axisIndexing: boolean;
    distanceIndexing: boolean;
    autoFocusFields: boolean;
    autoPointPlacement: boolean;
    private static _tempRot;
    /** @internal */
    onInitialized(): void;
    /** @internal */
    getRotation(rMatrix?: Matrix3d): Matrix3d;
    get isActive(): boolean;
    get isEnabled(): boolean;
    get isInactive(): boolean;
    get isDeactivated(): boolean;
    /** Get the current lock state for the supplied input field */
    getFieldLock(index: ItemField): boolean;
    /** @internal */
    getKeyinStatus(index: ItemField): KeyinStatus;
    /** Implement this method to set focus to the AccuDraw UI. */
    grabInputFocus(): void;
    /** @internal */
    activate(): void;
    /** @internal */
    deactivate(): void;
    /** Change current compass input mode to either polar or rectangular */
    setCompassMode(mode: CompassMode): void;
    /** Change current compass orientation */
    setRotationMode(mode: RotationMode): void;
    /** Change the lock status for the supplied input field */
    setFieldLock(index: ItemField, locked: boolean): void;
    /** @internal */
    setKeyinStatus(index: ItemField, status: KeyinStatus): void;
    private needsRefresh;
    /** @internal */
    adjustPoint(pointActive: Point3d, vp: ScreenViewport, fromSnap: boolean): boolean;
    private setDefaultOrigin;
    /** @internal */
    isZLocked(vp: Viewport): boolean;
    /** @internal */
    accountForAuxRotationPlane(rot: ThreeAxes, plane: RotationMode): void;
    private accountForACSContextLock;
    private static useACSContextRotation;
    /** Gets X, Y or Z vector from top, front, (right) side, ACS, or View. */
    private getStandardVector;
    private getBestViewedRotationFromXVector;
    private getRotationFromVector;
    /** @internal */
    updateRotation(animate?: boolean, newRotationIn?: Matrix3d): void;
    /** @internal */
    enableForSession(): void;
    /** @internal */
    disableForSession(): void;
    /** @internal */
    setLastPoint(pt: Point3d): void;
    /** Emulate a mouse click at the specified location in the supplied view by sending button down/up events. */
    sendDataPoint(pt: Point3d, viewport: ScreenViewport): Promise<void>;
    /** @internal */
    clearTentative(): boolean;
    /** @internal */
    doAutoPoint(index: ItemField, mode: CompassMode): Promise<void>;
    /** Get the current value for the supplied input field */
    getValueByIndex(index: ItemField): number;
    /** Set the current value for the supplied input field */
    setValueByIndex(index: ItemField, value: number): void;
    private updateVector;
    private stringToDistance;
    private stringToAngle;
    private updateFieldValue;
    /** @internal */
    unlockAllFields(): void;
    /** produces the normal vector of the closest plane to the view which
     * contains inVec (uses true view rotation, never auxiliary)
     */
    private planeByVectorAndView;
    private handleDegeneratePolarCase;
    private rawDeltaIsValid;
    /** Call from an AccuDraw UI event to sync the supplied input field value */
    processFieldInput(index: ItemField, input: string, synchText: boolean): Promise<void>;
    /** @internal */
    updateFieldLock(index: ItemField, locked: boolean): void;
    /** @internal */
    static getSnapRotation(snap: SnapDetail, currentVp: Viewport | undefined, out?: Matrix3d): Matrix3d | undefined;
    /** @internal */
    static getStandardRotation(nStandard: StandardViewId, vp: Viewport | undefined, useACS: boolean, out?: Matrix3d): Matrix3d;
    /** @internal */
    static getCurrentOrientation(vp: Viewport, checkAccuDraw: boolean, checkACS: boolean, rMatrix?: Matrix3d): Matrix3d | undefined;
    /** @internal */
    static updateAuxCoordinateSystem(acs: AuxCoordSystemState, vp: Viewport, allViews?: boolean): void;
    /** @internal */
    distanceLock(synchText: boolean, saveInHistory: boolean): void;
    /** @internal */
    angleLock(): void;
    /** @internal */
    doLockAngle(isSnapped: boolean): void;
    /** @internal */
    saveCoordinate(index: ItemField, value: number): void;
    /** @internal */
    changeCompassMode(animate?: boolean): void;
    /** @internal */
    changeBaseRotationMode(mode: RotationMode): void;
    private getBaseRotation;
    /** @internal */
    setContextRotation(rMatrix: Matrix3d, locked: boolean, animate: boolean): void;
    private clearContext;
    /** @internal */
    setContext(flags: AccuDrawFlags, originP?: Point3d, orientationP?: Matrix3d | Vector3d, deltaP?: Vector3d, distanceP?: number, angleP?: number, transP?: Transform): BentleyStatus;
    private onEventCommon;
    /** @internal */
    onPrimitiveToolInstall(): boolean;
    /** @internal */
    onViewToolInstall(): boolean;
    /** @internal */
    onViewToolExit(): boolean;
    /** @internal */
    onInputCollectorInstall(): boolean;
    /** @internal */
    onInputCollectorExit(): boolean;
    /** @internal */
    saveState(stateBuffer: SavedState): void;
    /** @internal */
    restoreState(stateBuffer: SavedState): void;
    private getCompassPlanePoint;
    private getDisplayTransform;
    private setIndexingTolerance;
    private displayAlignments;
    /** @internal */
    testDecorationHit(id: string): boolean;
    /** @internal */
    getDecorationGeometry(hit: HitDetail): GeometryStreamProps | undefined;
    /** @internal */
    decorate(context: DecorateContext): void;
    private checkRotation;
    private saveLockedCoords;
    /** Called after compass state is changed between the active state and one of the disabled states */
    onCompassDisplayChange(_state: "show" | "hide"): void;
    /** Called after compass mode is changed between polar and rectangular */
    onCompassModeChange(): void;
    /** Called after compass rotation is changed */
    onRotationModeChange(): void;
    /** Called after input field locked state is changed */
    onFieldLockChange(_index: ItemField): void;
    /** Called after input field value changes */
    onFieldValueChange(_index: ItemField): void;
    /** Whether AccuDraw currently has input focus */
    get hasInputFocus(): boolean;
    /** Set focus to the specified input field */
    setFocusItem(_index: ItemField): void;
    private static getMinPolarMag;
    /** projects cursor onto plane in view, or returns an error */
    private constructionPlane;
    /** @internal */
    softConstructionPlane(outPtP: Point3d, inPtP: Point3d, pointOnPlaneP: Point3d, normalVectorP: Vector3d, vp: Viewport, isSnap: boolean): boolean;
    /** @internal */
    hardConstructionPlane(outPtP: Point3d, inPtP: Point3d, pointOnPlaneP: Point3d, normalVectorP: Vector3d, vp: Viewport, isSnap: boolean): boolean;
    private static allowAxisIndexing;
    private applyDistanceRoundOff;
    private applyAngleRoundOff;
    /** @internal */
    fixPointPolar(vp: Viewport): void;
    /** @internal */
    fixPointRectangular(vp: Viewport): void;
    private fixPoint;
    /** @internal */
    refreshDecorationsAndDynamics(): void;
    /** @internal */
    upgradeToActiveState(): boolean;
    /** @internal */
    downgradeInactiveState(): boolean;
    /** @internal */
    onBeginDynamics(): boolean;
    /** @internal */
    onEndDynamics(): boolean;
    /** Implemented by sub-classes to update ui fields to show current deltas or coordinates when inactive.
     * Should also choose active x or y input field in rectangular mode based on cursor position when
     * axis isn't locked to support "smart lock".
     */
    onMotion(_ev: BeButtonEvent): void;
    /** @internal */
    onPreButtonEvent(ev: BeButtonEvent): boolean;
    /** @internal */
    onPostButtonEvent(ev: BeButtonEvent): boolean;
    /** @internal */
    onTentative(): boolean;
    private intersectXYCurve;
    private intersectLine;
    private intersectCircle;
    /** @internal */
    onSnap(snap: SnapDetail): boolean;
    /** @internal */
    onSelectedViewportChanged(previous: ScreenViewport | undefined, current: ScreenViewport | undefined): void;
    private doProcessHints;
    /** @internal */
    processHints(): void;
}
/** Specify the rotation to return from [[AccuDrawHintBuilder.getContextRotation]].
 * @public
 * @extensions
 */
export declare enum ContextRotationId {
    Top = 0,
    Front = 1,
    Left = 2,
    Bottom = 3,
    Back = 4,
    Right = 5,
    View = 6,
    Face = 7
}
/** [[AccuDrawHintBuilder]] is an [[InteractiveTool]] helper class that facilitates AccuDraw interaction.
 * Accudraw is an aide for entering coordinate data.
 * A tool does not directly change the current AccuDraw state; the tool's job is merely
 * to supply "hints" to AccuDraw regarding its preferred AccuDraw configuration for the
 * current tool state. User settings such as "Context Sensitivity" and "Floating Origin"
 * affect how and which hints are applied. Additionally the user can drive AccuDraw
 * through keyboard shortcuts.
 * @see [Using AccuDraw]($docs/learning/frontend/primitivetools.md#AccuDraw)*
 * @public
 * @extensions
 */
export declare class AccuDrawHintBuilder {
    private _flagOrigin;
    private _flagNormal;
    private _flagRotation;
    private _flagXAxis;
    private _flagXAxis2;
    private _flagDistance;
    private _flagAngle;
    private _flagModePolar;
    private _flagModeRectangular;
    private _origin?;
    private _axis?;
    private _rMatrix?;
    private _distance;
    private _angle;
    /** Don't automatically set compass origin to point from data button events */
    setOriginFixed: boolean;
    /** Override "fixed" and "floating" origin settings for [[setOrigin] hint */
    setOriginAlways: boolean;
    /** Lock current distance value in polar mode */
    setLockDistance: boolean;
    /** Lock current angle value in polar mode */
    setLockAngle: boolean;
    /** Lock current x delta value in rectangular mode */
    setLockX: boolean;
    /** Lock current y delta value in rectangular mode  */
    setLockY: boolean;
    /** Lock current z delta value in 3d views */
    setLockZ: boolean;
    /** Set the initial compass orientation from the current [[SnapDetail]] when activating */
    enableSmartRotation: boolean;
    /** Add hint to specify a new compass origin */
    setOrigin(origin: Point3d): void;
    /** Add hint to fully specify compass orientation from a Matrix3d */
    setMatrix(matrix: Matrix3d): boolean;
    /** @internal Add hint to fully specify compass orientation from a Matrix3d in row format */
    setRotation(rowMatrix: Matrix3d): void;
    /** Add hint to change compass orientation by combining the supplied x axis direction with the current base rotation */
    setXAxis(xAxis: Vector3d): void;
    /** Add hint to change compass orientation by combining the supplied x axis direction with the current base rotation preferring the result most closely aligned to the view */
    setXAxis2(xAxis: Vector3d): void;
    /** Add hint to change compass orientation by combining the supplied z axis direction with the current base rotation */
    setNormal(normal: Vector3d): void;
    /** Add hint to change compass to polar mode */
    setModePolar(): void;
    /** Add hint to change compass to rectangular mode */
    setModeRectangular(): void;
    /** Set current distance value in polar mode */
    setDistance(distance: number): void;
    /** Set current angle value in polar mode */
    setAngle(angle: number): void;
    /** Enable AccuDraw for the current tool without sending any hints */
    static activate(): void;
    /** Disable AccuDraw for the current tool */
    static deactivate(): void;
    /** Whether AccuDraw is enabled by the host application this session and can be used */
    static get isEnabled(): boolean;
    /** Whether AccuDraw compass is currently displayed and points are being adjusted */
    static get isActive(): boolean;
    /**
     * Provide hints to AccuDraw using the current builder state.
     * @return true if hints were successfully sent.
     */
    sendHints(activate?: boolean): boolean;
    /** Adjust the location of the last data button. If dynamics are enabled on this event, [[InteractiveTool.onDynamicFrame]] is called with this location. */
    setLastPoint(ev: BeButtonEvent): void;
    /** Create a [[Ray3d]] whose origin is the supplied space point and direction is into the view */
    static getBoresite(spacePt: Point3d, vp: Viewport, checkAccuDraw?: boolean, checkACS?: boolean): Ray3d;
    /** Return ray intersection with a plane defined by a point and normal
     * @see [[getBoresite]]
     */
    static projectPointToPlaneInView(spacePt: Point3d, planePt: Point3d, planeNormal: Vector3d, vp: Viewport, checkAccuDraw?: boolean, checkACS?: boolean): Point3d | undefined;
    /** Return ray intersection with a line defined by a point and direction
     * @see [[getBoresite]]
     */
    static projectPointToLineInView(spacePt: Point3d, linePt: Point3d, lineDirection: Vector3d, vp: Viewport, checkAccuDraw?: boolean, checkACS?: boolean): Point3d | undefined;
    /** Return a [[Matrix3d]] representing the current working plane specified by AccuDraw, [[Viewport.auxCoordSystem]], or [[Viewport.rotation]]. */
    static getCurrentRotation(vp: Viewport, checkAccuDraw: boolean, checkACS: boolean, matrix?: Matrix3d): Matrix3d | undefined;
    /** Return a [[Matrix3d]] from a [[SnapDetail]].
     * Uses [[SnapDetail.normal]] and [[SnapDetail.primitive]] when available to create the most well defined rotation for the given snap location.
     */
    static getSnapRotation(snap: SnapDetail, matrix?: Matrix3d): Matrix3d | undefined;
    /** Return a [[Matrix3d]] corresponding to the supplied [[ContextRotationId]].
     * A [[ContextRotationId]] that corresponds to a standard view, "Top", "Front", etc. will return a [[Matrix3d]] that
     * is relative to the current [[Viewport.auxCoordSystem]] when ACS context lock is enabled.
     * @see [[ToolAdmin.acsContextLock]]
     */
    static getContextRotation(id: ContextRotationId, vp: Viewport): Matrix3d | undefined;
}
//# sourceMappingURL=AccuDraw.d.ts.map