public class LMap
extends com.vaadin.ui.AbstractComponentContainer
com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandler
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.HasContextHelp, com.vaadin.ui.Component.Listener
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
Constructor and Description |
---|
LMap() |
Modifier and Type | Method and Description |
---|---|
void |
addBaseLayer(LeafletLayer baseLayer,
java.lang.String name)
Add a base layer with given name.
|
com.vaadin.shared.Registration |
addBaseLayerChangeListener(LeafletBaseLayerChangeListener listener) |
com.vaadin.shared.Registration |
addClickListener(LeafletClickListener listener) |
void |
addComponent(com.vaadin.ui.Component c) |
com.vaadin.shared.Registration |
addContextMenuListener(LeafletContextMenuListener listener) |
void |
addControl(AbstractControl control) |
com.vaadin.shared.Registration |
addDragEndListener(LeafletDragEndListener dragEndListener) |
void |
addLayer(LeafletLayer layer) |
com.vaadin.shared.Registration |
addLocateListener(LeafletLocateListener listener) |
com.vaadin.shared.Registration |
addMoveEndListener(LeafletMoveEndListener moveEndListener) |
void |
addOverlay(LeafletLayer overlay,
java.lang.String name) |
com.vaadin.shared.Registration |
addOverlayAddListener(LeafletOverlayAddListener listener) |
com.vaadin.shared.Registration |
addOverlayRemoveListener(LeafletOverlayRemoveListener listener) |
com.vaadin.shared.Registration |
addZoomEndListener(LeafletZoomEndListener zoomEndListener) |
void |
beforeClientResponse(boolean initial) |
void |
detach() |
void |
flyTo(Point center,
java.lang.Double zoom) |
java.lang.String |
getAttributionPrefix() |
Bounds |
getBounds()
Gets the bounds of the maps "viewport".
|
Point |
getCenter() |
int |
getComponentCount() |
org.locationtech.jts.geom.Geometry |
getContentBounds() |
Crs |
getCrs() |
LLayers |
getLayersControl() |
protected LeafletMapState |
getState() |
protected LeafletMapState |
getState(boolean markAsDirty) |
LZoom |
getZoomControl() |
java.lang.Double |
getZoomLevel() |
boolean |
hasComponent(com.vaadin.ui.Component component) |
boolean |
hasControl(java.lang.Class<? extends AbstractControl> leafletControl) |
boolean |
isBoxZoomEnabled() |
boolean |
isDoubleZoomEnabled() |
boolean |
isDraggingEnabled() |
boolean |
isKeyboardZoomEnabled() |
boolean |
isReadOnly() |
boolean |
isScrollWheelZoomEnabled() |
boolean |
isTouchZoomEnabled() |
java.util.Iterator<com.vaadin.ui.Component> |
iterator() |
void |
locate()
Tries to detect the users geolocation.
|
void |
locate(boolean watch,
boolean highAccuracy,
boolean updateView)
Tries to detect the users geolocation.
|
void |
removeComponent(com.vaadin.ui.Component c) |
void |
removeControl(AbstractControl control) |
void |
removeLayer(LeafletLayer layer) |
void |
replaceComponent(com.vaadin.ui.Component oldComponent,
com.vaadin.ui.Component newComponent) |
void |
setAttributionPrefix(java.lang.String prefix) |
void |
setBoxZoomEnabled(boolean boxZoom) |
void |
setCenter(Bounds bounds) |
void |
setCenter(double lat,
double lon) |
void |
setCenter(Point center) |
void |
setCenter(org.locationtech.jts.geom.Point jtsPoint) |
void |
setCenter(Point center,
java.lang.Double zoom) |
void |
setControls(java.util.List<Control> controls)
Deprecated.
use addControl() instead
|
void |
setCrs(Crs lc)
Specify the CRS to use for the whole Map.
|
void |
setCustomCrs(java.lang.String name,
double min_x,
double min_y,
double max_x,
double max_y,
double a,
double b,
double c,
double d)
Adds and uses a new Crs definition and makes it immediately available for
use inside a Map.
|
void |
setCustomCrs(java.lang.String name,
java.lang.String projection,
double a,
double b,
double c,
double d)
Adds and uses a new Crs definition and makes it immediately available for
use inside a Map.
|
void |
setCustomInitOption(java.lang.String key,
boolean b) |
void |
setDoubleClickZoomEnabled(boolean doubleClickZoom) |
void |
setDraggingEnabled(boolean dragging) |
void |
setKeyboardEnabled(boolean keyboard) |
void |
setLayersToUpdateOnLocate(AbstractLeafletLayer... layers)
Updates given layers directly on the client side when position is
located.
|
void |
setMaxBounds(Bounds bounds)
Sets the area into where the viewport is restricted.
|
void |
setMaxBounds(org.locationtech.jts.geom.Geometry bounds)
Sets the area into where the viewport is restricted.
|
void |
setMaxZoom(int maxZoom) |
void |
setMinLocatationUpdateInterval(int millis) |
void |
setMinZoom(int minZoom) |
void |
setReadOnly(boolean readOnly) |
void |
setScrollWheelZoomEnabled(boolean scrollWheelZoom) |
void |
setTouchZoomEnabled(boolean touchZoom) |
void |
setView(java.lang.Double lat,
java.lang.Double lon,
java.lang.Double zoom) |
void |
setZoomDelta(java.lang.Double zoomDelta) |
void |
setZoomLevel(double zoomLevel) |
void |
setZoomSnap(java.lang.Double zoomSnap) |
void |
stopLocate()
Stops detecting users geolocation.
|
void |
translatePixelCoordinates(int x,
int y,
com.vaadin.server.SerializableConsumer<Point> callback)
Translates given parameters (x/y pixel coordinates relative to the map)
to actual coordinates on the client side and passes the values to the callback.
|
void |
zoomToContent()
Calculates extent of all contained components that are not "baselayers".
|
void |
zoomToContent(LeafletLayer l) |
void |
zoomToExtent(Bounds bounds) |
void |
zoomToExtent(org.locationtech.jts.geom.Geometry geometry) |
addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeAllComponents, removeComponentAttachListener, removeComponentDetachListener, setHeight, setWidth
addContextClickListener, addContextHelpIconClickListener, addListener, addShortcutListener, addStyleName, attach, ensureContextHelpInitialized, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireContextHelpClick, focus, getActionManager, getCaption, getComponentError, getComponentErrorProvider, getContextHelpText, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getJTestId, getLocale, getParent, getPrimaryStyleName, getRequiredError, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isContextHelpTextHtmlEnabled, isEnabled, isOrHasAncestor, isRequiredIndicatorVisible, isResponsive, isVisible, readDesign, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setComponentErrorProvider, setContextHelpText, setContextHelpTextHtmlEnabled, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setJTestId, setLocale, setParent, setPrimaryStyleName, setRequiredError, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefined, writeDesign
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getIncorrectConcurrentAccessHandler, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setConnectorResource, setErrorHandler, setIncorrectConcurrentAccessHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getJTestId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setJTestId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign
addAttachListener, addDetachListener, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
public void beforeClientResponse(boolean initial)
beforeClientResponse
in interface com.vaadin.server.ClientConnector
beforeClientResponse
in class com.vaadin.ui.AbstractComponent
public void detach()
detach
in interface com.vaadin.server.ClientConnector
detach
in class com.vaadin.ui.AbstractComponent
protected LeafletMapState getState(boolean markAsDirty)
getState
in class com.vaadin.ui.AbstractComponentContainer
protected LeafletMapState getState()
getState
in class com.vaadin.ui.AbstractComponentContainer
public void replaceComponent(com.vaadin.ui.Component oldComponent, com.vaadin.ui.Component newComponent)
public void addBaseLayer(LeafletLayer baseLayer, java.lang.String name)
baseLayer
- the layer to be addedname
- to be used in LayerControl, null if layer should not be
displayed in the layer controlpublic LZoom getZoomControl()
public LLayers getLayersControl()
public void addControl(AbstractControl control)
public void removeControl(AbstractControl control)
public void addOverlay(LeafletLayer overlay, java.lang.String name)
public void addLayer(LeafletLayer layer)
public void removeLayer(LeafletLayer layer)
public void addComponent(com.vaadin.ui.Component c)
addComponent
in interface com.vaadin.ui.ComponentContainer
addComponent
in class com.vaadin.ui.AbstractComponentContainer
public void removeComponent(com.vaadin.ui.Component c)
removeComponent
in interface com.vaadin.ui.ComponentContainer
removeComponent
in class com.vaadin.ui.AbstractComponentContainer
public int getComponentCount()
public boolean hasControl(java.lang.Class<? extends AbstractControl> leafletControl)
public boolean hasComponent(com.vaadin.ui.Component component)
public java.util.Iterator<com.vaadin.ui.Component> iterator()
public void setView(java.lang.Double lat, java.lang.Double lon, java.lang.Double zoom)
public void setCenter(double lat, double lon)
public void setCenter(Point center, java.lang.Double zoom)
public void flyTo(Point center, java.lang.Double zoom)
public void setCenter(Point center)
public void setCenter(org.locationtech.jts.geom.Point jtsPoint)
public void setZoomLevel(double zoomLevel)
public com.vaadin.shared.Registration addLocateListener(LeafletLocateListener listener)
public com.vaadin.shared.Registration addClickListener(LeafletClickListener listener)
public com.vaadin.shared.Registration addMoveEndListener(LeafletMoveEndListener moveEndListener)
public com.vaadin.shared.Registration addZoomEndListener(LeafletZoomEndListener zoomEndListener)
public com.vaadin.shared.Registration addDragEndListener(LeafletDragEndListener dragEndListener)
public com.vaadin.shared.Registration addContextMenuListener(LeafletContextMenuListener listener)
public com.vaadin.shared.Registration addBaseLayerChangeListener(LeafletBaseLayerChangeListener listener)
public com.vaadin.shared.Registration addOverlayAddListener(LeafletOverlayAddListener listener)
public com.vaadin.shared.Registration addOverlayRemoveListener(LeafletOverlayRemoveListener listener)
public void setCenter(Bounds bounds)
public java.lang.Double getZoomLevel()
public void zoomToExtent(Bounds bounds)
public void zoomToExtent(org.locationtech.jts.geom.Geometry geometry)
public Bounds getBounds()
public void zoomToContent()
public org.locationtech.jts.geom.Geometry getContentBounds()
@Deprecated public void setControls(java.util.List<Control> controls)
controls
- the list of controls to be shownpublic Point getCenter()
public void setAttributionPrefix(java.lang.String prefix)
public java.lang.String getAttributionPrefix()
public void zoomToContent(LeafletLayer l)
public void setMaxBounds(Bounds bounds)
bounds
- the bounds of where the viewport of the map should be limited topublic void setMaxBounds(org.locationtech.jts.geom.Geometry bounds)
bounds
- the bounds of where the viewport of the map should be limited topublic void setMinZoom(int minZoom)
public void setMaxZoom(int maxZoom)
public Crs getCrs()
public void setCrs(Crs lc)
lc
- The CRS to use (one from a limited range)public void setCustomCrs(java.lang.String name, java.lang.String projection, double a, double b, double c, double d)
name
- Name for the new Crs.projection
- Name of the projection for this new Crs. It needs to be
the name of a valid projection defined in L.Projection (LonLat,
SphericalMercator, Mercator).a
- transformation parameter ab
- transformation parameter bc
- transformation parameter cd
- transformation parameter dpublic void setCustomCrs(java.lang.String name, double min_x, double min_y, double max_x, double max_y, double a, double b, double c, double d)
name
- Name for the new Crs.min_x
- the minimum x valuemin_y
- the minimum y valuemax_x
- the maximum x valuemax_y
- the maximum y valuea
- transformation parameter ab
- transformation parameter bc
- transformation parameter cd
- transformation parameter dpublic void setCustomInitOption(java.lang.String key, boolean b)
public void setReadOnly(boolean readOnly)
setReadOnly
in class com.vaadin.ui.AbstractComponent
public void setDraggingEnabled(boolean dragging)
dragging
- true if dragging map should be possiblepublic boolean isDraggingEnabled()
public void setTouchZoomEnabled(boolean touchZoom)
touchZoom
- true if touch zoom should be enabledpublic boolean isTouchZoomEnabled()
public void setDoubleClickZoomEnabled(boolean doubleClickZoom)
doubleClickZoom
- true if double click zooming should be enabledpublic boolean isDoubleZoomEnabled()
public void setBoxZoomEnabled(boolean boxZoom)
boxZoom
- true if box zoom mode should be enabledpublic boolean isBoxZoomEnabled()
public void setScrollWheelZoomEnabled(boolean scrollWheelZoom)
scrollWheelZoom
- true if zooming with scroll wheel should be enabledpublic void setZoomSnap(java.lang.Double zoomSnap)
zoomSnap
- public void setZoomDelta(java.lang.Double zoomDelta)
zoomDelta
- public boolean isScrollWheelZoomEnabled()
public void setKeyboardEnabled(boolean keyboard)
keyboard
- true if keyboard usage should be enabledpublic boolean isKeyboardZoomEnabled()
public void locate()
public void locate(boolean watch, boolean highAccuracy, boolean updateView)
watch
- true if location should be updated continuouslyhighAccuracy
- true if high accuracy should be requestedupdateView
- true if the viewport should be centered to the latest
position, with appropriate zoom levelpublic void stopLocate()
public void setMinLocatationUpdateInterval(int millis)
millis
- the minimum interval in milliseconds that server side gets
notified about the new location (via LeafletLocateListener), if watch
option is used. Can be handy if you want to limit the amount of client
server traffic. The default is 5000ms.public void setLayersToUpdateOnLocate(AbstractLeafletLayer... layers)
layers
- that should be updated, only LMarker, LCircle and
LCircleMarker are currently supported. If the layer is of type LCircle,
the radius is set to accuracy of the location eventpublic boolean isReadOnly()
isReadOnly
in class com.vaadin.ui.AbstractComponent
public void translatePixelCoordinates(int x, int y, com.vaadin.server.SerializableConsumer<Point> callback)
Note, only one callback is allowed at once.
x
- the x pixel coordinatey
- the y pixel coordinatecallback
- the callback to notify when translation is done