UNPKG

1.7 kBTypeScriptView Raw
1// Type definitions for leaflet.FeatureGroup.SubGroup 1.0
2// Project: https://github.com/ghybs/Leaflet.FeatureGroup.SubGroup
3// Definitions by: Thomas Revesz <https://github.com/drtomato>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 2.3
6
7import * as L from 'leaflet';
8
9declare module 'leaflet' {
10 namespace FeatureGroup {
11 /**
12 * An extended FeatureGroup that adds its child layers into a parent
13 * group when added to a map (e.g., through L.Control.Layers). Typical
14 * usage is to dynamically add and remove groups of markers from marker
15 * clusters.
16 */
17 class SubGroup<P = any> extends FeatureGroup<P> {
18 /**
19 * Instantiates a SubGroup.
20 */
21 constructor(parentGroup?: LayerGroup, layers?: Layer[]);
22
23 /**
24 * Changes the parent group into which child markers are added to or
25 * removed from.
26 */
27 setParentGroup(parentGroup: LayerGroup): this;
28
29 /**
30 * Removes the current sub-group from map before changing the parent
31 * group. Re-adds the sub-group to map if it was before changing.
32 */
33 setParentGroupSafe(parentGroup: LayerGroup): this;
34
35 /**
36 * Returns the current parent group.
37 */
38 getParentGroup(): LayerGroup;
39 }
40 }
41
42 namespace featureGroup {
43 /**
44 * Creates a feature subgroup, optionally given an initial parent group and a set of layers.
45 */
46 function subGroup(parentGroup?: LayerGroup, layers?: Layer[]): FeatureGroup.SubGroup;
47 }
48}