Esempio n. 1
0
        private static void Read_Line(ref StreamReader sr, ref WGeometry2D WGC)
        {
            tLayer = sr.ReadLine();
            t_1    = sr.ReadLine().Split(',');
            tColor = Color.FromArgb(Convert.ToInt16(t_1[0]), Convert.ToInt16(t_1[1]), Convert.ToInt16(t_1[2]));
            tWidth = Convert.ToSingle(sr.ReadLine());
            t_1    = sr.ReadLine().Split(',');
            x1     = Convert.ToDouble(t_1[0]);
            y1     = Convert.ToDouble(t_1[1]);

            t_1 = sr.ReadLine().Split(',');
            x2  = Convert.ToDouble(t_1[0]);
            y2  = Convert.ToDouble(t_1[1]);
            /////
            if (Math.Abs(x1 - x2) <= WGeos2D_Paras.E_Merge &&
                Math.Abs(y1 - y2) <= WGeos2D_Paras.E_Merge)
            {
                sr.ReadLine();
                return;
            }

            WLine2D L = new WLine2D(WGC.PsList.Add(x1, y1, true), WGC.PsList.Add(x2, y2, true));

            L.Kind      = GeoKind.Line;
            L.Layer     = tLayer;
            L.Color     = tColor;
            L.LineWidth = tWidth;
            L.Sort      = ShowSort._5;
            WGC.Add_Geo(L);
            sr.ReadLine();
        }
Esempio n. 2
0
        private static void Read_PolyLine(ref StreamReader sr, ref WGeometry2D WGC)
        {
            tLayer = sr.ReadLine();
            t_1    = sr.ReadLine().Split(',');
            tColor = Color.FromArgb(Convert.ToInt16(t_1[0]), Convert.ToInt16(t_1[1]), Convert.ToInt16(t_1[2]));
            tWidth = Convert.ToSingle(sr.ReadLine());
            int Q = Convert.ToInt32(sr.ReadLine());

            tPs  = new List <WPoint2D>();
            tPst = new WPoint2D[Q];

            for (int i = 0; i < Q; i++)
            {
                t_1     = sr.ReadLine().Split(',');
                tPst[i] = new WPoint2D(Convert.ToDouble(t_1[0]), Convert.ToDouble(t_1[1]));
            }

            tPs.Add(WGC.PsList.Add(tPst[0].X, tPst[0].Y, true));

            for (int i = 1; i < Q - 1; i++)
            {
                if (Near_Check(tPst[i], tPst[i - 1]) == false && Near_Check(tPst[i], tPst[i + 1]) == false)
                {
                    tPs.Add(WGC.PsList.Add(tPst[i].X, tPst[i].Y, false));
                }
            }
            tPs.Add(WGC.PsList.Add(tPst[Q - 1].X, tPst[Q - 1].Y, true));
            tPst = null;
            /////
            if (tPs.Count < 2)
            {
                sr.ReadLine();
                return;
            }
            WPolyLine2D PL = new WPolyLine2D(tPs, ref WGC);

            PL.Kind      = GeoKind.PolyLine;
            PL.Layer     = tLayer;
            PL.Color     = tColor;
            PL.LineWidth = tWidth;
            PL.Sort      = ShowSort._5;
            WGC.Add_Geo(PL);
            sr.ReadLine();
        }
Esempio n. 3
0
        private static void Read_Circle(ref StreamReader sr, ref WGeometry2D WGC)
        {
            tLayer = sr.ReadLine();
            t_1    = sr.ReadLine().Split(',');
            tColor = Color.FromArgb(Convert.ToInt16(t_1[0]), Convert.ToInt16(t_1[1]), Convert.ToInt16(t_1[2]));
            tWidth = Convert.ToSingle(sr.ReadLine());
            t_1    = sr.ReadLine().Split(',');
            x1     = Convert.ToDouble(t_1[0]);
            y1     = Convert.ToDouble(t_1[1]);
            x2     = Convert.ToDouble(sr.ReadLine());

            WCircle2D C = new WCircle2D(WGC.PsList.Add(x1, y1, true), x2, ref WGC);

            C.Kind      = GeoKind.Circle;
            C.Layer     = tLayer;
            C.Color     = tColor;
            C.LineWidth = tWidth;
            C.Sort      = ShowSort._5;
            WGC.Add_Geo(C);
            sr.ReadLine();
        }
Esempio n. 4
0
        /// <summary>
        /// 在世界中加入线的编号
        /// </summary>
        /// <param name="Curves"></param>
        /// <param name="WGC"></param>
        private static void Add_CurveNum(ref WEntity2D[] Curves, ref WGeometry2D WGC)
        {
            string   N;
            WPoint2D S, E;
            int      A;
            WPoint2D P = new WPoint2D();

            for (int i = 0; i < Curves.Length; i++)
            {
                N = Convert.ToString(i);
                if (Curves[i].Kind == GeoKind.Line)
                {
                    S = ((WCurve2D)Curves[i]).StartPoint;
                    E = ((WCurve2D)Curves[i]).EndPoint;
                    P = new WPoint2D((S.X + E.X) / 2, (S.Y + E.Y) / 2);
                }
                if (Curves[i].Kind == GeoKind.PolyLine)
                {
                    A = ((WPolyLine2D)Curves[i]).Count / 2;
                    P = ((WPolyLine2D)Curves[i])[A];
                }
                WGC.Add_Geo(new WText2D(N, P, 10));
            }
        }