毕业论文开发语言企业开发JAVA技术.NET技术WEB开发Linux/Unix数据库技术Windows平台移动平台嵌入式论文范文英语论文
您现在的位置: 毕业论文 >> 企业开发 >> 正文

mapcontrol如何自动加载代码中添加的坐标值和线段属性画图

更新时间:2015-9-10:  来源:毕业论文

在VS2010arcgis engine中mapcontrol中操作,实现点击触发一个点击事件,或者运行就直接加载,自动加载代码中添加的坐标值和线段属性画图。
private void button1_Click(object sender, EventArgs e)
        {
            //首先要实现容器接口
            IGraphicsContainer pGraphicsContainer = axMapControl1.ActiveView as IGraphicsContainer;
            pGraphicsContainer.DeleteAllElements();//清空容器里面所有的元素

            //设置点的坐标
            IPoint pPoint = new PointClass();
            pPoint.PutCoords(310, 310);

            //IMarkerElement用来获得symbol属性
            IMarkerElement pMarkerElement = new MarkerElementClass();

            //用ISimpleMarkerSymbol来设置点的属性
            ISimpleMarkerSymbol pSymbol = new SimpleMarkerSymbolClass();
            IRgbColor pRGBcolor = new RgbColorClass();
            pRGBcolor.Red = 255;
            pRGBcolor.Green = 0;
            pRGBcolor.Blue = 0;
            pSymbol.Color = pRGBcolor;//红色
            pMarkerElement.Symbol = pSymbol;

            //IElement用来获得Geometry属性
            IElement pElement = pMarkerElement as IElement;


            //把IPoint转换为为IGeoMetry也能实现
            //IGeometry pGeometry = pPoint as IGeometry;
            //pElement.Geometry = pGeometry;
            pElement.Geometry = pPoint;

            //在容器里添加元素
            pGraphicsContainer.AddElement(pElement, 0);
            pElement.Activate(axMapControl1.ActiveView.ScreenDisplay);
            axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElement, null);
        }

//首先要实现容器接口
            IGraphicsContainer pGraphicsContainer = axMapControl1.ActiveView as IGraphicsContainer;
            pGraphicsContainer.DeleteAllElements();//清空容器里面所有的元素

            //设置点的坐标

            for (int i = 0; i <= 100; i = i + 10)
            {
                IPoint pPoint = new PointClass();
                pPoint.PutCoords(300 + i, 300 + i);
               
                //IMarkerElement用来获得symbol属性
                IMarkerElement pMarkerElement = new MarkerElementClass();

                //用ISimpleMarkerSymbol来设置点的属性
                ISimpleMarkerSymbol pSymbol = new SimpleMarkerSymbolClass();
                IRgbColor pRGBcolor = new RgbColorClass();
                pRGBcolor.Red = 255;
                pRGBcolor.Green = 0;
                pRGBcolor.Blue = 0;
                pSymbol.Color = pRGBcolor;//红色
                pMarkerElement.Symbol = pSymbol;

                //IElement用来获得Geometry属性
                IElement pElement = pMarkerElement as IElement;
               
                //把IPoint转换为为IGeoMetry也能实现
                //IGeometry pGeometry = pPoint as IGeometry;
                //pElement.Geometry = pGeometry;
                pElement.Geometry = pPoint;

                //在容器里添加元素
                pGraphicsContainer.AddElement(pElement, 0);
                pElement.Activate(axMapControl1.ActiveView.ScreenDisplay);
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pElement, null);

设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©youerw.com 优尔论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。