com.mapitz.gwt.googleMaps.client
Class GMap2

java.lang.Object
  extended by com.google.gwt.core.client.JavaScriptObject
      extended by com.mapitz.gwt.googleMaps.client.GMap2

public class GMap2
extends com.google.gwt.core.client.JavaScriptObject

Instantiate class GMap2 in order to create a map. This is the central class in the API. Everything else is auxiliary.

Author:
aglaforge

Method Summary
 void addControl(GControl control)
          addControl(control, position?) none Adds the control to the map.
 void addControl(GControl control, GControlPosition position)
          addControl(control, position?) none Adds the control to the map.
 void addMapType(GMapType type)
          addMapType(type) none Adds a new map type to the map.
 void addOverlay(GOverlay overlay)
          addOverlay(overlay) none Adds an overlay to the map and fires the addoverlay event.
 void checkResize()
          checkResize() none Notifies the map of a change of the size of its container.
 void clearOverlays()
          clearOverlays() none Removes all overlay from the map, and fires the clearoverlays event.
 void closeInfoWindow()
          closeInfoWindow() none Closes the currently open info window.
static GMap2 create(com.google.gwt.user.client.Element e)
          Creates a GMap2 object by passing a DIV element
 void disableDragging()
          Disables dragging of the map by the user
 void disableInfoWindow()
          Disables display of the information window
 boolean draggingEnabled()
          Test to see if dragging enabled
 void enableDragging()
          Enables dragging of the map by the user
 void enableInfoWindow()
          Enables display of the information window
 GLatLng fromContainerPixelToLatLng(GPoint pixel)
          fromContainerPixelToLatLng(pixel) GLatLng Computes the geographical coordinates of the point at the given pixel coordinates in the DOM element that contains the map on the page.
 GLatLng fromDivPixelToLatLng(GPoint pixel)
          fromDivPixelToLatLng(pixel) GLatLng Computes the geographical coordinates from pixel coordinates in the div that holds the draggable impl.
 GPoint fromLatLngToDivPixel(GLatLng latlng)
          fromLatLngToDivPixel(latlng) GPoint Computes the pixel coordinates of the given geographical point in the DOM element that holds the draggable impl.
 GLatLngBounds getBounds()
          Returns the the visible rectangular region of the map view in geographical coordinates.
 int getBoundsZoomLevel(GLatLngBounds bounds)
          Returns the zoom level at which the given rectangular region fits in the map view.
 GLatLng getCenter()
          Returns the geographical coordinates of the center point of the map view.
 com.google.gwt.user.client.Element getContainer()
          getContainer() Node Returns the DOM object that contains the map.
 GMapType getCurrentMapType()
          getCurrentMapType() GMapType Returns the currently selected map type.
 GInfoWindow getInfoWindow()
          getInfoWindow() GInfoWindow Returns the info window object of this impl.
 GMapType[] getMapTypes()
          getMapTypes() Array of GMapType Returns the array of map types registered with this map.
 com.google.gwt.user.client.Element getPane(GMapPane pane)
          getPane(pane) Node Returns a DIV that holds the object in the layer identified by pane.
 GSize getSize()
          Returns the size of the map view in pixels.
 double getZoom()
          Returns the current zoom level.
 boolean infoWindowEnabled()
          Tests if info window will be displayed
 boolean isLoaded()
          Tests if the map is "loaded" and ready to be used
 void openInfoWindow(GLatLng point, com.google.gwt.user.client.Element node)
          openInfoWindow(point, node, opts?) none Opens a simple info window at the given point.
 void openInfoWindow(GLatLng point, com.google.gwt.user.client.Element node, GInfoWindowOptions opts)
          openInfoWindow(point, node, opts?) none Opens a simple info window at the given point.
 void openInfoWindowHtml(GLatLng point, java.lang.String html)
          openInfoWindowHtml(point, html, opts?) none Opens a simple info window at the given point.
 void openInfoWindowHtml(GLatLng point, java.lang.String html, GInfoWindowOptions opts)
          openInfoWindowHtml(point, html, opts?) none Opens a simple info window at the given point.
 void openInfoWindowTabs(GLatLng point, GInfoWindowTab[] tabs)
          openInfoWindowTabs(point, tabs, opts?) none Opens a tabbed info window at the given point.
 void openInfoWindowTabs(GLatLng point, GInfoWindowTab[] tabs, GInfoWindowOptions opts)
          openInfoWindowTabs(point, tabs, opts?) none Opens a tabbed info window at the given point.
 void openInfoWindowTabsHtml(GLatLng point, GInfoWindowTab[] tabs)
          openInfoWindowTabsHtml(point, tabs, opts?) none Opens a tabbed info window at the given point.
 void openInfoWindowTabsHtml(GLatLng point, GInfoWindowTab[] tabs, GInfoWindowOptions opts)
          openInfoWindowTabsHtml(point, tabs, opts?) none Opens a tabbed info window at the given point.
 void panBy(int distance)
          panBy(distance) none Starts a pan animation by the given distance in pixels.
 void panDirection(int dx, int dy)
          panDirection(dx, dy) none Starts a pan animation by half the width of the map in the indicated directions.
 void panTo(GLatLng center)
          panTo(center) none Changes the center point of the map to the given point.
 void removeControl(GControl control)
          removeControl(control) none Removes the control from the map.
 void removeMapType(GMapType type)
          removeMapType(type) none Removes the map type from the map.
 void removeOverlay(GOverlay overlay)
          removeOverlay(overlay) none Removes the overlay from the map.
 void returnToSavedPosition()
          returnToSavedPosition() none Restores the map view that was saved by savePosition().
 void savePosition()
          savePosition() none Stores the current map position and zoom level for later recall by returnToSavedPosition().
 void setCenter(GLatLng latlng)
          Set's the center position on the map
 void setCenter(GLatLng latlng, int zoom)
           
 void setCenter(GLatLng latlng, int zoomlevel, GMapType type)
           
 void setMapType(GMapType type)
          setMapType(type) none Selects the given new map type.
 void setZoom(int level)
          setZoom(level) none Sets the zoom level to the given new value.
 void showMapBlowup(GLatLng point)
          showMapBlowup(point, opts?) none Opens an info window at the given point that contains a closeup view on the map around this point.
 void showMapBlowup(GLatLng point, GInfoWindowOptions opts)
          showMapBlowup(point, opts?) none Opens an info window at the given point that contains a closeup view on the map around this point.
 void zoomIn()
          zoomIn() none Increments zoom level by one.
 void zoomOut()
          zoomOut() none Decrements zoom level by one.
 
Methods inherited from class com.google.gwt.core.client.JavaScriptObject
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static GMap2 create(com.google.gwt.user.client.Element e)
Creates a GMap2 object by passing a DIV element

Parameters:
e -
Returns:

setCenter

public void setCenter(GLatLng latlng)
Set's the center position on the map

Parameters:
latlng -

enableDragging

public void enableDragging()
Enables dragging of the map by the user


disableDragging

public void disableDragging()
Disables dragging of the map by the user


draggingEnabled

public boolean draggingEnabled()
Test to see if dragging enabled

Returns:

enableInfoWindow

public void enableInfoWindow()
Enables display of the information window


disableInfoWindow

public void disableInfoWindow()
Disables display of the information window


infoWindowEnabled

public boolean infoWindowEnabled()
Tests if info window will be displayed

Returns:

isLoaded

public boolean isLoaded()
Tests if the map is "loaded" and ready to be used

Returns:

getCenter

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

Returns:

getBounds

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

Returns:

getBoundsZoomLevel

public int getBoundsZoomLevel(GLatLngBounds 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 -
Returns:

getZoom

public double getZoom()
Returns the current zoom level.

Returns:

getSize

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

Returns:

panTo

public void panTo(GLatLng center)
panTo(center) none Changes the center point of the map to the given point. If the point is already visible in the current map view, change the center in a smooth animation.

Parameters:
center -

panBy

public void panBy(int distance)
panBy(distance) none Starts a pan animation by the given distance in pixels.

Parameters:
distance -

panDirection

public void panDirection(int dx,
                         int dy)
panDirection(dx, dy) none Starts a pan animation by half the width of the map in the indicated directions. +1 is right and down, -1 is left and up, respectively.

Parameters:
dx -
dy -

setZoom

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

Parameters:
level -

zoomIn

public void zoomIn()
zoomIn() none Increments zoom level by one.


zoomOut

public void zoomOut()
zoomOut() none Decrements zoom level by one.


savePosition

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


returnToSavedPosition

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


checkResize

public void checkResize()
checkResize() none Notifies the map of a change of the size of its container. 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.


addControl

public void addControl(GControl control,
                       GControlPosition position)
addControl(control, position?) none Adds the control to the map. The position on the map is determined by the optional position argument. If this argument is absent, the default position of the control is used, as determined by the GControl.getDefaultPosition() method. A control instance must not be added more than once to the map.


addControl

public void addControl(GControl control)
addControl(control, position?) none Adds the control to the map. The position on the map is determined by the optional position argument. If this argument is absent, the default position of the control is used, as determined by the GControl.getDefaultPosition() method. A control instance must not be added more than once to the map.


removeControl

public void removeControl(GControl control)
removeControl(control) none Removes the control from the map. It does nothing if the control was never added to the map.


getContainer

public com.google.gwt.user.client.Element getContainer()
getContainer() Node Returns the DOM object that contains the map. Used by GControl.initialize().


getMapTypes

public GMapType[] getMapTypes()
getMapTypes() Array of GMapType Returns the array of map types registered with this map.


getCurrentMapType

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


setMapType

public void setMapType(GMapType type)
setMapType(type) none Selects the given new map type. The type must be known to the map. See the constructor, and the method addMapType().


addMapType

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


removeMapType

public void removeMapType(GMapType type)
removeMapType(type) none Removes the map type from the map. Will update the set of buttons displayed by the GMapTypeControl and fire the removemaptype event.


setCenter

public void setCenter(GLatLng latlng,
                      int zoomlevel,
                      GMapType type)

setCenter

public void setCenter(GLatLng latlng,
                      int zoom)

addOverlay

public void addOverlay(GOverlay overlay)
addOverlay(overlay) none Adds an overlay to the map and fires the addoverlay event.


removeOverlay

public void removeOverlay(GOverlay overlay)
removeOverlay(overlay) none Removes the overlay from the map. If the overlay was on the map, it fires the removeoverlay event.


clearOverlays

public void clearOverlays()
clearOverlays() none Removes all overlay from the map, and fires the clearoverlays event.


getPane

public com.google.gwt.user.client.Element getPane(GMapPane pane)
getPane(pane) Node Returns a DIV that holds the object in the layer identified by pane. Used by GOverlay instances in method GOverlay.initialize() instances to draw themselves on the map


openInfoWindow

public void openInfoWindow(GLatLng point,
                           com.google.gwt.user.client.Element node,
                           GInfoWindowOptions opts)
openInfoWindow(point, node, opts?) none Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as a DOM node.


openInfoWindow

public void openInfoWindow(GLatLng point,
                           com.google.gwt.user.client.Element node)
openInfoWindow(point, node, opts?) none Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as a DOM node.


openInfoWindowHtml

public void openInfoWindowHtml(GLatLng point,
                               java.lang.String html,
                               GInfoWindowOptions opts)
openInfoWindowHtml(point, html, opts?) none Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text.


openInfoWindowHtml

public void openInfoWindowHtml(GLatLng point,
                               java.lang.String html)
openInfoWindowHtml(point, html, opts?) none Opens a simple info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text.


openInfoWindowTabs

public void openInfoWindowTabs(GLatLng point,
                               GInfoWindowTab[] tabs,
                               GInfoWindowOptions opts)
openInfoWindowTabs(point, tabs, opts?) none Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as DOM nodes.


openInfoWindowTabs

public void openInfoWindowTabs(GLatLng point,
                               GInfoWindowTab[] tabs)
openInfoWindowTabs(point, tabs, opts?) none Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as DOM nodes.


openInfoWindowTabsHtml

public void openInfoWindowTabsHtml(GLatLng point,
                                   GInfoWindowTab[] tabs,
                                   GInfoWindowOptions opts)
openInfoWindowTabsHtml(point, tabs, opts?) none Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text.


openInfoWindowTabsHtml

public void openInfoWindowTabsHtml(GLatLng point,
                                   GInfoWindowTab[] tabs)
openInfoWindowTabsHtml(point, tabs, opts?) none Opens a tabbed info window at the given point. Pans the map such that the opened info window is fully visible. The content of the info window is given as HTML text.


showMapBlowup

public void showMapBlowup(GLatLng point,
                          GInfoWindowOptions opts)
showMapBlowup(point, opts?) none Opens an info window at the given point that contains a closeup view on the map around this point.


showMapBlowup

public void showMapBlowup(GLatLng point)
showMapBlowup(point, opts?) none Opens an info window at the given point that contains a closeup view on the map around this point.


closeInfoWindow

public void closeInfoWindow()
closeInfoWindow() none Closes the currently open info window.


getInfoWindow

public GInfoWindow getInfoWindow()
getInfoWindow() GInfoWindow Returns the info window object of this impl. If no info window exists yet, it is created, but not displayed. This operation is not influenced by enableInfoWindow().


fromLatLngToDivPixel

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


fromDivPixelToLatLng

public GLatLng fromDivPixelToLatLng(GPoint pixel)
fromDivPixelToLatLng(pixel) GLatLng Computes the geographical coordinates from pixel coordinates in the div that holds the draggable impl. You need this when you implement interaction with custom overlays.


fromContainerPixelToLatLng

public GLatLng fromContainerPixelToLatLng(GPoint pixel)
fromContainerPixelToLatLng(pixel) GLatLng Computes the geographical coordinates of the point at the given pixel coordinates in the DOM element that contains the map on the page. You need this when you implement interaction of custom controls with the impl.