Exemplo n.º 1
0
        public GeoReferencia[] BuscarEsquina(string calle1, string calle2, string comuna, bool rm)
        {
            int                  id1, id2;
            e171924r             t_rm   = new e171924r();
            z_gsl                gsl    = new z_gsl();
            z_gclase             clase  = new z_gclase();
            z_gcom               com    = new z_gcom();
            List <GeoReferencia> GeoRef = new List <GeoReferencia>();
            DataSet              calles = null;

            try
            {
                // obtener ids
                id1 = t_rm.GetRecno(calle1);
                id2 = t_rm.GetRecno(calle2);

                if (rm)
                {
                    calles = gsl.Get_gsl(id1, id2);
                }
                else
                {
                    // filtrado por comunas
                    List <int> comunas = null;
                    if (string.IsNullOrEmpty(comuna))
                    {
                        // comunas cuerpo
                        comunas = new k_comunas_cuerpo().GetIDs();
                    }
                    else
                    {
                        // una comuna
                        comunas = new List <int>();
                        comunas.Add(com.GetID(comuna));
                    }
                    calles = gsl.Get_gsl(id1, id2, comunas);
                }

                foreach (DataRow dr in calles.Tables[0].Rows)
                {
                    // obtener clase e ingresar al array
                    GeoReferencia gr = new GeoReferencia();
                    gr.Dato1 = clase.GetClase(Convert.ToInt32(dr["gsl_6"])) + " " + calle1;
                    gr.Dato2 = clase.GetClase(Convert.ToInt32(dr["gsl_7"])) + " " + calle2;
                    gr.Dato3 = com.GetComuna(Convert.ToInt32(dr["gsl_5"]));

                    string[] pto = (dr["gsl_4"] as string).Split(' ');

                    gr.Punto1  = new PointD(pto[0], pto[1]);
                    gr.TipoRef = TipoReferencia.Esquina;

                    GeoRef.Add(gr);
                }
            }
            catch (Exception e)
            {
                Log.ShowAndLog(e);
            }
            return(GeoRef.ToArray());
        }
Exemplo n.º 2
0
        public GeoReferencia[] BuscarEsquina(string strCalle1, string strCalle2, bool rm)
        {
            string Pto;

            string[] CadaPto;
            string[] CadaValorTem;
            string[] CadaValor;
            //GeoReferencia[] GeoRef = null;
            List <GeoReferencia> GeoRef = new List <GeoReferencia>();
            int i;


            if (rm)
            {
                Pto = this.BuscaEsquina(strCalle1, strCalle2, Tablas.Esquinas_RM);
            }
            else
            {
                Pto = this.BuscaEsquina(strCalle1, strCalle2, Tablas.Esquinas_Cuerpo);
            }

            CadaPto      = Regex.Split(Pto.Trim(), "___");
            CadaValorTem = CadaPto[0].Split('_');
            // ERROR: Not supported in C#: ReDimStatement

            for (i = 0; i <= (int.Parse(CadaValorTem[4]) - 1); i++)
            {
                GeoReferencia gr = new GeoReferencia();
                CadaValor = CadaPto[i].Split("_".ToCharArray());
                gr.Dato1  = CadaValor[1] + " " + strCalle1.Trim();
                gr.Dato2  = CadaValor[2] + " " + strCalle2.Trim();
                gr.Dato3  = CadaValor[3];
                // de string a point
                Regex  re = new Regex("POINT\\(([0-9]*\\.?[0-9]*)\\s([0-9]*\\.?[0-9]*)\\)");
                PointD p  = new PointD(re.Match(CadaValor[0]).Groups[1].ToString(), re.Match(CadaValor[0]).Groups[2].ToString());

                gr.Punto1  = p;
                gr.TipoRef = TipoReferencia.Esquina;
                GeoRef.Add(gr);
            }
            return(GeoRef.ToArray());
        }
Exemplo n.º 3
0
        public GeoReferencia[] BuscarAltura(string strCalle, long intAltura)
        {
            string Pto = this.BuscaAltura(strCalle, intAltura);

            string[]             CadaPto;
            string[]             CadaValorTem;
            string[]             CadaValor;
            List <GeoReferencia> GeoRef = new List <GeoReferencia>();
            int i;

            CadaPto      = Regex.Split(Pto.Trim(), "___");
            CadaValorTem = CadaPto[0].Split('_');
            if (strTipoGeo == "alturas")
            {
                // ERROR: Not supported in C#: ReDimStatement

                for (i = 0; i <= (int.Parse(CadaValorTem[5]) - 1); i++)
                {
                    CadaValor = CadaPto[i].Split('_');
                    GeoReferencia gr = new GeoReferencia();
                    gr.Dato1 = CadaValor[1] + " " + strCalle.Trim();
                    gr.Dato2 = CadaValor[3];
                    gr.Dato3 = CadaValor[4];
                    // de string a point
                    Regex re = new Regex("POINT\\(([0-9]*\\.?[0-9]*)\\s([0-9]*\\.?[0-9]*)\\)");
                    //Dim p As New PointF(CDec(re.Match(CadaValor(0)).Groups(1).ToString().Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)), CDec(re.Match(CadaValor(0)).Groups(2).ToString().Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)))
                    PointD p = new PointD(re.Match(CadaValor[0]).Groups[1].ToString(), re.Match(CadaValor[0]).Groups[2].ToString());
                    gr.Punto1  = p;
                    gr.TipoRef = TipoReferencia.Altura;
                    GeoRef.Add(gr);
                }
            }
            if (strTipoGeo == "tramos")
            {
                // ERROR: Not supported in C#: ReDimStatement

                for (i = 0; i <= (int.Parse(CadaValorTem[4]) - 1); i++)
                {
                    CadaValor = CadaPto[i].Split('_');
                    GeoReferencia gr = new GeoReferencia();
                    gr.Dato1 = CadaValor[1];
                    gr.Dato2 = CadaValor[2];
                    gr.Dato3 = CadaValor[3];
                    //vItem.SubItems(3) = CadaValor(0)
                    // de string a point
                    Regex re = new Regex("BOX\\(([0-9]*\\.?[0-9]*)\\s([0-9]*\\.?[0-9]*),([0-9]*\\.?[0-9]*)\\s([0-9]*\\.?[0-9]*)\\)");
                    //Dim p As New PointF(CDec(re.Match(CadaValor(0)).Groups(1).ToString().Replace(".", ",")), CDec(re.Match(CadaValor(0)).Groups(2).ToString().Replace(".", ",")))
                    PointD p = new PointD(re.Match(CadaValor[0]).Groups[1].ToString(), re.Match(CadaValor[0]).Groups[2].ToString());

                    gr.Punto1 = p;
                    //p = New PointF(CDec(re.Match(CadaValor(0)).Groups(3).ToString().Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)), CDec(re.Match(CadaValor(0)).Groups(4).ToString().Replace(".", System.Globalization.NumberFormatInfo.CurrentInfo.NumberDecimalSeparator)))
                    p = new PointD(re.Match(CadaValor[0]).Groups[3].ToString(), re.Match(CadaValor[0]).Groups[4].ToString());

                    gr.Punto2  = p;
                    gr.TipoRef = TipoReferencia.Tramo;
                    GeoRef.Add(gr);
                }
            }

            return(GeoRef.ToArray());
        }