Exemple #1
0
        }//Draw方法——关联点

        public static void Draw(List <Point> ptlist, Graphics g, int size, int i, Lineshape line)
        { //绘制线或面
            Pen   line_pen   = new Pen(line.color_out, size);
            Brush poly_brush = new SolidBrush(line.color_in);

            switch (i)
            {
            case 1:    //画直线段
                g.DrawLines(line_pen, ptlist.ToArray());
                break;

            case 2:    //画弧线段
                g.DrawCurve(line_pen, ptlist.ToArray());
                break;

            case 3:    //画直段面
            {
                g.DrawPolygon(line_pen, ptlist.ToArray());
                g.FillPolygon(poly_brush, ptlist.ToArray());
            }
            break;

            case 4:    //画弧线面
            {
                g.FillClosedCurve(poly_brush, ptlist.ToArray());
                g.DrawClosedCurve(line_pen, ptlist.ToArray());
            }
            break;
            }
        }//Draw方法——线段/面
Exemple #2
0
        }//DataType方法,判断导入数据类型

        public static void Importfile(StreamReader f, Graphics g, int Height, int Width)
        {
            while (f.Peek() > -1)               //判断文件有没有读取完
            {
                string tmp = f.ReadLine();      //读取第一行信息
                switch (Funcs.DataType(tmp))    //根据数据类型绘制
                {
                case 1:                         //为实体点
                {
                    string temp = f.ReadLine(); //再读一行字符串,判断是否为空,不为空就录入
                    while (temp != null && temp != ",,,")
                    {                           //实例化实体点并加入实体点集
                        Realpoint realpoint = new Realpoint(temp);
                        MyGlo.rplist.Add(realpoint);
                        temp = f.ReadLine();
                    }    //while
                }        //case 1
                break;

                case 2:    //为注记点
                {
                    string temp = f.ReadLine();
                    while (temp != null && temp != ",,,")
                    {
                        Notepoint notepoint = new Notepoint(temp);
                        MyGlo.nplist.Add(notepoint);
                        temp = f.ReadLine();
                    }
                }        //case 2
                break;

                case 3:     //为常规线
                {
                    string           temp    = f.ReadLine();
                    List <Basepoint> bt_temp = new List <Basepoint>();
                    while (temp != null && temp != ",,,")
                    {
                        Linkpoint linkpoint = new Linkpoint(temp);
                        bt_temp.Add(linkpoint);
                        temp = f.ReadLine();
                    }
                    Lineshape lineshape = new Lineshape(bt_temp, tmp); //实例化线对象
                    MyGlo.llist.Add(lineshape);                        //加入列表
                }                                                      //case3
                break;

                case 4:     //为弧线
                {
                    string           temp    = f.ReadLine();
                    List <Basepoint> bt_temp = new List <Basepoint>();
                    while (temp != null && temp != ",,,")
                    {
                        Linkpoint linkpoint = new Linkpoint(temp);
                        bt_temp.Add(linkpoint);
                        temp = f.ReadLine();
                    }
                    Lineshape lineshape = new Lineshape(bt_temp, tmp);
                    MyGlo.llist.Add(lineshape);
                }
                break;         //case4

                case 5:
                {
                    string           temp    = f.ReadLine();
                    List <Basepoint> bt_temp = new List <Basepoint>();
                    while (temp != null && temp != ",,,")
                    {
                        Linkpoint linkpoint = new Linkpoint(temp);
                        bt_temp.Add(linkpoint);
                        temp = f.ReadLine();
                    }
                    Lineshape lineshape = new Lineshape(bt_temp, tmp);
                    MyGlo.llist.Add(lineshape);
                }
                break;        //case5

                case 6:
                {
                    string           temp    = f.ReadLine();
                    List <Basepoint> bt_temp = new List <Basepoint>();
                    while (temp != null && temp != ",,,")
                    {
                        Linkpoint linkpoint = new Linkpoint(temp);
                        bt_temp.Add(linkpoint);
                        temp = f.ReadLine();
                    }
                    Lineshape lineshape = new Lineshape(bt_temp, tmp);
                    MyGlo.llist.Add(lineshape);
                }
                break;        //case6
                }//switch   Funcs.Update(g, Width, Height);
            }//while
        } //importfile,导入roi