当前位置: 首页>>代码示例>>C#>>正文


C# IMap.SelectByShape方法代码示例

本文整理汇总了C#中IMap.SelectByShape方法的典型用法代码示例。如果您正苦于以下问题:C# IMap.SelectByShape方法的具体用法?C# IMap.SelectByShape怎么用?C# IMap.SelectByShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMap的用法示例。


在下文中一共展示了IMap.SelectByShape方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateFeature

        public void UpdateFeature( IMap pMap ,ILayer pCurrentLayer,IPoint pPoint )
        {
            //处理具体数据
            if (pMap == null || pPoint == null )
                return;
            m_pMap = pMap;

            //如果没有地图图层 ,则不处理
            long nLayerCount = pMap.LayerCount;
            if( nLayerCount == 0 )
                return;

            //删除树结点
            FtTreeView.Nodes.Clear();

            this.FTtreeList.Nodes.Clear();

            //开始选择
            IGeometry geom = pPoint;

            ISpatialReference spatialReference = m_pMap.SpatialReference;
            geom.SpatialReference = spatialReference;

            //Refresh the active view
            IActiveView activeView = (IActiveView)m_pMap;

            ISelectionEnvironment selEnv =  new SelectionEnvironment();
            selEnv.PointSelectionMethod = esriSpatialRelEnum.esriSpatialRelWithin;
            m_pMap.SelectByShape(geom, selEnv, false);
            activeView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);

            //如果没有设置 当前图层pCurrentLayer ,则不处理

            ESRI.ArcGIS.esriSystem.IPersist pPersist = new FeatureLayer() as ESRI.ArcGIS.esriSystem.IPersist;
            UID uid = pPersist as UID ;

            IEnumLayer pEnumlayer = pMap.get_Layers(uid,true );

            pEnumlayer.Reset();
            ILayer pLayer = pEnumlayer.Next();
            while( pLayer != null )
            {

                if( pLayer.Visible == false )
                {
                    pLayer = pEnumlayer.Next();
                    continue;
                }

                IFeatureLayer2 pFtLayer = (IFeatureLayer2)pLayer;
                IFeatureSelection pFtSelect = (IFeatureSelection)pFtLayer;
                ISelectionSet pSelectset = (ISelectionSet)pFtSelect.SelectionSet;

                InitTreeView(pSelectset, pLayer);

                pLayer = pEnumlayer.Next();
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:58,代码来源:FrmFtAttr.cs

示例2: SelectFeatureByPoint

 public static void SelectFeatureByPoint(IMap map,System.Drawing.Point screenPoint,int pixelTol )
 {
     // Construct select envelope
     tagRECT r;
     r.left = screenPoint.X - pixelTol;
     r.right = screenPoint.X + pixelTol;
     r.top = screenPoint.Y - pixelTol;
     r.bottom = screenPoint.Y + pixelTol;
     IEnvelope hotEnvelope=new EnvelopeClass();
     // Transform for screen to map
     IActiveView activeView=map as IActiveView;
     IDisplayTransformation dispTransf = activeView.ScreenDisplay.DisplayTransformation;
     dispTransf.TransformRect(hotEnvelope, ref r, 5);
     // Create select environment
     hotEnvelope.SpatialReference = map.SpatialReference;
     ISelectionEnvironment selectEnviroment = new SelectionEnvironmentClass();
     selectEnviroment.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
     // Select by shape
     map.SelectByShape(hotEnvelope, selectEnviroment, false);
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:20,代码来源:MapSelectionHelperClass.cs

示例3: GetFeaturesInActiveView

        public static IEnumFeature GetFeaturesInActiveView(IMap map)
        {
            if (map == null)
                return null;

            IActiveView activeView = map as IActiveView;
            if (activeView == null)
                return null;

            map.SelectByShape(activeView.Extent, null, false);
            return map.FeatureSelection as IEnumFeature;
        }
开发者ID:Ramakrishnapv,项目名称:FuturaNetwork,代码行数:12,代码来源:DisplayMap.cs

示例4: SelectFeatureByPolygon

 public static void SelectFeatureByPolygon(IMap map,IPolygon polygon)
 {
     ISelectionEnvironment selectEnv = new SelectionEnvironmentClass();
     selectEnv.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
     map.SelectByShape(polygon, selectEnv, false);
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:6,代码来源:MapSelectionHelperClass.cs


注:本文中的IMap.SelectByShape方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。