LayerGroup

概述

将多个图层合并为一个,任何一个图层移除相当于也从map中将其移除, 实现ILayer接口

用法示例

FMap.layerGroup([marker1, marker2])
    .addLayer(polyline)
    .addTo(map);

创建(Creation)

创建:

创建 描述
FMap.layerGroup( <ILayer[]> layers? ) 创建一个图层组,任选初始化的图层

方法(Methods)

方法:

方法 参数 返回值 描述
addTo() <Map> map this 添加图层组到地图中
addLayer() <ILayer> layer this 将给定的图层添加到图层组
removeLayer() <ILayer> layer this 将给定的图层从图层组中移除
removeLayer() <String> id this 将给定id所在的图层从图层组中移除
hasLayer() <ILayer> layer Boolean 如果给定的图层已经添加到图层组,返回true
getLayer() <String> id ILayer 将给定id所在的图层返回
getLayers() Array 以数组的形式返回所有已经添加到图层组中的图层
clearLayers() this 移除图层组中所有的图层
eachLayer() <Function> fn,<Object> context? this Iterates over the layers of the group, optionally specifying context of the iterator function.遍历图层组中的图层,可指定上下文
toGeoJSON() Object 返回layer group的GeoJSON表示(GeoJSON FeatureCollection)

results matching ""

    No results matching ""