Floor Namespace

Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.

Index

Enumerations

Types

Properties

Methods

Types

FloorData

FloorData: object

Type declaration

  • id: string
  • name: string
  • sequence: number

Floors

Floors: object

Type declaration

  • currentFloor: number
  • floorNames: string[]
  • totalFloors: number

ObservableFloorData

ObservableFloorData: object

Type declaration

  • id: string | undefined
  • name: string
  • sequence: number | undefined

Properties

current

An observable for the player's currently active floor.

The current floor can tell you when "all floors" are visible and encodes when the camera is transitioning between floors.

The following table shows all 4 states of the current floor observable (INSIDE: inside mode, DH: dollhouse mode, FP: floorplan mode).

at sweep (INSIDE) or floor (DH, FP) all floors (DH, FP) transitioning in unplaced 360ยบ view
id ${current.id} '' '' undefined
sequence ${current.sequence} -1 undefined undefined
name ${current.name} 'all' '' ''
mpSdk.Floor.current.subscribe(function (currentFloor) {
  // Change to the current floor has occurred.
  if (currentFloor.sequence === -1) {
    console.log('Currently viewing all floors');
  } else if (currentFloor.sequence === undefined) {
    if (currentFloor.id === undefined) {
      console.log('Current viewing an unplaced unaligned sweep');
    } else {
      console.log('Currently transitioning between floors');
    }
  } else {
    console.log('Currently on floor', currentFloor.id);
    console.log('Current floor\'s sequence index', currentFloor.sequence);
    console.log('Current floor\'s name', currentFloor.name)
  }
});

data

An observable collection of Floor data that can be subscribed to.

See IObservableMap to learn how to receive data from the collection.

showcase.Floor.data.subscribe({
  onCollectionUpdated: function (collection) {
    console.log('Collection received. There are ', Object.keys(collection).length, 'floors in the collection');
  }
});

Methods

getData

  • deprecated

    Use the observable data collection instead

    This function returns the state of all floors.

    mpSdk.Floor.getData()
      .then(function(floors) {
        // Floor data retreival complete.
        console.log('Current floor: ' + floors.currentFloor);
        console.log('Total floos: ' + floors.totalFloors);
        console.log('Name of first floor: ' + floors.floorNames[0]);
      })
      .catch(function(error) {
        // Floors data retrieval error.
      });
    

    Returns Promise<Floor.Floors>

moveTo

  • moveTo(index: number): Promise<number>
  • When in inside mode, this function changes the active floor, and moves the camera to the nearest position on that floor. When in floorplan/dollhouse mode, this function changes the active floor, but does not modify the camera

    mpSdk.Floor.moveTo(2)
      .then(function(floorIndex) {
        // Move to floor complete.
        console.log('Current floor: ' + floorIndex);
      })
      .catch(function(error) {
        // Error moving to floor.
      });
    

    Parameters

    • index: number

    Returns Promise<number>

    The destination floor index.

showAll

  • showAll(): Promise<void>
  • This function displays all floors.

    mpSdk.Floor.showAll()
      .then(function(){
        // Show floors complete.
      })
      .catch(function(error) {
        // Error displaying all floors.
      });
    

    Returns Promise<void>