SnapService

Provides snap-to-geometry through an external service, which snaps against source geometry hosted remotely rather than geometry loaded in the scene. This type describes an interface and is not intended to be used.

new Cesium.SnapService()

Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

See:

Members

static constant Cesium.SnapService.DEFAULT_SNAP_APERTURE : number

The default snap tolerance used by SnapService#snap when options.snapAperture is not provided, in CSS pixels. The value is implementation-defined.
Experimental

This feature is not final and is subject to change without Cesium's standard deprecation policy.

Methods

async snap(options)Promise.<(SnapService.Result|undefined)>

Requests a snap against geometry known to the service. The camera and canvas dimensions describe the current view so the implementation can perform view-dependent snapping (nearest ordering, pixel apertures, surface tracking) correctly. Implementations may accept additional options beyond those listed here.
Name Type Description
options object Object with the following properties:
Name Type Default Description
elementId string An implementation-defined identifier of the geometry to snap to.
testPoint Cartesian3 The point to snap from, typically the picked cursor position.
camera Camera The camera defining the current view.
canvasWidth number The canvas width in CSS pixels.
canvasHeight number The canvas height in CSS pixels.
closePoint Cartesian3 options.testPoint optional A reference point near the target geometry that seeds the snap search.
snapAperture number SnapService.DEFAULT_SNAP_APERTURE optional The snap tolerance in CSS pixels.
Returns:
The snap result, or undefined if no snap was possible.

Type Definitions

Cesium.SnapService.Result

The result of a successful SnapService#snap. Implementations may return additional properties beyond those listed here.
Properties:
Name Type Attributes Description
snapPoint Cartesian3 <optional>
The snapped point. This is the point to consume.
hitPoint Cartesian3 <optional>
The point where the cursor hit the geometry: the nearest edge point when within the snap aperture, otherwise the surface point under the cursor.
Need help? The fastest way to get answers is from the community and team on the Cesium Forum.