3D-City Model
    Preparing search index...

    Class CustomHandler

    CustomHandler – Central event and interaction manager for Cesium viewers.

    Handles input event setup, picking, feature/selection management, throttling, and communication between the Cesium scene and UI through DOM events.

    Basic responsibilities:

    • Set up all input actions (mouse/touch/clicks/etc) on the Cesium viewer.
    • Route low-level Cesium events to higher-level application (DOM) events.
    • Manage highlighting/selecting of scene features.
    • Support info box/pop-up management and feature property display.

    Cesium Viewer instance (must have canvas property).

    Enables debug mode (console/extra info hooks).

    throttle(func, wait) - Utility to throttle event firing.

    addInputAction(callback, type, modifier) - Adds an input event handler with throttling.

    removeInputAction(callback, type) - Removes a registered input handler.

    safePick(position) - Attempts to pick position in the scene, updating lastValidPickPosition.

    pickPositionAndFeature(position) - Picks both a position and a feature, updates track.

    emitLastValidPosition() - Fires a DOM event with last valid position and feature.

    init() - Sets up all main event listeners and handlers.

    resetObject(object) - Clears color/Highlight from a picked/highlighted object.

    processFeature(feature, targetObject, defaultColor, transparentColor) - Colors/updates the current scene feature as highlighted/selected.

    handleHighlight(pickedFeature) - Handles and displays highlights on hover or move.

    handleSelection(pickedFeature) - Handles object selection and info box population.

    const handler = new CustomHandler(viewer);
    handler.addInputAction(ev => {...}, LEFT_CLICK);
    // See handleSelection/handleHighlight for integration in Cesium picking.
    Index

    Constructors

    Properties

    cameraAggregator: CameraEventAggregator

    Manages camera drag/aggregation.

    DEBUG: boolean

    Debug flag.

    dragTimeOut: any
    handlers: {}

    Registered input event callbacks by type.

    highlightedObject: any

    Current highlighted feature (if any).

    infoBox: GeInfobox

    The main info box widget displayed in the DOM.

    lastValidPickedFeature: any

    Tracks last successfully picked feature.

    lastValidPickPosition: any

    Tracks last successful pick position.

    screenSpaceEventHandler: ScreenSpaceEventHandler

    Main handler for low-level input.

    selectedObject: any

    Currently selected object (if any).

    selectionActive: boolean

    Enables object selection logic.

    showInfobox: boolean

    Enables info box pop-up.

    viewer: any

    The Cesium Viewer reference.

    Methods

    • Adds an input event (e.g., mouse or touch event) to Cesium with throttling and duplicate support.

      Parameters

      • callback: Function

        Callback to execute on event.

      • type: string | number

        Cesium event type constant.

      • Optionalmodifier: string | number

        (Optional) Event modifier.

      Returns Function

      Unregister callback.

    • Emits a DOM CustomEvent with last valid pick position and feature. Triggers 'viewer-mouse-move-3d'.

      Returns void

    • Handles mouse hover highlighting for features.

      Parameters

      • pickedFeature: any

        Raw picked object.

      Returns void

    • Handles full feature/entity selection and info box updating.

      Parameters

      • pickedFeature: any

      Returns void

    • Sets up default event mappings and custom window event dispatches for core Cesium/scene events. Registers handlers for various mouse, click, and wheel events.

      Returns void

    • Picks both position and feature (entity/object) at a position, updating caches.

      Parameters

      • position: any

      Returns [any, any]

      [pickedPosition, pickedFeature]

    • Applies highlighting or selection to a scene feature. Sets color (default or transparent) and tracks feature type for effect.

      Parameters

      • feature: Feature
      • targetObject: string

        Either 'highlightedObject' or 'selectedObject'.

      • defaultColor: Color
      • transparentColor: Color

      Returns Feature

    • Removes a registered input action of a particular type.

      Parameters

      • callback: Function
      • type: string | number

      Returns void

    • Clears highlight or color effects from a feature/object.

      Parameters

      • object: any

      Returns null

    • Safely attempts to pick a 3D position in the scene. Caches result as lastValidPickPosition.

      Parameters

      • position: any

        Mouse or input position.

      Returns any

      Picked position or null.

    • Throttles a function so it cannot be called more than once per wait ms.

      Parameters

      • func: Function

        Callback to throttle.

      • wait: number

        Milliseconds to wait.

      Returns Function