Skip to content

Routing plugin, hint please #18

@darionis

Description

@darionis

Hello,

I am trying to create a plugin for leaflet-routing-machine.

I started with

@NpmPackage(value = "leaflet-routing-machine", version = "3.2.12")
@JsModule("leaflet-routing-machine/dist/leaflet-routing-machine.js")
@CssImport(value = "leaflet-routing-machine/dist/leaflet-routing-machine.css", themeFor = "leaflet-map")
public class Routing extends Layer {
}

but I am really clueles about JS, so I need a quick hint, how to this with vaadin:

L.Routing.control({
  waypoints: [
    L.latLng(57.74, 11.94),
    L.latLng(57.6792, 11.949)
  ]
}).addTo(map);

I guess I somehow need to get hold of 'control' instance and pass waypoints, right? I will be able to work with it myself, but I just need small hint to get going:

  1. how do I get 'control' instance inside my Routing class?
  2. is extending Layer ok? Or shoud I extend LeafletControl

I have been through other plugins code, but they seem to be much simpler, so I wasn't able to figure it out myself.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions