Exemplo n.º 1
0
        /// <summary>
        /// 路网数据下载
        /// </summary>
        public void DownLoadRoadLine()
        {
            var roads         = new GaoDeRoads();
            var roaddataTable = new DataTable(this.City);

            roaddataTable.Columns.AddRange(
                new[]
                { new DataColumn("Name"), new DataColumn("WIDTH"), new DataColumn("TYPE"), new DataColumn("PATH") });

            Console.WriteLine("下载{0}中", this.City);
            roads.downOverHandler += () =>
            {
                var directory = this.GetCityDirectory();
                var path      = Path.Combine(directory, this.CityPinyin + "_roadNet.shp");
                ShpFileHelper.SaveShpFile(
                    roaddataTable,
                    path,
                    wkbGeometryType.wkbLineString,
                    ProjectConvert.GAODE84_WGS);
                roaddataTable.Rows.Clear();
            };
            roads.roadDateDowningHandler += (RoadModel road, int index, int count) =>
            {
                foreach (string path in road.paths)
                {
                    DataRow row = roaddataTable.NewRow();
                    row[0] = road.name;
                    row[1] = road.width;
                    row[2] = road.type;
                    row[3] = path;
                    roaddataTable.Rows.Add(row);
                }
            };
            roads.downLoadRoadsByCityName(this.City);
        }
Exemplo n.º 2
0
        private void downRoadData()
        {
            this.InitRoadDataTable();
            GaoDeRoads gaodeRoad = new GaoDeRoads();

            gaodeRoad.roadDateDowningHandler += new GaoDeRoads.RoadDateDowningHandler(roadDownHandler);
            gaodeRoad.downOverHandler        += new GaoDeRoads.DownOverHandler(saveDataInShp);
            gaodeRoad.downLoadRoadsByCityName(this.roadCurrentCity);
        }