[转载]地形图分幅与编号程序(VB)

标签:
转载 |
分类: 图书馆 |
地形图分幅与编号程序(VB)
徐州师范大学测绘学院
基于数字测图原理与方法,本程序主要有两个模块组成,即由经纬度推算图幅编号,或由图幅编号推算经纬度,程序界面及运行情况如下所示:
http://s5/middle/63a7c6abna231432c9b14&690
运行结果:
http://s6/middle/63a7c6abna231432fc975&690
程序代码(VB):
Private Sub Command1_Click()
Dim j1 As Integer, j2 As Integer, j3 As Double, j As Double
Dim w1 As Integer, w2 As Integer, w3 As Double, w As Double
Dim a As Integer, astr As String
Dim b As Integer, bstr As String
Dim bili As String, daima As String, dj As Double, dw As
Double
Dim cmod As Double, dmod As Double
Dim c As Integer, d As Integer, dx As Double
If Text1(0) = "" Or Text1(1) = "" Or Text1(2) = "" Then
End If
If Text2(0) = "" Or Text2(1) = "" Or Text2(2) = "" Then
End If
j1 = Val(Text1(0).Text): j2 = Val(Text1(1).Text): j3 =
Val(Text1(2).Text)
w1 = Val(Text2(0).Text): w2 = Val(Text2(1).Text): w3 =
Val(Text2(2).Text)
j = j1 + j2 / 60 + j3 / 3600
w = w1 + w2 / 60 + w3 / 3600
If j > 180 Or j < 0 Then
End If
If w > 90 Or w < 0 Then
End If
a = Int(w1 / 4) + 1
b = Int(j1 / 6) + 31
astr = Chr(64 + a)
bstr = CStr(b)
Text3 = astr
Text4 = bstr
bili = Combo1.List(Combo1.ListIndex)
If bili = "" Then
End If
If bili = "1:100万" Then
ElseIf bili = "1:50万" Then
ElseIf bili = "1:25万" Then
ElseIf bili = "1:10万" Then
ElseIf bili = "1:5万" Then
ElseIf bili = "1:2.5万" Then
ElseIf bili = "1:1万" Then
ElseIf bili = "1:5000" Then
End If
cmod = (w / 4 - Int(w / 4)) * 4
dmod = (j / 6 - Int(j / 6)) * 6
cmod = cmod * 3600
dmod = dmod * 3600
c = 4 * 3600 / switch(dw) - (cmod switch(dw))
d = dmod switch(dj) + 1
Text5 = Format(c, "000")
Text6 = Format(d, "000")
Text7 = daima
Text8 = astr + bstr + daima + Format(c, "000") + Format(d,
"000")
End Sub
Private Sub
Command2_Click()
Dim bianhao As String
Dim astr As String, bstr As String
Dim a As Integer, b As Integer, jint As Integer, wint As
Integer
Dim c As Integer, d As Integer, daima As String, bili As
String
Dim dj As Double, dw As Double
Dim jnum As Double, wnum As Double
Dim j1 As Integer, j2 As Integer, j3 As Double
Dim w1 As Integer, w2 As Integer, w3 As Double
bianhao = Text9.Text
astr = Left(bianhao, 1)
bstr = Mid(bianhao, 2, 2)
If Asc(astr) > 86 Or Asc(astr) < 65
Then
End If
If Val(bstr) < 31 Then
End If
a = Asc(astr) - 64
b = Val(bstr)
daima = Mid(bianhao, 4, 1)
If Asc(daima) > 72 Or Asc(daima) < 65
Then
End If
wint = (a - 1) * 4
jint = (b - 31) * 6
If daima = "A" Then
ElseIf daima = "B" Then
ElseIf daima = "C" Then
ElseIf daima = "D" Then
ElseIf daima = "E" Then
ElseIf daima = "F" Then
ElseIf daima = "G" Then
ElseIf daima = "H" Then
End If
c = Mid(bianhao, 5, 3)
d = Right(bianhao, 3)
wnum = (4 * 3600 / switch(dw) - c) * switch(dw)
Call miaodu(wnum, w1, w2, w3)
Text11(0).Text = wint + w1
Text11(1).Text = w2
Text11(2).Text = Format(w3, "0.0")
jnum = (d - 1) * switch(dj)
Call miaodu(jnum, j1, j2, j3)
Text10(0).Text = jint + j1
Text10(1).Text = j2
Text10(2).Text = Format(j3, "0.0")
Text12.Text = bili
End Sub
Private Sub
Form_Load()
For i = 1 To 2
Next i
End Sub
Private Function
switch(ByVal x As Double) As Double
Dim a As Integer, b As Integer, c As Double
a = Fix(x)
b = Fix((x - a) * 100)
c = ((x - a) * 100 - b) * 100
switch = a * 3600 + b * 60 + c
End Function
Private Sub miaodu(x
As Double, a As Integer, b As Integer, c As Double)
a = x 3600
b = (x - a * 3600) 60
c = x - a * 3600 - b * 60
End Sub