Options
All
  • Public
  • Public/Protected
  • All
Menu

A layer tree node that groups a number of child LayerTreeNode

Hierarchy

Implements

Overview

Constructors

constructor

Events

on

  • (event: string, callback: (...args: any[]) => void, context?: any): Handle
  • (event: "PaintRepresentationVisibilityChanged", callBack: (visibility: boolean, paintRepresentation: PaintRepresentation) => void, context?: any): Handle
  • (event: "VisibilityChanged", callBack: (visibility: boolean) => void, context?: any): Handle
  • (event: "LabelChanged", callBack: (label: string) => void, context?: any): Handle
  • Parameters

    • event: string
    • callback: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    • Optional context: any

    Returns Handle

  • Fired when the visibility of a certain paint representation of the layer changes. See setPaintRepresentationVisible.

    Parameters

    • event: "PaintRepresentationVisibilityChanged"

      the "PaintRepresentationVisibilityChanged" event.

    • callBack: (visibility: boolean, paintRepresentation: PaintRepresentation) => void

      the callback to be invoked when the visibility of a certain paint representation of the layer changes. The callback gets two parameters, 'visibility' indicates whether or not the 'paintRepresentation' is visible.

    • Optional context: any

      value to use as this when executing callback.

    Returns Handle

  • Fired when the visibility of the layer changes. See visible.

    Parameters

    • event: "VisibilityChanged"

      the "VisibilityChanged" event

    • callBack: (visibility: boolean) => void

      the callback to be invoked when the visibility of the layer changes. The callback gets one parameter, 'visibility' which indicates whether the layer is visible or not.

        • (visibility: boolean): void
        • Parameters

          • visibility: boolean

          Returns void

    • Optional context: any

      value to use as this when executing callback.

    Returns Handle

  • Fired when the label of the layer or layer group changes. See label.

    Parameters

    • event: "LabelChanged"

      the "LabelChanged" event

    • callBack: (label: string) => void

      the callback to be invoked when the label of the layer or layer group changes. The callback gets one parameter. 'label' which is the new label of the layer.

        • (label: string): void
        • Parameters

          • label: string

          Returns void

    • Optional context: any

      value to use as this when executing callback.

    Returns Handle

Accessors

children

id

  • get id(): string
  • The node's ID (immutable). This ID was configured at construction time. If no ID was given, a UUID will have been generated automatically.

    Returns string

label

  • get label(): string
  • set label(value: string): void
  • The node's label. This label was configured at construction time. If no label was given, the label will correspond to the layer's ID.

    Returns string

  • The node's label. This label was configured at construction time. If no label was given, the label will correspond to the layer's ID.

    Parameters

    • value: string

    Returns any

map

  • get map(): Map | null
  • The map this note is attached to, or null. This property will be null if this node is not attached to a map.

    Returns Map | null

parent

  • The parent of this node or null. This property will be null if this node has not been added as the child of another node yet.

    Returns LayerGroup | null

supportedPaintRepresentations

treeNodeType

visible

  • get visible(): boolean
  • set visible(visible: boolean): void
  • Denotes whether the node is visible. This can be considered to be the master visibility switch: Setting this to false makes the layer entirely invisible. If it is true, the visible paint representations will be visible.

    This property does not reflect whether this node's parent is visible as well, If this is desired, use LayerTreeNode.visibleInTree instead.

    Returns boolean

  • Denotes whether the node is visible. This can be considered to be the master visibility switch: Setting this to false makes the layer entirely invisible. If it is true, the visible paint representations will be visible.

    This property does not reflect whether this node's parent is visible as well, If this is desired, use LayerTreeNode.visibleInTree instead.

    Parameters

    • visible: boolean

    Returns any

visibleInTree

  • get visibleInTree(): boolean
  • set visibleInTree(value: boolean): void
  • Denotes whether this layer is visible on the map. This method will only return true if this layer and every parent layer up to the root of the layer tree is visible.

    If visibleInTree is set to true, this will ensure that every parent LayerTreeNode up to the of the tree is configured to be visible as well.

    Returns boolean

  • Denotes whether this layer is visible on the map. This method will only return true if this layer and every parent layer up to the root of the layer tree is visible.

    If visibleInTree is set to true, this will ensure that every parent LayerTreeNode up to the of the tree is configured to be visible as well.

    Parameters

    • value: boolean

    Returns any

Methods

accept

addChild

  • (layerTreeNode: LayerTreeNode, position?: "top" | "bottom" | "above" | "below", positionReference?: LayerTreeNode, noEvent?: boolean): void
  • Add a node to the LayerGroup

    Parameters

    • layerTreeNode: LayerTreeNode

      The LayerTreeNode to be added

    • Optional position: "top" | "bottom" | "above" | "below"
    • Optional positionReference: LayerTreeNode
    • Optional noEvent: boolean

    Returns void

canAddChild

  • Verifies whether the node can be added at the specified position. This check does not modify the LayerGroup. This check takes into account the ordering rules for layers that are applicable to the entire LayerTree. Layers of type LayerType.BASE must always be positioned at the bottom of the LayerTree.

    Parameters

    • layerTreeNode: LayerTreeNode

      The LayerTreeNode to be added

    • Optional position: "top" | "bottom" | "above" | "below"
    • Optional positionReference: LayerTreeNode

    Returns boolean

    whether the node can be added.

canMoveChild

  • Verifies whether the node can be moved to the specified position. This check does not modify the LayerGroup. This check takes into account the ordering rules for layers that are applicable to the entire LayerTree. Layers of type LayerType.BASE must always be positioned at the bottom of the LayerTree.

    Parameters

    • layerTreeNode: LayerTreeNode

      The LayerTreeNode to be added

    • Optional position: "top" | "bottom" | "above" | "below"
    • Optional positionReference: LayerTreeNode

    Returns boolean

    whether the node can be moved

findLayerById

  • Returns the layer with the given ID if that layer is this node or one of its children. Note that the layer's ID does not correspond with the layer's label.

    Parameters

    • id: string

      The id of the layer that you want to retrieve.

    Returns Layer

    the requested layer or undefined if it is not present in the tree

findLayerGroupById

  • Returns the layer group with the given ID if that layer is this node or one of its children.

    since

    2014.0

    Parameters

    • id: string

      The id of the layer group that you want to retrieve.

    Returns LayerGroup

    the requested layer group or undefined if it is not present in the tree

findLayerTreeNodeById

  • Returns the layer tree node with the given ID if that layer is this node or one of its children. This may be a layer-group or a layer.

    since

    2014.0

    Parameters

    • id: string

      The id of the layerTreeNode that you want to retrieve.

    Returns LayerTreeNode

    the requested layerTreeNode or undefined if it is not present in the tree

isPaintRepresentationSupported

  • Indicates whether the specified paint representation is supported for this layer. It returns always true since a LayerGroup is a collection of LayerTreeNodes. In other words, a group can support all the possible paint representations of its children.

    Parameters

    Returns boolean

    true in any case

isPaintRepresentationVisible

isPaintRepresentationVisibleInTree

moveChild

  • (layerTreeNode: LayerTreeNode, position?: "top" | "bottom" | "above" | "below", positionReference?: LayerTreeNode, noEvent?: boolean): void
  • Move a node that belongs to the same map to another location in its layer tree.

    Parameters

    • layerTreeNode: LayerTreeNode

      The layer to be moved

    • Optional position: "top" | "bottom" | "above" | "below"
    • Optional positionReference: LayerTreeNode
    • Optional noEvent: boolean

    Returns void

removeAllChildren

  • (): void
  • Removes all children from the layer group.

    Returns void

removeChild

  • Removes a child from this node.

    Parameters

    • layerTreeNode: LayerTreeNode

      The node to be removed.

    • Optional noEvent: boolean

    Returns void

setPaintRepresentationVisible

  • Sets the visibility of a specific paint representation. This allows for example to only show the BODY of a layer and not the LABEL:

      var layer = ...;
      layer.setPaintRepresentationVisible( PaintRepresentation.BODY, true );
      layer.setPaintRepresentationVisible( PaintRepresentation.LABEL, false );

    Parameters

    Returns void

setPaintRepresentationVisibleInTree

  • Sets the visibility of a specific paint representation in a layer tree. If it set to true, this will ensure that the paint representation of every parent LayerTreeNode up to the roof of the tree is configured to be visible as well.

    Parameters

    Returns void

visitChildren

whenReady

  • Wait until this layer or layer group is finished with all possible work related to any change that happened before this call.
    At that moment, the screen is up-to-date with all changes.

    Examples:

        map.mapNavigator.fit({ bounds: somewhere });
        map.layerTree.whenReady().then(makeScreenshot);

    or

        layer.painter.invalidateAll();
        layer.whenReady().then(alert);

    or

        layer.model.add(newFeature);
        layer.whenReady().then(alert);

    This call can be used to have a reliable, programmatic way to wait for all work leading up to the call to be reflected on the screen.
    The returned promise will always resolve once, when the layer is ready. The promise is rejected when the layer does not become ready in 5 minutes.

    Examples (not exhaustive) of aspects this promise will wait for:

    • While loading image data when it displayed for the first time, or after navigating the view
    • While loading image data after changing raster model properties such as WMS style
    • While loading feature data when it displayed for the first time, enters its scale range, or after navigating the view
    • While loading feature data after invalidating the layer query provider
    • While processing features after invalidating the layer feature painter or shape provider, or changing the layer filter
    • While processing features after they were added, updated or removed to/in/from a model or workingSet

    NOTE: The promise gets resolved also when an error (QueryStatus.QUERY_ERROR) occurs while handling underlying query.

    A LayerGroup or LayerTree will wait until all its children are ready.

    Returns Promise<LayerTreeNode>

    A promise that resolves to the LayerTreeNode when all current work is done

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method