IonSnapService
Provides interactive snap-to-geometry against a Cesium ion 3D Tiles asset backed by a BIM/CAD Database model, using the ion REST API's element snap endpoint.
This class handles conversions between the reference frame of a source BIM/CAD Database and the view-dependent screen space pixel coordinates. Each snap, it transforms using the ion asset's source reference frame, the camera's transform, and the canvas dimensions so that view-dependent features— such as the pixel aperture, nearest position, or surface tracking— behave correctly.
This object is normally not instantiated directly, use IonSnapService.fromAssetId.
const snapper = await IonSnapService.fromAssetId(123456);
const canvas = viewer.scene.canvas;
const result = await snapper.snap({
elementId: "0x30000000df2",
testPoint: pickedPosition,
camera: viewer.camera,
canvasWidth: canvas.clientWidth,
canvasHeight: canvas.clientHeight,
});
if (defined(result)) {
console.log("snapped to", result.snapPoint);
}Content copied to clipboard
See also
Types
Link copied to clipboard
interface ConstructorOptions
Link copied to clipboard
interface Result
The result of a successful IonSnapService.snap. Extends SnapService.Result with ion-specific fields.
Link copied to clipboard
interface SnapOptions