private static List <DxfEntity> OffsetToNest(IList <DxfEntity> dxfEntities, DxfPoint pivot, DxfPoint offset, double rotationAngle) { List <DxfEntity> dxfreturn = new List <DxfEntity>(); List <DxfPoint> tmpPts; foreach (DxfEntity entity in dxfEntities) { switch (entity.EntityType) { case DxfEntityType.Arc: DxfArc dxfArc = (DxfArc)entity; dxfArc.Center = RotateLocation(rotationAngle, dxfArc.Center); dxfArc.Center += offset; dxfArc.StartAngle += rotationAngle; dxfArc.EndAngle += rotationAngle; dxfreturn.Add(dxfArc); break; case DxfEntityType.ArcAlignedText: DxfArcAlignedText dxfArcAligned = (DxfArcAlignedText)entity; dxfArcAligned.CenterPoint = RotateLocation(rotationAngle, dxfArcAligned.CenterPoint); dxfArcAligned.CenterPoint += offset; dxfArcAligned.StartAngle += rotationAngle; dxfArcAligned.EndAngle += rotationAngle; dxfreturn.Add(dxfArcAligned); break; case DxfEntityType.Attribute: DxfAttribute dxfAttribute = (DxfAttribute)entity; dxfAttribute.Location = RotateLocation(rotationAngle, dxfAttribute.Location); dxfAttribute.Location += offset; dxfreturn.Add(dxfAttribute); break; case DxfEntityType.AttributeDefinition: DxfAttributeDefinition dxfAttributecommon = (DxfAttributeDefinition)entity; dxfAttributecommon.Location = RotateLocation(rotationAngle, dxfAttributecommon.Location); dxfAttributecommon.Location += offset; dxfreturn.Add(dxfAttributecommon); break; case DxfEntityType.Circle: DxfCircle dxfCircle = (DxfCircle)entity; dxfCircle.Center = RotateLocation(rotationAngle, dxfCircle.Center); dxfCircle.Center += offset; dxfreturn.Add(dxfCircle); break; case DxfEntityType.Ellipse: DxfEllipse dxfEllipse = (DxfEllipse)entity; dxfEllipse.Center = RotateLocation(rotationAngle, dxfEllipse.Center); dxfEllipse.Center += offset; dxfreturn.Add(dxfEllipse); break; case DxfEntityType.Image: DxfImage dxfImage = (DxfImage)entity; dxfImage.Location = RotateLocation(rotationAngle, dxfImage.Location); dxfImage.Location += offset; dxfreturn.Add(dxfImage); break; case DxfEntityType.Leader: DxfLeader dxfLeader = (DxfLeader)entity; tmpPts = new List <DxfPoint>(); foreach (DxfPoint vrt in dxfLeader.Vertices) { var tmppnt = RotateLocation(rotationAngle, vrt); tmppnt += offset; tmpPts.Add(tmppnt); } dxfLeader.Vertices.Clear(); dxfLeader.Vertices.Concat(tmpPts); dxfreturn.Add(dxfLeader); break; case DxfEntityType.Line: DxfLine dxfLine = (DxfLine)entity; dxfLine.P1 = RotateLocation(rotationAngle, dxfLine.P1); dxfLine.P2 = RotateLocation(rotationAngle, dxfLine.P2); dxfLine.P1 += offset; dxfLine.P2 += offset; dxfreturn.Add(dxfLine); break; case DxfEntityType.LwPolyline: DxfPolyline dxfPoly = (DxfPolyline)entity; foreach (DxfVertex vrt in dxfPoly.Vertices) { vrt.Location = RotateLocation(rotationAngle, vrt.Location); vrt.Location += offset; } dxfreturn.Add(dxfPoly); break; case DxfEntityType.MLine: DxfMLine mLine = (DxfMLine)entity; tmpPts = new List <DxfPoint>(); mLine.StartPoint += offset; mLine.StartPoint = RotateLocation(rotationAngle, mLine.StartPoint); foreach (DxfPoint vrt in mLine.Vertices) { var tmppnt = RotateLocation(rotationAngle, vrt); tmppnt += offset; tmpPts.Add(tmppnt); } mLine.Vertices.Clear(); mLine.Vertices.Concat(tmpPts); dxfreturn.Add(mLine); break; case DxfEntityType.Polyline: DxfPolyline polyline = (DxfPolyline)entity; List <DxfVertex> verts = new List <DxfVertex>(); foreach (DxfVertex vrt in polyline.Vertices) { var tmppnt = vrt; tmppnt.Location = RotateLocation(rotationAngle, tmppnt.Location); tmppnt.Location += offset; verts.Add(tmppnt); } DxfPolyline polyout = new DxfPolyline(verts); polyout.Location = polyline.Location + offset; polyout.IsClosed = polyline.IsClosed; polyout.Layer = polyline.Layer; dxfreturn.Add(polyout); break; case DxfEntityType.Body: case DxfEntityType.DgnUnderlay: case DxfEntityType.Dimension: case DxfEntityType.DwfUnderlay: case DxfEntityType.Face: case DxfEntityType.Helix: case DxfEntityType.Insert: case DxfEntityType.Light: case DxfEntityType.ModelerGeometry: case DxfEntityType.MText: case DxfEntityType.OleFrame: case DxfEntityType.Ole2Frame: case DxfEntityType.PdfUnderlay: case DxfEntityType.Point: case DxfEntityType.ProxyEntity: case DxfEntityType.Ray: case DxfEntityType.Region: case DxfEntityType.RText: case DxfEntityType.Section: case DxfEntityType.Seqend: case DxfEntityType.Shape: case DxfEntityType.Solid: case DxfEntityType.Spline: case DxfEntityType.Text: case DxfEntityType.Tolerance: case DxfEntityType.Trace: case DxfEntityType.Underlay: case DxfEntityType.Vertex: case DxfEntityType.WipeOut: case DxfEntityType.XLine: throw new ArgumentException("unsupported entity type: " + entity.EntityType); } } return(dxfreturn); }
public static Polyline ToPolyline(this DxfLeader leader) { return(new Polyline(leader.Vertices.Select(v => new Vertex(v.ToPoint())), leader.GetEntityColor(), leader)); }
public Class291(DxfLeader leader) : base((DxfEntity)leader) { }