2022-10-28 22:45:39 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner;
|
2023-02-11 23:51:48 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
|
|
2022-10-28 22:45:39 +08:00
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
|
[XmlInclude(typeof(DesignerItemBase))]
|
2023-01-24 16:20:39 +08:00
|
|
|
|
public class DesignerItemBase : SelectableItemBase
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
public DesignerItemBase()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DesignerItemBase(DesignerItemViewModelBase viewmodel, string reserve = null) : base(viewmodel)
|
|
|
|
|
|
{
|
2023-02-11 22:20:24 +08:00
|
|
|
|
this.PhysicalLeft = viewmodel.PhysicalLeft;
|
|
|
|
|
|
this.PhysicalTop = viewmodel.PhysicalTop;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
this.Angle = viewmodel.Angle;
|
|
|
|
|
|
this.ScaleX = viewmodel.ScaleX;
|
|
|
|
|
|
this.ScaleY = viewmodel.ScaleY;
|
2023-02-11 22:20:24 +08:00
|
|
|
|
this.PhysicalItemWidth = viewmodel.PhysicalItemWidth;
|
|
|
|
|
|
this.PhysicalItemHeight = viewmodel.PhysicalItemHeight;
|
2021-07-23 09:42:22 +08:00
|
|
|
|
this.Icon = viewmodel.Icon;
|
|
|
|
|
|
this.ItemTypeName = viewmodel.GetType().FullName;
|
|
|
|
|
|
this.Margin = viewmodel.Margin;
|
|
|
|
|
|
this.Reserve = reserve;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-02-11 23:51:48 +08:00
|
|
|
|
[XmlAttribute("Left")]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double PhysicalLeft
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-02-11 23:51:48 +08:00
|
|
|
|
[XmlAttribute("Top")]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double PhysicalTop
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double Angle
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double ScaleX
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double ScaleY
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double Margin
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-02-11 23:51:48 +08:00
|
|
|
|
[JsonProperty(PropertyName = "ItemWidth")]
|
|
|
|
|
|
[XmlAttribute("ItemWidth")]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double PhysicalItemWidth
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
2023-02-11 23:51:48 +08:00
|
|
|
|
[JsonProperty(PropertyName = "ItemHeight")]
|
|
|
|
|
|
[XmlAttribute("ItemHeight")]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public double PhysicalItemHeight
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public string Icon
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public string Reserve
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
[XmlAttribute]
|
2023-02-11 22:20:24 +08:00
|
|
|
|
public string ItemTypeName
|
|
|
|
|
|
{
|
|
|
|
|
|
get; set;
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|