Follow us on GitHub

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.maps.client.mvc.MVCObjectWidget<MapImpl>
              extended by com.google.gwt.maps.client.MapWidget
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsWidget

public class MapWidget
extends MVCObjectWidget<MapImpl>


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.maps.client.mvc.MVCObjectWidget
impl
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
MapWidget(MapOptions options)
          create a new Map Widget
 
Method Summary
 HandlerRegistration addBoundsChangeHandler(BoundsChangeMapHandler handler)
          This event is fired when the viewport bounds have changed.
 HandlerRegistration addCenterChangeHandler(CenterChangeMapHandler handler)
          This event is fired when the map center property changes.
 HandlerRegistration addClickHandler(ClickMapHandler handler)
          This event is fired when the user clicks on the map (but not when they click on a marker or infowindow).
 HandlerRegistration addDblClickHandler(DblClickMapHandler handler)
          This event is fired when the user double-clicks on the map.
 HandlerRegistration addDragEndHandler(DragEndMapHandler handler)
          This event is fired when the user stops dragging the map.
 HandlerRegistration addDragHandler(DragMapHandler handler)
          This event is repeatedly fired while the user drags the map.
 HandlerRegistration addDragStartHandler(DragStartMapHandler handler)
          This event is fired when the user starts dragging the map.
 HandlerRegistration addHeadingChangeHandler(HeadingChangeMapHandler handler)
          This event is fired when the map heading property changes.
 HandlerRegistration addIdleHandler(IdleMapHandler handler)
          This event is fired when the map becomes idle after panning or zooming.
 HandlerRegistration addMapTypeIdChangeHandler(MapTypeIdChangeMapHandler handler)
          This event is fired when the mapTypeId property changes.
 HandlerRegistration addMouseMoveHandler(MouseMoveMapHandler handler)
          This event is fired whenever the user's mouse moves over the map container.
 HandlerRegistration addMouseOutMoveHandler(MouseOutMapHandler handler)
          This event is fired when the user's mouse exits the map container.
 HandlerRegistration addMouseOverHandler(MouseOverMapHandler handler)
          This event is fired when the user's mouse enters the map container.
 HandlerRegistration addProjectionChangeHandler(ProjectionChangeMapHandler handler)
          This event is fired when the projection has changed.
 HandlerRegistration addResizeHandler(ResizeMapHandler handler)
          Developers should trigger this event on the map when the div changes size: google.maps.event.trigger(map, 'resize') .
 HandlerRegistration addRightClickHandler(RightClickMapHandler handler)
          This event is fired when the DOM contextmenu event is fired on the map container.
 HandlerRegistration addTilesLoadedHandler(TilesLoadedMapHandler handler)
          This event is fired when the visible tiles have finished loading.
 HandlerRegistration addTiltChangeHandler(TiltChangeMapHandler handler)
          This event is fired when the map tilt property changes.
 HandlerRegistration addZoomChangeHandler(ZoomChangeMapHandler handler)
          This event is fired when the map zoom property changes.
 void fitBounds(LatLngBounds bounds)
          Sets the viewport to contain the given bounds.
 LatLngBounds getBounds()
          Returns the lat/lng bounds of the current viewport.
 LatLng getCenter()
          get Center
 MVCArray<Element> getControls()
          TODO gets Additional controls to attach to the map.
 Element getDiv()
          get Element
 int getHeading()
          Returns the compass heading of aerial imagery.
 MapImpl getJso()
          get JavaScriptObject instance.
 MapTypeId getMapTypeId()
          gets MapTypeId
 MapTypeRegistry getMapTypeRegistry()
          gets a registry of MapType instances
 MVCArray<JavaScriptObject> getOverlayMapTypes()
          TODO gets Additional map types to overlay.
 Projection getProjection()
          Returns the current Projection.
 StreetViewPanoramaImpl getStreetView()
          Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView().
 int getTilt()
          gets Returns the angle of incidence for aerial imagery (available for SATELLITE and HYBRID map types) measured in degrees from the viewport plane to the map plane.
 int getZoom()
          get zoom
static MapWidget newInstance(MapImpl impl)
          Reconstruct the mapWidget from JSO
protected  void onDetach()
           
 void panBy(int x, int y)
          Changes the center of the map by the given distance in pixels.
 void panTo(LatLng latLng)
          Changes the center of the map to the given LatLng.
 void panToBounds(LatLngBounds latLngBounds)
          Pans the map by the minimum amount necessary to contain the given LatLngBounds.
 void setCenter(LatLng latlng)
          set center
 void setControls(ControlPosition controlPosition, Element element)
          sets Additional controls to attach to the map.
 void setControls(ControlPosition controlPosition, Widget widget)
          sets Additional controls to attach to the map.
 void setControls(MVCArray<Element> controls)
          TODO sets Additional controls to attach to the map.
 void setCustomMapType(String mapTypeId, StyledMapType styledType)
          Set the custom map type into the map's registry
 void setHeading(int heading)
          Sets the compass heading for aerial imagery measured in degrees from cardinal direction North.
 void setJso(MapImpl impl)
          sets JavaScriptObject instance.
 void setMapTypeId(MapTypeId mapTypeId)
          set MapTypeId
 void setMapTypesRegistry(MapTypeRegistry mapTypes)
          TODO sets A registry of MapType instances by string ID.
 void setOptions(MapOptions options)
          set MapOptions
 void setOverlayMapTypes(MVCArray<JavaScriptObject> overlayMapTypes)
          TODO sets Additional map types to overlay.
 void setStreetView(StreetViewPanoramaImpl panorama)
          Sets the angle of incidence for aerial imagery (available for SATELLITE and HYBRID map types) measured in degrees from the viewport plane to the map plane.
 void setTilt(int tilt)
          Sets the angle of incidence for aerial imagery (available for SATELLITE and HYBRID map types) measured in degrees from the viewport plane to the map plane.
 void setZoom(int zoom)
          sets map zoom
 
Methods inherited from class com.google.gwt.maps.client.mvc.MVCObjectWidget
getMVCObject
 
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, isAttached, isOrWasAttached, onAttach, onBrowserEvent, 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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, 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(MapOptions options)
create a new Map Widget

Parameters:
options - MapOptions
Method Detail

newInstance

public static MapWidget newInstance(MapImpl impl)
Reconstruct the mapWidget from JSO

Parameters:
impl -
Returns:
NULL if input is NULL

onDetach

protected void onDetach()
Overrides:
onDetach in class Widget

getJso

public MapImpl getJso()
get JavaScriptObject instance.

Returns:
MapImpl

setJso

public void setJso(MapImpl impl)
sets JavaScriptObject instance.

Parameters:
impl - MapImpl

fitBounds

public void fitBounds(LatLngBounds bounds)
Sets the viewport to contain the given bounds.

Parameters:
bounds - LatLngBounds

getBounds

public LatLngBounds getBounds()
Returns the lat/lng bounds of the current viewport. If the map is not yet initialized (i.e. the mapType is still null), or center and zoom have not been set then the result is null or undefined.

Returns:
LatLngBounds

getCenter

public LatLng getCenter()
get Center

Returns:
LatLng

getDiv

public Element getDiv()
get Element


getHeading

public int getHeading()
Returns the compass heading of aerial imagery. The heading value is measured in degrees (clockwise) from cardinal direction North.

Returns:
int

getMapTypeId

public final MapTypeId getMapTypeId()
gets MapTypeId

Returns:
MapTypeId

getProjection

public Projection getProjection()
Returns the current Projection. If the map is not yet initialized (i.e. the mapType is still null) then the result is null. Listen to projection_changed and check its value to ensure it is not null.

Returns:
Projection

getStreetView

public StreetViewPanoramaImpl getStreetView()
Returns the default StreetViewPanorama bound to the map, which may be a default panorama embedded within the map, or the panorama set using setStreetView(). Changes to the map's streetViewControl will be reflected in the display of such a bound panorama.

Returns:
StreetViewPanoramaImpl

getTilt

public int getTilt()
gets Returns the angle of incidence for aerial imagery (available for SATELLITE and HYBRID map types) measured in degrees from the viewport plane to the map plane. A value of 0 indicates no angle of incidence (no tilt) while 45° imagery will return a value of 45.


getZoom

public int getZoom()
get zoom


panBy

public void panBy(int x,
                  int y)
Changes the center of the map by the given distance in pixels. If the distance is less than both the width and height of the map, the transition will be smoothly animated. Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).

Parameters:
x -
y -

panTo

public void panTo(LatLng latLng)
Changes the center of the map to the given LatLng. If the change is less than both the width and height of the map, the transition will be smoothly animated.

Parameters:
latLng -

panToBounds

public void panToBounds(LatLngBounds latLngBounds)
Pans the map by the minimum amount necessary to contain the given LatLngBounds. It makes no guarantee where on the map the bounds will be, except that as much of the bounds as possible will be visible. The bounds will be positioned inside the area bounded by the map type and navigation (pan, zoom, and Street View) controls, if they are present on the map. If the bounds is larger than the map, the map will be shifted to include the northwest corner of the bounds. If the change in the map's position is less than both the width and height of the map, the transition will be smoothly animated.

Parameters:
latLngBounds -

setCenter

public void setCenter(LatLng latlng)
set center

Parameters:
latlng -

setHeading

public void setHeading(int heading)
Sets the compass heading for aerial imagery measured in degrees from cardinal direction North.

Parameters:
heading -

setMapTypeId

public final void setMapTypeId(MapTypeId mapTypeId)
set MapTypeId

Parameters:
mapTypeId -

setOptions

public void setOptions(MapOptions options)
set MapOptions

Parameters:
options -

setStreetView

public void setStreetView(StreetViewPanoramaImpl panorama)
Sets the angle of incidence for aerial imagery (available for SATELLITE and HYBRID map types) measured in degrees from the viewport plane to the map plane. The only supported values are 0, indicating no angle of incidence (no tilt), and 45 indicating a tilt of 45°.

Parameters:
panorama -

setTilt

public void setTilt(int tilt)
Sets the angle of incidence for aerial imagery (available for SATELLITE and HYBRID map types) measured in degrees from the viewport plane to the map plane. The only supported values are 0, indicating no angle of incidence (no tilt), and 45 indicating a tilt of 45°.

Parameters:
tilt -

setZoom

public void setZoom(int zoom)
sets map zoom

Parameters:
zoom -

setControls

public void setControls(MVCArray<Element> controls)
TODO sets Additional controls to attach to the map. To add a control to the map, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.

Parameters:
controls -

setControls

public void setControls(ControlPosition controlPosition,
                        Element element)
sets Additional controls to attach to the map. To add a control to the map, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.

Parameters:
controlPosition -
element -

setControls

public void setControls(ControlPosition controlPosition,
                        Widget widget)
sets Additional controls to attach to the map. To add a control to the map, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.

Parameters:
controlPosition -
widget -

getControls

public MVCArray<Element> getControls()
TODO gets Additional controls to attach to the map. To add a control to the map, add the control's <div> to the MVCArray corresponding to the ControlPosition where it should be rendered.


setMapTypesRegistry

public void setMapTypesRegistry(MapTypeRegistry mapTypes)
TODO sets A registry of MapType instances by string ID.

Parameters:
mapTypes -

setCustomMapType

public void setCustomMapType(String mapTypeId,
                             StyledMapType styledType)
Set the custom map type into the map's registry

Parameters:
mapTypeId -
styledType -

getMapTypeRegistry

public MapTypeRegistry getMapTypeRegistry()
gets a registry of MapType instances


setOverlayMapTypes

public void setOverlayMapTypes(MVCArray<JavaScriptObject> overlayMapTypes)
TODO sets Additional map types to overlay.

Parameters:
overlayMapTypes -

getOverlayMapTypes

public MVCArray<JavaScriptObject> getOverlayMapTypes()
TODO gets Additional map types to overlay.


addBoundsChangeHandler

public HandlerRegistration addBoundsChangeHandler(BoundsChangeMapHandler handler)
This event is fired when the viewport bounds have changed.

Parameters:
handler - BoundsChangeMapHandler
Returns:
MapHandlerRegistration

addCenterChangeHandler

public HandlerRegistration addCenterChangeHandler(CenterChangeMapHandler handler)
This event is fired when the map center property changes.

Parameters:
handler - CenterChangeMapHandler
Returns:
MapHandlerRegistration

addClickHandler

public HandlerRegistration addClickHandler(ClickMapHandler handler)
This event is fired when the user clicks on the map (but not when they click on a marker or infowindow).

Parameters:
handler - ClickMapHandler
Returns:
MapHandlerRegistration

addDblClickHandler

public HandlerRegistration addDblClickHandler(DblClickMapHandler handler)
This event is fired when the user double-clicks on the map. Note that the click event will also fire, right before this one.

Parameters:
handler - DblClickMapHandler
Returns:
MapHandlerRegistration

addDragHandler

public HandlerRegistration addDragHandler(DragMapHandler handler)
This event is repeatedly fired while the user drags the map.

Parameters:
handler - DragMapHandler
Returns:
MapHandlerRegistration

addDragEndHandler

public HandlerRegistration addDragEndHandler(DragEndMapHandler handler)
This event is fired when the user stops dragging the map.

Parameters:
handler - DragEndMapHandler
Returns:
MapHandlerRegistration

addDragStartHandler

public HandlerRegistration addDragStartHandler(DragStartMapHandler handler)
This event is fired when the user starts dragging the map.

Parameters:
handler - DragStartMapHandler
Returns:
MapHandlerRegistration

addHeadingChangeHandler

public HandlerRegistration addHeadingChangeHandler(HeadingChangeMapHandler handler)
This event is fired when the map heading property changes.

Parameters:
handler - HeadingChangeMapHandler
Returns:
MapHandlerRegistration

addIdleHandler

public HandlerRegistration addIdleHandler(IdleMapHandler handler)
This event is fired when the map becomes idle after panning or zooming.

Parameters:
handler - IdleMapHandler
Returns:
MapHandlerRegistration

addMapTypeIdChangeHandler

public HandlerRegistration addMapTypeIdChangeHandler(MapTypeIdChangeMapHandler handler)
This event is fired when the mapTypeId property changes.

Parameters:
handler - MapTypeIdChangeMapHandler
Returns:
MapHandlerRegistration

addMouseMoveHandler

public HandlerRegistration addMouseMoveHandler(MouseMoveMapHandler handler)
This event is fired whenever the user's mouse moves over the map container.

Parameters:
handler - MouseMoveMapHandler
Returns:
MapHandlerRegistration

addMouseOutMoveHandler

public HandlerRegistration addMouseOutMoveHandler(MouseOutMapHandler handler)
This event is fired when the user's mouse exits the map container.

Parameters:
handler - MouseOutMapHandler
Returns:
MapHandlerRegistration

addMouseOverHandler

public HandlerRegistration addMouseOverHandler(MouseOverMapHandler handler)
This event is fired when the user's mouse enters the map container.

Parameters:
handler - MouseOverMapHandler
Returns:
MapHandlerRegistration

addProjectionChangeHandler

public HandlerRegistration addProjectionChangeHandler(ProjectionChangeMapHandler handler)
This event is fired when the projection has changed.

Parameters:
handler - ProjectionChangeMapHandler
Returns:
MapHandlerRegistration

addResizeHandler

public HandlerRegistration addResizeHandler(ResizeMapHandler handler)
Developers should trigger this event on the map when the div changes size: google.maps.event.trigger(map, 'resize') .

Parameters:
handler - ResizeMapHandler
Returns:
MapHandlerRegistration

addRightClickHandler

public HandlerRegistration addRightClickHandler(RightClickMapHandler handler)
This event is fired when the DOM contextmenu event is fired on the map container.

Parameters:
handler - RightClickMapHandler
Returns:
MapHandlerRegistration

addTilesLoadedHandler

public HandlerRegistration addTilesLoadedHandler(TilesLoadedMapHandler handler)
This event is fired when the visible tiles have finished loading.

Parameters:
handler - TilesLoadedMapHandler
Returns:
MapHandlerRegistration

addTiltChangeHandler

public HandlerRegistration addTiltChangeHandler(TiltChangeMapHandler handler)
This event is fired when the map tilt property changes.

Parameters:
handler - TiltChangeMapHandler
Returns:
MapHandlerRegistration

addZoomChangeHandler

public HandlerRegistration addZoomChangeHandler(ZoomChangeMapHandler handler)
This event is fired when the map zoom property changes.

Parameters:
handler - ZoomChangeMapHandler
Returns:
MapHandlerRegistration


Follow us on GitHub

Copyright © 2011-2012 Gone Vertical LLC. All Rights Reserved.