当前位置:网站首页>ArcEngine(九)图形绘制

ArcEngine(九)图形绘制

2022-08-09 12:52:00 稻田里展望者

图形绘制是GIS系统中一个常用的功能,

MapControl提供了常用的线,圆,矩形,多变形的绘制

需要在axMapControl_OnMouseDown事件中设置绘制的方法

drawMapShape函数

private void drawMapShape(IGeometry geometry)
        {
    
            IRgbColor rgbColor;
            rgbColor = new RgbColorClass();
            rgbColor.Red = 255;
            rgbColor.Green = 255;
            rgbColor.Blue = 0;
            object symbol = null;
            if (geometry.GeometryType == esriGeometryType.esriGeometryPolyline ||
                  geometry.GeometryType == esriGeometryType.esriGeometryLine)
            {
    
                ISimpleLineSymbol simpleLineSymbol;
                simpleLineSymbol = new SimpleLineSymbolClass();
                simpleLineSymbol.Color = rgbColor;
                simpleLineSymbol.Width = 5;
                symbol = simpleLineSymbol;
            }
            else
            {
    
                ISimpleFillSymbol simpleFillSymbol;
                simpleFillSymbol = new SimpleFillSymbolClass();
                simpleFillSymbol.Color = rgbColor;
                symbol = simpleFillSymbol;
            }
            axMapControl1.DrawShape(geometry, ref symbol);
        }

axMapControl_OnMouseDown事件

private void axMapControl1_OnMouseDown(object sender, IMapControlEvents2_OnMouseDownEvent e)
        {
    
        	if (key == "Draw")
            {
    
                IGeometry geometry = this.axMapControl1.TrackCircle();
                drawMapShape(geometry);
            }
        }

按钮事件

private void botton_Click(object sender, EventArgs e)
        {
    
            key = "Draw";
        }
原网站

版权声明
本文为[稻田里展望者]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_46441425/article/details/126203752