• 大小: 1.34MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-21
  • 语言: C#
  • 标签: C#  ArcEngine  Polyline  Polygon  

资源简介

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  DrawAE\DrawPoint\bin\Debug\DrawPoint.exe

     文件      48640  2012-05-03 20:30  DrawAE\DrawPoint\bin\Debug\DrawPoint.pdb

     文件      11600  2012-05-03 20:38  DrawAE\DrawPoint\bin\Debug\DrawPoint.vshost.exe

     文件        490  2010-03-17 22:39  DrawAE\DrawPoint\bin\Debug\DrawPoint.vshost.exe.manifest

     文件         66  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Point.dbf

     文件        148  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Point.sbn

     文件        116  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Point.sbx

     文件        100  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Point.shp

     文件        100  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Point.shx

     文件         66  2012-05-03 20:31  DrawAE\DrawPoint\bin\Debug\Polygon.dbf

     文件        132  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polygon.sbn

     文件        116  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polygon.sbx

     文件        100  2012-05-03 20:31  DrawAE\DrawPoint\bin\Debug\Polygon.shp

     文件        100  2012-05-03 20:31  DrawAE\DrawPoint\bin\Debug\Polygon.shx

     文件         66  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polyline.dbf

     文件        132  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polyline.sbn

     文件        116  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polyline.sbx

     文件        100  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polyline.shp

     文件        100  2012-05-03 20:29  DrawAE\DrawPoint\bin\Debug\Polyline.shx

     文件    4558848  2012-02-01 00:08  DrawAE\DrawPoint\bin\DevComponents.DotNetBar2.dll

     文件       6267  2012-05-03 20:26  DrawAE\DrawPoint\DrawPoint.csproj

     文件      22039  2012-05-03 20:39  DrawAE\DrawPoint\Form1.cs

     文件      20085  2012-05-03 20:30  DrawAE\DrawPoint\Form1.Designer.cs

     文件      11499  2012-05-03 20:30  DrawAE\DrawPoint\Form1.resx

     文件     136240  2012-05-03 20:38  DrawAE\DrawPoint\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache

     文件       7329  2012-05-03 20:38  DrawAE\DrawPoint\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件       2623  2012-05-03 20:38  DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.csproj.FileListAbsolute.txt

     文件      26112  2012-05-03 20:30  DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.exe

     文件       3956  2012-05-03 20:30  DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.Form1.resources

     文件      48640  2012-05-03 20:30  DrawAE\DrawPoint\obj\x86\Debug\DrawPoint.pdb

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

评论

共有 条评论