Beispiel #1
0
 //public string ProductRoute(DataSet ds)
 //{
 //    string route = "";
 //    if (ds.Tables[0].Rows.Count > 1)
 //    {
 //        for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
 //        {
 //            string from = Convert.ToString(int.Parse(ds.Tables[0].Rows[i]["StationX"].ToString()) + 25) + "," + Convert.ToString(int.Parse(ds.Tables[0].Rows[i]["StationY"].ToString()) + 20);
 //            string to = Convert.ToString(int.Parse(ds.Tables[0].Rows[i + 1]["StationX"].ToString()) + 25) + "," + Convert.ToString(int.Parse(ds.Tables[0].Rows[i + 1]["StationY"].ToString()) + 20);
 //            if (route == "")
 //            {
 //                route = route + GetRoutePath(from, to);
 //            }
 //            else 
 //            {
 //                string routetemp = GetRoutePath(from, to);
 //                route = route + "," + routetemp.Substring(routetemp.IndexOf("||"));
 //            }
 //        }
 //    }
 //    return route;
 //}
 public string ProductRoutePoint(System.Windows.Forms.Form form,System.Windows.Forms.ProgressBar pgb)
 {
     if (new RouteDAL().GetNumOfRoute() > 0)
     {
         ZzhaStationDAL zzhastationdal = new ZzhaStationDAL();
         zzhastationdal.DelAllPoint();
         List<ZzhaStation> list = zzhastationdal.GetAllStations();
         if (list.Count > 0)
         {
             //for (int i = 0; i < list.Count; i++)
             //{
             //    for (int j = i + 1; j < list.Count; j++)
             //    {
             //        string routepath = GetRoutePath(list[i].Position, list[j].Position);
             //        string[] point = routepath.Split('|');
             //        for (int k = 0; k < point.Length; k++)
             //        {
             //            string[] xy = point[k].Split(',');
             //            if (!new ZzhaStationDAL().InsertPoint(list[i].StationAddressNum + "," + list[j].StationAddressNum, double.Parse(xy[0]), double.Parse(xy[1])))
             //                flag = false;
             //        }
             //    }
             //}
             Hashtable ht = this.GetRouteTable(list,form, pgb);
             if (ht.Count > 0)
             {
                 //float step = 100 /(float) ht.Count;
                 //float value = 0;
                 string savestring = "begin ";
                 foreach (DictionaryEntry de in ht)
                 {
                     string pointid = de.Key.ToString();
                     string[] routepoints = ((RouteLength)de.Value).RouteList.Split('|');                            
                     for (int i = 0; i < routepoints.Length; i++)
                     {
                         string[] xy = routepoints[i].Split(',');
                         savestring = savestring + zzhastationdal.InsertPoint(pointid, double.Parse(xy[0]), double.Parse(xy[1]));
                     }
                     //value += step;
                     //pgb.Value = Convert.ToInt32(value);
                 }
                 savestring = savestring + " end";
                 zzhastationdal.SavePoint(savestring);
                 return "生成路径点成功";
             }
             else
             {
                 return "生成路径点失败";
             }
         }
         else
         {
             return "基站尚未配置";
         }
     }
     else
     {
         return "路径尚未配置";
     }
 }
Beispiel #2
0
 public string ProductRoutePoint()
 {
     if (new RouteDAL().GetNumOfRoute() > 0)
     {
         ZzhaStationDAL zzhastationdal = new ZzhaStationDAL();
         zzhastationdal.DelAllPoint();
         List<ZzhaStation> list = zzhastationdal.GetAllStations();
         if (list.Count > 0)
         {
             //for (int i = 0; i < list.Count; i++)
             //{
             //    for (int j = i + 1; j < list.Count; j++)
             //    {
             //        string routepath = GetRoutePath(list[i].Position, list[j].Position);
             //        string[] point = routepath.Split('|');
             //        for (int k = 0; k < point.Length; k++)
             //        {
             //            string[] xy = point[k].Split(',');
             //            if (!new ZzhaStationDAL().InsertPoint(list[i].StationAddressNum + "," + list[j].StationAddressNum, double.Parse(xy[0]), double.Parse(xy[1])))
             //                flag = false;
             //        }
             //    }
             //}
             Hashtable ht=this.GetRouteTable(list);
             if (ht.Count > 0)
             {
                 foreach(DictionaryEntry de in ht)
                 {
                     string pointid = de.Key.ToString();
                     string[] routepoints = ((RouteLength)de.Value).RouteList.Split('|');
                     for (int i = 0; i < routepoints.Length; i++)
                     {
                         string[] xy = routepoints[i].Split(',');
                         zzhastationdal.InsertPoint(pointid, double.Parse(xy[0]), double.Parse(xy[1]));
                     }
                 }
                 return "生成路径点成功";
             }
             else
             {
                 return "生成路径点失败";
             }
         }
         else
         {
             return "基站尚未配置";
         }
     }
     else
     {
         return "路径尚未配置";
     }
 }