Esempio n. 1
0
        private void creatStation(string name, int shapeIndex, int xOffset, int yOffset)
        {
            Point   p = ((Line)drawingList[shapeIndex]).GetEndPoint;
            Station s = new Station(name, p.X, p.Y);

            stationList.Add(s);
            adjList.AddVertex(s);
            p.X = p.X + xOffset;
            p.Y = canvasHeight + p.Y + yOffset;
            Button btn = new Button();

            initButton(btn, name, btnClicked);
            btn.Location = p;
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();

            comboBox.Items.AddRange(System.IO.Ports.SerialPort.GetPortNames());
            comboBox.SelectedItem = comboBox.Items[0];
            InitPort();
            CurvePoint1 = new Point[0];
            #region
            Start = new Station("W0", 150, 400);
            T1    = new Station("T1", 400, 300);
            K1    = new Station("K1", 350, 350);
            F1    = new Station("F1", 450, 350);
            T2    = new Station("T2", 400, 500);
            K2    = new Station("K2", 350, 450);
            F2    = new Station("F2", 450, 450);
            P1    = new Station("P1", 200, 350);
            P2    = new Station("P2", 600, 350);
            P3    = new Station("P3", 200, 450);
            P4    = new Station("P4", 600, 450);
            Adj.AddVertex(Start);
            Adj.AddVertex(T1);
            Adj.AddVertex(K1);
            Adj.AddVertex(F1);
            Adj.AddVertex(T2);
            Adj.AddVertex(K2);
            Adj.AddVertex(F2);
            Adj.AddVertex(P1);
            Adj.AddVertex(P2);
            Adj.AddVertex(P3);
            Adj.AddVertex(P4);
            Adj.AddDirectedEdge(Adj.Find(Start), Adj.Find(P1)); //1
            Adj.AddDirectedEdge(Adj.Find(P1), Adj.Find(K1));    //2
            Adj.AddDirectedEdge(Adj.Find(K1), Adj.Find(F1));    //3
            Adj.AddDirectedEdge(Adj.Find(K1), Adj.Find(T1));    //4
            Adj.AddDirectedEdge(Adj.Find(T1), Adj.Find(F1));    //5
            Adj.AddDirectedEdge(Adj.Find(F1), Adj.Find(P2));    //6
            Adj.AddDirectedEdge(Adj.Find(P2), Adj.Find(P4));    //7
            Adj.AddDirectedEdge(Adj.Find(P4), Adj.Find(F2));    //8
            Adj.AddDirectedEdge(Adj.Find(F2), Adj.Find(K2));    //9
            Adj.AddDirectedEdge(Adj.Find(F2), Adj.Find(T2));    //10
            Adj.AddDirectedEdge(Adj.Find(T2), Adj.Find(K2));    //11
            Adj.AddDirectedEdge(Adj.Find(K2), Adj.Find(P3));    //12
            Adj.AddDirectedEdge(Adj.Find(P3), Adj.Find(Start)); //13
            #endregion
        }