@JsType(isNative=true) public class Map extends Object implements Evented
Modifier and Type | Field and Description |
---|---|
Handler |
boxZoom
Box (shift-drag with mouse) zoom handler.
|
Handler |
doubleClickZoom
Double click zoom handler.
|
Handler |
dragging
Map dragging handler (by both mouse and touch).
|
Handler |
keyboard
Keyboard navigation handler.
|
Handler |
scrollWheelZoom
Scroll wheel zoom handler.
|
Handler |
tap
Mobile touch hacks (quick tap and touch hold) handler.
|
Handler |
touchZoom
Touch zoom handler.
|
Modifier and Type | Method and Description |
---|---|
L |
addControl(Control control)
Adds the given control to the map.
|
L |
addEventParent(Evented obj)
Adds an event parent - an Evented that will receive propagated events
|
L |
addLayer(Layer layer,
Boolean insertAtTheBottom)
Adds the given layer to the map.
|
L |
clearAllEventListeners()
Clear all event listeners.
|
L |
closePopup(Popup popup)
Closes the popup previously opened with openPopup
|
LatLng |
containerPointToLatLng(Point point)
Returns the geographical coordinates of a given map container point.
|
Point |
containerPointToLayerPoint(Point point)
Converts the point relative to the map container to a point relative to the map layer.
|
elemental2.dom.HTMLElement |
createPane(String name)
Creates a new map pane with the given name if it doesn't exist already, then returns it.
|
elemental2.dom.HTMLElement |
createPane(String name,
elemental2.dom.HTMLElement container)
Creates a new map pane with the given name if it doesn't exist already, then returns it.
|
Boolean |
eachLayer(elemental2.core.Function action,
com.google.gwt.core.client.JavaScriptObject context)
Iterates over the layers of the map, optionally specifying context of the iterator function.
|
L |
fire(String type)
Fires an event of the specified type.
|
L |
fitBounds(LatLngBounds bounds,
FitBoundsOptions options)
Sets a map view that contains the given geographical bounds with the maximum zoom level possible.
|
L |
fitWorld(FitBoundsOptions options)
Sets a map view that mostly contains the whole world with the maximum zoom level possible.
|
LatLngBounds |
getBounds()
Returns the LatLngBounds of the current map view.
|
double |
getBoundsZoom(LatLngBounds bounds,
Boolean inside)
Returns the maximum zoom level on which the given bounds fit to the map view in its entirety.
|
LatLng |
getCenter()
Returns the geographical center of the map view.
|
elemental2.dom.HTMLElement |
getContainer()
Returns the container element of the map.
|
Double |
getMaxZoom()
Returns the maximum zoom level of the map.
|
Double |
getMinZoom()
Returns the minimum zoom level of the map.
|
MapPanes |
getPanes()
Returns an object with different map panes (to render overlays in).
|
Bounds |
getPixelBounds()
Returns the bounds of the current map view in projected pixel coordinates (sometimes useful in layer and overlay implementations).
|
Point |
getPixelOrigin()
Returns the projected pixel coordinates of the top left point of the map layer (useful in custom layer and overlay implementations).
|
Point |
getSize()
Returns the current size of the map container.
|
Double |
getZoom()
Returns the current zoom of the map view.
|
Boolean |
hasLayer(Layer layer)
Returns true if the given layer is currently added to the map.
|
L |
invalidateSize(Boolean options)
Checks if the map container size changed and updates the map if so — call it after you've changed the map size dynamically, also animating pan by default.
|
L |
invalidateSize(ZoomPanOptions options2)
Checks if the map container size changed and updates the map if so — call it after you've changed the map size dynamically, also animating pan by default.
|
Point |
latLngToContainerPoint(LatLng latlng)
Returns the map container point that corresponds to the given geographical coordinates.
|
Point |
latLngToLayerPoint(LatLng latlng)
Returns the map layer point that corresponds to the given geographical coordinates (useful for placing overlays on the map).
|
Point |
layerPointToContainerPoint(Point point)
Converts the point relative to the map layer to a point relative to the map container.
|
LatLng |
layerPointToLatLng(Point point)
Returns the geographical coordinates of a given map layer point.
|
Boolean |
listens(String type)
Returns true if a particular event type has any listeners attached to it.
|
L |
locate(LocateOptions options)
Tries to locate the user using the Geolocation API, firing a locationfound event with location data on success or a locationerror event on failure, and optionally sets the map view to the user's location with respect to detection accuracy (or to the world view if geolocation failed).
|
Point |
mouseEventToContainerPoint(MouseEvent event)
Returns the pixel coordinates of a mouse click (relative to the top left corner of the map) given its event object.
|
LatLng |
mouseEventToLatLng(MouseEvent event)
Returns the geographical coordinates of the point the mouse clicked on given the click's event object.
|
Point |
mouseEventToLayerPoint(MouseEvent event)
Returns the pixel coordinates of a mouse click relative to the map layer given its event object.
|
L |
off()
Removes all listener
|
L |
off(String type)
Removes a listener
|
L |
off(String[] type)
Removes a set of listener
|
L |
on(String type,
EventCallback fn)
Adds a set of type/listener pairs.
|
L |
once(String type,
EventCallback fn)
the listener will only get fired once and then removed.
|
L |
openPopup(elemental2.dom.HTMLElement el,
LatLng latlng,
PopupOptions options)
Creates a popup with the specified options and opens it in the given point on a map.
|
L |
openPopup(Popup popup)
Opens the specified popup while closing the previously opened (to make sure only one is opened at one time for usability).
|
L |
openPopup(String html,
LatLng latlng,
PopupOptions options)
Creates a popup with the specified options and opens it in the given point on a map.
|
L |
panBy(Point point,
PanOptions options)
Pans the map by a given number of pixels (animated).
|
L |
panInsideBounds(LatLngBounds bounds)
Pans the map to the closest view that would lie inside the given bounds (if it's not already), controlling the animation using the options specific, if any.
|
L |
panTo(LatLng latlng,
PanOptions options)
Pans the map to a given center.
|
Point |
project(LatLng latlng,
double zoom)
Projects the given geographical coordinates to absolute pixel coordinates for the given zoom level (current zoom level by default).
|
L |
remove()
Destroys the map and clears all related event listeners.
|
L |
removeControl(Control control)
Removes the given control from the map.
|
L |
removeEventParent(Evented obj)
Removes an event parent, so it will stop receiving propagated events
|
L |
removeLayer(Layer layer)
Removes the given layer from the map.
|
L |
setMaxBounds(LatLngBounds bounds,
ZoomPanOptions options)
Restricts the map view to the given bounds .
|
L |
setView(LatLng center,
double zoom,
ZoomPanOptions options)
Sets the view of the map (geographical center and zoom) with the given animation options.
|
L |
setZoom(double zoom,
ZoomOptions options)
Sets the zoom of the map.
|
L |
setZoomAround(LatLng latlng,
double zoom,
ZoomOptions options)
Zooms the map while keeping a specified point on the map stationary (e.g.
|
L |
stopLocate()
Stops watching location previously initiated by map.locate({watch: true}) and aborts resetting the map view if map.locate was called with {setView: true}.
|
LatLng |
unproject(Point point,
double zoom)
Projects the given absolute pixel coordinates to geographical coordinates for the given zoom level (current zoom level by default).
|
L |
whenReady(elemental2.core.Function fn,
Object context)
Runs the given callback when the map gets initialized with a place and zoom, or immediately if it happened already, optionally passing a function context.
|
L |
zoomIn(Double delta,
ZoomOptions options)
Increases the zoom of the map by delta (1 by default).
|
L |
zoomOut(Double delta,
ZoomOptions options)
Decreases the zoom of the map by delta (1 by default).
|
@JsProperty public Handler boxZoom
@JsProperty public Handler doubleClickZoom
@JsProperty public Handler dragging
@JsProperty public Handler keyboard
@JsProperty public Handler scrollWheelZoom
@JsProperty public Handler tap
@JsProperty public Handler touchZoom
@JsMethod public L setView(LatLng center, double zoom, ZoomPanOptions options)
center
- the centerzoom
- the zoomoptions
- the map options@JsMethod public L setZoom(double zoom, ZoomOptions options)
zoom
- the zoomoptions
- the zoom options@JsMethod public L zoomIn(Double delta, ZoomOptions options)
delta
- the deltaoptions
- the zoom options@JsMethod public L zoomOut(Double delta, ZoomOptions options)
delta
- the deltaoptions
- the zoom options@JsMethod public L setZoomAround(LatLng latlng, double zoom, ZoomOptions options)
latlng
- the latlngzoom
- the zoomoptions
- the zoom options@JsMethod public L fitBounds(LatLngBounds bounds, FitBoundsOptions options)
bounds
- the boundsoptions
- the options@JsMethod public L fitWorld(FitBoundsOptions options)
options
- the options@JsMethod public L panTo(LatLng latlng, PanOptions options)
latlng
- the latlngoptions
- the options@JsMethod public L panInsideBounds(LatLngBounds bounds)
bounds
- the bounds@JsMethod public L panBy(Point point, PanOptions options)
point
- the pointoptions
- the options@JsMethod public L invalidateSize(Boolean options)
options
- the options@JsMethod public L invalidateSize(ZoomPanOptions options2)
options2
- the options 2@JsMethod public L setMaxBounds(LatLngBounds bounds, ZoomPanOptions options)
bounds
- the boundsoptions
- the options@JsMethod public L locate(LocateOptions options)
options
- the locateOptions@JsMethod public L stopLocate()
@JsMethod public L remove()
@JsMethod public LatLng getCenter()
@JsMethod public Double getZoom()
@JsMethod public Double getMinZoom()
@JsMethod public Double getMaxZoom()
@JsMethod public LatLngBounds getBounds()
@JsMethod public double getBoundsZoom(LatLngBounds bounds, Boolean inside)
bounds
- the boundsinside
- the inside@JsMethod public Point getSize()
@JsMethod public Bounds getPixelBounds()
@JsMethod public Point getPixelOrigin()
@JsMethod public L addLayer(Layer layer, Boolean insertAtTheBottom)
layer
- the layerinsertAtTheBottom
- the insert at the bottom flag@JsMethod public L removeLayer(Layer layer)
layer
- the layer@JsMethod public Boolean hasLayer(Layer layer)
layer
- the layer@JsMethod public Boolean eachLayer(elemental2.core.Function action, com.google.gwt.core.client.JavaScriptObject context)
action
- the action functioncontext
- the context@JsMethod public L openPopup(Popup popup)
popup
- the popup@JsMethod public L openPopup(String html, LatLng latlng, PopupOptions options)
html
- the htmllatlng
- the latlngoptions
- the options@JsMethod public L openPopup(elemental2.dom.HTMLElement el, LatLng latlng, PopupOptions options)
el
- the ellatlng
- the latlngoptions
- the options@JsMethod public L closePopup(Popup popup)
popup
- the popup@JsMethod public L addControl(Control control)
control
- the control@JsMethod public L removeControl(Control control)
control
- the control@JsMethod public Point latLngToLayerPoint(LatLng latlng)
latlng
- the latlng@JsMethod public LatLng layerPointToLatLng(Point point)
point
- the point@JsMethod public Point containerPointToLayerPoint(Point point)
point
- the point@JsMethod public Point layerPointToContainerPoint(Point point)
point
- the point@JsMethod public Point latLngToContainerPoint(LatLng latlng)
latlng
- the latlng@JsMethod public LatLng containerPointToLatLng(Point point)
point
- the point@JsMethod public Point project(LatLng latlng, double zoom)
latlng
- the latlngzoom
- the zoom@JsMethod public LatLng unproject(Point point, double zoom)
point
- the pointzoom
- the zoom@JsMethod public Point mouseEventToContainerPoint(MouseEvent event)
event
- the event@JsMethod public Point mouseEventToLayerPoint(MouseEvent event)
event
- the event@JsMethod public LatLng mouseEventToLatLng(MouseEvent event)
event
- the event@JsMethod public elemental2.dom.HTMLElement getContainer()
@JsMethod public elemental2.dom.HTMLElement createPane(String name)
@JsMethod public elemental2.dom.HTMLElement createPane(String name, elemental2.dom.HTMLElement container)
@JsMethod public MapPanes getPanes()
@JsMethod public L whenReady(elemental2.core.Function fn, Object context)
fn
- the callbackcontext
- the contextpublic L clearAllEventListeners()
Evented
clearAllEventListeners
in interface Evented
public L on(String type, EventCallback fn)
Evented
public L once(String type, EventCallback fn)
Evented
public L off(String[] type)
Evented
public L fire(String type)
Evented
public Boolean listens(String type)
Evented
public L addEventParent(Evented obj)
Evented
addEventParent
in interface Evented
public L removeEventParent(Evented obj)
Evented
removeEventParent
in interface Evented
Copyright © 2018 G-Widgets. All rights reserved.