版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、高斯投影正反算程序设计一. 程序设计流程本程序的设计思路如下:(1) ,程序采用VS08版本作为开发平台,并采用C雄言作为开发语言,设计为WindowsForm 窗体程序形式。(2) ,程序主要的算法来自于教材。但是本程序为了更加实用,添加了更多的解算基准,包括:WGS-84国际椭球1975,克氏椭球,和 2000国家大地坐标系。(3) ,程序为了更方便的读取数据和输出数据,故需要自己定义了固定的数据输入格式和 数据输出格式或形式,请老师注意查看。二. 代码using System;using System.Collections.Generic;using System.ComponentM
2、odel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Gausspublic partial class Form1 : Form/大地坐标/Geodetic Coordinatepublic struct CRDGEODETICpublic double dLongitude;public double dLatitude;public double dHeight;/笛卡尔坐标/Cartesian Coordinatepublic struct C
3、RDCARTESIAN(public double x;public double y;public double z;)public Form1()(InitializeComponent();)private void button1_Click(object sender, EventArgs e)(double ee = 0;double a = 0;string tt;try(tt= boBox1.ItemsboBox1.SelectedIndex.ToString();)catch(MessageBox.Show("Gauss Inverse: Choose datum
4、error!");return;)if (tt.CompareTo(克氏椭球")=0)a = 6378245.00;ee = Math.Sqrt(0.006693421622);)if (tt.CompareTo("WGS-84") = 0)(a = 6378137.00;ee = Math.Sqrt(0.00669437999013);)if (tt.CompareTo("1975国际椭球")=0)(a = 6378140.00;ee = Math.Sqrt(0.006694384999588);)if (tt.CompareTo(
5、"2000国家大地坐标系 ")=0)(a = 6378137.0;ee =Math.Sqrt(0.0066943802290);)const double pai = 3.1415926;double b = Math.Sqrt(a * a * (1 - ee * ee);double c = a * a / b;double epp = Math.Sqrt(a * a - b * b) / b / b);CRDGEODETIC pcrdGeo;CRDCARTESIAN pcrdCar;double midlong;/ 求纬度string temp;temp = textB
6、ox1.Text.Split('');double tempradius = new double3;for (int i = 0; i < 3; i+)(tempradiusi = Convert.ToDouble(tempi);)pcrdGeo.dLatitude = tempradius0 / 180.0 * pai + tempradius1 / 180.0/ 60.0 * pai + tempradius2 / 180 / 60.0 / 60 * pai;/ 求经度temp = textBox2.Text.Split('');for (int i
7、 = 0; i < 3; i+)(tempradiusi = Convert.ToDouble(tempi);)pcrdGeo.dLongitude = tempradius0 / 180.0 * pai + tempradius1 / 180.0/ 60.0 * pai + tempradius2 / 180 / 60.0 / 60 * pai;int deglon = Convert.ToInt32(pcrdGeo.dLongitude * 180 / pai);/ 求中央经度int num;/带号midlong= 0;/默认值,需要制定分带try(tt= boBox3.Itemsb
8、oBox3.SelectedIndex.ToString();)catch(MessageBox.Show("Choose 3/6 error!");return;)if (tt.CompareTo("3度带")=0)num = Convert.ToInt32(deglon / 6 + 1);midlong = (6 * num - 3) / 180.0 * pai;)if (tt.CompareTo("6度带")=0)(num = Convert.ToInt32(deglon + 1.5) / 3);midlong = num *
9、3 * pai / 180;)double lp=pcrdGeo.dLongitude - midlong;double N = c / Math.Sqrt(1 + epp * epp * Math.Cos(pcrdGeo.dLatitude) * Math.Cos(pcrdGeo.dLatitude);double M = c / Math.Pow(1 + epp * epp * Math.Cos(pcrdGeo.dLatitude) * Math.Cos(pcrdGeo.dLatitude), 1.5);double ita = epp * Math.Cos(pcrdGeo.dLatitu
10、de);double t = Math.Tan(pcrdGeo.dLatitude);double Nscnb = N * Math.Sin(pcrdGeo.dLatitude) * Math.Cos(pcrdGeo.dLatitude);double Ncosb = N * Math.Cos(pcrdGeo.dLatitude);double cosb = Math.Cos(pcrdGeo.dLatitude);double X;double m0, m2, m4, m6, m8;double a0, a2, a4, a6, a8;m0 = a * (1 - ee * ee);m2 = 3.
11、0 / 2.0 * m0 * ee * ee;m4 = 5.0 / 4.0 * ee * ee * m2;m6 = 7.0 / 6.0 * ee * ee * m4;m8 = 9.0 / 8.0 * ee * ee * m6;a0 = m0 + m2 / 2.0 + 3.0 / 8.0 * m4 + 5.0 / 16.0 * m6 + 35.0 / 128.0 * m8;a2 = m2 / 2 + m4 / 2 + 15.0 / 32.0 * m6 +7.0/16.0 * m8;a4 = m4 / 8.0 + 3.0 / 16.0 * m6 + 7.0 / 32.0*m8;a6 = m6 /
12、32.0 + m8 / 16.0;a8 = m8 / 128.0;double B = pcrdGeo.dLatitude;double sb = Math.Sin(B);double cb = Math.Cos(B);double s2b = sb * cb * 2;double s4b = s2b * (1 - 2 * sb * sb) * 2;double s6b = s2b * Math.Sqrt(1 - s4b * s4b) + s4b * Math.Sqrt(1 - s2b * s2b);X = a0 * B - a2 / 2.0 * s2b + a4 * s4b / 4.0 -
13、a6 / 6.0 * s6b;pcrdCar.x = Nscnb * lp * lp / 2.0 + Nscnb * cosb * cosb * Math.Pow(lp, 4)* (5 - t * t + 9 * ita * ita + 4 * Math.Pow(ita, 4) / 24.0+ Nscnb * Math.Pow(cosb, 4) * Math.Pow(lp, 6) * (61 - 58 * t * t + Math.Pow(t, 4) / 720.0 + X;pcrdCar.y = Ncosb * Math.Pow(lp, 1) + Ncosb * cosb * cosb *
14、(1 - t * t + ita * ita) / 6.0 * Math.Pow(lp, 3) + Ncosb * Math.Pow(lp, 5)* Math.Pow(cosb, 4) * (5 - 18* t * t+ Math.Pow(t, 4) + 14 * ita * ita - 58 * ita * ita * t * t) / 120.0 ;if (pcrdCar.y < 0)pcrdCar.y += 500000;richTextBox1.Text = "Results:nX:t" + Convert.ToString(pcrdCar.x) +"
15、;nY:t"+ Convert.ToString(pcrdCar.y);)private void button2_Click(object sender, EventArgs e)(double ee = 0;double a = 0;string tt;int num;/带号string ytext;/利用y值求带号和中央经线)try(tt= boBox2.ItemsboBox2.SelectedIndex.ToString();)catch(MessageBox.Show("Gauss Inverse: Choose datum error!");retur
16、n;)if (tt.CompareTo("克氏椭球")=0)(a = 6378245.00;ee = Math.Sqrt(0.006693421622);)if (tt.CompareTo("WGS-84") = 0)(a = 6378137.00;ee = Math.Sqrt(0.00669437999013);)if (tt.CompareTo("1975国际椭球")=0)(a = 6378140.00;ee = Math.Sqrt(0.006694384999588);)if (tt.CompareTo("2000国家
17、大地坐标系 ")=0)(a = 6378137.0;ee =Math.Sqrt(0.0066943802290);const double pai = 3.1415926535898;double b = Math.Sqrt(a * a * (1 - ee * ee);double c = a * a / b;double epp = Math.Sqrt(a * a - b * b) / b / b);CRDGEODETIC pcrdGeo;CRDCARTESIAN pcrdCar;double midlong = 0;/ 求X, YW带号pcrdCar.x = Convert.To
18、Double(textBox4.Text);ytext = textBox5.Text;string temp = ytext.Substring(0, 2);num = Convert.ToInt32(temp);ytext = ytext.Remove(0, 2);pcrdCar.y = Convert.ToDouble(ytext) - 500000;try(tt= boBox4.ItemsboBox4.SelectedIndex.ToString();)catch(MessageBox.Show("Choose 3/6 error!");return;)if (tt
19、.CompareTo("3度带")=0)(midlong = num * 3 * pai / 180;)if (tt.CompareTo("6度带")=0)(midlong = (6 * num - 3) * pai / 180;)b = Math.Sqrt(a * a * (1 - ee * ee);c = a * a / b;epp = Math.Sqrt(a * a - b * b) / b;double m0, m2, m4, m6, m8;double a0, a2, a4, a6, a8;m0 = a * (1 - ee * ee);m2 =
20、 3.0 / 2.0 * m0 * ee * ee;m4 = 5.0 / 4.0 * ee * ee * m2;m6 = 7.0 / 6.0 * ee * ee * m4;m8 = 9.0 / 8.0 * ee * ee * m6;a0 = m0 + m2 / 2.0 + 3.0 / 8.0 * m4 + 5.0 / 16.0 * m6 + 35.0 / 128.0 * m8;a2 = m2 / 2 + m4 / 2 + 15.0 / 32.0 * m6 +7.0 /16.0 * m8;a4 = m4 / 8.0 + 3.0 / 16.0 * m6 + 7.0/ 32.0* m8;a6 = m
21、6 / 32.0 + m8 / 16.0;a8 = m8 / 128.0;double Bf, B;Bf = pcrdCar.x / a0;B = 0.0;while (Math.Abs(Bf - B) > 1E-10)(B = Bf;double sb = Math.Sin(B);double cb = Math.Cos(B);double s2b = sb * cb * 2;double s4b = s2b * (1 - 2 * sb * sb) * 2;double s6b = s2b * Math.Sqrt(1 - s4b * s4b) + s4b * Math.Sqrt(1 -
22、 s2b* s2b);Bf = (pcrdCar.x - (-a2 / 2.0 * s2b + a4 / 4.0 * s4b - a6 / 6.0 * s6b)/ a0;)double itaf, tf, Vf, Nf;itaf = epp * Math.Cos(Bf);tf = Math.Tan(Bf);Vf = Math.Sqrt(1 + epp * epp * Math.Cos(Bf) * Math.Cos(Bf);Nf = c / Vf;double ynf = pcrdCar.y / Nf;pcrdGeo.dLatitude = Bf - 1.0 / 2.0 * Vf * Vf *tf * (ynf * ynf - 1.0 / 12.0* Math.Pow(ynf, 4) * (5 + 3 * tf * tf + itaf * it
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 减脂塑形椅子课程设计
- 2024年超硬材料项目合作计划书
- 决策管理能力课程设计
- 农村大棚基础施工方案
- 公路波形护栏施工方案
- 小儿肺炎护理教学
- 第三方物流运输的合同范本2024年
- Java程序设计基础 课件 第3章 Java面向过程编程
- 野生菌中毒护理
- 购买柴油合同范本2024年
- 三年级上册数学课件-3.1三位数乘一位数(不进位) ︳青岛版 (共18张PPT)
- 火警处理流程图
- 起搏器术后并发症课件
- 小学科学苏教二年级上册1单元关心天气《天气的影响》教案
- 双重预防体系培训考试卷(含答案)
- 初中道德与法治人教九年级上册(统编2023年更新) 文明与家园美德万年长 教学设计
- 政治经济学-课件讲义全套
- 用电检查管理办法
- 2022年中小学心理健康教育指导纲要
- 中学团委组织架构图
- 《药物化学》讲义
评论
0/150
提交评论