• 大小: 8KB
    文件类型: .cs
    金币: 1
    下载: 0 次
    发布日期: 2021-06-04
  • 语言: C#
  • 标签: 邻带转换  

资源简介

c#代码高斯投影换算过程,经实践验证,过程清晰,结果正确,加油~~

资源截图

代码片段和文件信息

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.xml;
using System.IO;

namespace CoordinateTransformation
{
    public partial class 高斯邻带换算 : Form
    {
        public 高斯邻带换算()
        {
            InitializeComponent();
        }

        private void 高斯邻带换算_Load(object sender EventArgs e)
        {
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.GridColor = System.Drawing.Color.Chocolate;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.RowHeaderSelect;

            xmlDocument xdoc = new xmlDocument();
            xdoc.Load(“..//..//Params.xml“);
            xmlNodeList xlist = xdoc.GetElementsByTagName(“type“);
            foreach (xmlNode node in xlist)
            {
                cmbNorm.Items.Add(node[“name“].InnerText);
            }
            cmbNorm.SelectedIndex = 0;
        }

        static double a = 0 b = 0;
        private double Pow(double dbl double no)
        {
            return Math.Pow(dbl no);
        }
        //获取椭球参数ae2
        private void cmbNormSelectedChanged(object sender EventArgs e)
        {
            string str = null;
            try
            {
                str = cmbNorm.SelectedItem.ToString();
            }
            catch
            {
                MessageBox.Show(“基准未选择“);
            }
            xmlDocument xdoc = new xmlDocument();
            xdoc.Load(“..//..//Params.xml“);
            xmlNodeList normlist = xdoc.GetElementsByTagName(“type“);
            foreach (xmlNode node in normlist)
            {
                if (node[“name“].InnerText == str)
                {
                    a = Convert.ToDouble(node[“a“].InnerText);
                    b = Convert.ToDouble(node[“b“].InnerText);
                    break;
                }
            }
        }

        // 高斯换算   
        private void btnCal_Click(object sender EventArgs e)
        {

        }

        // 重置按钮事件
        private void btnReset_Click(object sender EventArgs e)
        {
            txbX1.Text = ““;
            txbY1.Text = ““;
            txbX2.Text = ““;
            txbY2.Text = ““;
        }

        // 打开文件按钮
        private void btnFileInput_Click(object sender EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();
            open.Filter = “文本文件|*.txt|Word文件|*.doc“;
            open.InitialDirectory = “D:\\“;
            open.RestoreDirectory = true;
            if (open.ShowDialog() == DialogResult.OK)
            {
                FileStream fs = new FileStream(open.FileName FileMode.Open);
                StreamReader sr = new StreamReader(fs);
                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();
                   

评论

共有 条评论

相关资源