Class GridLayer
java.lang.Object
org.vaadin.addons.componentfactory.leaflet.LeafletObject
org.vaadin.addons.componentfactory.leaflet.layer.Layer
org.vaadin.addons.componentfactory.leaflet.layer.groups.GridLayer
- All Implemented Interfaces:
Serializable,Evented,Identifiable,LayerPopupFunctions,LayerTooltipFunctions,ExecutableFunctions
- Direct Known Subclasses:
TileLayer
Generic class for handling a tiled grid of HTML elements. This is the base
class for all tile layers.
- Since:
- 2020-03-06
- Version:
- 1.0
- Author:
- Gabor Kokeny Email: kokeny19@gmail.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe event types fired by aGridLayerduring the loading and unloading of its tiles.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the geographical bounds outside of which tiles are not loaded.Gets the custom class name assigned to the tile layer.intGets the number of rows and columns of tiles kept before unloading them when panning.Gets the maximum zoom level up to which this layer is displayed (inclusive).Gets the minimum zoom level down to which this layer is displayed (inclusive).doubleGets the opacity of the tiles.intGets the width and height of tiles in the grid.intGets the minimum interval, in milliseconds, between tile updates while panning.intGets the explicit zIndex of the tile layer.booleanisNoWrap()Gets whether the layer is prevented from wrapping around the antimeridian.booleanGets whether new tiles are loaded only when panning ends.booleanGets whether the grid layer is updated on every integer zoom level during a smooth zoom animation.voidonLoad(LeafletEventListener<LeafletEvent> listener) Fired when the grid layer loaded all visible tiles.voidonLoading(LeafletEventListener<LeafletEvent> listener) Fired when the grid layer starts loading tiles.voidonTileError(LeafletEventListener<TileEvent> listener) Fired when there is an error loading a tile.voidonTileLoad(LeafletEventListener<TileEvent> listener) Fired when a tile loads.voidonTileLoadStart(LeafletEventListener<TileEvent> listener) Fired when a tile is requested and starts loading.voidonTileUnload(LeafletEventListener<TileEvent> listener) Fired when a tile is removed (e.g.voidsetBounds(LatLngBounds bounds) If set, tiles will only be loaded inside the set LatLngBounds.voidsetClassName(String className) A custom class name to assign to the tile layer.voidsetKeepBuffer(int keepBuffer) When panning the map, keep this many rows and columns of tiles before unloading them.voidsetMaxZoom(Integer maxZoom) The maximum zoom level up to which this layer will be displayed (inclusive).voidsetMinZoom(Integer minZoom) The minimum zoom level down to which this layer will be displayed (inclusive).voidsetNoWrap(boolean noWrap) Whether the layer is wrapped around the antimeridian.voidsetOpacity(double opacity) Opacity of the tiles.voidsetTileSize(int tileSize) Width and height of tiles in the grid.voidsetUpdateInterval(int updateInterval) Tiles will not update more than once every updateInterval milliseconds when panning.voidsetUpdateWhenIdle(boolean updateWhenIdle) Load new tiles only when panning ends.voidsetUpdateWhenZooming(boolean updateWhenZooming) By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level.voidsetzIndex(int zIndex) The explicit zIndex of the tile layer.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
-
GridLayer
public GridLayer()Creates a new grid layer rendered in the map'stilePane.
-
-
Method Details
-
onLoading
Fired when the grid layer starts loading tiles.- Parameters:
listener- the listener to call when the event occurs, notnull
-
onTileUnload
Fired when a tile is removed (e.g. when a tile goes off the screen).- Parameters:
listener- the listener to call when the event occurs, notnull
-
onTileLoadStart
Fired when a tile is requested and starts loading.- Parameters:
listener- the listener to call when the event occurs, notnull
-
onTileError
Fired when there is an error loading a tile.- Parameters:
listener- the listener to call when the event occurs, notnull
-
onTileLoad
Fired when a tile loads.- Parameters:
listener- the listener to call when the event occurs, notnull
-
onLoad
Fired when the grid layer loaded all visible tiles.- Parameters:
listener- the listener to call when the event occurs, notnull
-
getTileSize
public int getTileSize()Gets the width and height of tiles in the grid.- Returns:
- the tileSize
-
setTileSize
public void setTileSize(int tileSize) Width and height of tiles in the grid.- Parameters:
tileSize- the tileSize to set
-
getOpacity
public double getOpacity()Gets the opacity of the tiles.- Returns:
- the opacity
-
setOpacity
public void setOpacity(double opacity) Opacity of the tiles.- Parameters:
opacity- the opacity to set
-
isUpdateWhenIdle
public boolean isUpdateWhenIdle()Gets whether new tiles are loaded only when panning ends.- Returns:
- the updateWhenIdle
-
setUpdateWhenIdle
public void setUpdateWhenIdle(boolean updateWhenIdle) Load new tiles only when panning ends. true by default on mobile browsers, in order to avoid too many requests and keep smooth navigation. false otherwise in order to display new tiles during panning, since it is easy to pan outside the keepBuffer option in desktop browsers.- Parameters:
updateWhenIdle- the updateWhenIdle to set
-
isUpdateWhenZooming
public boolean isUpdateWhenZooming()Gets whether the grid layer is updated on every integer zoom level during a smooth zoom animation.- Returns:
- the updateWhenZooming
-
setUpdateWhenZooming
public void setUpdateWhenZooming(boolean updateWhenZooming) By default, a smooth zoom animation (during a touch zoom or a flyTo()) will update grid layers every integer zoom level. Setting this option to false will update the grid layer only when the smooth animation ends.- Parameters:
updateWhenZooming- the updateWhenZooming to set
-
getUpdateInterval
public int getUpdateInterval()Gets the minimum interval, in milliseconds, between tile updates while panning.- Returns:
- the updateInterval
-
setUpdateInterval
public void setUpdateInterval(int updateInterval) Tiles will not update more than once every updateInterval milliseconds when panning.- Parameters:
updateInterval- the updateInterval to set
-
getzIndex
public int getzIndex()Gets the explicit zIndex of the tile layer.- Returns:
- the zIndex
-
setzIndex
public void setzIndex(int zIndex) The explicit zIndex of the tile layer.- Parameters:
zIndex- the zIndex to set
-
getBounds
Gets the geographical bounds outside of which tiles are not loaded.- Returns:
- the bounds
-
setBounds
If set, tiles will only be loaded inside the set LatLngBounds.- Parameters:
bounds- the bounds to set
-
getMinZoom
Gets the minimum zoom level down to which this layer is displayed (inclusive).- Returns:
- the minZoom
-
setMinZoom
The minimum zoom level down to which this layer will be displayed (inclusive).- Parameters:
minZoom- the minZoom to set
-
getMaxZoom
Gets the maximum zoom level up to which this layer is displayed (inclusive).- Returns:
- the maxZoom
-
setMaxZoom
The maximum zoom level up to which this layer will be displayed (inclusive).- Parameters:
maxZoom- the maxZoom to set
-
isNoWrap
public boolean isNoWrap()Gets whether the layer is prevented from wrapping around the antimeridian.- Returns:
- the noWrap
-
setNoWrap
public void setNoWrap(boolean noWrap) Whether the layer is wrapped around the antimeridian. If true, the GridLayer will only be displayed once at low zoom levels. Has no effect when the map CRS doesn't wrap around. Can be used in combination with bounds to prevent requesting tiles outside the CRS limits.- Parameters:
noWrap- the noWrap to set
-
getClassName
Gets the custom class name assigned to the tile layer.- Returns:
- the className
-
setClassName
A custom class name to assign to the tile layer. Empty by default.- Parameters:
className- the className to set
-
getKeepBuffer
public int getKeepBuffer()Gets the number of rows and columns of tiles kept before unloading them when panning.- Returns:
- the keepBuffer
-
setKeepBuffer
public void setKeepBuffer(int keepBuffer) When panning the map, keep this many rows and columns of tiles before unloading them.- Parameters:
keepBuffer- the keepBuffer to set
-