-
大小: 8KB文件類(lèi)型: .cs金幣: 1下載: 0 次發(fā)布日期: 2021-06-04
- 語(yǔ)言: C#
- 標(biāo)簽: 鄰帶轉(zhuǎn)換??
資源簡(jiǎn)介
c#代碼高斯投影換算過(guò)程,經(jīng)實(shí)踐驗(yàn)證,過(guò)程清晰,結(jié)果正確,加油~~
代碼片段和文件信息
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);
????????}
????????//獲取橢球參數(shù)ae2
????????private?void?cmbNormSelectedChanged(object?sender?EventArgs?e)
????????{
????????????string?str?=?null;
????????????try
????????????{
????????????????str?=?cmbNorm.SelectedItem.ToString();
????????????}
????????????catch
????????????{
????????????????MessageBox.Show(“基準(zhǔn)未選擇“);
????????????}
????????????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?=?““;
????????}
????????//?打開(kāi)文件按鈕
????????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();
???????????????????
評(píng)論
共有 條評(píng)論