using System
using System.Collections.Generic
using System.Linq
using System.Text
namespace 测绘工程
{
class Program
{
static void Main(string[] args)
{
string a
Console.WriteLine("1:距离计算")
Console.WriteLine("2:度、分、秒转换")
Console.WriteLine("3:度与弧度转换")
Console.WriteLine("4:前方交会")
Console.WriteLine("5:距离交会")
Console.WriteLine(" ")
a=Console.ReadLine()
switch (a)
{
case "1"://计算距离
Distance distance = new Distance()
Console.WriteLine("请输入第一个点位坐标:")
distance.X1 = Convert.ToDouble(Console.ReadLine())
distance.Y1 = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个点位坐标:")
distance.X2 = Convert.ToDouble(Console.ReadLine())
distance.Y2 = Convert.ToDouble(Console.ReadLine())
distance.Calcu()
Console.ReadLine()
break
case "2"://度、分、秒转换
zhuanhuan zhuanhuan = new zhuanhuan()
string b
Console.WriteLine("1:度转换为分")
Console.WriteLine("2:度转换为秒")
Console.WriteLine("3:分转换为秒")
Console.WriteLine("4:分转换为度")
Console.WriteLine("5:秒转换为度")
Console.WriteLine("6:秒转换为分")
Console.WriteLine(" ")
b = Console.ReadLine()
switch(b)
{
case "1":
Console.WriteLine("度数:")
double dushu=Convert.ToDouble(Console.ReadLine())
zhuanhuan.A(dushu)
Console.WriteLine("转换后度数为:"+"{0:f4}"+"分",dushu)
Console.ReadLine()
break
case "2":
Console.WriteLine("度数:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu=(zhuanhuan.A(dushu))
dushu = (zhuanhuan.A(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "秒", dushu)
Console.ReadLine()
break
case "3":
Console.WriteLine("分:")
dushu = Convert.ToDouble(Console.ReadLine())
zhuanhuan.A(dushu)
Console.WriteLine("转换后度数为:" +"{0:f4}"+ "秒", dushu)
Console.ReadLine()
break
case "4":
Console.WriteLine("分:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu = (zhuanhuan.B(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "度", dushu)
Console.ReadLine()
break
case "5":
Console.WriteLine("秒:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu = (zhuanhuan.B(dushu))
dushu = (zhuanhuan.B(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "度",dushu)
Console.ReadLine()
break
case "6":
Console.WriteLine("秒:")
dushu = Convert.ToDouble(Console.ReadLine())
dushu = (zhuanhuan.B(dushu))
Console.WriteLine("转换后度数为:" + "{0:f4}" + "分", dushu)
Console.ReadLine()
break
}
break
case "3":
{
string aa
double bb
huduzhi huduzhi = new huduzhi()
Console.WriteLine("1:角度制转换为弧度制")
Console.WriteLine("2:弧度制转换为角度制")
Console.WriteLine(" ")
aa = Console.ReadLine()
if (aa == "1")
{
Console.WriteLine("角度为:")
bb =Convert.ToDouble(Console.ReadLine())
bb=huduzhi.A(bb)
Console.WriteLine("弧度为: "+"{0:f4}",bb)
Console.ReadLine()
}
if (aa == "2")
{
Console.WriteLine("弧度为:")
bb = Convert.ToDouble(Console.ReadLine())
bb=huduzhi.B(bb)
Console.WriteLine("角度为: " + "{0:f4}", bb)
Console.ReadLine()
}
break
}
case "4":
{
jiaohui jiaohui = new jiaohui()
Console.WriteLine("请输入第一个控制点X坐标:")
jiaohui.XA =Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个控制点Y坐标:")
jiaohui.YA =Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点X坐标:")
jiaohui.XB =Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点Y坐标:")
jiaohui.YB = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个观测方位角(弧度制):")
jiaohui.QBAP = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个观测方位角(弧度制):")
jiaohui.QPBA = Convert.ToDouble(Console.ReadLine())
jiaohui.qianfang()
}
break
case "5":
{
julijiaohui julijiaohui = new julijiaohui()
Console.WriteLine("请输入第一个控制点X坐标:")
julijiaohui.XA = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个控制点Y坐标:")
julijiaohui.YA = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点X坐标:")
julijiaohui.XB = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制点Y坐标:")
julijiaohui.YB = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第一个控制点与待求点距离:")
julijiaohui.DAP = Convert.ToDouble(Console.ReadLine())
Console.WriteLine("请输入第二个控制与待求点距离:")
julijiaohui.DBP = Convert.ToDouble(Console.ReadLine())
julijiaohui.juli()
}
break
}
}
}
}
角度前方交会的计算公式如下:
上式虽然漂亮,但是并不适合于编写程序代码,因为角 A、B 可能会接近 0 或 180 度。编写程序时,可使用下式:
关于sign,它的取值为+1或-1,具体要求为:
当 A、B、P 的排列顺序与方位角的增加方向一致时,它取值为1;
当 A、B、P 的排列顺序与方位角的增加方向相反时,它取值为-1。
更具体的说,就是:
测量坐标系下,A、B、P 顺时针排列时,sign=1;A、B、P 逆时针排列时,sign=-1。
数学坐标系下,A、B、P 逆时针排列时,sign=1;A、B、P 顺时针排列时,sign=-1。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)