Search Results for

    Show / Hide Table of Contents

    Class LayerCollection

    Represents a collection of map layers with support for grouping, ordering, and change notifications.

    Inheritance
    object
    LayerCollection
    Implements
    IEnumerable<ILayer>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Mapsui.Layers
    Assembly: Mapsui.dll
    Syntax
    public class LayerCollection : IEnumerable<ILayer>, IEnumerable

    Properties

    | Edit this page View Source

    Count

    Gets the number of layers in the collection.

    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    Add(ILayer, int)

    Adds a layer to a specific group.

    Declaration
    public void Add(ILayer layer, int group = 0)
    Parameters
    Type Name Description
    ILayer layer

    The layer to add.

    int group

    The group identifier (default is 0).

    | Edit this page View Source

    Add(IEnumerable<ILayer>, int)

    Adds multiple layers to a specific group.

    Declaration
    public void Add(IEnumerable<ILayer> layers, int group = 0)
    Parameters
    Type Name Description
    IEnumerable<ILayer> layers

    The layers to add.

    int group

    The group identifier (default is 0).

    | Edit this page View Source

    AddOnBottom(ILayer, int)

    Adds a layer at the bottom of the collection in a specific group.

    Declaration
    public void AddOnBottom(ILayer layer, int group = 0)
    Parameters
    Type Name Description
    ILayer layer

    The layer to add.

    int group

    The group identifier (default is 0).

    | Edit this page View Source

    AddOnTop(ILayer, int)

    Adds a layer on top of the collection in a specific group.

    Declaration
    public void AddOnTop(ILayer layer, int group = 0)
    Parameters
    Type Name Description
    ILayer layer

    The layer to add.

    int group

    The group identifier (default is 0).

    | Edit this page View Source

    Clear(int)

    Clears layers from a specific group.

    Declaration
    public void Clear(int group = 0)
    Parameters
    Type Name Description
    int group

    The group identifier (default is 0).

    | Edit this page View Source

    ClearAllGroups()

    Clears all layers from all groups.

    Declaration
    public void ClearAllGroups()
    | Edit this page View Source

    FindLayer(string)

    Finds layers in the collection by their name.

    Declaration
    public IEnumerable<ILayer> FindLayer(string layerName)
    Parameters
    Type Name Description
    string layerName

    The name of the layer to find.

    Returns
    Type Description
    IEnumerable<ILayer>

    The layers with the specified name.

    | Edit this page View Source

    Get(int, int)

    Gets a layer at a specific index in a group.

    Declaration
    public ILayer Get(int index, int group = 0)
    Parameters
    Type Name Description
    int index

    The index of the layer.

    int group

    The group identifier (default is 0).

    Returns
    Type Description
    ILayer

    The layer at the specified index and group.

    | Edit this page View Source

    GetEnumerator()

    Returns an enumerator that iterates through the collection.

    Declaration
    public IEnumerator<ILayer> GetEnumerator()
    Returns
    Type Description
    IEnumerator<ILayer>

    An enumerator for the layers in the collection.

    | Edit this page View Source

    GetLayers(int)

    Retrieves all layers in a specific group.

    Declaration
    public IEnumerable<ILayer> GetLayers(int group = 0)
    Parameters
    Type Name Description
    int group

    The group identifier (default is 0).

    Returns
    Type Description
    IEnumerable<ILayer>

    All the layers in the specified group.

    | Edit this page View Source

    GetLayersOfAllGroups()

    Retrieves all layers from all groups.

    Declaration
    public IEnumerable<ILayer> GetLayersOfAllGroups()
    Returns
    Type Description
    IEnumerable<ILayer>

    All the layers of all groups.

    | Edit this page View Source

    Insert(int, ILayer, int)

    Inserts a layer at a specific index in a group.

    Declaration
    public void Insert(int index, ILayer layer, int group = 0)
    Parameters
    Type Name Description
    int index

    The target index.

    ILayer layer

    The layer to insert.

    int group

    The group identifier (default is 0).

    | Edit this page View Source

    Insert(int, IEnumerable<ILayer>, int)

    Inserts multiple layers at a specific index in a group.

    Declaration
    public void Insert(int index, IEnumerable<ILayer> layers, int group = 0)
    Parameters
    Type Name Description
    int index

    The target index.

    IEnumerable<ILayer> layers

    The layers to insert.

    int group

    The group identifier (default is 0).

    | Edit this page View Source

    Modify(IEnumerable<ILayer>, IEnumerable<ILayer>)

    Modifies the layer collection by removing specified layers and adding new layers.

    Declaration
    public void Modify(IEnumerable<ILayer> layersToRemove, IEnumerable<ILayer> layersToAdd)
    Parameters
    Type Name Description
    IEnumerable<ILayer> layersToRemove

    The layers to remove from the collection.

    IEnumerable<ILayer> layersToAdd

    The layers to add to the collection.

    | Edit this page View Source

    Modify(Func<ILayer, bool>, IEnumerable<ILayer>)

    Modifies the layer collection by removing layers that match a specified predicate and adding new layers.

    Declaration
    public void Modify(Func<ILayer, bool> removePredicate, IEnumerable<ILayer> layersToAdd)
    Parameters
    Type Name Description
    Func<ILayer, bool> removePredicate

    The predicate to determine which layers to remove from the collection.

    IEnumerable<ILayer> layersToAdd

    The layers to add to the collection.

    | Edit this page View Source

    Move(int, ILayer)

    Moves a layer to a specific index in the collection.

    Declaration
    public void Move(int index, ILayer layer)
    Parameters
    Type Name Description
    int index

    The target index.

    ILayer layer

    The layer to move.

    | Edit this page View Source

    MoveDown(ILayer)

    Declaration
    public void MoveDown(ILayer layer)
    Parameters
    Type Name Description
    ILayer layer
    | Edit this page View Source

    MoveToBottom(ILayer)

    Moves a layer to the bottom of it's current group. This means the other layers will be drawn on top of it.

    Declaration
    public void MoveToBottom(ILayer layer)
    Parameters
    Type Name Description
    ILayer layer

    The layer to move.

    | Edit this page View Source

    MoveToTop(ILayer)

    Moves a layer to the top of it's current group. This means this layer will be drawn on top of the other layers.

    Declaration
    public void MoveToTop(ILayer layer)
    Parameters
    Type Name Description
    ILayer layer

    The layer to move.

    | Edit this page View Source

    MoveUp(ILayer)

    Declaration
    public void MoveUp(ILayer layer)
    Parameters
    Type Name Description
    ILayer layer
    | Edit this page View Source

    Remove(ILayer)

    Removes a specific layer from the collection.

    Declaration
    public bool Remove(ILayer layer)
    Parameters
    Type Name Description
    ILayer layer

    The layer to remove.

    Returns
    Type Description
    bool

    True if the layer was removed successfully; otherwise, false.

    | Edit this page View Source

    Remove(ILayer[])

    Removes multiple layers from the collection.

    Declaration
    public bool Remove(ILayer[] layers)
    Parameters
    Type Name Description
    ILayer[] layers

    The layers to remove.

    Returns
    Type Description
    bool

    True if all layers were removed successfully; otherwise, false.

    | Edit this page View Source

    Remove(Func<ILayer, bool>)

    Removes layers that match a specific predicate.

    Declaration
    public bool Remove(Func<ILayer, bool> predicate)
    Parameters
    Type Name Description
    Func<ILayer, bool> predicate

    The condition to match for removal.

    Returns
    Type Description
    bool

    True if all matching layers were removed successfully; otherwise, false.

    Events

    | Edit this page View Source

    Changed

    Occurs when the layer collection has changed (layers are added, removed, or moved).

    Declaration
    public event LayerCollection.LayerCollectionChangedEventHandler? Changed
    Event Type
    Type Description
    LayerCollection.LayerCollectionChangedEventHandler

    Implements

    IEnumerable<T>
    IEnumerable

    Extension Methods

    DisposableExtension.DisposeAllIfDisposable<T>(IEnumerable<T>)
    EnumerableLayerExtensions.WaitForLoadingAsync(IEnumerable<ILayer>)
    DisposableExtension.DisposeIfDisposable(object?)
    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX