home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "vbStates"
- ClientHeight = 8355
- ClientLeft = 1770
- ClientTop = 675
- ClientWidth = 7530
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 700
- size = 18
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 8730
- Left = 1710
- LinkTopic = "Form1"
- ScaleHeight = 8355
- ScaleWidth = 7530
- Top = 360
- Width = 7650
- Begin VB.PictureBox Picture1
- AutoSize = -1 'True
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 1020
- Left = 5880
- Picture = "vbStates.frx":0000
- ScaleHeight = 960
- ScaleWidth = 1500
- TabIndex = 7
- Top = 120
- Width = 1560
- End
- Begin VB.CommandButton Command4
- Caption = "Edit Light"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 3960
- TabIndex = 5
- Top = 840
- Width = 1692
- End
- Begin VB.CommandButton thumb
- Caption = "Thumbwheels On"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 1920
- TabIndex = 4
- Top = 840
- Width = 1572
- End
- Begin VB.CommandButton Command3
- Caption = "Reset"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 5520
- TabIndex = 3
- Top = 5280
- Width = 1692
- End
- Begin VB.CommandButton Command2
- Caption = "Day 2"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 2760
- TabIndex = 2
- Top = 5280
- Width = 1692
- End
- Begin VB.CommandButton Command1
- Caption = "Day 1"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 400
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 120
- TabIndex = 1
- Top = 5280
- Width = 1692
- End
- Begin VB.Label Label6
- Caption = "San Diego, California 92121"
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 2280
- TabIndex = 12
- Top = 7560
- Width = 2892
- End
- Begin VB.Label Label5
- Caption = "9920 Pacific Heights Blvd, Suite 200"
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 252
- Left = 2040
- TabIndex = 11
- Top = 7200
- Width = 3612
- End
- Begin VB.Label Label4
- Alignment = 2 'Center
- AutoSize = -1 'True
- Caption = "http://www.tgs.com"
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 264
- Left = 2760
- TabIndex = 10
- Top = 6480
- Width = 1884
- End
- Begin VB.Label Label3
- Alignment = 2 'Center
- Caption = "Template Graphics Software, Inc."
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 700
- size = 16.5
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 492
- Left = 1320
- TabIndex = 9
- Top = 6720
- Width = 4932
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- Caption = "For more information on this control and other TGS 3D/VRML desktop applications, contact:"
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 400
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 732
- Left = 480
- TabIndex = 8
- Top = 5880
- Width = 6972
- End
- Begin VB.Label Label1
- Caption = "Web Hits By State"
- BeginProperty Font
- name = "Times New Roman"
- charset = 0
- weight = 700
- size = 24
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 612
- Left = 240
- TabIndex = 6
- Top = 120
- Width = 4332
- End
- Begin TgsVisual3SpaceLibCtl.V3Space V3Space1
- Height = 3732
- Left = 0
- TabIndex = 0
- Top = 1440
- Width = 7572
- _Version = 131072
- _ExtentX = 13356
- _ExtentY = 6583
- _StockProps = 0
- decorationOn = 0 'False
- text3dBlue = 0
- text3dSpeedX = 0
- text3dSpeedZ = 0
- url = "examples\vb\vbStates2.0/models/usamap.wrl"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Const SCALE_MAX = 2#
- Dim aSensorCB
- Dim aSensor
- Dim states(50)
- Dim stateIndex
- Dim stopIndex
- Dim myReset
- Private Sub Command1_Click()
- OnDay1
- End Sub
- Private Sub Command2_Click()
- OnDay2
- End Sub
- Private Sub Command3_Click()
- OnReset
- End Sub
- Private Sub Command4_Click()
- Call V3Space1.EditHeadlight
- End Sub
- Private Sub Form_Load()
- On Error Resume Next
- Call InitStates
- Dim idisp
- Set idisp = V3Space1.GetIDispatch()
- Set aSensorCB = New SoSensorCB
- 'sensor=0,alarm=1,timer=2,idle=3,oneShot=4,field=5,node=6,path=7
- aSensorCB.sensorType = 3
- Set aSensor = New SoIdleSensor
- Call aSensor.setFunction(idisp, aSensorCB)
- idisp = Null
- myReset = False
- Call V3Space1.Play("examples\vb\vbStates2.0\models\vbstates.wav", 4)
- End Sub
- Public Sub SetStateHeight(stateStr, newValue)
- On Error Resume Next
- Dim numFields
- Dim coord
- Dim vec3f
- Dim aState
- Dim theValue
- Dim theStates
- theValue = newValue / SCALE_MAX
- Set theStates = V3Space1.getSceneRoot()
- Set aState = theStates.getByName(stateStr)
- 'Get the top of the state
- Dim Top
- Set Top = aState.getChild(2)
- 'Get the Coordinates for the top
- Set coord = Top.getChild(1)
- numFields = coord.Point.getNum()
- 'Loop through the Coordinates
- Dim i
- Dim X
- Dim Y
- Dim Z
- For i = numFields - 1 To 0 Step -1
- Set vec3f = coord.Point.getAt(i)
- 'Call vec3f.getValue(X, Y, Z)
- X = vec3f.getX()
- Z = vec3f.getZ()
- Call coord.Point.set1Value(i, X, theValue, Z)
- Set vec3f = Nothing
- Next i
- 'Clean Up
- Set coord = Nothing
- numFields = 0
- 'Set the size of the walls
- Dim walls
- Set walls = aState.getChild(3)
- Set coord = walls.getChild(1)
- numFields = coord.Point.getNum()
- For i = numFields - 1 To (numFields / 2) Step -1
- Set vec3f = coord.Point.getAt(i)
- 'Call vec3f.getValue(X, Y, Z)
- X = vec3f.getX()
- Z = vec3f.getZ()
- Call coord.Point.set1Value(i, X, theValue, Z)
- Set vec3f = Nothing
- Next i
- Set aState = Nothing
- Set theStates = Nothing
- End Sub
- Public Sub InitStates()
-
- On Error Resume Next
- states(1) = "ALABAMA"
- states(2) = "ARKANSAS"
- states(3) = "CONNECTICUT"
- states(4) = "DELAWARE"
- states(5) = "FLORIDA"
- states(6) = "GEORGIA"
- states(7) = "ILLINOIS"
- states(8) = "INDIANA"
- states(9) = "IOWA"
- states(10) = "KENTUCKY"
- '11
- states(11) = "LOUISIANA"
- states(12) = "MAINE"
- states(13) = "MARYLAND"
- states(14) = "MASSACHUSETTS"
- states(15) = "MICHIGAN"
- states(16) = "MICHIGAN_UPPER"
- states(17) = "MINNESOTA"
- states(18) = "MISSISSIPPI"
- states(19) = "MISSOURI"
- states(20) = "NEW_HAMPSHIRE"
- '21
- states(21) = "NEW_JERSEY"
- states(22) = "NEW_YORK"
- states(23) = "LONG_ISLAND"
- states(24) = "NORTH_CAROLINA"
- states(25) = "OHIO"
- states(26) = "PENNSYLVANIA"
- states(27) = "RHODE_ISLAND"
- states(28) = "SOUTH_CAROLINA"
- states(29) = "TENNESSEE"
- states(30) = "VERMONT"
- '31
- states(31) = "VIRGINIA"
- states(32) = "WEST_VIRGINIA"
- states(33) = "WISCONSIN"
- '34
- states(34) = "WYOMING"
- states(35) = "ARIZONA"
- states(36) = "CALIFORNIA"
- states(37) = "COLORADO"
- states(38) = "IDAHO"
- states(39) = "KANSAS"
- states(40) = "MONTANA"
- states(41) = "NEBRASKA"
- states(42) = "NEVADA"
- '43
- states(43) = "NEW_MEXICO"
- states(44) = "NORTH_DAKOTA"
- states(45) = "OKLAHOMA"
- states(46) = "OREGON"
- states(47) = "SOUTH_DAKOTA"
- states(48) = "TEXAS"
- states(49) = "UTAH"
- states(50) = "WASHINGTON"
- End Sub
- Public Sub OnDay1()
- On Error Resume Next
- If aSensor.isScheduled() = 1 Then
- Call aSensor.unschedule
- End If
- Call V3Space1.Play("", -1)
- Call V3Space1.Play("examples\vb\vbStates2.0\models\day1.wav", 4)
- stateIndex = 1
- stopIndex = 33
- 'window.status = "Computing Hits by State..."
- myReset = False
- Call aSensor.schedule
- End Sub
- Public Sub OnDay2()
- On Error Resume Next
- If aSensor.isScheduled = 1 Then
- Call aSensor.unschedule
- End If
-
- Call V3Space1.Play("examples\vb\vbStates2.0\models/day2.wav", 4)
- stateIndex = 34
- stopIndex = 50
- 'window.status = "Computing Hits by State..."
- myReset = False
- Call aSensor.schedule
- End Sub
- Public Sub OnReset()
- On Error Resume Next
- If aSensor.isScheduled Then
- Call aSensor.unschedule
- End If
- myReset = True
- stateIndex = 1
- stopIndex = 50
- 'window.status = "Reseting..."
- Call aSensor.schedule
- End Sub
- Public Sub thumbs()
- If V3Space1.decorationOn = True Then
- thumb.Caption = "Thumbwheels On"
- V3Space1.decorationOn = False
- Else
- V3Space1.decorationOn = True
- thumb.Caption = "Thumbwheels Off"
- End If
- End Sub
- Private Sub Form_Terminate()
- On Error Resume Next
- If aSensor.isScheduled() = 1 Then
- Call aSensor.unschedule
- End If
- Set aSensorCB = Nothing
- Set aSensor = Nothing
- Call V3Space1.Play("", -1)
- Call V3Space1.deleteSceneGraph
- End Sub
- Private Sub thumbs_Click()
- thumbs
- End Sub
- Private Sub thumb_Click()
- thumbs
- End Sub
- Private Sub V3Space1_IdleSensor(ByVal sensorCB As Object, ByVal sensor As Object)
- On Error Resume Next
- If (myReset) Then
- If (stateIndex <= stopIndex) Then
- Call SetStateHeight(states(stateIndex), 0)
- stateIndex = stateIndex + 1
- Call aSensor.schedule
- Else
- 'window.status = "Done."
- myReset = False
- End If
- Exit Sub
- End If
- If stateIndex <= stopIndex Then
- If stateIndex <= 33 Then
- Call SetStateHeight(states(stateIndex), Rnd + 0.3)
- Else
- Call SetStateHeight(states(stateIndex), Rnd + 1#)
- End If
- stateIndex = stateIndex + 1
- Call aSensor.schedule
- Else
- 'window.status = "Done."
- End If
- End Sub
-