using Prism.Mvvm;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PLCSharp.VVMs.MotionController
{
public class Matrix : BindableBase
{
///
/// 唯一标识
///
[Key]
public Guid ID { get; set; } = Guid.NewGuid();
///
/// 配方标识
///
public Guid RecipeID { get; set; }
private string _Name;
///
/// 名称
///
public string Name
{
get { return _Name; }
set { SetProperty(ref _Name, value); }
}
private string _StartName;
///
///
///
public string StartName
{
get { return _StartName; }
set { SetProperty(ref _StartName, value); }
}
private string _XEndName;
///
/// X方向尾点名
///
public string XEndName
{
get { return _XEndName; }
set { SetProperty(ref _XEndName, value); }
}
private string _YEndName;
///
/// Y方向尾点名
///
public string YEndName
{
get { return _YEndName; }
set { SetProperty(ref _YEndName, value); }
}
private int _XCount;
///
/// X方向点数
///
public int XCount
{
get { return _XCount; }
set { SetProperty(ref _XCount, value); }
}
private int _YCount;
///
/// Y方向点数
///
public int YCount
{
get { return _YCount; }
set { SetProperty(ref _YCount, value); }
}
private int _MatrixType;
///
/// 矩阵元素顺序 0先X后Y,1先Y后X
///
public int MatrixType
{
get { return _MatrixType; }
set { SetProperty(ref _MatrixType, value); }
}
private int _XTarget;
///
/// 手动运行时输入的X目标
///
[NotMapped]
public int XTarget
{
get { return _XTarget; }
set { SetProperty(ref _XTarget, value); }
}
private int _YTarget;
///
/// 手动运行时输入的Y目标
///
[NotMapped]
public int YTarget
{
get { return _YTarget; }
set { SetProperty(ref _YTarget, value); }
}
[NotMapped]
public List Points { get; set; } = [];
public AxisPoint GetPoint(int x, int y)
{
return Points.FirstOrDefault(p => p.XIndex == x && p.YIndex == y);
}
}
}