private void refreshVehicleLoaction_Dic() { foreach (string adr_id in dicVehicles.Keys) { for (int i = 0; i < dicVehicles[adr_id].Count(); i++) { int railInterval = 0; uctlRail matchRail = findTheMatchingRail(dicVehicles[adr_id].Count() - i, out railInterval); int railInterval_Pix = (int)WinFromUtility.RealLengthToPixelsWidthByScale((double)railInterval); int Location_X = 0; int Location_Y = 0; switch (RailDircetion) { case E_RAIL_DIR.F: Location_X = (int)matchRail.p_Points[0].RealPointf.X; Location_Y = (int)matchRail.p_Points[0].RealPointf.Y; if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal) { dicVehicles[adr_id][i].PrcSetLocation(Location_X + railInterval_Pix, Location_Y); } else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical) { dicVehicles[adr_id][i].PrcSetLocation(Location_X, Location_Y + railInterval_Pix); } else { dicVehicles[adr_id][i].PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y); } break; case E_RAIL_DIR.R: Location_X = (int)matchRail.p_Points[1].RealPointf.X; Location_Y = (int)matchRail.p_Points[1].RealPointf.Y; if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal) { dicVehicles[adr_id][i].PrcSetLocation(Location_X - railInterval_Pix, Location_Y); } else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical) { dicVehicles[adr_id][i].PrcSetLocation(Location_X, Location_Y - railInterval_Pix); } else { dicVehicles[adr_id][i].PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y); } break; } dicVehicles[adr_id][i].Tag = dicVehicles[adr_id][i].Top + "|" + dicVehicles[adr_id][i].Left + "|" + dicVehicles[adr_id][i].Height + "|" + dicVehicles[adr_id][i].Width; } } }
public SysExcuteQualityBLL(WindownApplication app) { webClientManager = app.GetWebClientManager(); OlsonTimeZoneID = WinFromUtility.TimeZoneInfoIDToOlsonTimeZoneID(TimeZoneInfo.Local); }
public (int LocX, int LocY) getVehicleLoaction(double sec_dis) { int iLocX = 0; int iLocY = 0; double distance_scale = 1; double distanceTemp = 0; if (RealDistance > 10) { distance_scale = sec_dis / RealDistance; } else { } distanceTemp = Distance * distance_scale; int railInterval = 0; uctlRail matchRail = findTheMatchingRail((int)distanceTemp, out railInterval); int railInterval_Pix = (int)WinFromUtility.RealLengthToPixelsWidthByScale((double)railInterval); int Location_X = 0; int Location_Y = 0; KeyValuePair <uctlRail, E_RAIL_DIR> keyValuePairTemp = uctlRails.Where(keyValue => keyValue.Key == matchRail).SingleOrDefault(); if (keyValuePairTemp.Equals(default(KeyValuePair <uctlRail, E_RAIL_DIR>))) { return(0, 0); } E_RAIL_DIR railDIR = keyValuePairTemp.Value; //switch (RailDircetion) switch (railDIR) { case E_RAIL_DIR.F: Location_X = (int)matchRail.p_Points[0].RealPointf.X; Location_Y = (int)matchRail.p_Points[0].RealPointf.Y; if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal) { iLocX = Location_X + railInterval_Pix; iLocY = Location_Y; //vh.PrcSetLocation(Location_X + railInterval_Pix, Location_Y); } else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical) { iLocX = Location_X; iLocY = Location_Y + railInterval_Pix; //vh.PrcSetLocation(Location_X, Location_Y + railInterval_Pix); } else { if (distance_scale == 1) { iLocX = (int)matchRail.p_Points[1].RealPointf.X; iLocY = (int)matchRail.p_Points[1].RealPointf.Y; //vh.PrcSetLocation((int)matchRail.p_Points[1].RealPointf.X, (int)matchRail.p_Points[1].RealPointf.Y); } else { iLocX = (int)matchRail.p_RealCenterPoint.X; iLocY = (int)matchRail.p_RealCenterPoint.Y; //vh.PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y); } } break; case E_RAIL_DIR.R: Location_X = (int)matchRail.p_Points[1].RealPointf.X; Location_Y = (int)matchRail.p_Points[1].RealPointf.Y; if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Horizontal) { iLocX = Location_X - railInterval_Pix; iLocY = Location_Y; //vh.PrcSetLocation(Location_X - railInterval_Pix, Location_Y); } else if (matchRail.p_RailType == E_RAIL_TYPE.Straight_Vertical) { iLocX = Location_X; iLocY = Location_Y - railInterval_Pix; //vh.PrcSetLocation(Location_X, Location_Y - railInterval_Pix); } else { if (distance_scale == 1) { iLocX = (int)matchRail.p_Points[1].RealPointf.X; iLocY = (int)matchRail.p_Points[1].RealPointf.Y; //vh.PrcSetLocation((int)matchRail.p_Points[1].RealPointf.X, (int)matchRail.p_Points[1].RealPointf.Y); } else { iLocX = (int)matchRail.p_RealCenterPoint.X; iLocY = (int)matchRail.p_RealCenterPoint.Y; //vh.PrcSetLocation((int)matchRail.p_RealCenterPoint.X, (int)matchRail.p_RealCenterPoint.Y); } } break; } return(iLocX, iLocY); }