.net ArcGis引擎,如何突出显示某些功能/形状?

.net ArcGis引擎,如何突出显示某些功能/形状?,.net,arcgis,.net,Arcgis,在使用ArcGis引擎的独立c#/wpf应用程序中,我加载了一些形状 现在我想突出显示一个选定的功能。我可以在IFeatureSelection/图层上找到对象/特征,我从IFeature.Shape获得了IGeometry 有没有一种简单的方法来标记已知的特征/形状,比如用红色或类似的东西 我使用了如下功能: AxMapControl _mapControl; IFeatureSelection features = _mapControl.Map.Layer[0] as IFeatureSe

在使用ArcGis引擎的独立c#/wpf应用程序中,我加载了一些形状

现在我想突出显示一个选定的功能。我可以在IFeatureSelection/图层上找到对象/特征,我从IFeature.Shape获得了IGeometry

有没有一种简单的方法来标记已知的特征/形状,比如用红色或类似的东西

我使用了如下功能:

AxMapControl _mapControl;
IFeatureSelection features = _mapControl.Map.Layer[0] as IFeatureSelection;
ICursor cursor;
features.SelectionSet.Search(null, true, out cursor);
IFeature feature;
while ((feature = ((IFeatureCursor)cursor).NextFeature()) != null)
{
  IGeometry geometry = feature.Shape;
}
我搜索了样品,但没有找到我需要的东西

static public void FlashFeature(IFeature feature)
        {
            if (feature == null)
                return;
            IApplication app = ApplicationRef;
            IMxDocument doc = (IMxDocument)(app.Document);

            IFeatureIdentifyObj feature_identify_obj = new FeatureIdentifyObjectClass();
            feature_identify_obj.Feature = feature;
            ((IIdentifyObj)feature_identify_obj).Flash(doc.ActiveView.ScreenDisplay);
        }

其中ApplicationRef是:

static public IApplication ApplicationRef
        {
            get
            {
                Type obj_type = Type.GetTypeFromCLSID(typeof(AppRefClass).GUID);

                IApplication obj = null;
                try
                {
                    obj = (IApplication)Activator.CreateInstance(obj_type);
                }
                catch {}

                return obj;
            }
        }

也可以通过在IGraphicsContainer中创建graphics IEElement元素来实现,如:

        void ShowFeature(IFeature feature)
        {
            element.Geometry = geometry.Project(mapSpatialReference, feature.Shape);

            graphicsContainer.AddElement(element, 0);

            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            featureHighlighted = true;
        }

        void HideFeature()
        {
            if (!featureHighlighted)
                return;

            graphicsContainer.DeleteElement(element);

            activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

            featureHighlighted = false;
        }

您也可以尝试:第一个解决方案不起作用,我在调用ApplicationRef:80040154类not registered(HRESULT:0x80040154(REGDB_E_CLASSNOTREG))的Activator.CreateInstance时遇到COM异常。