Class SimpleLayer

All Implemented Interfaces:
JsonSerializable
Direct Known Subclasses:
WorldLayer

@NullMarked public class SimpleLayer extends Layer
Represents a simple layer of markers and other metadata.
  • Constructor Details

    • SimpleLayer

      public SimpleLayer(String key, Supplier<String> labelSupplier)
      Create a new simple layer.
      Parameters:
      key - key for layer
  • Method Details

    • getMarkers

      public Collection<Marker<?>> getMarkers()
      Description copied from class: Layer
      Get the markers to display in this Layer.
      Specified by:
      getMarkers in class Layer
      Returns:
      markers to display
    • addMarker

      public SimpleLayer addMarker(Marker<?> marker)
      Add a new marker to this layer.
      Parameters:
      marker - marker
      Returns:
      this layer
    • removeMarker

      public @Nullable Marker<?> removeMarker(String key)
      Remove a marker from this layer, returning either the removed marker, or null if no marker was present for the provided key.
      Parameters:
      key - key
      Returns:
      the existing marker or null
    • clearMarkers

      public SimpleLayer clearMarkers()
      Remove all registered markers
    • registeredMarkers

      public Map<String,Marker<?>> registeredMarkers()
      Get an unmodifiable view of the registered markers.
      Returns:
      registered markers
    • hasMarker

      public boolean hasMarker(String key)
      Check whether a marker is registered for a key.
      Parameters:
      key - key
      Returns:
      true if marker is registered