| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using Prism.Mvvm;
- using System.Windows;
- namespace TeamAAS_VP.Models
- {
- /// <summary>
- /// ROI模型
- /// </summary>
- public class RoiModel : BindableBase
- {
- private double _x;
- private double _y;
- private double _width;
- private double _height;
- private double _angle;
- /// <summary>
- /// X坐标
- /// </summary>
- public double X
- {
- get => _x;
- set => SetProperty(ref _x, value);
- }
- /// <summary>
- /// Y坐标
- /// </summary>
- public double Y
- {
- get => _y;
- set => SetProperty(ref _y, value);
- }
- /// <summary>
- /// 宽度
- /// </summary>
- public double Width
- {
- get => _width;
- set => SetProperty(ref _width, value);
- }
- /// <summary>
- /// 高度
- /// </summary>
- public double Height
- {
- get => _height;
- set => SetProperty(ref _height, value);
- }
- /// <summary>
- /// 旋转角度
- /// </summary>
- public double Angle
- {
- get => _angle;
- set => SetProperty(ref _angle, value);
- }
- public bool IsValid => Width > 0 && Height > 0;
- public Rect ToRect() => new Rect(X, Y, Width, Height);
- public override string ToString()
- {
- return IsValid
- ? $"X={X:F0}, Y={Y:F0}, W={Width:F0}, H={Height:F0}, Angle={Angle:F1}°"
- : "未设置";
- }
- }
- }
|