mirror of
https://github.com/KeymonSoft/Ruteador-NonUI.git
synced 2026-04-20 22:29:18 +00:00
- Se agregaron varios TRY/CATCH para evitar que se muera la aplicacion en caso de parametros faltantes o equivocados.
This commit is contained in:
31
Mapa.bas
31
Mapa.bas
@@ -155,21 +155,26 @@ Sub ruteoCompleto(ruta As String) As ResumableSub 'ignore
|
|||||||
' Next
|
' Next
|
||||||
' Log("*****************************************")
|
' Log("*****************************************")
|
||||||
' Log(js.NextObject)
|
' Log(js.NextObject)
|
||||||
Private m As Map = js1.NextObject
|
ts.Put(ruta, CreateMap("code":"KO", "duration":0, "distance":0, "puntos":0))
|
||||||
|
Try
|
||||||
|
Private m As Map = js1.NextObject
|
||||||
' Private estatus As String = m.Get("code")
|
' Private estatus As String = m.Get("code")
|
||||||
Private rutas As Map = m.Get("routes").as(List).Get(0)
|
Private rutas As Map = m.Get("routes").as(List).Get(0)
|
||||||
' Private waypoints As List = m.Get("waypoints")
|
' Private waypoints As List = m.Get("waypoints")
|
||||||
' Log("Response: " & estatus)
|
' Log("Response: " & estatus)
|
||||||
' Log("Duration: " & rutas.Get("duration"))
|
' Log("Duration: " & rutas.Get("duration"))
|
||||||
' Log("Distance: " & rutas.Get("distance"))
|
' Log("Distance: " & rutas.Get("distance"))
|
||||||
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
||||||
' Log("Waypoints: " & waypoints.Size)
|
' Log("Waypoints: " & waypoints.Size)
|
||||||
Private steps As List
|
Private steps As List
|
||||||
steps.Initialize
|
steps.Initialize
|
||||||
steps = rutas.Get("legs").as(List).get("steps")
|
steps = rutas.Get("legs").as(List).get("steps")
|
||||||
Log("STEPS SIZE: " & steps.Size)
|
Log("STEPS SIZE: " & steps.Size)
|
||||||
ts.Put(ruta, CreateMap("code":"Ok", "duration":rutas.Get("duration"), "distance":rutas.Get("distance"), "puntos":rutas.Get("legs").As(List).Size))
|
ts.Put(ruta, CreateMap("code":"OK", "duration":rutas.Get("duration"), "distance":rutas.Get("distance"), "puntos":rutas.Get("legs").As(List).Size))
|
||||||
' Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>" & ts)
|
' Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>" & ts)
|
||||||
|
Catch
|
||||||
|
Log(LastException)
|
||||||
|
End Try
|
||||||
Return 1
|
Return 1
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -201,33 +201,37 @@ Sub generaMatrizLocal(ruta As String) 'ignore
|
|||||||
Log("#################################################################")
|
Log("#################################################################")
|
||||||
' Log($"delete from ${ruta}_punteo"$)
|
' Log($"delete from ${ruta}_punteo"$)
|
||||||
Log("Generamos matriz LOCAL")
|
Log("Generamos matriz LOCAL")
|
||||||
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
Try
|
||||||
' Log($"delete from ${ruta}_matriz"$)
|
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
||||||
db.ExecNonQuery($"delete from ${ruta}_matriz"$)
|
' Log($"delete from ${ruta}_matriz"$)
|
||||||
' matriz = ""
|
db.ExecNonQuery($"delete from ${ruta}_matriz"$)
|
||||||
punteoLista.Initialize
|
' matriz = ""
|
||||||
' Private otroPunto() As String
|
punteoLista.Initialize
|
||||||
Private lasCols, losVals As String
|
' Private otroPunto() As String
|
||||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
Private lasCols, losVals As String
|
||||||
' Dim h As String = c.GetString("id")
|
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
||||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
' Dim h As String = c.GetString("id")
|
||||||
' Log($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||||
punteoLista.Add(c.GetString("id")) 'Lista para ruteoNearestInsertion, ponemos el primer punto (almacen).
|
' Log($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||||
Do While c.NextRow
|
punteoLista.Add(c.GetString("id")) 'Lista para ruteoNearestInsertion, ponemos el primer punto (almacen).
|
||||||
lasCols = "idT"
|
Do While c.NextRow
|
||||||
' Log($"${c.GetString("id")}, ${c.GetString("nombre")}, ${c.GetString("lat")}, ${c.GetString("lon")}"$)
|
lasCols = "idT"
|
||||||
Private d As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
' Log($"${c.GetString("id")}, ${c.GetString("nombre")}, ${c.GetString("lat")}, ${c.GetString("lon")}"$)
|
||||||
losVals = $"'${c.GetString("id")}'"$
|
Private d As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
||||||
Do While d.NextRow
|
losVals = $"'${c.GetString("id")}'"$
|
||||||
Private laDist As Double = calculateDistance1(c.GetDouble("lat"), c.GetDouble("lon"), d.GetDouble("lat"), d.GetDouble("lon"))
|
Do While d.NextRow
|
||||||
lasCols = $"${lasCols}, '${d.GetString("id")}'"$
|
Private laDist As Double = calculateDistance1(c.GetDouble("lat"), c.GetDouble("lon"), d.GetDouble("lat"), d.GetDouble("lon"))
|
||||||
losVals = $"${losVals}, '${laDist}'"$
|
lasCols = $"${lasCols}, '${d.GetString("id")}'"$
|
||||||
' Log($"(${c.GetString("id")},${d.GetString("id")}) - Dist entre ${c.GetString("nombre")} y ${d.GetString("nombre")} = ${laDist}"$)
|
losVals = $"${losVals}, '${laDist}'"$
|
||||||
|
' Log($"(${c.GetString("id")},${d.GetString("id")}) - Dist entre ${c.GetString("nombre")} y ${d.GetString("nombre")} = ${laDist}"$)
|
||||||
|
Loop
|
||||||
|
' Log($"${lasCols}${CRLF}${losVals}"$)
|
||||||
|
db.ExecNonQuery($"insert into ${ruta}_matriz (${lasCols}) values (${losVals})"$)
|
||||||
Loop
|
Loop
|
||||||
' Log($"${lasCols}${CRLF}${losVals}"$)
|
Log("Matriz LOCAL generada")
|
||||||
db.ExecNonQuery($"insert into ${ruta}_matriz (${lasCols}) values (${losVals})"$)
|
Catch
|
||||||
Loop
|
Log(LastException)
|
||||||
Log("Matriz LOCAL generada")
|
End Try
|
||||||
' generaMatrizOSRM
|
' generaMatrizOSRM
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -236,52 +240,56 @@ Sub generaMatrizOSRM(ruta As String) As ResumableSub 'ignore
|
|||||||
Log("################################################################")
|
Log("################################################################")
|
||||||
Log("############# Main/generaMatrizOSRM ####################")
|
Log("############# Main/generaMatrizOSRM ####################")
|
||||||
Log("################################################################")
|
Log("################################################################")
|
||||||
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
Try
|
||||||
db.ExecNonQuery($"delete from ${ruta}_matrizOSRM"$)
|
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
||||||
' matriz = "OSRM"
|
db.ExecNonQuery($"delete from ${ruta}_matrizOSRM"$)
|
||||||
punteoLista.Initialize
|
' matriz = "OSRM"
|
||||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
punteoLista.Initialize
|
||||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
||||||
punteoLista.Add(c.GetString("id")) 'Lista para ruteoNearestInsertion, ponemos el primer punto (almacen).
|
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||||
Private lasCoords = "", lasCols = "idT", losIds = c.GetString("id") As String 'ignore
|
punteoLista.Add(c.GetString("id")) 'Lista para ruteoNearestInsertion, ponemos el primer punto (almacen).
|
||||||
Private listLasCols As List
|
Private lasCoords = "", lasCols = "idT", losIds = c.GetString("id") As String 'ignore
|
||||||
listLasCols.Initialize
|
Private listLasCols As List
|
||||||
Do While c.NextRow
|
listLasCols.Initialize
|
||||||
listLasCols.Add(c.GetString("Id"))
|
Do While c.NextRow
|
||||||
If lasCoords = "" Then
|
listLasCols.Add(c.GetString("Id"))
|
||||||
lasCoords = $"${c.GetString("lon")},${c.GetString("lat")}"$
|
If lasCoords = "" Then
|
||||||
lasCols = $"${lasCols},'${c.GetString("Id")}'"$
|
lasCoords = $"${c.GetString("lon")},${c.GetString("lat")}"$
|
||||||
Else
|
lasCols = $"${lasCols},'${c.GetString("Id")}'"$
|
||||||
lasCoords = $"${lasCoords};${c.GetString("lon")},${c.GetString("lat")}"$
|
Else
|
||||||
lasCols = $"${lasCols},'${c.GetString("Id")}'"$
|
lasCoords = $"${lasCoords};${c.GetString("lon")},${c.GetString("lat")}"$
|
||||||
|
lasCols = $"${lasCols},'${c.GetString("Id")}'"$
|
||||||
|
End If
|
||||||
|
Loop
|
||||||
|
Log(">>>>>>>>>>>> " & lasCols & CRLF & lasCoords)
|
||||||
|
Dim j As HttpJob
|
||||||
|
j.Initialize("", Me)
|
||||||
|
j.Download($"http://router.project-osrm.org/table/v1/driving/${lasCoords}"$)
|
||||||
|
Wait For (j) JobDone(j As HttpJob)
|
||||||
|
If j.Success Then
|
||||||
|
' Log(j.GetString)
|
||||||
|
Private j0 As String = j.GetString
|
||||||
End If
|
End If
|
||||||
Loop
|
j.Release
|
||||||
Log(">>>>>>>>>>>> " & lasCols & CRLF & lasCoords)
|
' StopMessageLoop
|
||||||
Dim j As HttpJob
|
Private durs As String = j0.SubString2(j0.IndexOf($""durations""$)+12, j0.IndexOf($""sources""$)).Replace("[","")
|
||||||
j.Initialize("", Me)
|
Private dur1() As String = Regex.Split("]", durs)
|
||||||
j.Download($"http://router.project-osrm.org/table/v1/driving/${lasCoords}"$)
|
Log(durs)
|
||||||
Wait For (j) JobDone(j As HttpJob)
|
For i = 0 To dur1.Length - 1
|
||||||
If j.Success Then
|
Private estosVals As String = dur1(i)
|
||||||
' Log(j.GetString)
|
If estosVals.StartsWith(",") Then estosVals = $"${estosVals.SubString(1)}"$
|
||||||
Private j0 As String = j.GetString
|
If estosVals.Length > 0 Then
|
||||||
End If
|
estosVals = $"'${listLasCols.get(i)}',${estosVals}"$
|
||||||
j.Release
|
Log(estosVals)
|
||||||
' StopMessageLoop
|
' Log($"insert into ${ruta}_matrizOSRM (${lasCols}) values (${estosVals})"$)
|
||||||
Private durs As String = j0.SubString2(j0.IndexOf($""durations""$)+12, j0.IndexOf($""sources""$)).Replace("[","")
|
db.ExecNonQuery($"insert into ${ruta}_matrizOSRM (${lasCols}) values (${estosVals})"$)
|
||||||
Private dur1() As String = Regex.Split("]", durs)
|
End If
|
||||||
Log(durs)
|
Next
|
||||||
For i = 0 To dur1.Length - 1
|
' fx.ShowExternalDocument($"http://router.project-osrm.org/table/v1/driving/${lasCoords}"$)
|
||||||
Private estosVals As String = dur1(i)
|
Log("Matriz OSRM generada")
|
||||||
If estosVals.StartsWith(",") Then estosVals = $"${estosVals.SubString(1)}"$
|
Catch
|
||||||
If estosVals.Length > 0 Then
|
Log(LastException)
|
||||||
estosVals = $"'${listLasCols.get(i)}',${estosVals}"$
|
End Try
|
||||||
Log(estosVals)
|
|
||||||
' Log($"insert into ${ruta}_matrizOSRM (${lasCols}) values (${estosVals})"$)
|
|
||||||
db.ExecNonQuery($"insert into ${ruta}_matrizOSRM (${lasCols}) values (${estosVals})"$)
|
|
||||||
End If
|
|
||||||
Next
|
|
||||||
' fx.ShowExternalDocument($"http://router.project-osrm.org/table/v1/driving/${lasCoords}"$)
|
|
||||||
Log("Matriz OSRM generada")
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub b_ruteo_Click
|
Sub b_ruteo_Click
|
||||||
@@ -295,9 +303,11 @@ Sub ruteo(ruta As String, matriz As String) 'ignore
|
|||||||
Log("#####################################################")
|
Log("#####################################################")
|
||||||
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
||||||
punteoLista.Initialize
|
punteoLista.Initialize
|
||||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos limit 1"$)
|
||||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
Do While c.NextRow
|
||||||
punteoLista.Add(c.GetString("id")) 'Lista para ruteoNearestInsertion, ponemos el primer punto de la lista de coordenadas.
|
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||||
|
punteoLista.Add(c.GetString("id")) 'Lista para ruteoNearestInsertion, ponemos el primer punto de la lista de coordenadas.
|
||||||
|
Loop
|
||||||
|
|
||||||
' Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos where id = 'CCINCIO' limit 1"$)
|
' Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos where id = 'CCINCIO' limit 1"$)
|
||||||
' Do While c.NextRow
|
' Do While c.NextRow
|
||||||
@@ -409,18 +419,23 @@ Sub tiempos(ruta As String) As ResumableSub 'ignore
|
|||||||
'' Log(colroot)
|
'' Log(colroot)
|
||||||
'' Next
|
'' Next
|
||||||
' Log("*****************************************")
|
' Log("*****************************************")
|
||||||
Private m As Map = js.NextObject
|
ts.Put(ruta, CreateMap("code":"KO", "duration":0, "distance":0, "puntos":0))
|
||||||
Log(m)
|
Try
|
||||||
Private estatus As String = m.Get("code")
|
Private m As Map = js.NextObject
|
||||||
Private rutas As Map = m.Get("routes").as(List).Get(0)
|
Log(m)
|
||||||
Private waypoints As List = m.Get("waypoints")
|
Private estatus As String = m.Get("code")
|
||||||
' Log("Response: " & estatus)
|
Private rutas As Map = m.Get("routes").as(List).Get(0)
|
||||||
' Log("Duration: " & rutas.Get("duration"))
|
Private waypoints As List = m.Get("waypoints")
|
||||||
' Log("Distance: " & rutas.Get("distance"))
|
Log("Response: " & estatus)
|
||||||
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
' Log("Duration: " & rutas.Get("duration"))
|
||||||
' Log("Waypoints: " & waypoints.Size)
|
' Log("Distance: " & rutas.Get("distance"))
|
||||||
ts.Put(ruta, CreateMap("code":"Ok", "duration":rutas.Get("duration"), "distance":rutas.Get("distance"), "puntos":rutas.Get("legs").As(List).Size))
|
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
||||||
' Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>" & ts)
|
' Log("Waypoints: " & waypoints.Size)
|
||||||
|
ts.Put(ruta, CreateMap("code":"OK", "duration":rutas.Get("duration"), "distance":rutas.Get("distance"), "puntos":rutas.Get("legs").As(List).Size))
|
||||||
|
' Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>" & ts)
|
||||||
|
Catch
|
||||||
|
Log(LastException)
|
||||||
|
End Try
|
||||||
Return 1
|
Return 1
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ ModuleBreakpoints2=
|
|||||||
ModuleBreakpoints3=
|
ModuleBreakpoints3=
|
||||||
ModuleBreakpoints4=
|
ModuleBreakpoints4=
|
||||||
ModuleBreakpoints5=
|
ModuleBreakpoints5=
|
||||||
ModuleClosedNodes0=3,4,5,6,7,8,10,11,14,16,17,19,21,22,23,24,25
|
ModuleClosedNodes0=3,4,5,6,8,10,11,14,17,19,21,22,23,24,25
|
||||||
ModuleClosedNodes1=
|
ModuleClosedNodes1=
|
||||||
ModuleClosedNodes2=
|
ModuleClosedNodes2=
|
||||||
ModuleClosedNodes3=
|
ModuleClosedNodes3=
|
||||||
ModuleClosedNodes4=
|
ModuleClosedNodes4=
|
||||||
ModuleClosedNodes5=
|
ModuleClosedNodes5=
|
||||||
NavigationStack=Main,Process_Globals,26,6,Main,ruteoNearestInsertion,491,6,Main,generaMatrizOSRM,210,0,Main,generaMatrizLocal,182,0,Main,creaTablas,122,0,rutaCompleta,Initialize,12,0,Mapa,Handle,54,0,Ruteador,Handle,63,6,rutaCompleta,Handle,55,6,Main,ruteo,285,6
|
NavigationStack=Main,ruteo,283,6,Mapa,Handle,54,0,Main,creaTablas,132,0,Main,generaMatrizLocal,204,1,Main,generaMatrizOSRM,214,1,Main,tiempos,410,3,Ruteador,generaMatrizRuteoTiempos,95,6,Ruteador,tiempos,136,1,Mapa,ruteoCompleto,166,3,rutaCompleta,ruteoCompleto,167,2
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=5,3,4,1,2
|
VisibleModules=5,3,4,1,2
|
||||||
|
|||||||
@@ -99,13 +99,14 @@ Sub generaMatrizRuteoTiempos(r As String, resp As ServletResponse, ruta As Strin
|
|||||||
tempMap.Put("api", matriz)
|
tempMap.Put("api", matriz)
|
||||||
If matriz = "" Then tempMap.Put("api", "Local")
|
If matriz = "" Then tempMap.Put("api", "Local")
|
||||||
'Ponemos la ruta, almacen, tiempos, distancias y la lista de las coordenadas en un mapa para regresarla en un JSON.
|
'Ponemos la ruta, almacen, tiempos, distancias y la lista de las coordenadas en un mapa para regresarla en un JSON.
|
||||||
tempMap.Put("code", "Ok")
|
tempMap.Put("code", "OK")
|
||||||
tempMap.Put("ruta", ruta)
|
tempMap.Put("ruta", ruta)
|
||||||
tempMap.Put("almacen", almacen)
|
tempMap.Put("almacen", almacen)
|
||||||
tempMap.Put("duration", ts.Get("duration"))
|
tempMap.Put("duration", ts.Get("duration"))
|
||||||
tempMap.Put("distance", ts.Get("distance"))
|
tempMap.Put("distance", ts.Get("distance"))
|
||||||
tempMap.Put("puntos", ts.Get("puntos"))
|
tempMap.Put("puntos", ts.Get("puntos"))
|
||||||
tempMap.Put("coords", listCoords)
|
tempMap.Put("coords", listCoords)
|
||||||
|
If tempMap.get("puntos") = 0 Then tempMap.Put("code", "KO")
|
||||||
' Log(tempMap)
|
' Log(tempMap)
|
||||||
js.Initialize(tempMap)
|
js.Initialize(tempMap)
|
||||||
StopMessageLoop
|
StopMessageLoop
|
||||||
@@ -139,13 +140,14 @@ Sub tiempos(r As String, resp As ServletResponse, ruta As String, almacen As Str
|
|||||||
Main.db.Close
|
Main.db.Close
|
||||||
tempMap.Put("api", matriz)
|
tempMap.Put("api", matriz)
|
||||||
If matriz = "" Then tempMap.Put("api", "Local")
|
If matriz = "" Then tempMap.Put("api", "Local")
|
||||||
tempMap.Put("code", "Ok")
|
tempMap.Put("code", "OK")
|
||||||
tempMap.Put("ruta", ruta)
|
tempMap.Put("ruta", ruta)
|
||||||
tempMap.Put("almacen", almacen)
|
tempMap.Put("almacen", almacen)
|
||||||
tempMap.Put("duration", ts.Get("duration"))
|
tempMap.Put("duration", ts.Get("duration"))
|
||||||
tempMap.Put("distance", ts.Get("distance"))
|
tempMap.Put("distance", ts.Get("distance"))
|
||||||
tempMap.Put("puntos", ts.Get("puntos"))
|
tempMap.Put("puntos", ts.Get("puntos"))
|
||||||
tempMap.Put("coords", listCoords)
|
tempMap.Put("coords", listCoords)
|
||||||
|
If tempMap.get("puntos") = 0 Then tempMap.Put("code", "KO")
|
||||||
' Log(tempMap)
|
' Log(tempMap)
|
||||||
js.Initialize(tempMap)
|
js.Initialize(tempMap)
|
||||||
StopMessageLoop
|
StopMessageLoop
|
||||||
|
|||||||
@@ -156,21 +156,26 @@ Sub ruteoCompleto(ruta As String) As ResumableSub 'ignore
|
|||||||
' Next
|
' Next
|
||||||
' Log("*****************************************")
|
' Log("*****************************************")
|
||||||
' Log(js.NextObject)
|
' Log(js.NextObject)
|
||||||
Private m As Map = js1.NextObject
|
ts.Put(ruta, CreateMap("code":"KO", "duration":0, "distance":0, "puntos":0))
|
||||||
|
Try
|
||||||
|
Private m As Map = js1.NextObject
|
||||||
' Private estatus As String = m.Get("code")
|
' Private estatus As String = m.Get("code")
|
||||||
Private rutas As Map = m.Get("routes").as(List).Get(0)
|
Private rutas As Map = m.Get("routes").as(List).Get(0)
|
||||||
' Private waypoints As List = m.Get("waypoints")
|
' Private waypoints As List = m.Get("waypoints")
|
||||||
' Log("Response: " & estatus)
|
' Log("Response: " & estatus)
|
||||||
' Log("Duration: " & rutas.Get("duration"))
|
' Log("Duration: " & rutas.Get("duration"))
|
||||||
' Log("Distance: " & rutas.Get("distance"))
|
' Log("Distance: " & rutas.Get("distance"))
|
||||||
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
||||||
' Log("Waypoints: " & waypoints.Size)
|
' Log("Waypoints: " & waypoints.Size)
|
||||||
Private steps As List
|
Private steps As List
|
||||||
steps.Initialize
|
steps.Initialize
|
||||||
steps = rutas.Get("legs").as(List).get(0).As(Map).Get("steps")
|
steps = rutas.Get("legs").as(List).get(0).As(Map).Get("steps")
|
||||||
Log("STEPS SIZE: " & steps.Size)
|
Log("STEPS SIZE: " & steps.Size)
|
||||||
ts.Put(ruta, CreateMap("code":"Ok", "duration":rutas.Get("duration"), "distance":rutas.Get("distance"), "puntos":rutas.Get("legs").As(List).Size))
|
ts.Put(ruta, CreateMap("code":"OK", "duration":rutas.Get("duration"), "distance":rutas.Get("distance"), "puntos":rutas.Get("legs").As(List).Size))
|
||||||
' Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>" & ts)
|
' Log(">>>>>>>>>>>>>>>>>>>>>>>>>>>" & ts)
|
||||||
|
Catch
|
||||||
|
Log(LastException)
|
||||||
|
End Try
|
||||||
Return 1
|
Return 1
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user