连接线改成path绘制,方便绘制曲线

This commit is contained in:
akwkevin
2021-08-06 18:12:05 +08:00
parent e9c043ae3a
commit 8bec38e040
17 changed files with 494 additions and 124 deletions

View File

@@ -10,16 +10,16 @@ namespace Util.DiagramDesigner
{
public class ConnectorViewModel : SelectableDesignerItemViewModelBase
{
private IDiagramServiceProvider _service { get { return DiagramServicesProvider.Instance.Provider; } }
public ConnectorViewModel(IDiagramViewModel parent, FullyCreatedConnectorInfo sourceConnectorInfo, FullyCreatedConnectorInfo sinkConnectorInfo,
SelectableDesignerItemBase designer) : base(parent, designer)
SelectableDesignerItemBase designer, DrawMode vectorLineDrawMode) : base(parent, designer)
{
VectorLineDrawMode = vectorLineDrawMode;
Init(sourceConnectorInfo, sinkConnectorInfo);
}
public ConnectorViewModel(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo)
public ConnectorViewModel(FullyCreatedConnectorInfo sourceConnectorInfo, ConnectorInfoBase sinkConnectorInfo, DrawMode vectorLineDrawMode)
{
VectorLineDrawMode = vectorLineDrawMode;
Init(sourceConnectorInfo, sinkConnectorInfo);
}
@@ -120,13 +120,15 @@ namespace Util.DiagramDesigner
private set
{
if (SetProperty(ref _area, value))
{
{
UpdateConnectionPoints();
OutTextItemLocation(_area, value);
}
}
}
public DrawMode VectorLineDrawMode { get; set; }
public ConnectorInfo ConnectorInfo(ConnectorOrientation orientation, double left, double top, double width, double height, Point position)
{
@@ -189,11 +191,11 @@ namespace Util.DiagramDesigner
private void UpdateConnectionPoints()
{
if (_service.DrawModeViewModel.VectorLineDrawMode == DrawMode.ConnectingLine)
if (VectorLineDrawMode == DrawMode.ConnectingLine)
{
UpdateConnectionPointsByLine();
}
else if (_service.DrawModeViewModel.VectorLineDrawMode == DrawMode.BoundaryConnectingLine)
else if (VectorLineDrawMode == DrawMode.BoundaryConnectingLine)
{
UpdateConnectionPointsByBoundary();
}
@@ -247,7 +249,7 @@ namespace Util.DiagramDesigner
}
else
{
ConnectionPoints = PointInfoBase.ToList(PathFinder.GetConnectionLine(sourceInfo, points[1], SourceConnectorInfo.Orientation, SourceConnectorInfo.IsInnerPoint));
ConnectionPoints = PointInfoBase.ToList(PathFinder.GetConnectionLine(sourceInfo, points[1], SourceConnectorInfo.Orientation, false, SourceConnectorInfo.IsInnerPoint));
EndPoint = new Point();
}
}