mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-03 15:46:36 +08:00
序列化继续整理
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public struct ConnectorInfo
|
||||
{
|
||||
public double DesignerItemLeft { get; set; }
|
||||
public double DesignerItemTop { get; set; }
|
||||
public SizeBase DesignerItemSize { get; set; }
|
||||
public PointBase Position { get; set; }
|
||||
public ConnectorOrientation Orientation { get; set; }
|
||||
|
||||
public static ConnectorInfo GetConnectorInfo(ConnectorOrientation orientation, double left, double top, double width, double height, PointBase position)
|
||||
{
|
||||
return new ConnectorInfo()
|
||||
{
|
||||
Orientation = orientation,
|
||||
DesignerItemSize = new SizeBase(width, height),
|
||||
DesignerItemLeft = left,
|
||||
DesignerItemTop = top,
|
||||
Position = position
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
}
|
||||
|
||||
public ConnectionItem(ConnectorViewModel viewmodel) : base(viewmodel)
|
||||
public ConnectionItem(ConnectionViewModel viewmodel) : base(viewmodel)
|
||||
{
|
||||
this.SourceId = viewmodel.SourceConnectorInfo.DataItem.Id;
|
||||
this.SourceOrientation = viewmodel.SourceConnectorInfo.Orientation;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,27 +9,23 @@ using System.Xml.Serialization;
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
/// <summary>
|
||||
/// 连接点
|
||||
/// 完整连接点
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[XmlInclude(typeof(ConnectorItem))]
|
||||
public class ConnectorItem : SelectableItemBase
|
||||
[XmlInclude(typeof(FullyCreatedConnectorInfoItem))]
|
||||
public class FullyCreatedConnectorInfoItem : ConnectorInfoItemBase
|
||||
{
|
||||
public ConnectorItem()
|
||||
public FullyCreatedConnectorInfoItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ConnectorItem(FullyCreatedConnectorInfo viewmodel) : base(viewmodel)
|
||||
public FullyCreatedConnectorInfoItem(FullyCreatedConnectorInfo viewmodel) : base(viewmodel)
|
||||
{
|
||||
XRatio = viewmodel.XRatio;
|
||||
YRatio = viewmodel.YRatio;
|
||||
ConnectorWidth = viewmodel.ConnectorWidth;
|
||||
ConnectorHeight = viewmodel.ConnectorHeight;
|
||||
Orientation = viewmodel.Orientation;
|
||||
IsInnerPoint = viewmodel.IsInnerPoint;
|
||||
ValueTypePoint = viewmodel.ValueTypePoint;
|
||||
ConnectorValue = viewmodel.ConnectorValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,22 +35,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
[XmlAttribute]
|
||||
public double YRatio { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorWidth { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorHeight { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public ConnectorOrientation Orientation { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public bool IsInnerPoint { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public ValueTypePoint ValueTypePoint { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public double ConnectorValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,16 +12,16 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
public ImageDesignerItem(ImageItemViewModel item) : base(item)
|
||||
{
|
||||
Icon = item.Icon;
|
||||
Connectors = new List<ConnectorItem>();
|
||||
Connectors = new List<FullyCreatedConnectorInfoItem>();
|
||||
foreach (var fullyCreatedConnectorInfo in item.Connectors)
|
||||
{
|
||||
ConnectorItem connector = new ConnectorItem(fullyCreatedConnectorInfo);
|
||||
FullyCreatedConnectorInfoItem connector = new FullyCreatedConnectorInfoItem(fullyCreatedConnectorInfo);
|
||||
Connectors.Add(connector);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlArray]
|
||||
public List<ConnectorItem> Connectors { get; set; }
|
||||
public List<FullyCreatedConnectorInfoItem> Connectors { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
public LogicalGateDesignerItemBase(LogicalGateItemViewModelBase item) : base(item)
|
||||
{
|
||||
this.Connectors = new List<ConnectorItem>();
|
||||
this.Connectors = new List<FullyCreatedConnectorInfoItem>();
|
||||
foreach (var fullyCreatedConnectorInfo in item.Connectors)
|
||||
{
|
||||
ConnectorItem connector = new ConnectorItem(fullyCreatedConnectorInfo);
|
||||
FullyCreatedConnectorInfoItem connector = new FullyCreatedConnectorInfoItem(fullyCreatedConnectorInfo);
|
||||
this.Connectors.Add(connector);
|
||||
}
|
||||
this.OrderNumber = item.OrderNumber;
|
||||
@@ -28,7 +28,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
|
||||
[XmlArray]
|
||||
public List<ConnectorItem> Connectors { get; set; }
|
||||
public List<FullyCreatedConnectorInfoItem> Connectors { get; set; }
|
||||
|
||||
[XmlAttribute]
|
||||
public int OrderNumber { get; set; }
|
||||
|
||||
@@ -12,26 +12,26 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
|
||||
public MediaDesignerItem(GifImageItemViewModel item) : base(item)
|
||||
{
|
||||
Connectors = new List<ConnectorItem>();
|
||||
Connectors = new List<FullyCreatedConnectorInfoItem>();
|
||||
foreach (var fullyCreatedConnectorInfo in item.Connectors)
|
||||
{
|
||||
ConnectorItem connector = new ConnectorItem(fullyCreatedConnectorInfo);
|
||||
FullyCreatedConnectorInfoItem connector = new FullyCreatedConnectorInfoItem(fullyCreatedConnectorInfo);
|
||||
Connectors.Add(connector);
|
||||
}
|
||||
}
|
||||
|
||||
public MediaDesignerItem(MediaItemViewModel item) : base(item)
|
||||
{
|
||||
Connectors = new List<ConnectorItem>();
|
||||
Connectors = new List<FullyCreatedConnectorInfoItem>();
|
||||
foreach (var fullyCreatedConnectorInfo in item.Connectors)
|
||||
{
|
||||
ConnectorItem connector = new ConnectorItem(fullyCreatedConnectorInfo);
|
||||
FullyCreatedConnectorInfoItem connector = new FullyCreatedConnectorInfoItem(fullyCreatedConnectorInfo);
|
||||
Connectors.Add(connector);
|
||||
}
|
||||
}
|
||||
|
||||
[XmlArray]
|
||||
public List<ConnectorItem> Connectors { get; set; }
|
||||
public List<FullyCreatedConnectorInfoItem> Connectors { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user