//Adds a given breadboard, identified by ID private void AddBreadboard(int breadboardNumber) { int col = breadboardNumber % Constants.BreadboardsPerRow; int row = breadboardNumber / Constants.BreadboardsPerRow; Breadboard newBb = new Breadboard(circuit); Canvas.SetLeft(newBb, col * Constants.BreadboardSpacingX + Constants.BreadboardStartX); Canvas.SetTop(newBb, row * Constants.BreadboardSpacingY + Constants.BreadboardStartY); DrawArea.Children.Add(newBb); Breadboards[breadboardNumber] = newBb; }
/* * Returns a map between pin numbers and connected breadboard bus */ public Dictionary <int, string> GetConnectedBreadboardNets() { Dictionary <int, string> connectedBusses = new Dictionary <int, string>(); foreach (var pinPosition in GetPinPositions()) { int breadboardID = 0; Point breadboardPosition = Breadboard.GetPositionOnBreadboard( GetAbsolutePosition(pinPosition.Value), ref breadboardID); connectedBusses[pinPosition.Key] = Breadboard.GetNetAtPoint(breadboardPosition, breadboardID.ToString()); } return(connectedBusses); }
public string[] GetConnectedBreadboardNets() { int startBbId = 0, endBbId = 0; Point startPtOnBb, endPtOnBb; Point endPoint = WirePosition; if (WireOrientation == Orientation.Horizontal) { endPoint.X += Length * Constants.ScaleFactor; } else { endPoint.Y += Length * Constants.ScaleFactor; } startPtOnBb = Breadboard.GetPositionOnBreadboard(WirePosition, ref startBbId); endPtOnBb = Breadboard.GetPositionOnBreadboard(endPoint, ref endBbId); return(new String[] { Breadboard.GetNetAtPoint(startPtOnBb, startBbId.ToString()), Breadboard.GetNetAtPoint(endPtOnBb, endBbId.ToString()) }); }