com.google.gwt.maps.client
Class MapWidget

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.google.gwt.maps.client.MapWidget
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.RequiresResize

public final class MapWidget
extends com.google.gwt.user.client.ui.Composite
implements com.google.gwt.user.client.ui.RequiresResize

A widget that presents a viewable Google Map to a user. Note: the GEvent.trigger methods are implemented by the API but intended for internal testing only.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
MapWidget()
           
MapWidget(LatLng center, int zoomLevel)
          Creates a new map widget and sets the view to the given center and zoom level.
MapWidget(LatLng center, int zoomLevel, MapOptions options)
          Creates a new map widget and sets the view to the specified center point and zoom level.
MapWidget(LatLng center, int zoomLevel, java.lang.String draggableCursor, java.lang.String draggingCursor)
          Deprecated. Use MapWidget(LatLng, int, MapOptions) instead.
 
Method Summary
 void addControl(Control control)
          Adds a control to the map.
 void addControl(Control control, ControlPosition position)
          Adds a control to the map at the given position.
 void addControlWidget(com.google.gwt.user.client.ui.Widget w)
          Adds a Control's widget to the map.
 void addInfoWindowBeforeCloseHandler(MapInfoWindowBeforeCloseHandler handler)
          This event is fired before the info window closes.
 void addInfoWindowCloseHandler(MapInfoWindowCloseHandler handler)
          This event is fired when the info window closes.
 void addInfoWindowOpenHandler(MapInfoWindowOpenHandler handler)
          This event is fired when the info window opens.
 void addMapAddMapTypeHandler(MapAddMapTypeHandler handler)
          This event is fired when a map type is added to the map.
 void addMapAddOverlayHandler(MapAddOverlayHandler handler)
          This event is fired when a single overlay is added to the map by the method addOverlay().
 void addMapClearOverlaysHandler(MapClearOverlaysHandler handler)
          This event is fired when all overlays are removed at once by the method clearOverlays().
 void addMapClickHandler(MapClickHandler handler)
          Add a click handler for mouse click events.
 void addMapDoubleClickHandler(MapDoubleClickHandler handler)
          Add a double click handler for mouse double click events.
 void addMapDragEndHandler(MapDragEndHandler handler)
          This event is fired when the user stops dragging the map.
 void addMapDragHandler(MapDragHandler handler)
          This event is repeatedly fired while the user drags the map.
 void addMapDragStartHandler(MapDragStartHandler handler)
          This event is fired when the user starts dragging the map.
 void addMapMouseMoveHandler(MapMouseMoveHandler handler)
          This event is fired when the user moves the mouse over the map from outside the map.
 void addMapMouseOutHandler(MapMouseOutHandler handler)
          This event is fired when the user moves the mouse over the map from outside the map.
 void addMapMouseOverHandler(MapMouseOverHandler handler)
          This event is fired when the user moves the mouse over the map from outside the map.
 void addMapMoveEndHandler(MapMoveEndHandler handler)
          This event is fired when the change of the map view ends.
 void addMapMoveHandler(MapMoveHandler handler)
          This event is fired, possibly repeatedly, while the map view is changing.
 void addMapMoveStartHandler(MapMoveStartHandler handler)
          This event is fired when the map view starts changing.
 void addMapRemoveMapTypeHandler(MapRemoveMapTypeHandler handler)
          This event is fired when a map type is removed from the map.
 void addMapRemoveOverlayHandler(MapRemoveOverlayHandler handler)
          This handler is fired when a single overlay is removed by the method removeOverlay(Overlay).
 void addMapRightClickHandler(MapRightClickHandler handler)
          Add a click handler for mouse right click events.
 void addMapType(MapType type)
          Adds a new map type to the map.
 void addMapTypeChangedHandler(MapTypeChangedHandler handler)
          This event is fired when another map type is selected.
 void addMapZoomEndHandler(MapZoomEndHandler handler)
          This event is fired when the map reaches a new zoom level.
 void addOverlay(Overlay overlay)
          Adds an overlay to the map and fires any registered MapAddOverlayHandler.
protected  void addVirtual(com.google.gwt.user.client.ui.Widget w)
          Adopts the widget, but does not modify the DOM.
 void checkResize()
          Notifies the map of a change of the size of its container.
 void checkResizeAndCenter()
          Notifies the map of a change in the size of its container and moves to the center of the map.
 void clearOverlays()
          Removes all overlay from the map, and fires any registered MapClearOverlaysHandler.
 void closeInfoWindow()
          Close the currently open InfoWindow.
 LatLng convertContainerPixelToLatLng(Point pixel)
          Computes the geographical coordinates from pixel coordinates in the div that holds the draggable map.
 LatLng convertDivPixelToLatLng(Point pixel)
          Computes the geographical coordinates from pixel coordinates in the div that holds the draggable map.
 Point convertLatLngToContainerPixel(LatLng latlng)
          Computes the pixel coordinates of the given geographical point in the DOM element that contains the map on the page.
 Point convertLatLngToDivPixel(LatLng latlng)
          Computes the pixel coordinates of the given geographical point in the DOM element that holds the draggable map.
 LatLngBounds getBounds()
          Returns the the visible rectangular region of the map view in geographical coordinates.
 int getBoundsZoomLevel(LatLngBounds bounds)
          Returns the zoom level at which the given rectangular region fits in the map view.
 LatLng getCenter()
          Returns the geographical coordinates of the center point of the map view.
 MapType getCurrentMapType()
          Returns the currently selected map type.
 MapUIOptions getDefaultUI()
          Returns a MapUIOptions object specifying default behaviour and UI elements for the Map, based on the UI of maps.google.com.
 DraggableObject getDragObject()
          Returns the draggable object used by this map.
 void getEarthInstance(EarthInstanceHandler handler)
          Asynchronously retrieves the Earth instance, initializing it if necessary.
 InfoWindow getInfoWindow()
          Gets the info window associated with the map.
 MapType[] getMapTypes()
          Gets the array of map types registered with this map.
 MapPane getPane(MapPaneType type)
          Returns the overlay DIV with the given id.
 com.google.gwt.core.client.JavaScriptObject getPeer()
          This method is not meant to be published, but is needed internally to support the GeoXmlOverlay gotoDefaultViewport() method.
 Size getSize()
          Returns the size of the map view in pixels.
 int getZoomLevel()
          Returns the current zoom level.
 void installKeyboardHandler()
          Enables keyboard shortcuts on the map.
 boolean isContinuousZoomEnabled()
          Returns true if continuous smooth zooming is enabled.
 boolean isDoubleClickZoomEnabled()
          Returns true if double-click to zoom is enabled.
 boolean isDraggable()
          Returns true if dragging of the map is enabled.
 boolean isInfoWindowEnabled()
          Returns true if opening info windows is enabled.
 boolean isPinchToZoomEnabled()
          Returns a Boolean indicating whether pinch to zoom is enabled.
 boolean isScrollWheelZoomEnabled()
          Returns true if zooming using a mouse's scroll wheel is enabled.
protected  void onAttach()
           
 void onResize()
          This method is automatically called by the parent container whenever it changes size.
 void panBy(int dx, int dy)
          Starts a pan animation by the given distance in pixels.
 void panDirection(int dx, int dy)
          Starts a pan animation by 1/3rd the size of the map in the indicated directions.
 void panTo(LatLng center)
          Centers the map to the given point.
 void removeControl(Control control)
          Removes the given control from the map.
 void removeInfoWindowBeforeCloseHandler(MapInfoWindowBeforeCloseHandler handler)
          Removes a single handler of this map previously added with addInfoWindowBeforeCloseHandler(MapInfoWindowBeforeCloseHandler) .
 void removeInfoWindowCloseHandler(MapInfoWindowCloseHandler handler)
          Removes a single handler of this map previously added with addInfoWindowCloseHandler(MapInfoWindowCloseHandler).
 void removeInfoWindowOpenHandler(MapInfoWindowOpenHandler handler)
          Removes a single handler of this map previously added with addInfoWindowOpenHandler(MapInfoWindowOpenHandler).
 void removeMapAddMapTypeHandler(MapAddMapTypeHandler handler)
          Removes a single handler of this map previously added with addMapAddMapTypeHandler(MapAddMapTypeHandler).
 void removeMapAddOverlayHandler(MapAddOverlayHandler handler)
          Removes a single handler of this map previously added with addMapAddOverlayHandler(MapAddOverlayHandler).
 void removeMapClearOverlaysHandler(MapClearOverlaysHandler handler)
          Removes a single handler of this map previously added with addMapClearOverlaysHandler(MapClearOverlaysHandler).
 void removeMapClickHandler(MapClickHandler handler)
          Removes a single handler of this map previously added with addMapClickHandler(MapClickHandler).
 void removeMapDoubleClickHandler(MapDoubleClickHandler handler)
          Removes a single handler of this map previously added with addMapDoubleClickHandler(MapDoubleClickHandler).
 void removeMapDragEndHandler(MapDragEndHandler handler)
          Removes a single handler of this map previously added with addMapDragEndHandler(MapDragEndHandler).
 void removeMapDragHandler(MapDragHandler handler)
          Removes a single handler of this map previously added with addMapDragHandler(MapDragHandler).
 void removeMapDragStartHandler(MapDragStartHandler handler)
          Removes a single handler of this map previously added with addMapDragStartHandler(MapDragStartHandler).
 void removeMapMouseMoveHandler(MapMouseMoveHandler handler)
          Removes a single handler of this map previously added with addMapMouseOutHandler(MapMouseOutHandler).
 void removeMapMouseOutHandler(MapMouseOutHandler handler)
          Removes a single handler of this map previously added with addMapMouseOutHandler(MapMouseOutHandler).
 void removeMapMouseOverHandler(MapMouseOverHandler handler)
          Removes a single handler of this map previously added with addMapMouseOverHandler(MapMouseOverHandler).
 void removeMapMoveEndHandler(MapMoveEndHandler handler)
          Removes a single handler of this map previously added with addMapMoveEndHandler(MapMoveEndHandler).
 void removeMapMoveHandler(MapMoveHandler handler)
          Removes a single handler of this map previously added with addMapMoveHandler(MapMoveHandler).
 void removeMapMoveStartHandler(MapMoveStartHandler handler)
          Removes a single handler of this map previously added with addMapMoveStartHandler(MapMoveStartHandler).
 void removeMapRemoveMapTypeHandler(MapRemoveMapTypeHandler handler)
          Removes a single handler of this map previously added with addMapRemoveMapTypeHandler(MapRemoveMapTypeHandler).
 void removeMapRemoveOverlayHandler(MapRemoveOverlayHandler handler)
          Removes a single handler of this map previously added with addMapRemoveOverlayHandler(MapRemoveOverlayHandler).
 void removeMapRightClickHandler(MapRightClickHandler handler)
          Removes a single handler of this map previously added with addMapRightClickHandler(MapRightClickHandler).
 void removeMapType(MapType type)
          Removes the map type from the map.
 void removeMapTypeChangedHandler(MapTypeChangedHandler handler)
          Removes a single handler of this map previously added with addMapTypeChangedHandler(MapTypeChangedHandler).
 void removeMapZoomEndHandler(MapZoomEndHandler handler)
          Removes a single handler of this map previously added with addMapZoomEndHandler(MapZoomEndHandler).
 void removeOverlay(Overlay overlay)
          Removes the overlay from the map.
 void returnToSavedPosition()
          Restores the map view that was saved by savePosition().
 void savePosition()
          Stores the current map position and zoom level for later recall by returnToSavedPosition().
 void setCenter(LatLng center)
          Centers the map to the given latitude and longitude.
 void setCenter(LatLng center, int zoomLevel)
          Centers the map to the given latitude and longitude and sets the zoom level.
 void setCenter(LatLng center, int zoomLevel, MapType type)
          Centers the map to the given latitude and longitude and sets the zoom level and current map type.
 void setContinuousZoom(boolean enabled)
          Enables or disables continuous zooming on supported browsers.
 void setCurrentMapType(MapType type)
          Sets the view to the given map type.
 void setDoubleClickZoom(boolean enabled)
          Enables or disables the double click to zoom functionality.
 void setDraggable(boolean draggable)
          Sets whether the map is draggable.
 void setGoogleBarEnabled(boolean enabled)
          Enables or disables the GoogleBar, an integrated search control, to the map.
 void setHeight(java.lang.String height)
           
 void setInfoWindowEnabled(boolean enabled)
          Sets whether info window operations on the map are enabled.
 void setPinchToZoom(boolean value)
          Enables or disables pinching to zoom on an iPhone or iPod touch.
 void setScrollWheelZoomEnabled(boolean enabled)
          Enables zooming using a mouse's scroll wheel.
 void setSize(java.lang.String width, java.lang.String height)
           
 void setUI(MapUIOptions options)
          Adds behaviour and UI elements specified in the options parameter, which can be a modified version of the object returned from getDefaultUI().
 void setUIToDefault()
          Adds the default behaviour and UI elements specified in getDefaultUI() to the Map.
 void setWidth(java.lang.String width)
           
 void setZoomLevel(int level)
          Sets the zoom level to the given new value.
 void zoomIn()
          Increments zoom level by one.
 void zoomOut()
          Decrements zoom level by one.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setPixelSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MapWidget

public MapWidget()

MapWidget

public MapWidget(LatLng center,
                 int zoomLevel)
Creates a new map widget and sets the view to the given center and zoom level.

Parameters:
center - the geographical point about which to center
zoomLevel - the zoom level

MapWidget

public MapWidget(LatLng center,
                 int zoomLevel,
                 MapOptions options)
Creates a new map widget and sets the view to the specified center point and zoom level. Note: The 'load' event requires that a handler be registered before GMap2.setCenter() is called. Since that method is always called in this constructor, it isn't clear that gwt-google-apis users needs this event.

Parameters:
center - the geographical point about which to center
zoomLevel - zoomLevel the zoom level
options - optional settings to specify when creating the map.

MapWidget

@Deprecated
public MapWidget(LatLng center,
                            int zoomLevel,
                            java.lang.String draggableCursor,
                            java.lang.String draggingCursor)
Deprecated. Use MapWidget(LatLng, int, MapOptions) instead.

Creates a new map widget and sets the view to the specified center point and zoom level. Also, sets the dragging and draggable cursor values. See the W3C CSS spec for allowable cursor string values. Note: The 'load' event requires that a handler be registered before GMap2.setCenter() is called. Since that method is always called in this constructor, it isn't clear that gwt-google-apis users needs this event.

Parameters:
center - the geographical point about which to center
zoomLevel - zoomLevel the zoom level
draggableCursor - CSS name of the cursor to display when the map is draggable
draggingCursor - CSS name of the cursor to display when the map is being dragged
Method Detail

addControl

public void addControl(Control control)
Adds a control to the map. The default position of the control is used. A control instance cannot be added more than once to the map.

Parameters:
control - the control to be added

addControl

public void addControl(Control control,
                       ControlPosition position)
Adds a control to the map at the given position. A control instance cannot be added more than once to the map.

Parameters:
control - the control to be added
position - the position of the control

addControlWidget

public void addControlWidget(com.google.gwt.user.client.ui.Widget w)
Adds a Control's widget to the map. This method is not intended to be called by the user. To add a custom control to the map, subclass Control.CustomControl and implement the initialize(MapWidget) method.

Parameters:
w - the control widget to add to the map

addInfoWindowBeforeCloseHandler

public void addInfoWindowBeforeCloseHandler(MapInfoWindowBeforeCloseHandler handler)
This event is fired before the info window closes. (Since 2.83)

Parameters:
handler - the handler to call when this event fires.

addInfoWindowCloseHandler

public void addInfoWindowCloseHandler(MapInfoWindowCloseHandler handler)
This event is fired when the info window closes. The handler MapInfoWindowBeforeCloseHandler is fired before this event. If a currently open info window is reopened at a different point using another call to openInfoWindow*(), the handler MapInfoWindowBeforeCloseHandler, MapInfoWindowCloseHandler and MapInfoWindowOpenHandler are fired in this order

Parameters:
handler - the handler to call when this event fires.

addInfoWindowOpenHandler

public void addInfoWindowOpenHandler(MapInfoWindowOpenHandler handler)
This event is fired when the info window opens.

Parameters:
handler - the handler to call when this event fires.

addMapAddMapTypeHandler

public void addMapAddMapTypeHandler(MapAddMapTypeHandler handler)
This event is fired when a map type is added to the map.

Parameters:
handler - the handler to call when this event fires.

addMapAddOverlayHandler

public void addMapAddOverlayHandler(MapAddOverlayHandler handler)
This event is fired when a single overlay is added to the map by the method addOverlay(). The new overlay is passed as an argument overlay to the event handler.

Parameters:
handler - the handler to call when this event fires.

addMapClearOverlaysHandler

public void addMapClearOverlaysHandler(MapClearOverlaysHandler handler)
This event is fired when all overlays are removed at once by the method clearOverlays().

Parameters:
handler - the handler to call when this event fires.

addMapClickHandler

public void addMapClickHandler(MapClickHandler handler)
Add a click handler for mouse click events. Note: this event fires even for double click events (twice!).

Parameters:
handler - handler to invoke on mouse click events.

addMapDoubleClickHandler

public void addMapDoubleClickHandler(MapDoubleClickHandler handler)
Add a double click handler for mouse double click events. Note that this event will not be invoked if the double click was on a marker object.

Parameters:
handler - handler to invoke on mouse double click events.

addMapDragEndHandler

public void addMapDragEndHandler(MapDragEndHandler handler)
This event is fired when the user stops dragging the map.

Parameters:
handler - the handler to call when this event fires.

addMapDragHandler

public void addMapDragHandler(MapDragHandler handler)
This event is repeatedly fired while the user drags the map.

Parameters:
handler - the handler to call when this event fires.

addMapDragStartHandler

public void addMapDragStartHandler(MapDragStartHandler handler)
This event is fired when the user starts dragging the map.

Parameters:
handler - the handler to call when this event fires.

addMapMouseMoveHandler

public void addMapMouseMoveHandler(MapMouseMoveHandler handler)
This event is fired when the user moves the mouse over the map from outside the map.

Parameters:
handler - the handler to call when this event fires.

addMapMouseOutHandler

public void addMapMouseOutHandler(MapMouseOutHandler handler)
This event is fired when the user moves the mouse over the map from outside the map.

Parameters:
handler - the handler to call when this event fires.

addMapMouseOverHandler

public void addMapMouseOverHandler(MapMouseOverHandler handler)
This event is fired when the user moves the mouse over the map from outside the map.

Parameters:
handler - the handler to call when this event fires.

addMapMoveEndHandler

public void addMapMoveEndHandler(MapMoveEndHandler handler)
This event is fired when the change of the map view ends.

Parameters:
handler - the handler to call when this event fires.

addMapMoveHandler

public void addMapMoveHandler(MapMoveHandler handler)
This event is fired, possibly repeatedly, while the map view is changing.

Parameters:
handler - handler to invoke on map move events.

addMapMoveStartHandler

public void addMapMoveStartHandler(MapMoveStartHandler handler)
This event is fired when the map view starts changing. This can be caused by dragging, in which case a MapDragStartHandler.MapDragStartEvent is also fired, or by invocation of a method that changes the map view.

Parameters:
handler - handler to invoke on map move events.

addMapRemoveMapTypeHandler

public void addMapRemoveMapTypeHandler(MapRemoveMapTypeHandler handler)
This event is fired when a map type is removed from the map.

Parameters:
handler - the handler to call when this event fires.

addMapRemoveOverlayHandler

public void addMapRemoveOverlayHandler(MapRemoveOverlayHandler handler)
This handler is fired when a single overlay is removed by the method removeOverlay(Overlay). The overlay that was removed is passed as an argument overlay to the event handler.

Parameters:
handler - the handler to call when this event fires.

addMapRightClickHandler

public void addMapRightClickHandler(MapRightClickHandler handler)
Add a click handler for mouse right click events. This event is fired when the DOM contextmenu event is fired on the map container. If the right click was on a marker, then the marker is passed to the event handler in the overlay argument. The pixel coordinates (in the DOM element that holds the map) of the point that was right clicked and the source element of the DOM event are passed in the point and src arguments respectively. Note that if it is a double right click and double click to zoom is enabled, then the map zooms out and no MapRightClickHandler event is fired. If, however, double click to zoom is disabled, two MapRightClickHandler events will be fired.

Parameters:
handler - handler to invoke on mouse click events.

addMapType

public void addMapType(MapType type)
Adds a new map type to the map. See section GMapType for how to define custom map types.

Parameters:
type -

addMapTypeChangedHandler

public void addMapTypeChangedHandler(MapTypeChangedHandler handler)
This event is fired when another map type is selected.

Parameters:
handler - the handler to call when this event fires.

addMapZoomEndHandler

public void addMapZoomEndHandler(MapZoomEndHandler handler)
This event is fired when the map reaches a new zoom level.

Parameters:
handler - the handler to call when this event fires.

addOverlay

public void addOverlay(Overlay overlay)
Adds an overlay to the map and fires any registered MapAddOverlayHandler.

Parameters:
overlay -

checkResize

public void checkResize()
Notifies the map of a change of the size of its container.


checkResizeAndCenter

public void checkResizeAndCenter()
Notifies the map of a change in the size of its container and moves to the center of the map. Call this method after the size of the container DOM object has changed, so that the map can adjust itself to fit the new size. Note: This call may cause problems with the Maps API if called during a Zoom or other transition.


clearOverlays

public void clearOverlays()
Removes all overlay from the map, and fires any registered MapClearOverlaysHandler.


closeInfoWindow

public void closeInfoWindow()
Close the currently open InfoWindow.


convertContainerPixelToLatLng

public LatLng convertContainerPixelToLatLng(Point pixel)
Computes the geographical coordinates from pixel coordinates in the div that holds the draggable map. You need this when you implement interaction with custom overlays.

Parameters:
pixel - the container coordinates
Returns:
the corresponding geographical coordinates

convertDivPixelToLatLng

public LatLng convertDivPixelToLatLng(Point pixel)
Computes the geographical coordinates from pixel coordinates in the div that holds the draggable map. This may be helpful for when you implement interaction with custom overlays that don't extend the Overlay interface. If this doesn't give you the expected output, try convertContainerPixelToLatLng(Point) instead.

Parameters:
pixel - point on the map to convert to Lat/Lng
Returns:
a set of converted coordinates

convertLatLngToContainerPixel

public Point convertLatLngToContainerPixel(LatLng latlng)
Computes the pixel coordinates of the given geographical point in the DOM element that contains the map on the page.

Parameters:
latlng - the geographical coordinates
Returns:
the corresponding projection pixel

convertLatLngToDivPixel

public Point convertLatLngToDivPixel(LatLng latlng)
Computes the pixel coordinates of the given geographical point in the DOM element that holds the draggable map. You need this method to position a custom overlay when you implement the GOverlay.redraw() method for a custom overlay.

Parameters:
latlng - the geographical coordinates
Returns:
the corresponding projection pixel

getBounds

public LatLngBounds getBounds()
Returns the the visible rectangular region of the map view in geographical coordinates.

Returns:
the visible region of the map view

getBoundsZoomLevel

public int getBoundsZoomLevel(LatLngBounds bounds)
Returns the zoom level at which the given rectangular region fits in the map view. The zoom level is computed for the currently selected map type. If no map type is selected yet, the first on the list of map types is used.

Parameters:
bounds - a rectangular region to test
Returns:
the zoom level at which the bounds fit in the map view.

getCenter

public LatLng getCenter()
Returns the geographical coordinates of the center point of the map view.

Returns:
the center of the map view

getCurrentMapType

public MapType getCurrentMapType()
Returns the currently selected map type.

Returns:
the currently selected map type

getDefaultUI

public MapUIOptions getDefaultUI()
Returns a MapUIOptions object specifying default behaviour and UI elements for the Map, based on the UI of maps.google.com.


getDragObject

public DraggableObject getDragObject()
Returns the draggable object used by this map.

Returns:
the draggable object used by this map.

getEarthInstance

public void getEarthInstance(EarthInstanceHandler handler)
Asynchronously retrieves the Earth instance, initializing it if necessary. On success, the event will contain an initialized Earth Plugin object. On failure, the Earth Plugin object will be null.

Parameters:
handler - the EarthInstanceHandler to invoke on initialization or failure

getInfoWindow

public InfoWindow getInfoWindow()
Gets the info window associated with the map. There is only one info window per map.

Returns:
the info window associated with the map.

getMapTypes

public MapType[] getMapTypes()
Gets the array of map types registered with this map.

Returns:
the map types registered with this map

getPane

public MapPane getPane(MapPaneType type)
Returns the overlay DIV with the given id. Used by some subclasses of Overlay.

Parameters:
type - the id of the layer
Returns:
the corresponding overlay pane

getPeer

public com.google.gwt.core.client.JavaScriptObject getPeer()
This method is not meant to be published, but is needed internally to support the GeoXmlOverlay gotoDefaultViewport() method.

Returns:
JavaScript object that is encapsulated by the MapWidget object.

getSize

public Size getSize()
Returns the size of the map view in pixels.

Returns:
the size of the map view in pixels

getZoomLevel

public int getZoomLevel()
Returns the current zoom level.

Returns:
the current zoom level

installKeyboardHandler

public void installKeyboardHandler()
Enables keyboard shortcuts on the map.


isContinuousZoomEnabled

public boolean isContinuousZoomEnabled()
Returns true if continuous smooth zooming is enabled.

Returns:
true if continuous smooth zooming is enabled

isDoubleClickZoomEnabled

public boolean isDoubleClickZoomEnabled()
Returns true if double-click to zoom is enabled.

Returns:
true if double-click to zoom is enabled

isDraggable

public boolean isDraggable()
Returns true if dragging of the map is enabled.

Returns:
true if dragging of the map is enabled

isInfoWindowEnabled

public boolean isInfoWindowEnabled()
Returns true if opening info windows is enabled.

Returns:
true if opening info windows is enabled

isPinchToZoomEnabled

public boolean isPinchToZoomEnabled()
Returns a Boolean indicating whether pinch to zoom is enabled.

Returns:
true if ping to zoom is enabled.

isScrollWheelZoomEnabled

public boolean isScrollWheelZoomEnabled()
Returns true if zooming using a mouse's scroll wheel is enabled.

Returns:
true if zooming using a mouse's scroll wheel is enabled

onResize

public void onResize()
This method is automatically called by the parent container whenever it changes size. This allows a map that is sized to a certain percentage of its parent container to adjust its contents (eliminating grey areas at the border).

Specified by:
onResize in interface com.google.gwt.user.client.ui.RequiresResize

panBy

public void panBy(int dx,
                  int dy)
Starts a pan animation by the given distance in pixels. +1 is left and up, -1 is right and down.

Parameters:
dx - the number of pixels to pan left
dy - the number of pixels to pan up

panDirection

public void panDirection(int dx,
                         int dy)
Starts a pan animation by 1/3rd the size of the map in the indicated directions. +1 is right and down, -1 is left and up, respectively. For example, to do a large pan east, do panDirection(-1, 0).

Parameters:
dx - the number of units to pan left
dy - the number of units to pan up

panTo

public void panTo(LatLng center)
Centers the map to the given point. If the point is visible in the current map view, the map pans in a smooth animation.

Parameters:
center - the new center

removeControl

public void removeControl(Control control)
Removes the given control from the map.

Parameters:
control - the control to remove

removeInfoWindowBeforeCloseHandler

public void removeInfoWindowBeforeCloseHandler(MapInfoWindowBeforeCloseHandler handler)
Removes a single handler of this map previously added with addInfoWindowBeforeCloseHandler(MapInfoWindowBeforeCloseHandler) .

Parameters:
handler - the handler to remove

removeInfoWindowCloseHandler

public void removeInfoWindowCloseHandler(MapInfoWindowCloseHandler handler)
Removes a single handler of this map previously added with addInfoWindowCloseHandler(MapInfoWindowCloseHandler).

Parameters:
handler - the handler to remove

removeInfoWindowOpenHandler

public void removeInfoWindowOpenHandler(MapInfoWindowOpenHandler handler)
Removes a single handler of this map previously added with addInfoWindowOpenHandler(MapInfoWindowOpenHandler).

Parameters:
handler - the handler to remove

removeMapAddMapTypeHandler

public void removeMapAddMapTypeHandler(MapAddMapTypeHandler handler)
Removes a single handler of this map previously added with addMapAddMapTypeHandler(MapAddMapTypeHandler).

Parameters:
handler - the handler to remove

removeMapAddOverlayHandler

public void removeMapAddOverlayHandler(MapAddOverlayHandler handler)
Removes a single handler of this map previously added with addMapAddOverlayHandler(MapAddOverlayHandler).

Parameters:
handler - the handler to remove

removeMapClearOverlaysHandler

public void removeMapClearOverlaysHandler(MapClearOverlaysHandler handler)
Removes a single handler of this map previously added with addMapClearOverlaysHandler(MapClearOverlaysHandler).

Parameters:
handler - the handler to remove

removeMapClickHandler

public void removeMapClickHandler(MapClickHandler handler)
Removes a single handler of this map previously added with addMapClickHandler(MapClickHandler).

Parameters:
handler - the handler to remove

removeMapDoubleClickHandler

public void removeMapDoubleClickHandler(MapDoubleClickHandler handler)
Removes a single handler of this map previously added with addMapDoubleClickHandler(MapDoubleClickHandler).

Parameters:
handler - the handler to remove

removeMapDragEndHandler

public void removeMapDragEndHandler(MapDragEndHandler handler)
Removes a single handler of this map previously added with addMapDragEndHandler(MapDragEndHandler).

Parameters:
handler - the handler to remove

removeMapDragHandler

public void removeMapDragHandler(MapDragHandler handler)
Removes a single handler of this map previously added with addMapDragHandler(MapDragHandler).

Parameters:
handler - the handler to remove

removeMapDragStartHandler

public void removeMapDragStartHandler(MapDragStartHandler handler)
Removes a single handler of this map previously added with addMapDragStartHandler(MapDragStartHandler).

Parameters:
handler - the handler to remove

removeMapMouseMoveHandler

public void removeMapMouseMoveHandler(MapMouseMoveHandler handler)
Removes a single handler of this map previously added with addMapMouseOutHandler(MapMouseOutHandler).

Parameters:
handler - the handler to remove

removeMapMouseOutHandler

public void removeMapMouseOutHandler(MapMouseOutHandler handler)
Removes a single handler of this map previously added with addMapMouseOutHandler(MapMouseOutHandler).

Parameters:
handler - the handler to remove

removeMapMouseOverHandler

public void removeMapMouseOverHandler(MapMouseOverHandler handler)
Removes a single handler of this map previously added with addMapMouseOverHandler(MapMouseOverHandler).

Parameters:
handler - the handler to remove

removeMapMoveEndHandler

public void removeMapMoveEndHandler(MapMoveEndHandler handler)
Removes a single handler of this map previously added with addMapMoveEndHandler(MapMoveEndHandler).

Parameters:
handler - the handler to remove

removeMapMoveHandler

public void removeMapMoveHandler(MapMoveHandler handler)
Removes a single handler of this map previously added with addMapMoveHandler(MapMoveHandler).

Parameters:
handler - the handler to remove

removeMapMoveStartHandler

public void removeMapMoveStartHandler(MapMoveStartHandler handler)
Removes a single handler of this map previously added with addMapMoveStartHandler(MapMoveStartHandler).

Parameters:
handler - the handler to remove

removeMapRemoveMapTypeHandler

public void removeMapRemoveMapTypeHandler(MapRemoveMapTypeHandler handler)
Removes a single handler of this map previously added with addMapRemoveMapTypeHandler(MapRemoveMapTypeHandler).

Parameters:
handler - the handler to remove

removeMapRemoveOverlayHandler

public void removeMapRemoveOverlayHandler(MapRemoveOverlayHandler handler)
Removes a single handler of this map previously added with addMapRemoveOverlayHandler(MapRemoveOverlayHandler).

Parameters:
handler - the handler to remove

removeMapRightClickHandler

public void removeMapRightClickHandler(MapRightClickHandler handler)
Removes a single handler of this map previously added with addMapRightClickHandler(MapRightClickHandler).

Parameters:
handler - the handler to remove

removeMapType

public void removeMapType(MapType type)
Removes the map type from the map. If the current map type is removed, the map will switch to the first map type. The last remaining map type cannot be removed. This method will update the set of buttons displayed by the Control and will fire any registered instances of MapRemoveMapTypeHandler.


removeMapTypeChangedHandler

public void removeMapTypeChangedHandler(MapTypeChangedHandler handler)
Removes a single handler of this map previously added with addMapTypeChangedHandler(MapTypeChangedHandler).

Parameters:
handler - the handler to remove

removeMapZoomEndHandler

public void removeMapZoomEndHandler(MapZoomEndHandler handler)
Removes a single handler of this map previously added with addMapZoomEndHandler(MapZoomEndHandler).

Parameters:
handler - the handler to remove

removeOverlay

public void removeOverlay(Overlay overlay)
Removes the overlay from the map. If the overlay was on the map, it fires any MapRemoveOverlayHandler handlers.

Parameters:
overlay - the overlay to remove from the map

returnToSavedPosition

public void returnToSavedPosition()
Restores the map view that was saved by savePosition().


savePosition

public void savePosition()
Stores the current map position and zoom level for later recall by returnToSavedPosition().


setCenter

public void setCenter(LatLng center)
Centers the map to the given latitude and longitude. To center the map using a smooth animation see panTo(LatLng).

Parameters:
center - the geographical coordinate about which to center

setCenter

public void setCenter(LatLng center,
                      int zoomLevel)
Centers the map to the given latitude and longitude and sets the zoom level. To center the map using a smooth animation see panTo(LatLng).

Parameters:
center - the geographical coordinate about which to center
zoomLevel - the zoom level

setCenter

public void setCenter(LatLng center,
                      int zoomLevel,
                      MapType type)
Centers the map to the given latitude and longitude and sets the zoom level and current map type. The map type must be known to the map. To center the map using a smooth animation see panTo(LatLng).

Parameters:
center - the geographical coordinate about which to center
zoomLevel - the zoom level
type - the viewed map type

setContinuousZoom

public void setContinuousZoom(boolean enabled)
Enables or disables continuous zooming on supported browsers. Continuous zooming is disabled by default.

Parameters:
enabled - true to enable continuous zooming

setCurrentMapType

public void setCurrentMapType(MapType type)
Sets the view to the given map type. The type must be known to the map via addMapType(MapType) or be one of the three default map types.

Parameters:
type - the desired map type

setDoubleClickZoom

public void setDoubleClickZoom(boolean enabled)
Enables or disables the double click to zoom functionality. Double-click to zoom is disabled by default.

Parameters:
enabled - true to enable double-click to zoom.

setDraggable

public void setDraggable(boolean draggable)
Sets whether the map is draggable.

Parameters:
draggable - true if the map is draggable

setGoogleBarEnabled

public void setGoogleBarEnabled(boolean enabled)
Enables or disables the GoogleBar, an integrated search control, to the map. When enabled, this control takes the place of the default Powered By Google logo. Note that this control is not enabled by default.

Parameters:
enabled - pass true to enable the Googlebar.

setHeight

public void setHeight(java.lang.String height)
Overrides:
setHeight in class com.google.gwt.user.client.ui.UIObject

setInfoWindowEnabled

public void setInfoWindowEnabled(boolean enabled)
Sets whether info window operations on the map are enabled. Info windows are enabled by default.

Parameters:
enabled - true to enable opening info windows

setPinchToZoom

public void setPinchToZoom(boolean value)
Enables or disables pinching to zoom on an iPhone or iPod touch. Note: pinch to zoom is enabled by default.

Parameters:
value - pass false to disable pinching to zoom.

setScrollWheelZoomEnabled

public void setScrollWheelZoomEnabled(boolean enabled)
Enables zooming using a mouse's scroll wheel. Scroll wheel zoom is disabled by default.

Parameters:
enabled - true to enable scroll wheel zooming

setSize

public void setSize(java.lang.String width,
                    java.lang.String height)
Overrides:
setSize in class com.google.gwt.user.client.ui.UIObject

setUI

public void setUI(MapUIOptions options)
Adds behaviour and UI elements specified in the options parameter, which can be a modified version of the object returned from getDefaultUI().

Parameters:
options - the user interface options to set on the map.

setUIToDefault

public void setUIToDefault()
Adds the default behaviour and UI elements specified in getDefaultUI() to the Map.


setWidth

public void setWidth(java.lang.String width)
Overrides:
setWidth in class com.google.gwt.user.client.ui.UIObject

setZoomLevel

public void setZoomLevel(int level)
Sets the zoom level to the given new value.

Parameters:
level - the new zoom level

zoomIn

public void zoomIn()
Increments zoom level by one.


zoomOut

public void zoomOut()
Decrements zoom level by one.


addVirtual

protected void addVirtual(com.google.gwt.user.client.ui.Widget w)
Adopts the widget, but does not modify the DOM.

Parameters:
w - the widget to adopt

onAttach

protected void onAttach()
Overrides:
onAttach in class com.google.gwt.user.client.ui.Composite