Windows窗体应用程序
大地测量测序设计
✔主要功能为:
#菜单界面
#空间坐标与大地坐标互换
#高斯投影计算
#七参数转换
#邻带换算
#大地主题解算
✔上述功能都有手动输入和文件导入两种方式,都具有不同的设计布局方案,以及不同的代码程序。
源代码获取:?V:1 8 000 611 62 8
部分功能和代码截图
public class KongjianToDadi
{
public void GeodeticToSpatial(double latitude, double longitude, double height, double a, double b, double e2, out double X, out double Y, out double Z)
{
latitude = Chuli.ConvertToDegree(latitude);
longitude = Chuli.ConvertToDegree(longitude);
double W = Math.Sqrt(1 - e2 * Math.Sin(latitude) * Math.Sin(latitude));
double N = a / W;
X = (N + height) * Math.Cos(latitude) * Math.Cos(longitude);
Y = (N + height) * Math.Cos(latitude) * Math.Sin(longitude);
Z = (N * (1 - e2) + height) * Math.Sin(latitude);
}
public void SpatialToGeodetic(double X, double Y, double Z, double a, double e2, out double latitude, out double longitude, out double height)
{
// Calculate longitude
longitude = Math.Atan2(Y, X) * 180 / Math.PI;
// Calculate latitude
double tgB = Z / Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2));
double dtgB = 0;
//Iterative calculation
do
{
dtgB = Z / Math.Sqrt(X * X + Y * Y) + a * e2 * tgB / Math.Sqrt(X * X + Y * Y) / Math.Sqrt(1 + (1 - e2) * tgB * tgB) - tgB;
tgB += dtgB;
}
while (Math.Abs(dtgB) > 0.000000000000000000000000001);
latitude = Math.Atan(tgB);
// Calculate height
height = Math.Sqrt(Math.Pow(X, 2) + Math.Pow(Y, 2)) / Math.Cos(latitude) - a / Math.Sqrt(1 - e2 * Math.Pow(Math.Sin(latitude), 2));
latitude = latitude * 180 / Math.PI;
latitude = Chuli.ConversionToOutput(latitude);
longitude = Chuli.ConversionToOutput(longitude);
}
}
public class Gaussian
{
public void Natural(double B, double L, double a, double e2, double e12, double L0, double n, out double x, out double y, out double X, out double Y)
{
double N, M0, W;
W = Math.Sqrt(1 - e2 * Math.Sin(B) * Math.Sin(B));
N = a / W;
M0 = a * (1 - e2 );
double Eta2, t;
Eta2 = e12 * Math.Cos(B) * Math.Cos(B);
t = Math.Tan(B);
double Ac, Bc, Cc, Dc, Ec, Fc;
Ac = 1 + 3 / 4.0 * e2 + 45 / 64.0 * Math.Pow(e2, 2) + 175 / 256.0 * Math.Pow(e2, 3) + 11025 / 16384.0 * Math.Pow(e2, 4) + 43659 / 65536.0 * Math.Pow(e2, 5);
Bc = 3 / 4.0 * Math.Pow(e2, 1) + 15 / 16.0 * Math.Pow(e2, 2) + 525 / 512.0 * Math.Pow(e2, 3) + 2205 / 2048.0 * Math.Pow(e2, 4) + 72765 / 65536.0 * Math.Pow(e2, 5);
Cc = 15 / 64.0 * Math.Pow(e2, 2) + 105 / 256.0 * Math.Pow(e2, 3) + 2205 / 4096.0 * Math.Pow(e2, 4) + 10395 / 16384.0 * Math.Pow(e2, 5);
Dc = 35 / 512.0 * Math.Pow(e2, 3) + 315 / 2048.0 * Math.Pow(e2, 4) + 31185 / 131072.0 * Math.Pow(e2, 5);
Ec = 315 / 16384.0 * Math.Pow(e2, 4) + 3465 / 65536.0 * Math.Pow(e2, 5);
Fc = 693 / 131072.0 * Math.Pow(e2, 5);
double Alpha, Beta, Gamma, Delta, Epsilon, Zeta;
Alpha = Ac * M0;
Beta = -1 / 2.0 * Bc * M0;
Gamma = 1 / 4.0 * Cc * M0;
Delta = -1 / 6.0 * Dc * M0;
Epsilon = 1 / 8.0 * Ec * M0;
Zeta = -1 / 10.0 * Fc * M0;
double X1 = Alpha * B + Beta * Math.Sin(2 * B) + Gamma * Math.Sin(4 * B) + Delta * Math.Sin(6 * B) + Epsilon * Math.Sin(8 * B) + Zeta * Math.Sin(10 * B);
L = L * Math.PI / 180.0;
L0 = L0 * Math.PI / 180.0;
double l = L - L0;
double a0, a1, a2, a3, a4, a5, a6;
a0 = X1;
a1 = N * Math.Cos(B);
a2 = 1 / 2.0 * N * Math.Pow(Math.Cos(B), 2) * t;
a3 = 1 / 6.0 * N * Math.Pow(Math.Cos(B), 3) * (1 - t * t + Eta2);
a4 = 1 / 24.0 * N * Math.Pow(Math.Cos(B), 4) * (5 - t * t + 9 * Eta2 + 4 * Eta2 * Eta2) * t;
a5 = 1 / 120.0 * N * Math.Pow(Math.Cos(B), 5) * (5 - 18 * t * t + t * t * t * t + 14 * Eta2 - 58 * Eta2 * t * t);
a6 = 1 / 720.0 * N * Math.Pow(Math.Cos(B), 6) * (61 - 58 * t * t + t * t * t * t + 270 * Eta2 - 330 * Eta2 * t * t) * t;
x = a0 + a2 * Math.Pow(l, 2) + a4 * Math.Pow(l, 4) + a6 * Math.Pow(l, 6);
y = a1 * Math.Pow(l, 1) + a3 * Math.Pow(l, 3) + a5 * Math.Pow(l, 5);
X = x;
Y = n * 1000000 + y + 500000;
}
public void Back(double X,double Y, double a, double e2, double e12, double L0, out double B,out double L)
{
double x,y;
x = X;
y = Y - (int)(Y / 1000000.0) * 1000000.0 - 500000.0;
double Ac, Bc, Cc, Dc, Ec, Fc;
Ac = 1 + 3 / 4.0 * e2 + 45 / 64.0 * Math.Pow(e2, 2) + 175 / 256.0 * Math.Pow(e2, 3) + 11025 / 16384.0 * Math.Pow(e2, 4) + 43659 / 65536.0 * Math.Pow(e2, 5);
Bc = 3 / 4.0 * Math.Pow(e2, 1) + 15 / 16.0 * Math.Pow(e2, 2) + 525 / 512.0 * Math.Pow(e2, 3) + 2205 / 2048.0 * Math.Pow(e2, 4) + 72765 / 65536.0 * Math.Pow(e2, 5);
Cc = 15 / 64.0 * Math.Pow(e2, 2) + 105 / 256.0 * Math.Pow(e2, 3) + 2205 / 4096.0 * Math.Pow(e2, 4) + 10395 / 16384.0 * Math.Pow(e2, 5);
Dc = 35 / 512.0 * Math.Pow(e2, 3) + 315 / 2048.0 * Math.Pow(e2, 4) + 31185 / 131072.0 * Math.Pow(e2, 5);
Ec = 315 / 16384.0 * Math.Pow(e2, 4) + 3465 / 65536.0 * Math.Pow(e2, 5);
Fc = 693 / 131072.0 * Math.Pow(e2, 5);
double M0 = a * (1 - e2);
double Alpha, Beta, Gamma,Delta, Epsilon, Zeta;
Alpha = Ac * M0;
Beta = -1 / 2.0 * Bc * M0;
Gamma = 1 / 4.0 * Cc * M0;
Delta = -1 / 6.0 * Dc * M0;
Epsilon = 1 / 8.0 * Ec * M0;
Zeta = -1 / 10.0 * Fc * M0;
double B0,Bf;
B0 = x / Alpha;
do
{
double deta = Beta * Math.Sin(2 * B0) + Gamma * Math.Sin(4 * B0) + Delta * Math.Sin(6 * B0) + Epsilon * Math.Sin(8 * B0) + Zeta * Math.Sin(10 * B0);
Bf = (X - deta )/ Alpha;
if ( Math.Abs(Bf - B0) <= 0.001)
break;
B0 = Bf;
} while (true);
// Bf = Bf / 180 * Math.PI;
double Nf, Wf,Mf;
Wf = Math.Sqrt(1 - e2 * Math.Sin(Bf) * Math.Sin(Bf));
Nf = a / Wf;
Mf = M0 / (Wf * Wf * Wf);
double Etaf2, tf;
Etaf2 = e12 * Math.Cos(Bf) * Math.Cos(Bf);
tf = Math.Tan(Bf);
double b0, b1, b2, b3, b4, b5, b6;
b0 = Bf;
b1 = 1.0 / (Nf * Math.Cos(Bf));
b2 = -tf / (2.0 * Mf * Nf);
b3 = -(1.0 + 2.0 * tf * tf + Etaf2) * b1 / (6.0 * Nf * Nf) ;
b4 = -(5 + 3 * tf * tf + Etaf2 - 9 * tf * tf * Etaf2) * b2 / (12.0 * Nf * Nf);
b5 = (5 + 28 * tf * tf + 24 * tf * tf * tf * tf + 6 * Etaf2 + 8 * Etaf2 * tf * tf) / (120.0 * Nf * Nf * Nf * Nf) * b1;
b6 = (61 + 90 * tf * tf + 45 * tf * tf * tf * tf) / (360.0 * Nf * Nf * Nf * Nf) * b2;
L0 = L0 * Math.PI / 180;
B = b0 + b2 * Math.Pow(y, 2) + b4 * Math.Pow(y, 4) + b6 * Math.Pow(y, 6);
L = b1 * Math.Pow(y, 1) + b3 * Math.Pow(y, 3) + b5 * Math.Pow(y, 5) + L0;
}
public void ZWXBL(string select, double L, out double L0, out double n)
{
L0 = 0;
n = 0;
if (select == "3°带")
{
n = (int)((L - 1.5) / 3.0) + 1;
L0 = 3 * n;
}
if (select == "6°带")
{
n = (int)((L / 6.0)) + 1;
L0 = 6 * n - 3;
}
}
public void ZWXXY(string select, double Y, out double L0, out double n)
{
L0= 0;
n = (int)(Y / 1000000.0);
if (select == "3°带")
{
L0 = 3 * n;
}
if (select == "6°带")
{
L0 = 6 * n - 3;
}
}
}