Use MeasurePlugin for interactive measurements on the loaded scene. The quickstart registers it with metric units and two decimal places. It is a different controller from PanoMeasurePlugin; their methods are not interchangeable.
Connect your controls
import type { MeasurePlugin } from '@realsee/dnalogel'
type MeasureController = ReturnType<typeof MeasurePlugin>
export function bindMeasurement(
measure: MeasureController,
report: (result: { reason: string; pointCount: number }) => void
) {
const stop = measure.on('measureEnd', (reason, points) => report({ reason, pointCount: points.length }))
return {
start() { measure.measure() },
finish() { measure.endMeasure() },
undo() { measure.undo() },
cancel() { measure.cancel() },
metric() { measure.setUnit('m'); measure.setPrecision(2) },
imperial() { measure.setUnit('ft'); measure.setPrecision(8) },
clear() { measure.clear() },
dispose() { stop(); measure.cancel() }
}
}Call bindMeasurement(result.measure, report) after the scene is ready. Connect its returned methods to your Start, Finish, Undo, Cancel, Units, and Clear buttons. The report callback receives an end reason and point count; it does not claim to be a persisted measurement result.
measure.on('measureEnd', ...) is the event surface for this controller. Unlike PanoTagPlugin, it does not use a .hooks property for this subscription.
Understand precision and completion
| Setting | Meaning |
|---|---|
Unit m, precision 2 | Two decimal places for lengths |
Unit ft, precision 8 | Eighth-inch length precision |
| Area display | Fixed two decimal places |
The published completion reasons include enter, escape, polygon, mode_change, pano_move, floor_change, points_insufficient, and external. A finished interaction is not always a usable polygon or a saved result. Decide what your product accepts before storing selected points on your backend.
Verify
Start a measurement, add points, undo, and finish. Repeat with cancellation and a panorama or mode change. Switch units without recreating the plugin. Confirm the display and report callback agree with the performed action, then clean up the binding and scene.
Test measurement behavior and accuracy on your captured scene in the browser. This example does not provide a surveying accuracy guarantee.
