Sub Process_Globals
Private PageShowAirfieldsMap As Page
Private gMap As GoogleMap
Private gMapsExtra As GoogleMapsExtra
End Sub
Public Sub Show(Query As String,Graphic As String, Lat As Double,Lon as Double)
If PageShowAirfieldsMap.IsInitialized = False Then
PageShowAirfieldsMap.Initialize("PageShowAirfieldsMap")
gMap.Initialize("gMap", Main.APIkey)
gMapsExtra.Initialize(gMap)
PageShowAirfieldsMap.RootPanel.AddView(gMap,0,0,100%x,100%y)
End If
Dim Bm As Bitmap = LoadBitmapResize(File.DirAssets,Graphic,30,30,True)
gMap.Clear
Main.NavControl.ShowPage(PageShowAirfieldsMap)
Private Locations As ResultSet
Locations = Main.SQL.ExecQuery(Query)
Dim ThisLat, ThisLong As Double
Dim Points As List
Points.Initialize
Do While Locations.NextRow
ThisLat = Locations.GetDouble("Lat")
ThisLong = Locations.GetDouble("Long")
Dim ThisPosition As LatLng
ThisPosition.Initialize(ThisLat,ThisLong)
Points.Add(ThisPosition)
gMap.AddMarker3(ThisLat,ThisLong, Locations.GetString("Name"),Bm)
Loop
If Points.Size = 1 Then 'Deal with the zoom
Dim cpos As CameraPosition
cpos.Initialize(Lat,Lon,14) 'Frame a single location only - Zoom 14
gMap.AnimateCamera(cpos)
Else
gMapsExtra.ZoomToPoints(Points) 'Frame multiple positions
'Only works after 2nd & subsequent page calls
End If
End Sub