com.google.gwt.maps.client.overlay
Class Marker

java.lang.Object
  extended by com.google.gwt.maps.client.overlay.Overlay
      extended by com.google.gwt.maps.client.overlay.Overlay.ConcreteOverlay
          extended by com.google.gwt.maps.client.overlay.Marker

public class Marker
extends Overlay.ConcreteOverlay

Marks a position on the map. It extends the ConcreteOverlay class and thus is added to the map using the MapWidget.addOverlay() method. A marker object has a point, which is the geographical position where the marker is anchored on the map, and an icon. If the icon is not set in the constructor, the default icon Icon.DEFAULT_ICON is used. After it is added to a map, the info window of that map can be opened through the marker. The marker object will fire mouse events and InfoWindow events.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.maps.client.overlay.Overlay
Overlay.ConcreteOverlay
 
Field Summary
 
Fields inherited from class com.google.gwt.maps.client.overlay.Overlay
jsoPeer
 
Constructor Summary
Marker(LatLng point)
          Create a new marker at the specified point using default options.
Marker(LatLng point, MarkerOptions options)
          Create a new marker at the specified point using the supplied options overrides.
 
Method Summary
 void addMarkerClickHandler(MarkerClickHandler handler)
          This event is fired when the marker icon was clicked.
 void addMarkerDoubleClickHandler(MarkerDoubleClickHandler handler)
          This event is fired when the marker icon was double-clicked.
 void addMarkerDragEndHandler(MarkerDragEndHandler handler)
          If the marker is enabled for dragging, this event is fired when the marker ceases to be dragged.
 void addMarkerDragHandler(MarkerDragHandler handler)
          If the marker is enabled for dragging, this event is fired when the marker is being dragged.
 void addMarkerDragStartHandler(MarkerDragStartHandler handler)
          If the marker is enabled for dragging, this event is fired when the marker dragging begins.
 void addMarkerInfoWindowBeforeCloseHandler(MarkerInfoWindowBeforeCloseHandler handler)
          This event is fired before the info window of the map that was opened through this marker is closed.
 void addMarkerInfoWindowCloseHandler(MarkerInfoWindowCloseHandler handler)
          This event is fired when the info window of the map that was opened through this marker is closed.
 void addMarkerInfoWindowOpenHandler(MarkerInfoWindowOpenHandler handler)
          This event is fired when the info window of the map was opened through this marker.
 void addMarkerMouseDownHandler(MarkerMouseDownHandler handler)
          This event is fired when the DOM "mousedown" event is fired on the marker icon.
 void addMarkerMouseOutHandler(MarkerMouseOutHandler handler)
          This event is fired when the mouse leaves the area of the marker icon.
 void addMarkerMouseOverHandler(MarkerMouseOverHandler handler)
          This event is fired when the mouse enters the area of the marker icon.
 void addMarkerMouseUpHandler(MarkerMouseUpHandler handler)
          This event is fired for the DOM "mouseup" on the marker.
 void addMarkerRemoveHandler(MarkerRemoveHandler handler)
          This event is fired when the marker is removed from the map, using MapWidget.removeOverlay(com.google.gwt.maps.client.overlay.Overlay) or MapWidget.clearOverlays().
 void addMarkerVisibilityChangedHandler(MarkerVisibilityChangedHandler handler)
          This event is fired when the visibility of the marker is changed (i.e.
 void closeInfoWindow()
          Closes the info window only if it belongs to this marker.
 Icon getIcon()
           
 LatLng getLatLng()
          Returns the geographical coordinates at which this marker is anchored, as set by the constructor or by setLatLng(LatLng).
 LatLng getPoint()
          Deprecated.  
 java.lang.String getTitle()
          Returns the title of this marker, as set by the constructor via the MarkerOptions.setTitle(String) method.
 boolean isDraggable()
          See if this Marker was created as a draggable marker type, that is, the draggable option was set in MarkerOptions when it was constructed.
 boolean isDraggingEnabled()
          Returns true if this marker is not only a draggable type of marker.
 boolean isVisible()
          Returns true if the marker is currently visible on the map.
 void removeMarkerClickHandler(MarkerClickHandler handler)
          Removes a single handler of this map previously added with addMarkerClickHandler(MarkerClickHandler).
 void removeMarkerDoubleClickHandler(MarkerDoubleClickHandler handler)
          Removes a single handler of this map previously added with addMarkerDoubleClickHandler(MarkerDoubleClickHandler).
 void removeMarkerDragEndHandler(MarkerDragEndHandler handler)
          Removes a single handler of this map previously added with addMarkerDragEndHandler(MarkerDragEndHandler).
 void removeMarkerDragHandler(MarkerDragHandler handler)
          Removes a single handler of this map previously added with addMarkerDragHandler(MarkerDragHandler).
 void removeMarkerDragStartHandler(MarkerDragStartHandler handler)
          Removes a single handler of this map previously added with addMarkerDragStartHandler(MarkerDragStartHandler).
 void removeMarkerInfoWindowBeforeCloseHandler(MarkerInfoWindowBeforeCloseHandler handler)
          Removes a single handler of this map previously added with addMarkerInfoWindowBeforeCloseHandler(MarkerInfoWindowBeforeCloseHandler) .
 void removeMarkerInfoWindowCloseHandler(MarkerInfoWindowCloseHandler handler)
          Removes a single handler of this map previously added with addMarkerInfoWindowCloseHandler(MarkerInfoWindowCloseHandler) .
 void removeMarkerInfoWindowOpenHandler(MarkerInfoWindowOpenHandler handler)
          Removes a single handler of this map previously added with addMarkerInfoWindowOpenHandler(MarkerInfoWindowOpenHandler).
 void removeMarkerMouseDownHandler(MarkerMouseDownHandler handler)
          Removes a single handler of this map previously added with addMarkerMouseDownHandler(MarkerMouseDownHandler).
 void removeMarkerMouseOutHandler(MarkerMouseOutHandler handler)
          Removes a single handler of this map previously added with addMarkerMouseOutHandler(MarkerMouseOutHandler).
 void removeMarkerMouseOverHandler(MarkerMouseOverHandler handler)
          Removes a single handler of this map previously added with addMarkerMouseOverHandler(MarkerMouseOverHandler).
 void removeMarkerMouseUpHandler(MarkerMouseUpHandler handler)
          Removes a single handler of this map previously added with addMarkerMouseUpHandler(MarkerMouseUpHandler).
 void removeMarkerRemoveHandler(MarkerRemoveHandler handler)
          Removes a single handler of this map previously added with addMarkerRemoveHandler(MarkerRemoveHandler).
 void removeMarkerVisibilityChangedHandler(MarkerVisibilityChangedHandler handler)
          Removes a single handler of this map previously added with addMarkerVisibilityChangedHandler(MarkerVisibilityChangedHandler) .
 void setDraggingEnabled(boolean value)
          Allow this marker to be dragged.
 void setImage(java.lang.String url)
          Use an image for this marker.
 void setLatLng(LatLng point)
          Sets the geographical coordinates of the point at which this marker is anchored.
 void setPoint(LatLng point)
          Deprecated.  
 void setVisible(boolean visible)
          Toggle the visibility of the Marker on the map it is associated with.
 void showMapBlowup()
          Opens the map info window over the icon of the marker.
 void showMapBlowup(InfoWindowContent content)
          Opens the map info window over the icon of the marker.
 
Methods inherited from class com.google.gwt.maps.client.overlay.Overlay.ConcreteOverlay
copy, initialize, redraw, remove
 
Methods inherited from class com.google.gwt.maps.client.overlay.Overlay
getZIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Marker

public Marker(LatLng point)
Create a new marker at the specified point using default options. Add the newly created marker to a MapWidget with the MapWidget.addOverlay(Overlay) method.

Parameters:
point - The point to create the new marker.

Marker

public Marker(LatLng point,
              MarkerOptions options)
Create a new marker at the specified point using the supplied options overrides. Add the newly created marker to a MapWidget with the MapWidget.addOverlay(Overlay) method.

Parameters:
point - The point to create the new marker.
options - Use settings in this object to override the Marker defaults.
Method Detail

addMarkerClickHandler

public void addMarkerClickHandler(MarkerClickHandler handler)
This event is fired when the marker icon was clicked. Notice that this event will also fire for the map, with the marker passed as an argument to the event handler.

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

addMarkerDoubleClickHandler

public void addMarkerDoubleClickHandler(MarkerDoubleClickHandler handler)
This event is fired when the marker icon was double-clicked. Notice that this event will not fire for the map, because the map centers on double-click as a hardwired behavior.

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

addMarkerDragEndHandler

public void addMarkerDragEndHandler(MarkerDragEndHandler handler)
If the marker is enabled for dragging, this event is fired when the marker ceases to be dragged.

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

addMarkerDragHandler

public void addMarkerDragHandler(MarkerDragHandler handler)
If the marker is enabled for dragging, this event is fired when the marker is being dragged.

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

addMarkerDragStartHandler

public void addMarkerDragStartHandler(MarkerDragStartHandler handler)
If the marker is enabled for dragging, this event is fired when the marker dragging begins.

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

addMarkerInfoWindowBeforeCloseHandler

public void addMarkerInfoWindowBeforeCloseHandler(MarkerInfoWindowBeforeCloseHandler handler)
This event is fired before the info window of the map that was opened through this marker is closed.

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

addMarkerInfoWindowCloseHandler

public void addMarkerInfoWindowCloseHandler(MarkerInfoWindowCloseHandler handler)
This event is fired when the info window of the map that was opened through this marker is closed. This happens when either the info window was closed, or when it was opened on another marker, or on the map. The handler MarkerInfoWindowBeforeCloseHandler is fired before this event.

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

addMarkerInfoWindowOpenHandler

public void addMarkerInfoWindowOpenHandler(MarkerInfoWindowOpenHandler handler)
This event is fired when the info window of the map was opened through this marker.

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

addMarkerMouseDownHandler

public void addMarkerMouseDownHandler(MarkerMouseDownHandler handler)
This event is fired when the DOM "mousedown" event is fired on the marker icon. Notice that the marker will stop the "mousedown" DOM event, so that it doesn't cause the map to start dragging.

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

addMarkerMouseOutHandler

public void addMarkerMouseOutHandler(MarkerMouseOutHandler handler)
This event is fired when the mouse leaves the area of the marker icon.

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

addMarkerMouseOverHandler

public void addMarkerMouseOverHandler(MarkerMouseOverHandler handler)
This event is fired when the mouse enters the area of the marker icon.

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

addMarkerMouseUpHandler

public void addMarkerMouseUpHandler(MarkerMouseUpHandler handler)
This event is fired for the DOM "mouseup" on the marker. Notice that the marker will not stop the "mousedown" DOM event, because it will not confuse the drag handler of the map.

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

addMarkerRemoveHandler

public void addMarkerRemoveHandler(MarkerRemoveHandler handler)
This event is fired when the marker is removed from the map, using MapWidget.removeOverlay(com.google.gwt.maps.client.overlay.Overlay) or MapWidget.clearOverlays().

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

addMarkerVisibilityChangedHandler

public void addMarkerVisibilityChangedHandler(MarkerVisibilityChangedHandler handler)
This event is fired when the visibility of the marker is changed (i.e. the visibility is flipped from visible to hidden or vice-versa). The visible parameter refers to the state of the marker after the visibility change has happened.

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

closeInfoWindow

public void closeInfoWindow()
Closes the info window only if it belongs to this marker.


getIcon

public Icon getIcon()
Returns:
the current icon used for this Marker.

getLatLng

public LatLng getLatLng()
Returns the geographical coordinates at which this marker is anchored, as set by the constructor or by setLatLng(LatLng).

Returns:
the geographical coordinates at which this marker is anchored.

getPoint

@Deprecated
public LatLng getPoint()
Deprecated. 

Returns:
the current position of this Marker.

getTitle

public java.lang.String getTitle()
Returns the title of this marker, as set by the constructor via the MarkerOptions.setTitle(String) method. Returns null if no title is passed in.

Returns:
the title of this marker.

isDraggable

public boolean isDraggable()
See if this Marker was created as a draggable marker type, that is, the draggable option was set in MarkerOptions when it was constructed.

Returns:
true if the marker was initialized as a draggable type of marker

isDraggingEnabled

public boolean isDraggingEnabled()
Returns true if this marker is not only a draggable type of marker.

Returns:
true if the marker can currently be dragged
See Also:
isDraggable(), setDraggingEnabled(boolean)

isVisible

public boolean isVisible()
Returns true if the marker is currently visible on the map.

Returns:
true if the marker is currently visible on the map.

removeMarkerClickHandler

public void removeMarkerClickHandler(MarkerClickHandler handler)
Removes a single handler of this map previously added with addMarkerClickHandler(MarkerClickHandler).

Parameters:
handler - the handler to remove

removeMarkerDoubleClickHandler

public void removeMarkerDoubleClickHandler(MarkerDoubleClickHandler handler)
Removes a single handler of this map previously added with addMarkerDoubleClickHandler(MarkerDoubleClickHandler).

Parameters:
handler - the handler to remove

removeMarkerDragEndHandler

public void removeMarkerDragEndHandler(MarkerDragEndHandler handler)
Removes a single handler of this map previously added with addMarkerDragEndHandler(MarkerDragEndHandler).

Parameters:
handler - the handler to remove

removeMarkerDragHandler

public void removeMarkerDragHandler(MarkerDragHandler handler)
Removes a single handler of this map previously added with addMarkerDragHandler(MarkerDragHandler).

Parameters:
handler - the handler to remove

removeMarkerDragStartHandler

public void removeMarkerDragStartHandler(MarkerDragStartHandler handler)
Removes a single handler of this map previously added with addMarkerDragStartHandler(MarkerDragStartHandler).

Parameters:
handler - the handler to remove

removeMarkerInfoWindowBeforeCloseHandler

public void removeMarkerInfoWindowBeforeCloseHandler(MarkerInfoWindowBeforeCloseHandler handler)
Removes a single handler of this map previously added with addMarkerInfoWindowBeforeCloseHandler(MarkerInfoWindowBeforeCloseHandler) .

Parameters:
handler - the handler to remove

removeMarkerInfoWindowCloseHandler

public void removeMarkerInfoWindowCloseHandler(MarkerInfoWindowCloseHandler handler)
Removes a single handler of this map previously added with addMarkerInfoWindowCloseHandler(MarkerInfoWindowCloseHandler) .

Parameters:
handler - the handler to remove

removeMarkerInfoWindowOpenHandler

public void removeMarkerInfoWindowOpenHandler(MarkerInfoWindowOpenHandler handler)
Removes a single handler of this map previously added with addMarkerInfoWindowOpenHandler(MarkerInfoWindowOpenHandler).

Parameters:
handler - the handler to remove

removeMarkerMouseDownHandler

public void removeMarkerMouseDownHandler(MarkerMouseDownHandler handler)
Removes a single handler of this map previously added with addMarkerMouseDownHandler(MarkerMouseDownHandler).

Parameters:
handler - the handler to remove

removeMarkerMouseOutHandler

public void removeMarkerMouseOutHandler(MarkerMouseOutHandler handler)
Removes a single handler of this map previously added with addMarkerMouseOutHandler(MarkerMouseOutHandler).

Parameters:
handler - the handler to remove

removeMarkerMouseOverHandler

public void removeMarkerMouseOverHandler(MarkerMouseOverHandler handler)
Removes a single handler of this map previously added with addMarkerMouseOverHandler(MarkerMouseOverHandler).

Parameters:
handler - the handler to remove

removeMarkerMouseUpHandler

public void removeMarkerMouseUpHandler(MarkerMouseUpHandler handler)
Removes a single handler of this map previously added with addMarkerMouseUpHandler(MarkerMouseUpHandler).

Parameters:
handler - the handler to remove

removeMarkerRemoveHandler

public void removeMarkerRemoveHandler(MarkerRemoveHandler handler)
Removes a single handler of this map previously added with addMarkerRemoveHandler(MarkerRemoveHandler).

Parameters:
handler - the handler to remove

removeMarkerVisibilityChangedHandler

public void removeMarkerVisibilityChangedHandler(MarkerVisibilityChangedHandler handler)
Removes a single handler of this map previously added with addMarkerVisibilityChangedHandler(MarkerVisibilityChangedHandler) .

Parameters:
handler - the handler to remove

setDraggingEnabled

public void setDraggingEnabled(boolean value)
Allow this marker to be dragged. Note: in order for dragging to work, the Marker must be created using the MarkerOptions.setDraggable(boolean) option.

Parameters:
value - true to allow the marker to be dragged.

setImage

public void setImage(java.lang.String url)
Use an image for this marker.

Parameters:
url - The URL to the image to display.

setLatLng

public void setLatLng(LatLng point)
Sets the geographical coordinates of the point at which this marker is anchored.

Parameters:
point - the geographical coordinates at which this marker is anchored.

setPoint

@Deprecated
public void setPoint(LatLng point)
Deprecated. 

Move the marker to the specified point.

Parameters:
point - position to move the marker to.

setVisible

public void setVisible(boolean visible)
Toggle the visibility of the Marker on the map it is associated with.

Parameters:
visible - set to true to make the marker visible.

showMapBlowup

public void showMapBlowup()
Opens the map info window over the icon of the marker.


showMapBlowup

public void showMapBlowup(InfoWindowContent content)
Opens the map info window over the icon of the marker. The content of the info window is a closeup map around the marker position. Only options zoomLevel and mapType in the InfoWindowContent are applicable.

Parameters:
content - overridden settings of zoomLevel or mapType