# Class LayerDefinitions

Represents a collection of LayerDefinition instances.

##### Index

### Constructors

constructor

### Methods

[iterator]
get
copyToRef
fromDTO

## Constructors

### constructor

- new LayerDefinitions(definitions?: LayerDefinition[]): LayerDefinitions

  Constructor.

  #### Parameters

  - definitions: LayerDefinition[] = []

    Definitions the collection shall consist of.

  #### Returns LayerDefinitions

## Methods

### [iterator]

- "[iterator]"(): IterableIterator<LayerDefinition>

  Iterates all contained LayerDefinition. Use this to get hold of all LayerDefinition instances the collection consists of.

  #### Returns IterableIterator<LayerDefinition>

### get

- get(id: string): LayerDefinition

  Gets the LayerDefinition instance with the same id. If no such instance is found then `LayerDefinition.notFound is returned.

  #### Parameters

  - id: string

    Id of layer definition to get.

  #### Returns LayerDefinition

  Layer instance.

### `Static` copyToRef

- copyToRef<T extends AvailableLayerDefinitions>(
  layerDefinitions: LayerDefinitions | { json?: LayerDefinitionsDTO },
  dst: T,
  ): T

  Copies the layer definitions defined by `layerDefinitions` to the `dst`.availableLayerDefinitions property.

  #### Type Parameters

  - T extends AvailableLayerDefinitions

  #### Parameters

  - layerDefinitions: LayerDefinitions | { json?: LayerDefinitionsDTO }

    Layer definitions to copy to `dst`.availableLayerDefinitions.

  - dst: T

    Object to assign property on.

  #### Returns T

  Reference to `dst`.

### `Static` fromDTO

- fromDTO(src?: LayerDefinitionsDTO): LayerDefinitions

  Creates a LayerDefinitions instance for a `Record<string, { permission_str: string }>` lookup where the properties are the layer ids. This is how a LayerDefinitions instance is represented in JSON.

  #### Parameters

  - `Optional` src: LayerDefinitionsDTO

    Source to copy from.

  #### Returns LayerDefinitions

  change with converted property.