import * as Core from "@intelligentgraphics/ig.gfx.core";
import { Bounds, WorldCoordinates, EGhostMode, MathTypes } from "@intelligentgraphics/ig.gfx.core";
import { IScreenWorldConverter } from "../ScreenWorldConverter";
import { EStage, SnapMode } from "../Types";
import { IMouseConverter } from "./MouseTo3DMovement";
import { SnapMatch } from "./SnapMatches";
import { IMovementPlane } from "./MovementPlanes";
/** Options to enabled / disable functionality of the Interactor */
export interface StandardInteractorOptions {
    snapping: {
        /** disable snapping completely, will also disable snap ghosts */
        ignoreAll: boolean;
        /** disable specific modes of snapping
         * (e.g. snapping to wall, weak snapping etc.) */
        ignoredModes: SnapMode[];
    };
    ghosts: {
        /** Enable / disable snap ghosts */
        snapping: boolean;
        /** Enable / disable collision ghosts */
        collision: boolean;
        /** Determines ghost representation (e.g. Box or Geometric) */
        mode: EGhostMode;
    };
    collisions: {
        /** Enable / disable collision checks */
        ignoreAll: boolean;
    };
    grid: {
        /** If set to a positive number, rotations will only
         * happen in multiples of this number. Given in radians */
        rotation: number;
        /** If set to a positive number, translations in all
         * directions will only happen in multiples of this number.
         * Given in meters */
        movement: number;
    };
    /** Set to a non-null value to ensure that movement is
     * restricted to the given bounds */
    bounds: Bounds;
    /** If object has category Category.Floating set,
     * keep it in the air (if set to true)
     * or drop it back to the ground (if set to false)  */
    keepFloatingObjectsFloating: boolean;
    /** If specific view-to-world-coordinates conversion
     * needs to be done, this can be set.
     * If not set, an instance of MouseTo3DMovement will be used. */
    createMouseConverter?(converter: IScreenWorldConverter, mouseAttachmentPoint: Core.WorldCoordinates, planes: IMovementPlane[]): IMouseConverter;
}
/** A enhanced modularized, global Interactor. */
export default class StandardInteractor extends Core.Interactor {
    /**
     * Only called once for the first TouchMotion Event.
     * @deprecated getter for backward compatibility
     */
    /**
    * @deprecated setter for backward compatibility
    */
    moveStartedCallback: () => void;
    /** Only called once for the first TouchMotion Event. */
    onMoveStarted: () => void;
    /**
     * The callback to be called after a snap occured. It receives the
     * snapped ids and the snap mode.
     * @deprecated getter for backward compatibility
     */
    /**
    * @deprecated setter for backward compatibility
    */
    onSnapCallback: (snappedIds: Core.ComponentId[], mode: SnapMode) => void;
    /** The callback to be called after a snap occured. It receives the
     * snapped ids and the snap mode. */
    onSnapped: (snappedIds: Core.ComponentId[], mode: SnapMode) => void;
    /**
     * Only called after all movement is finished.
     * @deprecated setter for backward compatibility
     */
    /**
    * @deprecated setter for backward compatibility
    */
    moveEndedCallback: () => void;
    /** Only called after all movement is finished. */
    onMoveEnded: () => void;
    /**
     * Called after all effects of a MouseMotion Event have been processed.
     * @param positionsById New positions, keyed by the corresponding id
     * @param isValid: is the new position a valid one (e.g. allowed)
     * @param matches: all snap matches that have been calculated
     * @deprecated getter for backward compatibility
     */
    /**
    * @deprecated setter for backward compatibility
    */
    moveSteppedCallback: (positionsById: {
        [id: string]: {
            position: WorldCoordinates;
        };
    }, isValid: boolean, matches?: SnapMatch[]) => void;
    /**
     * Called after all effects of a MouseMotion Event have been processed.
     * @param positionsById New positions, keyed by the corresponding id
     * @param isValid: is the new position a valid one (e.g. allowed)
     * @param matches: all snap matches that have been calculated
     */
    onMoveStepped: (positionsById: {
        [id: string]: {
            position: WorldCoordinates;
        };
    }, isValid: boolean, matches?: SnapMatch[]) => void;
    /** The state of the interactor during the last event */
    private previousState;
    /** The current state of the interactor */
    private currentState;
    /** The default timeout for snapping. If after this timeout no motion or
     * release of mouse has occurred, we will stop snapping. */
    static defaultSnappingTimeout: number;
    /** The default timeout for removing the collision check. */
    static defaultInvalidTimeout: number;
    /** The color of the ghost that shows an invalid position */
    static invalidPositionColor: Core.ColorRGB;
    /** Timer to allow for removal of snapping after
     * defaulSnappingTimeout has passed */
    private snapTimer;
    /** Timer to allow users to disable collisioncheck after
     * a certain amount of time has passed */
    private invalidTimer;
    /** Object used for finding the correct operation for the given situation. */
    private strategyFinder;
    /** Indicates if the snap timeout occurred, so we want to
     * ignore the next snap that occurs */
    private ignoreSnap;
    /** Indicates if the collision timeout occurred, so we want to
     * ignore the next collision that occurs */
    private ignoreCollision;
    /** The (3D) center of the current selection */
    private centerOfSelection;
    /** If set, we will log */
    static log: boolean;
    /** The type of ghost to be used for showing invalid positions */
    static invalidGhostMode: Core.EGhostMode;
    /**
     * The type of ghost to be used for showing snapping positions
     * @Deprecated this is now regulated by the _options.ghosts.mode property
     */
    static snappingGhostMode: Core.EGhostMode;
    /** The converter used to convert World to View Coordinates and vice versa */
    private converter;
    /** The current move mode */
    private moveMode;
    /** The point that is fixed for mouse movement during interaction.
     * In other words, the point that will always stay under the mouse during a movement.
     * This can either be a point on the selected objects, the 3D center of the selection.
     */
    private mouseAttachmentPoint;
    /** The component under the mouse cursor */
    private hitInfoForScreenBasedChildMatches;
    /**
     * Responsible for translating mouse movement (in camera plane) to
     * object movement (in 3D space)
     */
    private mouseFollower;
    /** cache the niches of all roots */
    private niches;
    /** Article configuration for snap ghost creation */
    articleConfigurations: Map<string, any>;
    /**
     * The constructor of StandardInteractor. Initializes the OperationStrategyFinder
     * member and settings.
     * @param parameters Initialization parameters, see IG.GFX.Core.Interactor
     */
    constructor(parameters: any);
    private _options;
    /**
     * Set Standard Interactor options. All values have to be provided.
     * @param options
     */
    setGlobalOptions(options: StandardInteractorOptions): void;
    /**
     * Set Standard Interactor options. All none specified values
     * will not be overridden
     * @param otherOptions
     */
    mergeIntoGlobalOptions(otherOptions: Partial<StandardInteractorOptions>): void;
    /**
     * Updates the current state.
     * @param stage the stage that the interaction is in
     * @param coordinates the view coordinates of the touch
     * @param converter the converter
     */
    private updateState;
    /**
     * special care about components that are only movable/rotatable
     * when the parent component is in selection too
     * @param selectedIds
     */
    private filterSelection;
    /**
     * Updates rotation angle for Y axis
     * @param coordinates the view coordinates of the touch
     * @param converter the converter
     */
    private updateYRotationAngle;
    private directNeighbors;
    /**
     * Function for applying an operation directly
     * @param stage the stage for the operation (Start, Motion, End)
     * @param coordinates the ViewCoordinates of the current touch
     * @param moveMode the move mode (rotation or translation)
     * @constructor
     */
    OperationDirect(stage: EStage, touch: Core.Touch): void;
    /**
     * Intialize the operation.
     * @param touch The Touch supplied by the event (pushing the mouse button).
     */
    SingleTouchStart(touch: Core.Touch): void;
    /**
     * Use the operation to calculate new positions and rotation for the components.
     * @param touch The touch from the mouse event.
     */
    SingleTouchMotion(touch: Core.Touch): void;
    /**
     * Apply operation or cancel if result is not valid .
     * @param touch The touch from the mouse event
     */
    SingleTouchEnd(touch: Core.Touch): void;
    /**
     * The Timeout to be called to release the snapping
     */
    ApplySnapTimeout(): void;
    /**
     * Activate the no collision mode.
     * Move object to the invalid ghost location after a certain amount
     * of time has passed with no movement.
     * @param ghostTransformations
     * @constructor
     */
    ApplyInvalidTimeout(ghostTransformations: MathTypes.Transformation[]): void;
    /**
     * Update niches cache
     */
    private updateNiches;
    /**
     * Make niches of roots visible
     */
    private makeAllNichesVisible;
    /**
     * Make niches of roots invisible
     */
    private makeAllNichesInvisible;
    /**
     * Applies the rotations and positions from result to the given componentIds.
     * Length of componentIds has to be the same as the amount of
     * positions/rotations in the result.
     * @param componentIds the ids of components that will move
     * @param transformations
     */
    private applyTransformation;
    /**
     * Reset the Snap and Invalid Timeout
     */
    clearTimeouts(): void;
    /**
     * Reset invalid timeout
     */
    private clearInvalidTimeout;
    /**
     * Reset snap timeout
     */
    private clearSnapTimeout;
    /**
     * Get the snap color for the passed snap mode.
     * @param mode The Snap mode.
     * @returns The corresponding Color
     */
    static getSnapColor(mode: SnapMode): Core.ColorRGB;
    /**
     * Calculate StrategyParameters based on the current state.
     */
    private getStrategyParameters;
    /**
     * If the log parameter is set, will log the message via IGX.Planning.PlannningLog
     * @param message
     */
    private log;
    /**
     * @param result
     * @param coordinates
     * @returns {boolean}
     */
    private applyMotionResult;
    /**
     * Make ghosts for invalid movement at the desired location
     * @param {MotionResult} result
     */
    private makeInvalidGhosts;
    /**
     * Create ghosts for snapping with the correct color at the location
     * that is stored in result.snapMatches[0]
     * @param result
     */
    private makeSnapGhosts;
    /**
     * Sets ghosts for each of the currently selected ids with the passed mode.
     * @param mode
     */
    private makeAllGhosts;
    /**
     * Applies the positions and rotations of the end result to the selected ids.
     * @param result the result
     * @param executeSnap true if a snap should be executed
     */
    private applyEndResult;
    /**
     * Apply the neighbor actions that are necessary after a movement has ended.
     */
    private executeNeighborActions;
    /**
     * Hides all ghost of the selected Ids
     */
    private hideAllGhosts;
    /**
     * Removes all ghost of the selected Ids
     */
    private removeAllGhosts;
    /**
     * Creates a Request containing the relative movement and/or
     * angle from the view coordinates.
     * @param coordinates the view coordinates (touch on the screen)
     * @returns {OperationRequest}
     */
    private makeRequest;
    /**
     * Sets the mouseAttachmentPoint member by casting a ray from the
     * camera to through the ViewCoordinates. If the ray intersects
     * an object, the intersection point is chosen,
     * otherwise we choose the 3D center of the current selection.
     */
    private calculate3DAttachmentPoint;
}
