All Implemented Interfaces:
Serializable, Evented, SupportsDragEvents, SupportsMouseEvents, Identifiable, LayerPopupFunctions, LayerTooltipFunctions, ExecutableFunctions, MarkerFunctions

public class Marker extends InteractiveLayer implements SupportsDragEvents, MarkerFunctions
L.Marker is used to display clickable/draggable icons on the map. Extends InteractiveLayer.
Since:
2020-02-06
Version:
1.0
Author:
Gabor Kokeny Email: kokeny19@gmail.com
See Also:
  • Constructor Details

    • Marker

      public Marker()
      Instantiates a new marker without a location and assigns it to the markerPane.
    • Marker

      public Marker(LatLng latLng)
      Instantiates a Marker object given a geographical point and optionally an options object.
      Parameters:
      latLng - the geographical point
  • Method Details

    • getLatLng

      public LatLng getLatLng()
      Returns the geographical point where the marker is placed.
      Returns:
      the geographical point of the marker
    • setLatLng

      public void setLatLng(LatLng latLng)
      Changes the marker position to the given point.
      Specified by:
      setLatLng in interface MarkerFunctions
      Parameters:
      latLng - the geographical point where the marker is placed
    • getTitle

      public String getTitle()
      Returns the text shown in a native browser tooltip when hovering the marker.
      Returns:
      the title of the marker
    • setTitle

      public void setTitle(String title)
      Sets the text shown in a native browser tooltip when hovering the marker.
      Parameters:
      title - the title of the marker
    • getOpacity

      public double getOpacity()
      Returns the opacity of the marker, between 0 and 1.
      Returns:
      the opacity of the marker
    • setOpacity

      public void setOpacity(double opacity)
      Sets the opacity of the marker, between 0 and 1.
      Specified by:
      setOpacity in interface MarkerFunctions
      Parameters:
      opacity - the opacity of the marker
    • getIcon

      public Icon getIcon()
      Returns the icon used to render the marker.
      Specified by:
      getIcon in interface MarkerFunctions
      Returns:
      the icon of the marker
    • setIcon

      public void setIcon(Icon icon)
      Sets the icon used to render the marker.
      Specified by:
      setIcon in interface MarkerFunctions
      Parameters:
      icon - the icon of the marker
    • isDraggable

      public boolean isDraggable()
      Returns whether the marker can be dragged with the mouse or touch.
      Returns:
      true if the marker is draggable, false otherwise
    • setDraggable

      public void setDraggable(boolean draggable)
      Sets whether the marker can be dragged with the mouse or touch.
      Parameters:
      draggable - true to make the marker draggable, false otherwise
    • isAutoPan

      public boolean isAutoPan()
      Returns whether the map is panned when a dragged marker is moved close to the map edges.
      Returns:
      true if the map auto-pans while dragging, false otherwise
    • setAutoPan

      public void setAutoPan(boolean autoPan)
      Sets whether the map is panned when a dragged marker is moved close to the map edges.
      Parameters:
      autoPan - true to auto-pan the map while dragging, false otherwise
    • getAutoPanSpeed

      public int getAutoPanSpeed()
      Returns the number of pixels the map is panned per animation frame during auto-panning.
      Returns:
      the auto-pan speed, in pixels per frame
    • setAutoPanSpeed

      public void setAutoPanSpeed(int autoPanSpeed)
      Sets the number of pixels the map is panned per animation frame during auto-panning.
      Parameters:
      autoPanSpeed - the auto-pan speed, in pixels per frame
    • isKeyboard

      public boolean isKeyboard()
      Returns whether the marker can be focused and moved with the keyboard.
      Returns:
      true if the marker is keyboard-accessible, false otherwise
    • setKeyboard

      public void setKeyboard(boolean keyboard)
      Sets whether the marker can be focused and moved with the keyboard.
      Parameters:
      keyboard - true to make the marker keyboard-accessible, false otherwise
    • getZIndexOffset

      public int getZIndexOffset()
      Returns the offset applied to the z-index of the marker's icon, used to control its stacking order.
      Returns:
      the z-index offset of the marker
    • setZIndexOffset

      public void setZIndexOffset(int zIndexOffset)
      Sets the offset applied to the z-index of the marker's icon, used to control its stacking order.
      Specified by:
      setZIndexOffset in interface MarkerFunctions
      Parameters:
      zIndexOffset - the z-index offset of the marker
    • isRiseOnHover

      public boolean isRiseOnHover()
      Returns whether the marker is brought to the front on hover.
      Returns:
      true if the marker rises on hover, false otherwise
    • setRiseOnHover

      public void setRiseOnHover(boolean riseOnHover)
      Sets whether the marker is brought to the front on hover.
      Parameters:
      riseOnHover - true to bring the marker to the front on hover, false otherwise
    • getRiseOffset

      public int getRiseOffset()
      Returns the z-index offset applied to the marker when it rises on hover.
      Returns:
      the rise offset of the marker
    • setRiseOffset

      public void setRiseOffset(int riseOffset)
      Sets the z-index offset applied to the marker when it rises on hover.
      Parameters:
      riseOffset - the rise offset of the marker
    • getAutoPanPadding

      public Point getAutoPanPadding()
      Returns the padding kept between a dragged marker and the map borders that triggers auto-panning.
      Returns:
      the auto-pan padding, in pixels
    • setAutoPanPadding

      public void setAutoPanPadding(Point autoPanPadding)
      Sets the padding kept between a dragged marker and the map borders that triggers auto-panning.
      Parameters:
      autoPanPadding - the auto-pan padding, in pixels
    • getAlt

      public String getAlt()
      Returns the text set for the alt attribute of the marker's icon, for accessibility purposes.
      Returns:
      the alternative text of the marker
    • setAlt

      public void setAlt(String alt)
      Sets the text used for the alt attribute of the marker's icon, for accessibility purposes.
      Parameters:
      alt - the alternative text of the marker