📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "x y z <> b l h"
ClientHeight = 5640
ClientLeft = 60
ClientTop = 450
ClientWidth = 10935
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 5640
ScaleWidth = 10935
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "确定"
Height = 615
Left = 5160
TabIndex = 24
Top = 3600
Width = 1455
End
Begin VB.TextBox Text10
Height = 615
Left = 1440
TabIndex = 23
Top = 3600
Width = 2895
End
Begin VB.TextBox Text9
Height = 495
Left = 5160
TabIndex = 20
Top = 2760
Width = 2895
End
Begin VB.TextBox Text8
Height = 495
Left = 3240
TabIndex = 18
Top = 2760
Width = 735
End
Begin VB.TextBox Text7
Height = 495
Left = 1320
TabIndex = 16
Top = 2760
Width = 735
End
Begin VB.TextBox Text6
Height = 495
Left = 5160
TabIndex = 13
Top = 2040
Width = 2775
End
Begin VB.TextBox Text5
Height = 495
Left = 3240
TabIndex = 11
Top = 2040
Width = 735
End
Begin VB.TextBox Text4
Height = 495
Left = 1320
TabIndex = 9
Top = 2040
Width = 735
End
Begin VB.TextBox Text3
Height = 495
Left = 6840
TabIndex = 6
Top = 240
Width = 2295
End
Begin VB.TextBox Text2
Height = 495
Left = 4200
TabIndex = 4
Top = 240
Width = 2175
End
Begin VB.TextBox Text1
Height = 495
Left = 1680
TabIndex = 1
Top = 240
Width = 2175
End
Begin VB.Label Label14
Caption = " h"
Height = 615
Left = 120
TabIndex = 22
Top = 3600
Width = 855
End
Begin VB.Label Label13
Caption = " 秒"
Height = 495
Left = 8280
TabIndex = 21
Top = 3000
Width = 855
End
Begin VB.Label Label12
Caption = " 分"
Height = 495
Left = 4200
TabIndex = 19
Top = 2760
Width = 855
End
Begin VB.Label Label11
Caption = " 度"
Height = 495
Left = 2160
TabIndex = 17
Top = 2760
Width = 735
End
Begin VB.Label Label10
Caption = " l"
Height = 615
Left = 0
TabIndex = 15
Top = 2760
Width = 975
End
Begin VB.Label Label9
Caption = " 秒"
Height = 495
Left = 8280
TabIndex = 14
Top = 2040
Width = 735
End
Begin VB.Label Label8
Caption = " 分"
Height = 495
Left = 4200
TabIndex = 12
Top = 2040
Width = 735
End
Begin VB.Label Label7
Caption = " 度"
Height = 495
Left = 2280
TabIndex = 10
Top = 2040
Width = 615
End
Begin VB.Label Label6
Caption = " b"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 8
Top = 2040
Width = 735
End
Begin VB.Label Label5
Caption = "b l h 坐标"
Height = 615
Left = 0
TabIndex = 7
Top = 1200
Width = 1575
End
Begin VB.Line Line1
X1 = 0
X2 = 9000
Y1 = 1080
Y2 = 1080
End
Begin VB.Label Label4
Caption = " z "
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6360
TabIndex = 5
Top = 240
Width = 735
End
Begin VB.Label Label3
Caption = " y "
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3600
TabIndex = 3
Top = 240
Width = 615
End
Begin VB.Label Label2
Caption = " x"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1320
TabIndex = 2
Top = 240
Width = 495
End
Begin VB.Label Label1
Caption = "x y z 坐标"
Height = 615
Left = 120
TabIndex = 0
Top = 0
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a As Double, e2 As Double, e12 As Double, b As Double, l As Double, h As Double, x As Double, y As Double, z As Double, n As Double
Private Sub Command1_Click()
'a = 6378245
'e2 = 6.69342162296595E-03
'e12 = 6.73852541468397E-03
a = 6378140
e2 = 6.69438499958795E-03
e12 = 6.73950181947293E-03
If Text1.Text = "" And Text3.Text = "" And Text6.Text = "" And Text9.Text = "" Then
MsgBox ("请输入数据")
Exit Sub
ElseIf Text1.Text = "" And Text2.Text = "" And Text3.Text = "" Then
b = 0: l = 0: h = 0: x = 0: y = 0: z = 0: n = 0
b = f(Val(Text4.Text), Val(Text5.Text), Val(Text6.Text))
l = f(Val(Text7.Text), Val(Text8.Text), Val(Text9.Text))
h = Val(Text10.Text)
n = a / (Sqr(1 - e2 * (Sin(b)) ^ 2))
x = (n + h) * Cos(b) * Cos(l)
y = (n + h) * Cos(b) * Sin(l)
z = (n * (1 - e2) + h) * Sin(b)
Text1.Text = x
Text2.Text = y
Text3.Text = z
ElseIf Text4.Text = "" Or Text6.Text = "" Or Text9.Text = "" Then
b = 0: l = 0: h = 0: x = 0: y = 0: z = 0: n = 0
Dim b0 As Double, tb As Double, p As Double
x = Val(Text1.Text): y = Val(Text2.Text): z = Val(Text3.Text)
l = Atn(y / x)
If l < 0 Then
l = l + 3.14159265358979
End If
b0 = Atn(z / (Sqr(x ^ 2 + y ^ 2)))
For i = 0 To 1E+17
tb = (1 / Sqr(x ^ 2 + y ^ 2)) * (z + e2 * a * Sin(b0) / (Sqr(1 - e2 * (Sin(b0)) ^ 2)))
If Abs(Atn(tb) - b0) < 0.00000000001 Then
GoTo r
Else
b0 = Atn(tb)
End If
Next i
r: b = Atn(tb)
n = a / Sqr(1 - e2 * (Sin(b)) ^ 2)
h = z / Sin(b) - n * (1 - e2)
j = 0: o = 0: p = 0
j = Fix(b / 3.14159265358979 * 180)
o = Fix((b / 3.14159265358979 * 180 - Fix(b / 3.14159265358979 * 180)) * 60)
p = (b / 3.14159265358979 * 180 * 60 - Fix(b / 3.14159265358979 * 180 * 60)) * 60
Text4.Text = j
Text5.Text = o
Text6.Text = p
j = 0: o = 0: p = 0
j = Fix(l / 3.14159265358979 * 180)
o = Fix((l / 3.14159265358979 * 180 - Fix(l / 3.14159265358979 * 180)) * 60)
p = (l / 3.14159265358979 * 180 * 60 - Fix(l / 3.14159265358979 * 180 * 60)) * 60
Text7.Text = j
Text8.Text = o
Text9.Text = p
Text10.Text = h
End If
End Sub
Public Function f(a As Double, b As Double, c As Double) As Double
f = (a / 180 + b / 60 / 180 + c / 60 / 60 / 180) * 3.14159265358979
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -