土木在线论坛 \ 水利工程 \ 水利软件 \ 大地坐标与工程坐标的相互转换程序

大地坐标与工程坐标的相互转换程序

发布于:2004-07-01 22:09:01 来自:水利工程/水利软件 [复制转发]

Public x_dadi_o As Double, y_dadi_o As Double, x_daba_o As Double, y_daba_o As Double, j_fangweijiao As Double
Public x_dadi_p As Double, y_dadi_p As Double, x_daba_p As Double, y_daba_p As Double

Private Sub Command1_Click()

Call annony_



End Sub

Private Sub Command2_Click()
Text6.Text = ""
Text7.Text = "": Text8.Text = "": Text9.Text = "": Option1.Value = False: Option2.Value = False
Exit Sub
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Command4_Click()
If (Text1.Text = "" Or Text2.Text = "") Or (Text3.Text = "" Or Text4.Text = "") Or (Text5.Text = "" And Text10.Text = "" And Text11.Text = "" And Text12.Text = "") Then
MsgBox "请输入基本参数!", vbOKOnly, "提示"
Exit Sub
End If

x_dadi_o = Val(Text1.Text): y_dadi_o = Val(Text2.Text): x_daba_o = Val(Text3.Text): y_daba_o = Val(Text4.Text)
If Text5.Text = "" Then
j_fangweijiao = (Val(Text10.Text) + Val(Text11.Text) / 60 + Val(Text12.Text) / 3600) * 3.1415926 / 180
Else
j_fangweijiao = Val(Text5.Text) * 3.1415926 / 180
End If
If (Option1.Value = False And Option2.Value = False) Then
MsgBox "请选择计算类型!", vbOKOnly, "提示"
Exit Sub
End If

End Sub

Private Sub Command5_Click()
Text1.Text = "": Text2.Text = "": Text3.Text = "": Text4.Text = "": Text5.Text = "": Text10.Text = "": Text11.Text = "": Text12.Text = ""
End Sub

Private Sub Option1_Click()
If Option1.Value = True Then
Text6.Text = "": Text7.Text = "": Text8.Text = "": Text9.Text = ""
Text6.SetFocus
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Text6.Text = "": Text7.Text = "": Text8.Text = "": Text9.Text = ""
End If
Text8.SetFocus
End Sub

Sub annony_()


If (Option1.Value = False And Option2.Value = False) Then
MsgBox "请选择计算类型!", vbOKOnly, "提示"
Exit Sub
End If


If Option2.Value = True Then
If (Text8.Text = "" And Text9.Text = "") Then
MsgBox "请输入已知点P的大坝坐标值!", vbOKOnly, "提示"
Exit Sub
End If

x_daba_p = Val(Text8.Text): y_daba_p = Val(Text9.Text)
dx = x_daba_p - x_daba_o
dy = y_daba_p - y_daba_o

x_dadi_p = x_dadi_o + dx * Cos(j_fangweijiao) - dy * Sin(j_fangweijiao)
y_dadi_p = y_dadi_o + dx * Sin(j_fangweijiao) + dy * Cos(j_fangweijiao)
Text6.Text = Str(Int(x_dadi_p * 1000) * 0.001)
Text7.Text = Str(Int(y_dadi_p * 1000) * 0.001)

ElseIf Option1.Value = True Then

If (Text6.Text = "" And Text7.Text = "") Then
MsgBox "请输入已知点P的大地坐标值!", vbOKOnly, "提示"
Exit Sub
End If

x_dadi_p = Val(Text6.Text): y_dadi_p = Val(Text7.Text)
dx = x_dadi_p - x_dadi_o
dy = y_dadi_p - y_dadi_o

x_daba_p = x_daba_o + dx * Cos(j_fangweijiao) + dy * Sin(j_fangweijiao)
y_daba_p = y_daba_o - dx * Sin(j_fangweijiao) + dy * Cos(j_fangweijiao)
Text8.Text = Str(Int(x_daba_p * 1000) * 0.001)
Text9.Text = Str(Int(y_daba_p * 1000) * 0.001)
End If
End Sub

全部回复(6 )

只看楼主 我来说两句
  • cdut2003@sl
    cdut2003@sl 沙发
    vb啊?
    2004-07-13 16:41:13

    回复 举报
    赞同0
  • cddk
    cddk 板凳
    怎么转换呀?
    2004-07-13 16:27:13

    回复 举报
    赞同0
加载更多
这个家伙什么也没有留下。。。

水利软件

返回版块

13.32 万条内容 · 188 人订阅

猜你喜欢

阅读下一篇

[转帖]个人电脑时代已近尾声

个人电脑时代快要落幕了,随后是网络计算服务的时代。雅虎宣布将其收费邮箱的空间扩大至2G,以对应搜索引擎巨头Google前期宣布的将推出空间达1G的免费邮箱。国内的网站也纷纷开始对邮箱进行扩容,这件事情没有更大张旗鼓的原因是,现在免费邮箱比前期推出的收费邮箱空间更大这一奇怪的逻辑还没有理顺。如果我们将大量的文档保留在网站的服务器上,好处是在任何一个可以上网的地点都可以查询和修改这些文档,那么个人电脑硬件的地位就下降了。

回帖成功

经验值 +10