public void PrcSetVehicleToSection(int vh_num, string seg_num, string adr_id, SCAppConstants.PassEvent passType) { uctlVehicle Vhcl = m_objItemVhcl[vh_num]; GroupRails groupRails = findMatchGroupRail(seg_num, adr_id); switch (passType) { case SCAppConstants.PassEvent.Pass: if (Vhcl.p_CurrentSecID != groupRails.Section_ID) { if (!string.IsNullOrWhiteSpace(Vhcl.p_CurrentSecID)) { m_DicSectionGroupRails[Vhcl.p_CurrentSecID].VehicleLeave(Vhcl); } } groupRails.VehicleEnterSection(Vhcl, adr_id, 0); break; case SCAppConstants.PassEvent.ArrivalFromAdr: groupRails.VehicleArrivalsStartAdr(Vhcl); break; case SCAppConstants.PassEvent.ArrivalToAdr: m_DicSectionGroupRails[Vhcl.p_CurrentSecID].VehicleLeave(Vhcl); groupRails.VehicleArrivalsEndAdr(Vhcl); break; } }
private void updateVehiclePosition() { TESTSpeedDisplay(); Adapter.Invoke((obj) => { try { GroupRails groupRails = Uctl_Map.getGroupRailBySecID(vh.CUR_SEC_ID); if (groupRails != null) { //switch (vh.VhRecentTranEvent) //{ // case EventType.AdrPass: // if (vh.ACC_SEC_DIST == groupRails.Distance) // { // uctlAddress uctlAdr1 = Uctl_Map.getuctAddressByAdrID(vh.CUR_ADR_ID); // PrcSetLocation(uctlAdr1.p_LocX, uctlAdr1.p_LocY); // } // else if (CurrentSecID != groupRails.Section_ID) // { // if (!string.IsNullOrWhiteSpace(CurrentSecID)) // Uctl_Map.p_DicSectionGroupRails[CurrentSecID.Trim()].VehicleLeave(this); // } // groupRails.VehicleEnterSection(this, vh.CUR_ADR_ID, vh.ACC_SEC_DIST); // break; // case EventType.LoadArrivals: // case EventType.UnloadArrivals: // case EventType.UnloadComplete: // case EventType.AdrOrMoveArrivals: // case EventType.VhmoveArrivals: // uctlAddress uctlAdr = Uctl_Map.getuctAddressByAdrID(vh.CUR_ADR_ID); // PrcSetLocation(uctlAdr.p_LocX, uctlAdr.p_LocY); // //uctlAddress uctlAdr = Uctl_Map.getuctAddressByAdrID(vh.CUR_ADR_ID); // //Uctl_Map.stopFlashingSpecifyRail(vh.PredictPath); // break; //} //if (vh.ACC_SEC_DIST == groupRails.Distance) //{ // uctlAddress uctlAdr1 = Uctl_Map.getuctAddressByAdrID(vh.CUR_ADR_ID); // PrcSetLocation(uctlAdr1.p_LocX, uctlAdr1.p_LocY); //} //else if (CurrentSecID != groupRails.Section_ID) //{ // if (!string.IsNullOrWhiteSpace(CurrentSecID)) // Uctl_Map.p_DicSectionGroupRails[CurrentSecID.Trim()].VehicleLeave(this); //} groupRails.VehicleEnterSection(this, vh.CUR_ADR_ID, vh.ACC_SEC_DIST, vh.CurrentDriveDirction); } else { PrcSetLocation((UNKNOW_DEFAULT_X_LOCATION_VALUE * Num) + 2, UNKNOW_DEFAULT_Y_LOCATION_VALUE); } } catch (Exception ex) { logger.Error(ex, "Exception"); } }, null); }
public void changeSpecifyRailColor(List <KeyValuePair <string, bool> > SectionsPassStatus) { string[] sections = null; if (SectionsPassStatus == null || SectionsPassStatus.Count() == 0) { return; } else { sections = SectionsPassStatus.Select(o => o.Key).ToArray(); } RailBringToFrontBySectionGroup(sections); foreach (KeyValuePair <string, bool> secAndStatus in SectionsPassStatus) { if (m_DicSectionGroupRails.ContainsKey(secAndStatus.Key)) { GroupRails groupRails = m_DicSectionGroupRails[secAndStatus.Key]; if (!secAndStatus.Value) { groupRails.GroupColorChange(Color.Yellow); } else { groupRails.GroupColorChange(Color.Gray); } } } }
private void updateVehiclePositionNew() { TESTSpeedDisplay(); GroupRails groupRails = Uctl_Map.getGroupRailBySecID(vh.CUR_SEC_ID); CurrentSecID = string.IsNullOrWhiteSpace(vh.CUR_SEC_ID) ? "" : vh.CUR_SEC_ID; (int LocX, int LocY)vh_location = default((int LocX, int LocY)); if (groupRails != null) { vh_location = groupRails.getVehicleEnterSectionOfLocation(vh.CUR_ADR_ID, vh.ACC_SEC_DIST); } else { vh_location.LocX = 20 + this.Width / 2; vh_location.LocY = 20 + this.Height / 2; } Adapter.Invoke((obj) => { try { PrcSetLocation(vh_location.LocX, vh_location.LocY); } catch (Exception ex) { logger.Error(ex, "Exception"); } }, null); }
public void changeSpecifyRailColor(string section, Color rail_color) { if (SCUtility.isEmpty(section)) { return; } if (m_DicSectionGroupRails.ContainsKey(section)) { GroupRails groupRails = m_DicSectionGroupRails[section]; groupRails.GroupColorChange(rail_color); } }
public void changeSpecifyRailColor(string[] sectionGroup) { if (sectionGroup == null || sectionGroup.Count() == 0) { return; } RailBringToFrontBySectionGroup(sectionGroup); foreach (string sec in sectionGroup) { if (m_DicSectionGroupRails.ContainsKey(sec)) { GroupRails groupRails = m_DicSectionGroupRails[sec]; groupRails.GroupColorChange(Color.Yellow); } } }
public GroupRails findMatchGroupRail(string seg_num, string adr_id) { GroupRails groupRails = null; foreach (KeyValuePair <string, GroupRails> keyValue in m_DicSectionGroupRails) { groupRails = keyValue.Value; if (groupRails.Segment_Num.Trim() == seg_num) { if (groupRails.p_Points[0].BindAddressID.Trim() == adr_id.Trim()) { return(groupRails); } } } return(groupRails); }
private void moveVehiclePosition() { Adapter.Invoke((obj) => { try { GroupRails groupRails = Uctl_Map.getGroupRailBySecID(eqpt.CUR_SEC_ID); if (groupRails != null) { switch (eqpt.VhRecentTranEvent) { case EventType.AdrPass: if (p_CurrentSecID != groupRails.Section_ID) { if (!string.IsNullOrWhiteSpace(p_CurrentSecID)) { Uctl_Map.p_DicSectionGroupRails[p_CurrentSecID.Trim()].VehicleLeave(this); } } groupRails.VehicleEnterSection(this, eqpt.CUR_ADR_ID, eqpt.ACC_SEC_DIST); break; case EventType.LoadArrivals: //groupRails.VehicleArrivalsStartAdr(this); //break; case EventType.UnloadArrivals: case EventType.UnloadComplete: case EventType.AdrOrMoveArrivals: uctlAddress uctlAdr = Uctl_Map.getuctAddressByAdrID(eqpt.CUR_ADR_ID); //point = bcApp.SCApplication.MapBLL.getPointByID(eqpt.currentAddress); PrcSetLocation(uctlAdr.p_LocX, uctlAdr.p_LocY); //groupRails.VehicleArrivalsEndAdr(this); Uctl_Map.stopFlashingSpecifyRail(eqpt.PredictPath); break; } } } catch (Exception ex) { logger.Error(ex, "Exception"); } }, null); }
private void updateVehiclePosition() { Adapter.Invoke((obj) => { try { //如果車子目前是位於9開頭的Address 就把他換成用Address的座標來定位 if (vh.CUR_ADR_ID != null && vh.CUR_ADR_ID.StartsWith("9")) { string replaced_cur_adr = replaceFirstChar(vh.CUR_ADR_ID); uctlAddress uctlAdr = Uctl_Map.getuctAddressByAdrID(replaced_cur_adr); if (uctlAdr == null) { return; } PrcSetLocation(uctlAdr.p_LocX, uctlAdr.p_LocY); } else { GroupRails groupRails = Uctl_Map.getGroupRailBySecID(vh.CUR_SEC_ID); if (groupRails != null) { groupRails.VehicleEnterSection(this, vh.CUR_ADR_ID, vh.ACC_SEC_DIST, vh.CurrentDriveDirction); } else { PrcSetLocation((UNKNOW_DEFAULT_X_LOCATION_VALUE * Num) + 2, UNKNOW_DEFAULT_Y_LOCATION_VALUE); } } } catch (Exception ex) { logger.Error(ex, "Exception"); } }, null); }