#Region Project Attributes
#ApplicationLabel: GoogleMapsPanorama
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalRes: c:\android\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Dim LastMapCenter As LatLng
Dim LastMapZoom As Int
End Sub
Sub Globals
Dim GoogleMap1 As GoogleMap
Dim MapFragment1 As MapFragment
Dim MapPanel As Panel
Dim TileOverlay1 As TileOverlay
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Google Play services not available.", True)
Else
If FirstTime Then
LastMapCenter.Initialize(40.6443475,2.6305006)
LastMapZoom=0
End If
MapFragment1.Initialize("MapFragment1", MapPanel)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
LastMapCenter=MapFragment1.GetMap.CameraPosition.Target
LastMapZoom=MapFragment1.GetMap.CameraPosition.Zoom
End Sub
Sub MapFragment1_Ready
Log("MapFragment1_Ready")
GoogleMap1 = MapFragment1.GetMap
If GoogleMap1.IsInitialized = False Then
ToastMessageShow("Error initializing map.", True)
Else
' set the map-type to none
' we do not want to load any of the built in tile sources
'GoogleMap1.MapType=GoogleMap1.MAP_TYPE_NONE
GoogleMap1.MapType=GoogleMap1.MAP_TYPE_NORMAL
Dim GoogleMapsExtras1 As GoogleMapsExtras
Dim TileOverlayOptions1 As TileOverlayOptions
Dim UrlTileProvider1 As UrlTileProvider
' Url parameters are %1$d tileX, %2$d tileY, %3$d zoom
' my panorama tiles are all in a single directory and are named: <zoom>_<tileX>x<tileY>.jpg
UrlTileProvider1.Initialize("http://162.221.184.24/tmp/wormegay_river_nar/%3$d_%1$dx%2$d.jpg", 256, 256)
TileOverlayOptions1.Initialize
TileOverlayOptions1.SetTileProvider(UrlTileProvider1)
TileOverlay1=GoogleMapsExtras1.AddTileOverlay(GoogleMap1, TileOverlayOptions1)
Dim Marker1 As Marker
Marker1=GoogleMap1.AddMarker(40.6443475,2.0305006, "casa")
Marker1=GoogleMap1.AddMarker(40.6443475,2.0805006, "1")
Dim CameraPosition1 As CameraPosition
' CameraPosition1.Initialize(LastMapCenter.Latitude, LastMapCenter.Longitude, LastMapZoom)
CameraPosition1.Initialize(41.6443475,2.7305006, 15)
GoogleMap1.AnimateCamera(CameraPosition1)
'evento despues de click a home location buton
Dim OnMyLocationButtonClickListener1 As OnMyLocationButtonClickListener
OnMyLocationButtonClickListener1.Initialize("OnMyLocationButtonClickListener1")
GoogleMapsExtras1.SetOnMyLocationButtonClickListener(GoogleMap1,OnMyLocationButtonClickListener1)
GoogleMap1.MyLocationEnabled=True
GoogleMap1.GetUiSettings.CompassEnabled=True
End If
End Sub
Sub OnMyLocationButtonClickListener1_Click
Log("clicked")
End Sub