using Prism.Mvvm;
using System.Windows;
namespace TeamAAS_VP.Models
{
///
/// ROI模型
///
public class RoiModel : BindableBase
{
private double _x;
private double _y;
private double _width;
private double _height;
private double _angle;
///
/// X坐标
///
public double X
{
get => _x;
set => SetProperty(ref _x, value);
}
///
/// Y坐标
///
public double Y
{
get => _y;
set => SetProperty(ref _y, value);
}
///
/// 宽度
///
public double Width
{
get => _width;
set => SetProperty(ref _width, value);
}
///
/// 高度
///
public double Height
{
get => _height;
set => SetProperty(ref _height, value);
}
///
/// 旋转角度
///
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}°"
: "未设置";
}
}
}