com.esri.map
Class ArcGISDynamicMapServiceLayer

java.lang.Object
  extended by com.esri.map.Layer
      extended by com.esri.map.DynamicLayer
          extended by com.esri.map.ArcGISDynamicMapServiceLayer
All Implemented Interfaces:
TimeAwareLayer
Direct Known Subclasses:
ArcGISLocalDynamicMapServiceLayer

public class ArcGISDynamicMapServiceLayer
extends DynamicLayer
implements TimeAwareLayer

An implementation of an ArcGIS Dynamic Map Service. A Map server provides all the meta-data about the service. This class draws to a JComponent graphics context (JMap) and to an in-memory image graphics context (JMap, Map) Additionally, it also draws its contents to an in-memory image maintained within this class for quick redraws of the contents of this individual layer if the state of the layer hasn't changed during a draw operation A dynamic layer supports on-the-fly projection to the spatial reference of the base layer of the JMap. Dynamic layers support the notion of sub-layers that can be turned on/off.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.esri.map.Layer
Layer.LayerStatus
 
Field Summary
 
Fields inherited from class com.esri.map.DynamicLayer
_nativeCreateSpatialRef
 
Fields inherited from class com.esri.map.Layer
_credentials, _progress, _resolutionList, serviceInfo
 
Constructor Summary
ArcGISDynamicMapServiceLayer()
          Default constructor.
ArcGISDynamicMapServiceLayer(String url)
          Constructs the dynamic map service layer with a URL to the service end point.
ArcGISDynamicMapServiceLayer(String url, GPJobResource gpJobResource)
          Construct a dynamic map service layer for a geoprocessing result map service.
ArcGISDynamicMapServiceLayer(String url, GPJobResource gpJobResource, int parameterIndex)
          Construct a dynamic map service layer for a geoprocessing result map service.
ArcGISDynamicMapServiceLayer(String url, UserCredentials credentials)
          Constructs a layer from a URL and credentials for the secure service.
 
Method Summary
protected  void createResolutionList(TileInfo tileInfo)
          Creates the resolution list.
 DynamicLayerInfoCollection getDynamicLayerInfos()
          If this dynamic map service layer supports dynamic layer functionality, this method will return a list of DynamicLayerInfos that can be used to modify the renderer and data source of each layer in the service.
 HashMap<String,LayerInfo> getLayers()
          Gets the top level sub-layers of this map service.
 Collection<LayerInfo> getLayersList()
          Gets all the sub-layers of this map service as a flat list of LayerInfo instances.
 LayerLegendInfoCollection getLegend()
           
 ArcGISPopupInfo getPopupInfo(int sublayerId)
           
 LayerInfo getSubLayer(int id)
          Gets a info on a sub-layer.
 LayerInfo getSubLayer(String name)
          Gets a info on a sub-layer.
protected  boolean getSubLayersVisibility(StringBuilder ex, boolean started, Collection<LayerInfo> layerInfoList)
          Used to generate a list of layer IDs for layers that should be hidden.
 TimeExtent getTimeExtent()
          Gets the valid TimeExtent object for the Layer or null if this service does not support time based queries.
 TimeInfo getTimeInfo()
          Get all the time awareness information for this layer.
 TimeExtent getTimeInterval()
          Get the current date/time range that this layer is filtered by.
 LayerTimeOptionsCollection getTimeOptions()
          This method will return a list of.
protected  void init(boolean isVisible, int[] visibleLayers, String title, float opacity)
          This method is called only when composing a Map from a Web Map.
protected  void internalInit()
           
 boolean isDynamicLayersSupported()
          Indicates whether or not this dynamic map service layer supports dynamic layer functionality; that is the ability to change a layer's renderer and data source.
protected  boolean isReadyToDraw()
          Returns true if the layer is ready for draw to be called.
 boolean isTimeAware()
          Indicates whether or not this dynamic map service layer belongs to a service which is time aware.
 void setDynamicLayerInfos(DynamicLayerInfoCollection dynamicLayerInfos)
          Set a list of DynamicLayerInfo instances that will be used to change the renderers and datasources of sub-layers of this dynamic map service.
 void setTimeInterval(TimeExtent timeInterval)
          Set the current date/time range that this layer will be filtered by.
 void setTimeOptions(LayerTimeOptionsCollection timeOptions)
          Set a list of LayerTimeOptions.
 
Methods inherited from class com.esri.map.DynamicLayer
createNativeLayer, getCenterMeridian, getDefaultSpatialReference, getResolution, initializeNativeLayer, isCrossesDateline, refresh, requestImage, setUrl, startlisteningToMapEvents, stopListeningToMapEvents
 
Methods inherited from class com.esri.map.Layer
addLayerInitializeCompleteListener, finalize, fireLayerCreateCompleteEvent, fireLayerCreateErrorEvent, fireLayerCreateErrorEvent, getCopyrightText, getCredentialsInternal, getDescription, getException, getExtent, getFullExtent, getInitialExtent, getInitializationError, getLayerHandle, getMap, getMapServer, getMapServerInfo, getMapServerLegendInfo, getMaxScale, getMinScale, getName, getOpacity, 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
 

Constructor Detail

ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer(String url)
Constructs the dynamic map service layer with a URL to the service end point.

Parameters:
url - the URL to the service.

ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer(String url,
                                    UserCredentials credentials)
Constructs a layer from a URL and credentials for the secure service.

Parameters:
url - the URL
credentials - the credentials

ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer()
Default constructor.


ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer(String url,
                                    GPJobResource gpJobResource,
                                    int parameterIndex)
Construct a dynamic map service layer for a geoprocessing result map service. This will return a layer containing a map image for the given geoprocessing job resource and output parameter index. Note: this is intended to be used with version 10.0 servers.

Parameters:
url - URL of service with the result we want to display
gpJobResource - A GPJobResource from a completed geoprocessor task
parameterIndex - Index of parameter we wish to display the result for

ArcGISDynamicMapServiceLayer

public ArcGISDynamicMapServiceLayer(String url,
                                    GPJobResource gpJobResource)
Construct a dynamic map service layer for a geoprocessing result map service. This will return a layer containing a map image for the given geoprocessing job resource. Note: this is intended to be used with version 10.1 servers. *

Parameters:
url - URL of service with the result we want to display
gpJobResource - A GPJobResource from a completed geoprocessor task
Method Detail

internalInit

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

createResolutionList

protected void createResolutionList(TileInfo tileInfo)
Creates the resolution list.

Parameters:
tileInfo - the tile info

getLayers

public HashMap<String,LayerInfo> getLayers()
Gets the top level sub-layers of this map service. The returned HashMap contains only the top level sub-layers. Further sub-layers are accessed by calling getSubLayerInfos on each LayerInfo in the HashMap.

Returns:
a list of layers.

getLayersList

public Collection<LayerInfo> getLayersList()
Gets all the sub-layers of this map service as a flat list of LayerInfo instances.

Returns:
the layers list

getSubLayer

public LayerInfo getSubLayer(String name)
Gets a info on a sub-layer.

Parameters:
name - Layer name.
Returns:
the sub layer information.

getSubLayer

public LayerInfo getSubLayer(int id)
Gets a info on a sub-layer.

Parameters:
id - Layer ID.
Returns:
the sub layer information.

isDynamicLayersSupported

public boolean isDynamicLayersSupported()
Indicates whether or not this dynamic map service layer supports dynamic layer functionality; that is the ability to change a layer's renderer and data source.

Returns:
true if dynamic layer functionality is supported

isTimeAware

public boolean isTimeAware()
Indicates whether or not this dynamic map service layer belongs to a service which is time aware.

Specified by:
isTimeAware in interface TimeAwareLayer
Returns:
true if time functionality is supported

getDynamicLayerInfos

public DynamicLayerInfoCollection getDynamicLayerInfos()
If this dynamic map service layer supports dynamic layer functionality, this method will return a list of DynamicLayerInfos that can be used to modify the renderer and data source of each layer in the service. If this property has not been previously set by the user, the returned list will contain a DynamicLayerInfo instance for each sub-layer in the service.

Returns:
a list of DynamicLayerInfo instances if dynamic layer functionality is supported, null otherwise

setDynamicLayerInfos

public void setDynamicLayerInfos(DynamicLayerInfoCollection dynamicLayerInfos)
Set a list of DynamicLayerInfo instances that will be used to change the renderers and datasources of sub-layers of this dynamic map service. Note that this property only works if

Parameters:
dynamicLayerInfos - a list of DynamicLayerInfo instances isDynamicLayersSupported() returns true. The layers will be rendered in the dynamic map service in the same order as the entries in this list with the first item at the top and the last item at the bottom.

Items in this list will reflect the current sub-layer visibility settings; any layer marked as invisible will not render. Any layer marked as visible that doesn't have a corresponding DynamicLayerInfo instance will be drawn below the other layers using the service default renderer and data source.


getLegend

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

getTimeOptions

public LayerTimeOptionsCollection getTimeOptions()
This method will return a list of.

Returns:
list of LayerTimeOptions instances LayerTimeOptions that can be used to indicate whether or not each layer should use the time extent specified by the TimeInterval property or not, whether to draw the layer features cumulatively or not and the time offsets for the layer. If this property has not been previously set by the user, the returned list will contain a LayerTimeOptions instance for each sub-layer in the service.

setTimeOptions

public void setTimeOptions(LayerTimeOptionsCollection timeOptions)
Set a list of LayerTimeOptions. There should be one option for each layer you wish to set the time options for.

Parameters:
timeOptions - list of LayerTimeOptions to apply to this layer

getTimeExtent

public TimeExtent getTimeExtent()
Description copied from interface: TimeAwareLayer
Gets the valid TimeExtent object for the Layer or null if this service does not support time based queries.

Specified by:
getTimeExtent in interface TimeAwareLayer
Returns:
the valid range of dates for this layer.

getTimeInterval

public TimeExtent getTimeInterval()
Description copied from interface: TimeAwareLayer
Get the current date/time range that this layer is filtered by.

Specified by:
getTimeInterval in interface TimeAwareLayer
Returns:
the current date/time range

setTimeInterval

public void setTimeInterval(TimeExtent timeInterval)
Description copied from interface: TimeAwareLayer
Set the current date/time range that this layer will be filtered by.

Specified by:
setTimeInterval in interface TimeAwareLayer
Parameters:
timeInterval - the new date/time range

getTimeInfo

public TimeInfo getTimeInfo()
Description copied from interface: TimeAwareLayer
Get all the time awareness information for this layer.

Specified by:
getTimeInfo in interface TimeAwareLayer
Returns:

getPopupInfo

public ArcGISPopupInfo getPopupInfo(int sublayerId)
Overrides:
getPopupInfo in class Layer

isReadyToDraw

protected boolean isReadyToDraw()
Returns true if the layer is ready for draw to be called.

Returns:
true, if is ready to draw True if ready.

getSubLayersVisibility

protected boolean getSubLayersVisibility(StringBuilder ex,
                                         boolean started,
                                         Collection<LayerInfo> layerInfoList)
Used to generate a list of layer IDs for layers that should be hidden. For each layer in layerInfoList, this method will check to see if it is visible. Hidden layers will have their ID added to the supplied StringBuilder. Each layer then has its sub-layers checked by calling this method recursively.

Parameters:
ex - this will contain the list of hidden layers
started - true if we've started the list of hidden layers
layerInfoList - list of layers we are checking the visibility of
Returns:
the sub layers visibility

init

protected void init(boolean isVisible,
                    int[] visibleLayers,
                    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


Copyright © 2012. All Rights Reserved.