2023-05-21 22:06:59 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Media;
|
2023-06-27 19:58:08 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
2023-05-21 22:06:59 +08:00
|
|
|
|
using AIStudio.Wpf.DiagramDesigner.Models;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
|
|
|
|
{
|
|
|
|
|
|
public class BlockConnectorInfo : FullyCreatedConnectorInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public BlockConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation) : this(null, dataItem, orientation)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BlockConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation) : base(root, dataItem, orientation)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Orientation == ConnectorOrientation.Left || Orientation == ConnectorOrientation.Right)
|
|
|
|
|
|
{
|
|
|
|
|
|
ConnectorWidth = 4;
|
|
|
|
|
|
ConnectorHeight = double.NaN;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (Orientation == ConnectorOrientation.Top || Orientation == ConnectorOrientation.Bottom)
|
|
|
|
|
|
{
|
|
|
|
|
|
ConnectorWidth = double.NaN;
|
|
|
|
|
|
ConnectorHeight = 4;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BlockConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, SerializableItem serializableItem, string serializableType) : base(root, dataItem, serializableItem, serializableType)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BlockConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, SelectableItemBase designer) : base(root, dataItem, designer)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void InitNew()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.InitNew();
|
|
|
|
|
|
ColorViewModel.LineColor.Color = Colors.Transparent;
|
|
|
|
|
|
ColorViewModel.FillColor.Color = Colors.Transparent;
|
|
|
|
|
|
}
|
2023-05-21 23:03:28 +08:00
|
|
|
|
|
2023-06-17 23:55:54 +08:00
|
|
|
|
public new BlockDesignerItemViewModel DataItem
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return Parent as BlockDesignerItemViewModel;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-05-21 23:03:28 +08:00
|
|
|
|
|
|
|
|
|
|
public override bool CanAttachTo(ConnectorInfoBase port)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (port is BlockConnectorInfo blockConnectorInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
return port != this && !port.IsReadOnly && DataItem != blockConnectorInfo.DataItem;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-05-21 22:06:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|