com.esri.map
Class WebMap

java.lang.Object
  extended by com.esri.map.WebMap

public class WebMap
extends Object

This class is used to open a Web Map by URL, ID or PortalItem and add it to a JMap instance. Simply create an instance of this class using either the full URL of the Web Map, the item ID or a PortalItem. Note that if the web map is to be constructed from an item ID and a Portal instance is not provided, the item is assumed to be hosted on arcgis.com. If the WebMap instance is created with a Portal or PortalItem, add the Web Map to a JMap by calling either initializeMap(JMap) or initializeMapAsync(JMap). Otherwise, add to a JMap by calling either initializeMap(JMap, String, String) or initializeMapAsync(JMap, String, String). If you are using the asynchronous version of this, you can listen for map ready events from the JMap to know when the map control is usable. To find out when individual layers are ready, you can listen for LayerList events on the JMap's LayerList (JMap.getLayers()).

If the Web Map contains a Bing Maps Layer, then provide the key using setBingKey(String).


Constructor Summary
WebMap(PortalItem item)
          Instantiate a new web map using the given PortalItem.
WebMap(PortalItem item, OnWebMapLoadListener listener)
          Instantiate a new web map using the given PortalItem.
WebMap(String itemId)
          Instantiates a new web map using just the item ID of the web map item.
WebMap(String itemId, OnWebMapLoadListener listener)
          Instantiates a new web map using just the item ID of the web map item.
WebMap(String itemId, Portal portal)
          Instantiate a new web map using the given item ID and Portal.
WebMap(String itemId, Portal portal, OnWebMapLoadListener listener)
          Instantiate a new web map using the given item ID and Portal.
WebMap(URL itemURL)
          Instantiates a new web map using the full URL of the web map item.
WebMap(URL itemURL, OnWebMapLoadListener listener)
          Instantiates a new web map using the full URL of the web map item.
 
Method Summary
 String getBingKey()
          Returns the key that was set to access a Bing Maps layer.
 List<Bookmark> getBookmarks()
          Get a list of Bookmarks defined by this web map.
 UserCredentials getCredentials()
          Get the user credentials used to access this web map.
 com.esri.core.internal.io.handler.IdentityManager getIdentityManager()
           
 PortalItem getInfo()
          Gets information on this web map.
 Envelope getInitExtent()
          Get this web map's initial extent.
 List<WebMapQuery> getPredifinedQueries()
          Get a list of WebMapQuerys defined by this web map.
 String getVersion()
          Get this web map's version.
protected  void handleMapServerLayer(WebMapLayer webMapLayer, String url)
          Handle a map server layer.
 void initializeMap(JMap map)
          Read the layers from a web map and add them to the given JMap instance.
 void initializeMap(JMap map, String uname, String pwd)
          Read the layers from a web map and add them to the given JMap instance.
 void initializeMapAsync(JMap map)
          Asynchronous version of initializeMap(JMap).
 void initializeMapAsync(JMap map, String uname, String pwd)
          Asynchronous version of initializeMap(JMap, String, String).
<T> com.esri.map.InteractiveTask.InteractiveTaskResult<T>
loadServiceInfo(com.esri.core.internal.tasks.Task<T> task, WebMapLayer wmlayer)
           
 void setBingKey(String bingKey)
          Sets the key to be used to access a Bing Maps layer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebMap

public WebMap(PortalItem item)
Instantiate a new web map using the given PortalItem.

Parameters:
item - portal item describing web map

WebMap

public WebMap(String itemId,
              Portal portal)
Instantiate a new web map using the given item ID and Portal.

Parameters:
itemId - ID of web map item
portal - portal serving the web map

WebMap

public WebMap(URL itemURL)
Instantiates a new web map using the full URL of the web map item.

Parameters:
itemURL - the item URL

WebMap

public WebMap(String itemId)
       throws MalformedURLException
Instantiates a new web map using just the item ID of the web map item. This assumes that the ID refers to an item on arcgis.com. If you wish to open a web map on another system, use the constructor that takes a full URL.

Parameters:
itemId - the item id
Throws:
MalformedURLException - a malformed URL exception

WebMap

public WebMap(PortalItem item,
              OnWebMapLoadListener listener)
Instantiate a new web map using the given PortalItem.

Parameters:
item - portal item describing web map

WebMap

public WebMap(String itemId,
              Portal portal,
              OnWebMapLoadListener listener)
Instantiate a new web map using the given item ID and Portal.

Parameters:
itemId - ID of web map item
portal - portal serving the web map

WebMap

public WebMap(URL itemURL,
              OnWebMapLoadListener listener)
Instantiates a new web map using the full URL of the web map item.

Parameters:
itemURL - the item URL

WebMap

public WebMap(String itemId,
              OnWebMapLoadListener listener)
       throws MalformedURLException
Instantiates a new web map using just the item ID of the web map item. This assumes that the ID refers to an item on arcgis.com. If you wish to open a web map on another system, use the constructor that takes a full URL.

Parameters:
itemId - the item id
Throws:
MalformedURLException - a malformed URL exception
Method Detail

getBingKey

public String getBingKey()
Returns the key that was set to access a Bing Maps layer.

Returns:
the key to access the Bing Maps layer.
Since:
10.1.1

setBingKey

public void setBingKey(String bingKey)
Sets the key to be used to access a Bing Maps layer.

Parameters:
bingKey - key to be used to access any Bing Maps layer.
Since:
10.1.1

initializeMap

public void initializeMap(JMap map)
                   throws Exception
Read the layers from a web map and add them to the given JMap instance. Calling this method will remove all layers from the given JMap and replace them with the web map's layers. Listening for a map ready event on the given JMap will tell you when the map control is usable. Listening for layer list events on the JMap's layer list will allow you to get a reference to each layer added and add layer event listeners if desired.

Parameters:
map - the map to add the layers to
Throws:
Exception

initializeMap

public void initializeMap(JMap map,
                          String uname,
                          String pwd)
                   throws Exception
Read the layers from a web map and add them to the given JMap instance. Calling this method will remove all layers from the given JMap and replace them with the web map's layers. Listening for a map ready event on the given JMap will tell you when the map control is usable. Listening for layer list events on the JMap's layer list will allow you to get a reference to each layer added and add layer event listeners if desired.

Parameters:
map - the map to add the layers to
uname - the user name, if any
pwd - the password, if any
Throws:
Exception

initializeMapAsync

public void initializeMapAsync(JMap map)
Asynchronous version of initializeMap(JMap).

Parameters:
map - the map to add the layers to

initializeMapAsync

public void initializeMapAsync(JMap map,
                               String uname,
                               String pwd)
Asynchronous version of initializeMap(JMap, String, String).

Parameters:
map - the map to add the layers to
uname - the user name, if any
pwd - the password, if any

getCredentials

public UserCredentials getCredentials()
Get the user credentials used to access this web map.

Returns:
credentials used to access this web map

getInitExtent

public Envelope getInitExtent()
Get this web map's initial extent.

Returns:
web map's initial extent

getInfo

public PortalItem getInfo()
Gets information on this web map.

Returns:
the information

getBookmarks

public List<Bookmark> getBookmarks()
Get a list of Bookmarks defined by this web map. Use this method after corresponding JMap is ready.

Returns:
list of bookmarks; empty list if corresponding JMap is not ready.

getPredifinedQueries

public List<WebMapQuery> getPredifinedQueries()
Get a list of WebMapQuerys defined by this web map.

Returns:
list of queries

getVersion

public String getVersion()
Get this web map's version.

Returns:
web map's version

handleMapServerLayer

protected void handleMapServerLayer(WebMapLayer webMapLayer,
                                    String url)
Handle a map server layer. This method will determine whether the given web map layer is a tiled service layer, a dynamic service layer or a single layer that should be treated as a feature layer.

Parameters:
webMapLayer - the web map layer
url - the URL of the referenced service layer

loadServiceInfo

public <T> com.esri.map.InteractiveTask.InteractiveTaskResult<T> loadServiceInfo(com.esri.core.internal.tasks.Task<T> task,
                                                                                 WebMapLayer wmlayer)
                                                                      throws Exception
Throws:
Exception

getIdentityManager

public com.esri.core.internal.io.handler.IdentityManager getIdentityManager()


Copyright © 2012. All Rights Reserved.