com.esri.core.internal.value
Class DynamicLayerInfoCollection

java.lang.Object
  extended by com.esri.core.internal.value.DynamicLayerInfoCollection
All Implemented Interfaces:
Iterable<DynamicLayerInfo>, Collection<DynamicLayerInfo>

public class DynamicLayerInfoCollection
extends Object

This class maintains a collection of DynamicLayerInfo instances. Each instance allows you to change the renderer and data source of a given sublayer in a supported dynamic map service.

An instance of this class can be queried from an ArcGISDynamicMapServiceLayer by calling its getDynamicLayerInfos method. If the service does not support dynamic layers, this will return null. If the service does support dynamic layers and the user has not set their own list, the returned DynamicLayerInfoCollection will contain one DynamicLayerInfo instance for each layer in the service. By default, each DynamicLayerInfo will be set to use the sublayer's default renderer and data source. To modify a particular DynamicLayerInfo instance, use the get(int) method and modify the returned instance.

A new instance of this list can be created and populated with DynamicLayerInfo instances. The order these are added to the list will affect the draw order when the dynamic map service is rendered: the first item in this list will be drawn on top and the last will be drawn at the bottom.

The items in this list will respect the sublayer visibility settings of the dynamic map service: any layer that is currently invisible will not render. Any layers that are marked as visible but do not have a corresponding DynamicLayerInfo instance will be drawn below the other layers using the service's default renderer and data source.

A particular sublayer that has a custom renderer and/or data source can be reset to the default renderer and datasource either by calling DynamicLayerInfo.resetToDefault() or by removing it from this list. If you wish to retain the drawing order, use the resetToDefault method. If you remove the DynamicLayerInfo instance from the list, the corresponding sublayer will be drawn below the other customized layers.

If you wish to reset all sublayers to their default renderer and datasource, use the resetToDefault() method on this class. Note that this will also reset the drawing order as it is equivalent to removing all the list's entries.


Constructor Summary
DynamicLayerInfoCollection(Collection<LayerInfo> layerInfos)
           
DynamicLayerInfoCollection(Collection<LayerInfo> layerInfos, boolean addDefaults)
           
 
Method Summary
 boolean add(T e)
          Add a new item to this collection.
 boolean addAll(Collection<? extends T> c)
          This method is equivalent to iterating through the given collection calling #add(T) for each item.
 void clear()
          Remove all T instances from this list.
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 T get(int layerId)
          Return the T instance representing the layer with the given id, if it exists.
protected  DynamicLayerInfo getDefaultItem(int id)
           
protected  HashMap<Integer,T> getDynamicLayerItemInfos()
           
protected  HashMap<Integer,LayerInfo> getLayersList()
           
 List<DynamicLayerInfo> getVisibleList()
          Gets the visible layers list.
 boolean isEmpty()
           
 Iterator<T> iterator()
           
 boolean remove(Object o)
          Remove the given item from the list.
 boolean removeAll(Collection<?> c)
          This method is equivalent to iterating through the given collection and calling remove(Object) for each item.
 void resetToDefault()
          Call this method to reset all the sublayer renderers back to the service defaults.
 boolean retainAll(Collection<?> c)
          This method is equivalent to calling remove(Object) for all the items in this list that are not contained in the given list.
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

DynamicLayerInfoCollection

public DynamicLayerInfoCollection(Collection<LayerInfo> layerInfos)

DynamicLayerInfoCollection

public DynamicLayerInfoCollection(Collection<LayerInfo> layerInfos,
                                  boolean addDefaults)
Parameters:
parentLayer -
addDefaults -
Method Detail

getVisibleList

public List<DynamicLayerInfo> getVisibleList()
Gets the visible layers list. This is used to get the list of DynamicLayerInfo instances for the layers in the service that are currently visible.

Returns:
the visible list

getDefaultItem

protected DynamicLayerInfo getDefaultItem(int id)

size

public int size()
Specified by:
size in interface Collection<T extends LayerInfoItem>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<T extends LayerInfoItem>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<T extends LayerInfoItem>

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T extends LayerInfoItem>
Specified by:
iterator in interface Collection<T extends LayerInfoItem>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<T extends LayerInfoItem>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<T extends LayerInfoItem>

add

public boolean add(T e)
Add a new item to this collection. Note that if there is already an item for the associated sublayer, it will be replaced with this one.

Specified by:
add in interface Collection<T extends LayerInfoItem>
See Also:
Collection.add(java.lang.Object)

remove

public boolean remove(Object o)
Remove the given item from the list. This will have the effect of reseting the associated sublayer back to its default behaviour.

Specified by:
remove in interface Collection<T extends LayerInfoItem>
See Also:
Collection.remove(java.lang.Object)

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<T extends LayerInfoItem>

addAll

public boolean addAll(Collection<? extends T> c)
This method is equivalent to iterating through the given collection calling #add(T) for each item.

Specified by:
addAll in interface Collection<T extends LayerInfoItem>
See Also:
Collection.addAll(java.util.Collection)

removeAll

public boolean removeAll(Collection<?> c)
This method is equivalent to iterating through the given collection and calling remove(Object) for each item. See the documentation for the remove(Object) method for information on the behaviour of this method.

Specified by:
removeAll in interface Collection<T extends LayerInfoItem>
See Also:
Collection.removeAll(java.util.Collection)

retainAll

public boolean retainAll(Collection<?> c)
This method is equivalent to calling remove(Object) for all the items in this list that are not contained in the given list. See the documentation for the remove(Object) method for information on the behaviour of this method.

Specified by:
retainAll in interface Collection<T extends LayerInfoItem>
See Also:
Collection.retainAll(java.util.Collection)

clear

public void clear()
Remove all T instances from this list. This will have the effect of reseting all the dynamic map service layers back to their default behaviour.

Specified by:
clear in interface Collection<T extends LayerInfoItem>
See Also:
Collection.clear()

get

public T get(int layerId)
Return the T instance representing the layer with the given id, if it exists.

Parameters:
layerId -
Returns:
DynamicLayerInfo matching layerId or null.

getDynamicLayerItemInfos

protected HashMap<Integer,T> getDynamicLayerItemInfos()
Returns:
the _dynamicLayerItemInfos

getLayersList

protected HashMap<Integer,LayerInfo> getLayersList()
Returns:
the _layersList

resetToDefault

public void resetToDefault()
Call this method to reset all the sublayer renderers back to the service defaults.



Copyright © 2012. All Rights Reserved.