Skip to content

Commit

Permalink
edit documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
arnevogt committed Dec 12, 2024
1 parent 459b61e commit 8f80a7b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 26 deletions.
34 changes: 12 additions & 22 deletions src/packages/map/api/MapModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,41 +241,31 @@ export interface LayerCollection {
addLayer(layer: Layer): void;

/**
* Returns a list of operational layers on the top level.
* This does not include sublayers or layers in (nested) groups.
* Since this includes only top level layers the return type is a list of {@link Layer}
*/
getOperationalLayers(options?: LayerRetrievalOptions): Layer[];

/**
* Depending on `includeChildLayers`, this returns a list of all operational layers or all operational layers on the top level.
* If `includeChildLayers` is `true` it returns a flat list that contains all parent layers and child layers.
* Since this can also include {@link Sublayer} the return type is a list of {@link AnyLayer}.
* If the hierachy of child layers is deeply nested this operation can become costly if `includeChildLayers` is `true`.
* Returns a list of operational layers.
* Depending on `includeChildLayers`, this returns a list of all operational layers or only operational layers on the top level.
* If `includeChildLayers` is `true` it returns a flat list that contains all parent layers and child layers, otherwise only top level layers are included.
* If parameter `includeChildLayers` is provided this returns list of {@link AnyLayer} since it can include {@link Sublayer}, otherwise a list of {@link Layer} is returned.
* If the hierachy of child layers is deeply nested this operation can become costly if `includeChildLayers` is `true`.
*/
getOperationalLayers(
options?: LayerRetrievalOptions & { includeChildLayers: boolean }
): AnyLayer[];
getOperationalLayers(options?: LayerRetrievalOptions): Layer[];

/**
* Returns the layer identified by the `id` or undefined, if no such layer exists.
*/
getLayerById(id: string): AnyLayer | undefined;

/**
* Returns a list of top level layers known to this collection.
* This does not include sublayers or layers in (nested) groups.
* Since this includes only top level layers the return type is a list of {@link Layer}
*/
getAllLayers(options?: LayerRetrievalOptions): Layer[];

/**
* Depending on `includeChildLayers`, this returns a list of all layers or all top level layers known to this collection.
* If `includeChildLayers` is `true` it returns a flat list that contains all parent layers and child layers.
* Since this can also include {@link Sublayer} the return type is a list of {@link AnyLayer}.
* If the hierachy of child layers is deeply nested this operation can become costly if `includeChildLayers` is `true`.
* Returns a list of layers known to this collection. This includes base layers and operational layers.
* Depending on `includeChildLayers`, this returns a list of all layers or only top level layers.
* If `includeChildLayers` is `true` it returns a flat list that contains all parent layers and child layers, otherwise only top level layers are included.
* If parameter `includeChildLayers` is provided this returns list of {@link AnyLayer} since it can include {@link Sublayer}, otherwise a list of {@link Layer} is returned.
* If the hierachy of child layers is deeply nested this operation can become costly if `includeChildLayers` is `true`.
*/
getAllLayers(options?: LayerRetrievalOptions & { includeChildLayers: boolean }): AnyLayer[];
getAllLayers(options?: LayerRetrievalOptions): Layer[];

/**
* Removes a layer identified by the `id` from the map.
Expand Down
10 changes: 6 additions & 4 deletions src/packages/map/model/LayerCollectionImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -638,9 +638,9 @@ it("it should return all layers including children", async () => {
layers: [base, group]
});

const allLayers = model.layers.getAllLayers({includeChildLayers: true});
const allLayers = model.layers.getAllLayers({ includeChildLayers: true });
expect(allLayers.length).toBe(3); //base & group & child
const topLevelLayers = model.layers.getAllLayers({includeChildLayers: false});
const topLevelLayers = model.layers.getAllLayers({ includeChildLayers: false });
expect(topLevelLayers.length).toBe(2); //base & group
});

Expand Down Expand Up @@ -673,9 +673,11 @@ it("it should return all operational layers including children", async () => {
layers: [base, group]
});

const allOperationalLayers = model.layers.getOperationalLayers({includeChildLayers: true});
const allOperationalLayers = model.layers.getOperationalLayers({ includeChildLayers: true });
expect(allOperationalLayers.length).toBe(2); //group & child
const topLevelOperationalLayers = model.layers.getOperationalLayers({includeChildLayers: false});
const topLevelOperationalLayers = model.layers.getOperationalLayers({
includeChildLayers: false
});
expect(topLevelOperationalLayers.length).toBe(1); //group
});

Expand Down

0 comments on commit 8f80a7b

Please sign in to comment.