Skip to main content

Point Cloud Viewer Tools

The point cloud viewer toolbar is built from pointcloudToolbarTools(). Tools interact with the Potree-based viewer instance stored in PointCloudContext.

Source: @collabdt/core/components/viewers/pointcloud/src/tools/

Available Tools

Tool IDComponentEnabledDescription
pc-fit-to-screen-toolFitToScreenYesFit camera to the point cloud bounds
pc-dimensions-toolMeasurePointCloudToolYesLine, area, and angle measurements
pc-set-camera-optionSetCameraOptionYesToggle camera projection (perspective/orthographic)
pc-clip-toolClippingToolDisabledClip the point cloud with a volume (not yet enabled)
pc-share-toolSharePointCloudToolDisabledShare camera position link (not yet enabled)

MeasurePointCloudTool

Sub-menu offering three measurement modes. All measurements use the Potree viewer's built-in measurement API.

Measurement types

Sub-toolComponentDescription
LineLineMeasurementMeasure distance between two points
AreaAreaMeasurementMeasure a polygonal area
AngleAngleMeasurementMeasure the angle between three points

Behaviour

  • Active measurement type is stored in PointCloudContext via SET_ACTIVE_TOOL action.
  • Length unit is set to inches (viewer.setLengthUnit('in')) when activating.
  • All active measurements can be cleared via a "Remove all" action, which iterates viewer.scene.measurements in reverse.
  • Cancelling returns activeTool to PointCloudTools.NONE.
const { state, dispatch } = useContext(PointCloudContext)
dispatch({ type: 'SET_ACTIVE_TOOL', payload: { activeTool: PointCloudTools.LINE_MEASURE } })

FitToScreen

Resets the camera to fit the point cloud bounding box. Single-action — no persistent active state.


SetCameraOption

Toggles between perspective and orthographic camera projections on the Potree viewer. Reads/writes viewer camera state directly.


PerformanceSettingTools

A sub-group of performance controls accessible from the toolbar:

ComponentDescription
PointBudgetToolAdjust the maximum number of rendered points
NodeSizeSelectionToolSet the point size
SplatQualitySelectionChoose splat rendering quality
ShowOctreeBoxToolToggle octree debug visualization

ClippingTool (disabled)

Volume clipping tool — not yet enabled in the toolbar (disabled: true). Will clip the rendered point cloud to a user-defined box or plane.


SharePointCloudTool (disabled)

Generates a shareable URL encoding the camera position. Not yet enabled (disabled: true). Source in SharePointCloudTool/src/getCameraPosition.ts.


Activating a tool

Tools are activated via ToolsContext and PointCloudContext together:

const { dispatch: toolsDispatch } = useContext(ToolsContext)
const { dispatch: pcDispatch } = useContext(PointCloudContext)

// Activate measurement
toolsDispatch({ type: 'SET-TOOL', payload: { currentToolId: 'pc-dimensions-tool' } })
pcDispatch({ type: 'SET_ACTIVE_TOOL', payload: { activeTool: PointCloudTools.LINE_MEASURE } })

Key Files

FileRole
@collabdt/core/components/viewers/pointcloud/src/tools/pointcloudToolbarTools.tsTool list definition
@collabdt/core/components/viewers/pointcloud/src/tools/MeasureTools/MeasurePointCloudTool.tsxMeasurement tool sub-menu
@collabdt/core/components/viewers/pointcloud/src/tools/MeasureTools/LineMeasurement.tsxLine measurement
@collabdt/core/components/viewers/pointcloud/src/tools/MeasureTools/AreaMeasurement.tsxArea measurement
@collabdt/core/components/viewers/pointcloud/src/tools/MeasureTools/AngleMeasurement.tsxAngle measurement
@collabdt/core/components/viewers/pointcloud/src/tools/FitToScreen.tsxFit to screen
@collabdt/core/components/viewers/pointcloud/src/tools/SetCameraOption.tsxCamera projection toggle
@collabdt/core/components/viewers/pointcloud/src/tools/PerformanceSettingsTools/Performance controls