Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Annotation

JMap.Application.Annotation

You can manage everything related to annotations here.

Index

Functions

addPresetColor

  • addPresetColor(presetColor: string): void
  • JMap.Application.Annotation.addPresetColor

    Add the given color to the preset colors of color pickers if not already present.

    throws

    if presetColor not an string or is empty

    example
    
    // Add the color #D2FDDF to the preset colors
    const presetColor = "#D2FDDF"
    
    JMap.Application.Annotation.addPresetColor(presetColor)

    Parameters

    • presetColor: string

      A hex color

    Returns void

deleteAll

  • deleteAll(): void
  • JMap.Application.Annotation.deleteAll

    Deletes all annotations.

    Does nothing if no annotation exists.

    example
    
    // Delete all annotations
    JMap.Application.Annotation.deleteAll()

    Returns void

deleteByIds

  • deleteByIds(annotationIds: string[]): void
  • JMap.Application.Annotation.deleteByIds

    Deletes the annotations for the given ids.

    throws

    if an annotation array is empty or an annotation is not found for the given ids.

    example
    
    // Delete two annotations
    JMap.Application.Annotation.deleteByIds([
     "d68385b01be3c241c7b6298b2788839d",
     "98ef8ad4476f0e6fa26be416d58d0734"
    ])

    Parameters

    • annotationIds: string[]

      an array of annotation id

    Returns void

deleteByType

  • JMap.Application.Annotation.deleteByType

    Deletes the annotations for the given type.

    Does nothing if no annotation exist for the type.

    throws

    if the annotation type is not correct

    example
    
    // Delete all text annotations if exist
    JMap.Application.Annotation.deleteByType("text")

    Parameters

    • annotationType: JAPP_DRAW_TYPES

      the annotation type : "point", "polygon", "line_string", "rectangle", "circle", or "text"

    Returns void

deletePresetColor

  • deletePresetColor(presetColor: string): void
  • JMap.Application.Annotation.deletePresetColor

    Delete the given color to the preset colors of color pickers if present.

    throws

    if presetColor not an string or is empty

    example
    
    // Delete the color #D2FDDF from the preset colors
    const presetColor = "#D2FDDF"
    
    JMap.Application.Annotation.deletePresetColor(presetColor)

    Parameters

    • presetColor: string

      A hex color

    Returns void

deleteSelected

  • deleteSelected(): void
  • JMap.Application.Annotation.deleteSelected

    Deletes the selected annotations.

    Does nothing if no selection.

    example
    
    // Delete selected annotations
    JMap.Application.Annotation.deleteSelected()

    Returns void

existsById

  • existsById(annotationId: string): boolean
  • JMap.Application.Annotation.existsById

    Returns true if annotation exists for the given id, else false

    throws

    if the annotationId param is not a valid string

    example
    
    // return true if annotation exists, else false
    JMap.Application.Annotation.existsById("d68385b01be3c241c7b6298b2788839d")

    Parameters

    • annotationId: string

      the given annotation id

    Returns boolean

getAll

  • JMap.Application.Annotation.getAll

    Returns all annotations.

    example
    
    // return all annotations
    JMap.Application.Annotation.getAll()

    Returns JAppAnnotation[]

getById

  • JMap.Application.Annotation.getById

    Returns the annotation for the given id.

    throws

    if the annotationId param is not a valid string, or annotation is not found

    example
    
    // return the annotation for the given id
    JMap.Application.Annotation.getById("d68385b01be3c241c7b6298b2788839d")

    Parameters

    • annotationId: string

      the given annotation id

    Returns JAppAnnotation

getDrawMode

  • JMap.Application.Annotation.getDrawMode

    Returns the current draw mode.

    example
    
    // return the current draw mode
    JMap.Application.Annotation.getDrawMode()

    Returns JAPP_DRAW_MODES

getDrawType

  • JMap.Application.Annotation.getDrawType

    Returns the current draw type.

    example
    
    // return the current draw type
    JMap.Application.Annotation.getDrawType()

    Returns JAPP_DRAW_TYPES

getPresetColors

  • getPresetColors(): string[]
  • JMap.Application.Annotation.getPresetColors

    Return the preset colors used by the application's color pickers.

    example
    
    // Get the current preset colors
    JMap.Application.Annotation.getPresetColors()

    Returns string[]

getSelectedIds

  • getSelectedIds(): string[]
  • JMap.Application.Annotation.getSelectedIds

    Returns the ids of the selected annotations.

    Empty array if no annotation is selected

    example
    
    // return ids of selected annotations
    JMap.Application.Annotation.getSelectedIds()

    Returns string[]

getStyle

  • JMap.Application.Annotation.getStyle

    Returns the current style in use for annotation drawing.

    example
    
    // return the current style in use for annotation drawing
    JMap.Application.Annotation.getStyle()

    Returns JAppDrawStyle

setDrawMode

  • JMap.Application.Annotation.setDrawMode

    Sets the annotation draw mode.

    example
    
    // Set the annotation draw mode to "draw"
    JMap.Application.Annotation.setDrawMode("draw")

    Parameters

    Returns void

setDrawType

  • JMap.Application.Annotation.setDrawMode

    Sets the annotation draw mode.

    example
    
    // Set the annotation draw mode to "draw"
    JMap.Application.Annotation.setDrawMode("draw")

    Parameters

    Returns void

setPresetColors

  • setPresetColors(presetColors: string[]): void
  • JMap.Application.Annotation.setPresetColors

    Set the preset colors of color pickers using the given colors.

    throws

    if presetColors not an array, does not contain string or is too big

    example
    
    // Set the preset colors with 2 color
    const presetColors = [
     "#29D1EA",
     "#D2FDDF"
    ]
    
    JMap.Application.Annotation.setPresetColors(presetColors)

    Parameters

    • presetColors: string[]

      A array of preset hex colors

    Returns void

setStyleByAnnotationIds

  • setStyleByAnnotationIds(annotationIds: string[], style: JAppDrawStyle): void
  • JMap.Application.Annotation.setStyleByAnnotationIds

    For given ids, updates annotation style.

    example
    
    const annotationIds = [
     "d68385b01be3c241c7b6298b2788839d",
     "98ef8ad4476f0e6fa26be416d58d0734"
    ]
    
    const customStyle = {
     lineWidth: 3
    }
    
    // Set custom style for 2 annotations
    JMap.Application.Annotation.setStyleByAnnotationIds(annotationIds, customStyle)

    Parameters

    Returns void

updateStyle

  • JMap.Application.Annotation.updateStyle

    Updates annotation style, for the next annotations that will be drawn.

    Merges the new options with current one.

    example
    
    // Set the line width as 3px
    JMap.Application.Annotation.updateStyle({
     lineWidth: 3
    })

    Parameters

    Returns void