LayerContainer

public protocol LayerContainer

Implemented by any object that can contain Layers (such as a Map)

  • The Layers inside the container

    Declaration

    Swift

    var layers: [Layer] { get }
  • layers(_:) Extension method

    Filters the Layers contained by the supplied filters. It does no further type restriction although of course the Layer.Kind of the layer can be used to extract Layer.Kind specifc information

    Throws

    An exception will be thrown if there are no filters or no layers match

    Declaration

    Swift

    func layers(_ matching: LayerFilter...) throws -> [Layer]

    Parameters

    matching

    Zero or more filters to use to reduce the set of matching layers

    Return Value

    A new LayerContainer containing the filtered Layers

  • groupLayer(_:at:) Extension method

    Returns a single GroupLayer that matches the supplied filters

    Throws

    Any exception will be thrown if there are no filters, no layers match, or more than one layer matches the supplied filters

    Declaration

    Swift

    func groupLayer(_ matching: LayerFilter..., at index: Int? = nil) throws -> GroupLayer

    Parameters

    matching

    The filters that should result in a single Layer being identified

    index

    If you know that the filters which match multiple and want a specific result specify it here

    Return Value

    The matching GroupLayer

  • objectLayer(_:at:) Extension method

    Returns a single ObjectLayer that matches the supplied filters

    Throws

    Any exception will be thrown if there are no filters, no layers match, or more than one layer matches the supplied filters

    Declaration

    Swift

    func objectLayer(_ matching: LayerFilter..., at index: Int? = nil) throws -> ObjectLayer

    Parameters

    matching

    The filters that should result in a single Layer being identified

    Return Value

    The matching ObjectLayer

  • tileLayer(_:at:) Extension method

    Returns a single TileLayer that matches the supplied filters

    Throws

    Any exception will be thrown if there are no filters, no layers match, or more than one layer matches the supplied filters

    Declaration

    Swift

    func tileLayer(_ matching: LayerFilter..., at index: Int? = nil) throws -> TileLayer

    Parameters

    matching

    The filters that should result in a single Layer being identified

    Return Value

    The matching TileLayer

  • imageLayer(_:at:) Extension method

    Returns a single ImageLayer that matches the supplied filters

    Throws

    Any exception will be thrown if there are no filters, no layers match, or more than one layer matches the supplied filters

    Declaration

    Swift

    func imageLayer(_ matching: LayerFilter..., at index: Int? = nil) throws -> ImageLayer

    Parameters

    matching

    The filters that should result in a single Layer being identified

    Return Value

    The matching ImageLayer

  • object(_:deep:) Extension method

    Retreives an object with the specified id. By default the search is recursive (searching within groups).

    Declaration

    Swift

    func object(_ id: Int, deep recursiveSearch: Bool = true) -> Object?

    Parameters

    id

    The desired id

    recursiveSearch

    If true then the search will search within groups until it finds object layer containing the object with the id.

    Return Value

    An Object or nil if no object with that id exists

  • objects(deep:matching:) Extension method

    Retreives all of the objects contained by the layers of the container that match the supplied filters

    Declaration

    Swift

    func objects(deep recursiveSearch: Bool = true, matching filters: ObjectFilter...) -> [Object]

    Parameters

    recursiveSearch

    If true any groups will be recursively searched for the objects

    filters

    The LayerFilters objects must match

    Return Value

    All matching Objects