Files
Intmex_Reparto_Vieja/MAPA_CLIENTE.bas

128 lines
3.3 KiB
QBasic

B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=9.95
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: FALSE
#End Region
Sub Process_Globals
Dim GPS As GPS
Dim rp As RuntimePermissions
Dim ruta As String
Dim skmt As SQL
End Sub
Sub Globals
Private gmap As GoogleMap
Private MapFragment1 As MapFragment
Dim Latitud As Double = 0
Dim Longitud As Double = 0
Dim Lat2 As Double = 0
Dim Lon2 As Double = 0
Dim p1, p2 As Location
Dim Distance As Float
Dim boton1 As Button
Dim c As Cursor
Dim latmarker As String
Dim longmarker As String
Private l_long As Label
Private l_lat As Label
Private NOMBRE_TIENDA As String
Private p_principal As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("mapa_cliente")
If MapFragment1.IsGooglePlayServicesAvailable = False Then
ToastMessageShow("Please install Google Play Services.", True)
End If
' Boton velocidad'
' boton1.Initialize(0)
' boton1.Text = 0 &" "&"km/h"
' boton1.TextColor = Colors.Red
' boton1.TextSize = 15
' boton1.Visible=False
' Activity.AddView(boton1, 40%x, 5dip, 25%x, 40dip)
'Fin Boton velocidad'
'GPS.Start(0, 0)
End Sub
Sub MapFragment1_Ready
gmap = MapFragment1.GetMap
'permisos
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
gmap.MyLocationEnabled = Result
'fin de permisos
Dim JavaMapsObject As JavaObject
JavaMapsObject = gmap.GetUiSettings
JavaMapsObject.RunMethod("setMapToolbarEnabled", Array As Object(True))
' Log($"AltoPanel: ${p_principal.Height}"$)
' Private altoMapa As Int = DipToCurrent(p_principal.Height*0.5o)
' Private anchoMapa As Int = DipToCurrent(p_principal.Width*0.6)
'' p_principal.GetView(0).SetLayout(15dip, 15dip, anchoMapa, altoMapa)
' p_principal.GetView(0).Height = altoMapa
'marcadores
' Dim latmarker As Double =19.3931867
' Dim longmarker As Double =-99.1439178
Dim marcador1 As Marker = gmap.AddMarker (latmarker,longmarker, "TIENDA")
marcador1.Snippet = fila.NOMBRE
'"Tienda 1"
'posicion inicial
Dim aa As CameraPosition
aa.Initialize(latmarker,longmarker,15)''' RECOMENDABLE CAMBIAR A 10 SI ES MAS DE 1 MARCADOR
gmap.AnimateCamera(aa)
End Sub
Sub GPS_LocationChanged (Parametro As Location)
' GPS.Start(0, 0)
' Dim sp As Int
' sp = Ceil(Parametro.Speed * 3.6)
' boton1.Text = sp &" "&"km/h"
' Latitud = Parametro.Latitude
' Longitud = Parametro.Longitude
' p2.Initialize2(Latitud,Longitud)
' p1.Initialize2(Lat2, Lon2)
' Distance = p1.DistanceTo(p2)
' If Latitud <> 0 And Longitud <> 0 Then
' If Distance > 10 Then
' Lat2 = Latitud
' Lon2 = Longitud
' Dim cp As CameraPosition
' cp.Initialize2(Parametro.Latitude, Parametro.Longitude, gmap.CameraPosition.Zoom, Parametro.Bearing, 0)
' gmap.AnimateCamera(cp)
' End If
' End If
End Sub
Sub Activity_Resume
GPS.Initialize("GPS")
If GPS.GPSEnabled = False Then
ToastMessageShow("Debe Activar el GPS del Equipo.", True)
StartActivity(GPS.LocationSettingsIntent)
Else
GPS.Start(0, 0)
End If
Subs.centraPanel(p_principal, Activity.Width)
p_principal.Height = Activity.Height * 0.95
latmarker = fila.LATITUD
longmarker = fila.LONGITUD
NOMBRE_TIENDA = fila.NOMBRE
End Sub
Sub Activity_Pause (UserClosed As Boolean)
GPS.Stop
End Sub
Sub reg_Click
StartActivity(fila)
End Sub