コード例 #1
0
        //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;
        }
コード例 #2
0
ファイル: Component.cs プロジェクト: sunlite99/BreadboardSim
        /*
         * 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);
        }
コード例 #3
0
        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()) });
        }