Ejemplo n.º 1
0
 private void InitDataTable()
 {
     this.dataTable = SVCHelper.ReadCsvFile(this.path);
     dataTable.Columns.Add("WGS84_X", Type.GetType("System.String"));
     dataTable.Columns.Add("WGS84_Y", Type.GetType("System.String"));
     dataTable.Rows.Clear();
 }
Ejemplo n.º 2
0
        private void converteData()
        {
            DataTable tempDataTable = SVCHelper.ReadCsvFile(this.path);
            int       k             = 0;

            foreach (DataRow row in tempDataTable.Rows)
            {
                if (!this.isStop)
                {
                    k++;
                    string xString = row["X"] != null ? row["X"].ToString() : "";
                    string yString = row["Y"] != null ? row["Y"].ToString() : "";
                    double x = 0.0, y = 0.0;
                    double.TryParse(xString, out x);
                    double.TryParse(yString, out y);
                    Coord coord = new Coord(x, y);
                    coord = CoordHelper.Gcj2Wgs(coord.lon, coord.lat);
                    DataRow newRow = this.dataTable.NewRow();
                    for (int i = 0; i < row.ItemArray.Length; i++)
                    {
                        newRow[i] = row[i];
                    }
                    newRow["WGS84_X"] = coord.lon;
                    newRow["WGS84_Y"] = coord.lat;
                    if (this.convertHandler != null)
                    {
                        this.convertHandler(newRow, k, tempDataTable.Rows.Count);
                    }
                }
            }
            if (this.converteEndHandler != null)
            {
                this.converteEndHandler();
            }
        }