private List <LayerFilterProperties> SearchIdentifyLayers()
        {
            List <LayerFilterProperties> IdentifyLayers = null;

            switch (AppConfig.Instance.IdentifierMode)
            {
            case IdentifierMode.AllLayer:
                IdentifyLayers = getAllLayers;
                break;

            case IdentifierMode.SelectableLayer:
                IdentifyLayers = getSelectableLayers;
                break;

            case IdentifierMode.VisibleLayer:
                IdentifyLayers = getVisibleLayers;
                break;

            case IdentifierMode.TopLayer:
                LayerFilterProperties layerProp = getTopmostLayer;
                if (layerProp != null)
                {
                    IdentifyLayers = new List <LayerFilterProperties>();
                    IdentifyLayers.Add(getTopmostLayer);
                }
                break;

            default:
                IdentifyLayers = new List <LayerFilterProperties>();
                IdentifyLayers.Add(getTargetLayer);
                break;
            }
            return(IdentifyLayers);
        }
        private void DisplayLayersFromMapControl()
        {
            IMap map = _context.MapControl.Map;

            if (map.LayerCount < 1)
            {
                return;
            }
            //获取指定类型图层
            UID uid = new UID();

            //表示搜索的是IDataLayer
            uid.Value = "{6CA416B1-E160-11D2-9F4E-00C04F6BC78E}";
            //布尔参数表示要搜索GroupLayer中的图层
            IEnumLayer layers = map.get_Layers(uid, true);

            layers.Reset();
            ILayer layer = layers.Next();

            while (layer != null)
            {
                LayerFilterProperties layerProperty = new LayerFilterProperties();
                //layerProperty.HeaderImage = null;
                layerProperty.LayerCategory    = string.Empty;
                layerProperty.LayerFilterName  = layer.Name;
                layerProperty.LayerFeatureType = GetLayerFeatureType(layer);
                layerProperty.TargetLayer      = layer;
                //保存引用
                layerFilterSet.Add(layerProperty);
                layer = layers.Next();
            }
            //释放Com对象
            System.Runtime.InteropServices.Marshal.ReleaseComObject(layers);
        }
        private void ExecuteIdentify(List <LayerFilterProperties> searchLayers, IGeometry identifyGeom)
        {
            object    Missing        = Type.Missing;
            IEnvelope searchEnvelope = GetIdentifyEnvelope(identifyGeom.Envelope);

            identifiedResultsList.Clear();

            int identifiedObjCount = 0;
            //获取用于查询的图层的数量
            int searchLayersCount = searchLayers.Count;

            //初始化进度条
            //IdentifyProgress.Visible = true;
            //IdentifyProgress.Maximum = searchLayersCount;
            ////初始化闪烁对象
            //flashObjects.MapControl = associateMapControl.Object as IMapControl2;
            //flashObjects.Init();
            //遍历所有图层
            for (int i = 0; i < searchLayersCount; i++)
            {
                LayerFilterProperties filterProps = searchLayers[i];
                ILayer layer = filterProps.TargetLayer;
                //新建查询结果列表对象
                LayerIdentifiedResult layerIdentifiedResult = new LayerIdentifiedResult();
                //先保存查询图层对象
                layerIdentifiedResult.IdentifyLayer = layer;
                layerIdentifiedResult.GeometryType  = filterProps.LayerFeatureType;
                //首先获得查询结果列表对象,以备后面往里添加结果使用
                List <IFeatureIdentifyObj> identifiedObjList = layerIdentifiedResult.IdentifiedFeatureObjList;
                //执行查询,返回查询结果
                IArray identifyResult = Identify(layer, searchEnvelope);
                //处理异常情况
                if (identifyResult != null)
                {
                    //依次获取每一个查询结果对象
                    for (int k = 0; k < identifyResult.Count; k++)
                    {
                        identifiedObjCount++;
                        IFeatureIdentifyObj identifiedFeatureObj = identifyResult.get_Element(k) as IFeatureIdentifyObj;
                        //闪烁要素
                        IFeature identifiedFeature = (identifiedFeatureObj as IRowIdentifyObject).Row as IFeature;
                        //添加闪烁图形
                        //flashObjects.AddGeometry(identifiedFeature.Shape);
                        //保存查询结果
                        identifiedObjList.Add(identifiedFeatureObj);
                    }
                    identifiedResultsList.Add(layerIdentifiedResult);
                }
                //显示查询进度
                //IdentifyProgress.Value = i + 1;
                Application.DoEvents();
            }
            //隐藏进度条
            // IdentifyProgress.Visible = false;
            //显示查询到的要素数量
            // lblFeatureCount.Text = "查询到 " + identifiedObjCount + " 条记录";
        }
        private void InitializeBasicLayerFilters()
        {
            //添加默认过滤器
            //最顶图层
            LayerFilterProperties topMostLayerProperty = new LayerFilterProperties();

            //topMostLayerProperty.HeaderImage = null;
            topMostLayerProperty.LayerCategory    = string.Empty;
            topMostLayerProperty.LayerFeatureType = LayerFeatureType.None;
            topMostLayerProperty.LayerFilterName  = TopMostLayer;
            topMostLayerProperty.TargetLayer      = null;

            //可见图层
            LayerFilterProperties visibleLayerProperty = new LayerFilterProperties();

            //visibleLayerProperty.HeaderImage = null;
            visibleLayerProperty.LayerCategory    = string.Empty;
            visibleLayerProperty.LayerFeatureType = LayerFeatureType.None;
            visibleLayerProperty.LayerFilterName  = VisibleLayers;
            visibleLayerProperty.TargetLayer      = null;
            //visibleLayerProperty.MapWindow = associateMapWindow;
            //可选图层
            LayerFilterProperties selectableLayerProperty = new LayerFilterProperties();

            //selectableLayerProperty.HeaderImage = null;
            selectableLayerProperty.LayerCategory    = string.Empty;
            selectableLayerProperty.LayerFeatureType = LayerFeatureType.None;
            selectableLayerProperty.LayerFilterName  = SelectableLayers;
            selectableLayerProperty.TargetLayer      = null;
            //selectableLayerProperty.MapWindow = associateMapWindow;
            //所有图层
            LayerFilterProperties allLayerProperty = new LayerFilterProperties();

            //allLayerProperty.HeaderImage = null;
            allLayerProperty.LayerCategory    = string.Empty;
            allLayerProperty.LayerFeatureType = LayerFeatureType.None;
            allLayerProperty.LayerFilterName  = AllLayers;
            allLayerProperty.TargetLayer      = null;
            //allLayerProperty.MapWindow = associateMapWindow;

            //保存图层引用
            layerFilterSet.Add(topMostLayerProperty);
            layerFilterSet.Add(visibleLayerProperty);
            layerFilterSet.Add(selectableLayerProperty);
            layerFilterSet.Add(allLayerProperty);
        }
        private void DisplayLayerFilters()
        {
            //保存清空前的选中状态
            int selectedIndex = _cboIdentifierMode.SelectedIndex;

            if (selectedIndex < 0)
            {
                selectedIndex = 0;
            }
            //清空先
            _cboIdentifierMode.Items.Clear();


            int filterCount = layerFilterSet.Count;

            //加载所有图层过滤条件
            for (int i = 0; i < filterCount; i++)
            {
                LayerFilterProperties filterItem = layerFilterSet[i];
                _cboIdentifierMode.Items.Add(filterItem.LayerFilterName);
            }
            //设定默认过滤条件
            _cboIdentifierMode.SelectedIndex = selectedIndex;
        }