Jump to content

 
Photo

Create Userform in ArcGIS

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Ohayo

Ohayo

    Contributor

  • Validated Member
  • PipPip
  • 14 posts
  • Thailand

Dear all,

Does anyone have a viable suggestion to solve my problem? First of all , I've doing sernior project about GIS software managment by use ArcGIS ( requirment from Profresser) My project is create easy tools for monitoring roughness of road (see an attached) and I 've already picture for each observation point feature ( .shp).Here are requir VB script
1.Play /Stop buttom
2.Query buttom
3.show picture while point running.

Concepture: Would to have tool for play picture 1,2,3.....end while point 1,2,3....appearing ,it seem like tracking animation but i don't wanna play by date
This tool is gonna show IRI value point ,point feature and Picture ( Frame ID) in 1 Frame( Userform) I will use Frame ID for primary Key , It's impossible?

As i know that API or AJAX or FLEX can be as well.

Thank you in advance for your kind help and kindness

Attached Files


Edited by Ohayo, 07 March 2010 - 02:31 AM.


#2
dsl

dsl

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 225 posts
  • Gender:Male
  • Location:Denver
  • United States

I'm still a bit confused about what you are trying to accomplish. This is what I am guessing:

You have a layer (shapefile) of roads, and a layer (shapefile?) of points where there is damage to the road or points where a photograph was taken.

On your form you will probably want a way for the user to select the layer for the roads, and the layer for the points, otherwise this will need to be hardcoded.

I'm also guessing you want the user to choose a road, push the play button then the "tool" shows the photo of the road at point x,y then after a few seconds pass, shows the next photo at point x,y?

I would suggest the path to the photograph is stored as an attribute in the point file.

When the user clicks play, get a feature cursor of the points, get the first point and the geometry coordinates, get the path to the image and display the image in image component. Use the zoomto option to zoom the display window to the point. Start a timer to run for 5-6 seconds and listen for the timer tick event (or something similar). When the timer tick event fires, move the cursor to the next feature and so on. Pause would stop the timer. Resume would restart the timer.

I don't know if that helps at all. This is a good place to start:
http://webhelp.esri....Sample_VBA_code

Here is an example of zooming.

This is an example of a timer in VBA with Excel, but should still be applicable.


#3
Ohayo

Ohayo

    Contributor

  • Validated Member
  • PipPip
  • 14 posts
  • Thailand

I am sorry that i made you confused , Actually, I am trying to import VB6 code to ArcGIS , it that mean I 've created VB and Form by used VB6 and I getting error when i run this code on ArcGIS , Do you have way for solve this code?

Here is my VB code ( Original)

Dim conn1 As ADODB.Connection
Dim rsdistress As ADODB.Recordset
Dim rsrutting As ADODB.Recordset
Dim rstexture As ADODB.Recordset
Dim rsrough As ADODB.Recordset

Dim picname As String
Dim picfolder As String
Dim picpath As String
'Declare Variables


Private Sub Command1_Click()
Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
Timer1.Enabled = False
End Sub


Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()


Set conn1 = New ADODB.Connection
Set rsdistress = New ADODB.Recordset
Set rsrutting = New ADODB.Recordset
Set rstexture = New ADODB.Recordset
Set rsrough = New ADODB.Recordset
'Declare Variables


conn1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\MotorWay\AccessDB\MotorWay.accdb;Persist Security Info=False;"
conn1.Open
' Set Connection to Database

sqldistress = "Select * from distress order by gid"
sqlrutting = "Select * from rutting order by gid"
sqltexture = "Select * from texture order by gid"
sqlrough = "Select * from rough order by gid"
'Query Data from Database Tables


rsdistress.Open sqldistress, conn1, adOpenDynamic, adLockOptimistic
rsrutting.Open sqlrutting, conn1, adOpenDynamic, adLockOptimistic
rstexture.Open sqltexture, conn1, adOpenDynamic, adLockOptimistic
rsrough.Open sqlrough, conn1, adOpenDynamic, adLockOptimistic
'Query Data from Database Tables


picfolder = "D:\Motorway\" & Mid(rsdistress("cs_id"), 1, 8) & "\thumbs\t_"
If Len(rsdistress("frameno")) = 3 Then
picname = "0" + rsdistress("frameno") + ".jpg"
Else
picname = rsdistress("frameno") + ".jpg"
End If
picpath = picfolder & picname
Picture1.Picture = LoadPicture(picpath)
Text1.Text = rsdistress("distance")
Text2.Text = rsrutting("rut_ave")
Text3.Text = rstexture("smtd_ave")
Text4.Text = rsrough("iri_ave")
'Display Data To TextBox



End Sub

Private Sub Timer1_Timer()

rsdistress.MoveNext
rsrutting.MoveNext
rstexture.MoveNext
rsrough.MoveNext

picfolder = "D:\Motorway\" & Mid(rsdistress("cs_id"), 1, 8) & "\thumbs\t_"
If Len(rsdistress("frameno")) = 3 Then
picname = "0" + rsdistress("frameno") + ".jpg"
Else
picname = rsdistress("frameno") + ".jpg"
End If
picpath = picfolder & picname
Picture1.Picture = LoadPicture(picpath)
Text1.Text = rsdistress("distance")
Text2.Text = rsrutting("rut_ave")
Text3.Text = rstexture("smtd_ave")
Text4.Text = rsrough("iri_ave")

'Refresh Data Every 2 seconds


End Sub


------------------------------------------------->
And this is code that I've collecting in ArcGIS


'' openShapeFileWorkspace
'' Note: location cannot be relative path ".\esridata\usa" it must be explicit pathname
''
Public Function openShapeFileWorkspace(Location As String) As IWorkspace

On Error GoTo EH

Dim pWS As IWorkspace
Dim pWorkspaceFactory As IWorkspaceFactory

Set openShapeFileWorkspace = Nothing

Set pWorkspaceFactory = New ShapefileWorkspaceFactory
Set pWS = pWorkspaceFactory.OpenFromFile(Location, 0)
Set openShapeFileWorkspace = pWS

Exit Function
EH:
MsgBox Err.Description, vbInformation, "openShapeFileWorkspace"
End Function

Private Sub CommandButton1_Click()
Timer1.Enabled = True
End Sub

Private Sub CommandButton2_Click()
Timer1.Enabled = False
End Sub

Private Sub CommandButton3_Click()
End
End Sub
Private Sub Form_Load()

Set conn = New ADODB.Connection
Set rsdistress = New ADODB.RecordSet
Set rsrutting = New ADODB.RecordSet
Set rstexture = New ADODB.RecordSet
Set rsrough = New ADODB.RecordSet
'Declare Variables


conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\MotorWay\AccessDB\MotorWay.accdb;Persist Security Info=False;"
conn.Open
' Set Connection to Database

sqldistress = "Select * from distress order by gid"
sqlrutting = "Select * from rutting order by gid"
sqltexture = "Select * from texture order by gid"
sqlrough = "Select * from rough order by gid"
'Query Data from Database Tables


rsdistress.Open sqldistress, conn1, adOpenDynamic, adLockOptimistic
rsrutting.Open sqlrutting, conn1, adOpenDynamic, adLockOptimistic
rstexture.Open sqltexture, conn1, adOpenDynamic, adLockOptimistic
rsrough.Open sqlrough, conn1, adOpenDynamic, adLockOptimistic
'Query Data from Database Tables


picfolder = "D:\Motorway\" & Mid(rsdistress("cs_id"), 1, 8) & "\thumbs\t_"
If Len(rsdistress("frameno")) = 3 Then
picname = "0" + rsdistress("frameno") + ".jpg"
Else
picname = rsdistress("frameno") + ".jpg"
End If
picpath = picfolder & picname
Picture1.Picture = LoadPicture(picpath)
Text1.Text = rsdistress("distance")
Text2.Text = rsrutting("rut_ave")
Text3.Text = rstexture("smtd_ave")
Text4.Text = rsrough("iri_ave")
'Display Data To TextBox



End Sub

Private Sub Timer1_Timer()

rsdistress.MoveNext
rsrutting.MoveNext
rstexture.MoveNext
rsrough.MoveNext

picfolder = "D:\Motorway\" & Mid(rsdistress("cs_id"), 1, 8) & "\thumbs\t_"
If Len(rsdistress("frameno")) = 3 Then
picname = "0" + rsdistress("frameno") + ".jpg"
Else
picname = rsdistress("frameno") + ".jpg"
End If
picpath = picfolder & picname
Picture1.Picture = LoadPicture(picpath)
Text1.Text = rsdistress("distance")
Text2.Text = rsrutting("rut_ave")
Text3.Text = rstexture("smtd_ave")
Text4.Text = rsrough("iri_ave")

'Refresh Data Every 2 seconds


End Sub

Private Sub UserForm_Click()

End Sub



Hopefully someone can help me pls.

Thanks you very much




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users

-->