常用测绘C#程序设计源代码.docx

上传人:b****3 文档编号:770910 上传时间:2022-10-12 格式:DOCX 页数:46 大小:142.77KB
下载 相关 举报
常用测绘C#程序设计源代码.docx_第1页
第1页 / 共46页
常用测绘C#程序设计源代码.docx_第2页
第2页 / 共46页
常用测绘C#程序设计源代码.docx_第3页
第3页 / 共46页
常用测绘C#程序设计源代码.docx_第4页
第4页 / 共46页
常用测绘C#程序设计源代码.docx_第5页
第5页 / 共46页
点击查看更多>>
下载资源
资源描述

常用测绘C#程序设计源代码.docx

《常用测绘C#程序设计源代码.docx》由会员分享,可在线阅读,更多相关《常用测绘C#程序设计源代码.docx(46页珍藏版)》请在冰豆网上搜索。

常用测绘C#程序设计源代码.docx

常用测绘C#程序设计源代码

常用测量程序设计

(1)用全站仪在A点观测了B点斜边和垂直角,求A到B的高差。

(提示:

,D--斜边,--垂直角,--仪器高,--反光镜高,--大气折光系数)

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Text;

namespaceConsoleApplication1

{

classApplication

{

staticvoidMain(string[]args)

{

Console.Write("请输入斜边=");

doubleD=double.Parse(Console.ReadLine());

Console.Write("请输入垂直角[ddd.mmss]=");

doublea=DEG(double.Parse(Console.ReadLine()));

Console.Write("请输入仪器高=");

doublei=double.Parse(Console.ReadLine());

Console.Write("请输入反光镜高=");

doublev=double.Parse(Console.ReadLine());

doubleh=D*Math.Sin(a)+(1-0.13)*D/6371000.0*D/6371000.0*Math.Cos(a)*Math.Cos(a)/2.0+i-v;

Console.WriteLine("高差为{0}",h);

}

//将ddd.mmss转为弧度

staticpublicdoubleDEG(doubleang)

{

intfuhao=(int)(ang/Math.Abs(ang));

ang=Math.Abs(ang);

intd=(int)ang;

intm=((int)(ang*100))-d*100;

doubles=ang*10000-m*100-d*10000;

return((d+m/60.0+s/3600.0)*fuhao)/180.0*Math.PI;

}

}

}

 

(2)如图所示,已知A点的坐标及A点到B点的边长及方位角,计算B点的坐标。

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Text;

namespaceConsoleApplication1

{

classApplication

{

staticvoidMain(string[]args)

{

Console.Write("请输入A点的X坐标=");

doubleXA=double.Parse(Console.ReadLine());

Console.Write("请输入A点的Y坐标=");

doubleYA=double.Parse(Console.ReadLine());

Console.Write("请输入A到B的方位角[ddd.mmss]=");

doublea=DEG(double.Parse(Console.ReadLine()));

Console.Write("请输入A到B的水平距离=");

doubleS=double.Parse(Console.ReadLine());

doubleXB=XA+S*Math.Cos(a);

doubleYB=YA+S*Math.Sin(a);

Console.WriteLine("B点的坐标({0},{1})",XB,YB);

}

//将ddd.mmss转为弧度

staticpublicdoubleDEG(doubleang)

{

intfuhao=(int)(ang/Math.Abs(ang));

ang=Math.Abs(ang);

intd=(int)ang;

intm=((int)(ang*100))-d*100;

doubles=ang*10000-m*100-d*10000;

return((d+m/60.0+s/3600.0)*fuhao)/180.0*Math.PI;

}

}

}

(3)如图所示,已知A点和B点的坐标,计算A点到的边长及方位角。

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Text;

namespaceConsoleApplication1

{

classApplication

{

staticvoidMain(string[]args)

{

Console.Write("请输入A点的X坐标=");

doubleXA=double.Parse(Console.ReadLine());

Console.Write("请输入A点的Y坐标=");

doubleYA=double.Parse(Console.ReadLine());

Console.Write("请输入B点的X坐标=");

doubleXB=double.Parse(Console.ReadLine());

Console.Write("请输入B点的Y坐标=");

doubleYB=double.Parse(Console.ReadLine());

doubleS=距离(XA,YA,XB,YB);

doublea=方位角(XA,YA,XB,YB);

Console.WriteLine("AB间的距离={0},从A到B的方位角={1}",S,DMS(a));

}

//将弧度转为ddd.mmss

staticpublicdoubleDMS(doubleang)

{

ang+=1.0E-15;//加上一个小量,以保证进位

intfuhao=(int)(ang/Math.Abs(ang));

ang=Math.Abs(ang)*180.0/Math.PI;

intd=(int)ang;

ang=(ang-d)*60.0;

intm=(int)ang;

doubles=(ang-m)*60.0;

return(d+m/100.0+s/10000.0)*fuhao;

}

//计算方位角,返回弧度值

publicstaticdouble方位角(doublex1,doubley1,doublex2,doubley2)

{

doubledeltaX=x2-x1;

doubledeltaY=y2-y1;

doubleangle=Math.PI*0.5;

if(Math.Abs(deltaX)>0.000000001)

{

angle=Math.Atan2(deltaY,deltaX);

}

if(angle<0)

{

angle+=Math.PI;

}

if(deltaY<0.0)

{

angle+=Math.PI;

}

returnangle;

}

//计算距离

publicstaticdouble距离(doublex1,doubley1,doublex2,doubley2)

{

returnMath.Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));

}

}

}

(4)在如图所示的支中导线,已知A点到M点的坐标方位角及每个左角,求每条边的坐标方位角。

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Text;

namespaceConsoleApplication1

{

classApplication

{

staticvoidMain(string[]args)

{

Console.Write("请输入A点到M点的坐标方位角=");

//将A点到M点的坐标方位角换算为M点到A点的坐标方位角,以便利用公式

doublea0=DEG(double.Parse(Console.ReadLine())+180.0);

if(a0>2*Math.PI)

{

a0-=2*Math.PI;

}

List导线转角集合=newList();

inti=1;

do

{

Console.Write("请输入第{0}个转角的水平角[左角为正,右角为负]<直接回车结束输入>=",i++);

stringstr=Console.ReadLine();

if(str!

="")

{

导线转角集合.Add(DEG(double.Parse(str)));

}

else

{

break;

}

}while(true);

i=1;

foreach(doubleain导线转角集合)

{

a0+=a+Math.PI;

if(a0>2*Math.PI)

{

a0-=2*Math.PI;

}

elseif(a0<0.0)

{

a0+=2*Math.PI;

}

Console.WriteLine("第{0}条边的方位角为{1}",i++,DMS(a0));

}

}

//将弧度转为ddd.mmss

staticpublicdoubleDMS(doubleang)

{

ang+=1.0E-15;//加上一个小量,以保证进位

intfuhao=(int)(ang/Math.Abs(ang));

ang=Math.Abs(ang)*180.0/Math.PI;

intd=(int)ang;

ang=(ang-d)*60.0;

intm=(int)ang;

doubles=(ang-m)*60.0;

return(d+m/100.0+s/10000.0)*fuhao;

}

//将ddd.mmss转为弧度

staticpublicdoubleDEG(doubleang)

{

intfuhao=(int)(ang/Math.Abs(ang));

ang=Math.Abs(ang);

intd=(int)ang;

intm=((int)(ang*100))-d*100;

doubles=ang*10000-m*100-d*10000;

return((d+m/60.0

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1