private void btnLoadRoute_Click(object sender, EventArgs e) { if (MapGis.RouteList.Count == 0) { DataTable stationposition = dpicbll.GetStationPositionByFileID(this.FileID); DataTable routedt = dpicbll.GetRouteInfoPositionByFileID(this.FileID); if (routedt.Rows.Count > 0) { this.MapGis.ClareRouteModelList(); this.MapGis.ClearAllStation(); for (int i = 0; i < stationposition.Rows.Count; i++) { string stationname = stationposition.Rows[i][0].ToString(); PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString())); MapGis.AddConfigStation(stationname, p); } for (int i = 0; i < routedt.Rows.Count; i++) { if (i % 2 != 0) { ZzhaControlLibrary.RouteModel rm = new RouteModel(); string from = routedt.Rows[i][0].ToString(); string[] fromxy = from.Split(','); rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1])); string to = routedt.Rows[i][1].ToString(); string[] toxy = to.Split(','); rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1])); rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString()); MapGis.AddConfigRouteModel(rm); } } MapGis.FlashAll(); this.btnCreate.Enabled = true; this.btnLoadRoute.Enabled = false; } else { MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK); } } }
private void 载入路径LToolStripMenuItem_Click(object sender, EventArgs e) { if (MapGis.RouteList.Count == 0) { DataTable stationposition = new Graphics_RouteBLL().GetStationHeadPosition(); DataTable routedt = new Graphics_RouteBLL().GetAllRoute(); if (routedt.Rows.Count > 0) { this.MapGis.ClareRouteModelList(); this.MapGis.ClearAllStation(); for (int i = 0; i < stationposition.Rows.Count; i++) { string stationname = stationposition.Rows[i][0].ToString(); PointF p = new PointF(float.Parse(stationposition.Rows[i][1].ToString()), float.Parse(stationposition.Rows[i][2].ToString())); MapGis.AddConfigStation(stationname, p); } for (int i = 0; i < routedt.Rows.Count; i++) { ZzhaControlLibrary.RouteModel rm = new RouteModel(); string from = routedt.Rows[i][0].ToString(); string[] fromxy = from.Split(','); rm.From = new PointF(float.Parse(fromxy[0]), float.Parse(fromxy[1])); string to = routedt.Rows[i][1].ToString(); string[] toxy = to.Split(','); rm.To = new PointF(float.Parse(toxy[0]), float.Parse(toxy[1])); rm.RouteLength = int.Parse(routedt.Rows[i][2].ToString()); MapGis.AddConfigRouteModel(rm); } MapGis.FlashAll(); } else { MessageBox.Show("您尚未配置过路径,无法载入上次路径配置信息...", "提示", MessageBoxButtons.OK); } } }