using CaeGlobals; using CaeKnowledge.Data; using LiteDB; using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; namespace CaeKnowledge.View { public class ViewCuttingParameter: INotifyPropertyChanged { private CuttingParameter _cuttingParameter; public ViewCuttingParameter() { _cuttingParameter = new CuttingParameter(ObjectId.NewObjectId()); } public ViewCuttingParameter(CuttingParameter cuttingParameter) { _cuttingParameter = cuttingParameter; } public CuttingParameter GetBase() => _cuttingParameter; [Category("1一般信息")] [OrderedDisplayName(0, 3, "编号Pid")] [Description("用于标识切削力系数的唯一标识符,方便后继调用。")] public string Pid { get => _cuttingParameter.Pid; set { _cuttingParameter.Pid = value; OnPropertyChanged(); } } [Category("1一般信息")] [OrderedDisplayName(1, 3, "刀具库号Cid")] [TypeConverter(typeof(CutterConverter))] public string Cid { get => _cuttingParameter.Cid; set { _cuttingParameter.Cid = value; OnPropertyChanged(); } } [Category("1一般信息")] [OrderedDisplayName(2, 3, "工件材料牌号Mat")] [TypeConverter(typeof(ElasticWithDensityConverter))] public string Material { get => _cuttingParameter.Material; set { _cuttingParameter.Material = value; OnPropertyChanged(); } } [Category("2切削力系数")] [OrderedDisplayName(0, 6, "轴向犁切力系数Ae")] public double AxialForceCoefficient { get => _cuttingParameter.AxialForceCoefficient; set { _cuttingParameter.AxialForceCoefficient = value; OnPropertyChanged(); } } [Category("2切削力系数")] [OrderedDisplayName(1, 6, "径向犁切力系数Re")] public double RadialForceCoefficient { get => _cuttingParameter.RadialForceCoefficient; set { _cuttingParameter.RadialForceCoefficient = value; OnPropertyChanged(); } } [Category("2切削力系数")] [OrderedDisplayName(2, 6, "切向犁切力系数Te")] public double TangentialForceCoefficient { get => _cuttingParameter.TangentialForceCoefficient; set { _cuttingParameter.TangentialForceCoefficient = value; OnPropertyChanged(); } } [Category("2切削力系数")] [OrderedDisplayName(3, 6, "轴向刀刃常数Ac")] public double AxialForceConstant { get => _cuttingParameter.AxialForceConstant; set { _cuttingParameter.AxialForceConstant = value; OnPropertyChanged(); } } [Category("2切削力系数")] [OrderedDisplayName(4, 6, "径向刀刃常数Rc")] public double RadialForceConstant { get => _cuttingParameter.RadialForceConstant; set { _cuttingParameter.RadialForceConstant = value; OnPropertyChanged(); } } [Category("2切削力系数")] [OrderedDisplayName(4, 6, "切向刀刃常数Tc")] public double TangentialForceConstant { get => _cuttingParameter.TangentialForceConstant; set { _cuttingParameter.TangentialForceConstant = value; OnPropertyChanged(); } } /* public ViewCuttingParameter DeepClone() { CuttingParameter cp = _cuttingParameter; return new ViewCuttingParameter(cp); } public void Clone(ViewCuttingParameter vcp) { Pid = vcp.Pid; CutterId = vcp.CutterId; Material = vcp.Material; AxialForceCoefficient = vcp.AxialForceCoefficient; RadialForceCoefficient = vcp.RadialForceCoefficient; TangentialForceCoefficient = vcp.TangentialForceCoefficient; AxialForceConstant = vcp.AxialForceConstant; RadialForceConstant = vcp.RadialForceConstant; TangentialForceConstant = vcp.TangentialForceConstant; }*/ public bool IsValid() { return true; } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } protected bool SetField(ref T field, T value, [CallerMemberName] string propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; } } }