嗨,我有以下代码,用于根据属性放大 arcGIS 对象,现在我需要的是能够使用选择功能突出显示该区域(您右键单击地图上的区域并选择的功能特征)。
目前我有一个可以进行缩放的事件。我也想将此选择添加到相同的属性中。
先感谢您!!!
ESRI.ArcGIS.Carto.ILayer layer = GetLayersClass.GetFieldBoundaryLayer;
if (layer is ESRI.ArcGIS.Carto.IGroupLayer)
{
ESRI.ArcGIS.Carto.IGroupLayer groupLayer = layer as ESRI.ArcGIS.Carto.IGroupLayer;
ICompositeLayer pCompositeLayer = layer as ICompositeLayer;
int layers = pCompositeLayer.Count;
ILayer pLayer = pCompositeLayer.Layer[0];
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IQueryFilter pFilter = new QueryFilterClass();
pFilter.WhereClause = "RightID = '" + selectedRightID.ToString() + "'";
IFeatureCursor pFeatureCursor = pFeatureClass.Search(pFilter, false);
IFeature pFeature = pFeatureCursor.NextFeature();
if (pFeature == null)
{
System.Windows.Forms.MessageBox.Show("This section doesn't exist");
return;
}
IApplication m_application = ArcMap.Application;
IMxDocument pMxDoc = (IMxDocument)m_application.Document;
IActiveView pActiveView = (IActiveView)pMxDoc.FocusMap;
IEnvelope pEnv = pFeature.Shape.Envelope;
pEnv.Expand(1.1, 1.1, true);
pActiveView.Extent = pEnv;
pActiveView.Refresh();
我尝试添加此代码,我认为这会将特定功能添加到选择中。但也没有运气。
IFeatureSelection pfeatSelect = pFeatureLayer as IFeatureSelection;
pfeatSelect.Add(pFeature);