Class GroupLayer

  • All Implemented Interfaces:
    LayerContent, Loadable

    public final class GroupLayer
    extends Layer
    Represents a layer that contains other layers. Group layers help organize related kinds of layers in a map or scene and can be used to define advanced drawing options. A group layer may be nested within another group layer.

    Suppose there are several feature layers that all represent water features in different dimensions. For example, wells (points), streams (lines), and lakes (polygons). The GroupLayer provides the functionality to treat them as one layer called "Water Features" even though they are stored as separate feature layers.

    Full Extent

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

    If an app wants to zoom to a group layer, it should interrogate the child layer loaded states to determine if the full extent of the group layer is representative of all layers - essentially wait for all children to be loaded before zooming to the group.

    Spatial Reference

    GroupLayer does not have a spatial reference.

    Min/Max scale

    You can set a min/max scale on a group layer. If a child layer has a more restricted min/max scale, the scale will be honored for that child.

    Opacity

    The visual opacity of a child layer will be the product of its opacity and the group layer's opacity.

    Identifying layers

    When identifying layers in a map/scene, identification will "pierce through" group layers into the child layers. When identifying on a GroupLayer, IdentifyLayerResult.getElements() will be empty. Calling IdentifyLayerResult.getSublayerResults() will give a list of IdentifyLayerResults for each child layer with the elements in that layer.

    Basemaps

    Group layers are not supported in basemaps (only operational layers). Attempting to create a basemap with a layer collection containing group layers will throw an unsupported layer exception and the basemap will not be created. Similarly, adding a layer collection containing group layers to an existing basemap will throw and none of the layers in the collection will be added.

    Since:
    100.5.0
    • Constructor Detail

      • 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
      • 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
    • Method Detail

      • 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
      • 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