public static LinkedList <AcDbEntity> Load(TextReader reader) { LinkedList <AcDbEntity> result = new LinkedList <AcDbEntity>(); State state = State.Start; AcDbEntity entity = null; DxfReader rdr = new DxfReader(reader); while (!rdr.IsEof) { DxfNode node = rdr.Read(); if (state == State.Start || node.TypeCode == 0) { // завершаем текущее состояние if (state != State.Start && node.TypeCode == 0) { state = State.Start; } if (node.TypeCode == 0) { switch ((string)node.Value) { case "LWPOLYLINE": entity = new AcDbPolyline(); result.AddLast(entity); state = State.Entity; break; case "LINE": entity = new AcDbLine(); result.AddLast(entity); state = State.Entity; break; case "CIRCLE": entity = new AcDbCircle(); result.AddLast(entity); state = State.Entity; break; case "ARC": entity = new AcDbArc(); result.AddLast(entity); state = State.Entity; break; } } } else if (state == State.Entity) { entity.TakeNode(node); } } return(result); }
public void Visit(AcDbArc arc) { Arc newarc = new Arc(); newarc.Center.X = arc.Center.X; newarc.Center.Y = arc.Center.Y; newarc.Radius = arc.Radius; newarc.StartAngle = arc.StartAngle; newarc.SweepAngle = arc.EndAngle - arc.StartAngle; _entities.AddLast(newarc); }