mirror of
https://github.com/KeymonSoft/Ruteador-NonUI.git
synced 2026-04-17 12:56:10 +00:00
-VERSION 5.07.31
- Se corrigió un error cuando no se mandaba el parametro "f" (final)
This commit is contained in:
@@ -1,51 +1,31 @@
|
||||
AppType=StandardJava
|
||||
Build1=Default,b4j.example
|
||||
File1=config.js
|
||||
File2=cover.png
|
||||
File3=genetic-algorithm.js
|
||||
File4=index.html
|
||||
File5=LICENSE
|
||||
File6=map.js
|
||||
File7=README.md
|
||||
File8=result.html
|
||||
File9=style.css
|
||||
FileGroup1=Default Group
|
||||
FileGroup2=Default Group
|
||||
FileGroup3=Default Group
|
||||
FileGroup4=Default Group
|
||||
FileGroup5=Default Group
|
||||
FileGroup6=Default Group
|
||||
FileGroup7=Default Group
|
||||
FileGroup8=Default Group
|
||||
FileGroup9=Default Group
|
||||
Group=Default Group
|
||||
Library1=byteconverter
|
||||
Library10=nhcalculatehash
|
||||
Library11=javaobject
|
||||
Library2=compressstrings
|
||||
Library3=jcore
|
||||
Library4=jfx
|
||||
Library5=jokhttputils2
|
||||
Library6=jrandomaccessfile
|
||||
Library7=jserver
|
||||
Library8=json
|
||||
Library9=jsql
|
||||
Module1=Ayuda
|
||||
Module2=DBRequestManager
|
||||
Module3=delDB
|
||||
Module4=Genetic_Algorithm
|
||||
Module5=Mapa
|
||||
Module6=rutaCompleta
|
||||
Module7=Ruteador
|
||||
NumberOfFiles=9
|
||||
NumberOfLibraries=11
|
||||
NumberOfModules=7
|
||||
Version=10
|
||||
Library1=compressstrings
|
||||
Library10=byteconverter
|
||||
Library2=jcore
|
||||
Library3=jfx
|
||||
Library4=jokhttputils2
|
||||
Library5=jrandomaccessfile
|
||||
Library6=jserver
|
||||
Library7=json
|
||||
Library8=jsql
|
||||
Library9=nhcalculatehash
|
||||
Module1=DBRequestManager
|
||||
Module2=delDB
|
||||
Module3=Mapa
|
||||
Module4=rutaCompleta
|
||||
Module5=Ruteador
|
||||
NumberOfFiles=0
|
||||
NumberOfLibraries=10
|
||||
NumberOfModules=5
|
||||
Version=10.3
|
||||
@EndOfDesignText@
|
||||
#Region Project Attributes
|
||||
#CommandLineArgs:
|
||||
#MergeLibraries: True
|
||||
#AdditionalJar: sqlite-jdbc-3.7.2.jar
|
||||
' VERSION 5.07.31
|
||||
'###########################################################################################################
|
||||
'###################### PULL #############################################################
|
||||
'Ctrl + click ide://run?file=%WINDIR%\System32\cmd.exe&Args=/c&Args=git&Args=pull
|
||||
@@ -59,7 +39,7 @@ Version=10
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
Dim srvr As Server
|
||||
Private srvr As Server
|
||||
Dim db As SQL
|
||||
' Dim fx As JFX
|
||||
Dim punteoLista As List
|
||||
@@ -73,7 +53,6 @@ Sub Process_Globals
|
||||
' Dim estePunto() As String
|
||||
Dim error As String = ""
|
||||
Dim msg As String = ""
|
||||
Dim hash As String = ""
|
||||
End Sub
|
||||
|
||||
Sub AppStart (Args() As String)
|
||||
@@ -94,7 +73,9 @@ Sub AppStart (Args() As String)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
|
||||
' Log($"ARGS=${DBRIp}:${DBRPort}"$)
|
||||
Log("Server Port=" & srvr.Port)
|
||||
ts.Initialize
|
||||
@@ -105,20 +86,12 @@ Sub AppStart (Args() As String)
|
||||
srvr.AddHandler("/mapa", "Mapa", False)
|
||||
srvr.AddHandler("/rutacompleta", "rutaCompleta", False)
|
||||
srvr.AddHandler("/borrar", "delDB", False)
|
||||
srvr.AddHandler("/ayuda", "Ayuda", False)
|
||||
srvr.AddHandler("/help", "Ayuda", False)
|
||||
srvr.AddHandler("/h", "Ayuda", False)
|
||||
srvr.AddHandler("/ga", "Genetic_Algorithm", False)
|
||||
|
||||
|
||||
Log(File.ListFiles(File.DirApp))
|
||||
Dim jo As JavaObject = srvr
|
||||
jo.GetFieldJO("context").RunMethodJO("getMimeTypes", Null).RunMethod("addMimeMapping", Array("kml", "text/xml"))
|
||||
|
||||
srvr.Start
|
||||
StartMessageLoop
|
||||
'open browser and navigate to: http://127.0.0.1:51042/
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#Region Shared Files
|
||||
@@ -181,7 +154,7 @@ Sub creaTablas(params As Map)
|
||||
Log(params)
|
||||
Private almacen As String = params.Get("almacen")
|
||||
Private estasCoords As String = params.Get("coords")
|
||||
hash = params.Get("hash")
|
||||
Private hash As String = params.Get("hash")
|
||||
Private ruta As String = $"${params.Get("ruta")}A${almacen}_${hash}"$
|
||||
db.BeginTransaction
|
||||
Try
|
||||
@@ -191,7 +164,6 @@ Sub creaTablas(params As Map)
|
||||
db.ExecNonQuery($"drop table if exists ${ruta}_matrizOSRM"$)
|
||||
' Log($"drop table if exists ${ruta}_puntos"$)
|
||||
db.ExecNonQuery($"drop table if exists ${ruta}_puntos"$)
|
||||
|
||||
db.ExecNonQuery($"create table if not exists ${ruta}_puntos (id TEXT, nombre TEXT, lat TEXT, lon TEXT)"$)
|
||||
' Log($"create table if not exists ${ruta}_puntos (id TEXT, nombre TEXT, lat TEXT, lon TEXT)"$)
|
||||
db.ExecNonQuery($"create table if not exists ${ruta}_punteo (pos TEXT, id TEXT, nombre TEXT, lat TEXT, lon TEXT)"$)
|
||||
@@ -250,7 +222,10 @@ Sub generaMatrizLocal(ruta As String) 'ignore
|
||||
Private lasCols, losVals As String
|
||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
||||
' Dim h As String = c.GetString("id")
|
||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||
If algoritmo <> 0 Then
|
||||
Log($">>> insertamos el almacen en PUNTEO"$)
|
||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||
End If
|
||||
' Log($"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).
|
||||
Do While c.NextRow
|
||||
@@ -286,6 +261,7 @@ Sub generaMatrizOSRM(ruta As String) As ResumableSub 'ignore
|
||||
' matriz = "OSRM"
|
||||
punteoLista.Initialize
|
||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos"$)
|
||||
Log($">>> insertamos el almacen en PUNTEO"$)
|
||||
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).
|
||||
Private lasCoords = "", lasCols = "idT", losIds = c.GetString("id") As String 'ignore
|
||||
@@ -350,12 +326,14 @@ Sub ruteo(ruta As String, matriz As String) 'ignore
|
||||
If checkIfTableExists(ruta&"_puntos") Then
|
||||
db.ExecNonQuery($"delete from ${ruta}_punteo"$)
|
||||
punteoLista.Initialize
|
||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos limit 1"$)
|
||||
Do While c.NextRow
|
||||
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
|
||||
|
||||
If algoritmo <> 0 Then
|
||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos limit 1"$)
|
||||
Do While c.NextRow
|
||||
Log($">>> insertamos el almacen en PUNTEO"$)
|
||||
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
|
||||
End If
|
||||
' Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos where id = 'CCINCIO' limit 1"$)
|
||||
' Do While c.NextRow
|
||||
' db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||
@@ -368,6 +346,7 @@ Sub ruteo(ruta As String, matriz As String) 'ignore
|
||||
Private pf() As String = Regex.Split(",", final) ' Obtenemos id, lon y lat.
|
||||
Private c As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos where id = '_${pf(0)}' limit 1"$)
|
||||
Do While c.NextRow
|
||||
Log($">>> insertamos el almacen en PUNTEO"$)
|
||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values ('0', '${c.GetString("id")}', 'Almacen', ${c.Getdouble("lat")}, ${c.Getdouble("lon")})"$)
|
||||
Loop
|
||||
punteoLista.Add("_" & pf(0))
|
||||
@@ -379,13 +358,15 @@ Sub ruteo(ruta As String, matriz As String) 'ignore
|
||||
If algoritmo = 1 Then
|
||||
ruteoNearestInsertion(ruta, matriz)
|
||||
cualAlgoritmo = " (NI)"
|
||||
Log(">>>>>>>>>> (NI)")
|
||||
Else If algoritmo = 0 Then
|
||||
Log(3)
|
||||
Log(">>>>>>>>>> (NN)")
|
||||
ruteoNearestNeighbor(ruta, matriz)
|
||||
cualAlgoritmo = " (NN)"
|
||||
Else
|
||||
ruteoNearestInsertion2
|
||||
cualAlgoritmo = " (NI2)"
|
||||
Log(">>>>>>>>>> (NI2)")
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
@@ -427,7 +408,7 @@ Private Sub b_tiempos_Click
|
||||
' tiempos("R1")
|
||||
End Sub
|
||||
|
||||
'Regresa El tiempo y distancia de la ruta especificada desde el API de OSRM.
|
||||
'Regresa El tiempo y distancia de la ruta especificada.
|
||||
Sub tiempos(ruta As String) As ResumableSub 'ignore
|
||||
Log("#######################################################")
|
||||
Log("############# Main/tiempos ####################")
|
||||
@@ -446,21 +427,26 @@ Sub tiempos(ruta As String) As ResumableSub 'ignore
|
||||
Private d() As String
|
||||
d = Regex.Split(";", estasCoords)
|
||||
' Log("$$$$$$ " & d.Length)
|
||||
Log($"http://router.project-osrm.org/route/v1/driving/${estasCoords}"$)
|
||||
Dim j As HttpJob
|
||||
j.Initialize("", Me)
|
||||
j.Download($"http://router.project-osrm.org/route/v1/driving/${estasCoords}"$)
|
||||
Wait For (j) JobDone(j As HttpJob)
|
||||
If j.Success Then
|
||||
Try
|
||||
Log($"http://router.project-osrm.org/route/v1/driving/${estasCoords}"$)
|
||||
Dim j As HttpJob
|
||||
j.Initialize("", Me)
|
||||
j.Download($"http://router.project-osrm.org/route/v1/driving/${estasCoords}"$)
|
||||
Wait For (j) JobDone(j As HttpJob)
|
||||
If j.Success Then
|
||||
' Log("RESPONSE:")
|
||||
' Log(j.GetString)
|
||||
Private j0 As String = j.GetString
|
||||
Else
|
||||
Log($"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ${CRLF} ${j.ErrorMessage}"$)
|
||||
If error = "" Then error = j.ErrorMessage
|
||||
Log($"######################### ${error}"$)
|
||||
End If
|
||||
j.Release
|
||||
Private j0 As String = j.GetString
|
||||
Else
|
||||
Log($"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ${CRLF} ${j.ErrorMessage}"$)
|
||||
If error = "" Then error = j.ErrorMessage
|
||||
Log($"######################### ${error}"$)
|
||||
End If
|
||||
j.Release
|
||||
Catch
|
||||
Log(LastException)
|
||||
End Try
|
||||
|
||||
' StopMessageLoop
|
||||
Private js As JSONParser
|
||||
js.Initialize(j0)
|
||||
@@ -483,7 +469,7 @@ Sub tiempos(ruta As String) As ResumableSub 'ignore
|
||||
' Log("Distance: " & rutas.Get("distance"))
|
||||
' Log("Legs: " & rutas.Get("legs").As(List).Size)
|
||||
' Log("Waypoints: " & waypoints.Size)
|
||||
ts.Put(ruta, CreateMap("code":"OK", "hash":hash, "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)
|
||||
Catch
|
||||
Log(LastException)
|
||||
@@ -505,16 +491,33 @@ Sub ruteoNearestNeighbor(ruta As String, matriz As String) 'ignore
|
||||
Log("####################################################################")
|
||||
Dim g As ResultSet
|
||||
Private x As ResultSet = db.ExecQuery($"select id from ${ruta}_puntos"$)
|
||||
Private cont As Int = 0
|
||||
Private sqlWhere As String = ""
|
||||
Do While x.NextRow 'Ejecutamos el siguiente codigo la cantidad de veces que hay puntos.
|
||||
Private punto As ResultSet = db.ExecQuery($"select id, count(id) as regs from ${ruta}_punteo order by pos DESC limit 1"$)
|
||||
Do While punto.NextRow
|
||||
' Log($"Select idt, '${punto.GetString("id")}', nombre, lat, lon from R1_matriz join R1_puntos on idT = id where idT Not in (Select id from r1_punteo) order by '${punto.GetString("id")}' Asc limit 1"$)
|
||||
g = db.ExecQuery($"Select idt, '${punto.GetString("id")}', nombre, lat, lon from ${ruta}_matriz${matriz} join ${ruta}_puntos on idT = id where idT Not in (Select id from ${ruta}_punteo) order by '${punto.GetString("id")}' Asc limit 1"$)
|
||||
Do While g.NextRow
|
||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values (${punto.GetString("regs")}, '${g.GetString("idT")}', '${g.GetString("nombre")}', '${g.GetString("lat")}', '${g.GetString("lon")}')"$)
|
||||
' Log(cont)
|
||||
If cont = 0 Then
|
||||
sqlWhere = $" idt = '_ACTUAL' and "$
|
||||
Private rs As ResultSet = db.ExecQuery($"select * from ${ruta}_puntos where id = '_ACTUAL'"$)
|
||||
Do While rs.NextRow
|
||||
Log(">>> Insertamos pos ACTUAL")
|
||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values (0, '${rs.GetString("id")}', '${rs.GetString("nombre")}', '${rs.GetString("lat")}', '${rs.GetString("lon")}')"$)
|
||||
Loop
|
||||
Else
|
||||
sqlWhere = ""
|
||||
End If
|
||||
Private punto As ResultSet = db.ExecQuery($"select id, count(id) as regs from ${ruta}_punteo order by pos DESC limit 1"$)
|
||||
' Do While punto.NextRow
|
||||
' Log(punto.GetString("id"))
|
||||
g = db.ExecQuery($"Select idt, "${punto.GetString("id")}", nombre, lat, lon from ${ruta}_matriz${matriz} join ${ruta}_puntos on idT = id where ${sqlWhere} idT Not in (Select id from ${ruta}_punteo) order by "${punto.GetString("id")}" Asc limit 1"$)
|
||||
Log($"Select idt, "${punto.GetString("id")}", nombre, lat, lon from ${ruta}_matriz${matriz} join ${ruta}_puntos on idT = id where ${sqlWhere} idT Not in (Select id from ${ruta}_punteo) order by "${punto.GetString("id")}" Asc limit 1"$)
|
||||
Do While g.NextRow
|
||||
Log($">>>> insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values (${punto.GetString("regs")}, '${g.GetString("idT")}', '${g.GetString("nombre")}', '${g.GetString("lat")}', '${g.GetString("lon")}')"$)
|
||||
db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values (${punto.GetString("regs")}, '${g.GetString("idT")}', '${g.GetString("nombre")}', '${g.GetString("lat")}', '${g.GetString("lon")}')"$)
|
||||
Loop
|
||||
' Loop
|
||||
cont = cont + 1
|
||||
Loop
|
||||
' db.ExecNonQuery($"insert into ${ruta}_punteo (pos, id, nombre, lat, lon) values (${punto.GetString("regs")}, '${g.GetString("idT")}', '${g.GetString("nombre")}', '${g.GetString("lat")}', '${g.GetString("lon")}')"$)
|
||||
End Sub
|
||||
|
||||
'Nearest Insertion
|
||||
@@ -673,7 +676,7 @@ Public Sub calculateDistance3(lat1 As Double, lon1 As Double, lat2 As Double, lo
|
||||
Return Round(Yards)
|
||||
Catch
|
||||
Log("CalcDistance " & LastException)
|
||||
If error = "" Then error = LastException
|
||||
if error = "" then error = LastException
|
||||
Return -1
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
@@ -4,24 +4,18 @@ ModuleBookmarks2=
|
||||
ModuleBookmarks3=
|
||||
ModuleBookmarks4=
|
||||
ModuleBookmarks5=
|
||||
ModuleBookmarks6=
|
||||
ModuleBookmarks7=
|
||||
ModuleBreakpoints0=
|
||||
ModuleBreakpoints1=
|
||||
ModuleBreakpoints2=
|
||||
ModuleBreakpoints3=
|
||||
ModuleBreakpoints4=
|
||||
ModuleBreakpoints5=
|
||||
ModuleBreakpoints6=
|
||||
ModuleBreakpoints7=
|
||||
ModuleClosedNodes0=
|
||||
ModuleClosedNodes1=
|
||||
ModuleClosedNodes2=
|
||||
ModuleClosedNodes3=
|
||||
ModuleClosedNodes4=5,6,8,9,10
|
||||
ModuleClosedNodes4=
|
||||
ModuleClosedNodes5=
|
||||
ModuleClosedNodes6=
|
||||
ModuleClosedNodes7=6,7
|
||||
NavigationStack=Ruteador,Class_Globals,9,4,Ruteador,Handle,28,0,Main,ruteoNearestNeighbor,466,0,Genetic_Algorithm,traeDistanciaDesdeMatriz,398,6,Main,Process_Globals,31,6,Main,creaTablas,143,0,Mapa,ruteoCompleto,167,4,Ruteador,generaMatrizRuteoTiempos,125,0,Ruteador,tiempos,194,0,Main,tiempos,441,4
|
||||
NavigationStack=Main,ruteoNearestNeighbor,467,6,Main,generaMatrizLocal,201,6,Main,creaTablas,141,0,Main,generaMatrizOSRM,239,0,Main,ruteoNearestInsertion,567,0,Main,ruteo,336,0,Main,tiempos,406,1,Ruteador,Handle,43,6,Main,Process_Globals,28,0,Ruteador,generaMatrizRuteoTiempos,92,6,Ruteador,checkIfTableExists,228,0
|
||||
SelectedBuild=0
|
||||
VisibleModules=7,5,6,2,3,4,1
|
||||
VisibleModules=5,3,4,1,2
|
||||
|
||||
37
Ruteador.bas
37
Ruteador.bas
@@ -14,7 +14,6 @@ Sub Class_Globals
|
||||
Dim getHash As CalculateHash
|
||||
Dim js As JSONGenerator
|
||||
Dim cuantosPuntos As Int = 0
|
||||
Dim elHash As String
|
||||
End Sub
|
||||
|
||||
Public Sub Initialize
|
||||
@@ -32,32 +31,23 @@ Sub Handle(req As ServletRequest, resp As ServletResponse)
|
||||
Log("##############################################################")
|
||||
' Log("q='"&req.GetParameter("q")&"'")
|
||||
' Log($"REQ: ${req.FullRequestURI}"$)
|
||||
elHash = getHash.CalculateTheHash(req.FullRequestURI)
|
||||
Private elHash As String = getHash.CalculateTheHash(req.FullRequestURI)
|
||||
' Log(elHash)
|
||||
Private ruta As String = req.GetParameter("r")
|
||||
Private almacen As String = req.GetParameter("a")
|
||||
Private coords As String = req.GetParameter("c")
|
||||
Private matriz As String = req.GetParameter("m")
|
||||
Private ayuda As String
|
||||
If req.GetParameter("h") <> "" Then ayuda = req.GetParameter("h")
|
||||
If req.GetParameter("h") <> "" Then ayuda = req.GetParameter("help")
|
||||
If req.GetParameter("h") <> "" Then ayuda = req.GetParameter("ayuda")
|
||||
Main.algoritmo = 1
|
||||
If req.GetParameter("algoritmo") = "0" Or req.GetParameter("algoritmo") = "NN" Then
|
||||
Main.algoritmo = 0 ' Algoritmo = Nearest Neighbor.
|
||||
End If
|
||||
Main.inicio = req.GetParameter("i")
|
||||
Main.final = req.GetParameter("f")
|
||||
If matriz <> "" And matriz <> "OSRM" Then matriz = ""
|
||||
' Log($"r: ${ruta}, a: ${almacen}, Coords: ${coords}"$)
|
||||
Private urlParams As Map
|
||||
Log("|"&ayuda&"|"& req.GetParameter("h") & "|" )
|
||||
If ayuda <> "" Then
|
||||
resp.ContentType = "text/html"
|
||||
resp.Write($"Son necesarios los siguientes parametros:<br>
|
||||
* r - La ruta<br>
|
||||
* a - El almacen<br>
|
||||
* c - Lista de puntos (id_cliente,lon,lat) separadas por punto y coma, el primer punto de la lista, se considera el punto de INICIO de la ruta.<br>
|
||||
* m - La matriz a usar LOCAL u OSRM (Opcional, default local<br>
|
||||
* f - El destino final (id_cliente,lon,lat) de donde termina la ruta (Opcional)"$)
|
||||
else If ruta <> "" And almacen <> "" And coords <> "" Then
|
||||
If Main.final <> "" Then coords = coords & ";" & Main.final
|
||||
If ruta <> "" And almacen <> "" And coords <> "" Then
|
||||
If Main.final <> "" And Main.algoritmo <> 0 Then coords = coords & ";" & Main.final
|
||||
ruta = "R" & ruta
|
||||
urlParams.Initialize
|
||||
urlParams.Put("almacen", almacen)
|
||||
@@ -111,6 +101,10 @@ Sub generaMatrizRuteoTiempos(r As String, resp As ServletResponse, ruta As Strin
|
||||
End Try
|
||||
'Generamos el ruteo
|
||||
Main.ruteo($"${r}"$, matriz)
|
||||
If Main.algoritmo <> 0 And Main.final <> "" Then
|
||||
Private t() As String = Regex.Split(",", Main.final)
|
||||
Main.db.ExecNonQuery($"insert into ${r}_punteo (pos, id, nombre, lat, lon) values (${cuantosPuntos + 1}, '${t(0)}', 'almacen', '${t(2)}', '${t(1)}')"$)
|
||||
End If
|
||||
Wait for(Main.tiempos($"${r}"$)) Complete (Result As Int)
|
||||
Private ts As Map = Main.ts.Get($"${r}"$)
|
||||
' Log(ts)
|
||||
@@ -129,7 +123,6 @@ Sub generaMatrizRuteoTiempos(r As String, resp As ServletResponse, ruta As Strin
|
||||
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.
|
||||
tempMap.Put("code", "OK")
|
||||
tempMap.Put("hash", elHash)
|
||||
tempMap.Put("ruta", ruta)
|
||||
tempMap.Put("almacen", almacen)
|
||||
tempMap.Put("duration", ts.Get("duration"))
|
||||
@@ -183,22 +176,18 @@ Sub tiempos(r As String, resp As ServletResponse, ruta As String, almacen As Str
|
||||
Private listCoords As List
|
||||
listCoords.Initialize
|
||||
Private coords2 As String = ""
|
||||
Private coords3 As String = ""
|
||||
Do While p.NextRow
|
||||
listCoords.Add(CreateMap("pos":p.GetString("pos"), "id":p.GetString("id"), "lat":p.GetString("lat"), "lon":p.GetString("lon")))
|
||||
If coords2 = "" Then
|
||||
coords2 = $"${p.GetString("lon")},${p.GetString("lat")}"$
|
||||
coords3 = $"${p.GetString("id")},${p.GetString("lon")},${p.GetString("lat")}"$
|
||||
Else
|
||||
coords2 = $"${coords2}:${p.GetString("lon")},${p.GetString("lat")}"$
|
||||
coords3 = $"${coords3};${p.GetString("id")},${p.GetString("lon")},${p.GetString("lat")}"$
|
||||
End If
|
||||
Loop
|
||||
Main.db.Close
|
||||
tempMap.Put("api", matriz)
|
||||
If matriz = "" Then tempMap.Put("api", "Local")
|
||||
tempMap.Put("code", "OK")
|
||||
tempMap.Put("hash", elHash)
|
||||
tempMap.Put("ruta", ruta)
|
||||
tempMap.Put("almacen", almacen)
|
||||
tempMap.Put("duration", ts.Get("duration"))
|
||||
@@ -216,9 +205,7 @@ Sub tiempos(r As String, resp As ServletResponse, ruta As String, almacen As Str
|
||||
resp.ContentType = "text/html"
|
||||
resp.Write(js.ToString)
|
||||
Log("###################################################################" & CRLF)
|
||||
Log($"http://keymon.lat:${Main.srvr.port}/ga?c=${coords3}"$)
|
||||
Log("###################################################################" & CRLF)
|
||||
Log($"http://keymon.lat:${Main.srvr.port}/kmz.php?a=1&c=${coords2}"$)
|
||||
Log($"http://keymon.lat:9001/kmz.php?a=1&c=${coords2}"$)
|
||||
Log("###################################################################" & CRLF)
|
||||
Log("Liga para ver la ruta en mapa:" & CRLF)
|
||||
Log($"https://osm.quelltextlich.at/viewer-js.html?kml_url=http://keymon.lat:9001/kmz.php?c=${coords2}"$)
|
||||
|
||||
Reference in New Issue
Block a user