Adding functionality

After creating a simple UI for your GisLink Addin, you can begin adding some functionality.

If you haven’t already, find or create your own SWD. You will need this to test your functions.

Add the following sub statement to your HelloWorld class.

Copy
Private Sub AddSomeData(ByVal sender As Object, ByVal e As SisClickArgs)

        'make an object from e.Desktop 
        SIS = e.Desktop

        'the first parameter provides a file path the second determines if the swd is 
        'is loaded as a editable or read only. 0 = editable 1 = read-only 
        SIS.SwdOpen("C:\your file path\yourSWD.swd", 0)

        'release the control over SIS 
        SIS.Dispose()
        SIS = Nothing

    End Sub
  • This will load the SWD as defined above into SIS but you need a way to run it.
  • Go back to the BigButton you created at the start.
  • The line of code where the button is defined should look like this:
Dim BigButton As SisRibbonButton = New SisRibbonButton("Big Button")
  • It needs a click handler; modify the line so that it looks like this:
Dim BigButton As SisRibbonButton = New SisRibbonButton("Big Button", 
New SisClickHandler(AddressOf AddSomeData))
  • Build and test in SIS Desktop (if you click BigButton SIS will automatically load your desired SWD).
  • Now add some functionality to the loaded SWD. This is a simple example but it should give you an idea of the kind of flexibility and power that GisLink addins can have.
  • Add the following sub statement to your HelloWorld class:
  • Copy
    Private Sub ExportImages(ByVal sender As Object, ByVal e As SisClickArgs)

            SIS = e.Desktop

            '              file path, resolution of the output image 
            SIS.ExportGif("c:\your path here\map.gif", 600, 400)
            SIS.ExportPng("c:\your path here\mapb.png", 1024, 1024)
            SIS.ExportJpeg("c:\your path here\mapd.jpg", 1024, 1024)

            SIS.Dispose()
            SIS = Nothing

        End Sub

Add the appropriate click handler to the drop-down menu you made earlier. Here is an example:

Dim ChildButton1 As SisRibbonButton = New SisRibbonButton("Child Button 1", 
New SisClickHandler(AddressOf ExportImages)