Measurements Namespace

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

Index

Types

MeasurementData

MeasurementData: object

Type declaration

MeasurementModeData

MeasurementModeData: object

The data associated with Showcase's measurement mode

Type declaration

  • points: Vector3[]

    The list of wold-space coordinates that compose this measurement

  • sid: string

    A unique identifier for this measurement

State

State: object

Type declaration

  • active: boolean

Properties

data

An observable collection of measurement mode data that can be subscribed to.

showcase.Measurements.data.subscribe({
  onAdded: function (index, item, collection) {
    console.log('item added to the collection', index, item, collection);
  },
  onRemoved: function (index, item, collection) {
    console.log('item removed from the collection', index, item, collection);
  },
  onUpdated: function (index, item, collection) {
    console.log('item updated in place in the collection', index, item, collection);
  },
  onCollectionUpdated: function (collection) {
    console.log('the entire up-to-date collection', collection);
  }
});

mode

An observable measurement mode state object.

mpSdk.Measurements.mode.subscribe(function (measurementModeState) {
 // measurement mode state has changed
 console.log('Is measurement mode currently active? ', measurementModeState.active);
});

// output
// > Is measurement mode currently active? true

Methods

getData

  • This function returns metadata on the collection of Measurements.

    mpSdk.Measurement.getData()
      .then(function(Measurements) {
        // Measurement data retreival complete.
        if(Measurements.length > 0) {
          console.log('First Measurement label: ' + Measurements[0].label);
          console.log('First Measurement description: ' + Measurements[0].description);
        }
      })
      .catch(function(error) {
        // Measurement data retrieval error.
      });
    

    Returns Promise<Measurements.MeasurementData[]>

toggleMode

  • toggleMode(activate: boolean): Promise<void>
  • Activate or deactivate measurement mode. This function can only be used after the application has started playing. Use App.state to determine the phase of the application.

    showcase.Measurements.toggleMode(true)
      .then(() => {
        console.log('measurement mode is now active');
      });
    

    Parameters

    • activate: boolean

    Returns Promise<void>