Class HeatMapLayer

java.lang.Object
io.jmix.mapsui.component.layer.HeatMapLayer
All Implemented Interfaces:
Layer, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

public class HeatMapLayer extends Object
A layer providing a visual representation of data density across a set of geographical points.

The layer's data can be provided either by data container or by providing data delegate which builds a map of points and their intensity values.

  • Field Details

    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
  • Constructor Details

    • HeatMapLayer

      public HeatMapLayer(String id)
  • Method Details

    • getOptions

      public HeatMapOptions getOptions()
      Returns heatmap options.
    • setOptions

      public void setOptions(HeatMapOptions options)
      Sets custom heatmap options.
    • getDataDelegate

      public Function<HeatMapLayer,Map<org.locationtech.jts.geom.Point,Double>> getDataDelegate()
      Returns a function which will be used to load a map of points and their intensity values.
    • setDataDelegate

      public void setDataDelegate(Function<HeatMapLayer,Map<org.locationtech.jts.geom.Point,Double>> dataDelegate)
      Sets a function which will be used to load a map of points and their intensity values.

      If this function is specified along with dataContainer, the dataContainer will be ignored and this function will be used to obtain the heatmap data.

    • getDataContainer

      public CollectionContainer<?> getDataContainer()
      Returns a data container which is used to obtain the heatmap points.
    • setDataContainer

      @StudioProperty(type=COLLECTION_DATACONTAINER_REF) public void setDataContainer(CollectionContainer<?> dataContainer)
      Sets a data container which will be used to obtain the heatmap points.

      The items of the data container should be geo-objects having a Geometry property of Point type. The intensity value of each point equals 1 by default. If the intensity value should be taken from some other property (for example, 'amount'), this property can be specified in setIntensityProperty(String). If the intensity value should be calculated another way, consider using setDataDelegate(java.util.function.Function<io.jmix.mapsui.component.layer.HeatMapLayer, java.util.Map<org.locationtech.jts.geom.Point, java.lang.Double>>) instead of this method, to build your own map of points and their intensity values.

      The layer does not react to changes in the data container, so if you need to update the layer, invoke Layer.refresh() method.

    • getIntensityProperty

      public String getIntensityProperty()
      Returns a property which value defines the intensity of the point on a heatmap.
    • setIntensityProperty

      @StudioProperty(type=STRING) public void setIntensityProperty(String intensityProperty)
      Sets a property which value defines the intensity of the point on a heatmap.

      Used in combination with setDataContainer(io.jmix.ui.model.CollectionContainer<?>) to mark the property of the data container's entity meta-class.

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • setMaxZoom

      public void setMaxZoom(int maxZoom)
      Description copied from interface: Layer
      Sets maximum zoom level up to which the layer is visible (inclusive).
      Specified by:
      setMaxZoom in interface Layer
      Parameters:
      maxZoom - maximum layer zoom level
    • getMaxZoom

      public int getMaxZoom()
      Description copied from interface: Layer
      Returns maximum layer zoom level.
      Specified by:
      getMaxZoom in interface Layer
      Returns:
      maximum layer zoom level
    • setMinZoom

      public void setMinZoom(int minZoom)
      Description copied from interface: Layer
      Sets minimum zoom level down to which the layer is visible (inclusive).

      Default value: 0.

      Specified by:
      setMinZoom in interface Layer
      Parameters:
      minZoom - minimum layer zoom level
    • getMinZoom

      public int getMinZoom()
      Description copied from interface: Layer
      Returns minimum layer zoom level.
      Specified by:
      getMinZoom in interface Layer
      Returns:
      minimum layer zoom level
    • getId

      public String getId()
      Specified by:
      getId in interface Layer
      Returns:
      ID of a layer
    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: Layer
      Sets whether the layer should be visible on a map.

      Default value: true.

      Specified by:
      setVisible in interface Layer
      Parameters:
      visible - true/false
    • isVisible

      public boolean isVisible()
      Description copied from interface: Layer
      Whether the layer is to be visible on a map.
      Specified by:
      isVisible in interface Layer
      Returns:
      true if the layer is set to be visible; otherwise false
    • setEditable

      public void setEditable(boolean editable)
      Description copied from interface: Layer
      Sets whether the layer is to be editable on a map.

      Default value: false.

      Specified by:
      setEditable in interface Layer
      Parameters:
      editable - true/false
    • isEditable

      public boolean isEditable()
      Description copied from interface: Layer
      Whether the layer is to be editable on a map.
      Specified by:
      isEditable in interface Layer
      Returns:
      true if the layer is set to be editable; otherwise false
    • fireLayerChangedEvent

      protected void fireLayerChangedEvent(LayerChangedEvent event)
    • refresh

      public void refresh()
      Description copied from interface: Layer
      Notify clients that the layer has changed and need to be redrawn.
      Specified by:
      refresh in interface Layer
    • toString

      public String toString()
      Overrides:
      toString in class Object