Files
2026-02-23 17:02:55 +08:00

89 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;
using netDxf;
using netDxf.Tables;
namespace MetroGauges.Controls
{
public class BlockCircle : BaseShap
{
public BlockCircle(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)
{
Path path = shapeitem as Path;
EllipseGeometry ellipseGeometry = path.Data as EllipseGeometry;
Point p1 = (Point)path.DataContext;
Vector3 center = new Vector3();
center.X = p1.X * m_ScaleRale;
center.Y = p1.Y * m_ScaleRale;
netDxf.Entities.Circle circle = new netDxf.Entities.Circle(center, ellipseGeometry.RadiusX * m_ScaleRale);
circle.Layer = layer;
dxf.AddEntity(circle);
}
public override List<Point> GetPoints()
{
List<Point> points = new List<Point>();
Path path = shapeitem as Path;
EllipseGeometry ellipseGeometry = path.Data as EllipseGeometry;
Point p0 = (Point)path.DataContext;
Point p1 = new Point() { X = p0.X + ellipseGeometry.RadiusX, Y = p0.Y };
Point p2 = new Point() { X = p0.X - ellipseGeometry.RadiusX, Y = p0.Y };
Point p3 = new Point() { X = p0.X , Y = p0.Y + ellipseGeometry.RadiusY };
Point p4 = new Point() { X = p0.X , Y = p0.Y - ellipseGeometry.RadiusY };
points.Add(p1);
points.Add(p2);
points.Add(p3);
points.Add(p4);
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();
}
}
}