activateDrawInteraction (options = {}) {
    this.deactivateDrawInteraction()
    console.info('activate "draw" interaction')

    const geometryOptionsMapping = {
      point: {
        type: 'Point',
        geometryName: 'Point'
      },
      circle: {
        type: 'Circle',
        geometryName: 'Circle'
      },
      box: {
        type: 'Circle',
        geometryName: 'Box',
        geometryFunction: createRegularPolygon(4)
      },
      polygon: {
        type: 'Polygon',
        geometryName: 'Polygon',
        freehand: false
      },
      freehandpolygon: {
        type: 'Polygon',
        geometryName: 'FreeHandPolygon',
        freehand: true
      },
      line: {
        type: 'LineString',
        geometryName: 'Line',
        freehand: false,
        maxPoints: options.maxPoints,
        minPoints: options.minPoints
      },
      freehandline: {
        type: 'LineString',
        geometryName: 'FreeHandLine',
        freehand: true
      }
    }

    if (!('geometryType' in options)) {
      console.error('geometry type must be specified for drawing interaction')
    }

    if (!(options.geometryType in geometryOptionsMapping)) {
      console.error(`unsupported geometry type "${options.geometryType}"`)
    }

    const internalDrawOptions = { source: this[_drawingSource] }
    const geometryDrawOptions = geometryOptionsMapping[options.geometryType]
    const builtInDrawOptions = {
      [Enums.InternalProperties.Marker]:
        options[Enums.InternalProperties.Marker],
      [Enums.InternalProperties.Markup]:
        options[Enums.InternalProperties.Markup],
      vertexEnabled: options.vertexEnabled,
      [Enums.InternalProperties.Label]: options[Enums.InternalProperties.Label]
    }
    const drawOptions = Object.assign(
      internalDrawOptions,
      geometryDrawOptions,
      builtInDrawOptions
    )

    /**
     * This used to define which mouse buttons will fire the action.
     *
     * bindings: {
     *   mouseButtons can be 'left', 'right' and/or 'middle'. if absent, the action is bound to all mouse buttons.
     *   mouseButtons: ['left', 'right'],
     *   modifierKey can be 'shift', 'ctrl' or 'alt'. If not present, the action is bound to no modifier key.
     *   modifierKey: 'ctrl' // The modifier
     * },
     */
    if (options.bindings) {
      drawOptions.condition = _getInteractionBindingCondition(options.bindings)
    }

    this[_interactions].draw = new Draw(drawOptions)
    const container = this[_map].getTargetElement()

    this[_interactions].draw.on(Enums.InteractionEvents.DRAW_START, (event) => {
      event.feature.setProperties(builtInDrawOptions, true)
      event.feature.setId(generateUID())

      /** Set external styles before calling internal annotation hooks */
      _setFeatureStyle(
        event.feature,
        options[Enums.InternalProperties.StyleOptions]
      )

      this[_annotationManager].onDrawStart(event)

      _wireMeasurementsAndQualitativeEvaluationsEvents(
        this[_map],
        event.feature,
        this[_pyramidMetadata]
      )
    })

    this[_interactions].draw.on(Enums.InteractionEvents.DRAW_ABORT, (event) => {
      this[_annotationManager].onDrawAbort(event)
    })

    this[_interactions].draw.on(Enums.InteractionEvents.DRAW_END, (event) => {
      this[_annotationManager].onDrawEnd(event)
      publish(
        container,
        EVENT.ROI_DRAWN,
        this._getROIFromFeature(event.feature, this[_pyramidMetadata])
      )
    })

    this[_map].addInteraction(this[_interactions].draw)
  }
/** Activates the draw interaction for graphic annotation of regions of interest.
   * @param {object} options - Drawing options
   * @param {string} options.geometryType - Name of the geometry type (point, circle, box, polygon, freehandPolygon, line, freehandLine)
   * @param {string} options.marker - Marker
   * @param {string} options.markup - Markup
   * @param {number} options.maxPoints - Geometry max points
   * @param {number} options.minPoints - Geometry min points
   * @param {boolean} options.vertexEnabled - Enable vertex
   * @param {object} options.styleOptions - Style options
   * @param {object} options.styleOptions.stroke - Style options for the outline of the geometry
   * @param {number[]} options.styleOptions.stroke.color - RGBA color of the outline
   * @param {number} options.styleOptions.stroke.width - Width of the outline
   * @param {object} options.styleOptions.fill - Style options for body the geometry
   * @param {number[]} options.styleOptions.fill.color - RGBA color of the body
   * @param {object} options.styleOptions.image - Style options for image
   */
Activates the draw interaction for graphic annotation of regions of interest.
Activates the draw interaction for graphic annotation of regions of interest .
activateDrawInteraction (options = {}) {
    this.deactivateDrawInteraction()
    console.info('activate "draw" interaction')
    const geometryOptionsMapping = {
      point: {
        type: 'Point',
        geometryName: 'Point'
      },
      circle: {
        type: 'Circle',
        geometryName: 'Circle'
      },
      box: {
        type: 'Circle',
        geometryName: 'Box',
        geometryFunction: createRegularPolygon(4)
      },
      polygon: {
        type: 'Polygon',
        geometryName: 'Polygon',
        freehand: false
      },
      freehandpolygon: {
        type: 'Polygon',
        geometryName: 'FreeHandPolygon',
        freehand: true
      },
      line: {
        type: 'LineString',
        geometryName: 'Line',
        freehand: false,
        maxPoints: options.maxPoints,
        minPoints: options.minPoints
      },
      freehandline: {
        type: 'LineString',
        geometryName: 'FreeHandLine',
        freehand: true
      }
    }
    if (!('geometryType' in options)) {
      console.error('geometry type must be specified for drawing interaction')
    }
    if (!(options.geometryType in geometryOptionsMapping)) {
      console.error(`unsupported geometry type "${options.geometryType}"`)
    }
    const internalDrawOptions = { source: this[_drawingSource] }
    const geometryDrawOptions = geometryOptionsMapping[options.geometryType]
    const builtInDrawOptions = {
      [Enums.InternalProperties.Marker]:
        options[Enums.InternalProperties.Marker],
      [Enums.InternalProperties.Markup]:
        options[Enums.InternalProperties.Markup],
      vertexEnabled: options.vertexEnabled,
      [Enums.InternalProperties.Label]: options[Enums.InternalProperties.Label]
    }
    const drawOptions = Object.assign(
      internalDrawOptions,
      geometryDrawOptions,
      builtInDrawOptions
    )
    if (options.bindings) {
      drawOptions.condition = _getInteractionBindingCondition(options.bindings)
    }
    this[_interactions].draw = new Draw(drawOptions)
    const container = this[_map].getTargetElement()
    this[_interactions].draw.on(Enums.InteractionEvents.DRAW_START, (event) => {
      event.feature.setProperties(builtInDrawOptions, true)
      event.feature.setId(generateUID())
      _setFeatureStyle(
        event.feature,
        options[Enums.InternalProperties.StyleOptions]
      )
      this[_annotationManager].onDrawStart(event)
      _wireMeasurementsAndQualitativeEvaluationsEvents(
        this[_map],
        event.feature,
        this[_pyramidMetadata]
      )
    })
    this[_interactions].draw.on(Enums.InteractionEvents.DRAW_ABORT, (event) => {
      this[_annotationManager].onDrawAbort(event)
    })
    this[_interactions].draw.on(Enums.InteractionEvents.DRAW_END, (event) => {
      this[_annotationManager].onDrawEnd(event)
      publish(
        container,
        EVENT.ROI_DRAWN,
        this._getROIFromFeature(event.feature, this[_pyramidMetadata])
      )
    })
    this[_map].addInteraction(this[_interactions].draw)
  }
activateDrawInteraction ( options = { } ) { this . deactivateDrawInteraction ( ) console . info ( 'activate "draw" interaction' ) const geometryOptionsMapping = { point : { type : 'Point' , geometryName : 'Point' } , circle : { type : 'Circle' , geometryName : 'Circle' } , box : { type : 'Circle' , geometryName : 'Box' , geometryFunction : createRegularPolygon ( 4 ) } , polygon : { type : 'Polygon' , geometryName : 'Polygon' , freehand : false } , freehandpolygon : { type : 'Polygon' , geometryName : 'FreeHandPolygon' , freehand : true } , line : { type : 'LineString' , geometryName : 'Line' , freehand : false , maxPoints : options . maxPoints , minPoints : options . minPoints } , freehandline : { type : 'LineString' , geometryName : 'FreeHandLine' , freehand : true } } if ( ! ( 'geometryType' in options ) ) { console . error ( 'geometry type must be specified for drawing interaction' ) } if ( ! ( options . geometryType in geometryOptionsMapping ) ) { console . error ( ` ${ options . geometryType } ` ) } const internalDrawOptions = { source : this [ _drawingSource ] } const geometryDrawOptions = geometryOptionsMapping [ options . geometryType ] const builtInDrawOptions = { [ Enums . InternalProperties . Marker ] : options [ Enums . InternalProperties . Marker ] , [ Enums . InternalProperties . Markup ] : options [ Enums . InternalProperties . Markup ] , vertexEnabled : options . vertexEnabled , [ Enums . InternalProperties . Label ] : options [ Enums . InternalProperties . Label ] } const drawOptions = Object . assign ( internalDrawOptions , geometryDrawOptions , builtInDrawOptions ) if ( options . bindings ) { drawOptions . condition = _getInteractionBindingCondition ( options . bindings ) } this [ _interactions ] . draw = new Draw ( drawOptions ) const container = this [ _map ] . getTargetElement ( ) this [ _interactions ] . draw . on ( Enums . InteractionEvents . DRAW_START , ( event ) => { event . feature . setProperties ( builtInDrawOptions , true ) event . feature . setId ( generateUID ( ) ) _setFeatureStyle ( event . feature , options [ Enums . InternalProperties . StyleOptions ] ) this [ _annotationManager ] . onDrawStart ( event ) _wireMeasurementsAndQualitativeEvaluationsEvents ( this [ _map ] , event . feature , this [ _pyramidMetadata ] ) } ) this [ _interactions ] . draw . on ( Enums . InteractionEvents . DRAW_ABORT , ( event ) => { this [ _annotationManager ] . onDrawAbort ( event ) } ) this [ _interactions ] . draw . on ( Enums . InteractionEvents . DRAW_END , ( event ) => { this [ _annotationManager ] . onDrawEnd ( event ) publish ( container , EVENT . ROI_DRAWN , this . _getROIFromFeature ( event . feature , this [ _pyramidMetadata ] ) ) } ) this [ _map ] . addInteraction ( this [ _interactions ] . draw ) }
Activates the draw interaction for graphic annotation of regions of interest.
Activates the draw interaction for graphic annotation of regions of interest .
/**
     * This used to define which mouse buttons will fire the action.
     *
     * bindings: {
     *   mouseButtons can be 'left', 'right' and/or 'middle'. if absent, the action is bound to all mouse buttons.
     *   mouseButtons: ['left', 'right'],
     *   modifierKey can be 'shift', 'ctrl' or 'alt'. If not present, the action is bound to no modifier key.
     *   modifierKey: 'ctrl' // The modifier
     * },
     */ /** Set external styles before calling internal annotation hooks */