using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Collections ;
using System.Text.RegularExpressions;
using System.Data.Odbc;
namespace 大地_空间坐标系转换
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double B, L, H, X, Y, Z, e2, w, N, a;
a = 6378137.000000;
e2 = 0.00669438;
if (((textBox1.Text == "") || (textBox2.Text == ""))||(textBox3 .Text ==""))
{
MessageBox.Show(this, "请输入大地坐标", "msg", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
B = Convert.ToDouble(textBox1.Text) * Math .PI /180;
L = Convert.ToDouble(textBox2.Text) * Math.PI / 180;
H = Convert.ToDouble(textBox3.Text) ;
w = Math.Sqrt(1 - e2 * Math.Pow(Math.Sin(B), 2));
N = a / w;
X = (N + H) * Math.Cos(B) * Math.Cos(L );
Y = (N + H) * Math.Cos(B) * Math.Sin(L);
Z = (N * (1 - e2) + H) * Math.Sin(B);
textBox4.Text = Convert.ToString(X );
textBox5.Text = Convert.ToString(Y );
textBox6.Text = Convert.ToString(Z );
}
private void button2_Click(object sender, EventArgs e)
{
double B, L, H, X, Y, Z, e2, w, N, a, e4, p, t, t0, tt, c;
a = 6378137.000000;
e2 = 0.00669438;
e4 = 0.0067394968;
if (((textBox4.Text == "") || (textBox5.Text == "")) || (textBox6.Text == ""))
{
MessageBox.Show(this, "请输入空间直角坐标", "msg", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
B = 0.1;