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

public class ImageOverlay extends InteractiveLayer
Used to load and display a single image over specific bounds of the map. Extends InteractiveLayer.
Since:
2020-03-06
Version:
1.0
Author:
Gabor Kokeny Email: kokeny19@gmail.com
See Also:
  • Constructor Details

    • ImageOverlay

      public ImageOverlay(String imageUrl)
      Instantiates an image overlay object given the URL of the image and the geographical bounds it is tied to.
      Parameters:
      imageUrl - the image url
  • Method Details

    • onLoad

      public void onLoad(LeafletEventListener<LeafletEvent> listener)
      Fired when the ImageOverlay layer has loaded its image
      Parameters:
      listener - the listener to call when the event occurs, not null
    • onError

      public void onError(LeafletEventListener<LeafletEvent> listener)
      Fired when the ImageOverlay layer fails to load its image
      Parameters:
      listener - the listener to call when the event occurs, not null
    • getImageUrl

      public String getImageUrl()
      Gets the URL of the image displayed by this overlay.
      Returns:
      the imageUrl
    • getOpacity

      public double getOpacity()
      Gets the opacity of the image overlay.
      Returns:
      the opacity
    • setOpacity

      public void setOpacity(double opacity)
      The opacity of the image overlay.
      Parameters:
      opacity - the opacity to set
    • getAlt

      public String getAlt()
      Gets the text used for the alt attribute of the image.
      Returns:
      the alt
    • setAlt

      public void setAlt(String alt)
      Text for the alt attribute of the image (useful for accessibility).
      Parameters:
      alt - the alt to set
    • getCrossOrigin

      public String getCrossOrigin()
      Gets the crossOrigin attribute value applied to the image.
      Returns:
      the crossOrigin
    • setCrossOrigin

      public void setCrossOrigin(String crossOrigin)
      Whether the crossOrigin attribute will be added to the image. If a String is provided, the image will have its crossOrigin attribute set to the String provided. This is needed if you want to access image pixel data. Refer to CORS Settings for valid String values.
      Parameters:
      crossOrigin - the crossOrigin to set
    • getErrorOverlayUrl

      public String getErrorOverlayUrl()
      Gets the URL of the image shown when the overlay image fails to load.
      Returns:
      the errorOverlayUrl
    • setErrorOverlayUrl

      public void setErrorOverlayUrl(String errorOverlayUrl)
      URL to the overlay image to show in place of the overlay that failed to load.
      Parameters:
      errorOverlayUrl - the errorOverlayUrl to set
    • getzIndex

      public int getzIndex()
      Gets the explicit zIndex of the overlay layer.
      Returns:
      the zIndex
    • setzIndex

      public void setzIndex(int zIndex)
      The explicit zIndex of the overlay layer.
      Parameters:
      zIndex - the zIndex to set
    • getClassName

      public String getClassName()
      Gets the custom class name assigned to the image.
      Returns:
      the className
    • setClassName

      public void setClassName(String className)
      A custom class name to assign to the image. Empty by default.
      Parameters:
      className - the className to set
    • getBounds

      public LatLngBounds getBounds()
      Gets the geographical bounds the image is tied to.
      Returns:
      the bounds
    • setBounds

      public void setBounds(LatLngBounds bounds)
      Sets the geographical bounds the image is tied to.
      Parameters:
      bounds - the bounds to set