Class MapView

Represents a map with all the interactive features, controls, and actions.

Hierarchy

Implements

  • IMapView

Properties

Camera: ICamera = ...

Camera (ICamera) controls for the map.

Exporter: Exporter = ...

Export controller for the map.

Labels: ILabels = ...

Controls for the map's labels *ILabels).

Markers: IMarkers = ...

Controls for the map's markers (IMarkers).

Navigation: INavigation = ...

Navigation (INavigation) controls for the map.

Paths: IPaths = ...

Controls for the map's (IPaths).

Accessors

  • get currentFloor(): Floor
  • Retrieves the current floor of the map.

    Returns Floor

    The current floor of the map.

    Example

    // Get the current floor of the map.
    const floor = map.currentFloor;
  • get mapData(): {
        [key: string]: MapData;
    }
  • Returns {
        [key: string]: MapData;
    }

Methods

  • Creates a Coordinate on the map.

    Parameters

    • latitude: number

      The latitude of the coordinate.

    • longitude: number

      The longitude of the coordinate.

    • floor: undefined | Floor = undefined

      Optional floor information if applicable.

    Returns Coordinate

    The created coordinate object.

    Example

    // Create a coordinate at the CN Tower.
    const coord = map.createCoordinate(43.642567, -79.387054);
  • Parameters

    • x: number
    • y: number
    • Optional floor: Floor

    Returns Coordinate

  • Unsubscribe a function previously subscribed with on

    Type Parameters

    Parameters

    • eventName: EVENT_NAME

      An event name to which the provided function was previously subscribed.

    • fn: ((payload) => void)

      A function that was previously passed to on. The function must have the same reference as the function that was subscribed.

        • (payload): void
        • Parameters

          Returns void

    Returns void

    Example

    // Unsubscribe from the 'click' event
    const handler = (event) => {
    console.log('Map was clicked', event);
    };
    map.off('click', handler);
  • Subscribe a function to an event.

    Type Parameters

    Parameters

    • eventName: EVENT_NAME

      An event name which, when fired, will call the provided function.

    • fn: ((payload) => void)

      A callback that gets called when the corresponding event is fired. The callback will get passed an argument with a type that's one of event payloads.

        • (payload): void
        • Parameters

          • payload: TEvents[EVENT_NAME] extends {
                    data: null;
                }
                ? any[any]["data"]
                : TEvents[EVENT_NAME]

          Returns void

    Returns void

    Example

    // Subscribe to the 'click' event
    const handler = (event) => {
    const { coordinate } = event;
    const { latitude, longitude } = coordinate;
    console.log(`Map was clicked at ${latitude}, ${longitude}`);
    };
    map.on('click', handler);
  • Sets the current floor of the map.

    Parameters

    Returns void

  • Updates the state TUpdateState of a given target on the map.

    The following table maps targets to states.

    target state
    Label TLabelState
    MapObject TGeometryState
    Space TGeometryState

    Type Parameters

    Parameters

    • target: T

      The target to update.

    • state: TUpdateState<T>

      The new state to apply to the target.

    Returns void

    Example

    // Update the color of a space to red.
    map.updateState(space, { color: 'red' });