using AIStudio.Wpf.DiagramDesigner.Geometrys; namespace AIStudio.Wpf.DiagramDesigner { public class ConnectorVertexModel : ConnectorPoint { public ConnectorVertexModel(ConnectorViewModel parent, PointBase? position = null) { Parent = parent; X = position?.X ?? 0; Y = position?.Y ?? 0; DeleteVertexCommand = new SimpleCommand(DeleteVertex); } public ConnectorViewModel Parent { get; } public override PointBase Position { get { return new PointBase(Parent.Area.Left + Left, Parent.Area.Top + Top); } } public override PointBase MiddlePosition => new PointBase(Parent.Area.Left + Left + ConnectorWidth / 2, Parent.Area.Top + Top + ConnectorHeight / 2); public SimpleCommand DeleteVertexCommand { get; set; } private void DeleteVertex(object parameter) { if (parameter is ConnectorVertexModel vertice) { Parent.Vertices.Remove(vertice); } } } }