com.esri.map
Class BingMapsLayer

java.lang.Object
  extended by com.esri.map.Layer
      extended by com.esri.map.BingMapsLayer

public class BingMapsLayer
extends Layer

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.


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.map.Layer
Layer.LayerStatus
 
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.
protected  int[] displayLevels
           
static int initWithDpi
          The DPI for Bing Maps.
protected  ConcurrentHashMap<String,Future<?>> pending
           
protected static ExecutorService pool
           
 
Fields inherited from class com.esri.map.Layer
_credentials, _progress, _resolutionList, 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
protected  void cancelRequest(int lod, int col, int row)
           
 void clearTiles()
          Cancels all current tile request.
protected  void createNativeLayer()
           
 String getAppId()
          Returns the Bing Maps key.
 String getCulture()
          Returns the culture of the layer (format: [language]-[REGION], e.g.: en-US)
see Culture Parameter
 LayerLegendInfoCollection getLegend()
           
 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  void getTileAsynch(int lod, int col, int row, com.esri.map.TiledMapServiceLayer.TileListener tilecallback)
          get byte array of the tile at the specified level, column and row.
protected  void init(boolean isVisible, int[] displayLevels, String title, float opacity)
          This method is called only when composing a Map from a Web Map.
protected  void initializeNativeLayer()
           
protected  void internalInit()
           
protected  long nativeCreateLayer()
           
protected  boolean nativeInitialize(long layerHandle, int pWKT, String wkt, double originX, double originY, double minX, double minY, double maxX, double maxY, double[] lodScale, double[] lodResolution, int lodCount, int dpi, int tilePixelWidth, int tilePixelHeight)
           
protected  void nativeSetCachePath(long layerHandle, String path)
           
protected  void nativeSetTile(long layerHandle, int lod, int col, int row, byte[] pData, int size)
           
 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.
protected  void requestTile(int lod, int col, int row)
           
 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. see BingMapsLayer.MapStyle for available values.
 void setMapVersion(String mapVersion)
          Sets the map version (format: v[map version], e.g.: v0).
 void setUrl(String url)
          Sets the URL.
protected  void updateProgress()
          Update progress.
 
Methods inherited from class com.esri.map.Layer
addLayerInitializeCompleteListener, finalize, fireLayerCreateCompleteEvent, fireLayerCreateErrorEvent, fireLayerCreateErrorEvent, getCopyrightText, getCredentialsInternal, getDefaultSpatialReference, getDescription, getException, getExtent, getFullExtent, getInitialExtent, getInitializationError, getLayerHandle, getMap, getMapServer, getMapServerInfo, getMapServerLegendInfo, getMaxScale, getMinScale, getName, getOpacity, getPopupInfo, getResolution, getResolutionList, getServiceDescription, getSpatialReference, getStatus, getUrl, getUrlHashCode, initializeAsync, internalGetLayerLegendInfos, isHidingNoDataTiles, isInitialized, isReady, isShowingCopyright, isVisible, loadServiceInfo, lock, recycle, reinitializeAsync, removeLayerInitializeCompleteListener, setCopyrightText, setCredentials, setDefaultSpatialReference, setDescription, setError, setException, setFullExtent, setInitialExtent, setLayerHandle, setMap, setMapServer, setName, setOpacity, setPopupInfos, setServiceDescription, setShowingCopyright, setStatus, setVisible, unlock, updateSpatialReferenceStatus
 
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

displayLevels

protected int[] displayLevels

pending

protected final ConcurrentHashMap<String,Future<?>> pending

pool

protected static final ExecutorService pool
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

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.
Method Detail

getLogoUrl

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

Returns:
a URL object for Bing Maps logo.

setUrl

public void setUrl(String url)
Sets the URL.

Parameters:
url - the URL

internalInit

protected void internalInit()

initializeNativeLayer

protected void initializeNativeLayer()
Specified by:
initializeNativeLayer in class Layer

getTileAsynch

protected void getTileAsynch(int lod,
                             int col,
                             int row,
                             com.esri.map.TiledMapServiceLayer.TileListener tilecallback)
get byte array of the tile at the specified level, column and row.


getMapStyle

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

Returns:
the style of the layer

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

getMapVersion

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

Returns:
the map version

setMapVersion

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

Parameters:
mapVersion - the map version to set

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

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

getAppId

public String getAppId()
Returns the Bing Maps key.

Returns:
the Bing Maps key

setAppId

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

Parameters:
appId - the Bing Maps key to set

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.


getLegend

public LayerLegendInfoCollection getLegend()
Specified by:
getLegend in class Layer

requestTile

protected void requestTile(int lod,
                           int col,
                           int row)

cancelRequest

protected void cancelRequest(int lod,
                             int col,
                             int row)

clearTiles

public void clearTiles()
Cancels all current tile request. This method will cause the tiled layer to fetch new tiles in current extent and redraw.


init

protected void init(boolean isVisible,
                    int[] displayLevels,
                    String title,
                    float opacity)
Description copied from class: Layer
This method is called only when composing a Map from a Web Map. The web map contains properties that every layer should be initialized with, up front.

Specified by:
init in class Layer

createNativeLayer

protected void createNativeLayer()
Specified by:
createNativeLayer in class Layer

updateProgress

protected void updateProgress()
Update progress.


nativeCreateLayer

protected long nativeCreateLayer()

nativeInitialize

protected boolean nativeInitialize(long layerHandle,
                                   int pWKT,
                                   String wkt,
                                   double originX,
                                   double originY,
                                   double minX,
                                   double minY,
                                   double maxX,
                                   double maxY,
                                   double[] lodScale,
                                   double[] lodResolution,
                                   int lodCount,
                                   int dpi,
                                   int tilePixelWidth,
                                   int tilePixelHeight)

nativeSetTile

protected void nativeSetTile(long layerHandle,
                             int lod,
                             int col,
                             int row,
                             byte[] pData,
                             int size)

nativeSetCachePath

protected void nativeSetCachePath(long layerHandle,
                                  String path)


Copyright © 2012. All Rights Reserved.