package reparto_izca.keymon.lat;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.B4AClass;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.debug.*;

public class c_clientes extends B4AClass.ImplB4AClass implements BA.SubDelegator{
    private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
    private void innerInitialize(BA _ba) throws Exception {
        if (ba == null) {
            ba = new BA(_ba, this, htSubs, "reparto_izca.keymon.lat.c_clientes");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", reparto_izca.keymon.lat.c_clientes.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }

 public anywheresoftware.b4a.keywords.Common __c = null;
public anywheresoftware.b4a.objects.B4XViewWrapper _root = null;
public anywheresoftware.b4a.objects.B4XViewWrapper.XUI _xui = null;
public String _q_buscar = "";
public String _entro = "";
public anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
public anywheresoftware.b4a.sql.SQL.CursorWrapper _c2 = null;
public anywheresoftware.b4a.objects.ListViewWrapper _listview1 = null;
public anywheresoftware.b4a.objects.LabelWrapper _lfila = null;
public anywheresoftware.b4a.objects.EditTextWrapper _busca = null;
public anywheresoftware.b4a.objects.PanelWrapper _p_colonia = null;
public String _laruta = "";
public anywheresoftware.b4a.objects.ButtonWrapper _b_getdirs = null;
public reparto_izca.keymon.lat.b4xorderedmap _distorderedmap = null;
public reparto_izca.keymon.lat.b4xorderedmap _clientesmapao = null;
public anywheresoftware.b4a.objects.ImageViewWrapper _img_getdirs = null;
public anywheresoftware.b4a.objects.LabelWrapper _l_rutainfo = null;
public anywheresoftware.b4a.objects.ButtonWrapper _b_getrutainfo = null;
public boolean _conmapa = false;
public anywheresoftware.b4a.objects.collections.List _listawaypoints = null;
public String _lv1top = "";
public anywheresoftware.b4a.objects.ButtonWrapper _b_limpiarruta = null;
public boolean _rutagenerada = false;
public String _rutaacambiar = "";
public b4a.example.dateutils _dateutils = null;
public reparto_izca.keymon.lat.main _main = null;
public reparto_izca.keymon.lat.appupdater _appupdater = null;
public reparto_izca.keymon.lat.foto _foto = null;
public reparto_izca.keymon.lat.mapa_cliente _mapa_cliente = null;
public reparto_izca.keymon.lat.mapa_rutas _mapa_rutas = null;
public reparto_izca.keymon.lat.starter _starter = null;
public reparto_izca.keymon.lat.subs _subs = null;
public reparto_izca.keymon.lat.tracker _tracker = null;
public reparto_izca.keymon.lat.newinst2 _newinst2 = null;
public reparto_izca.keymon.lat.b4xpages _b4xpages = null;
public reparto_izca.keymon.lat.b4xcollections _b4xcollections = null;
public reparto_izca.keymon.lat.httputils2service _httputils2service = null;
public reparto_izca.keymon.lat.xuiviewsutils _xuiviewsutils = null;
public boolean  _activity_keypress(int _key) throws Exception{
 //BA.debugLineNum = 219;BA.debugLine="Sub Activity_KeyPress (key As Int) As Boolean 'ign";
 //BA.debugLineNum = 221;BA.debugLine="If key=KeyCodes.KEYCODE_BACK Then";
if (_key==__c.KeyCodes.KEYCODE_BACK) { 
 //BA.debugLineNum = 222;BA.debugLine="If entro = 3 And Not(conMapa) Then";
if ((_entro).equals(BA.NumberToString(3)) && __c.Not(_conmapa)) { 
 //BA.debugLineNum = 223;BA.debugLine="b_GetDirs.Visible = False";
_b_getdirs.setVisible(__c.False);
 //BA.debugLineNum = 225;BA.debugLine="B4XPage_Created(Root)";
_b4xpage_created(_root);
 //BA.debugLineNum = 226;BA.debugLine="Return True";
if (true) return __c.True;
 };
 //BA.debugLineNum = 228;BA.debugLine="B4XPages.ShowPage(\"Principal\")";
_b4xpages._showpage /*String*/ (ba,"Principal");
 //BA.debugLineNum = 229;BA.debugLine="Return False";
if (true) return __c.False;
 };
 //BA.debugLineNum = 233;BA.debugLine="End Sub";
return false;
}
public void  _b_getdirs_click() throws Exception{
ResumableSub_b_GetDirs_Click rsub = new ResumableSub_b_GetDirs_Click(this);
rsub.resume(ba, null);
}
public static class ResumableSub_b_GetDirs_Click extends BA.ResumableSub {
public ResumableSub_b_GetDirs_Click(reparto_izca.keymon.lat.c_clientes parent) {
this.parent = parent;
}
reparto_izca.keymon.lat.c_clientes parent;
anywheresoftware.b4a.objects.collections.Map _m2 = null;
int _f = 0;
Object _k = null;
String _distancia2 = "";
String _thisloc1 = "";
String _locactual = "";
anywheresoftware.b4a.objects.collections.List _r = null;
int _tid = 0;
anywheresoftware.b4a.objects.collections.Map _tmap = null;
String _tempndd = "";
int _indexd = 0;
anywheresoftware.b4a.objects.collections.Map _estecliente = null;
anywheresoftware.b4a.objects.collections.Map _m3 = null;
anywheresoftware.b4a.BA.IterableList group4;
int index4;
int groupLen4;
anywheresoftware.b4a.BA.IterableList group38;
int index38;
int groupLen38;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 467;BA.debugLine="ProgressDialogShow(\"Calculando distancias y tiemp";
parent.__c.ProgressDialogShow(ba,BA.ObjectToCharSequence("Calculando distancias y tiempos ..."));
 //BA.debugLineNum = 468;BA.debugLine="Private m2 As Map";
_m2 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 469;BA.debugLine="Private f As Int = 0";
_f = (int) (0);
 //BA.debugLineNum = 470;BA.debugLine="For Each k As Object In distOrderedMap.Keys 'Trae";
if (true) break;

case 1:
//for
this.state = 30;
group4 = parent._distorderedmap._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ();
index4 = 0;
groupLen4 = group4.getSize();
this.state = 31;
if (true) break;

case 31:
//C
this.state = 30;
if (index4 < groupLen4) {
this.state = 3;
_k = group4.Get(index4);}
if (true) break;

case 32:
//C
this.state = 31;
index4++;
if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 471;BA.debugLine="m2 = distOrderedMap.Get(k)";
_m2 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(parent._distorderedmap._get /*Object*/ (_k)));
 //BA.debugLineNum = 472;BA.debugLine="Private distancia2 As String = m2.Get(\"distancia";
_distancia2 = BA.ObjectToString(_m2.Get((Object)("distancia")));
 //BA.debugLineNum = 473;BA.debugLine="Private thisLoc1 As String = m2.Get(\"ubicacion\")";
_thisloc1 = BA.ObjectToString(_m2.Get((Object)("ubicacion")));
 //BA.debugLineNum = 474;BA.debugLine="Private locActual As String = Tracker.UUGCoords.";
_locactual = BA.NumberToString(parent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude())+","+BA.NumberToString(parent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude());
 //BA.debugLineNum = 475;BA.debugLine="If locActual = \"0,0\" Then 'Si no tenemos ubicaci";
if (true) break;

case 4:
//if
this.state = 11;
if ((_locactual).equals("0,0")) { 
this.state = 6;
}if (true) break;

case 6:
//C
this.state = 7;
 //BA.debugLineNum = 476;BA.debugLine="c = Starter.skmt.ExecQuery(\"select * from hist_";
parent._c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select * from hist_gps")));
 //BA.debugLineNum = 477;BA.debugLine="If c.RowCount > 0 Then";
if (true) break;

case 7:
//if
this.state = 10;
if (parent._c.getRowCount()>0) { 
this.state = 9;
}if (true) break;

case 9:
//C
this.state = 10;
 //BA.debugLineNum = 478;BA.debugLine="c.Position = 0";
parent._c.setPosition((int) (0));
 //BA.debugLineNum = 479;BA.debugLine="locActual = c.GetString(\"hglon\") & \",\" & c.Get";
_locactual = parent._c.GetString("hglon")+","+parent._c.GetString("hglat");
 if (true) break;

case 10:
//C
this.state = 11;
;
 //BA.debugLineNum = 481;BA.debugLine="c.Close";
parent._c.Close();
 if (true) break;

case 11:
//C
this.state = 12;
;
 //BA.debugLineNum = 483;BA.debugLine="f = f+1";
_f = (int) (_f+1);
 //BA.debugLineNum = 484;BA.debugLine="If f < 8 Then";
if (true) break;

case 12:
//if
this.state = 29;
if (_f<8) { 
this.state = 14;
}if (true) break;

case 14:
//C
this.state = 15;
 //BA.debugLineNum = 485;BA.debugLine="If locActual = \"0,0\" Then 'Si todavia no tenemo";
if (true) break;

case 15:
//if
this.state = 18;
if ((_locactual).equals("0,0")) { 
this.state = 17;
}if (true) break;

case 17:
//C
this.state = 18;
 //BA.debugLineNum = 486;BA.debugLine="ToastMessageShow(\"No se pudo obtener la ubicac";
parent.__c.ToastMessageShow(BA.ObjectToCharSequence("No se pudo obtener la ubicacion actual!!"),parent.__c.True);
 //BA.debugLineNum = 487;BA.debugLine="f = 8";
_f = (int) (8);
 if (true) break;

case 18:
//C
this.state = 19;
;
 //BA.debugLineNum = 489;BA.debugLine="Log($\"locActual: ${locActual}, thisLoc1: ${this";
parent.__c.LogImpl("510813463",("locActual: "+parent.__c.SmartStringFormatter("",(Object)(_locactual))+", thisLoc1: "+parent.__c.SmartStringFormatter("",(Object)(_thisloc1))+""),0);
 //BA.debugLineNum = 490;BA.debugLine="Wait For(distanciaEntreCoords(distancia2, locAc";
parent.__c.WaitFor("complete", ba, this, parent._distanciaentrecoords(_distancia2,_locactual,_thisloc1));
this.state = 33;
return;
case 33:
//C
this.state = 19;
_r = (anywheresoftware.b4a.objects.collections.List) result[0];
;
 //BA.debugLineNum = 491;BA.debugLine="LogColor($\"R: ${r.Get(0)} - ${r.Get(1)} - ${r.G";
parent.__c.LogImpl("510813465",("R: "+parent.__c.SmartStringFormatter("",_r.Get((int) (0)))+" - "+parent.__c.SmartStringFormatter("",_r.Get((int) (1)))+" - "+parent.__c.SmartStringFormatter("",_r.Get((int) (2)))+""),parent.__c.Colors.Green);
 //BA.debugLineNum = 492;BA.debugLine="Private tId As Int = r.Get(0)";
_tid = (int)(BA.ObjectToNumber(_r.Get((int) (0))));
 //BA.debugLineNum = 493;BA.debugLine="Private tMap As Map = distOrderedMap.Get(tId)";
_tmap = new anywheresoftware.b4a.objects.collections.Map();
_tmap = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(parent._distorderedmap._get /*Object*/ ((Object)(_tid))));
 //BA.debugLineNum = 494;BA.debugLine="LogColor(\"|\" & tId & \"| - \" &distOrderedMap.Get";
parent.__c.LogImpl("510813468","|"+BA.NumberToString(_tid)+"| - "+BA.ObjectToString(parent._distorderedmap._get /*Object*/ ((Object)(_tid))),parent.__c.Colors.Blue);
 //BA.debugLineNum = 495;BA.debugLine="Private tempNDD As String = tMap.Get(\"nomDirDis";
_tempndd = BA.ObjectToString(_tmap.Get((Object)("nomDirDist")));
 //BA.debugLineNum = 496;BA.debugLine="Private indexD As Int = tempNDD.IndexOf(\"Distan";
_indexd = _tempndd.indexOf("Distancia:");
 //BA.debugLineNum = 497;BA.debugLine="If indexD > -1 Then tempNDD = tempNDD.SubString";
if (true) break;

case 19:
//if
this.state = 24;
if (_indexd>-1) { 
this.state = 21;
;}if (true) break;

case 21:
//C
this.state = 24;
_tempndd = _tempndd.substring((int) (0),_indexd);
if (true) break;

case 24:
//C
this.state = 25;
;
 //BA.debugLineNum = 498;BA.debugLine="Log(tempNDD)";
parent.__c.LogImpl("510813472",_tempndd,0);
 //BA.debugLineNum = 499;BA.debugLine="tempNDD = tempNDD & $\"Dist: $1.1{(r.Get(1)/1000";
_tempndd = _tempndd+("Dist: "+parent.__c.SmartStringFormatter("1.1",(Object)(((double)(BA.ObjectToNumber(_r.Get((int) (1))))/(double)1000)))+" kms, Tiempo aprox: "+parent.__c.SmartStringFormatter("1.0",(Object)((((double)(BA.ObjectToNumber(_r.Get((int) (2))))*2)/(double)60)))+" min.");
 //BA.debugLineNum = 500;BA.debugLine="Private esteCliente As Map = CreateMap(\"distanc";
_estecliente = new anywheresoftware.b4a.objects.collections.Map();
_estecliente = parent.__c.createMap(new Object[] {(Object)("distancia"),(Object)(_distancia2),(Object)("ubicacion"),_tmap.Get((Object)("ubicacion")),(Object)("codigo"),_tmap.Get((Object)("codigo")),(Object)("nomDirDist"),(Object)(_tempndd)});
 //BA.debugLineNum = 501;BA.debugLine="distOrderedMap.Put(tId, esteCliente)";
parent._distorderedmap._put /*String*/ ((Object)(_tid),(Object)(_estecliente.getObject()));
 //BA.debugLineNum = 502;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 503;BA.debugLine="Private m3 As Map";
_m3 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 504;BA.debugLine="For Each k As Object In distOrderedMap.Keys  'G";
if (true) break;

case 25:
//for
this.state = 28;
group38 = parent._distorderedmap._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ();
index38 = 0;
groupLen38 = group38.getSize();
this.state = 34;
if (true) break;

case 34:
//C
this.state = 28;
if (index38 < groupLen38) {
this.state = 27;
_k = group38.Get(index38);}
if (true) break;

case 35:
//C
this.state = 34;
index38++;
if (true) break;

case 27:
//C
this.state = 35;
 //BA.debugLineNum = 505;BA.debugLine="m3 = distOrderedMap.Get(k)";
_m3 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(parent._distorderedmap._get /*Object*/ (_k)));
 //BA.debugLineNum = 506;BA.debugLine="m3.Get(\"codigo\")";
_m3.Get((Object)("codigo"));
 //BA.debugLineNum = 507;BA.debugLine="ListView1.AddTwoLines(m3.Get(\"codigo\"), m3.Get";
parent._listview1.AddTwoLines(BA.ObjectToCharSequence(_m3.Get((Object)("codigo"))),BA.ObjectToCharSequence(_m3.Get((Object)("nomDirDist"))));
 if (true) break;
if (true) break;

case 28:
//C
this.state = 29;
;
 if (true) break;

case 29:
//C
this.state = 32;
;
 if (true) break;
if (true) break;

case 30:
//C
this.state = -1;
;
 //BA.debugLineNum = 511;BA.debugLine="ProgressDialogHide";
parent.__c.ProgressDialogHide();
 //BA.debugLineNum = 512;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public void  _complete(anywheresoftware.b4a.objects.collections.List _r) throws Exception{
}
public String  _b_getrutainfo_click() throws Exception{
 //BA.debugLineNum = 570;BA.debugLine="Private Sub b_getRutaInfo_Click";
 //BA.debugLineNum = 572;BA.debugLine="caculaRutaGPS(todosAVisitar)";
_cacularutagps(_todosavisitar());
 //BA.debugLineNum = 573;BA.debugLine="End Sub";
return "";
}
public String  _b_getrutainfo_longclick() throws Exception{
 //BA.debugLineNum = 576;BA.debugLine="Private Sub b_getRutaInfo_LongClick";
 //BA.debugLineNum = 577;BA.debugLine="If b_limpiarRuta.Visible Then";
if (_b_limpiarruta.getVisible()) { 
 //BA.debugLineNum = 578;BA.debugLine="b_limpiarRuta.Visible = False";
_b_limpiarruta.setVisible(__c.False);
 }else {
 //BA.debugLineNum = 580;BA.debugLine="b_limpiarRuta.Visible = True";
_b_limpiarruta.setVisible(__c.True);
 };
 //BA.debugLineNum = 582;BA.debugLine="End Sub";
return "";
}
public String  _b_limpiarruta_click() throws Exception{
 //BA.debugLineNum = 585;BA.debugLine="Private Sub b_limpiarRuta_Click";
 //BA.debugLineNum = 586;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from waypoints\"";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from waypoints");
 //BA.debugLineNum = 587;BA.debugLine="b_limpiarRuta.Visible = False";
_b_limpiarruta.setVisible(__c.False);
 //BA.debugLineNum = 588;BA.debugLine="B4XPage_Appear";
_b4xpage_appear();
 //BA.debugLineNum = 589;BA.debugLine="End Sub";
return "";
}
public String  _b4xpage_appear() throws Exception{
anywheresoftware.b4a.objects.CSBuilder _cs = null;
anywheresoftware.b4a.objects.CSBuilder _cs2 = null;
int _i = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _x = null;
String[] _y = null;
 //BA.debugLineNum = 49;BA.debugLine="Sub B4XPage_Appear";
 //BA.debugLineNum = 50;BA.debugLine="busca.Text = \"\"";
_busca.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 51;BA.debugLine="b_GetDirs.Visible = False";
_b_getdirs.setVisible(__c.False);
 //BA.debugLineNum = 53;BA.debugLine="entro =\"2\"";
_entro = "2";
 //BA.debugLineNum = 57;BA.debugLine="p_colonia.Width = Root.Width";
_p_colonia.setWidth(_root.getWidth());
 //BA.debugLineNum = 58;BA.debugLine="p_colonia.Height = Root.Height";
_p_colonia.setHeight(_root.getHeight());
 //BA.debugLineNum = 59;BA.debugLine="p_colonia.Top = 0";
_p_colonia.setTop((int) (0));
 //BA.debugLineNum = 60;BA.debugLine="p_colonia.Left = 0";
_p_colonia.setLeft((int) (0));
 //BA.debugLineNum = 61;BA.debugLine="Subs.centraListView(ListView1, p_colonia.Width)";
_subs._centralistview /*String*/ (ba,_listview1,_p_colonia.getWidth());
 //BA.debugLineNum = 62;BA.debugLine="ListView1.Height = p_colonia.Height * 0.75";
_listview1.setHeight((int) (_p_colonia.getHeight()*0.75));
 //BA.debugLineNum = 63;BA.debugLine="Subs.SetDivider(ListView1, Colors.LightGray, 2)";
_subs._setdivider /*String*/ (ba,_listview1,__c.Colors.LightGray,(int) (2));
 //BA.debugLineNum = 64;BA.debugLine="If Not(l_rutaInfo.Visible) Then";
if (__c.Not(_l_rutainfo.getVisible())) { 
 //BA.debugLineNum = 65;BA.debugLine="ListView1.Top = lv1Top";
_listview1.setTop((int)(Double.parseDouble(_lv1top)));
 }else {
 //BA.debugLineNum = 67;BA.debugLine="ListView1.Top = lv1Top + 100";
_listview1.setTop((int) ((double)(Double.parseDouble(_lv1top))+100));
 };
 //BA.debugLineNum = 69;BA.debugLine="c=Starter.skmt.ExecQuery(\"select codigo, indice,";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select codigo, indice, CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_NOEXT from waypoints inner join kmt_info on waypoints.codigo = kmt_info.CAT_CL_CODIGO where gestion = 0 AND CAT_CL_RUTA <> 1000 order by indice")));
 //BA.debugLineNum = 70;BA.debugLine="If c.RowCount > 0 Then 'Ya hay waypoints en la ba";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 71;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 73;BA.debugLine="conMapa = True";
_conmapa = __c.True;
 //BA.debugLineNum = 75;BA.debugLine="ListView1.Clear";
_listview1.Clear();
 //BA.debugLineNum = 76;BA.debugLine="Dim cs, cs2 As CSBuilder";
_cs = new anywheresoftware.b4a.objects.CSBuilder();
_cs2 = new anywheresoftware.b4a.objects.CSBuilder();
 //BA.debugLineNum = 77;BA.debugLine="entro = 3";
_entro = BA.NumberToString(3);
 //BA.debugLineNum = 79;BA.debugLine="For i=0 To c.RowCount -1 'Generamos el listView";
{
final int step23 = 1;
final int limit23 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit23 ;_i = _i + step23 ) {
 //BA.debugLineNum = 80;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 81;BA.debugLine="cs.Initialize";
_cs.Initialize();
 //BA.debugLineNum = 82;BA.debugLine="cs2.Initialize";
_cs2.Initialize();
 //BA.debugLineNum = 86;BA.debugLine="ListView1.AddTwoLines(cs.Color(Colors.RGB(100,1";
_listview1.AddTwoLines(BA.ObjectToCharSequence(_cs.Color(__c.Colors.RGB((int) (100),(int) (149),(int) (237))).Append(BA.ObjectToCharSequence(_c.GetString("codigo"))).PopAll().getObject()),BA.ObjectToCharSequence(_cs2.Append(BA.ObjectToCharSequence(_c.GetString("CAT_CL_NOMBRE"))).Color(__c.Colors.RGB((int) (100),(int) (149),(int) (237))).Append(BA.ObjectToCharSequence(" Calle: ")).Pop().Append(BA.ObjectToCharSequence(_c.GetString("CAT_CL_CALLE").trim()+" "+_c.GetString("CAT_CL_NOEXT"))).PopAll().getObject()));
 }
};
 }else {
 //BA.debugLineNum = 89;BA.debugLine="generaListViewRutas";
_generalistviewrutas();
 };
 //BA.debugLineNum = 91;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 92;BA.debugLine="p_colonia.Width = Root.Width";
_p_colonia.setWidth(_root.getWidth());
 //BA.debugLineNum = 93;BA.debugLine="p_colonia.Height = Root.Height";
_p_colonia.setHeight(_root.getHeight());
 //BA.debugLineNum = 94;BA.debugLine="Subs.centraEtiqueta(l_rutaInfo, Root.Width)";
_subs._centraetiqueta /*String*/ (ba,_l_rutainfo,_root.getWidth());
 //BA.debugLineNum = 95;BA.debugLine="Subs.centraListView(ListView1, p_colonia.Width)";
_subs._centralistview /*String*/ (ba,_listview1,_p_colonia.getWidth());
 //BA.debugLineNum = 96;BA.debugLine="ListView1.Height = p_colonia.Height * 0.70";
_listview1.setHeight((int) (_p_colonia.getHeight()*0.70));
 //BA.debugLineNum = 97;BA.debugLine="Subs.centraEtiqueta(lfila, Root.Width)";
_subs._centraetiqueta /*String*/ (ba,_lfila,_root.getWidth());
 //BA.debugLineNum = 98;BA.debugLine="b_getRutaInfo.Visible = True";
_b_getrutainfo.setVisible(__c.True);
 //BA.debugLineNum = 99;BA.debugLine="b_getRutaInfo.BringToFront";
_b_getrutainfo.BringToFront();
 //BA.debugLineNum = 100;BA.debugLine="If Starter.cedisLocation.Latitude = \"0\" Then";
if (_starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude()==(double)(Double.parseDouble("0"))) { 
 //BA.debugLineNum = 101;BA.debugLine="Private x As Cursor = Starter.skmt.ExecQuery(\"se";
_x = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_x = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select * from CAT_VARIABLES where CAT_VA_DESCRIPCION = 'COORDS_ALMACEN'")));
 //BA.debugLineNum = 102;BA.debugLine="If x.RowCount > 0 Then";
if (_x.getRowCount()>0) { 
 //BA.debugLineNum = 103;BA.debugLine="x.Position = 0";
_x.setPosition((int) (0));
 //BA.debugLineNum = 104;BA.debugLine="Private y() As String";
_y = new String[(int) (0)];
java.util.Arrays.fill(_y,"");
 //BA.debugLineNum = 105;BA.debugLine="Starter.cedisLocation.Latitude = Regex.Split(\",";
_starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .setLatitude((double)(Double.parseDouble(__c.Regex.Split(",",_x.GetString("CAT_VA_VALOR"))[(int) (1)])));
 //BA.debugLineNum = 106;BA.debugLine="Starter.cedisLocation.Longitude = Regex.Split(\"";
_starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .setLongitude((double)(Double.parseDouble(__c.Regex.Split(",",_x.GetString("CAT_VA_VALOR"))[(int) (0)])));
 };
 };
 //BA.debugLineNum = 109;BA.debugLine="Log(Starter.cedisLocation)";
__c.LogImpl("510289212",BA.ObjectToString(_starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ ),0);
 //BA.debugLineNum = 110;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _b4xpage_closerequest() throws Exception{
ResumableSub_B4XPage_CloseRequest rsub = new ResumableSub_B4XPage_CloseRequest(this);
rsub.resume(ba, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_B4XPage_CloseRequest extends BA.ResumableSub {
public ResumableSub_B4XPage_CloseRequest(reparto_izca.keymon.lat.c_clientes parent) {
this.parent = parent;
}
reparto_izca.keymon.lat.c_clientes parent;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
{
parent.__c.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = 1;
 //BA.debugLineNum = 116;BA.debugLine="Log(entro)";
parent.__c.LogImpl("510354691",parent._entro,0);
 //BA.debugLineNum = 117;BA.debugLine="If rutaGenerada Or entro = 3 Then ' Si ya generam";
if (true) break;

case 1:
//if
this.state = 6;
if (parent._rutagenerada || (parent._entro).equals(BA.NumberToString(3))) { 
this.state = 3;
}else if((parent._entro).equals(BA.NumberToString(2))) { 
this.state = 5;
}if (true) break;

case 3:
//C
this.state = 6;
 //BA.debugLineNum = 118;BA.debugLine="b_limpiarRuta_Click";
parent._b_limpiarruta_click();
 //BA.debugLineNum = 119;BA.debugLine="l_rutaInfo.Text = \"\"";
parent._l_rutainfo.setText(BA.ObjectToCharSequence(""));
 //BA.debugLineNum = 120;BA.debugLine="rutaGenerada = False";
parent._rutagenerada = parent.__c.False;
 if (true) break;

case 5:
//C
this.state = 6;
 //BA.debugLineNum = 122;BA.debugLine="B4XPages.ShowPage(\"Principal\")";
parent._b4xpages._showpage /*String*/ (ba,"Principal");
 if (true) break;

case 6:
//C
this.state = -1;
;
 //BA.debugLineNum = 124;BA.debugLine="Return False";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)(parent.__c.False));return;};
 //BA.debugLineNum = 125;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public String  _b4xpage_created(anywheresoftware.b4a.objects.B4XViewWrapper _root1) throws Exception{
 //BA.debugLineNum = 36;BA.debugLine="Private Sub B4XPage_Created (Root1 As B4XView)";
 //BA.debugLineNum = 37;BA.debugLine="Root = Root1";
_root = _root1;
 //BA.debugLineNum = 39;BA.debugLine="Root.LoadLayout(\"clientes\")";
_root.LoadLayout("clientes",ba);
 //BA.debugLineNum = 40;BA.debugLine="entro =\"2\"";
_entro = "2";
 //BA.debugLineNum = 41;BA.debugLine="lv1Top = ListView1.Top";
_lv1top = BA.NumberToString(_listview1.getTop());
 //BA.debugLineNum = 42;BA.debugLine="clientesMapaO.Initialize";
_clientesmapao._initialize /*String*/ (ba);
 //BA.debugLineNum = 43;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from waypoints\"";
_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from waypoints");
 //BA.debugLineNum = 44;BA.debugLine="Log(\"Coordenadas del almacen: \" & Starter.cedisLo";
__c.LogImpl("510223624","Coordenadas del almacen: "+BA.NumberToString(_starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude())+","+BA.NumberToString(_starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude()),0);
 //BA.debugLineNum = 45;BA.debugLine="End Sub";
return "";
}
public String  _busca_textchanged(String _old,String _new) throws Exception{
int _i = 0;
anywheresoftware.b4a.objects.LabelWrapper _label1 = null;
anywheresoftware.b4a.objects.LabelWrapper _label2 = null;
 //BA.debugLineNum = 235;BA.debugLine="Sub BUSCA_TextChanged (Old As String, New As Strin";
 //BA.debugLineNum = 236;BA.debugLine="q_buscar = \"%\" & busca.Text & \"%\"";
_q_buscar = "%"+_busca.getText()+"%";
 //BA.debugLineNum = 237;BA.debugLine="c2=Starter.skmt.ExecQuery2(\"select  CAT_CL_NOMBRE";
_c2 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select  CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO from kmt_info where CAT_CL_NOMBRE like ? and gestion = 0 AND CAT_CL_RUTA <> 1000 order by CAT_CL_CODIGO ",new String[]{_q_buscar})));
 //BA.debugLineNum = 238;BA.debugLine="ListView1.Clear";
_listview1.Clear();
 //BA.debugLineNum = 239;BA.debugLine="lfila.text = \"Nombre y Calle\"";
_lfila.setText(BA.ObjectToCharSequence("Nombre y Calle"));
 //BA.debugLineNum = 240;BA.debugLine="Subs.SetDivider(ListView1, Colors.LightGray, 2)";
_subs._setdivider /*String*/ (ba,_listview1,__c.Colors.LightGray,(int) (2));
 //BA.debugLineNum = 241;BA.debugLine="If c2.RowCount>0 Then";
if (_c2.getRowCount()>0) { 
 //BA.debugLineNum = 242;BA.debugLine="For i=0 To c2.RowCount -1";
{
final int step7 = 1;
final int limit7 = (int) (_c2.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit7 ;_i = _i + step7 ) {
 //BA.debugLineNum = 243;BA.debugLine="c2.Position=i";
_c2.setPosition(_i);
 //BA.debugLineNum = 244;BA.debugLine="Dim label1 As Label";
_label1 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 245;BA.debugLine="label1 = ListView1.TwoLinesLayout.Label";
_label1 = _listview1.getTwoLinesLayout().Label;
 //BA.debugLineNum = 246;BA.debugLine="label1.TextSize = 15";
_label1.setTextSize((float) (15));
 //BA.debugLineNum = 247;BA.debugLine="label1.TextColor = Colors.Black";
_label1.setTextColor(__c.Colors.Black);
 //BA.debugLineNum = 248;BA.debugLine="Dim label2 As Label";
_label2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 249;BA.debugLine="label2 = ListView1.TwoLinesLayout.SecondLabel";
_label2 = _listview1.getTwoLinesLayout().SecondLabel;
 //BA.debugLineNum = 250;BA.debugLine="label2.TextSize = 15";
_label2.setTextSize((float) (15));
 //BA.debugLineNum = 251;BA.debugLine="label2.TextColor = Colors.Black";
_label2.setTextColor(__c.Colors.Black);
 //BA.debugLineNum = 252;BA.debugLine="ListView1.AddTwoLines(c2.GetString(\"CAT_CL_CODI";
_listview1.AddTwoLines(BA.ObjectToCharSequence(_c2.GetString("CAT_CL_CODIGO")),BA.ObjectToCharSequence(_c2.GetString("CAT_CL_NOMBRE")+" CALLE:  "+_c2.GetString("CAT_CL_CALLE")));
 }
};
 };
 //BA.debugLineNum = 255;BA.debugLine="entro = \"3\"";
_entro = "3";
 //BA.debugLineNum = 256;BA.debugLine="c2.Close";
_c2.Close();
 //BA.debugLineNum = 257;BA.debugLine="End Sub";
return "";
}
public void  _cacularutagps(anywheresoftware.b4a.objects.collections.List _coords) throws Exception{
ResumableSub_caculaRutaGPS rsub = new ResumableSub_caculaRutaGPS(this,_coords);
rsub.resume(ba, null);
}
public static class ResumableSub_caculaRutaGPS extends BA.ResumableSub {
public ResumableSub_caculaRutaGPS(reparto_izca.keymon.lat.c_clientes parent,anywheresoftware.b4a.objects.collections.List _coords) {
this.parent = parent;
this._coords = _coords;
}
reparto_izca.keymon.lat.c_clientes parent;
anywheresoftware.b4a.objects.collections.List _coords;
anywheresoftware.b4a.objects.collections.List _tmplist = null;
anywheresoftware.b4a.objects.CSBuilder _cs = null;
anywheresoftware.b4a.objects.CSBuilder _cs2 = null;
String _coordsstr = "";
anywheresoftware.b4a.objects.collections.List _tienda = null;
reparto_izca.keymon.lat.httpjob _j = null;
anywheresoftware.b4a.objects.collections.JSONParser _jp = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
int _puntos = 0;
String _duration = "";
String _distance = "";
String _mensaje = "";
int _i = 0;
anywheresoftware.b4a.objects.collections.Map _ti = null;
anywheresoftware.b4a.BA.IterableList group8;
int index8;
int groupLen8;
int step37;
int limit37;
int step49;
int limit49;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 592;BA.debugLine="Private tmpList As List";
_tmplist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 593;BA.debugLine="Dim cs, cs2 As CSBuilder";
_cs = new anywheresoftware.b4a.objects.CSBuilder();
_cs2 = new anywheresoftware.b4a.objects.CSBuilder();
 //BA.debugLineNum = 594;BA.debugLine="tmpList.Initialize";
_tmplist.Initialize();
 //BA.debugLineNum = 595;BA.debugLine="tmpList.AddAll(Array As String(\"ACTUAL\", Tracker.";
_tmplist.AddAll(anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{"ACTUAL",BA.NumberToString(parent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude()),BA.NumberToString(parent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude())}));
 //BA.debugLineNum = 596;BA.debugLine="coords.InsertAt(0,tmpList)";
_coords.InsertAt((int) (0),(Object)(_tmplist.getObject()));
 //BA.debugLineNum = 597;BA.debugLine="Log(\"=================================\")";
parent.__c.LogImpl("511141126","=================================",0);
 //BA.debugLineNum = 599;BA.debugLine="Private coordsStr As String = \"\"";
_coordsstr = "";
 //BA.debugLineNum = 600;BA.debugLine="For Each tienda As List In coords";
if (true) break;

case 1:
//for
this.state = 10;
_tienda = new anywheresoftware.b4a.objects.collections.List();
group8 = _coords;
index8 = 0;
groupLen8 = group8.getSize();
this.state = 33;
if (true) break;

case 33:
//C
this.state = 10;
if (index8 < groupLen8) {
this.state = 3;
_tienda = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(group8.Get(index8)));}
if (true) break;

case 34:
//C
this.state = 33;
index8++;
if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 602;BA.debugLine="If coordsStr = \"\" Then";
if (true) break;

case 4:
//if
this.state = 9;
if ((_coordsstr).equals("")) { 
this.state = 6;
}else {
this.state = 8;
}if (true) break;

case 6:
//C
this.state = 9;
 //BA.debugLineNum = 603;BA.debugLine="coordsStr = $\"${tienda.get(0)},${tienda.get(1)}";
_coordsstr = (""+parent.__c.SmartStringFormatter("",_tienda.Get((int) (0)))+","+parent.__c.SmartStringFormatter("",_tienda.Get((int) (1)))+","+parent.__c.SmartStringFormatter("",_tienda.Get((int) (2)))+"");
 if (true) break;

case 8:
//C
this.state = 9;
 //BA.debugLineNum = 605;BA.debugLine="coordsStr = $\"${coordsStr};${tienda.get(0)},${t";
_coordsstr = (""+parent.__c.SmartStringFormatter("",(Object)(_coordsstr))+";"+parent.__c.SmartStringFormatter("",_tienda.Get((int) (0)))+","+parent.__c.SmartStringFormatter("",_tienda.Get((int) (1)))+","+parent.__c.SmartStringFormatter("",_tienda.Get((int) (2)))+"");
 if (true) break;

case 9:
//C
this.state = 34;
;
 if (true) break;
if (true) break;

case 10:
//C
this.state = 11;
;
 //BA.debugLineNum = 608;BA.debugLine="Log(coordsStr)";
parent.__c.LogImpl("511141137",_coordsstr,0);
 //BA.debugLineNum = 609;BA.debugLine="ProgressDialogShow2(\"Calculando distancia y tiemp";
parent.__c.ProgressDialogShow2(ba,BA.ObjectToCharSequence("Calculando distancia y tiempo, un momento por favor."),parent.__c.False);
 //BA.debugLineNum = 610;BA.debugLine="Dim j As HttpJob";
_j = new reparto_izca.keymon.lat.httpjob();
 //BA.debugLineNum = 611;BA.debugLine="j.Initialize(\"trip\", Me) 'Calculamos el resto de";
_j._initialize /*String*/ (ba,"trip",parent);
 //BA.debugLineNum = 612;BA.debugLine="j.Download($\"http://keymon.net:9002/ruteador?m=OS";
_j._download /*String*/ (("http://keymon.net:9002/ruteador?m=OSRM&r="+parent.__c.SmartStringFormatter("",(Object)(parent._subs._traerutareparto /*String*/ (ba)))+"&a="+parent.__c.SmartStringFormatter("",(Object)(parent._subs._traealmacen /*String*/ (ba)))+"&f=CEDIS,"+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude()))+","+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude()))+"&c="+parent.__c.SmartStringFormatter("",(Object)(_coordsstr))+""));
 //BA.debugLineNum = 613;BA.debugLine="Log($\"http://keymon.net:9002/ruteador?m=OSRM&r=${";
parent.__c.LogImpl("511141142",("http://keymon.net:9002/ruteador?m=OSRM&r="+parent.__c.SmartStringFormatter("",(Object)(parent._subs._traerutareparto /*String*/ (ba)))+"&a="+parent.__c.SmartStringFormatter("",(Object)(parent._subs._traealmacen /*String*/ (ba)))+"&f=CEDIS,"+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude()))+","+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude()))+"&c="+parent.__c.SmartStringFormatter("",(Object)(_coordsstr))+""),0);
 //BA.debugLineNum = 614;BA.debugLine="Wait For (j) JobDone(j As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j));
this.state = 35;
return;
case 35:
//C
this.state = 11;
_j = (reparto_izca.keymon.lat.httpjob) result[0];
;
 //BA.debugLineNum = 615;BA.debugLine="If j.Success Then";
if (true) break;

case 11:
//if
this.state = 32;
if (_j._success /*boolean*/ ) { 
this.state = 13;
}else {
this.state = 31;
}if (true) break;

case 13:
//C
this.state = 14;
 //BA.debugLineNum = 616;BA.debugLine="Dim jp As JSONParser";
_jp = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 617;BA.debugLine="jp.Initialize(j.GetString)";
_jp.Initialize(_j._getstring /*String*/ ());
 //BA.debugLineNum = 618;BA.debugLine="Dim m As Map = jp.NextObject";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m = _jp.NextObject();
 //BA.debugLineNum = 619;BA.debugLine="Log(m)";
parent.__c.LogImpl("511141148",BA.ObjectToString(_m),0);
 //BA.debugLineNum = 620;BA.debugLine="If m.Get(\"code\") = \"OK\" Then";
if (true) break;

case 14:
//if
this.state = 29;
if ((_m.Get((Object)("code"))).equals((Object)("OK"))) { 
this.state = 16;
}if (true) break;

case 16:
//C
this.state = 17;
 //BA.debugLineNum = 621;BA.debugLine="Log(\"=====   OK\")";
parent.__c.LogImpl("511141150","=====   OK",0);
 //BA.debugLineNum = 622;BA.debugLine="rutaGenerada = True";
parent._rutagenerada = parent.__c.True;
 //BA.debugLineNum = 623;BA.debugLine="Dim puntos As Int = m.Get(\"puntos\")";
_puntos = (int)(BA.ObjectToNumber(_m.Get((Object)("puntos"))));
 //BA.debugLineNum = 624;BA.debugLine="Private coords As List = m.Get(\"coords\")";
_coords = new anywheresoftware.b4a.objects.collections.List();
_coords = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_m.Get((Object)("coords"))));
 //BA.debugLineNum = 625;BA.debugLine="Private duration As String = m.Get(\"duration\")";
_duration = BA.ObjectToString(_m.Get((Object)("duration")));
 //BA.debugLineNum = 626;BA.debugLine="Private distance As String = m.Get(\"distance\")";
_distance = BA.ObjectToString(_m.Get((Object)("distance")));
 //BA.debugLineNum = 627;BA.debugLine="Private mensaje As String = m.Get(\"mensaje\")";
_mensaje = BA.ObjectToString(_m.Get((Object)("mensaje")));
 //BA.debugLineNum = 628;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from waypoint";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from waypoints");
 //BA.debugLineNum = 629;BA.debugLine="Starter.skmt.ExecNonQuery(\"update kmt_info set";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("update kmt_info set SECUENCIA = 0");
 //BA.debugLineNum = 630;BA.debugLine="For i = 0 To coords.Size - 1";
if (true) break;

case 17:
//for
this.state = 20;
step37 = 1;
limit37 = (int) (_coords.getSize()-1);
_i = (int) (0) ;
this.state = 36;
if (true) break;

case 36:
//C
this.state = 20;
if ((step37 > 0 && _i <= limit37) || (step37 < 0 && _i >= limit37)) this.state = 19;
if (true) break;

case 37:
//C
this.state = 36;
_i = ((int)(0 + _i + step37)) ;
if (true) break;

case 19:
//C
this.state = 37;
 //BA.debugLineNum = 631;BA.debugLine="Private ti As Map = coords.Get(i)";
_ti = new anywheresoftware.b4a.objects.collections.Map();
_ti = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_coords.Get(_i)));
 //BA.debugLineNum = 632;BA.debugLine="Starter.skmt.ExecNonQuery($\"update kmt_info se";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update kmt_info set SECUENCIA = "+parent.__c.SmartStringFormatter("",_ti.Get((Object)("pos")))+" where CAT_CL_CODIGO = '"+parent.__c.SmartStringFormatter("",(Object)((BA.ObjectToString(_ti.Get((Object)("id")))).substring((int) (1))))+"'"));
 //BA.debugLineNum = 633;BA.debugLine="Starter.skmt.ExecNonQuery($\"insert into waypoi";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("insert into waypoints (codigo, indice) values ('"+parent.__c.SmartStringFormatter("",(Object)((BA.ObjectToString(_ti.Get((Object)("id")))).substring((int) (1))))+"', '"+parent.__c.SmartStringFormatter("",_ti.Get((Object)("pos")))+"')"));
 if (true) break;
if (true) break;

case 20:
//C
this.state = 21;
;
 //BA.debugLineNum = 635;BA.debugLine="c = Starter.skmt.ExecQuery(\"select codigo, indi";
parent._c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select codigo, indice, CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_NOEXT from waypoints inner join kmt_info on waypoints.codigo = kmt_info.CAT_CL_CODIGO where gestion = 0 AND CAT_CL_RUTA <> 1000 order by indice")));
 //BA.debugLineNum = 636;BA.debugLine="If c.RowCount > 0 Then 'Ya hay waypoints en la";
if (true) break;

case 21:
//if
this.state = 28;
if (parent._c.getRowCount()>0) { 
this.state = 23;
}if (true) break;

case 23:
//C
this.state = 24;
 //BA.debugLineNum = 637;BA.debugLine="c.Position = 0";
parent._c.setPosition((int) (0));
 //BA.debugLineNum = 638;BA.debugLine="conMapa = True";
parent._conmapa = parent.__c.True;
 //BA.debugLineNum = 639;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 640;BA.debugLine="Dim cs, cs2 As CSBuilder";
_cs = new anywheresoftware.b4a.objects.CSBuilder();
_cs2 = new anywheresoftware.b4a.objects.CSBuilder();
 //BA.debugLineNum = 641;BA.debugLine="entro = 3";
parent._entro = BA.NumberToString(3);
 //BA.debugLineNum = 642;BA.debugLine="For i=0 To c.RowCount -1 'Generamos el listVie";
if (true) break;

case 24:
//for
this.state = 27;
step49 = 1;
limit49 = (int) (parent._c.getRowCount()-1);
_i = (int) (0) ;
this.state = 38;
if (true) break;

case 38:
//C
this.state = 27;
if ((step49 > 0 && _i <= limit49) || (step49 < 0 && _i >= limit49)) this.state = 26;
if (true) break;

case 39:
//C
this.state = 38;
_i = ((int)(0 + _i + step49)) ;
if (true) break;

case 26:
//C
this.state = 39;
 //BA.debugLineNum = 643;BA.debugLine="c.Position = i";
parent._c.setPosition(_i);
 //BA.debugLineNum = 644;BA.debugLine="cs.Initialize";
_cs.Initialize();
 //BA.debugLineNum = 645;BA.debugLine="cs2.Initialize";
_cs2.Initialize();
 //BA.debugLineNum = 646;BA.debugLine="ListView1.AddTwoLines(cs.Color(Colors.RGB(100";
parent._listview1.AddTwoLines(BA.ObjectToCharSequence(_cs.Color(parent.__c.Colors.RGB((int) (100),(int) (149),(int) (237))).Append(BA.ObjectToCharSequence(parent._c.GetString("codigo"))).PopAll().getObject()),BA.ObjectToCharSequence(_cs2.Append(BA.ObjectToCharSequence(parent._c.GetString("CAT_CL_NOMBRE"))).Color(parent.__c.Colors.RGB((int) (100),(int) (149),(int) (237))).Append(BA.ObjectToCharSequence(" Calle: ")).Pop().Append(BA.ObjectToCharSequence(parent._c.GetString("CAT_CL_CALLE").trim()+" "+parent._c.GetString("CAT_CL_NOEXT"))).PopAll().getObject()));
 if (true) break;
if (true) break;

case 27:
//C
this.state = 28;
;
 if (true) break;

case 28:
//C
this.state = 29;
;
 //BA.debugLineNum = 649;BA.debugLine="c.Close";
parent._c.Close();
 //BA.debugLineNum = 650;BA.debugLine="Log($\"Distancia total: $1.1{distance/1000} kms,";
parent.__c.LogImpl("511141179",("Distancia total: "+parent.__c.SmartStringFormatter("1.1",(Object)((double)(Double.parseDouble(_distance))/(double)1000))+" kms, tiempo aprox: "+parent.__c.SmartStringFormatter("1.1",(Object)((double)(Double.parseDouble(_duration))/(double)60))+" mins. ("+parent.__c.SmartStringFormatter("1.1",(Object)((double)(Double.parseDouble(_duration))/(double)60/(double)60))+" hrs)"),0);
 //BA.debugLineNum = 651;BA.debugLine="l_rutaInfo.Text = $\"Distancia: $1.1{distance/10";
parent._l_rutainfo.setText(BA.ObjectToCharSequence(("Distancia: "+parent.__c.SmartStringFormatter("1.1",(Object)((double)(Double.parseDouble(_distance))/(double)1000))+" kms, tiempo aprox: "+parent.__c.SmartStringFormatter("1.1",(Object)((double)(Double.parseDouble(_duration))/(double)60/(double)60))+" hrs"+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+"Visitas restantes: "+parent.__c.SmartStringFormatter("",(Object)(_puntos-1))+"")));
 //BA.debugLineNum = 652;BA.debugLine="l_rutaInfo.Width = Root.Width * 0.9";
parent._l_rutainfo.setWidth((int) (parent._root.getWidth()*0.9));
 //BA.debugLineNum = 653;BA.debugLine="Subs.centraEtiqueta(l_rutaInfo, Root.Width)";
parent._subs._centraetiqueta /*String*/ (ba,parent._l_rutainfo,parent._root.getWidth());
 //BA.debugLineNum = 654;BA.debugLine="l_rutaInfo.Visible = True";
parent._l_rutainfo.setVisible(parent.__c.True);
 //BA.debugLineNum = 655;BA.debugLine="l_rutaInfo.BringToFront";
parent._l_rutainfo.BringToFront();
 //BA.debugLineNum = 656;BA.debugLine="ListView1.Top = lv1Top + 100";
parent._listview1.setTop((int) ((double)(Double.parseDouble(parent._lv1top))+100));
 if (true) break;

case 29:
//C
this.state = 32;
;
 if (true) break;

case 31:
//C
this.state = 32;
 //BA.debugLineNum = 659;BA.debugLine="LogColor(\"****************  Error!  ************";
parent.__c.LogImpl("511141188","****************  Error!  ******************",parent.__c.Colors.Red);
 if (true) break;

case 32:
//C
this.state = -1;
;
 //BA.debugLineNum = 661;BA.debugLine="j.Release";
_j._release /*String*/ ();
 //BA.debugLineNum = 662;BA.debugLine="ProgressDialogHide";
parent.__c.ProgressDialogHide();
 //BA.debugLineNum = 663;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public void  _jobdone(reparto_izca.keymon.lat.httpjob _j) throws Exception{
}
public String  _class_globals() throws Exception{
 //BA.debugLineNum = 1;BA.debugLine="Sub Class_Globals";
 //BA.debugLineNum = 2;BA.debugLine="Private Root As B4XView 'ignore";
_root = new anywheresoftware.b4a.objects.B4XViewWrapper();
 //BA.debugLineNum = 3;BA.debugLine="Private xui As XUI 'ignore";
_xui = new anywheresoftware.b4a.objects.B4XViewWrapper.XUI();
 //BA.debugLineNum = 4;BA.debugLine="Dim q_buscar As String";
_q_buscar = "";
 //BA.debugLineNum = 6;BA.debugLine="Dim entro As String";
_entro = "";
 //BA.debugLineNum = 7;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 8;BA.debugLine="Dim c2 As Cursor";
_c2 = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
 //BA.debugLineNum = 9;BA.debugLine="Dim ListView1 As ListView";
_listview1 = new anywheresoftware.b4a.objects.ListViewWrapper();
 //BA.debugLineNum = 11;BA.debugLine="Dim lfila As Label";
_lfila = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 12;BA.debugLine="Dim busca As EditText";
_busca = new anywheresoftware.b4a.objects.EditTextWrapper();
 //BA.debugLineNum = 13;BA.debugLine="Private p_colonia As Panel";
_p_colonia = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 16;BA.debugLine="Dim laRuta As String";
_laruta = "";
 //BA.debugLineNum = 17;BA.debugLine="Private b_GetDirs As Button";
_b_getdirs = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 18;BA.debugLine="Private distOrderedMap, clientesMapaO As B4XOrder";
_distorderedmap = new reparto_izca.keymon.lat.b4xorderedmap();
_clientesmapao = new reparto_izca.keymon.lat.b4xorderedmap();
 //BA.debugLineNum = 19;BA.debugLine="Private img_getDirs As ImageView";
_img_getdirs = new anywheresoftware.b4a.objects.ImageViewWrapper();
 //BA.debugLineNum = 20;BA.debugLine="Private l_rutaInfo As Label";
_l_rutainfo = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 21;BA.debugLine="Private b_getRutaInfo As Button";
_b_getrutainfo = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 22;BA.debugLine="Private conMapa As Boolean = False";
_conmapa = __c.False;
 //BA.debugLineNum = 23;BA.debugLine="Dim listaWayPoints As List";
_listawaypoints = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 24;BA.debugLine="Dim lv1Top As String";
_lv1top = "";
 //BA.debugLineNum = 25;BA.debugLine="Private b_limpiarRuta As Button";
_b_limpiarruta = new anywheresoftware.b4a.objects.ButtonWrapper();
 //BA.debugLineNum = 26;BA.debugLine="Dim rutaGenerada As Boolean = False";
_rutagenerada = __c.False;
 //BA.debugLineNum = 27;BA.debugLine="Dim rutaacambiar As String";
_rutaacambiar = "";
 //BA.debugLineNum = 28;BA.debugLine="End Sub";
return "";
}
public anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _distanciaentrecoords(String _id,String _coords1,String _coords2) throws Exception{
ResumableSub_distanciaEntreCoords rsub = new ResumableSub_distanciaEntreCoords(this,_id,_coords1,_coords2);
rsub.resume(ba, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_distanciaEntreCoords extends BA.ResumableSub {
public ResumableSub_distanciaEntreCoords(reparto_izca.keymon.lat.c_clientes parent,String _id,String _coords1,String _coords2) {
this.parent = parent;
this._id = _id;
this._coords1 = _coords1;
this._coords2 = _coords2;
}
reparto_izca.keymon.lat.c_clientes parent;
String _id;
String _coords1;
String _coords2;
String _distanciatotal = "";
String _tiempo = "";
reparto_izca.keymon.lat.httpjob _j = null;
anywheresoftware.b4a.objects.collections.JSONParser _jp = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
anywheresoftware.b4a.objects.collections.List _rutas = null;
anywheresoftware.b4a.objects.collections.Map _rutas2 = null;
anywheresoftware.b4a.objects.collections.List _r = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
{
parent.__c.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = 1;
 //BA.debugLineNum = 263;BA.debugLine="Sleep(1050)";
parent.__c.Sleep(ba,this,(int) (1050));
this.state = 11;
return;
case 11:
//C
this.state = 1;
;
 //BA.debugLineNum = 264;BA.debugLine="Private distanciaTotal As String = \"0\"";
_distanciatotal = "0";
 //BA.debugLineNum = 265;BA.debugLine="Private tiempo As String = \"0\"";
_tiempo = "0";
 //BA.debugLineNum = 266;BA.debugLine="Dim j As HttpJob";
_j = new reparto_izca.keymon.lat.httpjob();
 //BA.debugLineNum = 267;BA.debugLine="j.Initialize(\"\", Me)";
_j._initialize /*String*/ (ba,"",parent);
 //BA.debugLineNum = 268;BA.debugLine="j.Download(\"https://router.project-osrm.org/route";
_j._download /*String*/ ("https://router.project-osrm.org/route/v1/driving/"+_coords1+";"+_coords2+"?overview=false");
 //BA.debugLineNum = 269;BA.debugLine="Wait For (j) JobDone(j As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j));
this.state = 12;
return;
case 12:
//C
this.state = 1;
_j = (reparto_izca.keymon.lat.httpjob) result[0];
;
 //BA.debugLineNum = 270;BA.debugLine="If j.Success Then";
if (true) break;

case 1:
//if
this.state = 10;
if (_j._success /*boolean*/ ) { 
this.state = 3;
}else {
this.state = 9;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 271;BA.debugLine="Dim jp As JSONParser";
_jp = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 272;BA.debugLine="jp.Initialize(j.GetString)";
_jp.Initialize(_j._getstring /*String*/ ());
 //BA.debugLineNum = 273;BA.debugLine="Dim m As Map = jp.NextObject";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m = _jp.NextObject();
 //BA.debugLineNum = 274;BA.debugLine="Log($\"Respuesta: ${m.Get(\"code\")}\"$)";
parent.__c.LogImpl("510682380",("Respuesta: "+parent.__c.SmartStringFormatter("",_m.Get((Object)("code")))+""),0);
 //BA.debugLineNum = 275;BA.debugLine="If m.Get(\"code\") = \"Ok\" Then";
if (true) break;

case 4:
//if
this.state = 7;
if ((_m.Get((Object)("code"))).equals((Object)("Ok"))) { 
this.state = 6;
}if (true) break;

case 6:
//C
this.state = 7;
 //BA.debugLineNum = 277;BA.debugLine="Dim rutas As List = m.Get(\"routes\")";
_rutas = new anywheresoftware.b4a.objects.collections.List();
_rutas = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_m.Get((Object)("routes"))));
 //BA.debugLineNum = 278;BA.debugLine="Dim rutas2 As Map = rutas.Get(0)";
_rutas2 = new anywheresoftware.b4a.objects.collections.Map();
_rutas2 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_rutas.Get((int) (0))));
 //BA.debugLineNum = 282;BA.debugLine="distanciaTotal = rutas2.Get(\"distance\")";
_distanciatotal = BA.ObjectToString(_rutas2.Get((Object)("distance")));
 //BA.debugLineNum = 283;BA.debugLine="tiempo = rutas2.Get(\"duration\")";
_tiempo = BA.ObjectToString(_rutas2.Get((Object)("duration")));
 //BA.debugLineNum = 284;BA.debugLine="Log($\"Distancia total: ${distanciaTotal}, Tiemp";
parent.__c.LogImpl("510682390",("Distancia total: "+parent.__c.SmartStringFormatter("",(Object)(_distanciatotal))+", Tiempo: "+parent.__c.SmartStringFormatter("",(Object)(_tiempo))+""),0);
 if (true) break;

case 7:
//C
this.state = 10;
;
 if (true) break;

case 9:
//C
this.state = 10;
 //BA.debugLineNum = 287;BA.debugLine="Log(\"Error!\")";
parent.__c.LogImpl("510682393","Error!",0);
 if (true) break;

case 10:
//C
this.state = -1;
;
 //BA.debugLineNum = 289;BA.debugLine="j.Release";
_j._release /*String*/ ();
 //BA.debugLineNum = 290;BA.debugLine="Private r As List";
_r = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 291;BA.debugLine="r.Initialize";
_r.Initialize();
 //BA.debugLineNum = 292;BA.debugLine="r.Add(id)";
_r.Add((Object)(_id));
 //BA.debugLineNum = 293;BA.debugLine="r.Add(distanciaTotal)";
_r.Add((Object)(_distanciatotal));
 //BA.debugLineNum = 294;BA.debugLine="r.Add(tiempo)";
_r.Add((Object)(_tiempo));
 //BA.debugLineNum = 295;BA.debugLine="Return r";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)(_r));return;};
 //BA.debugLineNum = 296;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public void  _generalistviewrutas() throws Exception{
ResumableSub_generaListViewRutas rsub = new ResumableSub_generaListViewRutas(this);
rsub.resume(ba, null);
}
public static class ResumableSub_generaListViewRutas extends BA.ResumableSub {
public ResumableSub_generaListViewRutas(reparto_izca.keymon.lat.c_clientes parent) {
this.parent = parent;
}
reparto_izca.keymon.lat.c_clientes parent;
anywheresoftware.b4a.objects.LabelWrapper _label1 = null;
anywheresoftware.b4a.objects.LabelWrapper _label2 = null;
int _i = 0;
int step16;
int limit16;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 196;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 197;BA.debugLine="Sleep(110)";
parent.__c.Sleep(ba,this,(int) (110));
this.state = 9;
return;
case 9:
//C
this.state = 1;
;
 //BA.debugLineNum = 198;BA.debugLine="lfila.Text = \"RUTA PREVENTA\"";
parent._lfila.setText(BA.ObjectToCharSequence("RUTA PREVENTA"));
 //BA.debugLineNum = 199;BA.debugLine="Dim label1 As Label";
_label1 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 200;BA.debugLine="label1 = ListView1.TwoLinesLayout.Label";
_label1 = parent._listview1.getTwoLinesLayout().Label;
 //BA.debugLineNum = 201;BA.debugLine="label1.TextSize = 15";
_label1.setTextSize((float) (15));
 //BA.debugLineNum = 202;BA.debugLine="label1.TextColor = Colors.Black";
_label1.setTextColor(parent.__c.Colors.Black);
 //BA.debugLineNum = 203;BA.debugLine="Dim label2 As Label";
_label2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 204;BA.debugLine="label2 = ListView1.TwoLinesLayout.SecondLabel";
_label2 = parent._listview1.getTwoLinesLayout().SecondLabel;
 //BA.debugLineNum = 205;BA.debugLine="label2.TextSize = 15";
_label2.setTextSize((float) (15));
 //BA.debugLineNum = 206;BA.debugLine="label2.TextColor = Colors.Black";
_label2.setTextColor(parent.__c.Colors.Black);
 //BA.debugLineNum = 207;BA.debugLine="ListView1.TwoLinesLayout.ItemHeight = 60dip";
parent._listview1.getTwoLinesLayout().setItemHeight(parent.__c.DipToCurrent((int) (60)));
 //BA.debugLineNum = 208;BA.debugLine="c=Starter.skmt.ExecQuery(\"select CAT_CL_RUTA, cou";
parent._c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CAT_CL_RUTA, count(*) as cuantos from kmt_info where gestion = 0 AND CAT_CL_RUTA <> 1000 group by CAT_CL_RUTA order by CAT_CL_RUTA asc")));
 //BA.debugLineNum = 209;BA.debugLine="If c.RowCount>0 Then";
if (true) break;

case 1:
//if
this.state = 8;
if (parent._c.getRowCount()>0) { 
this.state = 3;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 210;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 211;BA.debugLine="For i=0 To c.RowCount -1";
if (true) break;

case 4:
//for
this.state = 7;
step16 = 1;
limit16 = (int) (parent._c.getRowCount()-1);
_i = (int) (0) ;
this.state = 10;
if (true) break;

case 10:
//C
this.state = 7;
if ((step16 > 0 && _i <= limit16) || (step16 < 0 && _i >= limit16)) this.state = 6;
if (true) break;

case 11:
//C
this.state = 10;
_i = ((int)(0 + _i + step16)) ;
if (true) break;

case 6:
//C
this.state = 11;
 //BA.debugLineNum = 212;BA.debugLine="c.Position=i";
parent._c.setPosition(_i);
 //BA.debugLineNum = 213;BA.debugLine="ListView1.AddTwoLines(\"Ruta: \" & c.GetString(\"C";
parent._listview1.AddTwoLines(BA.ObjectToCharSequence("Ruta: "+parent._c.GetString("CAT_CL_RUTA")),BA.ObjectToCharSequence("Por visitar:  "+parent._c.GetString("cuantos")));
 if (true) break;
if (true) break;

case 7:
//C
this.state = 8;
;
 if (true) break;

case 8:
//C
this.state = -1;
;
 //BA.debugLineNum = 216;BA.debugLine="c.Close";
parent._c.Close();
 //BA.debugLineNum = 217;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public Object  _initialize(anywheresoftware.b4a.BA _ba) throws Exception{
innerInitialize(_ba);
 //BA.debugLineNum = 31;BA.debugLine="Public Sub Initialize As Object";
 //BA.debugLineNum = 32;BA.debugLine="Return Me";
if (true) return this;
 //BA.debugLineNum = 33;BA.debugLine="End Sub";
return null;
}
public void  _listview1_itemclick(int _position,Object _value) throws Exception{
ResumableSub_ListView1_ItemClick rsub = new ResumableSub_ListView1_ItemClick(this,_position,_value);
rsub.resume(ba, null);
}
public static class ResumableSub_ListView1_ItemClick extends BA.ResumableSub {
public ResumableSub_ListView1_ItemClick(reparto_izca.keymon.lat.c_clientes parent,int _position,Object _value) {
this.parent = parent;
this._position = _position;
this._value = _value;
}
reparto_izca.keymon.lat.c_clientes parent;
int _position;
Object _value;
String _lrt = "";
anywheresoftware.b4a.gps.LocationWrapper _thisloc = null;
anywheresoftware.b4a.objects.LabelWrapper _label1 = null;
anywheresoftware.b4a.objects.LabelWrapper _label2 = null;
int _i = 0;
int _distancia = 0;
anywheresoftware.b4a.objects.collections.Map _estecliente = null;
anywheresoftware.b4a.objects.collections.Map _m1 = null;
Object _k = null;
int step34;
int limit34;
anywheresoftware.b4a.BA.IterableList group45;
int index45;
int groupLen45;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 129;BA.debugLine="Log(Value)";
parent.__c.LogImpl("510420226",BA.ObjectToString(_value),0);
 //BA.debugLineNum = 130;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 131;BA.debugLine="Sleep(50)";
parent.__c.Sleep(ba,this,(int) (50));
this.state = 31;
return;
case 31:
//C
this.state = 1;
;
 //BA.debugLineNum = 132;BA.debugLine="Subs.SetDivider(ListView1, Colors.LightGray, 2)";
parent._subs._setdivider /*String*/ (ba,parent._listview1,parent.__c.Colors.LightGray,(int) (2));
 //BA.debugLineNum = 133;BA.debugLine="If Not(l_rutaInfo.Visible) Then";
if (true) break;

case 1:
//if
this.state = 6;
if (parent.__c.Not(parent._l_rutainfo.getVisible())) { 
this.state = 3;
}else {
this.state = 5;
}if (true) break;

case 3:
//C
this.state = 6;
 //BA.debugLineNum = 134;BA.debugLine="ListView1.Top = lv1Top";
parent._listview1.setTop((int)(Double.parseDouble(parent._lv1top)));
 if (true) break;

case 5:
//C
this.state = 6;
 //BA.debugLineNum = 136;BA.debugLine="ListView1.Top = lv1Top + 100";
parent._listview1.setTop((int) ((double)(Double.parseDouble(parent._lv1top))+100));
 if (true) break;

case 6:
//C
this.state = 7;
;
 //BA.debugLineNum = 138;BA.debugLine="l_rutaInfo.Visible = False";
parent._l_rutainfo.setVisible(parent.__c.False);
 //BA.debugLineNum = 139;BA.debugLine="b_GetDirs.Visible = False";
parent._b_getdirs.setVisible(parent.__c.False);
 //BA.debugLineNum = 140;BA.debugLine="If entro = \"2\" Then";
if (true) break;

case 7:
//if
this.state = 30;
if ((parent._entro).equals("2")) { 
this.state = 9;
}else if((parent._entro).equals("3")) { 
this.state = 29;
}if (true) break;

case 9:
//C
this.state = 10;
 //BA.debugLineNum = 144;BA.debugLine="Private lrt As String";
_lrt = "";
 //BA.debugLineNum = 145;BA.debugLine="lrt = Value";
_lrt = BA.ObjectToString(_value);
 //BA.debugLineNum = 146;BA.debugLine="laRuta = lrt.SubString(6) 'Quitamos el texto \"Ru";
parent._laruta = _lrt.substring((int) (6));
 //BA.debugLineNum = 147;BA.debugLine="Log($\"Original: ${Value} - Mod: |${lrt.SubString";
parent.__c.LogImpl("510420244",("Original: "+parent.__c.SmartStringFormatter("",_value)+" - Mod: |"+parent.__c.SmartStringFormatter("",(Object)(_lrt.substring((int) (6))))+"| - laRuta: "+parent.__c.SmartStringFormatter("",(Object)(parent._laruta))+""),0);
 //BA.debugLineNum = 148;BA.debugLine="rutaacambiar = laRuta";
parent._rutaacambiar = parent._laruta;
 //BA.debugLineNum = 149;BA.debugLine="c2 = Starter.skmt.ExecQuery2(\"select CAT_CL_NOMB";
parent._c2 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO, CAT_CL_LAT, CAT_CL_LONG from kmt_info where CAT_CL_RUTA = ? and gestion = 0 AND CAT_CL_RUTA <> 1000 order by CAT_CL_NOMBRE ",new String[]{parent._laruta})));
 //BA.debugLineNum = 150;BA.debugLine="Private thisLoc As Location";
_thisloc = new anywheresoftware.b4a.gps.LocationWrapper();
 //BA.debugLineNum = 151;BA.debugLine="Private label1 As Label";
_label1 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 152;BA.debugLine="Private label2 As Label";
_label2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 153;BA.debugLine="label1 = ListView1.TwoLinesLayout.Label";
_label1 = parent._listview1.getTwoLinesLayout().Label;
 //BA.debugLineNum = 154;BA.debugLine="label1.TextSize = 15";
_label1.setTextSize((float) (15));
 //BA.debugLineNum = 155;BA.debugLine="label1.TextColor = Colors.black";
_label1.setTextColor(parent.__c.Colors.Black);
 //BA.debugLineNum = 156;BA.debugLine="label2 = ListView1.TwoLinesLayout.SecondLabel";
_label2 = parent._listview1.getTwoLinesLayout().SecondLabel;
 //BA.debugLineNum = 157;BA.debugLine="label2.TextSize = 15";
_label2.setTextSize((float) (15));
 //BA.debugLineNum = 158;BA.debugLine="label2.TextColor = Colors.black";
_label2.setTextColor(parent.__c.Colors.Black);
 //BA.debugLineNum = 159;BA.debugLine="label2.Height = 57dip";
_label2.setHeight(parent.__c.DipToCurrent((int) (57)));
 //BA.debugLineNum = 160;BA.debugLine="thisLoc.Initialize";
_thisloc.Initialize();
 //BA.debugLineNum = 161;BA.debugLine="If entro = 2 Then ListView1.TwoLinesLayout.ItemH";
if (true) break;

case 10:
//if
this.state = 15;
if ((parent._entro).equals(BA.NumberToString(2))) { 
this.state = 12;
;}if (true) break;

case 12:
//C
this.state = 15;
parent._listview1.getTwoLinesLayout().setItemHeight(parent.__c.DipToCurrent((int) (90)));
if (true) break;

case 15:
//C
this.state = 16;
;
 //BA.debugLineNum = 162;BA.debugLine="lfila.text = \"Nombre y Calle\"";
parent._lfila.setText(BA.ObjectToCharSequence("Nombre y Calle"));
 //BA.debugLineNum = 163;BA.debugLine="distOrderedMap.Initialize";
parent._distorderedmap._initialize /*String*/ (ba);
 //BA.debugLineNum = 164;BA.debugLine="If c2.RowCount > 0 Then";
if (true) break;

case 16:
//if
this.state = 27;
if (parent._c2.getRowCount()>0) { 
this.state = 18;
}if (true) break;

case 18:
//C
this.state = 19;
 //BA.debugLineNum = 165;BA.debugLine="For i = 0 To c2.RowCount -1 'Generamos mapa de";
if (true) break;

case 19:
//for
this.state = 22;
step34 = 1;
limit34 = (int) (parent._c2.getRowCount()-1);
_i = (int) (0) ;
this.state = 32;
if (true) break;

case 32:
//C
this.state = 22;
if ((step34 > 0 && _i <= limit34) || (step34 < 0 && _i >= limit34)) this.state = 21;
if (true) break;

case 33:
//C
this.state = 32;
_i = ((int)(0 + _i + step34)) ;
if (true) break;

case 21:
//C
this.state = 33;
 //BA.debugLineNum = 166;BA.debugLine="c2.Position = i";
parent._c2.setPosition(_i);
 //BA.debugLineNum = 167;BA.debugLine="thisLoc.Latitude = c2.GetString(\"CAT_CL_LAT\")";
_thisloc.setLatitude((double)(Double.parseDouble(parent._c2.GetString("CAT_CL_LAT"))));
 //BA.debugLineNum = 168;BA.debugLine="thisLoc.Longitude = c2.GetString(\"CAT_CL_LONG\"";
_thisloc.setLongitude((double)(Double.parseDouble(parent._c2.GetString("CAT_CL_LONG"))));
 //BA.debugLineNum = 170;BA.debugLine="Private distancia As Int = Tracker.UUGCoords.D";
_distancia = (int) (parent._tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ .DistanceTo((android.location.Location)(_thisloc.getObject())));
 //BA.debugLineNum = 171;BA.debugLine="Private esteCliente As Map = CreateMap(\"distan";
_estecliente = new anywheresoftware.b4a.objects.collections.Map();
_estecliente = parent.__c.createMap(new Object[] {(Object)("distancia"),(Object)(_distancia),(Object)("ubicacion"),(Object)(BA.NumberToString(_thisloc.getLongitude())+","+BA.NumberToString(_thisloc.getLatitude())),(Object)("codigo"),(Object)(parent._c2.GetString("CAT_CL_CODIGO")),(Object)("nomDirDist"),(Object)((""+parent.__c.SmartStringFormatter("",(Object)(parent._c2.GetString("CAT_CL_NOMBRE")))+" CALLE: "+parent.__c.SmartStringFormatter("",(Object)(parent._c2.GetString("CAT_CL_CALLE")))+" "+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+"Distancia: "+parent.__c.SmartStringFormatter("1.1",(Object)((_distancia/(double)1000)))+" kms"))});
 //BA.debugLineNum = 172;BA.debugLine="distOrderedMap.Put(distancia, esteCliente)";
parent._distorderedmap._put /*String*/ ((Object)(_distancia),(Object)(_estecliente.getObject()));
 if (true) break;
if (true) break;

case 22:
//C
this.state = 23;
;
 //BA.debugLineNum = 174;BA.debugLine="distOrderedMap.Keys.Sort(True) 'Ordenamos la ma";
parent._distorderedmap._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().Sort(parent.__c.True);
 //BA.debugLineNum = 175;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 176;BA.debugLine="Private m1 As Map";
_m1 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 177;BA.debugLine="For Each k As Object In distOrderedMap.Keys  'G";
if (true) break;

case 23:
//for
this.state = 26;
group45 = parent._distorderedmap._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ();
index45 = 0;
groupLen45 = group45.getSize();
this.state = 34;
if (true) break;

case 34:
//C
this.state = 26;
if (index45 < groupLen45) {
this.state = 25;
_k = group45.Get(index45);}
if (true) break;

case 35:
//C
this.state = 34;
index45++;
if (true) break;

case 25:
//C
this.state = 35;
 //BA.debugLineNum = 178;BA.debugLine="m1 = distOrderedMap.Get(k)";
_m1 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(parent._distorderedmap._get /*Object*/ (_k)));
 //BA.debugLineNum = 179;BA.debugLine="m1.Get(\"codigo\")";
_m1.Get((Object)("codigo"));
 //BA.debugLineNum = 181;BA.debugLine="ListView1.AddTwoLines(m1.Get(\"codigo\"), m1.Get";
parent._listview1.AddTwoLines(BA.ObjectToCharSequence(_m1.Get((Object)("codigo"))),BA.ObjectToCharSequence(_m1.Get((Object)("nomDirDist"))));
 if (true) break;
if (true) break;

case 26:
//C
this.state = 27;
;
 if (true) break;

case 27:
//C
this.state = 30;
;
 //BA.debugLineNum = 184;BA.debugLine="c2.Close";
parent._c2.Close();
 //BA.debugLineNum = 185;BA.debugLine="entro = \"3\"";
parent._entro = "3";
 if (true) break;

case 29:
//C
this.state = 30;
 //BA.debugLineNum = 188;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from CUENTAA\")";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from CUENTAA");
 //BA.debugLineNum = 189;BA.debugLine="Starter.skmt.ExecNonQuery2(\"INSERT INTO CUENTAA";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO CUENTAA VALUES (?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{_value}));
 //BA.debugLineNum = 190;BA.debugLine="B4XPages.ShowPage(\"Cliente\")";
parent._b4xpages._showpage /*String*/ (ba,"Cliente");
 if (true) break;

case 30:
//C
this.state = -1;
;
 //BA.debugLineNum = 192;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public anywheresoftware.b4a.objects.collections.List  _todosavisitar() throws Exception{
String _sqlderuta = "";
anywheresoftware.b4a.objects.collections.List _avisitar = null;
anywheresoftware.b4a.objects.collections.List _tmplist = null;
anywheresoftware.b4a.sql.SQL.ResultSetWrapper _coords = null;
 //BA.debugLineNum = 666;BA.debugLine="Sub todosAVisitar As List";
 //BA.debugLineNum = 667;BA.debugLine="Log(laRuta)";
__c.LogImpl("511206657",_laruta,0);
 //BA.debugLineNum = 668;BA.debugLine="Log(entro)";
__c.LogImpl("511206658",_entro,0);
 //BA.debugLineNum = 669;BA.debugLine="Private sqlDeRuta As String = \"\"";
_sqlderuta = "";
 //BA.debugLineNum = 670;BA.debugLine="If entro = 3 Then sqlDeRuta = $\"and CAT_CL_RUTA =";
if ((_entro).equals(BA.NumberToString(3))) { 
_sqlderuta = ("and CAT_CL_RUTA = '"+__c.SmartStringFormatter("",(Object)(_laruta))+"'");};
 //BA.debugLineNum = 671;BA.debugLine="Private aVisitar, tmpList As List";
_avisitar = new anywheresoftware.b4a.objects.collections.List();
_tmplist = new anywheresoftware.b4a.objects.collections.List();
 //BA.debugLineNum = 672;BA.debugLine="aVisitar.Initialize";
_avisitar.Initialize();
 //BA.debugLineNum = 673;BA.debugLine="Private coords As ResultSet = Starter.skmt.ExecQu";
_coords = new anywheresoftware.b4a.sql.SQL.ResultSetWrapper();
_coords = (anywheresoftware.b4a.sql.SQL.ResultSetWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.ResultSetWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("select CAT_CL_CODIGO, CAT_CL_LAT, CAT_CL_LONG from kmt_info where gestion = 0 AND CAT_CL_RUTA <> 1000 "+__c.SmartStringFormatter("",(Object)(_sqlderuta))+""))));
 //BA.debugLineNum = 674;BA.debugLine="Do While coords.NextRow";
while (_coords.NextRow()) {
 //BA.debugLineNum = 675;BA.debugLine="tmpList.Initialize";
_tmplist.Initialize();
 //BA.debugLineNum = 676;BA.debugLine="tmpList.AddAll(Array As String(coords.GetString(";
_tmplist.AddAll(anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{_coords.GetString("CAT_CL_CODIGO"),_coords.GetString("CAT_CL_LONG"),_coords.GetString("CAT_CL_LAT")}));
 //BA.debugLineNum = 677;BA.debugLine="aVisitar.Add(tmpList)";
_avisitar.Add((Object)(_tmplist.getObject()));
 }
;
 //BA.debugLineNum = 679;BA.debugLine="Log(aVisitar)";
__c.LogImpl("511206669",BA.ObjectToString(_avisitar),0);
 //BA.debugLineNum = 680;BA.debugLine="Return aVisitar";
if (true) return _avisitar;
 //BA.debugLineNum = 681;BA.debugLine="End Sub";
return null;
}
public void  _traerutadia(reparto_izca.keymon.lat.b4xorderedmap _avisitar) throws Exception{
ResumableSub_traeRutaDia rsub = new ResumableSub_traeRutaDia(this,_avisitar);
rsub.resume(ba, null);
}
public static class ResumableSub_traeRutaDia extends BA.ResumableSub {
public ResumableSub_traeRutaDia(reparto_izca.keymon.lat.c_clientes parent,reparto_izca.keymon.lat.b4xorderedmap _avisitar) {
this.parent = parent;
this._avisitar = _avisitar;
}
reparto_izca.keymon.lat.c_clientes parent;
reparto_izca.keymon.lat.b4xorderedmap _avisitar;
String _coordsinicio = "";
String _rutacompleta = "";
String _preruta = "";
double _distanciatotal = 0;
double _distanciatotal0 = 0;
double _tiempo0 = 0;
double _tiempo = 0;
boolean _masde100 = false;
anywheresoftware.b4a.objects.collections.Map _m4 = null;
int _visitaactual = 0;
int _cuantosantes = 0;
Object _k = null;
double _tiempovisitas = 0;
reparto_izca.keymon.lat.httpjob _j0 = null;
anywheresoftware.b4a.objects.collections.JSONParser _jp0 = null;
anywheresoftware.b4a.objects.collections.Map _m0 = null;
anywheresoftware.b4a.objects.collections.List _puntos0 = null;
anywheresoftware.b4a.objects.collections.Map _estewaypoint0 = null;
int _p = 0;
anywheresoftware.b4a.objects.collections.List _rutas0 = null;
anywheresoftware.b4a.objects.collections.Map _rutas20 = null;
reparto_izca.keymon.lat.httpjob _j = null;
anywheresoftware.b4a.objects.collections.JSONParser _jp = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
anywheresoftware.b4a.objects.collections.List _puntos = null;
anywheresoftware.b4a.objects.collections.Map _estewaypoint = null;
int _twpi = 0;
anywheresoftware.b4a.objects.collections.List _rutas = null;
anywheresoftware.b4a.objects.collections.Map _rutas2 = null;
int _r = 0;
anywheresoftware.b4a.objects.collections.Map _r1 = null;
anywheresoftware.b4a.objects.collections.Map _wps = null;
anywheresoftware.b4a.objects.LabelWrapper _label2 = null;
anywheresoftware.b4a.objects.CSBuilder _cs = null;
anywheresoftware.b4a.objects.CSBuilder _cs2 = null;
int _i = 0;
anywheresoftware.b4a.BA.IterableList group18;
int index18;
int groupLen18;
int step47;
int limit47;
int step78;
int limit78;
anywheresoftware.b4a.BA.IterableList group112;
int index112;
int groupLen112;
int step135;
int limit135;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 301;BA.debugLine="Private coordsInicio As String = $\"${Starter.cedi";
_coordsinicio = (""+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude()))+","+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude()))+"");
 //BA.debugLineNum = 302;BA.debugLine="Log($\"Coordenadas de inicio: ${Starter.cedisLocat";
parent.__c.LogImpl("510747906",("Coordenadas de inicio: "+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLongitude()))+","+parent.__c.SmartStringFormatter("",(Object)(parent._starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ .getLatitude()))+""),0);
 //BA.debugLineNum = 303;BA.debugLine="Private rutaCompleta As String = coordsInicio";
_rutacompleta = _coordsinicio;
 //BA.debugLineNum = 304;BA.debugLine="Private preRuta As String = coordsInicio";
_preruta = _coordsinicio;
 //BA.debugLineNum = 305;BA.debugLine="Private distanciaTotal, distanciaTotal0, tiempo0,";
_distanciatotal = 0;
_distanciatotal0 = 0;
_tiempo0 = 0;
_tiempo = 0;
 //BA.debugLineNum = 306;BA.debugLine="Private masDe100 As Boolean";
_masde100 = false;
 //BA.debugLineNum = 307;BA.debugLine="Private m4 As Map";
_m4 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 308;BA.debugLine="Private visitaActual As Int = 0";
_visitaactual = (int) (0);
 //BA.debugLineNum = 309;BA.debugLine="Private cuantosAntes As Int = 0";
_cuantosantes = (int) (0);
 //BA.debugLineNum = 310;BA.debugLine="listaWayPoints.Initialize";
parent._listawaypoints.Initialize();
 //BA.debugLineNum = 311;BA.debugLine="If aVisitar.Keys.Size > 98 Then 'Si los clientes";
if (true) break;

case 1:
//if
this.state = 4;
if (_avisitar._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().getSize()>98) { 
this.state = 3;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 312;BA.debugLine="cuantosAntes = aVisitar.Keys.Size - 98 'Definimo";
_cuantosantes = (int) (_avisitar._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().getSize()-98);
 //BA.debugLineNum = 313;BA.debugLine="preRuta = coordsInicio 'Ponemos las coordenadas";
_preruta = _coordsinicio;
 //BA.debugLineNum = 314;BA.debugLine="rutaCompleta = \"\"";
_rutacompleta = "";
 //BA.debugLineNum = 315;BA.debugLine="masDe100 = True";
_masde100 = parent.__c.True;
 if (true) break;

case 4:
//C
this.state = 5;
;
 //BA.debugLineNum = 317;BA.debugLine="Log($\"a visitar: ${aVisitar.Keys.Size}\"$)";
parent.__c.LogImpl("510747921",("a visitar: "+parent.__c.SmartStringFormatter("",(Object)(_avisitar._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().getSize()))+""),0);
 //BA.debugLineNum = 318;BA.debugLine="For Each k As Object In aVisitar.Keys";
if (true) break;

case 5:
//for
this.state = 15;
group18 = _avisitar._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ();
index18 = 0;
groupLen18 = group18.getSize();
this.state = 70;
if (true) break;

case 70:
//C
this.state = 15;
if (index18 < groupLen18) {
this.state = 7;
_k = group18.Get(index18);}
if (true) break;

case 71:
//C
this.state = 70;
index18++;
if (true) break;

case 7:
//C
this.state = 8;
 //BA.debugLineNum = 319;BA.debugLine="visitaActual = visitaActual + 1";
_visitaactual = (int) (_visitaactual+1);
 //BA.debugLineNum = 320;BA.debugLine="m4 = aVisitar.Get(k)";
_m4 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_avisitar._get /*Object*/ (_k)));
 //BA.debugLineNum = 322;BA.debugLine="If visitaActual < cuantosAntes + 2 Then 'Si esta";
if (true) break;

case 8:
//if
this.state = 11;
if (_visitaactual<_cuantosantes+2) { 
this.state = 10;
}if (true) break;

case 10:
//C
this.state = 11;
 //BA.debugLineNum = 323;BA.debugLine="preRuta = preRuta & \";\" & m4.Get(\"coords\")";
_preruta = _preruta+";"+BA.ObjectToString(_m4.Get((Object)("coords")));
 if (true) break;
;
 //BA.debugLineNum = 326;BA.debugLine="If visitaActual >= cuantosAntes + 2 Then 'Si est";

case 11:
//if
this.state = 14;
if (_visitaactual>=_cuantosantes+2) { 
this.state = 13;
}if (true) break;

case 13:
//C
this.state = 14;
 //BA.debugLineNum = 327;BA.debugLine="rutaCompleta = rutaCompleta & \";\" & m4.Get(\"coo";
_rutacompleta = _rutacompleta+";"+BA.ObjectToString(_m4.Get((Object)("coords")));
 if (true) break;

case 14:
//C
this.state = 71;
;
 if (true) break;
if (true) break;

case 15:
//C
this.state = 16;
;
 //BA.debugLineNum = 331;BA.debugLine="rutaCompleta = rutaCompleta & \";\" & coordsInicio";
_rutacompleta = _rutacompleta+";"+_coordsinicio;
 //BA.debugLineNum = 333;BA.debugLine="If rutaCompleta.StartsWith(\";\") Then rutaCompleta";
if (true) break;

case 16:
//if
this.state = 21;
if (_rutacompleta.startsWith(";")) { 
this.state = 18;
;}if (true) break;

case 18:
//C
this.state = 21;
_rutacompleta = _rutacompleta.substring((int) (1));
if (true) break;

case 21:
//C
this.state = 22;
;
 //BA.debugLineNum = 336;BA.debugLine="ProgressDialogShow2(\"Calculando distancia y tiemp";
parent.__c.ProgressDialogShow2(ba,BA.ObjectToCharSequence("Calculando distancia y tiempo, un momento por favor."),parent.__c.False);
 //BA.debugLineNum = 337;BA.debugLine="Private tiempoVisitas As Double 'TIMEPO DE 4 MINU";
_tiempovisitas = 0;
 //BA.debugLineNum = 338;BA.debugLine="tiempoVisitas = aVisitar.Keys.Size * 4 * 60 'Aqui";
_tiempovisitas = _avisitar._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().getSize()*4*60;
 //BA.debugLineNum = 339;BA.debugLine="tiempo0 = 0";
_tiempo0 = 0;
 //BA.debugLineNum = 340;BA.debugLine="distanciaTotal0 = 0";
_distanciatotal0 = 0;
 //BA.debugLineNum = 341;BA.debugLine="If masDe100 Then 'Si son mas de 100, entonces pri";
if (true) break;

case 22:
//if
this.state = 39;
if (_masde100) { 
this.state = 24;
}if (true) break;

case 24:
//C
this.state = 25;
 //BA.debugLineNum = 342;BA.debugLine="Dim j0 As HttpJob";
_j0 = new reparto_izca.keymon.lat.httpjob();
 //BA.debugLineNum = 343;BA.debugLine="j0.Initialize(\"trip0\", Me)";
_j0._initialize /*String*/ (ba,"trip0",parent);
 //BA.debugLineNum = 344;BA.debugLine="j0.Download(\"https://router.project-osrm.org/tri";
_j0._download /*String*/ ("https://router.project-osrm.org/trip/v1/driving/"+_preruta+"?source=first&destination=last&roundtrip=false&geometries=geojson");
 //BA.debugLineNum = 346;BA.debugLine="Wait For (j0) JobDone(j0 As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j0));
this.state = 72;
return;
case 72:
//C
this.state = 25;
_j0 = (reparto_izca.keymon.lat.httpjob) result[0];
;
 //BA.debugLineNum = 347;BA.debugLine="If j0.Success Then";
if (true) break;

case 25:
//if
this.state = 38;
if (_j0._success /*boolean*/ ) { 
this.state = 27;
}else {
this.state = 37;
}if (true) break;

case 27:
//C
this.state = 28;
 //BA.debugLineNum = 348;BA.debugLine="Dim jp0 As JSONParser";
_jp0 = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 349;BA.debugLine="jp0.Initialize(j0.GetString)";
_jp0.Initialize(_j0._getstring /*String*/ ());
 //BA.debugLineNum = 350;BA.debugLine="Dim m0 As Map = jp0.NextObject";
_m0 = new anywheresoftware.b4a.objects.collections.Map();
_m0 = _jp0.NextObject();
 //BA.debugLineNum = 351;BA.debugLine="If m0.Get(\"code\") = \"Ok\" Then";
if (true) break;

case 28:
//if
this.state = 35;
if ((_m0.Get((Object)("code"))).equals((Object)("Ok"))) { 
this.state = 30;
}if (true) break;

case 30:
//C
this.state = 31;
 //BA.debugLineNum = 352;BA.debugLine="Dim puntos0 As List = m0.Get(\"waypoints\")";
_puntos0 = new anywheresoftware.b4a.objects.collections.List();
_puntos0 = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_m0.Get((Object)("waypoints"))));
 //BA.debugLineNum = 353;BA.debugLine="Private esteWayPoint0 As Map";
_estewaypoint0 = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 354;BA.debugLine="For p = 0 To puntos0.Size -1";
if (true) break;

case 31:
//for
this.state = 34;
step47 = 1;
limit47 = (int) (_puntos0.getSize()-1);
_p = (int) (0) ;
this.state = 73;
if (true) break;

case 73:
//C
this.state = 34;
if ((step47 > 0 && _p <= limit47) || (step47 < 0 && _p >= limit47)) this.state = 33;
if (true) break;

case 74:
//C
this.state = 73;
_p = ((int)(0 + _p + step47)) ;
if (true) break;

case 33:
//C
this.state = 74;
 //BA.debugLineNum = 355;BA.debugLine="esteWayPoint0 = puntos0.Get(p)";
_estewaypoint0 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_puntos0.Get(_p)));
 //BA.debugLineNum = 358;BA.debugLine="esteWayPoint0.Remove(\"hint\")";
_estewaypoint0.Remove((Object)("hint"));
 //BA.debugLineNum = 359;BA.debugLine="esteWayPoint0.Remove(\"distance\")";
_estewaypoint0.Remove((Object)("distance"));
 //BA.debugLineNum = 360;BA.debugLine="esteWayPoint0.Remove(\"trips_index\")";
_estewaypoint0.Remove((Object)("trips_index"));
 //BA.debugLineNum = 361;BA.debugLine="listaWayPoints.Add(esteWayPoint0)";
parent._listawaypoints.Add((Object)(_estewaypoint0.getObject()));
 if (true) break;
if (true) break;

case 34:
//C
this.state = 35;
;
 //BA.debugLineNum = 364;BA.debugLine="Dim rutas0 As List = m0.Get(\"trips\")";
_rutas0 = new anywheresoftware.b4a.objects.collections.List();
_rutas0 = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_m0.Get((Object)("trips"))));
 //BA.debugLineNum = 365;BA.debugLine="Dim rutas20 As Map = rutas0.Get(0)";
_rutas20 = new anywheresoftware.b4a.objects.collections.Map();
_rutas20 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_rutas0.Get((int) (0))));
 //BA.debugLineNum = 368;BA.debugLine="distanciaTotal0 = rutas20.Get(\"distance\")";
_distanciatotal0 = (double)(BA.ObjectToNumber(_rutas20.Get((Object)("distance"))));
 //BA.debugLineNum = 369;BA.debugLine="tiempo0 = rutas20.Get(\"duration\")";
_tiempo0 = (double)(BA.ObjectToNumber(_rutas20.Get((Object)("duration"))));
 //BA.debugLineNum = 370;BA.debugLine="tiempo0 = ((tiempo0 * 2) ) 'Tiempo X 2 (es muy";
_tiempo0 = ((_tiempo0*2));
 //BA.debugLineNum = 371;BA.debugLine="Log($\"Distancia total ruta inicial: $1.1{dista";
parent.__c.LogImpl("510747975",("Distancia total ruta inicial: "+parent.__c.SmartStringFormatter("1.1",(Object)(_distanciatotal0/(double)1000))+" kms, tiempo aprox: "+parent.__c.SmartStringFormatter("1.1",(Object)(_tiempo0/(double)60))+" mins. ("+parent.__c.SmartStringFormatter("1.1",(Object)(_tiempo0/(double)60/(double)60))+" hrs)"),0);
 if (true) break;

case 35:
//C
this.state = 38;
;
 if (true) break;

case 37:
//C
this.state = 38;
 //BA.debugLineNum = 375;BA.debugLine="Log(\"Error!\")";
parent.__c.LogImpl("510747979","Error!",0);
 if (true) break;

case 38:
//C
this.state = 39;
;
 //BA.debugLineNum = 377;BA.debugLine="j0.Release";
_j0._release /*String*/ ();
 if (true) break;

case 39:
//C
this.state = 40;
;
 //BA.debugLineNum = 380;BA.debugLine="Dim j As HttpJob";
_j = new reparto_izca.keymon.lat.httpjob();
 //BA.debugLineNum = 381;BA.debugLine="j.Initialize(\"trip\", Me) 'Calculamos el resto de";
_j._initialize /*String*/ (ba,"trip",parent);
 //BA.debugLineNum = 382;BA.debugLine="j.Download(\"https://router.project-osrm.org/trip/";
_j._download /*String*/ ("https://router.project-osrm.org/trip/v1/driving/"+_rutacompleta+"?source=first&destination=last&roundtrip=false&geometries=geojson");
 //BA.debugLineNum = 384;BA.debugLine="Wait For (j) JobDone(j As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j));
this.state = 75;
return;
case 75:
//C
this.state = 40;
_j = (reparto_izca.keymon.lat.httpjob) result[0];
;
 //BA.debugLineNum = 385;BA.debugLine="If j.Success Then";
if (true) break;

case 40:
//if
this.state = 53;
if (_j._success /*boolean*/ ) { 
this.state = 42;
}else {
this.state = 52;
}if (true) break;

case 42:
//C
this.state = 43;
 //BA.debugLineNum = 386;BA.debugLine="Dim jp As JSONParser";
_jp = new anywheresoftware.b4a.objects.collections.JSONParser();
 //BA.debugLineNum = 387;BA.debugLine="jp.Initialize(j.GetString)";
_jp.Initialize(_j._getstring /*String*/ ());
 //BA.debugLineNum = 388;BA.debugLine="Dim m As Map = jp.NextObject";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m = _jp.NextObject();
 //BA.debugLineNum = 389;BA.debugLine="If m.Get(\"code\") = \"Ok\" Then";
if (true) break;

case 43:
//if
this.state = 50;
if ((_m.Get((Object)("code"))).equals((Object)("Ok"))) { 
this.state = 45;
}if (true) break;

case 45:
//C
this.state = 46;
 //BA.debugLineNum = 390;BA.debugLine="Dim puntos As List = m.Get(\"waypoints\")";
_puntos = new anywheresoftware.b4a.objects.collections.List();
_puntos = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_m.Get((Object)("waypoints"))));
 //BA.debugLineNum = 391;BA.debugLine="Private esteWayPoint As Map";
_estewaypoint = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 392;BA.debugLine="Dim twpi As Int";
_twpi = 0;
 //BA.debugLineNum = 393;BA.debugLine="For p = 0 To puntos.Size -1";
if (true) break;

case 46:
//for
this.state = 49;
step78 = 1;
limit78 = (int) (_puntos.getSize()-1);
_p = (int) (0) ;
this.state = 76;
if (true) break;

case 76:
//C
this.state = 49;
if ((step78 > 0 && _p <= limit78) || (step78 < 0 && _p >= limit78)) this.state = 48;
if (true) break;

case 77:
//C
this.state = 76;
_p = ((int)(0 + _p + step78)) ;
if (true) break;

case 48:
//C
this.state = 77;
 //BA.debugLineNum = 394;BA.debugLine="esteWayPoint = puntos.Get(p)";
_estewaypoint = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_puntos.Get(_p)));
 //BA.debugLineNum = 397;BA.debugLine="esteWayPoint.Remove(\"hint\")";
_estewaypoint.Remove((Object)("hint"));
 //BA.debugLineNum = 398;BA.debugLine="esteWayPoint.Remove(\"distance\")";
_estewaypoint.Remove((Object)("distance"));
 //BA.debugLineNum = 399;BA.debugLine="esteWayPoint.Remove(\"trips_index\")";
_estewaypoint.Remove((Object)("trips_index"));
 //BA.debugLineNum = 400;BA.debugLine="twpi = esteWayPoint.Get(\"waypoint_index\")";
_twpi = (int)(BA.ObjectToNumber(_estewaypoint.Get((Object)("waypoint_index"))));
 //BA.debugLineNum = 401;BA.debugLine="esteWayPoint.Remove(\"waypoint_index\")";
_estewaypoint.Remove((Object)("waypoint_index"));
 //BA.debugLineNum = 402;BA.debugLine="esteWayPoint.Put(\"waypoint_index\", (twpi + cua";
_estewaypoint.Put((Object)("waypoint_index"),(Object)((_twpi+_cuantosantes+2)));
 //BA.debugLineNum = 403;BA.debugLine="listaWayPoints.Add(esteWayPoint)";
parent._listawaypoints.Add((Object)(_estewaypoint.getObject()));
 if (true) break;
if (true) break;

case 49:
//C
this.state = 50;
;
 //BA.debugLineNum = 406;BA.debugLine="Dim rutas As List = m.Get(\"trips\")";
_rutas = new anywheresoftware.b4a.objects.collections.List();
_rutas = (anywheresoftware.b4a.objects.collections.List) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.List(), (java.util.List)(_m.Get((Object)("trips"))));
 //BA.debugLineNum = 407;BA.debugLine="Dim rutas2 As Map = rutas.Get(0)";
_rutas2 = new anywheresoftware.b4a.objects.collections.Map();
_rutas2 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(_rutas.Get((int) (0))));
 //BA.debugLineNum = 408;BA.debugLine="distanciaTotal = rutas2.Get(\"distance\")";
_distanciatotal = (double)(BA.ObjectToNumber(_rutas2.Get((Object)("distance"))));
 //BA.debugLineNum = 409;BA.debugLine="Log(\"distancia ruta 2:\" & (distanciaTotal) & \"|";
parent.__c.LogImpl("510748013","distancia ruta 2:"+BA.NumberToString((_distanciatotal))+"|"+BA.ObjectToString(_rutas2.Get((Object)("distance"))),0);
 //BA.debugLineNum = 410;BA.debugLine="distanciaTotal = distanciaTotal + distanciaTota";
_distanciatotal = _distanciatotal+_distanciatotal0;
 //BA.debugLineNum = 411;BA.debugLine="tiempo = rutas2.Get(\"duration\")";
_tiempo = (double)(BA.ObjectToNumber(_rutas2.Get((Object)("duration"))));
 //BA.debugLineNum = 412;BA.debugLine="tiempo = (((tiempo + tiempo0) * 2) + tiempoVisi";
_tiempo = (((_tiempo+_tiempo0)*2)+_tiempovisitas);
 //BA.debugLineNum = 413;BA.debugLine="Log($\"Distancia total: $1.1{distanciaTotal/1000";
parent.__c.LogImpl("510748017",("Distancia total: "+parent.__c.SmartStringFormatter("1.1",(Object)(_distanciatotal/(double)1000))+" kms, tiempo aprox: "+parent.__c.SmartStringFormatter("1.1",(Object)(_tiempo/(double)60))+" mins. ("+parent.__c.SmartStringFormatter("1.1",(Object)(_tiempo/(double)60/(double)60))+" hrs)"),0);
 //BA.debugLineNum = 414;BA.debugLine="l_rutaInfo.Text = $\"Distancia: $1.1{distanciaTo";
parent._l_rutainfo.setText(BA.ObjectToCharSequence(("Distancia: "+parent.__c.SmartStringFormatter("1.1",(Object)(_distanciatotal/(double)1000))+" kms, tiempo aprox: "+parent.__c.SmartStringFormatter("1.1",(Object)(_tiempo/(double)60/(double)60))+" hrs"+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+"Visitas restantes: "+parent.__c.SmartStringFormatter("",(Object)(_avisitar._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().getSize()))+"")));
 //BA.debugLineNum = 415;BA.debugLine="l_rutaInfo.Width = Root.Width * 0.9";
parent._l_rutainfo.setWidth((int) (parent._root.getWidth()*0.9));
 //BA.debugLineNum = 416;BA.debugLine="Subs.centraEtiqueta(l_rutaInfo, Root.Width)";
parent._subs._centraetiqueta /*String*/ (ba,parent._l_rutainfo,parent._root.getWidth());
 //BA.debugLineNum = 417;BA.debugLine="l_rutaInfo.Visible = True";
parent._l_rutainfo.setVisible(parent.__c.True);
 //BA.debugLineNum = 418;BA.debugLine="l_rutaInfo.BringToFront";
parent._l_rutainfo.BringToFront();
 //BA.debugLineNum = 419;BA.debugLine="ListView1.Top = lv1Top + 100";
parent._listview1.setTop((int) ((double)(Double.parseDouble(parent._lv1top))+100));
 if (true) break;

case 50:
//C
this.state = 53;
;
 if (true) break;

case 52:
//C
this.state = 53;
 //BA.debugLineNum = 422;BA.debugLine="LogColor(\"****************  Error!  ************";
parent.__c.LogImpl("510748026","****************  Error!  ******************",parent.__c.Colors.Red);
 if (true) break;

case 53:
//C
this.state = 54;
;
 //BA.debugLineNum = 424;BA.debugLine="j.Release";
_j._release /*String*/ ();
 //BA.debugLineNum = 425;BA.debugLine="ProgressDialogHide";
parent.__c.ProgressDialogHide();
 //BA.debugLineNum = 427;BA.debugLine="Private r As Int = 1";
_r = (int) (1);
 //BA.debugLineNum = 428;BA.debugLine="Private r1, wps As Map";
_r1 = new anywheresoftware.b4a.objects.collections.Map();
_wps = new anywheresoftware.b4a.objects.collections.Map();
 //BA.debugLineNum = 429;BA.debugLine="Starter.skmt.ExecNonQuery(\"delete from waypoints\"";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("delete from waypoints");
 //BA.debugLineNum = 430;BA.debugLine="Log(\"BORRAMOS WAYPOINTS\")";
parent.__c.LogImpl("510748034","BORRAMOS WAYPOINTS",0);
 //BA.debugLineNum = 431;BA.debugLine="For Each k As Object In clientesMapaO.Keys 'Guard";
if (true) break;

case 54:
//for
this.state = 61;
group112 = parent._clientesmapao._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ();
index112 = 0;
groupLen112 = group112.getSize();
this.state = 78;
if (true) break;

case 78:
//C
this.state = 61;
if (index112 < groupLen112) {
this.state = 56;
_k = group112.Get(index112);}
if (true) break;

case 79:
//C
this.state = 78;
index112++;
if (true) break;

case 56:
//C
this.state = 57;
 //BA.debugLineNum = 432;BA.debugLine="If listaWayPoints.Size > 0 Then";
if (true) break;

case 57:
//if
this.state = 60;
if (parent._listawaypoints.getSize()>0) { 
this.state = 59;
}if (true) break;

case 59:
//C
this.state = 60;
 //BA.debugLineNum = 433;BA.debugLine="r1 = clientesMapaO.Get(k)";
_r1 = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(parent._clientesmapao._get /*Object*/ (_k)));
 //BA.debugLineNum = 434;BA.debugLine="r1.Get(\"codigo\")";
_r1.Get((Object)("codigo"));
 //BA.debugLineNum = 435;BA.debugLine="Log(listaWayPoints.Get(r) & \"|\" & r1.Get(\"coord";
parent.__c.LogImpl("510748039",BA.ObjectToString(parent._listawaypoints.Get(_r))+"|"+BA.ObjectToString(_r1.Get((Object)("coords")))+"|"+BA.ObjectToString(_r1.Get((Object)("calle"))),0);
 //BA.debugLineNum = 436;BA.debugLine="wps = listaWayPoints.Get(r)";
_wps = (anywheresoftware.b4a.objects.collections.Map) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.objects.collections.Map(), (java.util.Map)(parent._listawaypoints.Get(_r)));
 //BA.debugLineNum = 437;BA.debugLine="Starter.skmt.ExecNonQuery($\"update kmt_info set";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery(("update kmt_info set SECUENCIA = "+parent.__c.SmartStringFormatter("",_wps.Get((Object)("waypoint_index")))+" where CAT_CL_CODIGO = '"+parent.__c.SmartStringFormatter("",_r1.Get((Object)("codigo")))+"'"));
 //BA.debugLineNum = 438;BA.debugLine="Starter.skmt.ExecNonQuery2(\"insert into waypoin";
parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("insert into waypoints values (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{_r1.Get((Object)("codigo")),_wps.Get((Object)("waypoint_index"))}));
 //BA.debugLineNum = 439;BA.debugLine="r = r + 1";
_r = (int) (_r+1);
 if (true) break;

case 60:
//C
this.state = 79;
;
 if (true) break;
if (true) break;

case 61:
//C
this.state = 62;
;
 //BA.debugLineNum = 442;BA.debugLine="ListView1.Clear";
parent._listview1.Clear();
 //BA.debugLineNum = 443;BA.debugLine="Sleep(100)";
parent.__c.Sleep(ba,this,(int) (100));
this.state = 80;
return;
case 80:
//C
this.state = 62;
;
 //BA.debugLineNum = 444;BA.debugLine="Dim label2 As Label";
_label2 = new anywheresoftware.b4a.objects.LabelWrapper();
 //BA.debugLineNum = 445;BA.debugLine="label2 = ListView1.TwoLinesLayout.SecondLabel";
_label2 = parent._listview1.getTwoLinesLayout().SecondLabel;
 //BA.debugLineNum = 446;BA.debugLine="label2.TextSize = 15";
_label2.setTextSize((float) (15));
 //BA.debugLineNum = 447;BA.debugLine="label2.Height = 100dip";
_label2.setHeight(parent.__c.DipToCurrent((int) (100)));
 //BA.debugLineNum = 448;BA.debugLine="ListView1.TwoLinesLayout.ItemHeight = 70dip";
parent._listview1.getTwoLinesLayout().setItemHeight(parent.__c.DipToCurrent((int) (70)));
 //BA.debugLineNum = 449;BA.debugLine="Dim cs, cs2 As CSBuilder";
_cs = new anywheresoftware.b4a.objects.CSBuilder();
_cs2 = new anywheresoftware.b4a.objects.CSBuilder();
 //BA.debugLineNum = 450;BA.debugLine="entro = 3";
parent._entro = BA.NumberToString(3);
 //BA.debugLineNum = 451;BA.debugLine="Log(\"Generamos ListView1 en traeRutaDia\")";
parent.__c.LogImpl("510748055","Generamos ListView1 en traeRutaDia",0);
 //BA.debugLineNum = 453;BA.debugLine="c=Starter.skmt.ExecQuery(\"select codigo, indice,";
parent._c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(parent._starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select codigo, indice, CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_NOEXT from  waypoints inner join kmt_info on waypoints.codigo = kmt_info.CAT_CL_CODIGO where gestion = 0 AND CAT_CL_RUTA <> 1000 order by indice")));
 //BA.debugLineNum = 454;BA.debugLine="If c.RowCount > 0 Then";
if (true) break;

case 62:
//if
this.state = 69;
if (parent._c.getRowCount()>0) { 
this.state = 64;
}if (true) break;

case 64:
//C
this.state = 65;
 //BA.debugLineNum = 455;BA.debugLine="For i=0 To c.RowCount -1 'Generamos el listView";
if (true) break;

case 65:
//for
this.state = 68;
step135 = 1;
limit135 = (int) (parent._c.getRowCount()-1);
_i = (int) (0) ;
this.state = 81;
if (true) break;

case 81:
//C
this.state = 68;
if ((step135 > 0 && _i <= limit135) || (step135 < 0 && _i >= limit135)) this.state = 67;
if (true) break;

case 82:
//C
this.state = 81;
_i = ((int)(0 + _i + step135)) ;
if (true) break;

case 67:
//C
this.state = 82;
 //BA.debugLineNum = 456;BA.debugLine="c.Position=i";
parent._c.setPosition(_i);
 //BA.debugLineNum = 457;BA.debugLine="cs.Initialize";
_cs.Initialize();
 //BA.debugLineNum = 458;BA.debugLine="cs2.Initialize";
_cs2.Initialize();
 //BA.debugLineNum = 459;BA.debugLine="ListView1.AddTwoLines(cs.Color(Colors.RGB(100,1";
parent._listview1.AddTwoLines(BA.ObjectToCharSequence(_cs.Color(parent.__c.Colors.RGB((int) (100),(int) (149),(int) (237))).Append(BA.ObjectToCharSequence(parent._c.GetString("codigo"))).PopAll().getObject()),BA.ObjectToCharSequence(_cs2.Append(BA.ObjectToCharSequence(parent._c.GetString("CAT_CL_NOMBRE"))).Color(parent.__c.Colors.RGB((int) (100),(int) (149),(int) (237))).Append(BA.ObjectToCharSequence(" Calle: ")).Pop().Append(BA.ObjectToCharSequence(parent._c.GetString("CAT_CL_CALLE").trim()+" "+parent._c.GetString("CAT_CL_NOEXT"))).PopAll().getObject()));
 if (true) break;
if (true) break;

case 68:
//C
this.state = 69;
;
 if (true) break;

case 69:
//C
this.state = -1;
;
 //BA.debugLineNum = 462;BA.debugLine="c.Close";
parent._c.Close();
 //BA.debugLineNum = 463;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public reparto_izca.keymon.lat.b4xorderedmap  _traetodosavisitar() throws Exception{
anywheresoftware.b4a.gps.LocationWrapper _thisloc = null;
anywheresoftware.b4a.gps.LocationWrapper _ubicacioninicial = null;
int _i = 0;
int _j = 0;
int _distancia = 0;
anywheresoftware.b4a.objects.collections.Map _estecliente = null;
 //BA.debugLineNum = 515;BA.debugLine="Sub traeTodosAVisitar As B4XOrderedMap 'ignore";
 //BA.debugLineNum = 516;BA.debugLine="Log(\"Iniciamos traeTodosAVisitar\")";
__c.LogImpl("510878977","Iniciamos traeTodosAVisitar",0);
 //BA.debugLineNum = 519;BA.debugLine="Private thisLoc, ubicacionInicial As Location";
_thisloc = new anywheresoftware.b4a.gps.LocationWrapper();
_ubicacioninicial = new anywheresoftware.b4a.gps.LocationWrapper();
 //BA.debugLineNum = 520;BA.debugLine="ubicacionInicial = Starter.cedisLocation";
_ubicacioninicial = _starter._cedislocation /*anywheresoftware.b4a.gps.LocationWrapper*/ ;
 //BA.debugLineNum = 521;BA.debugLine="LogColor(ubicacionInicial, Colors.Gray)";
__c.LogImpl("510878982",BA.ObjectToString(_ubicacioninicial),__c.Colors.Gray);
 //BA.debugLineNum = 522;BA.debugLine="c=Starter.skmt.ExecQuery(\"select sum(gestion) as";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select sum(gestion) as hayVisitados from kmt_info")));
 //BA.debugLineNum = 523;BA.debugLine="If c.RowCount > 0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 524;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
 //BA.debugLineNum = 526;BA.debugLine="If c.GetString(\"hayVisitados\") > 0 Then ubicacio";
if ((double)(Double.parseDouble(_c.GetString("hayVisitados")))>0) { 
_ubicacioninicial = _tracker._uugcoords /*anywheresoftware.b4a.gps.LocationWrapper*/ ;};
 };
 //BA.debugLineNum = 528;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 529;BA.debugLine="LogColor(ubicacionInicial, Colors.Red)";
__c.LogImpl("510878990",BA.ObjectToString(_ubicacioninicial),__c.Colors.Red);
 //BA.debugLineNum = 530;BA.debugLine="thisLoc.Initialize";
_thisloc.Initialize();
 //BA.debugLineNum = 531;BA.debugLine="clientesMapaO.Clear";
_clientesmapao._clear /*String*/ ();
 //BA.debugLineNum = 533;BA.debugLine="c=Starter.skmt.ExecQuery(\"select CAT_CL_RUTA, cou";
_c = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select CAT_CL_RUTA, count(*) as cuantos from kmt_info where gestion = 0  AND CAT_CL_RUTA <> 1000 group by CAT_CL_RUTA order by CAT_CL_RUTA asc")));
 //BA.debugLineNum = 534;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
 //BA.debugLineNum = 536;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step16 = 1;
final int limit16 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit16 ;_i = _i + step16 ) {
 //BA.debugLineNum = 537;BA.debugLine="c.Position=i";
_c.setPosition(_i);
 //BA.debugLineNum = 539;BA.debugLine="c2=Starter.skmt.ExecQuery2(\"select  CAT_CL_NOMB";
_c2 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_starter._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery2("select  CAT_CL_NOMBRE, CAT_CL_CALLE, CAT_CL_CODIGO, CAT_CL_LAT, CAT_CL_LONG from kmt_info where CAT_CL_RUTA = ? and gestion = 0 AND CAT_CL_RUTA <> 1000 order by CAT_CL_NOMBRE ",new String[]{_c.GetString("CAT_CL_RUTA")})));
 //BA.debugLineNum = 540;BA.debugLine="If c2.RowCount>0 Then";
if (_c2.getRowCount()>0) { 
 //BA.debugLineNum = 541;BA.debugLine="For j=0 To c2.RowCount -1 'Generamos lista de";
{
final int step20 = 1;
final int limit20 = (int) (_c2.getRowCount()-1);
_j = (int) (0) ;
for (;_j <= limit20 ;_j = _j + step20 ) {
 //BA.debugLineNum = 542;BA.debugLine="c2.Position=j";
_c2.setPosition(_j);
 //BA.debugLineNum = 544;BA.debugLine="thisLoc.Latitude = c2.GetString(\"CAT_CL_LAT\")";
_thisloc.setLatitude((double)(Double.parseDouble(_c2.GetString("CAT_CL_LAT"))));
 //BA.debugLineNum = 545;BA.debugLine="thisLoc.Longitude = c2.GetString(\"CAT_CL_LONG";
_thisloc.setLongitude((double)(Double.parseDouble(_c2.GetString("CAT_CL_LONG"))));
 //BA.debugLineNum = 546;BA.debugLine="If Not(thisLoc.Latitude = 0.0) And Not(thisLo";
if (__c.Not(_thisloc.getLatitude()==0.0) && __c.Not(_thisloc.getLatitude()==0)) { 
 //BA.debugLineNum = 547;BA.debugLine="Private distancia As Int = ubicacionInicial.";
_distancia = (int) (_ubicacioninicial.DistanceTo((android.location.Location)(_thisloc.getObject())));
 //BA.debugLineNum = 548;BA.debugLine="If clientesMapaO.ContainsKey(distancia) Then";
if (_clientesmapao._containskey /*boolean*/ ((Object)(_distancia))) { 
_distancia = (int) (_distancia+1);};
 //BA.debugLineNum = 549;BA.debugLine="Private esteCliente As Map = CreateMap(\"dist";
_estecliente = new anywheresoftware.b4a.objects.collections.Map();
_estecliente = __c.createMap(new Object[] {(Object)("distancia"),(Object)(_distancia),(Object)("ordenDist"),(Object)(_j),(Object)("coords"),(Object)(_c2.GetString("CAT_CL_LONG")+","+_c2.GetString("CAT_CL_LAT")),(Object)("codigo"),(Object)(_c2.GetString("CAT_CL_CODIGO")),(Object)("nombre"),(Object)(_c2.GetString("CAT_CL_NOMBRE")),(Object)("calle"),(Object)(_c2.GetString("CAT_CL_CALLE"))});
 //BA.debugLineNum = 550;BA.debugLine="clientesMapaO.Put(distancia, esteCliente)";
_clientesmapao._put /*String*/ ((Object)(_distancia),(Object)(_estecliente.getObject()));
 }else {
 //BA.debugLineNum = 552;BA.debugLine="ToastMessageShow(\"Hay tiendas SIN coordenada";
__c.ToastMessageShow(BA.ObjectToCharSequence("Hay tiendas SIN coordenadas, fueron excluidas!!"),__c.False);
 };
 }
};
 };
 }
};
 };
 //BA.debugLineNum = 560;BA.debugLine="clientesMapaO.Keys.Sort(True) 'Ordenamos la lista";
_clientesmapao._getkeys /*anywheresoftware.b4a.objects.collections.List*/ ().Sort(__c.True);
 //BA.debugLineNum = 561;BA.debugLine="c.Close";
_c.Close();
 //BA.debugLineNum = 562;BA.debugLine="c2.Close";
_c2.Close();
 //BA.debugLineNum = 563;BA.debugLine="Log(c.RowCount & \" rutas, \" & clientesMapaO.Size";
__c.LogImpl("510879024",BA.NumberToString(_c.getRowCount())+" rutas, "+BA.NumberToString(_clientesmapao._getsize /*int*/ ())+" clientes",0);
 //BA.debugLineNum = 566;BA.debugLine="Return clientesMapaO";
if (true) return _clientesmapao;
 //BA.debugLineNum = 567;BA.debugLine="End Sub";
return null;
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
BA.senderHolder.set(sender);
if (BA.fastSubCompare(sub, "B4XPAGE_CREATED"))
	return _b4xpage_created((anywheresoftware.b4a.objects.B4XViewWrapper) args[0]);
return BA.SubDelegator.SubNotFound;
}
}
