• 大小: 287KB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2021-06-12
  • 语言: C#
  • 标签: 拓扑  节点      

资源简介

使用C#(VS2010)编写的“GIS拓扑生成”。给定【节点-弧拓扑表】,生成【弧-面】【面-弧】【弧-节点】三张拓扑表。压缩包内包含源程序以及使用说明:数据格式、源代码、操作步骤。

资源截图

代码片段和文件信息

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.IO;

namespace GIS_Topology
{
    //定义弧段的结构体
    struct Arc
    {
        public string ID;            //弧段的ID号
        public string startNode;     //弧段的起点
        public string endNode;       //弧段的终点
        public string leftPolygon;   //弧段的左多边形
        public string rightPolygon;  //弧段的右多边形
    }

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void 导入节点弧拓扑ToolStripMenuItem_Click(object sender EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.ShowDialog();
            string MyFileName = openFileDialog1.FileName;
            if (MyFileName.Trim() == ““)
                return;
            StreamReader MyReader = null;
            try
            {
                MyReader = new StreamReader(MyFileName System.Text.Encoding.Default);
                int point_mum = Convert.ToInt32(MyReader.ReadLine());
                dataGridView1.RowCount = point_mum;
                for (int i = 0; i < point_mum; i++)
                {
                    string[] temp = MyReader.ReadLine().Split(‘ ‘ ‘‘);
                    dataGridView1[0 i].Value = temp[0];
                    int arc_num = temp.Length - 1;
                    for (int j = 0; j < arc_num - 1; j++)
                        dataGridView1[1 i].Value += temp[j + 1] + ““;
                    dataGridView1[1 i].Value += temp[arc_num];
                }

            }
            catch
            {
                MessageBox.Show(“打开失败“ “信息提示“ MessageBoxButtons.OK MessageBoxIcon.Information);
                return;
            }
            finally
            {
                if (MyReader != null)
                {
                    MyReader.Close();
                }
            }
        }

        private void 导入弧节点拓扑ToolStripMenuItem_Click(object sender EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.ShowDialog();
            string MyFileName = openFileDialog1.FileName;
            if (MyFileName.Trim() == ““)
                return;
            StreamReader MyReader = null;
            try
            {
                MyReader = new StreamReader(MyFileName System.Text.Encoding.Default);
                int arc_num = Convert.ToInt32(MyReader.ReadLine());
                dataGridView2.RowCount = arc_num;
                dataGridView3.RowCount = arc_num;
                for (int i = 0; i < arc_num; i++)
                {
                    string[] temp = MyReader.ReadLine().Split(‘ ‘ ‘‘);
                    for (int j = 0; j < 3; j++)
                        dataGridV

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\
     文件          43  2011-10-28 22:20  拓扑生成(GIS)\Arc_Node.txt
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\
     文件       15398  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Form1.Designer.cs
     文件       10498  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Form1.cs
     文件        8041  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Form1.resx
     文件        3683  2011-10-30 18:17  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\GIS_Topology.csproj
     文件         143  2011-10-30 17:57  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\GIS_Topology.csproj.user
     文件         493  2011-10-30 17:56  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Program.cs
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Properties\
     文件        1356  2011-10-30 17:56  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Properties\AssemblyInfo.cs
     文件        2872  2011-10-30 17:56  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Properties\Resources.Designer.cs
     文件        5612  2011-10-30 17:56  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Properties\Resources.resx
     文件        1095  2011-10-30 17:56  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Properties\Settings.Designer.cs
     文件         249  2011-10-30 17:56  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\Properties\Settings.settings
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Debug\
     文件       15872  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Debug\GIS_Topology.exe
     文件       30208  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Debug\GIS_Topology.pdb
     文件       11600  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Debug\GIS_Topology.vshost.exe
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Release\
     文件       15360  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Release\GIS_Topology.exe
     文件       28160  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\bin\Release\GIS_Topology.pdb
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\obj\
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\obj\x86\
     目录           0  2012-07-01 16:06  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\obj\x86\Debug\
     文件        4440  2011-10-30 18:22  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6301  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         180  2011-10-30 18:26  拓扑生成(GIS)\GIS_Topology\GIS_Topology\GIS_Topology\obj\x86\Debug\GIS_Topology.Form1.resources
............此处省略23个文件信息

评论

共有 条评论