在AE中通过指定中心点和半径画圆

来源:互联网 发布:阿里云多少钱一年 编辑:程序博客网 时间:2024/05/16 08:01
///
/// 通过指定的中心点、半径画圆
///</summary>
///要画的圆所在的图层</param>
///圆的中心点</param>
///半径圆的</param>
///图形绘制对象</param>
privatevoid DrawCircleByCenterAndRadius(ILayer pLayer, IPoint pPoint, double circleRadius, IScreenDisplay pScreenDisplay)
{
if (pLayer !=null)
    {
        ISegmentCollection pSegmentCollection 
=null;
if (pLayer is IFeatureLayer)
        {
            IFeatureLayer pFeatureLayer 
= pLayer as IFeatureLayer;
            IFeatureClass pFeatureClass 
= pFeatureLayer.FeatureClass;
if (pFeatureClass !=null)
            {
if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                {
                    pSegmentCollection 
=new PolylineClass();
                }
elseif (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                {
                    pSegmentCollection 
=new PolygonClass();
                }
//开始画圆
                pSegmentCollection.SetCircle(pPoint, circleRadius);
                IFeature pCircleFeature 
= pFeatureClass.CreateFeature();
                pCircleFeature.Shape 
= pSegmentCollection as IGeometry;
                pCircleFeature.Store();
//局部刷新
                IInvalidArea pInvalidArea =new InvalidAreaClass();
                pInvalidArea.Add(pSegmentCollection);
                pInvalidArea.Display 
= pScreenDisplay;
                pInvalidArea.Invalidate((
short)esriScreenCache.esriAllScreenCaches);
            }
        }
    }
}
0 0
原创粉丝点击