Class DetourEditor

DetourEditor

The DetourEditor is responsible for creating and editing detours

To construct a new DetourEditor, you need to provide an OpenLayers map instance:

const detourEditor = new sww.DetourEditor({
map: map
});

This will allow the user to create two types of lines:

  • closed_way_line: The closed way line
  • detour_line: The detour line

To edit an existing detour, you can provide the uuid of the detour:

const detourEditor = new sww.DetourEditor({
map: map,
uuid: "1234-5678-91011"
});

To save the detour to the server, call the DetourEditor.save function:

To update the properties of the detour that are not related to the geometries (for example the title, description, or any other property), call the DetourEditor.updateDetourProperties function and pass an object with the properties to update:

detourEditor.updateDetourProperties({
title: {"fr": "title fr", "de": "title de", "it": "title it", "en": "title en"},
url: "https://www.suisse-rando.ch",
});

Constructors

  • Parameters

    • options: DetourEditorOptions

    Returns DetourEditor

Accessors

  • get detourLineType(): "closed_way_line" | "detour_line"
  • Returns "closed_way_line" | "detour_line"

  • set detourLineType(value): void
  • Parameters

    • value: "closed_way_line" | "detour_line"

    Returns void

  • get edit(): boolean
  • Returns boolean

  • set edit(value): void
  • Parameters

    • value: boolean

    Returns void

  • get snapping(): boolean
  • Returns boolean

  • set snapping(value): void
  • Parameters

    • value: boolean

    Returns void

Methods

  • Returns the uuid of the detour. If the detour is not saved yet, this function returns undefined.

    Returns undefined | string

  • Redo the last action

    Returns void

  • Create or update the detour to the server

    Returns Promise<string>

  • Undo the last action

    Returns void

  • Update the detour properties

    Parameters

    • properties: Record<string, unknown>

    Returns void