com.esri.android.map.bing
Class BingMapsLayer

java.lang.Object
  extended by com.esri.android.map.Layer
      extended by com.esri.android.map.TiledLayer
          extended by com.esri.android.map.TiledServiceLayer
              extended by com.esri.android.map.bing.BingMapsLayer

public class BingMapsLayer
extends TiledServiceLayer

BingMapsLayer class is used to define the Layer populated from Bing Maps that can be added to the MapView object.

BingMapsLayer allows you to work with maps from Bing Maps. Bing Maps requires a key in order to allow access to the tiles. Information on how to obtain a key can be found on this page: Getting a Bing Maps Key

The following are examples of how you can work with the BingMapsLayer class. The code will add a map with a Bing Maps Layer of Aerial style.

Java usage:
 MapView mv = new MapView(this);
 mv.addLayer(new BingMapsLayer(
 "[your Bing Maps key]", MapStyle.Aerial));
 setContentView(mv);
 

To initialize a Bing map in a WebMap please see the class description of the MapView.

Since:
1.0

Nested Class Summary
static class BingMapsLayer.MapStyle
           Map styles available for the imagery: Aerial - Aerial imagery AerialWithLabels - Aerial imagery with a road overlay Road - Roads without additional imagery.
 
Nested classes/interfaces inherited from class com.esri.android.map.TiledServiceLayer
TiledServiceLayer.TileInfo
 
Field Summary
static int BING_MAPS_SPATIAL_REFERENCE_WKID
          The WKID of spatial reference for the Bing Maps Imagery service.
static double BING_MAPS_XMAX
          Maximum X coordinate in meters for the full extent of Bing Maps service.
static double BING_MAPS_XMIN
          Minimum X coordinate in meters for the full extent of Bing Maps service.
static double BING_MAPS_YMAX
          Maximum Y coordinate in meters for the full extent of Bing Maps service.
static double BING_MAPS_YMIN
          Minimum Y coordinate in meters for the full extent of Bing Maps service.
static int initWithDpi
          The DPI for Bing Maps.
 
Fields inherited from class com.esri.android.map.TiledServiceLayer
isBingMap, pending
 
Fields inherited from class com.esri.android.map.Layer
credentials, nativeHandle, popUpInfos, serviceInfo
 
Constructor Summary
BingMapsLayer(String appId, BingMapsLayer.MapStyle mapStyle)
           Creates a BingMapsLayer object from Bing Maps key and map style.
BingMapsLayer(String appId, BingMapsLayer.MapStyle mapStyle, boolean initLayer)
          Creates a BingMapsLayer object from Bing Maps key and map style.
 
Method Summary
 String getAppId()
          Returns the Bing Maps key.
 android.graphics.Bitmap getBingLogo(int width, int height)
          Returns the Bing Logo bitmap.
 String getCulture()
          Returns the culture of the layer (format: [language]-[REGION], e.g.: en-US)
see Culture Parameter
 URL getLogoUrl()
          Returns a URL object for Bing Maps logo.
 BingMapsLayer.MapStyle getMapStyle()
          Returns the style of the Bing Maps layer.
 String getMapVersion()
          Returns the map version (format: v[map version], e.g.: v0).
protected  byte[] getTile(int lev, int col, int row)
          get byte array of the tile at the specified level, column and row.
protected  void initLayer()
          Initializes the layer.
 void refresh()
          Fetches the information for the tiles again if any of the parameters have changed (map version, map style, culture...) and refreshes the tiles accordingly.
 void reinitializeLayer(String appID)
          Re-initializes the layer with the given appID.
 void reinitializeLayer(UserCredentials usercredentials)
          This method has no impact on the BingMapsLayer.
 void setAppId(String appId)
          Sets the Bing Maps key.
 void setCulture(String culture)
          Sets the culture of the layer (format: [language]-[REGION], e.g.: en-US)
see Culture Parameter
 void setMapStyle(BingMapsLayer.MapStyle mapStyle)
          Sets the map style of the Bing Maps layer.
 void setMapVersion(String mapVersion)
          Sets the map version (format: v[map version], e.g.: v0).
 
Methods inherited from class com.esri.android.map.TiledServiceLayer
cancelPendingTasks, cancelRequest, create, getTileInfo, recycle, requestTile, setTileInfo
 
Methods inherited from class com.esri.android.map.TiledLayer
clearTiles, getBrightness, getContrast, getCurrentLevel, getGamma, setBrightness, setContrast, setGamma
 
Methods inherited from class com.esri.android.map.Layer
changeStatus, finalize, getCredentials, getDefaultSpatialReference, getDpi, getExtent, getFullExtent, getHeight, getID, getInitialExtent, getName, getOpacity, getParent, getPoolExecutor, getPopupInfo, getQueryUrl, getResolution, getServiceExecutor, getSpatialReference, getTitle, getUrl, getUrlHashCode, getWidth, isInitialized, isRecycled, isShowLegend, isVisible, isWebMapBaselayer, loadServiceInfo, lock, setCredentials, setDefaultSpatialReference, setFullExtent, setInitialExtent, setName, setOnStatusChangedListener, setOpacity, setPopupInfos, setQueryUrls, setUrl, setVisible, unlock, updateSpatialReferenceStatus, verifyCredentials
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BING_MAPS_SPATIAL_REFERENCE_WKID

public static final int BING_MAPS_SPATIAL_REFERENCE_WKID
The WKID of spatial reference for the Bing Maps Imagery service. The value is 102100.

See Also:
Constant Field Values

BING_MAPS_XMIN

public static final double BING_MAPS_XMIN
Minimum X coordinate in meters for the full extent of Bing Maps service.

See Also:
Constant Field Values

BING_MAPS_YMIN

public static final double BING_MAPS_YMIN
Minimum Y coordinate in meters for the full extent of Bing Maps service.

See Also:
Constant Field Values

BING_MAPS_XMAX

public static final double BING_MAPS_XMAX
Maximum X coordinate in meters for the full extent of Bing Maps service.

See Also:
Constant Field Values

BING_MAPS_YMAX

public static final double BING_MAPS_YMAX
Maximum Y coordinate in meters for the full extent of Bing Maps service.

See Also:
Constant Field Values

initWithDpi

public static final int initWithDpi
The DPI for Bing Maps. The value is 96.

See Also:
Constant Field Values
Constructor Detail

BingMapsLayer

public BingMapsLayer(String appId,
                     BingMapsLayer.MapStyle mapStyle)

Creates a BingMapsLayer object from Bing Maps key and map style.

This constructor is used if you instantiate the BingMapsLayer pragmatically (see the class description for an example of this usage).

Parameters:
appId - the Bing Maps key.
mapStyle - the map style. See BingMapsLayer.MapStyle for available values
Since:
1.0

BingMapsLayer

public BingMapsLayer(String appId,
                     BingMapsLayer.MapStyle mapStyle,
                     boolean initLayer)
Creates a BingMapsLayer object from Bing Maps key and map style.

Parameters:
appId - -the Bing Maps key.
mapStyle - -the map style.
initLayer - set to true to initialize the the layer, or the layer will not initialized.
Since:
1.0
Method Detail

getLogoUrl

public URL getLogoUrl()
Returns a URL object for Bing Maps logo.

Returns:
a URL object for Bing Maps logo.
Since:
1.0

initLayer

protected void initLayer()
Description copied from class: Layer
Initializes the layer. The implementation should submit the OnStatusChangedListener.STATUS event accordingly.

Overrides:
initLayer in class TiledServiceLayer

getTile

protected byte[] getTile(int lev,
                         int col,
                         int row)
                  throws Exception
get byte array of the tile at the specified level, column and row.

Specified by:
getTile in class TiledServiceLayer
Throws:
Exception

getMapStyle

public BingMapsLayer.MapStyle getMapStyle()
Returns the style of the Bing Maps layer.

Returns:
the style of the layer
Since:
1.0

setMapStyle

public void setMapStyle(BingMapsLayer.MapStyle mapStyle)
Sets the map style of the Bing Maps layer. see BingMapsLayer.MapStyle for available values.

Parameters:
mapStyle - the map style to set
Since:
1.0

getMapVersion

public String getMapVersion()
Returns the map version (format: v[map version], e.g.: v0).

Returns:
the map version
Since:
1.0

setMapVersion

public void setMapVersion(String mapVersion)
Sets the map version (format: v[map version], e.g.: v0).

Parameters:
mapVersion - the map version to set
Since:
1.0

getCulture

public String getCulture()
Returns the culture of the layer (format: [language]-[REGION], e.g.: en-US)
see Culture Parameter

Returns:
the culture of the layer
Since:
1.0

setCulture

public void setCulture(String culture)
Sets the culture of the layer (format: [language]-[REGION], e.g.: en-US)
see Culture Parameter

Parameters:
culture - the culture to set
Since:
1.0

getAppId

public String getAppId()
Returns the Bing Maps key.

Returns:
the Bing Maps key
Since:
1.0

setAppId

public void setAppId(String appId)
Sets the Bing Maps key.

Parameters:
appId - the Bing Maps key to set
Since:
1.0

refresh

public void refresh()
Fetches the information for the tiles again if any of the parameters have changed (map version, map style, culture...) and refreshes the tiles accordingly.

Since:
1.0

getBingLogo

public android.graphics.Bitmap getBingLogo(int width,
                                           int height)
Returns the Bing Logo bitmap.

Parameters:
width - - logo width in integer
height - - logo height in integer
Returns:
a Bitmap object for Bing Logo
Since:
1.0

reinitializeLayer

public void reinitializeLayer(UserCredentials usercredentials)
This method has no impact on the BingMapsLayer. Please use reinitializeLayer(String) instead.

Overrides:
reinitializeLayer in class Layer
Parameters:
usercredentials - the usercredentials
Since:
1.0

reinitializeLayer

public void reinitializeLayer(String appID)
Re-initializes the layer with the given appID.

Parameters:
appID - the new appID.
Since:
1.0


Copyright © 2010. All Rights Reserved.