Ejemplo n.º 1
0
        public void SelectByPolygons(IFeatureLayer selectedItem)
        {
            IFeatureLayer baseLayer   = selectedItem;
            IFeatureLayer selectLayer = null;

            foreach (ILayer layer in _map.MapFrame.DrawingLayers)
            {
                if (layer.LegendText == "Polygon")
                {
                    selectLayer = layer as IFeatureLayer;
                    break;
                }
            }

            List <int> resultIndices = null;

            if (selectLayer != null)
            {
                resultIndices = FeatureSetQuery.SpatialFilter(baseLayer.DataSet, selectLayer.DataSet);
                //resultIndices = OgrQuery.OgrSpatialFilter(baseLayer.DataSet, selectLayer.DataSet);
            }
            if (resultIndices != null)
            {
                baseLayer.UnSelectAll();
                baseLayer.Select(resultIndices);
                _map.Refresh();
            }
        }
Ejemplo n.º 2
0
        //作为委托传入到DrawPolygon操作中
        public void SelectByPolygon(IFeatureLayer drawedLayer)
        {
            ILegendItem selectedItem = (GIS.FrameWork.Application.App.Legend as GIS.Common.Dialogs.Legend).SelectedLegendMenuItem;

            if (selectedItem != null && selectedItem is IFeatureLayer)
            {
                IFeatureLayer baseLayer     = selectedItem as IFeatureLayer;
                IFeatureLayer selectLayer   = drawedLayer;
                List <int>    resultIndices = null;
                if (selectLayer != null)
                {
                    resultIndices = FeatureSetQuery.SpatialFilter(baseLayer.DataSet, selectLayer.DataSet);
                    //resultIndices = OgrQuery.OgrSpatialFilter(baseLayer.DataSet, selectLayer.DataSet);
                }
                if (resultIndices != null)
                {
                    baseLayer.UnSelectAll();
                    baseLayer.Select(resultIndices);
                    _map.Refresh();
                }
            }
        }