连接线改成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

@@ -105,7 +105,7 @@ namespace Util.DiagramDesigner
}
}
private DrawMode _vectorLineDrawMode = DrawMode.RadiusConnectingLine;
private DrawMode _vectorLineDrawMode = DrawMode.CornerConnectingLine;
public DrawMode VectorLineDrawMode
{
get

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();
}
}

View File

@@ -117,7 +117,7 @@ namespace Util.DiagramDesigner
}
}
private Size _gridCellSize = new Size(50, 50);
private Size _gridCellSize = new Size(100, 100);
public Size GridCellSize
{
get
@@ -130,6 +130,32 @@ namespace Util.DiagramDesigner
}
}
public double GridCellWidth
{
get
{
return _gridCellSize.Width;
}
set
{
_gridCellSize.Width = value;
RaisePropertyChanged(nameof(GridCellSize));
}
}
public double GridCellHeight
{
get
{
return _gridCellSize.Height;
}
set
{
_gridCellSize.Height = value;
RaisePropertyChanged(nameof(GridCellSize));
}
}
private Color _pageBackground = Colors.White;
public Color PageBackground
{