public RoutePlanData(IList <AllSegment> Segs) { Segments = Segs; AllLands = AGVClientDAccess.LoadLandByCondition("1=1"); }
public bool Inital() { try { MoniCars.Clear(); AllCar = AGVClientDAccess.LoadAGVAchive(); AllLands = AGVClientDAccess.LoadLandByCondition("1=1"); AllSegs = AGVClientDAccess.LoadAllSegment(); SimulatorVar.AllSegs = AllSegs; Stores = AGVClientDAccess.LoadStorages(); System = AGVSimulationDAccess.LoadSystem(); foreach (CarBaseStateInfo item in AllCar) { CarMonitor moniCar = new CarMonitor(); moniCar.AgvID = item.AgvID; moniCar.CurrSite = Convert.ToInt32(item.StandbyLandMark); moniCar.StandbyLandMark = item.StandbyLandMark; double ScalingRate = 0; string ScalingRateStr = System["ScalingRate"].ToString(); try { ScalingRate = Convert.ToDouble(ScalingRateStr); } catch { } if (ScalingRate > 0) { LandmarkInfo CurrLand = AllLands.FirstOrDefault(p => p.LandmarkCode == item.StandbyLandMark); if (CurrLand != null) { moniCar.X = (float)(CurrLand.LandX * ScalingRate); moniCar.Y = (float)(CurrLand.LandY * ScalingRate); } } moniCar.ScalingRate = ScalingRate; MoniCars.Add(moniCar); } if (Car_Ini != null) { Car_Ini(MoniCars); } //Juncts.Clear(); //IList<TrafficController> Traffics = AGVClientDAccess.GetTraffics(); //foreach (TrafficController item in Traffics) //{ // JunctionInfo junct = new JunctionInfo(); // foreach (string s in item.EnterLandCode.Split(',')) // { junct.JunctionLandMarkCodes.Add(s); } // junct.JunctionID = item.JunctionID; // foreach (string s in item.JunctionLandMarkCodes.Split(',')) // { junct.JunctionLandMarkCodes.Add(s); } // junct.RealseLandMarkCode = item.RealseLandMarkCode; // Juncts.Add(junct); //} CountRoute = new RoutePlanData(AllSegs); Traffic = new TrafficController(MoniCars, AllSegs, System, AllLands); timerStarBeStopedCar.Enabled = true; timerStarBeStopedCar.AutoReset = true; timerStarBeStopedCar.Elapsed += TimerStarBeStopedCar_Elapsed; timerFreshTask.Enabled = true; timerFreshTask.AutoReset = true; timerFreshTask.Elapsed += TimerFreshTask_Elapsed; return(true); } catch (Exception ex) { return(false); throw ex; } }