com.esri.map
Class GroupLayer

java.lang.Object
  extended by com.esri.map.Layer
      extended by com.esri.map.GroupLayer
Direct Known Subclasses:
KMLLayer

public class GroupLayer
extends Layer

A group layer is a collection of layers extending from the Layer class. it can appear and act as a single layer and has a Layer object's properties such as visibility, extent etc.

If the group layer is the map's first layer, the map will be initialized by the first layer of group layer.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.esri.map.Layer
Layer.LayerStatus
 
Field Summary
protected  List<Layer> innerLayers
           
 
Fields inherited from class com.esri.map.Layer
_credentials, _progress, _resolutionList, serviceInfo
 
Constructor Summary
GroupLayer()
          Creates a GroupLayer
 
Method Summary
 int add(Layer layer)
          Adds a layer to the current layer group by appending it to the bottom.
 void addAll(Collection<? extends Layer> layers)
          Adds an array of layers to the current layer group.
 boolean addLayerAt(Layer layer, int index)
          Inserts a layer object at certain position in the group layer.
 void clear()
          The sublayers are removed.
 boolean contains(Layer layer)
           
protected  void createNativeLayer()
           
protected  boolean doesExist(com.esri.map.GroupLayerBase grouplayer, Layer checklayer)
           
protected  void finalize()
           
 Layer get(int index)
          Returns the layer for the given index position.
 SpatialReference getDefaultSpatialReference()
          Gets the defaultSpatialReference of the Layer.
 Envelope getFullExtent()
          Returns the full extent of the layer.
 long getID()
          Return the Layer runtime ID which is a long integer.
 Layer getLayer(String layername)
          Returns the layer for the given layer name.
 Layer[] getLayers()
          Returns the direct sublayers in an array.
 LayerLegendInfoCollection getLegend()
           
 double getMaxScale()
          Gets the maximum scale at which this layer will be displayed.
 double getMinScale()
          Gets the minimum scale at which this layer will be displayed.
protected  void graphicsLayerAddRequest(String layerName, int index)
           
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 initializeNativeLayer()
           
protected  int internalAdd(Layer layer)
           
protected  boolean internalAddLayerAt(Layer layer, int index)
           
protected  void internalInit()
           
 boolean isEmpty()
           
 void recycle()
          Releases resources referenced by the Layer so that they can be recycled.
protected  void recycleLayers()
           
 void remove(int index)
          Removes the layer in the given index.
 void remove(String layerName)
          Remove a layer by name.
protected  void setDefaultSpatialReference(SpatialReference defaultSpatialReference)
          Sets the defaultSpatialReference of the Layer.
protected  void setMap(JMap parent)
          Every layer is provided a reference to the parent JComponent that contains that layer.
 void setOpacity(float opacity)
          Sets the opacity of the GroupLayer, it will change all opacity of it sublayers.
 int size()
          Returns the size of the group layer.
 
Methods inherited from class com.esri.map.Layer
addLayerInitializeCompleteListener, fireLayerCreateCompleteEvent, fireLayerCreateErrorEvent, fireLayerCreateErrorEvent, getCopyrightText, getCredentialsInternal, getDescription, getException, getExtent, getInitialExtent, getInitializationError, getLayerHandle, getMap, getMapServer, getMapServerInfo, getMapServerLegendInfo, getName, getOpacity, getPopupInfo, getResolution, getResolutionList, getServiceDescription, getSpatialReference, getStatus, getUrl, getUrlHashCode, initializeAsync, internalGetLayerLegendInfos, isHidingNoDataTiles, isInitialized, isReady, isShowingCopyright, isVisible, loadServiceInfo, lock, reinitializeAsync, removeLayerInitializeCompleteListener, setCopyrightText, setCredentials, setDescription, setError, setException, setFullExtent, setInitialExtent, setLayerHandle, setMapServer, setName, setPopupInfos, setServiceDescription, setShowingCopyright, setStatus, setUrl, setVisible, unlock, updateSpatialReferenceStatus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

innerLayers

protected final List<Layer> innerLayers
Constructor Detail

GroupLayer

public GroupLayer()
Creates a GroupLayer

Method Detail

add

public int add(Layer layer)
Adds a layer to the current layer group by appending it to the bottom.

Parameters:
layer -
Returns:
the index of added layed. return -1 if the layer fail to add the group layer.

addAll

public void addAll(Collection<? extends Layer> layers)
Adds an array of layers to the current layer group.

Parameters:
layers - an array of layers

addLayerAt

public boolean addLayerAt(Layer layer,
                          int index)
Inserts a layer object at certain position in the group layer.

Parameters:
layer - a Layer object to be added.
index - an integer of position.
Returns:
true if the layer is inserted successfully.

clear

public void clear()
The sublayers are removed.


remove

public void remove(int index)
Removes the layer in the given index.

Parameters:
index - an integer should be less than current group layer size.

remove

public void remove(String layerName)
Remove a layer by name.

Parameters:
layerName - a layer name.

getLayers

public Layer[] getLayers()
Returns the direct sublayers in an array.

Returns:
an array of Layer objects

getLayer

public Layer getLayer(String layername)
Returns the layer for the given layer name.

Parameters:
layername - a layer name string
Returns:
a Layer object

get

public Layer get(int index)
Returns the layer for the given index position.

Parameters:
index - an integer for layer position.
Returns:
a Layer object

isEmpty

public boolean isEmpty()

contains

public boolean contains(Layer layer)

size

public int size()
Returns the size of the group layer.

Returns:
the size of the group layer.

setOpacity

public void setOpacity(float opacity)
Sets the opacity of the GroupLayer, it will change all opacity of it sublayers.

Overrides:
setOpacity in class Layer
Parameters:
opacity - the opacity to set.

getFullExtent

public Envelope getFullExtent()
Returns the full extent of the layer. Returns NULL if the group layer is empty.

Overrides:
getFullExtent in class Layer
Returns:
an Envelope object

getDefaultSpatialReference

public SpatialReference getDefaultSpatialReference()
Gets the defaultSpatialReference of the Layer.

Overrides:
getDefaultSpatialReference in class Layer
Returns:
Returns the defaultSpatialReference.

getID

public long getID()
Return the Layer runtime ID which is a long integer. A zero will be returned if the Layer object is invalid.

Returns:
a long integer.

getMinScale

public double getMinScale()
Description copied from class: Layer
Gets the minimum scale at which this layer will be displayed. For service layers this is defined by the service. For a GraphicsLayer there is no minimum scale.

Overrides:
getMinScale in class Layer
Returns:
the minimum scale

getMaxScale

public double getMaxScale()
Description copied from class: Layer
Gets the maximum scale at which this layer will be displayed. For service layers this is defined by the service. For a GraphicsLayer there is no maximum scale.

Overrides:
getMaxScale in class Layer
Returns:
the maximum scale

getLegend

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

internalInit

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

recycle

public void recycle()
Description copied from class: Layer
Releases resources referenced by the Layer so that they can be recycled.

Overrides:
recycle in class Layer

setDefaultSpatialReference

protected void setDefaultSpatialReference(SpatialReference defaultSpatialReference)
Sets the defaultSpatialReference of the Layer.

Overrides:
setDefaultSpatialReference in class Layer
Parameters:
defaultSpatialReference - The defaultSpatialReference to set.

internalAdd

protected int internalAdd(Layer layer)
Parameters:
layer -
Returns:

internalAddLayerAt

protected boolean internalAddLayerAt(Layer layer,
                                     int index)
Parameters:
layer -
index -
Returns:

doesExist

protected boolean doesExist(com.esri.map.GroupLayerBase grouplayer,
                            Layer checklayer)

recycleLayers

protected void recycleLayers()

graphicsLayerAddRequest

protected void graphicsLayerAddRequest(String layerName,
                                       int index)

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Layer
Throws:
Throwable

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

createNativeLayer

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

initializeNativeLayer

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

setMap

protected void setMap(JMap parent)
Description copied from class: Layer
Every layer is provided a reference to the parent JComponent that contains that layer. Layers can use the existence or absence of a parent to determine if are being used in a JMap.

Overrides:
setMap in class Layer
Parameters:
parent - the new parent component


Copyright © 2012. All Rights Reserved.