using CommunityToolkit.Mvvm.ComponentModel; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Input; using Zhaoxi.VisionFrame.Base; namespace Zhaoxi.VisionFrame.Models { public class NodeModel : ObservableObject { // 每个节点实例 唯一编号 public string NodeId { get; } = Guid.NewGuid().ToString(); public object TargetNodeObject { get; set; } private double _x; public double X { get { return _x; } set { SetProperty(ref _x, value); } } private double _y; public double Y { get { return _y; } set { SetProperty(ref _y, value); } } public double W { get; set; } public double H { get; set; } private bool _isSelected = false; public bool IsSelected { get { return _isSelected; } set { SetProperty(ref _isSelected, value); } } public bool ShowAnchorT { get; set; } = true; public bool ShowAnchorB { get; set; } = true; public bool ShowAnchorL { get; set; } = true; public bool ShowAnchorR { get; set; } = true; public void SetAnchorShow(string anchor, bool show) { PropertyInfo pi = this.GetType().GetProperty("ShowAnchor" + anchor); if (pi != null) { pi.SetValue(this, show); this.OnPropertyChanged("ShowAnchor" + anchor); } } } }