Class HeatLayer
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.LeafletObject
org.vaadin.addons.componentfactory.leaflet.layer.Layer
org.vaadin.addons.componentfactory.leaflet.plugins.heatmap.HeatLayer
- All Implemented Interfaces:
Serializable,Evented,Identifiable,LayerPopupFunctions,LayerTooltipFunctions,ExecutableFunctions
@NpmPackage(value="leaflet.heat",
version="0.2.0")
@JsModule("leaflet.heat/dist/leaflet-heat.js")
public class HeatLayer
extends Layer
Leaflet.heat
A tiny, simple and fast Leaflet heatmap plugin. Uses leaflet.heat which uses simpleheat under the hood, additionally clustering points into a grid for performance.Heatmap options
- minOpacity - the minimum opacity the heat will start at
- maxZoom - zoom level where the points reach maximum intensity (as intensity scales with zoom), equals maxZoom of the map by default
- max - maximum point intensity, 1.0 by default
- radius - radius of each "point" of the heatmap, 25 by default
- blur - amount of blur, 15 by default
- gradient - color gradient config, e.g. {0.4: 'blue', 0.65: 'lime', 1: 'red'}
Basic Usage
HeatLayer heatLayer = new HeatLayer(); heatLayer.setLatLngs(randomLatLngs()); heatLayer.setOptions(new HeatLayerOptions()); heatLayer.addTo(leafletMap);
- Since:
- 2020-05-25
- Version:
- 1.0
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
Layer.LayerEventType -
Field Summary
Fields inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
DEFAULT_PANE -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a heatmap layerConstructs a heatmap layer given an array of pointsHeatLayer(List<LatLng> latLngs, HeatLayerOptions options) Constructs a heatmap layer given an array of points and an object with the following optionsHeatLayer(HeatLayerOptions options) Constructs a heatmap layer with custom layer options -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a new point to the heatmap and redraws it.doublegetBlur()Returns the amount of blur applied to the heatmap.Returns the color gradient configuration mapping intensity ratios to colors.Returns the list of weighted points currently rendered by this heatmap.doublegetMax()Returns the maximum point intensity.intReturns the zoom level at which the points reach maximum intensity.doubleReturns the minimum opacity the heat will start at.doubleReturns the radius of each point of the heatmap.voidredraw()Redraws the heatmap.voidsetLatLngs(List<LatLng> laLngs) Resets heatmap data and redraws it.voidsetOptions(HeatLayerOptions options) Sets new heatmap options and redraws it.Methods inherited from class org.vaadin.addons.componentfactory.leaflet.layer.Layer
addEventListener, addTo, addTo, bindPopup, bindPopup, bindTooltip, bindTooltip, clearAllEventListeners, fireEvent, getAttribution, getEvents, getPane, getPopup, getTooltip, hasEventListeners, onAdd, onPopupClose, onPopupOpen, onRemove, onTooltipClose, onTooltipOpen, remove, removeEventListener, set, setAttribution, setPane, unbindPopup, unbindTooltipMethods inherited from class org.vaadin.addons.componentfactory.leaflet.LeafletObject
call, configureObjectMapper, executeJs, getConstructorArgumentNames, getJson, getLeafletType, getParent, getUuid, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.events.Evented
listens, off, off, onMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.map.functions.ExecutableFunctions
call, call, executeJs, executeJsMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.Identifiable
getUuidMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerPopupFunctions
closePopup, isPopupOpen, openPopup, openPopup, setPopupContent, setPopupContent, togglePopupMethods inherited from interface org.vaadin.addons.componentfactory.leaflet.layer.LayerTooltipFunctions
closeTooltip, isTooltipOpen, openTooltip, openTooltip, setTooltipContent, setTooltipContent, toggleTooltip
-
Constructor Details
-
HeatLayer
public HeatLayer()Constructs a heatmap layer -
HeatLayer
Constructs a heatmap layer given an array of points- Parameters:
latLngs- the initial points to be added
-
HeatLayer
Constructs a heatmap layer with custom layer options- Parameters:
options- the custom options to be used- See Also:
-
HeatLayer
Constructs a heatmap layer given an array of points and an object with the following options- Parameters:
latLngs- the initial points to be addedoptions- the custom options to be used- See Also:
-
-
Method Details
-
addLatLng
Adds a new point to the heatmap and redraws it.- Parameters:
latLng- a new point to be added- See Also:
-
setLatLngs
Resets heatmap data and redraws it.- Parameters:
laLngs- the list of the new points to be added- See Also:
-
setOptions
Sets new heatmap options and redraws it.- Parameters:
options- the custom options to be used
-
redraw
public void redraw()Redraws the heatmap. -
getLatLngs
Returns the list of weighted points currently rendered by this heatmap.- Returns:
- the heatmap points
- See Also:
-
getMinOpacity
public double getMinOpacity()Returns the minimum opacity the heat will start at.- Returns:
- the minimum opacity
-
getMaxZoom
public int getMaxZoom()Returns the zoom level at which the points reach maximum intensity.- Returns:
- the maximum zoom level
-
getMax
public double getMax()Returns the maximum point intensity.- Returns:
- the maximum point intensity
-
getRadius
public double getRadius()Returns the radius of each point of the heatmap.- Returns:
- the point radius
-
getBlur
public double getBlur()Returns the amount of blur applied to the heatmap.- Returns:
- the blur amount
-
getGradient
Returns the color gradient configuration mapping intensity ratios to colors.- Returns:
- the color gradient configuration
-