Class DivPointIcon


public class DivPointIcon extends AbstractCustomPointIcon
A fully custom lightweight icon for points that uses a <div> element instead of an image.

This type of icon allows you to specify an html code that will be used as an icon.

  • Constructor Details

    • DivPointIcon

      protected DivPointIcon(String html)
      Creates an icon that uses the given <div> element instead of an image.
  • Method Details

    • getIcon

      public String getIcon()
    • getStyles

      public String getStyles()
    • setStyles

      public DivPointIcon setStyles(String styles)
      Sets one or more user-defined CSS style names for the <div> element. Multiple styles can be specified as space-separated list of style names.

      Replaces the default style, which is a white square. So, to get rid of the white square, specify any style name (for example, my-div-style).

    • setIconAnchor

      public DivPointIcon setIconAnchor(double x, double y)
      Description copied from class: AbstractCustomPointIcon
      Sets the coordinates of the "tip" of the icon in pixels (relative to its top left corner). The icon will be aligned so that this point matches the geographical coordinates of a layer's point. By default: centered if size is specified and equals the top left corner when size is not specified.
      Overrides:
      setIconAnchor in class AbstractCustomPointIcon
      Returns:
      the instance on which this method was called. Useful for a fluent API.
    • setIconSize

      public DivPointIcon setIconSize(double x, double y)
      Does not affect size of the html content. Effectively needed for specifying iconAnchor and popupAnchor options.
      Overrides:
      setIconSize in class AbstractCustomPointIcon
      Returns:
      the instance on which this method was called. Useful for a fluent API.
    • setPopupAnchor

      public DivPointIcon setPopupAnchor(double x, double y)
      Description copied from class: AbstractCustomPointIcon
      Sets the coordinates of the point from which popups will open (relative to the icon anchor). By default: equals the icon anchor, so relative coordinates = [0, 0].
      Overrides:
      setPopupAnchor in class AbstractCustomPointIcon
      Returns:
      the instance on which this method was called. Useful for a fluent API.