Beispiel #1
0
        //protected delegate void ChangeDataDelegate2();

        protected override void OnPaint(PaintEventArgs e)//重绘
        {
            base.OnPaint(e);
            dc = e.Graphics;
            Pen blkPen = new Pen(Color.Black, 1);

            agvTrack.AddLine(200, 350, 600, 350);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddLine(200, 450, 600, 450);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(150, 350, 100, 100, 180, 90);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(150, 350, 100, 100, 90, 90);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(550, 350, 100, 100, 90, -180);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(350, 300, 100, 100, 180, 90);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(350, 300, 100, 100, 0, -90);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(350, 400, 100, 100, 90, 90);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();

            agvTrack.AddArc(350, 400, 100, 100, 0, 90);
            CurvePoint = agvTrack.TrackPoints;
            dc.DrawCurve(blkPen, CurvePoint, 0.1f);
            agvTrack.TrackPointList.Clear();
        }
Beispiel #2
0
        private void addDrawingListToTrack(ArrayList drawingList, ArrayList objIdentifier, Track t)
        {
            foreach (DrawingObject obj in objectIdentifier)                                             //iterates through the objects
            {
                switch (obj.shapeType)
                {
                case 2:                                 //line
                {
                    Line temp = new Line((Line)drawingList[obj.indexNo]);
                    t.AddLine(temp);
                    break;
                }

                case 6:                                 //arc
                {
                    Arc temp       = new Arc((Arc)drawingList[obj.indexNo]);
                    int startAngle = -(int)temp.StartAngle;

                    int sweepAngle = (int)temp.SweepAngle;
                    //if (sweepAngle > 0)
                    sweepAngle = -(int)sweepAngle;
                    //else {
                    //    sweepAngle = -360 - (int)sweepAngle;
                    //}
                    t.AddArc((int)(temp.CenterPoint.X - temp.Radius), (int)(temp.CenterPoint.Y - temp.Radius), 2 * (int)(temp.Radius), 2 * (int)(temp.Radius), startAngle, sweepAngle);
                    break;
                }
                }
            }
        }
Beispiel #3
0
 public void run(Line line)
 {
     if (line == null)
     {
         return;
     }
     trackToGo.AddLine(line);
     run();
 }
Beispiel #4
0
        public static Track getTrack(Station from, Station to)
        {
            Track  track = new Track();
            string path  = "";

            path = from.name + "->" + to.name;
            switch (path)
            {
            case "W0->P1":    //1
                track.Name         = null;
                track.StartStation = "Start";
                track.EndStation   = "P1";
                track.AddArc(150, 350, 100, 100, 180, 90);
                break;

            case "P1->K1":    //2
                track.Name         = null;
                track.StartStation = "P1";
                track.EndStation   = "K1";
                track.AddLine(200, 350, 350, 350);
                break;

            case "K1->F1":    //3
                track.Name         = "K1S";
                track.StartStation = "K1";
                track.EndStation   = "F1";
                track.AddLine(350, 350, 450, 350);
                break;

            case "K1->T1":    //4
                track.Name         = "K1L";
                track.StartStation = "K1";
                track.EndStation   = "T1";
                track.AddArc(350, 300, 100, 100, 180, 90);
                break;

            case "T1->F1":    //5
                track.Name         = "T1";
                track.StartStation = "T1";
                track.EndStation   = "F1";
                track.AddArc(350, 300, 100, 100, 270, 90);
                break;

            case "F1->P2":    //6
                track.Name         = null;
                track.StartStation = "F1";
                track.EndStation   = "P2";
                track.AddLine(450, 350, 600, 350);
                break;

            case "P2->P4":    //7
                track.Name         = null;
                track.StartStation = "P2";
                track.EndStation   = "P4";
                track.AddArc(550, 350, 100, 100, 270, 180);
                break;

            case "P4->F2":    //8
                track.Name         = null;
                track.StartStation = "P4";
                track.EndStation   = "F2";
                track.AddLine(600, 450, 450, 450);
                break;

            case "F2->K2":    //9
                track.Name         = "F2S";
                track.StartStation = "F2";
                track.EndStation   = "K2";
                track.AddLine(450, 450, 350, 450);
                break;

            case "F2->T2":    //10
                track.Name         = "F2L";
                track.StartStation = "F2";
                track.EndStation   = "T2";
                track.AddArc(350, 400, 100, 100, 0, 90);
                break;

            case "T2->K2":    //11
                track.Name         = "T2";
                track.StartStation = "T2";
                track.EndStation   = "K2";
                track.AddArc(350, 400, 100, 100, 90, 90);
                break;

            case "K2->P3":    //12
                track.Name         = null;
                track.StartStation = "K2";
                track.EndStation   = "P3";
                track.AddLine(350, 450, 200, 450);
                break;

            case "P3->W0":    //13
                track.Name         = "W0";
                track.StartStation = "P3";
                track.EndStation   = "Start";
                track.AddArc(150, 350, 100, 100, 90, 90);
                break;

            default:
                break;
            }
            return(track);
        }