ArcEngine画点画线画面C#


ArcEngine实现画点 画面 画线 C#
资源截图
代码片段和文件信息
////////by须臾蜉蝣////////
////////////////////////////////

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Controls;


namespace DrawPoint
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        int m_x = 350;
        int m_y = 350;

        Random m_r= new Random();
        int ranNumX;
        int ranNumY;

        private void Form1_Load(object sender EventArgs e)
        {
            string strPath = System.Windows.Forms.Application.StartupPath;//指定路径
            axMapControl1.AddShapeFile(strPath “Polygon“);//加载polygon的shp文件
            axMapControl1.AddShapeFile(strPath “Polyline“);//加载polyline的shp文件
            axMapControl1.AddShapeFile(strPath “Point“);//加载point的shp文件           

            //设置画布大小
            IEnvelope pEnvelope = new EnvelopeClass();
            pEnvelope.PutCoords(0 0 600 600);
            axMapControl1.Extent = pEnvelope;
        }

        #region 生成点的三种方法
        /// 
        /// 1.直接在mapcontrol视窗中画点,不能常驻
        /// 

        private void DrawPoint()
        {
            //获得当前活动范围
            IActiveView pActiveView = axMapControl1.ActiveView;
            //开始画笔 
            pActiveView.ScreenDisplay.StartDrawing(pActiveView.ScreenDisplay.hDC (short)esriScreenCache.esriNoScreenCache);
            IPoint pPoint;
            //定义简单marker元素的标志
            ISimpleMarkerSymbol pSymbol = new SimpleMarkerSymbolClass();
            //设置颜色            
            IRgbColor pRGBcolor = new RgbColorClass();
            pRGBcolor.Red = 255;
            pRGBcolor.Green = 255;
            pRGBcolor.Blue = 0;
            pSymbol.Color = pRGBcolor;
            //形状为圆形
            pSymbol.style = esriSimpleMarkerstyle.esriSMSCircle;
            pSymbol.Size = 15;
            pSymbol.Angle = 270;
            
            //最后实现的时候要用ISymbol来实现,所以还是要做个转换
            ISymbol pPointSymbol = pSymbol as ISymbol;
            //该点是用来设置坐标的
            pPoint = new PointClass();
            pPoint.PutCoords(300 300);
            
            pActiveView.ScreenDisplay.SetSymbol((ISymbol)pPointSymbol);
            pActiveView.ScreenDisplay.DrawPoint(pPoint);
            //结束画笔
            pActiveView.ScreenDisplay.UpdateWindow();
            pActiveView.ScreenDisplay.FinishDrawing();

        }
        
        /// 
        /// 2.用element画点
        /// 

        private void DrawPointElement()
        {
            //首先要实现容器接口
            IGraphicsContainer pGraphicsContainer = axMapControl1.ActiveView as IGraphics

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      26112  2012-05-03 20:30  DrawAEDrawPointinDebugDrawPoint.exe

     文件      48640  2012-05-03 20:30  DrawAEDrawPointinDebugDrawPoint.pdb

     文件      11600  2012-05-03 20:38  DrawAEDrawPointinDebugDrawPoint.vshost.exe

     文件        490  2010-03-17 22:39  DrawAEDrawPointinDebugDrawPoint.vshost.exe.manifest

     文件         66  2012-05-03 20:29  DrawAEDrawPointinDebugPoint.dbf

     文件        148  2012-05-03 20:29  DrawAEDrawPointinDebugPoint.sbn

     文件        116  2012-05-03 20:29  DrawAEDrawPointinDebugPoint.sbx

     文件        100  2012-05-03 20:29  DrawAEDrawPointinDebugPoint.shp

     文件        100  2012-05-03 20:29  DrawAEDrawPointinDebugPoint.shx

     文件         66  2012-05-03 20:31  DrawAEDrawPointinDebugPolygon.dbf

     文件        132  2012-05-03 20:29  DrawAEDrawPointinDebugPolygon.sbn

     文件        116  2012-05-03 20:29  DrawAEDrawPointinDebugPolygon.sbx

     文件        100  2012-05-03 20:31  DrawAEDrawPointinDebugPolygon.shp

     文件        100  2012-05-03 20:31  DrawAEDrawPointinDebugPolygon.shx

     文件         66  2012-05-03 20:29  DrawAEDrawPointinDebugPolyline.dbf

     文件        132  2012-05-03 20:29  DrawAEDrawPointinDebugPolyline.sbn

     文件        116  2012-05-03 20:29  DrawAEDrawPointinDebugPolyline.sbx

     文件        100  2012-05-03 20:29  DrawAEDrawPointinDebugPolyline.shp

     文件        100  2012-05-03 20:29  DrawAEDrawPointinDebugPolyline.shx

     文件    4558848  2012-02-01 00:08  DrawAEDrawPointinDevComponents.DotNetBar2.dll

     文件       6267  2012-05-03 20:26  DrawAEDrawPointDrawPoint.csproj

     文件      22039  2012-05-03 20:39  DrawAEDrawPointForm1.cs

     文件      20085  2012-05-03 20:30  DrawAEDrawPointForm1.Designer.cs

     文件      11499  2012-05-03 20:30  DrawAEDrawPointForm1.resx

     文件     136240  2012-05-03 20:38  DrawAEDrawPointobjx86DebugDesignTimeResolveAssemblyReferences.cache

     文件       7329  2012-05-03 20:38  DrawAEDrawPointobjx86DebugDesignTimeResolveAssemblyReferencesInput.cache

     文件       2623  2012-05-03 20:38  DrawAEDrawPointobjx86DebugDrawPoint.csproj.FileListAbsolute.txt

     文件      26112  2012-05-03 20:30  DrawAEDrawPointobjx86DebugDrawPoint.exe

     文件       3956  2012-05-03 20:30  DrawAEDrawPointobjx86DebugDrawPoint.Form1.resources

     文件      48640  2012-05-03 20:30  DrawAEDrawPointobjx86DebugDrawPoint.pdb

............此处省略24个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)