Usage of the SDK constitutes your agreement with the Matterport SDK Agreement. Email developers@matterport.com with any questions.
Index
Types
Properties
Methods
Types
MeasurementData
MeasurementModeData
Type declaration
-
id: string
A unique identifier for this measurement
-
label: string
The user-set "description" of this measurement
-
points: Vector3[]
The list of wold-space coordinates that compose this measurement
-
segment
Lengths: number[] The length of each segment between consecutive pairs of points
-
sid: string
Alias for
id -
total
Length: number The total length of the measurement
State
Type declaration
-
active: boolean
Properties
data
An observable collection of measurement mode data that can be subscribed to.
mpSdk.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
-
Returns Promise<Measurements.MeasurementData[]>
remove
-
Remove one or more measurements.
const measurements: Dictionary<Measurements.MeasurementModeData>; // ... acquired through `mpSdk.Measurements.data` // remove one measurement mpSdk.Measurements.remove(measurements); // or rmeove multiple at the same time mpSdk.Measurements.remove(...Object.values(measurements));Parameters
-
Rest ...measurements: Measurements.MeasurementModeData[]
Returns Promise<void>
-
toggleMode
-
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.
mpSdk.Measurements.toggleMode(true) .then(() => { console.log('measurement mode is now active'); });Parameters
-
activate: boolean
-
Optional options: undefined | object
Returns Promise<void>
-
The data associated with Showcase's measurement mode