Class Layer<S extends Source>

java.lang.Object
io.jmix.mapsflowui.kit.component.model.MapObservableObject
io.jmix.mapsflowui.kit.component.model.layer.Layer<S>
Type Parameters:
S - source type
All Implemented Interfaces:
HasBaseLayerOptions, Serializable
Direct Known Subclasses:
BaseImageLayer, BaseTileLayer, BaseVectorLayer

public abstract class Layer<S extends Source> extends MapObservableObject implements HasBaseLayerOptions
Base implementation of layer.

For more details see: layer docs

See Also:
  • Field Details

  • Constructor Details

    • Layer

      public Layer()
  • Method Details

    • getId

      public String getId()
      Returns:
      layer's id or null if not set
    • setId

      public void setId(String id)
      Sets layer's id.
      Parameters:
      id - id to set or null to unset value
    • withId

      public Layer<S> withId(String id)
      Parameters:
      id - id to set or null to unset value
      Returns:
      current instance
    • createOptions

      protected abstract BaseLayerOptions createOptions()
    • getOptions

      protected abstract BaseLayerOptions getOptions()
    • getSource

      public abstract <T extends S> T getSource()
      Type Parameters:
      T - the source type
      Returns:
      the layer source or null if not set
    • setSource

      public void setSource(S source)
      Sets source to the layer.

      For more details see: #setSource docs

      Parameters:
      source - source to set
    • withSource

      public Layer<S> withSource(S source)
      Parameters:
      source - source to set
      Returns:
      current instance
    • getClassName

      public String getClassName()
      Specified by:
      getClassName in interface HasBaseLayerOptions
      Returns:
      a CSS class name that should be used by the layer element, null value means that default value is used: 'ol-layer'
    • setClassName

      public void setClassName(String className)
      Description copied from interface: HasBaseLayerOptions
      Set a CSS class name to the layer element. The default value 'ol-layer'.

      Note, CSS class name is set only at creation time and cannot be changed at runtime.

      For more details see: Layer docs

      Specified by:
      setClassName in interface HasBaseLayerOptions
      Parameters:
      className - CSS class name
    • withClassName

      public Layer<S> withClassName(String className)
      Parameters:
      className - CSS class name
      Returns:
      current instance
    • getOpacity

      public Double getOpacity()
      Specified by:
      getOpacity in interface HasBaseLayerOptions
      Returns:
      the opacity of the layer. null value means that default value is used: '1'
    • setOpacity

      public void setOpacity(Double opacity)
      Description copied from interface: HasBaseLayerOptions
      Sets the opacity of the layer, allowed values range from 0 to 1. The default value is '1'.

      For more details see: setOpacity() docs

      Specified by:
      setOpacity in interface HasBaseLayerOptions
      Parameters:
      opacity - opacity of the layer
    • withOpacity

      public Layer<S> withOpacity(Double opacity)
      Parameters:
      opacity - opacity of the layer
      Returns:
      current instance
    • getVisible

      public Boolean getVisible()
      Specified by:
      getVisible in interface HasBaseLayerOptions
      Returns:
      the visibility of the layer. null value means that default value is used: 'true'
    • setVisible

      public void setVisible(Boolean visible)
      Description copied from interface: HasBaseLayerOptions
      Set the visibility of the layer. The default value is true.

      For more details see: setVisible() docs

      Specified by:
      setVisible in interface HasBaseLayerOptions
      Parameters:
      visible - whether layer should be visible
    • withVisible

      public Layer<S> withVisible(Boolean visible)
      Parameters:
      visible - whether layer should be visible
      Returns:
      current instance
    • getExtent

      public Extent getExtent()
      Specified by:
      getExtent in interface HasBaseLayerOptions
      Returns:
      the bounding extent for layer rendering or null if not set
    • setExtent

      public void setExtent(Extent extent)
      Description copied from interface: HasBaseLayerOptions
      Sets the bounding extent for layer rendering. The layer will not be rendered outside of this extent. If not set, the layer will be visible at all extents.

      For more details see: setExtent() docs

      Specified by:
      setExtent in interface HasBaseLayerOptions
      Parameters:
      extent - extent at which the layer is visible
    • withExtent

      public Layer<S> withExtent(Extent extent)
      Parameters:
      extent - extent at which the layer is visible
      Returns:
      current instance
    • getZIndex

      public Integer getZIndex()
      Specified by:
      getZIndex in interface HasBaseLayerOptions
      Returns:
      z-index for layer rendering or null if not set
    • setZIndex

      public void setZIndex(Integer zIndex)
      Description copied from interface: HasBaseLayerOptions
      Sets the z-index for layer rendering.

      At rendering time, the layers will be ordered, first by Z-index and then by position. The default value is 0.

      For more details see: setZIndex() docs

      Specified by:
      setZIndex in interface HasBaseLayerOptions
      Parameters:
      zIndex - z-index for layer rendering
    • withZIndex

      public Layer<S> withZIndex(Integer zIndex)
      Parameters:
      zIndex - z-index for layer rendering
      Returns:
      current instance
    • getMinZoom

      public Double getMinZoom()
      Specified by:
      getMinZoom in interface HasBaseLayerOptions
      Returns:
      the minimum view zoom level (exclusive) above which layer will be visible or null if not set
    • setMinZoom

      public void setMinZoom(Double minZoom)
      Description copied from interface: HasBaseLayerOptions
      Sets the minimum view zoom level (exclusive) above which layer will be visible. Note that the zoom levels for layer visibility are based on the view zoom level, which may be different from a tile source zoom level.

      For more details see: setMinZoom() docs

      Specified by:
      setMinZoom in interface HasBaseLayerOptions
      Parameters:
      minZoom - zoom level (exclusive) above which layer will be visible
    • withMinZoom

      public Layer<S> withMinZoom(Double minZoom)
      Parameters:
      minZoom - zoom level (exclusive) above which layer will be visible
      Returns:
      current instance
    • getMaxZoom

      public Double getMaxZoom()
      Specified by:
      getMaxZoom in interface HasBaseLayerOptions
      Returns:
      the maximum view zoom level (inclusive) at which layer will be visible or null if not set
    • setMaxZoom

      public void setMaxZoom(Double maxZoom)
      Description copied from interface: HasBaseLayerOptions
      Sets the maximum view zoom level (inclusive) at which layer will be visible. Note that the zoom levels for layer visibility are based on the view zoom level, which may be different from a tile source zoom level.

      For more details see: setMaxZoom() docs

      Specified by:
      setMaxZoom in interface HasBaseLayerOptions
      Parameters:
      maxZoom - zoom level (inclusive) at which layer will be visible
    • withMaxZoom

      public Layer<S> withMaxZoom(Double maxZoom)
      Parameters:
      maxZoom - zoom level (inclusive) at which layer will be visible
      Returns:
      current instance