• 大小: 2.79MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-12
  • 语言: 其他
  • 标签: 点生成TIN  

资源简介

通过exel表中的坐标创建shape文件生成tin

资源截图

代码片段和文件信息

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 System.Data.OleDb;
using System.Drawing.Imaging;
using System.Collections;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using System.IO;

namespace kurong
{
    public partial class CreateshpToTIN : Form
    {
        public AxSceneControl pScenecontrol;
        public string ExePath=“ “;

    public CreateshpToTIN(AxSceneControl sceneCon)
    {
         this.pScenecontrol = sceneCon;
         InitializeComponent();
           
     }

        private void button_loadpoint_Click(object sender EventArgs e)
        {
            OpenFileDialog mopenfiledig=new OpenFileDialog();
            mopenfiledig.title = “打开exel数据“;
            mopenfiledig.Filter = “Excel表格(*.xls)|*.xls“;
            DialogResult mdilogresult=new  DialogResult();
            mdilogresult = mopenfiledig.ShowDialog();      //     !!!!!
            if (mdilogresult == DialogResult.OK)
            {
                textBox_point.Text = mopenfiledig.FileName;
                ExePath = textBox_point.Text;
                
            }
            else
            {
            }
        }

        private void button_ok_Click(object sender EventArgs e)
        { 
            string sheetName = “sheet1“;
            //读取exel
            DataTable mdatatable = ReadExel(sheetNameExePath);
            //转为shp     // 默认存储路径s_path
            string s_path = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);       ///存储在debug目录下
            string shpName=“坐标点shp文件“;
            IFeatureClass mfeatuClass=ToShape(sheetNames_pathshpName);
            IFeatureClass FillFeatureclass= Fillshape(sheetName mdatatable mfeatuClass);
          
            string tin_path=textBox_outpath.Text;
            CreateTin(tin_path FillFeatureclass);
        }

        #region
        //读取exel表
        //exepath  exel文件的存储路径
        //sheetname   exel表格中sheet1的名称
        public DataTable ReadExel(string sheetnamestring exepath)
        {
            DataTable dtTable=new DataTable();
            DataSet ds=new DataSet();

            OleDbConnection conn = new OleDbConnection(“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=“ + exepath + “;Extended Properties=Excel 8.0“);
            conn.Open();
            string table = string.Format(“SELECT * FROM [{0}$]“sheetname);
            OleDbDataAdapter olecommand = new OleDbDataAdapter(table conn);
            olecommand.Fill(ds “[“ + sheetname + “]“);
            dtTable = ds.Tables[0];
            return dtTable;
        }
        #endregion

        #region
        //创建shape的几何字段,如点,线
        public IFeatureClass 

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

     文件      22528  2016-11-09 15:35  kurong\kurong\bin\Debug\kurong.exe

     文件      52736  2016-11-09 15:35  kurong\kurong\bin\Debug\kurong.pdb

     文件      11608  2016-11-09 15:35  kurong\kurong\bin\Debug\kurong.vshost.exe

     文件         38  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\prj.adf

     文件        104  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tdenv9.adf

     文件    1391568  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tedg.adf

     文件       3680  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\thul.adf

     文件      14628  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tmsk.adf

     文件        116  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tmsx.adf

     文件    1391568  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tnod.adf

     文件     115970  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tnodinfo.adf

     文件     927760  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tnxy.adf

     文件     231940  2016-11-09 15:28  kurong\kurong\bin\Debug\tin1\tnz.adf

     文件         38  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\prj.adf

     文件        104  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tdenv9.adf

     文件    1391568  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tedg.adf

     文件       3680  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\thul.adf

     文件      14628  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tmsk.adf

     文件        116  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tmsx.adf

     文件    1391568  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tnod.adf

     文件     115970  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tnodinfo.adf

     文件     927760  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tnxy.adf

     文件     231940  2016-11-09 15:32  kurong\kurong\bin\Debug\tin2\tnz.adf

     文件    3710946  2016-11-09 15:32  kurong\kurong\bin\Debug\坐标点shp文件.dbf

     文件    2551264  2016-11-09 15:32  kurong\kurong\bin\Debug\坐标点shp文件.shp

     文件     463948  2016-11-09 15:32  kurong\kurong\bin\Debug\坐标点shp文件.shx

     文件      10007  2016-11-09 16:09  kurong\kurong\CreateshpToTIN.cs

     文件       9530  2016-11-09 15:33  kurong\kurong\CreateshpToTIN.Designer.cs

     文件       8049  2016-11-09 15:33  kurong\kurong\CreateshpToTIN.resx

     文件       1156  2016-11-09 16:09  kurong\kurong\Form1.cs

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

评论

共有 条评论

相关资源