using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Shapes; using netDxf; using netDxf.Tables; namespace MetroGauges.Controls { public class BlockRectangle : BaseShap { public BlockRectangle(FrameworkElement shap) : base(shap) { } public override void CopyBlock() { } public override FrameworkElement DirectionShap(Point dirPoint) { throw new NotImplementedException(); } public override void DrawDxfBlocks(DxfDocument dxf, Layer layer) { Rectangle rec = shapeitem as Rectangle; Point p1 = (Point)rec.DataContext; Point p2 = new Point() { X=p1.X+ rec.Width, Y= p1.Y }; Point p3 = new Point() { X=p1.X + rec.Width, Y= p1.Y - rec.Height }; Point p4 = new Point() { X=p1.X, Y=p1.Y -rec.Height }; List points = new List(); points.Add(p1); points.Add(p2); points.Add(p3); points.Add(p4); netDxf.Entities.LwPolyline poly = new netDxf.Entities.LwPolyline() { IsClosed = true }; foreach (var p in points) { poly.Vertexes.Add(new netDxf.Entities.LwPolylineVertex(p.X * m_ScaleRale, -p.Y * m_ScaleRale)); } poly.Layer = layer; dxf.AddEntity(poly); } public override List GetPoints() { List points = new List(); Rectangle rectangle = shapeitem as Rectangle; return points; } public override void MoveBlock(Point currentPoint, Point dragPoint) { //throw new NotImplementedException(); } public override void MoveByX(double x) { //throw new NotImplementedException(); } public override void MoveByY(double y) { //throw new NotImplementedException(); } public override void ScaleBlock(double rate) { //throw new NotImplementedException(); } } }