本文整理汇总了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();
}
}
示例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);
}
示例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;
}
示例4: SelectFeatureByPolygon
public static void SelectFeatureByPolygon(IMap map,IPolygon polygon)
{
ISelectionEnvironment selectEnv = new SelectionEnvironmentClass();
selectEnv.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
map.SelectByShape(polygon, selectEnv, false);
}