Sub Process_Globals
Dim MapCenter As GeoPoint
Dim ZoomLevel As Int
' create a List to store the path points in Activity_Pause
Dim PathPoints As List
End Sub
Sub Globals
Dim MapView1 As MapView
' create the PathOverlay
Dim PathOverlay1 As PathOverlay
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.AddMenuItem("Do something", "DoSomething")
MapView1.Initialize("MapView1")
Activity.AddView(MapView1, 0, 0, 100%x, 100%y)
MapView1.SetMultiTouchEnabled(True)
MapView1.SetZoomEnabled(True)
' initialize the PathOverlay and add it to the MapView, the path will be colored red
PathOverlay1.Initialize(MapView1, Colors.Black)
MapView1.AddOverlay(PathOverlay1)
' make the path 50% transparent (by default it is fully opaque)
PathOverlay1.Alpha=128
PathOverlay1.StrokeWidth=4
If FirstTime Then
PathPoints.Initialize
PathOverlay1.AddPoint(52.7788, 0.4710)
PathOverlay1.AddPoint(52.7543, 0.4482)
PathOverlay1.AddPoint(52.7373, 0.4170)
PathOverlay1.AddPoint(52.7599, 0.3970)
PathOverlay1.AddPoint(52.7709, 0.4062)
PathOverlay1.AddPoint(52.7788, 0.4710)
PathPoints=PathOverlay1.GetAllPoints
Log(PathPoints.Size) ' logs 6 points
' fit the map to the path
MapView1.FitMapToBoundingBox(PathOverlay1.GetBoundingBox)
Else
' restore map center and zoom level
MapView1.Zoom=ZoomLevel
MapView1.SetCenter3(MapCenter)
' restore the path points
PathOverlay1.AddPoints(PathPoints)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
MapCenter=MapView1.GetCenter
ZoomLevel=MapView1.Zoom
End Sub
Sub DoSomething_Click
' set the map center and zoom level so that it contains the entire path
MapView1.FitMapToBoundingBox(PathOverlay1.GetBoundingBox)
End Sub