com.google.gwt.maps.client
Class MapType

java.lang.Object
  extended by com.google.gwt.maps.client.MapType

public final class MapType
extends java.lang.Object

A MapType is a sequence of tile layers, a map projection, a tile size, and assorted other settings, link colors, and copyrights. There are three predefine map types: normalMap, satelliteMap, and hybridMap. You can create instances of this class to define custom map types. In order to show them on the map, use the MapWidget.addMapType(MapType) method. You can use TileLayerOverlay to add to (rather than entirely replace) the map's tile layers.

See Also:
MapWidget.addMapType(MapType), TileLayerOverlay

Constructor Summary
MapType(TileLayer[] layers, Projection projection, java.lang.String name)
          Creates a new custom map type from the tile layers, projection, and name.
MapType(TileLayer[] layers, Projection projection, java.lang.String name, MapTypeOptions options)
          Creates a new custom map type from the tile layers, projection, name, and options.
 
Method Summary
 void addMapTypeNewCopyrightHandler(MapTypeNewCopyrightHandler handler)
          Add a handler for "newcopyright" events.
static MapType getAerialHybridMap()
          This map type displays a transparent layer of major streets on top of aerial imagery.
static MapType getAerialMap()
          This map type displays a transparent layer of major streets on satellite images.
 java.lang.String getAlt()
          Returns to the map the alternative text of this map type.
 int getBoundsZoomLevel(LatLngBounds bounds, Size viewSize)
          Returns the highest resolution zoom level that shows show the given geographical bounds in a map of the given pixel size.
 java.lang.String[] getCopyrights(LatLngBounds bounds, int zoomLevel)
          Returns the copyrights for the given bounds and zoom level.
static java.util.List<MapType> getDefaultMapTypes()
          Returns G_DEFAULT_MAP_TYPES as an Java Array of MapType objects.
static MapType getEarthMap()
          Returns a map type that shows Google Earth using the browser plugin.
 java.lang.String getErrorMessage()
          Returns the error message that is displayed in areas and zoom levels where this map type does not have map tiles.
static MapType getHybridMap()
          Returns a map type that shows transparent street maps over Google Earth satellite images.
 java.lang.String getLinkColor()
          Returns the color that used for a hyperlinks displayed on the map.
static MapType getMapmakerHybridMap()
          This map type displays a transparent layer of major streets created using Google Mapmaker on satellite images.
static java.util.List<MapType> getMapmakerMapTypes()
          Turns G_MAPMAKER_MAP_TYPES into an immutable of MapType objects.
static MapType getMapmakerNormalMap()
          This map type displays a street map with tiles created using Google Mapmaker.
static MapType getMarsElevationMap()
          Returns a map type displays a shaded relief map of the surface of Mars.
static MapType getMarsInfraredMap()
          Returns a map type displays a shaded infrared map of the surface of Mars.
static java.util.List<MapType> getMarsMapTypes()
          Turns G_MARS_MAP_TYPES into an immutable of MapType objects.
static MapType getMarsVisibleMap()
          Returns a map type that displays photographs taken from orbit around Mars.
 int getMaximumResolution()
          Returns the highest zoom level at which this map type is defined for a given point.
 int getMinimumResolution()
          Returns the lowest zoom level at which this map type is defined for a given point.
static MapType getMoonElevationMap()
          Returns a map type that displays a shaded terrain map of the surface of the Moon.
static java.util.List<MapType> getMoonMapTypes()
          Turns G_MOON_MAP_TYPES into an immutable list of MapType objects.
static MapType getMoonVisibleMap()
          Returns a map type that displays photographs taken from orbit around the moon.
 java.lang.String getName(boolean shortName)
          Returns the translated, human-readable string name of the map type.
static MapType getNormalMap()
          Returns the normal street map type.
 com.google.gwt.core.client.JavaScriptObject getPeer()
          Returns the native JavaScript object representing this MapType.
static MapType getPhysicalMap()
          Returns a map type that shows a terrain view.
 Projection getProjection()
          Returns the projection used by this map type.
static MapType getSatelliteMap()
          Returns a map type that shows Google Earth satellite images.
static java.util.List<MapType> getSkyMapTypes()
          Turns G_SKY_MAP_TYPES into an immutable list of MapType objects.
static MapType getSkyVisibleMap()
          Returns a map type shows a mosaic of the sky.
 int getSpanZoomLevel(LatLng center, LatLng span, Size viewSize)
          Returns the highest resolution zoom level required to show the given span with the given center point.
 java.lang.String getTextColor()
          Returns the color used for text displayed on the map.
 TileLayer[] getTileLayers()
          Returns the array of tile layers in the z-order they should be displayed.
 int getTileSize()
          Returns the tile size of this map's tile layers.
 java.lang.String getUrlArg()
          Returns the URL argument used to refer to this map type.
 void removeMapTypeNewCopyrightHandler(MapTypeNewCopyrightHandler handler)
          Removes a single handler of this map type previously added with addMapTypeNewCopyrightHandler(MapTypeNewCopyrightHandler).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapType

public MapType(TileLayer[] layers,
               Projection projection,
               java.lang.String name)
Creates a new custom map type from the tile layers, projection, and name.

Parameters:
layers - the map type's tile layers
projection - the projection to be used for this map type
name - the name of the map type

MapType

public MapType(TileLayer[] layers,
               Projection projection,
               java.lang.String name,
               MapTypeOptions options)
Creates a new custom map type from the tile layers, projection, name, and options.

Parameters:
layers - the map type's tile layers
projection - the projection to be used for this map type
name - the name of the map type
options - options for this map type
Method Detail

getAerialHybridMap

public static MapType getAerialHybridMap()
This map type displays a transparent layer of major streets on top of aerial imagery.

Returns:
a map type that displays a transparent layer of major streets on top of aerial imagery.

getAerialMap

public static MapType getAerialMap()
This map type displays a transparent layer of major streets on satellite images.

Returns:
A map type that displays a transparent layer of major streets on satellite images.

getDefaultMapTypes

public static java.util.List<MapType> getDefaultMapTypes()
Returns G_DEFAULT_MAP_TYPES as an Java Array of MapType objects.

Returns:
an immutable list of MapType objects.

getEarthMap

public static MapType getEarthMap()
Returns a map type that shows Google Earth using the browser plugin.

Returns:
a map type that shows Google Earth.

getHybridMap

public static MapType getHybridMap()
Returns a map type that shows transparent street maps over Google Earth satellite images.

Returns:
a map type that shows transparent street maps over Google Earth satellite images.

getMapmakerHybridMap

public static MapType getMapmakerHybridMap()
This map type displays a transparent layer of major streets created using Google Mapmaker on satellite images. Note: When you use the Mapmaker maptype, users will only see maps in countries where Google Map Maker is launched.

Returns:
a map type that displays a transparent layer of major streets created using Google Mapmaker on satellite images.

getMapmakerNormalMap

public static MapType getMapmakerNormalMap()
This map type displays a street map with tiles created using Google Mapmaker. Note: When you use a Mapmaker map type, users will only see maps in countries where Google Map Maker is launched.

Returns:
A map type that displays a street map with tiles created using Google Mapmaker.

getMapmakerMapTypes

public static java.util.List<MapType> getMapmakerMapTypes()
Turns G_MAPMAKER_MAP_TYPES into an immutable of MapType objects.

Returns:
an immutable list of MapType objects.

getMarsElevationMap

public static MapType getMarsElevationMap()
Returns a map type displays a shaded relief map of the surface of Mars.

Returns:
a map type displays a shaded relief map of the surface of Mars, color-coded by altitude. This map type is not displayed within map type controls by default. (Since 2.95)

getMarsInfraredMap

public static MapType getMarsInfraredMap()
Returns a map type displays a shaded infrared map of the surface of Mars.

Returns:
a map type displays a shaded infrared map of the surface of Mars, where warmer areas appear brighter and colder areas appear darker. (Since 2.95)

getMarsMapTypes

public static java.util.List<MapType> getMarsMapTypes()
Turns G_MARS_MAP_TYPES into an immutable of MapType objects.

Returns:
an immutable list of MapType objects.

getMarsVisibleMap

public static MapType getMarsVisibleMap()
Returns a map type that displays photographs taken from orbit around Mars.

Returns:
a map type that displays photographs taken from orbit around Mars. This map type is not displayed within map type controls by default. (Since 2.95)

getMoonElevationMap

public static MapType getMoonElevationMap()
Returns a map type that displays a shaded terrain map of the surface of the Moon.

Returns:
a map type that displays a shaded terrain map of the surface of the Moon, color-coded by altitude. This map type is not displayed within map type controls by default. (Since 2.95)

getMoonMapTypes

public static java.util.List<MapType> getMoonMapTypes()
Turns G_MOON_MAP_TYPES into an immutable list of MapType objects.

Returns:
an immutable list of MapType objects.

getMoonVisibleMap

public static MapType getMoonVisibleMap()
Returns a map type that displays photographs taken from orbit around the moon.

Returns:
a map type that displays photographs taken from orbit around the moon. This map type is not displayed within map type controls by default. (Since 2.95)

getNormalMap

public static MapType getNormalMap()
Returns the normal street map type.

Returns:
the normal street map type.

getPhysicalMap

public static MapType getPhysicalMap()
Returns a map type that shows a terrain view.

Returns:
a map type that shows a terrain view.

getSatelliteMap

public static MapType getSatelliteMap()
Returns a map type that shows Google Earth satellite images.

Returns:
a map type that shows Google Earth satellite images.

getSkyMapTypes

public static java.util.List<MapType> getSkyMapTypes()
Turns G_SKY_MAP_TYPES into an immutable list of MapType objects.

Returns:
an immutable list of MapType objects.

getSkyVisibleMap

public static MapType getSkyVisibleMap()
Returns a map type shows a mosaic of the sky.

Returns:
a map type shows a mosaic of the sky, covering the full celestial sphere. (Since 2.95)

addMapTypeNewCopyrightHandler

public void addMapTypeNewCopyrightHandler(MapTypeNewCopyrightHandler handler)
Add a handler for "newcopyright" events. This event is fired when a new copyright was added to this copyright collection.

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

getAlt

public java.lang.String getAlt()
Returns to the map the alternative text of this map type.

Returns:
to the map the alternative text of this map type.

getBoundsZoomLevel

public int getBoundsZoomLevel(LatLngBounds bounds,
                              Size viewSize)
Returns the highest resolution zoom level that shows show the given geographical bounds in a map of the given pixel size.

Parameters:
bounds - the bounds to show
viewSize - the size of the viewport in pixels
Returns:
the zoom level required to show the given bounds

getCopyrights

public java.lang.String[] getCopyrights(LatLngBounds bounds,
                                        int zoomLevel)
Returns the copyrights for the given bounds and zoom level.

Parameters:
bounds - the current viewport
zoomLevel - the current zoom level
Returns:
the copyrights corresponding to the given viewport

getErrorMessage

public java.lang.String getErrorMessage()
Returns the error message that is displayed in areas and zoom levels where this map type does not have map tiles.

Returns:
the error message for empty tiles

getLinkColor

public java.lang.String getLinkColor()
Returns the color that used for a hyperlinks displayed on the map.

Returns:
the color used for hyperlinks

getMaximumResolution

public int getMaximumResolution()
Returns the highest zoom level at which this map type is defined for a given point.

Returns:
the highest zoom level for the point

getMinimumResolution

public int getMinimumResolution()
Returns the lowest zoom level at which this map type is defined for a given point.

Returns:
the lowest zoom level for the point

getName

public java.lang.String getName(boolean shortName)
Returns the translated, human-readable string name of the map type. The name is used as the button label in the MapTypeControl.

Parameters:
shortName - true to return the abbreviated name
Returns:
the name of the map type

getPeer

public com.google.gwt.core.client.JavaScriptObject getPeer()
Returns the native JavaScript object representing this MapType.

Returns:
the native JavaScript object representing this MapType.

getProjection

public Projection getProjection()
Returns the projection used by this map type.

Returns:
the projection used by this map type

getSpanZoomLevel

public int getSpanZoomLevel(LatLng center,
                            LatLng span,
                            Size viewSize)
Returns the highest resolution zoom level required to show the given span with the given center point.

Parameters:
center - the center of the viewport
span - the span of the viewport
viewSize - the size of the viewport in pixels
Returns:
the highest possible zoom level

getTextColor

public java.lang.String getTextColor()
Returns the color used for text displayed on the map.

Returns:
the color used for text displayed on the map

getTileLayers

public TileLayer[] getTileLayers()
Returns the array of tile layers in the z-order they should be displayed.

Returns:
the tile layers.

getTileSize

public int getTileSize()
Returns the tile size of this map's tile layers.

Returns:
the size of the tiles.

getUrlArg

public java.lang.String getUrlArg()
Returns the URL argument used to refer to this map type. The URL argument is used as a URL parameter value to identify this map type in permalinks to the current map view.

Returns:
the URL argument used to refer to this map type

removeMapTypeNewCopyrightHandler

public void removeMapTypeNewCopyrightHandler(MapTypeNewCopyrightHandler handler)
Removes a single handler of this map type previously added with addMapTypeNewCopyrightHandler(MapTypeNewCopyrightHandler).

Parameters:
handler - the handler to remove