Panning with SOAP controls
Another basic tool required by a GIS-based web application is the ability to move the map window over the SWD.
To allow panning in the four directions, add four buttons with these IDs:
- panNorthButton
- panEastButton
- panWestButton and
- panSouthButton.
TIP: Image Buttons will function in the same manner; this means you can use arrow icons instead of textual descriptions.
Double-click on each button in turn to create the event handler methods. Fill them in as below:
Copy
Private Sub panNorthButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles panNorthButton.Click
Dim ex As SisExtent = oSis.SplitExtent(oSis.GetViewExtent())
' Pan by half the screen height
Dim distance = (ex.max.y - ex.min.y) / 2
oSis.SetViewExtent(ex.min.x, ex.min.y + distance, ex.min.z, ex.max.x, ex.max.y + distance, ex.max.z)
RenderSis()
End Sub
Copy
Private Sub panEastButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles panEastButton.Click
Dim ex As SisExtent = oSis.SplitExtent(oSis.GetViewExtent())
' Pan by half the screen width
Dim distance = (ex.max.x - ex.min.x) / 2
oSis.SetViewExtent(ex.min.x + distance, ex.min.y, ex.min.z, ex.max.x + distance, ex.max.y, ex.max.z)
RenderSis()
End Sub
Copy
Private Sub panEastButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles panEastButton.Click
Dim ex As SisExtent = oSis.SplitExtent(oSis.GetViewExtent())
' Pan by half the screen width
Dim distance = (ex.max.x - ex.min.x) / 2
oSis.SetViewExtent(ex.min.x + distance, ex.min.y, ex.min.z, ex.max.x + distance, ex.max.y, ex.max.z)
RenderSis()
End Sub