mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-04 16:16:34 +08:00
序列化继续整理
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 连接点
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[XmlInclude(typeof(ConnectorInfoItemBase))]
|
||||
public class ConnectorInfoItemBase : SelectableItemBase
|
||||
{
|
||||
public ConnectorInfoItemBase()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ConnectorInfoItemBase(ConnectorInfoBase viewmodel) : base(viewmodel)
|
||||
{
|
||||
ConnectorWidth = viewmodel.ConnectorWidth;
|
||||
ConnectorHeight = viewmodel.ConnectorHeight;
|
||||
Orientation = viewmodel.Orientation;
|
||||
ConnectorValue = viewmodel.ConnectorValue;
|
||||
}
|
||||
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorWidth
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorHeight
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public ConnectorOrientation Orientation
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorValue
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接点文字
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[XmlInclude(typeof(ConnectorLabelItem))]
|
||||
public class ConnectorLabelItem : ConnectorPointItem
|
||||
{
|
||||
public ConnectorLabelItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ConnectorLabelItem(ConnectorLabelModel viewmodel) : base(viewmodel)
|
||||
{
|
||||
Distance = viewmodel.Distance;
|
||||
Offset = viewmodel.Offset;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double? Distance
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlIgnore]
|
||||
public Point Offset
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
[XmlAttribute("Offset")]
|
||||
public string XmlOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return SerializeHelper.SerializePoint(Offset);
|
||||
}
|
||||
set
|
||||
{
|
||||
Offset = SerializeHelper.DeserializePoint(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 连接中间点
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[XmlInclude(typeof(ConnectorPointItem))]
|
||||
public class ConnectorPointItem : SelectableItemBase
|
||||
{
|
||||
public ConnectorPointItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ConnectorPointItem(ConnectorPointModel viewmodel) : base(viewmodel)
|
||||
{
|
||||
X = viewmodel.X;
|
||||
Y = viewmodel.Y;
|
||||
ConnectorWidth = viewmodel.ConnectorWidth;
|
||||
ConnectorHeight = viewmodel.ConnectorHeight;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double X
|
||||
{
|
||||
get;set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double Y
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorWidth
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorHeight
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接线。中间点
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[XmlInclude(typeof(ConnectorVertexItem))]
|
||||
public class ConnectorVertexItem : ConnectorPointItem
|
||||
{
|
||||
public ConnectorVertexItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ConnectorVertexItem(ConnectorVertexModel viewmodel) : base(viewmodel)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
/// <summary>
|
||||
/// 完整连接点
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[XmlInclude(typeof(FullyCreatedConnectorInfoItem))]
|
||||
public class FullyCreatedConnectorInfoItem : ConnectorInfoItemBase
|
||||
{
|
||||
public FullyCreatedConnectorInfoItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public FullyCreatedConnectorInfoItem(FullyCreatedConnectorInfo viewmodel) : base(viewmodel)
|
||||
{
|
||||
XRatio = viewmodel.XRatio;
|
||||
YRatio = viewmodel.YRatio;
|
||||
IsInnerPoint = viewmodel.IsInnerPoint;
|
||||
ValueTypePoint = viewmodel.ValueTypePoint;
|
||||
}
|
||||
|
||||
|
||||
[XmlAttribute]
|
||||
public double XRatio { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public double YRatio { get; set; }
|
||||
|
||||
|
||||
[XmlAttribute]
|
||||
public bool IsInnerPoint { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public ValueTypePoint ValueTypePoint { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user