1、通用测绘C#程序设计源代码*- 常用测量程序设计 (1)用全站仪在A点观测了B点斜边和垂直角,求A到B的高差。 2D2a?i?v?(1?k)hcos?Dsinaavi-反-(提示:D-斜边,仪器高,-垂直角, AB2R光镜高,-大气折光系数) kusing System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 class Application static void Main(string args) Console.Write(请输入斜边尽); double D
2、= double.Parse(Console.ReadLine(); Console.Write(请输入垂直角摛摤洮獭嵳尽); double a = DEG(double.Parse(Console.ReadLine(); Console.Write(请输入仪器高尽); double i = double.Parse(Console.ReadLine(); Console.Write(请输入反光镜高尽); double v = double.Parse(Console.ReadLine(); double h = D * Math.Sin(a) + (1 - 0.13) * D / 63710
3、00.0 * D / 6371000.0 * Math.Cos(a) * Math.Cos(a) / 2.0 + i - v; Console.WriteLine(高差为屽,h); /将ddd.mmss转为弧度 static public double DEG(double ang) int fuhao = (int)(ang / Math.Abs(ang); ang = Math.Abs(ang); int d = (int)ang; int m = (int)(ang * 100) - d * 100; double s = ang * 10000 - m * 100 - d * 1000
4、0; return (d + m / 60.0 + s / 3600.0) * fuhao) / 180.0 * Math.PI; *- B点的坐标。点到B点的边长及方位角,计算(2)如图所示,已知A点的坐标及A System; using System.Collections.Generic; using System.Text; using ConsoleApplication1 namespace Application class args) void Main(string static ); 坐标尽X.Write(请输入A点的 Console.ReadLine(); .Parse(
5、Console double XA = double); 坐标尽请输入A点的Y Console.Write(.ReadLine(); .Parse(Console double YA = double); 摛摤洮獭嵳尽A到B的方位角 Console.Write(请输入.ReadLine(); Consoledouble a = DEG(double.Parse( ); 尽到B的水平距离Console .Write(请输入A.ReadLine(); Console S = double.Parse( double.Cos(a); double XB = XA + S*Math .Sin(a);
6、double YB = YA + S*Math ,XB,YB); ) Console.WriteLine(B点的坐标( 转为弧度将ddd.mmss / ang) DEG(double static publicdouble .Abs(ang); )(ang / Math int fuhao = (int.Abs(ang); ang = Math)ang; int int d = ()(ang * 100) - d * 100; int int m = ( s = ang * 10000 - m * 100 - d * 10000; double .PI; Mathreturn (d + m /
7、 60.0 + s / 3600.0) * fuhao) / 180.0 * 点到的边长及方位角。点的坐标,计算AB3()如图所示,已知A点和 System; using System.Collections.Generic; using System.Text; using ConsoleApplication1 namespace Application class *- static void Main(string args) Console.Write(请输入A点的X坐标尽); double XA = double.Parse(Console.ReadLine(); Console.
8、Write(请输入A点的Y坐标尽); double YA = double.Parse(Console.ReadLine(); Console.Write(请输入B点的X坐标尽); double XB = double.Parse(Console.ReadLine(); Console.Write(请输入B点的Y坐标尽); double YB = double.Parse(Console.ReadLine(); double S = 距离(XA, YA, XB, YB); double a = 方位角(XA, YA, XB, YB); Console.WriteLine(AB间的距离=0,从A
9、到B的方位角笽紱,S,DMS(a); /将弧度转为ddd.mmss static public double DMS(double ang) ang += 1.0E-15;/加上一个小量,以保证进位 int fuhao = (int)(ang / Math.Abs(ang); ang = Math.Abs(ang) * 180.0 / Math.PI; int d = (int)ang; ang = (ang - d) * 60.0; int m = (int)ang; double s = (ang - m) * 60.0; return (d + m / 100.0 + s / 10000
10、.0) * fuhao; /计算方位角,返回弧度值 public static double 方位角(double x1, double y1, double x2, double y2) double deltaX = x2 - x1; double deltaY = y2 - y1; double angle = Math.PI * 0.5; if (Math.Abs(deltaX) 0.000000001) angle = Math.Atan2(deltaY, deltaX); if (angle 0) angle += Math.PI; if (deltaY 2 * Math.PI)
11、a0 -= 2 * Math.PI; List 导线转角集合 = new List(); int i = 1; do Console.Write(请输入第0个转角的水平角左角为正,右角为负 2 * Math.PI) a0 -= 2 * Math.PI; else if (a0 0.0) a0 += 2 * Math.PI; Console.WriteLine(第0条边的方位角为?屽,i+,DMS(a0); /将弧度转为ddd.mmss static public double DMS(double ang) ang += 1.0E-15;/加上一个小量,以保证进位 int fuhao = (int)(ang / Math.Abs(ang); ang = Math.Abs(ang) * 180.0 / Math.PI; int d = (int)ang; ang = (ang - d) * 60.0; int m = (int)ang; double s = (ang - m) * 60.0; return (d + m / 100.0 + s / 10000.0) * fuhao; /将ddd.mmss转为弧度 static public double DEG(double ang
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1