/// 增加几何实例 /// <summary> /// 增加几何实例 /// </summary> public void Add_Geo(WEntity2D E) { int N; if (this.Entities.Count == 0) { N = 0; } else { N = this.Entities[this.Entities.Count - 1].ID + 1; } E.ID = N; if (Layers.Contains(E.Layer) == false) { Layers.Add(E.Layer); } Entities.Add(E); switch (E.Kind) { case GeoKind.Line: WLine2D L = (WLine2D)E; Bounds.Update(L.StartPoint.X, L.StartPoint.Y); Bounds.Update(L.EndPoint.X, L.EndPoint.Y); break; case GeoKind.PolyLine: WPolyLine2D P = (WPolyLine2D)E; for (int i = 0; i < P.Count; i++) { Bounds.Update(P[i].X, P[i].Y); } break; case GeoKind.Spline: break; case GeoKind.Arc: break; case GeoKind.Circle: WCircle2D C = (WCircle2D)E; Bounds.Update(C.Center.X - C.R, C.Center.Y - C.R); Bounds.Update(C.Center.X + C.R, C.Center.Y + C.R); Bounds.Update(C.Center.X - C.R, C.Center.Y + C.R); Bounds.Update(C.Center.X + C.R, C.Center.Y - C.R); break; default: break; } }
private void RenderCircles(ScreenTrans zoom, WCircle2D Circle, bool SnapCheck) { if (SnapCheck == false) { tPen = new Pen(Circle.Color, Circle.LineWidth); } else { tPen = RParas.SnapGeo2DPen; } float R; p0 = Ps[Circle.Center.Num]; R = (float)Circle.R; R = zoom.WorldToScreen(R); G.DrawArc(tPen, new Rectangle((int)(p0.X - R), (int)(p0.Y - R), (int)(R * 2), (int)(R * 2)), 0, 360); }
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(); }