public final class Map extends Object
Constructor and Description |
---|
Map(String id) |
Map(String id,
MapOptions options) |
Modifier and Type | Method and Description |
---|---|
Map |
addDragEndListener(DragEndEvent.Type type,
DragEndListener listener)
Adds a drag end listener to a particular drag end event type of the
object.
|
Map |
addErrorListener(ErrorEvent.Type type,
ErrorListener listener)
Adds a error listener to a particular error event type of the object.
|
Map |
addEventListener(Event.Type type,
EventListener listener)
Adds a event listener to a particular event type of the object.
|
Map |
addLayer(ILayer layer)
Adds the given layer to the map.
|
Map |
addLayerListener(LayerEvent.Type type,
LayerListener listener)
Adds a layer listener to a particular layer event type of the object.
|
Map |
addLocationListener(LocationEvent.Type type,
LocationListener listener)
Adds a location listener to a particular location event type of the
object.
|
Map |
addMouseListener(MouseEvent.Type type,
MouseListener listener)
Adds a mouse listener to a particular mouse event type of the object.
|
Map |
addPopupListener(PopupEvent.Type type,
PopupListener listener)
Adds a popup listener to a particular popup event type of the object.
|
Map |
addResizeListener(ResizeEvent.Type type,
ResizeListener listener)
Adds a resize listener to a particular resize event type of the object.
|
Map |
clearAllEventListeners()
Removes all listeners to all events on the object.
|
Map |
closePopup()
Closes the popup previously opened with
openPopup(java.lang.String, net.java.html.leaflet.LatLng) . |
Map |
closePopup(Popup popup)
Closes the given popup.
|
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.
|
LatLngBounds |
getBounds()
Returns the LatLngBounds of the current map view.
|
int |
getBoundsZoom(LatLngBounds bounds)
Returns the maximum zoom level on which the given bounds fit to the map
view in its entirety.
|
int |
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.
|
ILayer[] |
getLayers()
Returns all layers.
|
int |
getMaxZoom()
Returns the maximum zoom level of the map.
|
int |
getMinZoom()
Returns the minimum zoom level of the map.
|
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.
|
int |
getZoom()
Returns the current zoom of the map view.
|
boolean |
hasLayer(ILayer layer)
Returns
true if the given layer is currently added to the
map. |
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.
|
Map |
openPopup(Popup popup,
LatLng latlng)
Opens the specified popup while closing the previously opened (to make
sure only one is opened at one time for usability).
|
Map |
openPopup(Popup popup,
LatLng latlng,
PopupOptions options)
Opens the specified popup while closing the previously opened (to make
sure only one is opened at one time for usability).
|
Map |
openPopup(String html,
LatLng latlng)
Creates a popup and opens it in the given point on a map.
|
Point |
project(LatLng latlng)
Projects the given geographical coordinates to absolute pixel coordinates
for the given zoom level (current zoom level by default).
|
Point |
project(LatLng latlng,
int zoom)
Projects the given geographical coordinates to absolute pixel coordinates
for the given zoom level (current zoom level by default).
|
Map |
removeDragEndListener(DragEndEvent.Type type,
DragEndListener listener)
Removes a drag end listener to a particular drag end event type of the
object.
|
Map |
removeErrorListener(ErrorEvent.Type type,
ErrorListener listener)
Removes a error listener to a particular error event type of the object.
|
Map |
removeEventListener(Event.Type type,
EventListener listener)
Removes a event listener to a particular event type of the object.
|
Map |
removeLayer(ILayer layer)
Removes the given layer from the map.
|
Map |
removeLayerListener(LayerEvent.Type type,
LayerListener listener)
Removes a layer listener to a particular layer event type of the object.
|
Map |
removeLocationListener(LocationEvent.Type type,
LocationListener listener)
Removes a location listener to a particular location event type of the
object.
|
Map |
removeMouseListener(MouseEvent.Type type,
MouseListener listener)
Removes a mouse listener to a particular mouse event type of the object.
|
Map |
removePopupListener(PopupEvent.Type type,
PopupListener listener)
Removes a popup listener to a particular popup event type of the object.
|
Map |
removeResizeListener(ResizeEvent.Type type,
ResizeListener listener)
Removes a resize listener to a particular resize event type of the
object.
|
void |
setView(LatLng center)
Sets the view of the map (geographical center and zoom) with the given
animation options.
|
void |
setView(LatLng center,
int zoom)
Sets the view of the map (geographical center and zoom) with the given
animation options.
|
void |
setView(LatLng center,
int zoom,
ZoomPanOptions options)
Sets the view of the map (geographical center and zoom) with the given
animation options.
|
LatLng |
unproject(Point point)
Projects the given absolute pixel coordinates to geographical coordinates
for the given zoom level (current zoom level by default).
|
LatLng |
unproject(Point point,
int zoom)
Projects the given absolute pixel coordinates to geographical coordinates
for the given zoom level (current zoom level by default).
|
public Map(String id)
public Map(String id, MapOptions options)
public void setView(LatLng center)
center
- The center valuepublic void setView(LatLng center, int zoom)
center
- The center valuezoom
- The zoom valuepublic void setView(LatLng center, int zoom, ZoomPanOptions options)
center
- The center valuezoom
- The zoom valueoptions
- The zoom/pan optionspublic Map addLayer(ILayer layer)
layer
- The added layer.public Map removeLayer(ILayer layer)
layer
- The removed layer.public boolean hasLayer(ILayer layer)
true
if the given layer is currently added to the
map.layer
- The layer.true
if the given layer is currently added
to the map, false
otherwise.public ILayer[] getLayers()
public Map addMouseListener(MouseEvent.Type type, MouseListener listener)
type
- The mouse event type. The types CLICK, DBLCLICK, MOUSEDOWN,
MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, CONTEXTMENU and PRECLICK are
supported.listener
- The registered listener.public Map addEventListener(Event.Type type, EventListener listener)
type
- The event type. The types FOCUS, BLUR, LOAD, UNLOAD,
VIEWRESET, MOVESTART, MOVE, MOVEEND, DRAGSTART, DRAG, ZOOMSTART, ZOOMEND,
ZOOMLEVELSCHANGE and AUTOPANSTART are supported.listener
- The registered listener.public Map addDragEndListener(DragEndEvent.Type type, DragEndListener listener)
type
- The drag end event type. The type DRAGEND is supported.listener
- The registered listener.public Map addResizeListener(ResizeEvent.Type type, ResizeListener listener)
type
- The resize event type. The type RESIZE is supported.listener
- The registered listener.public Map addLayerListener(LayerEvent.Type type, LayerListener listener)
type
- The layer event type. The types LAYERADD, LAYERREMOVE,
BASSELAYERCHANGE, OVERLAYADD and OVERLAYREMOVE are supported.listener
- The registered listener.public Map addLocationListener(LocationEvent.Type type, LocationListener listener)
type
- The location event type. The type LOCATIONFOUND is supported.listener
- The registered listener.public Map addErrorListener(ErrorEvent.Type type, ErrorListener listener)
type
- The error event type. The type LOCATIONERROR is supported.listener
- The registered listener.public Map addPopupListener(PopupEvent.Type type, PopupListener listener)
type
- The popup event type. The types POPUPOPEN and POPUPCLOSE are
supported.listener
- The registered listener.public Map removeMouseListener(MouseEvent.Type type, MouseListener listener)
type
- The mouse event type. The types CLICK, DBLCLICK, MOUSEDOWN,
MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, CONTEXTMENU and PRECLICK are
supported.listener
- The registered listener.public Map removeEventListener(Event.Type type, EventListener listener)
type
- The event type. The types FOCUS, BLUR, LOAD, UNLOAD,
VIEWRESET, MOVESTART, MOVE, MOVEEND, DRAGSTART, DRAG, ZOOMSTART, ZOOMEND,
ZOOMLEVELSCHANGE and AUTOPANSTART are supported.listener
- The registered listener.public Map removeDragEndListener(DragEndEvent.Type type, DragEndListener listener)
type
- The drag end event type. The type DRAGEND is supported.listener
- The registered listener.public Map removeResizeListener(ResizeEvent.Type type, ResizeListener listener)
type
- The resize event type. The type RESIZE is supported.listener
- The registered listener.public Map removeLayerListener(LayerEvent.Type type, LayerListener listener)
type
- The layer event type. The types LAYERADD, LAYERREMOVE,
BASSELAYERCHANGE, OVERLAYADD and OVERLAYREMOVE are supported.listener
- The registered listener.public Map removeLocationListener(LocationEvent.Type type, LocationListener listener)
type
- The location event type. The type LOCATIONFOUND is supported.listener
- The registered listener.public Map removeErrorListener(ErrorEvent.Type type, ErrorListener listener)
type
- The error event type. The type LOCATIONERROR is supported.listener
- The registered listener.public Map removePopupListener(PopupEvent.Type type, PopupListener listener)
type
- The popup event type. The types POPUPOPEN and POPUPCLOSE are
supported.listener
- The registered listener.public Map clearAllEventListeners()
public Map openPopup(String html, LatLng latlng)
html
- The html content.latlng
- The point.public Map openPopup(Popup popup, LatLng latlng)
popup
- The popup.latlng
- The point.public Map openPopup(Popup popup, LatLng latlng, PopupOptions options)
popup
- The popup.latlng
- The point.options
- The PopupOptions
.public Map closePopup()
openPopup(java.lang.String, net.java.html.leaflet.LatLng)
.public Map closePopup(Popup popup)
popup
- The popup to close.public LatLng getCenter()
public int getZoom()
public int getMinZoom()
public int getMaxZoom()
public LatLngBounds getBounds()
LatLngBounds
of the current map view.public int getBoundsZoom(LatLngBounds bounds)
bounds
- The bounds.public int getBoundsZoom(LatLngBounds bounds, boolean inside)
bounds
- The bounds.inside
- If inside is set true
, the method instead
returns the minimum zoom level on which the map view fits into the given
bounds in its entirety.public Point getSize()
public Bounds getPixelBounds()
public Point getPixelOrigin()
public Point latLngToLayerPoint(LatLng latlng)
latlng
- The geographical coordinates.public LatLng layerPointToLatLng(Point point)
point
- The map layer point.public Point containerPointToLayerPoint(Point point)
point
- A point relative to the map container.public Point layerPointToContainerPoint(Point point)
point
- A point relative to the map layer.public Point latLngToContainerPoint(LatLng latlng)
latlng
- The geographical coordinates.public LatLng containerPointToLatLng(Point point)
point
- The map container point.public Point project(LatLng latlng)
latlng
- The geographical coordinates.public Point project(LatLng latlng, int zoom)
latlng
- The geographical coordinates.zoom
- The zoom level.public LatLng unproject(Point point)
point
- The absolute pixel coordinates.public LatLng unproject(Point point, int zoom)
point
- The absolute pixel coordinates.zoom
- The zoom level.Copyright © 2017. All rights reserved.