Class MapView

Generic PubSub class implementing the Publish-Subscribe pattern for event handling.

Hierarchy (view full)

Properties

Camera: Camera

Controls for the map's camera.

CustomGeometries: CustomGeometries

Controls custom GeoJSON geometry on the map

Labels: Labels

Controls for the map's labels.

Markers: Markers

Controls for the map's markers.

Models: Models

Controls for the map's models.

Navigation: Navigation

Controls for the map's navigation.

Outdoor: {
    enabled: boolean;
    map: undefined | Map;
    setStyle: ((style: any) => void);
}

Type declaration

  • enabled: boolean

    Whether the outdoorView is enabled.

  • map: undefined | Map

    Returns a Maplibre map for advanced usage.

    Maplibre map instance

    Limitations:

    • Maplibre interaction events are not supported; use SDK interaction events.
    • Maplibre markers and labels may overlap as they are not integrated with the SDK collision engine.
  • setStyle: ((style: any) => void)
      • (style): void
      • Parameters

        • style: any

        Returns void

Paths: Paths

Controls for the map's paths.

Style: Style

Accessors

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

    Returns Floor

Methods

  • Creates a Coordinate on the map.

    Parameters

    • latitude: number

      The latitude of the coordinate.

    • longitude: number

      The longitude of the coordinate.

    • Optionalfloor: Floor

      Optional floor information if applicable.

    Returns Coordinate

    The created coordinate object.

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

    • x: number
    • y: number
    • Optionalfloor: Floor

    Returns undefined | Coordinate

  • Destroys the MapView.

    Returns void

  • Experimental

    Parameters

    • Optionalopts: {
          excludeFloors: Floor[];
      }

    Returns undefined | Promise<void>

  • Returns undefined | string

  • Returns {}

    • Unsubscribe a function previously subscribed with on

      Type Parameters

      • EventName extends
            | "click"
            | "hover"
            | "camera-change"
            | "floor-change-start"
            | "floor-change"
            | "outdoor-view-loaded"
            | "outdoor-style-loaded"
            | "user-interaction-start"
            | "user-interaction-end"
            | (keyof TStackedMapsEvents)

      Parameters

      • eventName: EventName

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

      • fn: ((payload: TEventPayload<EventName>) => void)

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

      Returns void

      // Unsubscribe from the 'click' event
      const handler = (event) => {
      const { coordinate } = event;
      const { latitude, longitude } = coordinate;
      console.log(`Map was clicked at ${latitude}, ${longitude}`);
      };
      mapView.off('click', handler);
    • Subscribe a function to an event.

      Type Parameters

      • EventName extends
            | "click"
            | "hover"
            | "camera-change"
            | "floor-change-start"
            | "floor-change"
            | "outdoor-view-loaded"
            | "outdoor-style-loaded"
            | "user-interaction-start"
            | "user-interaction-end"
            | (keyof TStackedMapsEvents)

      Parameters

      • eventName: EventName

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

      • fn: ((payload: TEventPayload<EventName>) => 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.

      Returns void

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

      Parameters

      • floor: string | Floor

        The floor or floor ID to set.

      Returns void

    • Parameters

      • c: string

      Returns void

    • Returns void