c#在ArCEngine中怎样根据中心点和两个半径来画出一个圆环?

renchuang 2020-12-19 09:09:17
c#在ArCEngine中怎样根据中心点和两个半径来画出一个圆环?
...全文
12297 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ziqi0716 2020-12-22
  • 打赏
  • 举报
回复
这个使用要付费吧?所以大家用的少
HerryDong 2020-12-22
  • 打赏
  • 举报
回复
很简单的问题啊,圆环不就是拿大的圆擦除小的圆嘛~
using System;
using System.Windows.Forms;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geometry;

namespace WinApp
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        // 绘制按钮
        private void btnDraw_Click(object sender, EventArgs e)
        {
            // 圆心
            IPoint pPoint = new ESRI.ArcGIS.Geometry.Point();
            pPoint.X = 400;
            pPoint.Y = 400;

            // 内部、外部半径
            double innerRadius = 200;
            double outerRadius = 300;

            // 内部、外部圆
            IGeometry pInnerCircleGeometry = CreateCircle(pPoint, innerRadius);
            IGeometry pOuterCircleGeometry = CreateCircle(pPoint, outerRadius);

            // 绘制圆环
            IGeometry pRingGeometry = Erase(pOuterCircleGeometry, pInnerCircleGeometry);
            CreateElement(axMapControl1.Object as IMapControlDefault, pRingGeometry);
        }

        // 根据圆心和半径创建一个圆
        private IGeometry CreateCircle(IPoint pPoint, double radius)
        {
            // 创建圆的边界线
            IConstructCircularArc pConstructCircularArc = new CircularArc() as IConstructCircularArc;
            pConstructCircularArc.ConstructCircle(pPoint, radius, false);
            ICircularArc pCircularArc = pConstructCircularArc as ICircularArc;

            // 转换为片段集合
            object missing = Type.Missing;
            ISegment pSegment = pCircularArc as ISegment;
            ISegmentCollection pSegmentCollection = new Ring() as ISegmentCollection;
            pSegmentCollection.AddSegment(pSegment, ref missing, ref missing);

            // 转换为环,闭合之
            IRing pRing = pSegmentCollection as IRing;
            pRing.Close();

            // 返回地理实体
            IGeometryCollection pGeometryCollection = new Polygon() as IGeometryCollection;
            pGeometryCollection.AddGeometry(pRing, ref missing, ref missing);
            IGeometry pGeometry = pGeometryCollection as IGeometry;
            return pGeometry;
        }

        // 利用小圆对大圆进行擦除操作
        private IGeometry Erase(IGeometry pSourceGeometry, IGeometry pEraseGeometry)
        {
            ITopologicalOperator pTopologicalOperator = pSourceGeometry as ITopologicalOperator;
            IGeometry pGeometry = pTopologicalOperator.Difference(pEraseGeometry);
            return pGeometry;
        }

        // 创建Element元素,添加到地图
        private void CreateElement(IMapControlDefault mapControl, IGeometry pGeometry)
        {
            // 创建颜色
            IRgbColor pRgbColor = new RgbColor();
            pRgbColor.Red = 255;
            pRgbColor.Green = 0;
            pRgbColor.Blue = 0;

            // 创建面符号
            ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbol();
            pSimpleFillSymbol.Color = pRgbColor;
            pSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSDiagonalCross;

            // 创建面要素
            IFillShapeElement pFillShapeElement = new PolygonElement() as IFillShapeElement;
            pFillShapeElement.Symbol = pSimpleFillSymbol;
            IElement pElement = pFillShapeElement as IElement;
            pElement.Geometry = pGeometry;

            // 添加至地图
            IActiveView pActiveView = mapControl.ActiveView;
            IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
            pGraphicsContainer.DeleteAllElements();
            pGraphicsContainer.AddElement(pElement, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
    }
}
weixin_42406391 2020-12-22
  • 打赏
  • 举报
回复
记得是GDI+
renchuang 2020-12-20
  • 打赏
  • 举报
回复
有大神吗,指点一下吧,谢了,
访问真八字排盘系统介绍: 1、八字排盘 八字排盘是将年月日时按照天干地支的形式进行排列,一个时间单位代表了一个柱。八字由年柱、月柱、日柱和时柱共四个柱组成,也被称为四柱八字。八字学基于国阴阳五行、天干地支与刑冲克害、以及民间盲派的神煞论等方式,进一步预测爱情顺遂、工作高低、姻缘好坏、财富高低、学业成就、身体健康等事的学问。 八字排盘由以下元素组合:年月日时四柱、大运干支、胎元 、流年干支、十神、地势、神煞等。生辰八字不只是把干支历计算出来,而还要遵守月令、节令的强弱,时辰的阴阳变化进行校正。排盘分析,就是根据出生者的性别、天干地支的阴阳五行关系、进一步推算出来的一套方法论,给预测者做人生吉凶的参考数据,在未来事业、财运、婚姻、家庭等问题时,能做出风险较低的决策。 八字排盘怎么看 八字排盘由年、月、日、时四柱组成,每柱包含一个天干和一个地支,共八个字。年柱代表出生的年份,月柱代表出生的月份,日柱代表出生的日期,时柱则代表出生的时辰。每个柱的干支组合都会对个人的命运产生影响。天干地支旁边标注的正财、偏财、偏印、正印、比肩、劫财、食神、伤官、正官、七杀等,称为十神。 2、八字排盘软件介绍 我们是腾讯云市场金牌合作伙伴,广州正规软件开发公司,开发的八字排盘系统数据最全面精准,我们八字排盘采用最精确的排盘程序,而且运用“真太阳时”,进行更精确的时间划分。大家都知道我们使用的北京时间,是统一规定的标准时间。而八字排盘需要相对于太阳方位的天文时间,即平太阳时。我们国家地大物博,北京时间19时,哈尔滨已经夜幕降临,而新疆却还是太阳高挂,这时哈尔滨的天文时间可能在20:00以后,而新疆的天文时间可能在16时以前。北京时间是东经120度经线的平太阳时,如果您出生地的经度与北京时间所处的经度差异较大,或者处于单数时间点的前后,比如6点差一刻,8点,10点15分等

111,097

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧