private void btnBaiduPoi_Click(object sender, EventArgs e)
        {
            if (this.mapControl.extent == null)
            {
                MessageBox.Show("请选择下载区域");
                return;
            }
            Extent extent    = this.mapControl.extent;
            Extent newExtent = new Extent();

            if (this.mapType == MapType.Gaode || this.mapType == MapType.GaodeImage || this.mapType == MapType.Google ||
                this.mapType == MapType.GoogleImage)
            {
                Coord leftTop = CoordHelper.Mercator2lonLat(extent.minX, extent.minY);
                leftTop = CoordHelper.BdEncrypt(leftTop.lat, leftTop.lon);
                Coord rightBottum = CoordHelper.Mercator2lonLat(extent.maxX, extent.maxY);
                rightBottum    = CoordHelper.BdEncrypt(rightBottum.lat, rightBottum.lon);
                newExtent.minX = leftTop.lon;
                newExtent.minY = leftTop.lat;
                newExtent.maxX = rightBottum.lon;
                newExtent.maxY = rightBottum.lat;
            }
            else if (this.mapType == MapType.Tiandi || this.mapType == MapType.TiandiImage)
            {
                Coord leftTop = CoordHelper.Transform(extent.minX, extent.minY);
                leftTop = CoordHelper.BdEncrypt(leftTop.lat, leftTop.lon);
                Coord rightBottum = CoordHelper.Transform(extent.maxX, extent.maxY);
                rightBottum    = CoordHelper.BdEncrypt(rightBottum.lat, rightBottum.lon);
                newExtent.minX = leftTop.lon;
                newExtent.minY = leftTop.lat;
                newExtent.maxX = rightBottum.lon;
                newExtent.maxY = rightBottum.lat;
            }
            else
            {
                MessageBox.Show("该地图类型不支持兴趣点下载,选择其他类型");
                return;
            }
            FrmPOIDownForBaidu frmPOIDown = new FrmPOIDownForBaidu(newExtent);

            frmPOIDown.Show();
        }
Exemple #2
0
        private void converteData()
        {
            // DataTable tempDataTable = AsposeCellsHelper.ExportToDataTable(this.path,true);
            //SVCHelper.readCSVFile(this.path);
            int k = 0;

            foreach (DataRow row in this.dataTable.Rows)
            {
                if (!this.isStop)
                {
                    k++;
                    DataRow newRow = row;
                    //for (int i = 0; i < row.ItemArray.Length; i++)
                    //{
                    //    newRow[i] = row[i];
                    //}
                    string xString = row["X"] != null ? row["X"].ToString() : "0";
                    string yString = row["Y"] != null ? row["Y"].ToString() : "0";
                    double x = 0.0, y = 0.0;
                    double.TryParse(xString, out x);
                    double.TryParse(yString, out y);
                    if (x == 0 || y == 0)
                    {
                        continue;
                    }
                    Coord coord = new Coord(x, y);
                    switch (this.covertType)
                    {
                    case CovertType.WGS2GCJ02:
                        coord           = CoordHelper.Transform(x, y);
                        newRow["GDJ_X"] = coord.lon;
                        newRow["GDJ_Y"] = coord.lat;
                        break;

                    case CovertType.BAIDU2GCJ02:
                        coord           = CoordHelper.BdDecrypt(y, x);
                        newRow["GDJ_X"] = coord.lon;
                        newRow["GDJ_Y"] = coord.lat;
                        break;

                    case CovertType.LONLAT2MOCTOR:
                        coord          = CoordHelper.WebMoctorJw2Pm(x, y);
                        newRow["PM_X"] = coord.lon;
                        newRow["PM_Y"] = coord.lat;
                        break;

                    case CovertType.GCJ022BAIDU:
                        coord          = CoordHelper.BdEncrypt(y, x);
                        newRow["BD_X"] = coord.lon;
                        newRow["BD_Y"] = coord.lat;
                        break;

                    case CovertType.WGS2BAIDU:
                        coord          = CoordHelper.Transform(x, y);
                        coord          = CoordHelper.BdEncrypt(coord.lat, coord.lon);
                        newRow["BD_X"] = coord.lon;
                        newRow["BD_Y"] = coord.lat;
                        break;

                    case CovertType.MOCTOR2LONLAT:
                        coord          = CoordHelper.Mercator2lonLat(x, y);
                        newRow["JW_X"] = coord.lon;
                        newRow["JW_Y"] = coord.lat;
                        break;

                    case CovertType.WGS2MOCTOR:
                        coord          = CoordHelper.Transform(x, y);
                        coord          = CoordHelper.WebMoctorJw2Pm(coord.lon, coord.lat);
                        newRow["PM_X"] = coord.lon;
                        newRow["PM_Y"] = coord.lat;
                        break;
                    }
                    //if (this.convertHandler != null)
                    //{
                    //    this.convertHandler(newRow, k, tempDataTable.Rows.Count);
                    //}
                }
            }
            AsposeCellsHelper.ExportToExcel(this.dataTable, this.outPutPath + "\\" + this.outputFileName);
            if (this.converteEndHandler != null)
            {
                this.converteEndHandler();
            }
        }