Class WLeafletMap.WidgetMarker

Enclosing class:
WLeafletMap

public static class WLeafletMap.WidgetMarker extends WLeafletMap.Marker
A marker rendered with a widget.

This can be used to place arbitrary widgets on the map.

The widgets will stay the same size regardless of the zoom level of the map.

  • Constructor Details

  • Method Details

    • getWidget

      public WWidget getWidget()
      Get the widget.
    • setAnchorPoint

      public void setAnchorPoint(double x, double y)
      Set the anchor point of the marker.

      This determines the "tip" of the marker (relative to its top left corner). The marker will be aligned so that this point is at the marker's geographical location.

      If x is negative, the anchor point is in the horizontal center of the widget. If y is negative, the anchor point is in the vertical center of the widget.

      By default the anchor point is in the middle (horizontal and vertical center).

    • setMap

      protected void setMap(WLeafletMap map)
      Description copied from class: WLeafletMap.AbstractMapItem
      Set the map this item belongs to.

      This is called to set the map the item belongs to. You can override this function if you need to do something when the item is added to a map.

      You should not call this function directly.

      Overrides:
      setMap in class WLeafletMap.Marker
      See Also:
    • createItemJS

      protected void createItemJS(StringBuilder ss, StringBuilder postJS, long id)
      Description copied from class: WLeafletMap.AbstractMapItem
      Writes the JS code to create this item to the stream.

      This method should write in ss the JS code that creates the item. The postJS stream can be used to write JS code that should be executed after the item has been created.

      Specified by:
      createItemJS in class WLeafletMap.AbstractMapItem
    • unrender

      protected void unrender()
      Description copied from class: WLeafletMap.AbstractMapItem
      Unrender the item.

      This is called when the map needs to be recreated. You can override this function in case you need to do some cleanup before the map is recreated.

      By default, this does nothing.

      Overrides:
      unrender in class WLeafletMap.AbstractMapItem
      See Also:
    • needsUpdate

      protected boolean needsUpdate()
      Description copied from class: WLeafletMap.AbstractMapItem
      Return whether this item needs to be updated.

      This is called when the map is rendered. If this returns true, update() will be used to update the item.

      Overrides:
      needsUpdate in class WLeafletMap.AbstractMapItem
    • update

      protected void update(StringBuilder js)
      Description copied from class: WLeafletMap.AbstractMapItem
      Writes the JS to update this item to the stream.

      This is called when the map is rendered if needsUpdate() returns true.

      Overrides:
      update in class WLeafletMap.AbstractMapItem