Package org.vaadin.addons.maplibre
Class MapLibre
java.lang.Object
com.vaadin.flow.component.Component
org.vaadin.addons.velocitycomponent.AbstractVelocityJsComponent
org.vaadin.addons.maplibre.MapLibre
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,Serializable
@Tag("div")
public class MapLibre
extends org.vaadin.addons.velocitycomponent.AbstractVelocityJsComponent
implements com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle
A Java/Vaadin API for MapLibre GL JS.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassstatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LayeraddFillLayer(String name, String source, String sourceLayer, FillPaint paintJson, org.locationtech.jts.geom.Geometry geom) addFillLayer(org.locationtech.jts.geom.Polygon polygon, FillPaint style) protected LayeraddLineLayer(String name, String source, String sourceLayer, LinePaint paint, org.locationtech.jts.geom.Geometry geom) addLineLayer(org.locationtech.jts.geom.Geometry geometry, LinePaint linePaint) voidaddMapClickListener(MapLibre.MapClickListener listener) addMarker(double x, double y) voidvoidfitTo(org.locationtech.jts.geom.Geometry geom, double padding) voidflyTo(double x, double y, double zoom) voidflyTo(org.locationtech.jts.geom.Geometry geometry, int i) org.locationtech.jts.geom.Coordinateprotected org.apache.velocity.VelocityContextprotected voidprotected com.vaadin.flow.component.page.PendingJavaScriptResultExecutes given JS in the context of the map component, either right away, or right after initial loading is done.protected voidLoads the MapLibre JS library to the host page.voidremoveLayer(Layer layer) voidsetCenter(double x, double y) voidsetZoomLevel(int zoomLevel) Methods inherited from class org.vaadin.addons.velocitycomponent.AbstractVelocityJsComponent
jsTemplate, velocityJs, velocityJs, velocityJsMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
MapLibre
-
MapLibre
-
MapLibre
-
-
Method Details
-
loadMapLibreJs
protected void loadMapLibreJs()Loads the MapLibre JS library to the host page. Not using @JavaScript annotation, as not all users necessarily want to use the unpkg.com CDN.Override if you want for example to load it from a local file instead of from unpkg.com.
-
getZoomLevel
-
getCenter
public org.locationtech.jts.geom.Coordinate getCenter() -
getMapStyle
-
addLineLayer
-
addFillLayer
-
addFillLayer
-
addLineLayer
-
removeLayer
-
addSource
-
addMarker
-
getVelocityContext
protected org.apache.velocity.VelocityContext getVelocityContext()- Overrides:
getVelocityContextin classorg.vaadin.addons.velocitycomponent.AbstractVelocityJsComponent
-
setCenter
public void setCenter(double x, double y) -
setZoomLevel
public void setZoomLevel(int zoomLevel) -
fitTo
public void fitTo(org.locationtech.jts.geom.Geometry geom, double padding) -
flyTo
public void flyTo(double x, double y, double zoom) -
js
protected com.vaadin.flow.component.page.PendingJavaScriptResult js(String js, Map<String, Object> variables) Executes given JS in the context of the map component, either right away, or right after initial loading is done.- Parameters:
js- the JS to execute, map and component variables are initialized automatically.- Returns:
-
js
-
flyTo
public void flyTo(org.locationtech.jts.geom.Geometry geometry, int i) -
addMapClickListener
-