/// <summary> /// 获取图层所在的最低一级组图层。 /// </summary> /// <param name="map">地图对象。</param> /// <param name="layer">图层对象。</param> /// <returns>图层所在的组图层或者null</returns> public static IGroupLayer GetBelongGroupLayer(IMap map, ILayer layer) { IEnumLayer mapGroupLayers = LayerUtil.GetMapGroupLayers(map, true); IGroupLayer groupLayer = mapGroupLayers.Next() as IGroupLayer; if (groupLayer != null) { Predicate <ILayer> layerPredicate = currentLayer => currentLayer == layer; while (groupLayer != null) { if (LayerUtil.GetLayerOfGroupLayer(groupLayer, layerPredicate, false) != null) { if (groupLayer != null) { return(groupLayer); } } groupLayer = (mapGroupLayers.Next() as IGroupLayer); } } return(null); }