geoview-core - v2.2.0
    Preparing search index...

    Class GVGroupLayer

    Manages a Group Layer.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    loadedOnce: boolean = false

    Indicates if the layer has become in loaded status at least once already

    Methods

    • Gets the bounds for the layer in the given projection. When the layer is a GVLayer, its layer bounds are returned. When the layer is a GVGroup, an Extent union of all layers bounds in the group is returned.

      Parameters

      • projection: Projection

        The projection to get the bounds into

      • stops: number

        The number of stops to use to generate the extent

      Returns Promise<Extent | undefined>

      A promise that resolves with the layer bounding box or undefined when not found

    • Returns all layers contained within this group, including nested layers.

      This method performs a depth-first traversal of the group hierarchy, collecting all child layers recursively. If a filter function is provided, it is applied to each layer before inclusion in the result. Both GVGroupLayer instances and concrete layer types may be returned, depending on the filter criteria.

      Parameters

      • Optionalfilter: (layer: AbstractBaseGVLayer) => boolean

        Optional predicate function used to filter the returned layers

      Returns AbstractBaseGVLayer[]

      A flattened array of all descendant layers (including group layers), optionally filtered

    • Returns all leaf layers (non-group layers) contained within this group, including those nested in child groups.

      This is a convenience method that retrieves all descendant layers and filters them to include only concrete AbstractGVLayer instances (i.e., excluding GVGroupLayer containers). The returned collection is flattened and traversed depth-first.

      Returns AbstractGVLayer[]

      An array of AbstractGVLayer instances representing all leaf layers in the group hierarchy

    • Retrieves all parent group layers of this layer in hierarchical order.

      The returned array starts with the immediate parent and continues up the hierarchy until the root group layer is reached or a group has already been visited (not supposed to happen).

      This method traverses upward through the parent chain starting from the immediate parent of this layer. A protection mechanism prevents infinite loops in case of circular parent references.

      Returns GVGroupLayer[]

      An array of parent GVGroupLayer instances, ordered from the immediate parent to the top-most ancestor. Returns an empty array if the layer has no parent.

    • Determines whether this layer is visible, taking into account the visibility of all its parent groups. A layer is considered visible only if:

      • the layer itself is visible, and
      • every parent GVGroupLayer up the hierarchy is also visible. This function walks upward through the group layer tree until it reaches the root, returning false immediately if any parent is not visible.

      Returns boolean

      true if this layer and all its parent groups are visible; otherwise false.

    • Overrides the way to get the bounds for this layer type.

      Parameters

      • projection: Projection

        The projection to get the bounds into

      • stops: number

        The number of stops to use to generate the extent

      Returns Promise<Extent | undefined>

      A promise that resolves with the layer bounding box or undefined when not found

    • Overrides the set opacity function to set the opacity to all the children as well.

      Parameters

      • opacity: number

        The desired opacity for the layer, typically between 0 (fully transparent) and 1 (fully opaque).

      • emitOpacityChanged: boolean = true

        Optional, whether to emit a layer opacity change event after updating the opacity. Defaults to true.

      Returns void

    • Sets the opacity of the layer while ensuring it does not exceed the opacity of its parent layer.

      If the layer has a parent, the provided opacity is clamped so that it cannot be greater than the parent's opacity. The resulting opacity is applied to the underlying OpenLayers layer.

      If the layer is a GVGroupLayer, the computed opacity is recursively applied to all child layers to maintain consistency within the layer hierarchy.

      Optionally emits a layer opacity change event.

      Parameters

      • opacity: number

        The desired opacity for the layer, typically between 0 (fully transparent) and 1 (fully opaque).

      • emitOpacityChanged: boolean = true

        Optional, whether to emit a layer opacity change event after updating the opacity. Defaults to true.

      Returns void

    • Recursively searches the layer tree to find the parent GVGroupLayer of a given layer.

      The search begins from the provided list of layers, which should represent the root-level layer collection. This method walks top-down through all nested GVGroupLayers until it finds the group whose children contain the specified layer. It proceeds this way, because OpenLayers doesn't have a way to start from a leaf - have to start from the root.

      Parameters

      • layer: AbstractBaseGVLayer

        The layer for which the parent group is being searched.

      • groupLayers: AbstractBaseGVLayer[]

        The list of layers to search within. Typically this is the root layer group of the map.

      Returns GVGroupLayer | undefined

      The parent group layer if found, otherwise undefined if the layer has no parent.