Documentation
    Preparing search index...

    Internal API for the Measurement tool and layer to display measurements.

    Hierarchy

    • MeasurementAnnotationSupport
      • CustomMeasurementSupport
    Index

    Constructors

    Properties

    _annotationController: null | Ruler3DController<MeasurementSegment>
    _creationBounds: null | Bounds
    _eventedSupport: EventedSupport
    _layer: FeatureLayer
    _map: Map
    _onControllerChange: (controller: null | Controller) => void
    _projectorPlaneMeshUrl: string
    _store: MemoryStore<MeasurementFeature>
    _styles: MeasurementAnnotationStyles
    _switchingControllers: boolean

    Methods

    • Creates a controller that will be used for creating a new annotation and initializes it in such a way that emitControllerActiveStateChanged and emitAnnotationCreated are called correctly.

      Parameters

      • options: CreateMeasurementOptions

      Returns Ruler3DController

    • Returns a new feature that represents the given annotation.

      Parameters

      • annotation: MeasurementAnnotation

      Returns MeasurementFeature

    • Creates the layer that will be used to display the annotation features on the map.

      Parameters

      • store: MemoryStore<MeasurementFeature>
      • options: MeasurementAnnotationSupportCreateOptions

      Returns FeatureLayer

    • Removes the hover and selection change handles that this annotation support has on the map. Also removes the annotation layer from its parent if there is any. Call this when you are no longer using this support.

      Returns void

    • Triggers the listeners of onAnnotationCreated

      Parameters

      • id: string
      • createdAnnotationInfo: Measurement
      • lookAt: LookAt

      Returns void

    • Triggers the listeners of onControllerActiveStateChanged

      Parameters

      • state: boolean

      Returns void

    • Returns whether the controller that is currently active was created with the given options or not

      Parameters

      • options: CreateMeasurementOptions

      Returns boolean

    • Event that is triggered when an annotation has been created by a user. Typically, the arguments from the callback function are used to create a new AnnotationFeature, which is then passed to the updateAnnotations method of this class, together with the previously created annotations.

      Parameters

      • callback: (id: string, createdAnnotationInfo: Measurement, lookAt: LookAt) => void

        the callback to be invoked when the annotation was created. The arguments contain an identifier, annotation information and camera LookAt that corresponds to the camera state when creating the annotation.

      Returns Handle

    • Event that is triggered when a change has been detected in the list of annotations that are currently hovered by the user.

      Parameters

      • callback: (ids: string[]) => void

        the callback to be invoked when the hovering change is detected. The ids argument contain a list of identifiers specifying which annotations are currently hovered.

      Returns Handle

    • Event that is triggered when a change has been detected in the list of annotations that are currently selected by the user.

      Parameters

      • callback: (ids: string[]) => void

        the callback to be invoked when the selection change is detected. The ids argument contain a list of identifiers specifying which annotations are currently selected.

      Returns Handle

    • Event that is triggered when the controller used to create annotations is enabled or disabled

      Parameters

      • callback: (state: boolean) => void

        the callback to be invoked when the controller is changed. The state argument specifies whether the controller is still active or not.

      Returns Handle

    • Resets the current measurement, if creation is currently active. This will cause the current measurement to be empty of points, but still allows a user to add points.

      Returns void

    • Sets the bounds in which annotations are allowed to be created. If these are omitted, creation is unrestricted. Changing this while the user is already creating an annotation has no effect.

      Parameters

      • bounds: null | Bounds

      Returns void

    • Sets whether the annotation labels should always be painted for visible annotations, instead of only when they're being hovered/selected.

      Parameters

      • isAlwaysVisible: boolean

      Returns void

    • Updates the annotations handled by this support class. This class calculates the difference between the given arguments and the current state on the map and does the necessary to ensure that the map's state will correspond to the given arguments.

      Parameters

      • annotations: MeasurementAnnotation[]

        the annotations that this support is managing. Note that for optimal performance, it is best to define the position of the annotations in the same modelReference as used by the support.

      • hoveredAnnotationIds: string[]

        the identifiers of the annotations that should be hovered. This allows to highlight annotations from the UI.

      • selectedAnnotationIds: string[]

        the identifiers of the annotations that should be selected. This allows to select annotations from the UI.

      Returns void

    • Updates whether the user should be creating an annotation or just seeing/interacting with them. When the creating argument is true, AnnotationSupportCreateOptions.onControllerChange onControllerChange is called to set a controller on the map that allows a user to create annotations. If it is false, AnnotationSupportCreateOptions.onControllerChange onControllerChange is called with null to removed that controller from the map.

      Parameters

      • creating: boolean
      • options: CreateMeasurementOptions

      Returns void

    • Updates the given feature to match the given annotation.

      Parameters

      • feature: MeasurementFeature
      • annotation: MeasurementAnnotation

      Returns boolean

      whether the feature was modified or not