(12) 1
1. Visual Basic Private Sub LoadDatabase() Dim strip As String Dim straccount As String Dim strpassword As String Dim strdatabase As String Dim strtable As String Dim strsql As String Dim strtemp1 As String Dim index1 As Integer Dim index2 As Integer Dim index3 As Integer Dim i As Integer Dim sname As String Dim x As Double Dim y As Double Dim z As Double Dim size As Double Dim color As Long Dim data As String Dim olddata As Collection On Local Error GoTo errout Set olddata = m_data Set m_data = New Collection strip = GetSetting("3D_Tunnel_Display_System", "DatabaseConfig", "txtip") straccount = GetSetting("3D_Tunnel_Display_System", "DatabaseConfig", "txtaccount") strpassword = GetSetting("3D_Tunnel_Display_System", "DatabaseConfig", "txtpassword") strdatabase = GetSetting("3D_Tunnel_Display_System", "DatabaseConfig", "txtdatabase") strtable = GetSetting("3D_Tunnel_Display_System", "DatabaseConfig", "txttable") Set mycon = New ADODB.Connection mycon.connectionstring = "driver={sql Server};" & _ "server=" & strip & ";" & _ "uid=" & straccount & ";" & _ "pwd=" & strpassword & ";" & _ "database=" & strdatabase mycon.connectiontimeout = 30 mycon.open strsql = "select * from " & strtable Set myrs = mycon.execute(strsql) While Not myrs.eof x = val(myrs("x").value) y = val(myrs("y").value) z = val(myrs("z").value) index1 = val(myrs("timeid").value) index2 = val(myrs("mileid").value) index3 = val(myrs("markid").value) myoridatax(index1, index2, index3) = x myoridatay(index1, index2, index3) = y myoridataz(index1, index2, index3) = z intnotime = index1 intnomile = index2 'set defaults i = i + 1 size = 0.2 color = D3DCOLORVALUEtoLONG(ColorValue4(0.4, CSng(BallR(0) / 255#), CSng(BallG(0) / 255#), CSng(BallB(0) / 255#))) data = "" sname = "1" If index1 = 1 Then AddEntry sname, x, y, z, size, color, data Else 2
' tempx = (myoridatax(index1, index2, index3) - myoridatax(1, index2, index3)) * EScaleX tempy = (myoridatay(index1, index2, index3) - myoridatay(1, index2, index3)) * EScaleY tempz = (myoridataz(index1, index2, index3) - myoridataz(1, index2, index3)) * EScaleZ ' tempx = tempz + myoridatax(1, index2, index3) tempy = tempy + myoridatay(1, index2, index3) tempz = tempz + myoridataz(1, index2, index3) ' mypx(index1, index2, index3) = (tempx + myoridatax(1, index2, index3)) / 2 mypy(index1, index2, index3) = (tempy + myoridatay(1, index2, index3)) / 2 mypz(index1, index2, index3) = (tempz + myoridataz(1, index2, index3)) / 2 size = (mypx(index1, index2, index3) - tempx) ^ 2 + (mypy(index1, index2, index3) - tempy) ^ 2 + (mypz(index1, index2, index3) - tempz) ^ 2 size = Sqr(size) color = D3DCOLORVALUEtoLONG(ColorValue4(0.4, CSng(BallR(9) / 255#), CSng(BallG(9) / 255#), CSng(BallB(9) / 255#))) color = D3DCOLORVALUEtoLONG(ColorValue4(0.4, 1, 0, 0)) x = mypx(index1, index2, index3) y = mypy(index1, index2, index3) z = mypz(index1, index2, index3) ' AddEntry sname, x, y, z, size * 0.1, color, data End If myrs.movenext Wend Set m_graphroot = Nothing Set m_quad1 = Nothing Set m_quad2 = Nothing Set m_xzplaneframe = Nothing ComputeDataExtents BuildGraph RestoreDeviceObjects Set olddata = Nothing Set myrs = Nothing Exit Sub errout: Set m_data = olddata MsgBox Err.Description, vbcritical, " " Set myrs = Nothing End Sub 3
91 10 92 10 1. 2. 3. 4. 5. 6. 1. 1. Window 98/ME, Window NT 4.0, Window 2000 2. Visual Basic 6.0 DirectX 8.1 3. Microsoft SQL Server 2000 Window Visual Basic 6.0 DirectX 8.1 DirectX DirectX API 3D 1 4
(1) (2) (3) (4) (5) 1 (1) 2 2 SQL Server IP Domain Name SQL Server 5
SQL Server (2) 3 CSV Excel CSV Excel 3 (3) 4 6
4 X X 1 1000 Y Y 1 1000 Z Z 1 1000 5 10 5 10 (1) (2) (3) 10 10 5 7
5 6 6 7 6 8
(1) (2) 7 (1) (2) (4) (5) 8 8 Ctrl+w 9 Ctrl+w 9
(1) (2) (3) (4) 9 Ctrl+w Ctrl+s 5-17 Ctrl+s (1) (2) 10
(3) (4) 10 Ctrl+s Ctrl+q 11 Ctrl+q (1) 11 Ctrl+q (2) Ctrl+e 12 Ctrl+e (1) 12 Ctrl+e (2) Ctrl+z 13 11
(1) 13 Ctrl+z (2) Ctrl+a 14 Ctrl+a (1) 14 Ctrl+a (2) 15 (1) (2) 12
(3) (4) 15 16 16 17 17 13