Class GroupLayer

java.lang.Object
com.esri.arcgisruntime.layers.Layer
com.esri.arcgisruntime.layers.GroupLayer
All Implemented Interfaces:
LayerContent, Loadable

public final class GroupLayer extends Layer
A container for other layers and group layers. It is used to represent datasets that are composed of multiple layers to be managed as a single layer with respect to display in a map or scene.

Group layers are designed for presentation of operational layers that are related by a theme. You can add several related operational child layers into a group layer so the layers can be displayed together. Suppose there are several feature layers that represent existing infrastructure projects (buildings, sidewalks, roads, and trees). You can add these feature layers into a single group layer called "Existing". Similarly assume there are also proposed infrastructure projects that are features in other layers. These layers can be added to a group layer called "Planned". You can manage the visibility of the existing or planned features as separate groups.

For the most part, group layers behave like any other layer in that:

  • A group layer has visual properties (visibility, opacity) that can be applied to all layers in the group layer at once. This is helpful when controlling the visibility of the group.
  • You can set a scale range on a group layer using the minimum and maximum scale properties. If a child layer has more restricted scale range, that scale range will be honored for that child layer.
  • A group layer may be queried for the aggregate geographic extent of its child layers.
  • A group layer may be nested inside another group layer. There is no defined nesting level limit.
  • Cloning a group layer will also clone its child layers.
  • A group layer does not have its own attribute values. The text from the child layers is displayed instead.
  • A group layer is not time-aware, but may contain layers that are.
  • A group layer cannot be added to a basemap.

The full extent of a group layer is derived asynchronously based on what information is available from the child layers. This means the full extent can change when child layers are added or removed. The full extent geometry will have the spatial reference of the first loaded child layer.

The visual opacity property of the group layer affects the opacity of the child layers. The opacity of the child layers is a mathematical product of the individual child layer's opacity and the group layer's opacity. Opacity values range from 0.0 (transparent) to 1.0 (opaque). This means that setting the opacity of the group layer to 0.0 will make all child layers transparent [0 * AnyNumber = 0] . Likewise when the group layer opacity is 1.0, will set the opacity of the child layers to their individual layer opacity [1 * AnyNumber = AnyNumber].

Since:
100.5.0
  • Constructor Details

    • GroupLayer

      public GroupLayer()
      Creates a new, empty group layer. Once the layer is created you will have to set the child layers by calling getLayers() and adding the child layers to the resultant list.
      Since:
      100.5.0
      See Also:
    • GroupLayer

      public GroupLayer(Iterable<Layer> layers)
      Creates a new group layer with the given child layers.
      Parameters:
      layers - used to populate the list of child layers
      Throws:
      IllegalArgumentException - if layers is null or empty
      Since:
      100.5.0
      See Also:
  • Method Details

    • getLayers

      public ListenableList<Layer> getLayers()
      Gets a modifiable listenable list of the child layers associated with this group layer.

      You can add listeners to the returned list to be notified when child layers are added or removed. A layer can only be in the list once.

      Returns:
      the list of child layers; may be empty but is never null
      Since:
      100.5.0
    • isShowChildrenInLegend

      public boolean isShowChildrenInLegend()
      Indicates if the child layers of this group layer should be shown in the map legend.
      Returns:
      true to show the child layers, false otherwise
      Since:
      100.5.0
    • setShowChildrenInLegend

      public void setShowChildrenInLegend(boolean showChildrenInLegend)
      Sets whether or not the child layers of this group layer should be shown in the map legend. The default value is true.
      Parameters:
      showChildrenInLegend - true to show the child layers, false otherwise
      Since:
      100.5.0
    • setVisibilityMode

      public void setVisibilityMode(GroupVisibilityMode groupVisibilityMode)
      Sets the visibility mode for the layers in a table of contents.
      Parameters:
      groupVisibilityMode - a GroupVisibilityMode
      Throws:
      IllegalArgumentException - if groupVisibilityMode is null
      Since:
      100.9.0
    • getVisibilityMode

      public GroupVisibilityMode getVisibilityMode()
      Gets the visibility mode for the layers in a table of contents.
      Returns:
      a GroupVisibilityMode
      Since:
      100.9.0
    • copy

      public GroupLayer copy()
      Creates a deep copy of this GroupLayer instance. This means that copies of all fields of this layer are made including its load state.
      Returns:
      a deep copy of this GroupLayer instance
      Since:
      100.5.0